Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4538529imm; Mon, 17 Sep 2018 16:06:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZf+AC+DC1yb4E33DOan6ttwU2a0cMIxTqvWxHGgmQYwdfvCB/OyzkU+HnYwmE89ayiVP+s X-Received: by 2002:a63:1064:: with SMTP id 36-v6mr25204366pgq.254.1537225607692; Mon, 17 Sep 2018 16:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225607; cv=none; d=google.com; s=arc-20160816; b=TE49f5Cp+YupEq5TqFi1G9cRePzQJuxzIGY7GgfqJX+2l6+lS1bDHC5ZlKNDZWt7Ev M5HEoPyVlYgkmilcjMAzLzP0F3RAB7DzUChmFaMulg9WQ7gCXpGga8mbDsjy4wfT3B/7 ZWncfUMYPpUjI/kKwDkQVXcGhJIr/fpVCbdnRc5ysbvbd3tUEwz6T7BL3J0vZ5KoWEiI +PYbLvJYYdkE8hGVxuP4y86tCRpQvZy8R/cbJKSqhzXGTtzqmByDBXChLAOtROIv/M/i yUjS3qBMwYs+tts8fw5jHxfs7VlWg9oc15leXOJGnyLK8Ow3Gtu1DCUs2mhtoshDEl7Q M49A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=tgmr7DLzrGBgr55DqCyi4vUafP8Tet6a1KjKyTWhxA8=; b=tx30G493Ck/MhDbcD0iyGDyX3ZTP9tPp8FYBeAqcx7IeUkpVP88zfQ3k2iLPgfV1e/ rblhy1j9ybLIjlj7BvaiBbV/24zau93hLWRxTi1s/qeH15AOUic/yu7ISLBhTlyMX8bS amiZSFnzKWPDWluSXnXKXVvYlhnuexImdrkgurHi2kJxuizgr4oapj9Z7s/XgcdZQuMe zFOwgaVLtzY3ep0TScI6NPA9cOcl1Dea4nXqyAXxnMrv7RrK7ETTH6Qull1rLX+xan0H 2zteys4z7PXo5yu04Tvni9ZWlpjg2uRWSFyoMGKfg0IeJMn0DbVD3tjyLTZqlA895wF2 YCkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m29-v6si17604999pgl.304.2018.09.17.16.06.32; Mon, 17 Sep 2018 16:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730974AbeIREef (ORCPT + 99 others); Tue, 18 Sep 2018 00:34:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49258 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730207AbeIREed (ORCPT ); Tue, 18 Sep 2018 00:34:33 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 42C2EC7D; Mon, 17 Sep 2018 23:05:04 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: [PATCH 4.14 101/126] inet: frags: remove some helpers Date: Tue, 18 Sep 2018 00:42:29 +0200 Message-Id: <20180917211710.560505893@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet Remove sum_frag_mem_limit(), ip_frag_mem() & ip6_frag_mem() Also since we use rhashtable we can bring back the number of fragments in "grep FRAG /proc/net/sockstat /proc/net/sockstat6" that was removed in commit 434d305405ab ("inet: frag: don't account number of fragment queues") Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller (cherry picked from commit 6befe4a78b1553edb6eed3a78b4bcd9748526672) Signed-off-by: Greg Kroah-Hartman --- include/net/inet_frag.h | 5 ----- include/net/ip.h | 1 - include/net/ipv6.h | 7 ------- net/ipv4/ip_fragment.c | 5 ----- net/ipv4/proc.c | 6 +++--- net/ipv6/proc.c | 5 +++-- 6 files changed, 6 insertions(+), 23 deletions(-) --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -141,11 +141,6 @@ static inline void add_frag_mem_limit(st atomic_add(i, &nf->mem); } -static inline int sum_frag_mem_limit(struct netns_frags *nf) -{ - return atomic_read(&nf->mem); -} - /* RFC 3168 support : * We want to check ECN values of all fragments, do detect invalid combinations. * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value. --- a/include/net/ip.h +++ b/include/net/ip.h @@ -570,7 +570,6 @@ static inline struct sk_buff *ip_check_d return skb; } #endif -int ip_frag_mem(struct net *net); /* * Functions provided by ip_forward.c --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -331,13 +331,6 @@ static inline bool ipv6_accept_ra(struct idev->cnf.accept_ra; } -#if IS_ENABLED(CONFIG_IPV6) -static inline int ip6_frag_mem(struct net *net) -{ - return sum_frag_mem_limit(&net->ipv6.frags); -} -#endif - #define IPV6_FRAG_HIGH_THRESH (4 * 1024*1024) /* 4194304 */ #define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ #define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -83,11 +83,6 @@ static u8 ip4_frag_ecn(u8 tos) static struct inet_frags ip4_frags; -int ip_frag_mem(struct net *net) -{ - return sum_frag_mem_limit(&net->ipv4.frags); -} - static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, struct net_device *dev); --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -54,7 +54,6 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) { struct net *net = seq->private; - unsigned int frag_mem; int orphans, sockets; orphans = percpu_counter_sum_positive(&tcp_orphan_count); @@ -72,8 +71,9 @@ static int sockstat_seq_show(struct seq_ sock_prot_inuse_get(net, &udplite_prot)); seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse_get(net, &raw_prot)); - frag_mem = ip_frag_mem(net); - seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem); + seq_printf(seq, "FRAG: inuse %u memory %u\n", + atomic_read(&net->ipv4.frags.rhashtable.nelems), + frag_mem_limit(&net->ipv4.frags)); return 0; } --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c @@ -38,7 +38,6 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) { struct net *net = seq->private; - unsigned int frag_mem = ip6_frag_mem(net); seq_printf(seq, "TCP6: inuse %d\n", sock_prot_inuse_get(net, &tcpv6_prot)); @@ -48,7 +47,9 @@ static int sockstat6_seq_show(struct seq sock_prot_inuse_get(net, &udplitev6_prot)); seq_printf(seq, "RAW6: inuse %d\n", sock_prot_inuse_get(net, &rawv6_prot)); - seq_printf(seq, "FRAG6: inuse %u memory %u\n", !!frag_mem, frag_mem); + seq_printf(seq, "FRAG6: inuse %u memory %u\n", + atomic_read(&net->ipv6.frags.rhashtable.nelems), + frag_mem_limit(&net->ipv6.frags)); return 0; }