From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f68.google.com ([74.125.83.68]:44731 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932139AbeBST5O (ORCPT ); Mon, 19 Feb 2018 14:57:14 -0500 Received: by mail-pg0-f68.google.com with SMTP id l4so4088078pgp.11 for ; Mon, 19 Feb 2018 11:57:14 -0800 (PST) From: Eric Dumazet To: "David S . Miller" Cc: netdev , Neal Cardwell , Yuchung Cheng , Soheil Hassas Yeganeh , Eric Dumazet , Oleksandr Natalenko , Eric Dumazet Subject: [PATCH net-next 3/6] tcp: remove sk_check_csum_caps() Date: Mon, 19 Feb 2018 11:56:49 -0800 Message-Id: <20180219195652.242663-4-edumazet@google.com> In-Reply-To: <20180219195652.242663-1-edumazet@google.com> References: <20180219195652.242663-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: Since TCP relies on GSO, we do not need this helper anymore. Signed-off-by: Eric Dumazet --- include/net/sock.h | 9 --------- net/ipv4/tcp.c | 11 +++-------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index f0f576ff5603eb0f282f37fbf76138a9bdd0f724..b9624581d639ff7f1f9466d7e7cd50c6b87cabf5 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1863,15 +1863,6 @@ static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) sk->sk_route_caps &= ~flags; } -static inline bool sk_check_csum_caps(struct sock *sk) -{ - return (sk->sk_route_caps & NETIF_F_HW_CSUM) || - (sk->sk_family == PF_INET && - (sk->sk_route_caps & NETIF_F_IP_CSUM)) || - (sk->sk_family == PF_INET6 && - (sk->sk_route_caps & NETIF_F_IPV6_CSUM)); -} - static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, struct iov_iter *from, char *to, int copy, int offset) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 6f35c12af85aaed5bbed5090c7d7e63a952b8dab..7c41402718876ef8adc7dc90cd51994e6a4fded9 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1063,8 +1063,7 @@ EXPORT_SYMBOL_GPL(do_tcp_sendpages); int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset, size_t size, int flags) { - if (!(sk->sk_route_caps & NETIF_F_SG) || - !sk_check_csum_caps(sk)) + if (!(sk->sk_route_caps & NETIF_F_SG)) return sock_no_sendpage_locked(sk, page, offset, size, flags); tcp_rate_check_app_limited(sk); /* is sending application-limited? */ @@ -1190,7 +1189,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) goto out_err; } - zc = sk_check_csum_caps(sk) && sk->sk_route_caps & NETIF_F_SG; + zc = sk->sk_route_caps & NETIF_F_SG; if (!zc) uarg->zerocopy = 0; } @@ -1287,11 +1286,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) goto wait_for_memory; process_backlog = true; - /* - * Check whether we can use HW checksum. - */ - if (sk_check_csum_caps(sk)) - skb->ip_summed = CHECKSUM_PARTIAL; + skb->ip_summed = CHECKSUM_PARTIAL; skb_entail(sk, skb); copy = size_goal; -- 2.16.1.291.g4437f3f132-goog