From patchwork Tue Feb 26 01:43:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Oskolkov X-Patchwork-Id: 10829339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBA6317EF for ; Tue, 26 Feb 2019 01:43:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8D912B4BB for ; Tue, 26 Feb 2019 01:43:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAE962B596; Tue, 26 Feb 2019 01:43:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F7F32B5B9 for ; Tue, 26 Feb 2019 01:43:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726062AbfBZBn4 (ORCPT ); Mon, 25 Feb 2019 20:43:56 -0500 Received: from mail-pg1-f201.google.com ([209.85.215.201]:51025 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726031AbfBZBn4 (ORCPT ); Mon, 25 Feb 2019 20:43:56 -0500 Received: by mail-pg1-f201.google.com with SMTP id n24so8373098pgm.17 for ; Mon, 25 Feb 2019 17:43:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=5P6CcbciBgb0VO6Yd6SB5mH3fXB+oeL0YT9y8EYPpGU=; b=Th3EYIAPS7GqIJLxLlQfTTtI+dMStCEaQ+zY7h/GnwB1cChZ8GZtSY1a1EwblOgztP UHMgw40YHwmOspiDfZVgg8kFD+ZlAl0aEiRxBjV1uTz7KC3TmeTisOM2kJ3idNJoYEnQ EvYPLDAnohv9OIuCW8EZ+hgbkDNkxIvn2SidmETLE695KYqmnPfVZB0hwpLhevbcHTmV i1N9AltI9qfOz59dRVeUL0stLN/fatEmzprUSj16iMVvsAYFrJpxshgZJQH7BHdBMAyt tJBLmyQ+XsGfrqPoFZJwvtLye6iPlDAlvo/fCC0p/Jr3u8Nl0D3o5lfhjcU55CrHr0r2 Fa0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=5P6CcbciBgb0VO6Yd6SB5mH3fXB+oeL0YT9y8EYPpGU=; b=kweiXz+qDNOhClrLSRqd6zoINRy2ax5MrES8BFpCBMMhN1xEVMGPQ5PDEJyhcI7IDQ 0dYWEhty5Os208VLaBGqvNcLOXtqP5Edjo+lkf2/G119mvZi2bQmkuxXSnJyON0xaTGs BRJp6QZxhwBupknOT1pcpwBDzpBfrABrgVp+57OxB6E5dlfJ9Xe+ylSRB/2LFd3E4glL QkTr/0Lml0hIldDpOLSxw3/0yJSHxCL8GOtCECCXeSP5EmMlVtbjlmHhshUiU6ZQe8H+ 6Nl/LLj2P3+yU8W7zxKTvTJfAl59vx8tn2XoO8w+9gKDZd8VDUKiub28CTpO9k9PbMmX uEnw== X-Gm-Message-State: AHQUAuYwFs+nEn8HNjftt2B6ft1yQnRgBOQDeE+sVsecSX/KXah2BHPn V6d33DilS0gB3x1eAyQ7Kfe46Cu/ X-Google-Smtp-Source: AHgI3Iavjqg10/sh2JEFTWb1kSMub78RrM2ryj39+3QbuCkRRsZ/nV0mSCKCvika6dlIWYf5H4jaD0Rn X-Received: by 2002:a17:902:9a06:: with SMTP id v6mr6493673plp.18.1551145435451; Mon, 25 Feb 2019 17:43:55 -0800 (PST) Date: Mon, 25 Feb 2019 17:43:46 -0800 Message-Id: <20190226014346.77719-1-posk@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.rc2.261.ga7da99ff1b-goog Subject: [PATCH net-next] net: remove unused struct inet_frag_queue.fragments field From: Peter Oskolkov To: David Miller , netdev@vger.kernel.org Cc: Peter Oskolkov , linux-wpan@vger.kernel.org, Peter Oskolkov Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Stefan Schmidt --- include/net/inet_frag.h | 4 +-- net/ieee802154/6lowpan/reassembly.c | 1 - net/ipv4/inet_fragment.c | 44 ++++++++----------------- net/ipv4/ip_fragment.c | 2 -- net/ipv6/netfilter/nf_conntrack_reasm.c | 1 - net/ipv6/reassembly.c | 1 - 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 { * @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; 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, 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; 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); 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; 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) 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; 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, 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; 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, 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;