Skip to content

Commit d8cf757

Browse files
Peter Oskolkovdavem330
authored andcommitted
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 <[email protected]> Acked-by: Stefan Schmidt <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c14f7e1 commit d8cf757

File tree

6 files changed

+14
-39
lines changed

6 files changed

+14
-39
lines changed

include/net/inet_frag.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ struct frag_v6_compare_key {
5656
* @timer: queue expiration timer
5757
* @lock: spinlock protecting this frag
5858
* @refcnt: reference count of the queue
59-
* @fragments: received fragments head
6059
* @rb_fragments: received fragments rb-tree root
6160
* @fragments_tail: received fragments tail
6261
* @last_run_head: the head of the last "run". see ip_fragment.c
@@ -77,8 +76,7 @@ struct inet_frag_queue {
7776
struct timer_list timer;
7877
spinlock_t lock;
7978
refcount_t refcnt;
80-
struct sk_buff *fragments; /* used in 6lopwpan IPv6. */
81-
struct rb_root rb_fragments; /* Used in IPv4/IPv6. */
79+
struct rb_root rb_fragments;
8280
struct sk_buff *fragments_tail;
8381
struct sk_buff *last_run_head;
8482
ktime_t stamp;

net/ieee802154/6lowpan/reassembly.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ static int lowpan_frag_reasm(struct lowpan_frag_queue *fq, struct sk_buff *skb,
179179

180180
skb->dev = ldev;
181181
skb->tstamp = fq->q.stamp;
182-
fq->q.fragments = NULL;
183182
fq->q.rb_fragments = RB_ROOT;
184183
fq->q.fragments_tail = NULL;
185184
fq->q.last_run_head = NULL;

net/ipv4/inet_fragment.c

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ EXPORT_SYMBOL(inet_frag_rbtree_purge);
203203

204204
void inet_frag_destroy(struct inet_frag_queue *q)
205205
{
206-
struct sk_buff *fp;
207206
struct netns_frags *nf;
208207
unsigned int sum, sum_truesize = 0;
209208
struct inet_frags *f;
@@ -212,20 +211,9 @@ void inet_frag_destroy(struct inet_frag_queue *q)
212211
WARN_ON(del_timer(&q->timer) != 0);
213212

214213
/* Release all fragment data. */
215-
fp = q->fragments;
216214
nf = q->net;
217215
f = nf->f;
218-
if (fp) {
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-
}
216+
sum_truesize = inet_frag_rbtree_purge(&q->rb_fragments);
229217
sum = sum_truesize + f->qsize;
230218

231219
call_rcu(&q->rcu, inet_frag_destroy_rcu);
@@ -489,26 +477,20 @@ EXPORT_SYMBOL(inet_frag_reasm_finish);
489477

490478
struct sk_buff *inet_frag_pull_head(struct inet_frag_queue *q)
491479
{
492-
struct sk_buff *head;
480+
struct sk_buff *head, *skb;
493481

494-
if (q->fragments) {
495-
head = q->fragments;
496-
q->fragments = head->next;
497-
} else {
498-
struct sk_buff *skb;
482+
head = skb_rb_first(&q->rb_fragments);
483+
if (!head)
484+
return NULL;
485+
skb = FRAG_CB(head)->next_frag;
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();
499493

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-
}
512494
if (head == q->fragments_tail)
513495
q->fragments_tail = NULL;
514496

net/ipv4/ip_fragment.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ static int ip_frag_reinit(struct ipq *qp)
261261
qp->q.flags = 0;
262262
qp->q.len = 0;
263263
qp->q.meat = 0;
264-
qp->q.fragments = NULL;
265264
qp->q.rb_fragments = RB_ROOT;
266265
qp->q.fragments_tail = NULL;
267266
qp->q.last_run_head = NULL;
@@ -451,7 +450,6 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb,
451450
ip_send_check(iph);
452451

453452
__IP_INC_STATS(net, IPSTATS_MIB_REASMOKS);
454-
qp->q.fragments = NULL;
455453
qp->q.rb_fragments = RB_ROOT;
456454
qp->q.fragments_tail = NULL;
457455
qp->q.last_run_head = NULL;

net/ipv6/netfilter/nf_conntrack_reasm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb,
365365
skb_network_header_len(skb),
366366
skb->csum);
367367

368-
fq->q.fragments = NULL;
369368
fq->q.rb_fragments = RB_ROOT;
370369
fq->q.fragments_tail = NULL;
371370
fq->q.last_run_head = NULL;

net/ipv6/reassembly.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *skb,
304304
rcu_read_lock();
305305
__IP6_INC_STATS(net, __in6_dev_get(dev), IPSTATS_MIB_REASMOKS);
306306
rcu_read_unlock();
307-
fq->q.fragments = NULL;
308307
fq->q.rb_fragments = RB_ROOT;
309308
fq->q.fragments_tail = NULL;
310309
fq->q.last_run_head = NULL;

0 commit comments

Comments
 (0)