From patchwork Tue May 9 11:46:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 91547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2818308vqo; Tue, 9 May 2023 04:57:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kAHxOScH4nLsETRfLfzDyvZt8DN4HsnzoUVJl9fZgVMJUYeVDBa7E8xGf9SOBUMevnp40 X-Received: by 2002:a17:902:e5d2:b0:1ac:7969:cd67 with SMTP id u18-20020a170902e5d200b001ac7969cd67mr7801602plf.21.1683633454754; Tue, 09 May 2023 04:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683633454; cv=none; d=google.com; s=arc-20160816; b=IChfRL6OvGW1t7OimIgXPd5fsldUlqsl0xwS2LcL1qpE/hIj7Z9+Mb1ZqozBeEigGp YWU/RnIzIEj9ZIDxx3pRLHwyloM3GbIVNifcj13//2vZn1NauqHUSUkeLH+Pp/JodrJs n7t5LI8QGJ5FXrUm03kIpRDPrwh/vIEEjcits71Klh6W3xMO4r5m/zqJ/W88dS3C+WHk UDXgnmNT3JhkBcEgC3t0qI+2hx+suoLXDHwDR6JHvDY0X7fDOQ17cTz2JiYMIIzdsPdB Q78N5M1fJtvlxxL4sVeqPFG2hzgh6eMLXmuv1rf2L/rlc2C5GW1t0SNeCgolKIyq/w94 O23w== 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 :message-id:date:subject:cc:to:from; bh=DGY0dcqQclmk1XQQOW/lMmRWBr+Yc1d2PrBM/9ekQRM=; b=zefb9sDpo7Q1CTLlgZoR1SKPL8nM/G+HkzZg80DeKfIurYi0uOzEWxw5TwBPWQlmGd 4aimmrVC/aG5b9aIgSIo5SaqQpoDHgVWDYIyE7PukCn91CPXOXSnnGufZ75a62fh9Yjr 99u5aPUVKoD540oS/+T/CEXd14GZD9YkYz6HFIgA+WaDcljqKvlQQ/IzrPuKde2CQMhF LXLaTm/eHfkftfBM9QOuF9VOA1j8gJ9nUYCw6ApvZ8jRqtO3jp3CCZ14eop9Ud1pBLGf NMVYl3mvd50S6zpxSoFb5v6uFIAT5Yiw868w1/nRi18DnVBM8cJXH/dwb/uUd0JtN6Wm whAg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a170903018f00b001a922d1f4c7si1450727plg.60.2023.05.09.04.57.19; Tue, 09 May 2023 04:57:34 -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 S235359AbjEILs1 (ORCPT + 99 others); Tue, 9 May 2023 07:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235568AbjEILsV (ORCPT ); Tue, 9 May 2023 07:48:21 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852D5468F; Tue, 9 May 2023 04:48:16 -0700 (PDT) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QFxBL1KxDzTkDk; Tue, 9 May 2023 19:43:38 +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:48:14 +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:46:34 +0800 Message-ID: <20230509114634.21079-1-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765417323998810824?= X-GMAIL-MSGID: =?utf-8?q?1765417633686981417?= 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 Reviewed-by: Michael Chan Reviewed-by: Jesse Brandeburg Reviewed-by: Simon Horman --- 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); /**