提交 f066e2b0 编写于 作者: W Willem de Bruijn 提交者: David S. Miller

net-timestamp: cumulative tcp timestamping fixes

A set of small fixes pointed out just after the merge:
- make tcp_tx_timestamp static
- make tcp_gso_tstamp static
- use before() to compare TCP seqno, instead of cast to u64
- add tstamp to tx_flags in GSO, instead of overwrite tx_flags
- record skb_shinfo(skb)->tskey for all timestamps, also HW.
- optimization in tcp_tx_timestamp:
  call sock_tx_timestamp only if a tstamp option is set.
Signed-off-by: NWillem de Bruijn <willemb@google.com>
Fixes: 4ed2d765 ("net-timestamp: TCP timestamping")
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 be136ed3
...@@ -426,13 +426,15 @@ void tcp_init_sock(struct sock *sk) ...@@ -426,13 +426,15 @@ void tcp_init_sock(struct sock *sk)
} }
EXPORT_SYMBOL(tcp_init_sock); EXPORT_SYMBOL(tcp_init_sock);
void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb) static void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb)
{ {
struct skb_shared_info *shinfo = skb_shinfo(skb); if (sk->sk_tsflags) {
struct skb_shared_info *shinfo = skb_shinfo(skb);
sock_tx_timestamp(sk, &shinfo->tx_flags); sock_tx_timestamp(sk, &shinfo->tx_flags);
if (shinfo->tx_flags & SKBTX_ANY_SW_TSTAMP) if (shinfo->tx_flags & SKBTX_ANY_TSTAMP)
shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1; shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1;
}
} }
/* /*
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
#include <net/tcp.h> #include <net/tcp.h>
#include <net/protocol.h> #include <net/protocol.h>
void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq, unsigned int seq, static void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq,
unsigned int mss) unsigned int seq, unsigned int mss)
{ {
while (skb) { while (skb) {
if (ts_seq < (__u64) seq + mss) { if (before(ts_seq, seq + mss)) {
skb_shinfo(skb)->tx_flags = SKBTX_SW_TSTAMP; skb_shinfo(skb)->tx_flags |= SKBTX_SW_TSTAMP;
skb_shinfo(skb)->tskey = ts_seq; skb_shinfo(skb)->tskey = ts_seq;
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册