History

net: sock: extend SO_TIMESTAMPING for PHC binding

Since PTP virtual clock support is added, there can be several PTP virtual clocks based on one PTP physical clock for timestamping. This patch is to extend SO_TIMESTAMPING API to support PHC (PTP Hardware Clock) binding by adding a new flag SOF_TIMESTAMPING_BIND_PHC. When PTP virtual clocks are in use, user space can configure to bind one for timestamping, but PTP physical clock is not supported and not needed to bind. This patch is preparation for timestamp conversion from raw timestamp to a specific PTP virtual clock time in core net.

Yangbo Lu committed 5 years ago

Commit d4631261 parent 6c9a0a05 files · +101 −13Browse files

Showing the changes to include/uapi/linux (1 of 5 files). Show all

Unified · Split

include/uapi/linux/net_tstamp.h+15−2
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 #include <linux/types.h>
1414 #include <linux/socket.h> /* for SO_TIMESTAMPING */
1515
16−/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
16+/* SO_TIMESTAMPING flags */
1717 enum {
1818 SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
1919 SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
@@ -30,8 +30,9 @@ enum { · 10 unmodified lines
3030 SOF_TIMESTAMPING_OPT_STATS = (1<<12),
3131 SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13),
3232 SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14),
33+ SOF_TIMESTAMPING_BIND_PHC = (1 << 15),
3334
34− SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW,
35+ SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_BIND_PHC,
3536 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
3637 SOF_TIMESTAMPING_LAST
3738 };
@@ -46,6 +47,18 @@ enum { · 8 unmodified lines
4647 SOF_TIMESTAMPING_TX_SCHED | \
4748 SOF_TIMESTAMPING_TX_ACK)
4849
50+/**
51+ * struct so_timestamping - SO_TIMESTAMPING parameter
52+ *
53+ * @flags: SO_TIMESTAMPING flags
54+ * @bind_phc: Index of PTP virtual clock bound to sock. This is available
55+ * if flag SOF_TIMESTAMPING_BIND_PHC is set.
56+ */
57+struct so_timestamping {
58+ int flags;
59+ int bind_phc;
60+};
61+
4962 /**
5063 * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter
5164 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t