Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5796647rdb; Wed, 13 Dec 2023 22:34:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHDyHAoJT3eeyPgOGqG6/eJsfgrv3OENO3fMFyg8u9DAzOhvtXQ7CbKO0ou2f7V/EKiyD+ X-Received: by 2002:a05:6a21:998a:b0:18f:ea5b:683e with SMTP id ve10-20020a056a21998a00b0018fea5b683emr12492732pzb.85.1702535692560; Wed, 13 Dec 2023 22:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702535692; cv=none; d=google.com; s=arc-20160816; b=aAVlx6B8qUkPM2Gc/nq1KIThrEnR82mgcJ5RhlvauqmG+Emcqd2bOI9en/EvDbkdbY Xlgf7omqhBqYXWHVwIcPbM9SxkceIGqPa/28kvgmSbqkwehRW2S1H66QX/vI2raoSc4c 5ZZvqjINjVwOHF+zTbiZRXsFzvID4Rwf8DZCloZkKuUsVSwcv5Nv8nSGYY5DvyWH6bnh rQuM3b5n7m1ufnZlvri+MvVZRcOztTaO+NRRETsGVZqFdRLhaIO3YaVd94I7tb4WekFx qdO+5figihN84/fP8JliNduKgq1VNBQs/djesfNwArXIBP/JLHLUTvtbTuB+L5CFD3yj STow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hJhKTzOZ/kcVX8QKcpWmSSvmzfxII0wEoMStW9hZ7CE=; fh=44XcX9H6IuDjGc+wIzW1df+GjOzISEx4HTDYauchgjk=; b=Rjdbt76OkJzXWXcoie19q2baB50V8eGaR+m6uDFZwSKhN+NidYuC9rubQmScvBr8JR HmUUuGedQiE43lfwC3pICEhIf4hh3YG92+RY/BDHD68YnpNsyG5UJENBMUzuFNF1hdns T/C1f+MP7ejUagby79dRIKKj9tFmmkri/Qi9sq1APAMe5rOf2ZfGLymUc7JjxtbqmDzg f0lqC2ZyGiX8pCjyQL5jx2YOkzydiip/yukTCzazyCGX/gl2PaHlsyYXahJd273P7Aks CEAQ2DqGS3rVftnsTVq8KFjlgNJCVhKoCqjwtBoLdo+YJkbxktNRJ6CnUDyVUvS2eCIP 4MIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VlJb41ft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s13-20020a056a00194d00b006cef51f51bdsi8651896pfk.15.2023.12.13.22.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 22:34:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VlJb41ft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6AAB2802A6F2; Wed, 13 Dec 2023 22:34:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234281AbjLNGel (ORCPT + 99 others); Thu, 14 Dec 2023 01:34:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjLNGek (ORCPT ); Thu, 14 Dec 2023 01:34:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D42AF4 for ; Wed, 13 Dec 2023 22:34:47 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C84CCC433C8; Thu, 14 Dec 2023 06:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702535686; bh=1KvqRRdnwqEvmlU+FTtgALcCS9FN2+H6/ZpytPxQYp8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=VlJb41ftGhuFO+GxwcbjBxwGRGB2zf1smUTBpPP4JBA21Ox58C2c4TJJyLD2oij5K mhW89hPQm8fkU3MEjAcZ53HkyHmCdWYJQhc/LAI1IGQAIuilBVJ6gO00dm42gKkRK9 T7P/gPUcj7Y3pkkaSoG3q/lhkVoLzh1sDJjSvR7LrXNUBxF8Ep4GagCnjp4YRTCjIl f5haY1z8EdeGAaTNu6Xej1GiLHDG9EFd/kM3doSgDZS1KbY6yxPLrJSkvhiuYkdYYK /q7BhYSEXQSWZIKGts3JsXifLENy7qPEzo+qd1/2oy0Lu4OzsIrqNxAnpvL2KkQUpK iDg8FMq/DWfPw== Message-ID: <80e14311-61ba-4dda-93bb-991ad4b779df@kernel.org> Date: Wed, 13 Dec 2023 22:34:43 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH net-next v1 2/4] net: introduce abstraction for network memory Content-Language: en-US To: Mina Almasry , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Michael Chan , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Thomas Petazzoni , Marcin Wojtas , Russell King , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Saeed Mahameed , Leon Romanovsky , Horatiu Vultur , UNGLinuxDriver@microchip.com, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Jassi Brar , Ilias Apalodimas , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Siddharth Vadapalli , Ravi Gunasekaran , Roger Quadros , Jiawen Wu , Mengyuan Lou , Ronak Doshi , VMware PV-Drivers Reviewers , Ryder Lee , Shayne Chen , Kalle Valo , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Stefan Hajnoczi , Stefano Garzarella , Shuah Khan , =?UTF-8?Q?Micka=C3=ABl_Sala=C3=BCn?= , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Jason Gunthorpe , Shakeel Butt , Yunsheng Lin , Willem de Bruijn References: <20231214020530.2267499-1-almasrymina@google.com> <20231214020530.2267499-3-almasrymina@google.com> From: David Ahern In-Reply-To: <20231214020530.2267499-3-almasrymina@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 22:34:51 -0800 (PST) On 12/13/23 7:05 PM, Mina Almasry wrote: > diff --git a/include/net/netmem.h b/include/net/netmem.h > new file mode 100644 > index 000000000000..e4309242d8be > --- /dev/null > +++ b/include/net/netmem.h > @@ -0,0 +1,35 @@ > +/* SPDX-License-Identifier: GPL-2.0 > + * > + * netmem.h > + * Author: Mina Almasry > + * Copyright (C) 2023 Google LLC > + */ > + > +#ifndef _NET_NETMEM_H > +#define _NET_NETMEM_H > + > +struct netmem { > + union { > + struct page page; > + > + /* Stub to prevent compiler implicitly converting from page* > + * to netmem_t* and vice versa. > + * > + * Other memory type(s) net stack would like to support > + * can be added to this union. > + */ > + void *addr; > + }; > +}; > + > +static inline struct page *netmem_to_page(struct netmem *netmem) > +{ > + return &netmem->page; > +} > + > +static inline struct netmem *page_to_netmem(struct page *page) > +{ > + return (struct netmem *)page; container_of; no typecasts. > +} > + > +#endif /* _NET_NETMEM_H */