From patchwork Tue May 9 11:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 9086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2818176vqo; Tue, 9 May 2023 04:57:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4pAhLM+0ZpNCgInx/u3Y5pNBcF+U2wUYjcSpeugD9NhOL3Rui5ZTtI2Tq4/BXsQQtLudE/ X-Received: by 2002:a05:6a20:7490:b0:e4:b52:76c9 with SMTP id p16-20020a056a20749000b000e40b5276c9mr16966014pzd.23.1683633434702; Tue, 09 May 2023 04:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683633434; cv=none; d=google.com; s=arc-20160816; b=ye/lF0ejM7YSvodieIXYlpT9F+5SjQqFgfxBIXRdaSxUMqBCrpCMs+wbrg/ST71gYQ +Z9m7DmzeCPejZxcYal5W7RdIp6sJXPDB2ulL0nWMHqODRZIn48F9wJJ5+FGSzEBMbMC rxo33uyWAjZoynuDcH5imFXy4PeYYGtveyCJAQhaNs/x+CB+lCIj6ztJRlvx3r8Hgr6R YQIIZf4WzpmrlVmdEDjH4We17pu3T6ncTKQBzZCcON333cppNDusbEe+U2jUWgawvCF2 3y1NF503MdGd2ngOoMirtZ/FK8Baqz8WGyuNMkWUdesl+RWixL3AjCL4U+mmGv3anwMy 0tVw== 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=AKESNoIjpvM8L58bBQz7Tci9CJ5MGaqnBhAFFkNRIss=; b=D/CZTb+cN3LlhNTXs+C1Tpx/GpYISpM+Jr7YU7iu8S4BbhDSnAQDS/rdsAvkVokg3p NA8t6LCTBYHuKr8cav+3Ljy5Ny+yk+z7wPSlbKs9K2FxUS1/WDCkCflLXJqAdAHvRdeH VE3kruaPcpXaDnZCvC5sLY3whBMgKwXg6TNF1pOK6jJqKlUTpDOXX9Y+n8J2RoaLP1AU wfc091dCA2TGav4C8qCer5jdckmZjjo8Iw32A3lPxRPrUy1/Pr+CVR3jqKf1//TnMfzk qdU1gNLrtsjgU39mCc8rHoy7As5npTx/qG2JPjdO3ckyu6KcRe7XO07ovAXgWT4Z4y// aLUw== 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 l65-20020a633e44000000b0052c6e736ad1si1473480pga.61.2023.05.09.04.56.59; Tue, 09 May 2023 04:57:14 -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 S235358AbjEILoV (ORCPT + 99 others); Tue, 9 May 2023 07:44:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbjEILoS (ORCPT ); Tue, 9 May 2023 07:44:18 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C361998; Tue, 9 May 2023 04:44:17 -0700 (PDT) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QFx9c6PCnzpWF3; Tue, 9 May 2023 19:43:00 +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:44:13 +0800 From: Yunsheng Lin To: , , CC: , Subject: [PATCH net-next v1 0/2] introduce skb_frag_fill_page_desc() Date: Tue, 9 May 2023 19:42:30 +0800 Message-ID: <20230509114232.20986-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: dggems703-chm.china.huawei.com (10.3.19.180) 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,URIBL_BLOCKED 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?1765417486544451153?= X-GMAIL-MSGID: =?utf-8?q?1765417612368920872?= Most users use __skb_frag_set_page()/skb_frag_off_set()/ skb_frag_size_set() to fill the page desc for a skb frag. It does not make much sense to calling __skb_frag_set_page() without calling skb_frag_off_set(), as the offset may depend on whether the page is head page or tail page, so add skb_frag_fill_page_desc() to fill the page desc for a skb frag. In the future, we can make sure the page in the frag is head page of compound page or a base page, if not, we may warn about that and convert the tail page to head page and update the offset accordingly, if we see a warning about that, we also fix the caller to fill the head page in the frag. when the fixing is done, we may remove the warning and converting. In this way, we can remove the compound_head() or use page_ref_*() like the below case: https://elixir.bootlin.com/linux/latest/source/net/core/page_pool.c#L881 https://elixir.bootlin.com/linux/latest/source/include/linux/skbuff.h#L3383 It may also convert net stack to use the folio easier. RFC: remove a local variable as pointed out by Simon. Yunsheng Lin (2): net: introduce and use skb_frag_fill_page_desc() net: remove __skb_frag_set_page() .../net/ethernet/aquantia/atlantic/aq_ring.c | 6 +-- drivers/net/ethernet/broadcom/bnx2.c | 1 - drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 ++--- drivers/net/ethernet/chelsio/cxgb3/sge.c | 5 +-- drivers/net/ethernet/emulex/benet/be_main.c | 32 ++++++++------- drivers/net/ethernet/freescale/enetc/enetc.c | 5 +-- .../net/ethernet/fungible/funeth/funeth_rx.c | 5 +-- drivers/net/ethernet/marvell/mvneta.c | 5 +-- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 4 +- drivers/net/ethernet/sun/cassini.c | 8 +--- drivers/net/virtio_net.c | 4 +- drivers/net/vmxnet3/vmxnet3_drv.c | 4 +- drivers/net/xen-netback/netback.c | 4 +- include/linux/skbuff.h | 39 +++++-------------- net/bpf/test_run.c | 3 +- net/core/gro.c | 4 +- net/core/pktgen.c | 13 ++++--- net/core/skbuff.c | 7 ++-- net/tls/tls_device.c | 10 ++--- net/xfrm/xfrm_ipcomp.c | 5 +-- 20 files changed, 65 insertions(+), 109 deletions(-)