]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: remove unused struct inet_frag_queue.fragments field
authorPeter Oskolkov <posk@google.com>
Tue, 26 Feb 2019 01:43:46 +0000 (17:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Feb 2019 16:27:05 +0000 (08:27 -0800)
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>
include/net/inet_frag.h
net/ieee802154/6lowpan/reassembly.c
net/ipv4/inet_fragment.c
net/ipv4/ip_fragment.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/ipv6/reassembly.c

index b02bf737d019ae067d26c9edcc8c447fcf426ff9..378904ee91296ff06a78d3ede4151892186f4545 100644 (file)
@@ -56,7 +56,6 @@ struct frag_v6_compare_key {
  * @timer: queue expiration timer
  * @lock: spinlock protecting this frag
  * @refcnt: reference count of the queue
- * @fragments: received fragments head
  * @rb_fragments: received fragments rb-tree root
  * @fragments_tail: received fragments tail
  * @last_run_head: the head of the last "run". see ip_fragment.c
@@ -77,8 +76,7 @@ struct inet_frag_queue {
        struct timer_list       timer;
        spinlock_t              lock;
        refcount_t              refcnt;
-       struct sk_buff          *fragments;  /* used in 6lopwpan IPv6. */
-       struct rb_root          rb_fragments; /* Used in IPv4/IPv6. */
+       struct rb_root          rb_fragments;
        struct sk_buff          *fragments_tail;
        struct sk_buff          *last_run_head;
        ktime_t                 stamp;
index bd61633d2c32a52810f8cec611f31f6cf95da9d6..4196bcd4105ae047b88cdaf090055980144fcc2b 100644 (file)
@@ -179,7 +179,6 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, struct sk_buff *skb,
 
        skb->dev = ldev;
        skb->tstamp = fq->q.stamp;
-       fq->q.fragments = NULL;
        fq->q.rb_fragments = RB_ROOT;
        fq->q.fragments_tail = NULL;
        fq->q.last_run_head = NULL;
index 9f69411251d030ff018fda5afa4b0d55110c0cad..737808e27f8b1cd65aac21c9316a5db5d0f40111 100644 (file)
@@ -203,7 +203,6 @@ EXPORT_SYMBOL(inet_frag_rbtree_purge);
 
 void inet_frag_destroy(struct inet_frag_queue *q)
 {
-       struct sk_buff *fp;
        struct netns_frags *nf;
        unsigned int sum, sum_truesize = 0;
        struct inet_frags *f;
@@ -212,20 +211,9 @@ void inet_frag_destroy(struct inet_frag_queue *q)
        WARN_ON(del_timer(&q->timer) != 0);
 
        /* Release all fragment data. */
-       fp = q->fragments;
        nf = q->net;
        f = nf->f;
-       if (fp) {
-               do {
-                       struct sk_buff *xp = fp->next;
-
-                       sum_truesize += fp->truesize;
-                       kfree_skb(fp);
-                       fp = xp;
-               } while (fp);
-       } else {
-               sum_truesize = inet_frag_rbtree_purge(&q->rb_fragments);
-       }
+       sum_truesize = inet_frag_rbtree_purge(&q->rb_fragments);
        sum = sum_truesize + f->qsize;
 
        call_rcu(&q->rcu, inet_frag_destroy_rcu);
@@ -489,26 +477,20 @@ EXPORT_SYMBOL(inet_frag_reasm_finish);
 
 struct sk_buff *inet_frag_pull_head(struct inet_frag_queue *q)
 {
-       struct sk_buff *head;
+       struct sk_buff *head, *skb;
 
-       if (q->fragments) {
-               head = q->fragments;
-               q->fragments = head->next;
-       } else {
-               struct sk_buff *skb;
+       head = skb_rb_first(&q->rb_fragments);
+       if (!head)
+               return NULL;
+       skb = FRAG_CB(head)->next_frag;
+       if (skb)
+               rb_replace_node(&head->rbnode, &skb->rbnode,
+                               &q->rb_fragments);
+       else
+               rb_erase(&head->rbnode, &q->rb_fragments);
+       memset(&head->rbnode, 0, sizeof(head->rbnode));
+       barrier();
 
-               head = skb_rb_first(&q->rb_fragments);
-               if (!head)
-                       return NULL;
-               skb = FRAG_CB(head)->next_frag;
-               if (skb)
-                       rb_replace_node(&head->rbnode, &skb->rbnode,
-                                       &q->rb_fragments);
-               else
-                       rb_erase(&head->rbnode, &q->rb_fragments);
-               memset(&head->rbnode, 0, sizeof(head->rbnode));
-               barrier();
-       }
        if (head == q->fragments_tail)
                q->fragments_tail = NULL;
 
index 486ecb0aeb87f78db6700c2a5cc996ae61308532..cf2b0a6a33372a7a6ed8bc30f505a350be463d91 100644 (file)
@@ -261,7 +261,6 @@ static int ip_frag_reinit(struct ipq *qp)
        qp->q.flags = 0;
        qp->q.len = 0;
        qp->q.meat = 0;
-       qp->q.fragments = NULL;
        qp->q.rb_fragments = RB_ROOT;
        qp->q.fragments_tail = NULL;
        qp->q.last_run_head = NULL;
@@ -451,7 +450,6 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
        ip_send_check(iph);
 
        __IP_INC_STATS(net, IPSTATS_MIB_REASMOKS);
-       qp->q.fragments = NULL;
        qp->q.rb_fragments = RB_ROOT;
        qp->q.fragments_tail = NULL;
        qp->q.last_run_head = NULL;
index cb1b4772dac0a8bfd4013491aee00d858f2acb54..3de0e9b0a48247f0eef0691295642d6d8f521280 100644 (file)
@@ -365,7 +365,6 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb,
                                         skb_network_header_len(skb),
                                         skb->csum);
 
-       fq->q.fragments = NULL;
        fq->q.rb_fragments = RB_ROOT;
        fq->q.fragments_tail = NULL;
        fq->q.last_run_head = NULL;
index 24264d0a4b859b89a3e3da1dd32f78497b44c02c..1a832f5e190bb00554026b50837329606371ed47 100644 (file)
@@ -304,7 +304,6 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *skb,
        rcu_read_lock();
        __IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
        rcu_read_unlock();
-       fq->q.fragments = NULL;
        fq->q.rb_fragments = RB_ROOT;
        fq->q.fragments_tail = NULL;
        fq->q.last_run_head = NULL;