diff options
author | Tom Herbert <tom@herbertland.com> | 2015-12-14 20:19:45 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-15 22:50:20 +0100 |
commit | 9a49850d0af7b9fd14d091dfe61ef6cb369f86b9 (patch) | |
tree | 32d6e3173c2bd3e92084884f8006d5a2a73e3ffb /net/ipv4/tcp.c | |
parent | net: Eliminate NETIF_F_GEN_CSUM and NETIF_F_V[46]_CSUM (diff) | |
download | linux-9a49850d0af7b9fd14d091dfe61ef6cb369f86b9.tar.xz linux-9a49850d0af7b9fd14d091dfe61ef6cb369f86b9.zip |
tcp: Fix conditions to determine checksum offload
In tcp_send_sendpage and tcp_sendmsg we check the route capabilities to
determine if checksum offload can be performed. This check currently
does not take the IP protocol into account for devices that advertise
only one of NETIF_F_IPV6_CSUM or NETIF_F_IP_CSUM. This patch adds a
function to check capabilities for checksum offload with a socket
called sk_check_csum_caps. This function checks for specific IPv4 or
IPv6 offload support based on the family of the socket.
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index cf7ef7be79f0..92b3e61b847d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1018,7 +1018,7 @@ int tcp_sendpage(struct sock *sk, struct page *page, int offset, ssize_t res; if (!(sk->sk_route_caps & NETIF_F_SG) || - !(sk->sk_route_caps & NETIF_F_CSUM_MASK)) + !sk_check_csum_caps(sk)) return sock_no_sendpage(sk->sk_socket, page, offset, size, flags); @@ -1175,7 +1175,7 @@ new_segment: /* * Check whether we can use HW checksum. */ - if (sk->sk_route_caps & NETIF_F_CSUM_MASK) + if (sk_check_csum_caps(sk)) skb->ip_summed = CHECKSUM_PARTIAL; skb_entail(sk, skb); |