Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1189762rwb; Wed, 26 Jul 2023 08:48:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlH1nvdF8yh/o9V0xjB6SSsocL1H9Z16Vb8EGFxjyrb93YyYuD4VsghyT6pa1wwIPOqD/I0K X-Received: by 2002:a05:6a21:71cb:b0:105:6d0e:c046 with SMTP id ay11-20020a056a2171cb00b001056d0ec046mr2964306pzc.26.1690386538509; Wed, 26 Jul 2023 08:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690386538; cv=none; d=google.com; s=arc-20160816; b=nUf2Hd4sW2pwdr2g5F7elWTogaB6EPnSA/SRP0812ClI38CxA1ViHmjiEVmKQ7upnX jlo5hE1Y4z0ZXc3LaeIHaYjiQoYkcCTUFJxJ8baGB6JSh2jI2a0a7pnWbLZVMJ4ml99y BheyQ2jkTJ3VxTO3GT1YGv/0h+VmGRn6JKxT1CFPuBHPz246wKnRL7pTw76UI8MAmP1Q pAQT4O937GADy7dXHfTOJfJtH+Q4w8thfU5zeB/yDX45fmkW/jASru7uEysYh8JJyzyv t/GOrpk1W1Ae8Gllju+GSTKbZNJXn12f1fkcfSX6V24bGH49efdyOG44Va5Bxds2i7TS TDPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=QIvg9RvPixHqfad2Kamp9kJBh4DIZcFMKZRn7pfOsNE=; fh=yUIm0mzMpo3AljN0IHjCYq5sTQhUHvzwhW+RJvjOGjI=; b=jF46DzzBaeJ6nsdXJNMz9kpGXOFRPogUp+xuf2cFbVwVh1b+QtXngD2404uDUgFsky uaiG0EOkXsVOTsWdXHOnZdev5TODH1hWlAm3Kbzc7Hn2Pobeql9V1/JqWjssjMcfQWAt KQEf/6N4gQJQMi0U9VZpZPd7n7Pe527zCVFMc8WT4oKr20qQ0OLba8+y+eJxua8rbUc9 q22LugHhiMw86iUumNhfZIoCTJ6G8Jw2YW+jiwMGia+kY4+JtjrXlFdihlh8czaxcGpw 4FI5jvHhr9CbZ3m/svUBONHbpjBG8qaUB5GKc0JifTAFQYRVsiSKBplehTO4p7MFTKCk Ym0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UvNxr8eL; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j190-20020a6380c7000000b00563dc551164si1890792pgd.162.2023.07.26.08.48.42; Wed, 26 Jul 2023 08:48:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UvNxr8eL; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234303AbjGZPbC (ORCPT + 58 others); Wed, 26 Jul 2023 11:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233997AbjGZPbA (ORCPT ); Wed, 26 Jul 2023 11:31:00 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFEBD2701; Wed, 26 Jul 2023 08:30:54 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-686bd857365so1101499b3a.3; Wed, 26 Jul 2023 08:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690385454; x=1690990254; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QIvg9RvPixHqfad2Kamp9kJBh4DIZcFMKZRn7pfOsNE=; b=UvNxr8eLJ9hNPoNo/nmVkgjI4LmuR9ztzcTY+8rMIzSoHv7gwljQlaHHd92gm95UVm nU56pgA2IgpkZ87/1SXR5DOwjHop16+wfwPEV6IS33mO1QlQi6mSJ8FVmwoSi/+kZx4P qanoK+6WcjuZX7MFStjdzc0nrwV3XSiclq3I9Cq47+YLuQmJjCuttPtZTA47gY8Px5VL M0KGCrZjA8PmkcEwyq7+BkhWwhnMHinBdCCuaa+ygSj2WTJ1OO0iLTikgnWKqb83HYA/ 7qGLhQ84+9qqmlQzBfUs/lur7fuEApadKSY61qyN9KpEKVsfsHhr/QJ2E0h+XppBvQji sYQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690385454; x=1690990254; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QIvg9RvPixHqfad2Kamp9kJBh4DIZcFMKZRn7pfOsNE=; b=RwbvIAEsfrnnAkZp10d5GK2xnJ/PISXCb4hDRbDeoDEAmfqr/c4Ry6lcfXUFfrCNcq /YuhuMlV5YN/35P4vjYhnxHYyM4BmmUDKUTu5/TirswnbZ9XEu5zOFbpWIYFsYTOSH06 xXSVVKhkHcEX3IxTQb9HvIVvz41o3dl1jg/0P+BkXFrleILggOmvUXldqNR/Yy4rmDY/ P0yx34lN5RE6pu2uVLYN554MMMEu63ERszFVgcobyM4pMxinpMBUuk6fhQPtNZIrvjPt TuTkFx4KMcefaApb59FNLM4lPOOaEDRR/gr/HWit9Jg1XcHv0x1uze8oFF8beD4yzzoH INyg== X-Gm-Message-State: ABy/qLaxNMwdkA9M8i8MKjifByrfhN1ISoeOjHYk1hO/kqAgpCx+3V03 cXLWMZBv4nW+bJU2y4bHpyqZhuyxoMLZPOtpal4= X-Received: by 2002:a17:90b:a4e:b0:268:5620:cfc7 with SMTP id gw14-20020a17090b0a4e00b002685620cfc7mr1509855pjb.30.1690385453708; Wed, 26 Jul 2023 08:30:53 -0700 (PDT) MIME-Version: 1.0 References: <20230725131258.31306-1-linyunsheng@huawei.com> <94272ffed7636c4c92fcc73ccfc15236dd8e47dc.camel@gmail.com> <16b4ab57-dfb0-2c1d-9be1-57da30dff3c3@intel.com> <22af47fe-1347-3e32-70bf-745d833e88b9@huawei.com> In-Reply-To: <22af47fe-1347-3e32-70bf-745d833e88b9@huawei.com> From: Alexander Duyck Date: Wed, 26 Jul 2023 08:30:17 -0700 Message-ID: Subject: Re: [PATCH net-next v2] page_pool: split types and declarations from page_pool.h To: Yunsheng Lin Cc: Alexander Lobakin , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Saeed Mahameed , Leon Romanovsky , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Ilias Apalodimas , linux-rdma@vger.kernel.org, bpf@vger.kernel.org, linux-wireless@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-wireless@vger.kernel.org On Wed, Jul 26, 2023 at 4:23=E2=80=AFAM Yunsheng Lin wrote: > > On 2023/7/26 18:43, Alexander Lobakin wrote: > > From: Alexander H Duyck > > Date: Tue, 25 Jul 2023 08:47:46 -0700 > > > >> On Tue, 2023-07-25 at 21:12 +0800, Yunsheng Lin wrote: > >>> Split types and pure function declarations from page_pool.h > >>> and add them in page_pool/types.h, so that C sources can > >>> include page_pool.h and headers should generally only include > >>> page_pool/types.h as suggested by jakub. > >>> > >>> Signed-off-by: Yunsheng Lin > >>> Suggested-by: Jakub Kicinski > >>> CC: Alexander Lobakin > > > > [...] > > > >>> +/* Caller must provide appropriate safe context, e.g. NAPI. */ > >>> +void page_pool_update_nid(struct page_pool *pool, int new_nid); > >>> + > >>> +#endif /* _NET_PAGE_POOL_H */ > >> > >> > >> This seems kind of overkill for what is needed. It seems like the > >> general thought process with splitting this was so that you had just > >> the minimum of what is needed to support skbuff.h and the functions > >> declared there. The rest of this would then be added via the .h to the > >> .c files that will actually be calling the functions. > >> > >> By that logic I think the only thing we really need is the function > >> declaration for page_pool_return_skb_page moved into skbuff.h. We coul= d > >> then just remove page_pool.h from skbuff.h couldn't we? > > > > This patch is not to drop page_pool.h include from skbuff.h. > > This is more future-proof (since I'm dropping this include anyway in my > > series) to have includes organized and prevent cases like that one with > > skbuff.h from happening. And to save some CPU cycles on preprocessing i= f > > that makes sense. > > The suggestion is from below: > > https://lore.kernel.org/all/20230710113841.482cbeac@kernel.org/ I get that. But it seemed like your types.h is full of inline functions. That is what I was responding to. I would leave the inline functions in page_pool.h unless there is some significant need for them. > > > >> > >> Another thing we could consider doing is looking at splitting things u= p > >> so that we had a include file in net/core/page_pool.h to handle some o= f > >> the cases where we are just linking the page_pool bits to other core > >> file bits such as xdp.c and skbuff.c. > > I suppose the above suggestion is about splitting or naming by > the user as the discussed in the below thread? > https://lore.kernel.org/all/20230721182942.0ca57663@kernel.org/ Actually my suggestion is more about defining boundaries for what is meant to be used by drivers and what isn't. The stuff you could keep in net/core/page_pool.h would only be usable by the files in net/core/ whereas the stuff you are keeping in the include/net/ folder is usable by drivers. It is meant to prevent things like what you were complaining about with the Mellanox drivers making use of interfaces you didn't intend them to use. So for example you could pull out functions like page_pool_return_skb_page, page_pool_use_xdp_mem, page_pool_update_nid, and the like and look at relocating them into the net/core/ folder and thereby prevent abuse of those functions by drivers.