diff options
| author | Willem de Bruijn <willemb@google.com> | 2014-08-06 15:09:44 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-08-06 17:09:01 -0400 |
| commit | f066e2b091a50f0b76ade87250065d65996b93dd (patch) | |
| tree | 433ad51129e91defe42fd78d16551bb425326704 | |
| parent | be136ed30a4345e42ad846c1b9d925932dab303b (diff) | |
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: Willem de Bruijn <willemb@google.com>
Fixes: 4ed2d765dfac ("net-timestamp: TCP timestamping")
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | net/ipv4/tcp.c | 12 | ||||
| -rw-r--r-- | net/ipv4/tcp_offload.c | 8 |
2 files changed, 11 insertions, 9 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 744af67a5989..181b70ebd964 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -426,13 +426,15 @@ void tcp_init_sock(struct sock *sk) | |||
| 426 | } | 426 | } |
| 427 | EXPORT_SYMBOL(tcp_init_sock); | 427 | EXPORT_SYMBOL(tcp_init_sock); |
| 428 | 428 | ||
| 429 | void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb) | 429 | static void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb) |
| 430 | { | 430 | { |
| 431 | struct skb_shared_info *shinfo = skb_shinfo(skb); | 431 | if (sk->sk_tsflags) { |
| 432 | struct skb_shared_info *shinfo = skb_shinfo(skb); | ||
| 432 | 433 | ||
| 433 | sock_tx_timestamp(sk, &shinfo->tx_flags); | 434 | sock_tx_timestamp(sk, &shinfo->tx_flags); |
| 434 | if (shinfo->tx_flags & SKBTX_ANY_SW_TSTAMP) | 435 | if (shinfo->tx_flags & SKBTX_ANY_TSTAMP) |
| 435 | shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1; | 436 | shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1; |
| 437 | } | ||
| 436 | } | 438 | } |
| 437 | 439 | ||
| 438 | /* | 440 | /* |
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c index f597119fc4e7..bc1b83cb8309 100644 --- a/net/ipv4/tcp_offload.c +++ b/net/ipv4/tcp_offload.c | |||
| @@ -14,12 +14,12 @@ | |||
| 14 | #include <net/tcp.h> | 14 | #include <net/tcp.h> |
| 15 | #include <net/protocol.h> | 15 | #include <net/protocol.h> |
| 16 | 16 | ||
| 17 | void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq, unsigned int seq, | 17 | static void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq, |
| 18 | unsigned int mss) | 18 | unsigned int seq, unsigned int mss) |
| 19 | { | 19 | { |
| 20 | while (skb) { | 20 | while (skb) { |
| 21 | if (ts_seq < (__u64) seq + mss) { | 21 | if (before(ts_seq, seq + mss)) { |
| 22 | skb_shinfo(skb)->tx_flags = SKBTX_SW_TSTAMP; | 22 | skb_shinfo(skb)->tx_flags |= SKBTX_SW_TSTAMP; |
| 23 | skb_shinfo(skb)->tskey = ts_seq; | 23 | skb_shinfo(skb)->tskey = ts_seq; |
| 24 | return; | 24 | return; |
| 25 | } | 25 | } |
