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
13#include <linux/types.h>13#include <linux/types.h>
14#include <linux/socket.h> /* for SO_TIMESTAMPING */14#include <linux/socket.h> /* for SO_TIMESTAMPING */
15 15
16/* SO_TIMESTAMPING gets an integer bit field comprised of these values */16/* SO_TIMESTAMPING flags */
17enum {17enum {
18 SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),18 SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
19 SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),19 SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
@@ -30,8 +30,9 @@ enum { · 10 unmodified lines
30 SOF_TIMESTAMPING_OPT_STATS = (1<<12),30 SOF_TIMESTAMPING_OPT_STATS = (1<<12),
31 SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13),31 SOF_TIMESTAMPING_OPT_PKTINFO = (1<<13),
32 SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14),32 SOF_TIMESTAMPING_OPT_TX_SWHW = (1<<14),
33 SOF_TIMESTAMPING_BIND_PHC = (1 << 15),
33 34
34 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_TX_SWHW,35 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_BIND_PHC,
35 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |36 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
36 SOF_TIMESTAMPING_LAST37 SOF_TIMESTAMPING_LAST
37};38};
@@ -46,6 +47,18 @@ enum { · 8 unmodified lines
46 SOF_TIMESTAMPING_TX_SCHED | \47 SOF_TIMESTAMPING_TX_SCHED | \
47 SOF_TIMESTAMPING_TX_ACK)48 SOF_TIMESTAMPING_TX_ACK)
48 49
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 */
57struct so_timestamping {
58 int flags;
59 int bind_phc;
60};
61
49/**62/**
50 * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter63 * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter
51 *64 *

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