diff options
-rw-r--r-- | Documentation/networking/timestamping.txt | 9 | ||||
-rw-r--r-- | include/uapi/linux/net_tstamp.h | 14 | ||||
-rw-r--r-- | include/uapi/linux/sockios.h | 3 | ||||
-rw-r--r-- | net/core/dev_ioctl.c | 2 | ||||
-rw-r--r-- | net/socket.c | 1 |
5 files changed, 19 insertions, 10 deletions
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt index 98097d8cb910..661d3c316a17 100644 --- a/Documentation/networking/timestamping.txt +++ b/Documentation/networking/timestamping.txt | |||
@@ -85,7 +85,7 @@ Filled in if SOF_TIMESTAMPING_SYS_HARDWARE is set. Requires support | |||
85 | by the network device and will be empty without that support. | 85 | by the network device and will be empty without that support. |
86 | 86 | ||
87 | 87 | ||
88 | SIOCSHWTSTAMP: | 88 | SIOCSHWTSTAMP, SIOCGHWTSTAMP: |
89 | 89 | ||
90 | Hardware time stamping must also be initialized for each device driver | 90 | Hardware time stamping must also be initialized for each device driver |
91 | that is expected to do hardware time stamping. The parameter is defined in | 91 | that is expected to do hardware time stamping. The parameter is defined in |
@@ -115,6 +115,10 @@ Only a processes with admin rights may change the configuration. User | |||
115 | space is responsible to ensure that multiple processes don't interfere | 115 | space is responsible to ensure that multiple processes don't interfere |
116 | with each other and that the settings are reset. | 116 | with each other and that the settings are reset. |
117 | 117 | ||
118 | Any process can read the actual configuration by passing this | ||
119 | structure to ioctl(SIOCGHWTSTAMP) in the same way. However, this has | ||
120 | not been implemented in all drivers. | ||
121 | |||
118 | /* possible values for hwtstamp_config->tx_type */ | 122 | /* possible values for hwtstamp_config->tx_type */ |
119 | enum { | 123 | enum { |
120 | /* | 124 | /* |
@@ -157,7 +161,8 @@ DEVICE IMPLEMENTATION | |||
157 | 161 | ||
158 | A driver which supports hardware time stamping must support the | 162 | A driver which supports hardware time stamping must support the |
159 | SIOCSHWTSTAMP ioctl and update the supplied struct hwtstamp_config with | 163 | SIOCSHWTSTAMP ioctl and update the supplied struct hwtstamp_config with |
160 | the actual values as described in the section on SIOCSHWTSTAMP. | 164 | the actual values as described in the section on SIOCSHWTSTAMP. It |
165 | should also support SIOCGHWTSTAMP. | ||
161 | 166 | ||
162 | Time stamps for received packets must be stored in the skb. To get a pointer | 167 | Time stamps for received packets must be stored in the skb. To get a pointer |
163 | to the shared time stamp structure of the skb call skb_hwtstamps(). Then | 168 | to the shared time stamp structure of the skb call skb_hwtstamps(). Then |
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h index c9a7de2a6276..f53879c0f590 100644 --- a/include/uapi/linux/net_tstamp.h +++ b/include/uapi/linux/net_tstamp.h | |||
@@ -26,17 +26,17 @@ enum { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * struct hwtstamp_config - %SIOCSHWTSTAMP parameter | 29 | * struct hwtstamp_config - %SIOCGHWTSTAMP and %SIOCSHWTSTAMP parameter |
30 | * | 30 | * |
31 | * @flags: no flags defined right now, must be zero | 31 | * @flags: no flags defined right now, must be zero for %SIOCSHWTSTAMP |
32 | * @tx_type: one of HWTSTAMP_TX_* | 32 | * @tx_type: one of HWTSTAMP_TX_* |
33 | * @rx_filter: one of HWTSTAMP_FILTER_* | 33 | * @rx_filter: one of HWTSTAMP_FILTER_* |
34 | * | 34 | * |
35 | * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to | 35 | * %SIOCGHWTSTAMP and %SIOCSHWTSTAMP expect a &struct ifreq with a |
36 | * this structure. If the driver or hardware does not support the | 36 | * ifr_data pointer to this structure. For %SIOCSHWTSTAMP, if the |
37 | * requested @rx_filter value, the driver may use a more general | 37 | * driver or hardware does not support the requested @rx_filter value, |
38 | * filter mode. In this case @rx_filter will indicate the actual mode | 38 | * the driver may use a more general filter mode. In this case |
39 | * on return. | 39 | * @rx_filter will indicate the actual mode on return. |
40 | */ | 40 | */ |
41 | struct hwtstamp_config { | 41 | struct hwtstamp_config { |
42 | int flags; | 42 | int flags; |
diff --git a/include/uapi/linux/sockios.h b/include/uapi/linux/sockios.h index 7997a506ad41..e888b1aed69f 100644 --- a/include/uapi/linux/sockios.h +++ b/include/uapi/linux/sockios.h | |||
@@ -125,7 +125,8 @@ | |||
125 | #define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ | 125 | #define SIOCBRDELIF 0x89a3 /* remove interface from bridge */ |
126 | 126 | ||
127 | /* hardware time stamping: parameters in linux/net_tstamp.h */ | 127 | /* hardware time stamping: parameters in linux/net_tstamp.h */ |
128 | #define SIOCSHWTSTAMP 0x89b0 | 128 | #define SIOCSHWTSTAMP 0x89b0 /* set and get config */ |
129 | #define SIOCGHWTSTAMP 0x89b1 /* get config */ | ||
129 | 130 | ||
130 | /* Device private ioctl calls */ | 131 | /* Device private ioctl calls */ |
131 | 132 | ||
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 5b7d0e1d0664..cf999e09bcd2 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c | |||
@@ -327,6 +327,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) | |||
327 | cmd == SIOCBRADDIF || | 327 | cmd == SIOCBRADDIF || |
328 | cmd == SIOCBRDELIF || | 328 | cmd == SIOCBRDELIF || |
329 | cmd == SIOCSHWTSTAMP || | 329 | cmd == SIOCSHWTSTAMP || |
330 | cmd == SIOCGHWTSTAMP || | ||
330 | cmd == SIOCWANDEV) { | 331 | cmd == SIOCWANDEV) { |
331 | err = -EOPNOTSUPP; | 332 | err = -EOPNOTSUPP; |
332 | if (ops->ndo_do_ioctl) { | 333 | if (ops->ndo_do_ioctl) { |
@@ -546,6 +547,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
546 | */ | 547 | */ |
547 | default: | 548 | default: |
548 | if (cmd == SIOCWANDEV || | 549 | if (cmd == SIOCWANDEV || |
550 | cmd == SIOCGHWTSTAMP || | ||
549 | (cmd >= SIOCDEVPRIVATE && | 551 | (cmd >= SIOCDEVPRIVATE && |
550 | cmd <= SIOCDEVPRIVATE + 15)) { | 552 | cmd <= SIOCDEVPRIVATE + 15)) { |
551 | dev_load(net, ifr.ifr_name); | 553 | dev_load(net, ifr.ifr_name); |
diff --git a/net/socket.c b/net/socket.c index 7a766ab83ca5..1a548b70ef3a 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -3231,6 +3231,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, | |||
3231 | case SIOCBONDSLAVEINFOQUERY: | 3231 | case SIOCBONDSLAVEINFOQUERY: |
3232 | case SIOCBONDINFOQUERY: | 3232 | case SIOCBONDINFOQUERY: |
3233 | case SIOCSHWTSTAMP: | 3233 | case SIOCSHWTSTAMP: |
3234 | case SIOCGHWTSTAMP: | ||
3234 | return compat_ifr_data_ioctl(net, cmd, argp); | 3235 | return compat_ifr_data_ioctl(net, cmd, argp); |
3235 | 3236 | ||
3236 | case FIOSETOWN: | 3237 | case FIOSETOWN: |