Skip to content

Commit 6befe4a

Browse files
edumazetdavem330
authored andcommitted
inet: frags: remove some helpers
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 434d305 ("inet: frag: don't account number of fragment queues") Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 648700f commit 6befe4a

File tree

6 files changed

+6
-23
lines changed

6 files changed

+6
-23
lines changed

include/net/inet_frag.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
141141
atomic_add(i, &nf->mem);
142142
}
143143

144-
static inline int sum_frag_mem_limit(struct netns_frags *nf)
145-
{
146-
return atomic_read(&nf->mem);
147-
}
148-
149144
/* RFC 3168 support :
150145
* We want to check ECN values of all fragments, do detect invalid combinations.
151146
* In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value.

include/net/ip.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,6 @@ static inline struct sk_buff *ip_check_defrag(struct net *net, struct sk_buff *s
588588
return skb;
589589
}
590590
#endif
591-
int ip_frag_mem(struct net *net);
592591

593592
/*
594593
* Functions provided by ip_forward.c

include/net/ipv6.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,6 @@ static inline bool ipv6_accept_ra(struct inet6_dev *idev)
379379
idev->cnf.accept_ra;
380380
}
381381

382-
#if IS_ENABLED(CONFIG_IPV6)
383-
static inline int ip6_frag_mem(struct net *net)
384-
{
385-
return sum_frag_mem_limit(&net->ipv6.frags);
386-
}
387-
#endif
388-
389382
#define IPV6_FRAG_HIGH_THRESH (4 * 1024*1024) /* 4194304 */
390383
#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
391384
#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */

net/ipv4/ip_fragment.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ static u8 ip4_frag_ecn(u8 tos)
8383

8484
static struct inet_frags ip4_frags;
8585

86-
int ip_frag_mem(struct net *net)
87-
{
88-
return sum_frag_mem_limit(&net->ipv4.frags);
89-
}
90-
9186
static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
9287
struct net_device *dev);
9388

net/ipv4/proc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
static int sockstat_seq_show(struct seq_file *seq, void *v)
5555
{
5656
struct net *net = seq->private;
57-
unsigned int frag_mem;
5857
int orphans, sockets;
5958

6059
orphans = percpu_counter_sum_positive(&tcp_orphan_count);
@@ -72,8 +71,9 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
7271
sock_prot_inuse_get(net, &udplite_prot));
7372
seq_printf(seq, "RAW: inuse %d\n",
7473
sock_prot_inuse_get(net, &raw_prot));
75-
frag_mem = ip_frag_mem(net);
76-
seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem);
74+
seq_printf(seq, "FRAG: inuse %u memory %u\n",
75+
atomic_read(&net->ipv4.frags.rhashtable.nelems),
76+
frag_mem_limit(&net->ipv4.frags));
7777
return 0;
7878
}
7979

net/ipv6/proc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
static int sockstat6_seq_show(struct seq_file *seq, void *v)
3939
{
4040
struct net *net = seq->private;
41-
unsigned int frag_mem = ip6_frag_mem(net);
4241

4342
seq_printf(seq, "TCP6: inuse %d\n",
4443
sock_prot_inuse_get(net, &tcpv6_prot));
@@ -48,7 +47,9 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
4847
sock_prot_inuse_get(net, &udplitev6_prot));
4948
seq_printf(seq, "RAW6: inuse %d\n",
5049
sock_prot_inuse_get(net, &rawv6_prot));
51-
seq_printf(seq, "FRAG6: inuse %u memory %u\n", !!frag_mem, frag_mem);
50+
seq_printf(seq, "FRAG6: inuse %u memory %u\n",
51+
atomic_read(&net->ipv6.frags.rhashtable.nelems),
52+
frag_mem_limit(&net->ipv6.frags));
5253
return 0;
5354
}
5455

0 commit comments

Comments
 (0)