summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Oskolkov <posk@google.com>2019-02-25 20:43:46 -0500
committerDavid S. Miller <davem@davemloft.net>2019-02-26 11:27:05 -0500
commitd8cf757fbd3ee96a449f656707e773c91ca805b8 (patch)
treefc1c6d8fe69e873f55d823a5b073526b87a6e0d4
parentc14f7e1efcbf744c49fcb44a121112c54d2c5330 (diff)
net: remove unused struct inet_frag_queue.fragments field
Now that all users of struct inet_frag_queue have been converted to use 'rb_fragments', remove the unused 'fragments' field. Build with `make allyesconfig` succeeded. ip_defrag selftest passed. Signed-off-by: Peter Oskolkov <posk@google.com> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--net/ieee802154/6lowpan/reassembly.c1
-rw-r--r--net/ipv4/inet_fragment.c44
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c1
-rw-r--r--net/ipv6/reassembly.c1
6 files changed, 14 insertions, 39 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index b02bf737d019..378904ee9129 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -56,7 +56,6 @@ struct frag_v6_compare_key {
56 * @timer: queue expiration timer 56 * @timer: queue expiration timer
57 * @lock: spinlock protecting this frag 57 * @lock: spinlock protecting this frag
58 * @refcnt: reference count of the queue 58 * @refcnt: reference count of the queue
59 * @fragments: received fragments head
60 * @rb_fragments: received fragments rb-tree root 59 * @rb_fragments: received fragments rb-tree root
61 * @fragments_tail: received fragments tail 60 * @fragments_tail: received fragments tail
62 * @last_run_head: the head of the last "run". see ip_fragment.c 61 * @last_run_head: the head of the last "run". see ip_fragment.c
@@ -77,8 +76,7 @@ struct inet_frag_queue {
77 struct timer_list timer; 76 struct timer_list timer;
78 spinlock_t lock; 77 spinlock_t lock;
79 refcount_t refcnt; 78 refcount_t refcnt;
80 struct sk_buff *fragments; /* used in 6lopwpan IPv6. */ 79 struct rb_root rb_fragments;
81 struct rb_root rb_fragments; /* Used in IPv4/IPv6. */
82 struct sk_buff *fragments_tail; 80 struct sk_buff *fragments_tail;
83 struct sk_buff *last_run_head; 81 struct sk_buff *last_run_head;
84 ktime_t stamp; 82 ktime_t stamp;
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
index bd61633d2c32..4196bcd4105a 100644
--- a/net/ieee802154/6lowpan/reassembly.c
+++ b/net/ieee802154/6lowpan/reassembly.c
@@ -179,7 +179,6 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, struct sk_buff *skb,
179 179
180 skb->dev = ldev; 180 skb->dev = ldev;
181 skb->tstamp = fq->q.stamp; 181 skb->tstamp = fq->q.stamp;
182 fq->q.fragments = NULL;
183 fq->q.rb_fragments = RB_ROOT; 182 fq->q.rb_fragments = RB_ROOT;
184 fq->q.fragments_tail = NULL; 183 fq->q.fragments_tail = NULL;
185 fq->q.last_run_head = NULL; 184 fq->q.last_run_head = NULL;
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 9f69411251d0..737808e27f8b 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -203,7 +203,6 @@ EXPORT_SYMBOL(inet_frag_rbtree_purge);
203 203
204void inet_frag_destroy(struct inet_frag_queue *q) 204void inet_frag_destroy(struct inet_frag_queue *q)
205{ 205{
206 struct sk_buff *fp;
207 struct netns_frags *nf; 206 struct netns_frags *nf;
208 unsigned int sum, sum_truesize = 0; 207 unsigned int sum, sum_truesize = 0;
209 struct inet_frags *f; 208 struct inet_frags *f;
@@ -212,20 +211,9 @@ void inet_frag_destroy(struct inet_frag_queue *q)
212 WARN_ON(del_timer(&q->timer) != 0); 211 WARN_ON(del_timer(&q->timer) != 0);
213 212
214 /* Release all fragment data. */ 213 /* Release all fragment data. */
215 fp = q->fragments;
216 nf = q->net; 214 nf = q->net;
217 f = nf->f; 215 f = nf->f;
218 if (fp) { 216 sum_truesize = inet_frag_rbtree_purge(&q->rb_fragments);
219 do {
220 struct sk_buff *xp = fp->next;
221
222 sum_truesize += fp->truesize;
223 kfree_skb(fp);
224 fp = xp;
225 } while (fp);
226 } else {
227 sum_truesize = inet_frag_rbtree_purge(&q->rb_fragments);
228 }
229 sum = sum_truesize + f->qsize; 217 sum = sum_truesize + f->qsize;
230 218
231 call_rcu(&q->rcu, inet_frag_destroy_rcu); 219 call_rcu(&q->rcu, inet_frag_destroy_rcu);
@@ -489,26 +477,20 @@ EXPORT_SYMBOL(inet_frag_reasm_finish);
489 477
490struct sk_buff *inet_frag_pull_head(struct inet_frag_queue *q) 478struct sk_buff *inet_frag_pull_head(struct inet_frag_queue *q)
491{ 479{
492 struct sk_buff *head; 480 struct sk_buff *head, *skb;
493 481
494 if (q->fragments) { 482 head = skb_rb_first(&q->rb_fragments);
495 head = q->fragments; 483 if (!head)
496 q->fragments = head->next; 484 return NULL;
497 } else { 485 skb = FRAG_CB(head)->next_frag;
498 struct sk_buff *skb; 486 if (skb)
487 rb_replace_node(&head->rbnode, &skb->rbnode,
488 &q->rb_fragments);
489 else
490 rb_erase(&head->rbnode, &q->rb_fragments);
491 memset(&head->rbnode, 0, sizeof(head->rbnode));
492 barrier();
499 493
500 head = skb_rb_first(&q->rb_fragments);
501 if (!head)
502 return NULL;
503 skb = FRAG_CB(head)->next_frag;
504 if (skb)
505 rb_replace_node(&head->rbnode, &skb->rbnode,
506 &q->rb_fragments);
507 else
508 rb_erase(&head->rbnode, &q->rb_fragments);
509 memset(&head->rbnode, 0, sizeof(head->rbnode));
510 barrier();
511 }
512 if (head == q->fragments_tail) 494 if (head == q->fragments_tail)
513 q->fragments_tail = NULL; 495 q->fragments_tail = NULL;
514 496
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 486ecb0aeb87..cf2b0a6a3337 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -261,7 +261,6 @@ static int ip_frag_reinit(struct ipq *qp)
261 qp->q.flags = 0; 261 qp->q.flags = 0;
262 qp->q.len = 0; 262 qp->q.len = 0;
263 qp->q.meat = 0; 263 qp->q.meat = 0;
264 qp->q.fragments = NULL;
265 qp->q.rb_fragments = RB_ROOT; 264 qp->q.rb_fragments = RB_ROOT;
266 qp->q.fragments_tail = NULL; 265 qp->q.fragments_tail = NULL;
267 qp->q.last_run_head = NULL; 266 qp->q.last_run_head = NULL;
@@ -451,7 +450,6 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
451 ip_send_check(iph); 450 ip_send_check(iph);
452 451
453 __IP_INC_STATS(net, IPSTATS_MIB_REASMOKS); 452 __IP_INC_STATS(net, IPSTATS_MIB_REASMOKS);
454 qp->q.fragments = NULL;
455 qp->q.rb_fragments = RB_ROOT; 453 qp->q.rb_fragments = RB_ROOT;
456 qp->q.fragments_tail = NULL; 454 qp->q.fragments_tail = NULL;
457 qp->q.last_run_head = NULL; 455 qp->q.last_run_head = NULL;
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index cb1b4772dac0..3de0e9b0a482 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -365,7 +365,6 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb,
365 skb_network_header_len(skb), 365 skb_network_header_len(skb),
366 skb->csum); 366 skb->csum);
367 367
368 fq->q.fragments = NULL;
369 fq->q.rb_fragments = RB_ROOT; 368 fq->q.rb_fragments = RB_ROOT;
370 fq->q.fragments_tail = NULL; 369 fq->q.fragments_tail = NULL;
371 fq->q.last_run_head = NULL; 370 fq->q.last_run_head = NULL;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 24264d0a4b85..1a832f5e190b 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -304,7 +304,6 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *skb,
304 rcu_read_lock(); 304 rcu_read_lock();
305 __IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS); 305 __IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
306 rcu_read_unlock(); 306 rcu_read_unlock();
307 fq->q.fragments = NULL;
308 fq->q.rb_fragments = RB_ROOT; 307 fq->q.rb_fragments = RB_ROOT;
309 fq->q.fragments_tail = NULL; 308 fq->q.fragments_tail = NULL;
310 fq->q.last_run_head = NULL; 309 fq->q.last_run_head = NULL;