提交 a693e698 编写于 作者: A Anders Berggren 提交者: David S. Miller

net: TX timestamps for IPv6 UDP packets

Enabling TX timestamps (SO_TIMESTAMPING) for IPv6 UDP packets, in
the same fashion as for IPv4. Necessary in order for NICs such as
Intel 82580 to timestamp IPv6 packets.
Signed-off-by: NAnders Berggren <anders@halon.se>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 eaaa3a7c
...@@ -1118,6 +1118,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, ...@@ -1118,6 +1118,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
int err; int err;
int offset = 0; int offset = 0;
int csummode = CHECKSUM_NONE; int csummode = CHECKSUM_NONE;
__u8 tx_flags = 0;
if (flags&MSG_PROBE) if (flags&MSG_PROBE)
return 0; return 0;
...@@ -1202,6 +1203,13 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, ...@@ -1202,6 +1203,13 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
} }
} }
/* For UDP, check if TX timestamp is enabled */
if (sk->sk_type == SOCK_DGRAM) {
err = sock_tx_timestamp(sk, &tx_flags);
if (err)
goto error;
}
/* /*
* Let's try using as much space as possible. * Let's try using as much space as possible.
* Use MTU if total length of the message fits into the MTU. * Use MTU if total length of the message fits into the MTU.
...@@ -1306,6 +1314,12 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, ...@@ -1306,6 +1314,12 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
sk->sk_allocation); sk->sk_allocation);
if (unlikely(skb == NULL)) if (unlikely(skb == NULL))
err = -ENOBUFS; err = -ENOBUFS;
else {
/* Only the initial fragment
* is time stamped.
*/
tx_flags = 0;
}
} }
if (skb == NULL) if (skb == NULL)
goto error; goto error;
...@@ -1317,6 +1331,9 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, ...@@ -1317,6 +1331,9 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
/* reserve for fragmentation */ /* reserve for fragmentation */
skb_reserve(skb, hh_len+sizeof(struct frag_hdr)); skb_reserve(skb, hh_len+sizeof(struct frag_hdr));
if (sk->sk_type == SOCK_DGRAM)
skb_shinfo(skb)->tx_flags = tx_flags;
/* /*
* Find where to start putting bytes * Find where to start putting bytes
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册