Message ID | 20230509114337.21005-1-linyunsheng@huawei.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2817219vqo; Tue, 9 May 2023 04:55:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7GfiyhmYYzaXQTOem3KMoYK+atjkacwBA9sOTmr2o9gKQ8I0HXGvnP2mG+bdi/0NuF7VWT X-Received: by 2002:a17:903:41ca:b0:1ac:6fc3:6beb with SMTP id u10-20020a17090341ca00b001ac6fc36bebmr9905902ple.9.1683633314545; Tue, 09 May 2023 04:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683633314; cv=none; d=google.com; s=arc-20160816; b=APQhbEeLFfbXxyHLTKikkN1UF0FTI9NJTnIppGs0wRYvS1dDzudPhUWQQx2IoNYKRT RJqq9PIqYEaNHSMjOuUZQPb2EQElupXfu9/JPMFGzM8vA8VzHwxb5PTRlgvsgmKZd0RC mq+Jj2qqzX6XFyE+XOpCQ0Eix5Qr1hXwO8mXpSuCenhYWAaNv5EOWmvQrf0ZM1JhRDtz QakpAItbwvXIovcVwjFHXL7Ok8yCMTIPWouNyIXorX+6qS2J2sx3e5la8eiKOyb7Akts wQlHPRxnseDWtSi2V1t5fBIu2b90FEosVkCGsjXKZKqazfhHZlllV10XkcknCF3N+tDL Q17w== 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=FD2AhwAki5xtDvSdgOj60nyAGhGFuT8cf1J4bP1loCyPnOqr1GAqA1zMaigwTvein1 qtaU77aVfwKMV4ZUOZV32r0s6SyK75fe6p/QAfa1V7S2T0Zsw2OL0jIELIqCg6Uah5Co l568+X922kRzhlOQXzTvk71imH4/mCwvyhdQW+novSdjq8sEWR2eewiz9aS4PpmCazoj T+vleCGS3xFIp1wtnnwnlhR2y95gOUIq8lJixgGcw2qY+cyyJSgGmOcoNC9l4BFuOvfQ NmWKUnwY9Ew00kX9UlzkNjyv1fcjevdAOJ87lW/C4ku0QQ754Ut0Y8DBpvjxyYYSsAYy VbcQ== 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 5-20020a170902ee4500b001a64fba3382si1321425plo.148.2023.05.09.04.55.01; Tue, 09 May 2023 04:55: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 S235386AbjEILpX (ORCPT <rfc822;baris.duru.linux@gmail.com> + 99 others); Tue, 9 May 2023 07:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234567AbjEILpU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 9 May 2023 07:45:20 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B66D5116; Tue, 9 May 2023 04:45:19 -0700 (PDT) Received: from dggpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QFxB64JDCzsR5R; Tue, 9 May 2023 19:43:26 +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 <linyunsheng@huawei.com> To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH net-next v1 0/2] introduce skb_frag_fill_page_desc() Date: Tue, 9 May 2023 19:43:35 +0800 Message-ID: <20230509114337.21005-1-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 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, 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: <linux-kernel.vger.kernel.org> 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?1765417486544451153?= |
Series |
introduce skb_frag_fill_page_desc()
|
|
Message
Yunsheng Lin
May 9, 2023, 11:43 a.m. UTC
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(-)
Comments
On Tue, 9 May 2023 19:43:35 +0800 Yunsheng Lin wrote: > 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. Looks like you posted this 3 times and different people replied with their acks to different versions :( Wait awhile, read: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html and repost with all the ack/review tags included.