Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5697787rwr; Tue, 9 May 2023 05:19:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hnfaiZsUV5xaHSXqekAKOy8T7QJUWCFq8+qPUaw63RbGdldKFP11DiYSVATNd7OUKQ4is X-Received: by 2002:a17:90a:6349:b0:24e:246e:6454 with SMTP id v9-20020a17090a634900b0024e246e6454mr14300176pjs.33.1683634773831; Tue, 09 May 2023 05:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683634773; cv=none; d=google.com; s=arc-20160816; b=Yj03EraTSSMM/MKBZ/ap4dCHBjaymfltVk8RgGRO3ovfhgMWjKQkyav1zWNkfQFZ+h 8LuWePEmNwBKfQr/8CJe/7rieruHky043nHkYPuWxcA8cx7D4CIj0EzOvvxJjph+lc+u bR/x8pSqpy3hO+gsFZlfLd4dJ2hnzE3Wm6uleu5KtssIAv+vN+ZKJI6c4LFRlaUHcFoZ VwFVRbHCKPRmxWwcipOWfDYLgomF7IC1wSbF8M/kMarmGHRsLVcxf2D68ujS/Bc0yO8I 588iwTdpKJgB9tQRH8ISh70QGUOXfi1v38f+UaRW4uerNy+tWE12g6xExJJoPznJ/CNS Ht9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DGY0dcqQclmk1XQQOW/lMmRWBr+Yc1d2PrBM/9ekQRM=; b=XkL4XthLIOOj2ehGRXE7WutJSxPyNEqe/OTK/rLFeq1oT/2LSHcXUZfWAUpxsK6Gza 2v03ClLbjrz+/yhX6Ql1N9DDe0QrqvEvs8hJPCTk3Co75Wa/HxV3TS+r7bN3bd6CN+qC i6lU1EpgBehPlLTVk1bK7T9epgf7hB2+RFKWQsgQq43qJxDRqIyR+vnLRbnxfwz5I/H1 iYqz/tv3MlEQnBPIOj+hhPgMOAC+GBdGgobzIJMK16B8soTwNtcqNx0dTLUNTS+NiASq h6fZ/wEhvxoZCcLqTZenMXkezvb+ExIiARfUTCSV8QVu5s01g1m45KHWLJ1ev23wK5aV sIcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi6-20020a17090b1e4600b00250c48910bdsi278700pjb.70.2023.05.09.05.19.18; Tue, 09 May 2023 05:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235426AbjEILpY (ORCPT + 99 others); Tue, 9 May 2023 07:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235281AbjEILpW (ORCPT ); Tue, 9 May 2023 07:45:22 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C74A619BC; Tue, 9 May 2023 04:45:20 -0700 (PDT) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QFx7T09CYz18LLH; Tue, 9 May 2023 19:41:09 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 9 May 2023 19:45:18 +0800 From: Yunsheng Lin To: , , CC: , Subject: [PATCH net-next v1 2/2] net: remove __skb_frag_set_page() Date: Tue, 9 May 2023 19:43:37 +0800 Message-ID: <20230509114337.21005-3-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230509114337.21005-1-linyunsheng@huawei.com> References: <20230509114337.21005-1-linyunsheng@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The remaining users calling __skb_frag_set_page() with page being NULL seems to be doing defensive programming, as shinfo->nr_frags is already decremented, so remove them. Signed-off-by: Yunsheng Lin --- RFC: remove a local variable as pointed out by Simon. --- drivers/net/ethernet/broadcom/bnx2.c | 1 - drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +---- include/linux/skbuff.h | 12 ------------ 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 466e1d62bcf6..0d917a9699c5 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c @@ -2955,7 +2955,6 @@ bnx2_reuse_rx_skb_pages(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, shinfo = skb_shinfo(skb); shinfo->nr_frags--; page = skb_frag_page(&shinfo->frags[shinfo->nr_frags]); - __skb_frag_set_page(&shinfo->frags[shinfo->nr_frags], NULL); cons_rx_pg->page = page; dev_kfree_skb(skb); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index efaff5018af8..f42e51bd3e42 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1102,10 +1102,7 @@ static u32 __bnxt_rx_agg_pages(struct bnxt *bp, xdp_buff_set_frag_pfmemalloc(xdp); if (bnxt_alloc_rx_page(bp, rxr, prod, GFP_ATOMIC) != 0) { - unsigned int nr_frags; - - nr_frags = --shinfo->nr_frags; - __skb_frag_set_page(&shinfo->frags[nr_frags], NULL); + --shinfo->nr_frags; cons_rx_buf->page = page; /* Update prod since possibly some pages have been diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 30be21c7d05f..00e8c435fa1a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3491,18 +3491,6 @@ static inline void skb_frag_page_copy(skb_frag_t *fragto, fragto->bv_page = fragfrom->bv_page; } -/** - * __skb_frag_set_page - sets the page contained in a paged fragment - * @frag: the paged fragment - * @page: the page to set - * - * Sets the fragment @frag to contain @page. - */ -static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page) -{ - frag->bv_page = page; -} - bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t prio); /** -- 2.33.0