Skip to content

Commit

Permalink
inet: frag: don't account number of fragment queues
Browse files Browse the repository at this point in the history
The 'nqueues' counter is protected by the lru list lock,
once thats removed this needs to be converted to atomic
counter.  Given this isn't used for anything except for
reporting it to userspace via /proc, just remove it.

We still report the memory currently used by fragment
reassembly queues.

Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Florian Westphal authored and davem330 committed Jul 28, 2014
1 parent b13d3cb commit 434d305
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 19 deletions.
3 changes: 0 additions & 3 deletions include/net/inet_frag.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <linux/percpu_counter.h>

struct netns_frags {
int nqueues;
struct list_head lru_list;
spinlock_t lru_lock;

Expand Down Expand Up @@ -158,7 +157,6 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)
{
spin_lock(&q->net->lru_lock);
list_del_init(&q->lru_list);
q->net->nqueues--;
spin_unlock(&q->net->lru_lock);
}

Expand All @@ -167,7 +165,6 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,
{
spin_lock(&nf->lru_lock);
list_add_tail(&q->lru_list, &nf->lru_list);
q->net->nqueues++;
spin_unlock(&nf->lru_lock);
}

Expand Down
1 change: 0 additions & 1 deletion include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ static inline struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user)
}
#endif
int ip_frag_mem(struct net *net);
int ip_frag_nqueues(struct net *net);

/*
* Functions provided by ip_forward.c
Expand Down
5 changes: 0 additions & 5 deletions include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,6 @@ static inline bool ipv6_accept_ra(struct inet6_dev *idev)
}

#if IS_ENABLED(CONFIG_IPV6)
static inline int ip6_frag_nqueues(struct net *net)
{
return net->ipv6.frags.nqueues;
}

static inline int ip6_frag_mem(struct net *net)
{
return sum_frag_mem_limit(&net->ipv6.frags);
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/inet_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ EXPORT_SYMBOL(inet_frags_init);

void inet_frags_init_net(struct netns_frags *nf)
{
nf->nqueues = 0;
init_frag_mem_limit(nf);
INIT_LIST_HEAD(&nf->lru_list);
spin_lock_init(&nf->lru_lock);
Expand Down
5 changes: 0 additions & 5 deletions net/ipv4/ip_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ static inline u8 ip4_frag_ecn(u8 tos)

static struct inet_frags ip4_frags;

int ip_frag_nqueues(struct net *net)
{
return net->ipv4.frags.nqueues;
}

int ip_frag_mem(struct net *net)
{
return sum_frag_mem_limit(&net->ipv4.frags);
Expand Down
5 changes: 3 additions & 2 deletions net/ipv4/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
static int sockstat_seq_show(struct seq_file *seq, void *v)
{
struct net *net = seq->private;
unsigned int frag_mem;
int orphans, sockets;

local_bh_disable();
Expand All @@ -71,8 +72,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
sock_prot_inuse_get(net, &udplite_prot));
seq_printf(seq, "RAW: inuse %d\n",
sock_prot_inuse_get(net, &raw_prot));
seq_printf(seq, "FRAG: inuse %d memory %d\n",
ip_frag_nqueues(net), ip_frag_mem(net));
frag_mem = ip_frag_mem(net);
seq_printf(seq, "FRAG: inuse %u memory %u\n", !!frag_mem, frag_mem);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
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));
Expand All @@ -42,8 +43,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
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 %d memory %d\n",
ip6_frag_nqueues(net), ip6_frag_mem(net));
seq_printf(seq, "FRAG6: inuse %u memory %u\n", !!frag_mem, frag_mem);
return 0;
}

Expand Down

0 comments on commit 434d305

Please sign in to comment.