Abstract page from net stack
From: | Mina Almasry <almasrymina-AT-google.com> | |
To: | linux-kernel-AT-vger.kernel.org, netdev-AT-vger.kernel.org | |
Subject: | [RFC PATCH net-next v4 0/2] Abstract page from net stack | |
Date: | Tue, 02 Jan 2024 13:27:13 -0800 | |
Message-ID: | <20240102212716.810731-1-almasrymina@google.com> | |
Cc: | Mina Almasry <almasrymina-AT-google.com>, "David S. Miller" <davem-AT-davemloft.net>, Eric Dumazet <edumazet-AT-google.com>, Jakub Kicinski <kuba-AT-kernel.org>, Paolo Abeni <pabeni-AT-redhat.com>, Jason Gunthorpe <jgg-AT-nvidia.com>, "Christian König" <christian.koenig-AT-amd.com>, Shakeel Butt <shakeelb-AT-google.com>, Yunsheng Lin <linyunsheng-AT-huawei.com>, Willem de Bruijn <willemdebruijn.kernel-AT-gmail.com> | |
Archive-link: | Article |
Changes in v4: - Forked off the trivial fixes to skb_frag_t field access to their own patches and changed this to RFC that depends on these fixes: https://lore.kernel.org/netdev/20240102205905.793738-1-al... https://lore.kernel.org/netdev/20240102205959.794513-1-al... - Use an empty struct for netmem instead of void* __bitwise as that's not a correct use of __bitwise. ----------- Changes in v3: - Replaced the struct netmem union with an opaque netmem_ref type. - Added func docs to the netmem helpers and type. - Renamed the skb_frag_t fields since it's no longer a bio_vec ----------- Changes in v2: - Reverted changes to the page_pool. The page pool now retains the same API, so that we don't have to touch many existing drivers. The devmem TCP series will include the changes to the page pool. - Addressed comments. This series is a prerequisite to the devmem TCP series. For a full snapshot of the code which includes these changes, feel free to check: https://github.com/mina/linux/commits/tcpdevmem-rfcv5/ ----------- Currently these components in the net stack use the struct page directly: 1. Drivers. 2. Page pool. 3. skb_frag_t. To add support for new (non struct page) memory types to the net stack, we must first abstract the current memory type. 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 safe compiler type checking we need to introduce a new type. struct netmem 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-a... Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: Christian König <christian.koenig@amd.com> Cc: Shakeel Butt <shakeelb@google.com> Cc: Yunsheng Lin <linyunsheng@huawei.com> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com> Mina Almasry (2): net: introduce abstraction for network memory net: add netmem to skb_frag_t include/linux/skbuff.h | 92 +++++++++++++++++++++++++++++------------- include/net/netmem.h | 41 +++++++++++++++++++ net/core/skbuff.c | 22 +++++++--- net/kcm/kcmsock.c | 9 ++++- 4 files changed, 129 insertions(+), 35 deletions(-) create mode 100644 include/net/netmem.h -- 2.43.0.472.g3155946c3a-goog