diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2020-02-18 20:56:41 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-19 20:20:59 +0100 |
commit | 76eeb12b71a4aa5654694765c8c1bde9a1ce8bd8 (patch) | |
tree | adbfb602842031da92ab6742083ef20a2d447562 /include/net/ip6_checksum.h | |
parent | net/ipv4/sysctl: show tcp_{allowed, available}_congestion_control in non-init... (diff) | |
download | linux-76eeb12b71a4aa5654694765c8c1bde9a1ce8bd8.tar.xz linux-76eeb12b71a4aa5654694765c8c1bde9a1ce8bd8.zip |
net: core: add helper tcp_v6_gso_csum_prep
Several network drivers for chips that support TSO6 share the same code
for preparing the TCP header, so let's factor it out to a helper.
A difference is that some drivers reset the payload_len whilst others
don't do this. This value is overwritten by TSO anyway, therefore
the new helper resets it in general.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip6_checksum.h')
-rw-r--r-- | include/net/ip6_checksum.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h index 7bec95df4f80..27ec612cd4a4 100644 --- a/include/net/ip6_checksum.h +++ b/include/net/ip6_checksum.h @@ -76,6 +76,15 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb, } } +static inline void tcp_v6_gso_csum_prep(struct sk_buff *skb) +{ + struct ipv6hdr *ipv6h = ipv6_hdr(skb); + struct tcphdr *th = tcp_hdr(skb); + + ipv6h->payload_len = 0; + th->check = ~tcp_v6_check(0, &ipv6h->saddr, &ipv6h->daddr, 0); +} + #if IS_ENABLED(CONFIG_IPV6) static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) { |