From: Shakeel Butt <shakeelb@google.com>
To: Mina Almasry <almasrymina@google.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
kvm@vger.kernel.org, virtualization@lists.linux.dev,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"David Howells" <dhowells@redhat.com>,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Christian König" <christian.koenig@amd.com>,
"Yunsheng Lin" <linyunsheng@huawei.com>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>
Subject: Re: [PATCH net-next v3 2/3] net: introduce abstraction for network memory
Date: Thu, 21 Dec 2023 23:23:43 +0000 [thread overview]
Message-ID: <20231221232343.qogdsoavt7z45dfc@google.com> (raw)
In-Reply-To: <20231220214505.2303297-3-almasrymina@google.com>
On Wed, Dec 20, 2023 at 01:45:01PM -0800, Mina Almasry wrote:
> Add the netmem_ref type, an abstraction for network memory.
>
> To add support for new memory types to the net stack, we must first
> abstract the current memory type. Currently parts of the net stack
> use struct page directly:
>
> - page_pool
> - drivers
> - skb_frag_t
>
> Originally the plan was to reuse struct page* for the new memory types,
> and to set the LSB on the page* to indicate it's not really a page.
> However, for compiler type checking we need to introduce a new type.
>
> netmem_ref is introduced to abstract the underlying memory type. Currently
> it's a no-op abstraction that is always a struct page underneath. In
> parallel there is an undergoing effort to add support for devmem to the
> net stack:
>
> https://lore.kernel.org/netdev/20231208005250.2910004-1-almasrymina@google.com/
>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
>
> ---
>
> v3:
>
> - Modify struct netmem from a union of struct page + new types to an opaque
> netmem_ref type. I went with:
>
> +typedef void *__bitwise netmem_ref;
>
> rather than this that Jakub recommended:
>
> +typedef unsigned long __bitwise netmem_ref;
>
> Because with the latter the compiler issues warnings to cast NULL to
> netmem_ref. I hope that's ok.
>
Can you share what the warning was? You might just need __force
attribute. However you might need this __force a lot. I wonder if you
can just follow struct encoded_page example verbatim here.
next prev parent reply other threads:[~2023-12-21 23:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 21:44 [PATCH net-next v3 0/3] Abstract page from net stack Mina Almasry
2023-12-20 21:45 ` [PATCH net-next v3 1/3] vsock/virtio: use skb_frag_*() helpers Mina Almasry
2023-12-21 17:17 ` Willem de Bruijn
2023-12-21 21:39 ` Shakeel Butt
2024-01-02 10:00 ` Stefano Garzarella
2023-12-20 21:45 ` [PATCH net-next v3 2/3] net: introduce abstraction for network memory Mina Almasry
2023-12-21 23:23 ` Shakeel Butt [this message]
2023-12-21 23:44 ` Mina Almasry
2024-01-04 21:44 ` Jakub Kicinski
2024-01-04 22:15 ` Mina Almasry
2024-01-10 17:50 ` Shakeel Butt
2024-01-11 1:35 ` Jakub Kicinski
2023-12-20 21:45 ` [PATCH net-next v3 3/3] net: add netmem_ref to skb_frag_t Mina Almasry
2023-12-21 17:16 ` Simon Horman
2023-12-21 17:18 ` Willem de Bruijn
2023-12-21 23:27 ` Shakeel Butt
2023-12-22 20:10 ` kernel test robot
2023-12-22 23:39 ` kernel test robot
2023-12-23 11:16 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231221232343.qogdsoavt7z45dfc@google.com \
--to=shakeelb@google.com \
--cc=almasrymina@google.com \
--cc=christian.koenig@amd.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=jgg@nvidia.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linyunsheng@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).