[RFC PATCH v3 03/12] net: netdev netlink api to bind dma-buf to a net device

2023-11-05 Thread Mina Almasry
API takes the dma-buf fd as input, and binds it to the netdevice. The user can specify the rx queues to bind the dma-buf to. Suggested-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- Changes in v3: - Support binding multiple rx rx-queues --- Documentation/netlink/specs/netdev.yaml

[RFC PATCH v3 02/12] net: page_pool: create hooks for custom page providers

2023-11-05 Thread Mina Almasry
references to be gone before feeding this page back into the pool. Signed-off-by: Jakub Kicinski Signed-off-by: Mina Almasry --- This is implemented by Jakub in his RFC: https://lore.kernel.org/netdev/f8270765-a27b-6ccf-33ea-cda097168...@redhat.com/T/ I take no credit for the idea or impleme

[RFC PATCH v3 01/12] net: page_pool: factor out releasing DMA from releasing the page

2023-11-05 Thread Mina Almasry
From: Jakub Kicinski Releasing the DMA mapping will be useful for other types of pages, so factor it out. Make sure compiler inlines it, to avoid any regressions. Signed-off-by: Jakub Kicinski Signed-off-by: Mina Almasry --- This is implemented by Jakub in his RFC: https://lore.kernel.org

[RFC PATCH v3 00/12] Device Memory TCP

2023-11-05 Thread Mina Almasry
-next with this RFC and memory provider API cherry-picked locally. Hardware: Google Cloud A3 VMs. NIC: GVE with header split & RSS & flow steering support. Jakub Kicinski (2): net: page_pool: factor out releasing DMA from releasing the page net: page_pool: create hooks for custom page provide

[RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-05 Thread Mina Almasry
gures its queues, and re-initializes its page pool. The netdev_dmabuf_binding struct is refcounted, and releases its resources only when all the refs are released. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- RFC v3: - Support multi rx-queu

[RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-05 Thread Mina Almasry
truct. page_pool_iov are refcounted and are freed back to the binding when the refcount drops to 0. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- include/linux/netdevice.h | 13 include/net/page_pool/helpers.h

[RFC PATCH v3 06/12] memory-provider: dmabuf devmem memory provider

2023-11-05 Thread Mina Almasry
for the provider in the page_pool_params. The provider obtains a reference on the netdev_dmabuf_binding which guarantees the binding and the underlying mapping remains alive until the provider is destroyed. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Alma

[RFC PATCH v3 07/12] page-pool: device memory support

2023-11-05 Thread Mina Almasry
check for special handling of page_pool_iov. Signed-off-by: Mina Almasry --- include/net/page_pool/helpers.h | 74 - net/core/page_pool.c| 63 2 files changed, 118 insertions(+), 19 deletions(-) diff --git a/include/net/page

[RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-05 Thread Mina Almasry
Make skb_frag_page() fail in the case where the frag is not backed by a page, and fix its relevent callers to handle this case. Correctly handle skb_frag refcounting in the page_pool_iovs case. Signed-off-by: Mina Almasry --- include/linux/skbuff.h | 42

[RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-05 Thread Mina Almasry
frags of devmem skbs and avoid coalescing devmem skbs with non devmem skbs. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- include/linux/skbuff.h | 14 +++- include/net/tcp.h | 5 +-- net/core/datagram.c| 6 net/core

[RFC PATCH v3 10/12] tcp: RX path for devmem TCP

2023-11-05 Thread Mina Almasry
er_pages, and each page passed to userspace is get_page()'d. This reference is dropped once the userspace indicates that it is done reading this page. All pages are released when the socket is destroyed. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --

[RFC PATCH v3 11/12] net: add SO_DEVMEM_DONTNEED setsockopt to release RX pages

2023-11-05 Thread Mina Almasry
Add an interface for the user to notify the kernel that it is done reading the NET_RX dmabuf pages returned as cmsg. The kernel will drop the reference on the NET_RX pages to make them available for re-use. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry

[RFC PATCH v3 12/12] selftests: add ncdevmem, netcat for devmem TCP

2023-11-05 Thread Mina Almasry
, ncdevmem has a validation mode, where it sends a specific pattern and validates this pattern on the receiver side to ensure data integrity. Suggested-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- RFC v2: - General cleanups (Willem). --- tools/testing/selftests/net/.gitignore | 1 + tools

Re: [RFC PATCH v3 10/12] tcp: RX path for devmem TCP

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 10:44 AM Stanislav Fomichev wrote: > > On 11/05, Mina Almasry wrote: > > In tcp_recvmsg_locked(), detect if the skb being received by the user > > is a devmem skb. In this case - if the user provided the MSG_SOCK_DEVMEM > > flag - pass it to tcp_rec

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > > On 11/05, Mina Almasry wrote: > >> For device memory TCP, we expect the skb headers to be available in host > >> memory for access, and we expect the skb frags t

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev wrote: > > On 11/06, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrote: > > > > > > On 11/6/23 11:47 AM, Stanislav Fomichev wrote: > > > > On 11/05, Mina Almasry wrote: > &g

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > > On 11/06, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 1:59 PM Stanislav Fomichev wrote: > > > > > > On 11/06, Mina Almasry wrote: > > > > On Mon, Nov 6, 2023 at 11:34 AM David Ahern wrot

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 3:37 PM David Ahern wrote: > > On 11/6/23 3:18 PM, Mina Almasry wrote: > >>>>>> @@ -991,7 +993,7 @@ struct sk_buff { > >>>>>> #if IS_ENABLED(CONFIG_IP_SCTP) > >>>>>> __u8

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 4:08 PM Willem de Bruijn wrote: > > On Mon, Nov 6, 2023 at 3:55 PM Stanislav Fomichev wrote: > > > > On Mon, Nov 6, 2023 at 3:27 PM Mina Almasry wrote: > > > > > > On Mon, Nov 6, 2023 at 2:59 PM Stanislav Fomichev wrote: > >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-06 Thread Mina Almasry
On Mon, Nov 6, 2023 at 4:16 PM David Ahern wrote: > > On 11/5/23 7:44 PM, Mina Almasry wrote: > > diff --git a/net/core/datagram.c b/net/core/datagram.c > > index 176eb5834746..cdd4fb129968 100644 > > --- a/net/core/datagram.c > > +++ b/net/core/datagram.c >

Re: [RFC PATCH v3 09/12] net: add support for skbs with unreadable frags

2023-11-07 Thread Mina Almasry
On Mon, Nov 6, 2023 at 5:06 PM Stanislav Fomichev wrote: [..] > > > > And the socket has to know this association; otherwise those tokens > > > > are useless since they don't carry anything to identify the dmabuf. > > > > > > > > I think my other issue with MSG_SOCK_DEVMEM being on recvmsg is that

Re: [RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-07 Thread Mina Almasry
On Tue, Nov 7, 2023 at 1:00 AM Yunsheng Lin wrote: > > On 2023/11/6 10:44, Mina Almasry wrote: > > Make skb_frag_page() fail in the case where the frag is not backed > > by a page, and fix its relevent callers to handle this case. > > > > Correctly hand

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-07 Thread Mina Almasry
On Tue, Nov 7, 2023 at 12:00 AM Yunsheng Lin wrote: > > On 2023/11/6 10:44, Mina Almasry wrote: > > Overload the LSB of struct page* to indicate that it's a page_pool_iov. > > > > Refactor mm calls on struct page* into helpers, and add page_pool_iov > > handli

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-07 Thread Mina Almasry
On Mon, Nov 6, 2023 at 11:46 PM Yunsheng Lin wrote: > > On 2023/11/6 10:44, Mina Almasry wrote: > > + > > +void __netdev_devmem_binding_free(struct netdev_dmabuf_binding *binding) > > +{ > > + size_t size, avail; > > + > > + g

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-07 Thread Mina Almasry
On Mon, Nov 6, 2023 at 3:44 PM David Ahern wrote: > > On 11/5/23 7:44 PM, Mina Almasry wrote: > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > > index eeeda849115c..1c351c138a5b 100644 > > --- a/include/linux/netdevice.h > > +++ b/include/l

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-07 Thread Mina Almasry
On Tue, Nov 7, 2023 at 2:55 PM David Ahern wrote: > > On 11/7/23 3:10 PM, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 3:44 PM David Ahern wrote: > >> > >> On 11/5/23 7:44 PM, Mina Almasry wrote: > >>> diff --git a/include/linux/netdevice.h b/include/

Re: [RFC PATCH v3 10/12] tcp: RX path for devmem TCP

2023-11-07 Thread Mina Almasry
On Mon, Nov 6, 2023 at 4:03 PM Willem de Bruijn wrote: > > On Mon, Nov 6, 2023 at 3:55 PM David Ahern wrote: > > > > On 11/6/23 4:32 PM, Stanislav Fomichev wrote: > > >> The concise notification API returns tokens as a range for > > >> compression, encoding as two 32-bit unsigned integers start +

Re: [RFC PATCH v3 06/12] memory-provider: dmabuf devmem memory provider

2023-11-07 Thread Mina Almasry
On Mon, Nov 6, 2023 at 1:02 PM Stanislav Fomichev wrote: > > On 11/05, Mina Almasry wrote: > > +static inline bool page_is_page_pool_iov(const struct page *page) > > +{ > > + return (unsigned long)page & PP_DEVMEM; > > +} > > Speaking of bpf: one t

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-08 Thread Mina Almasry
> > On Mon, Nov 6, 2023 at 11:45 PM Yunsheng Lin wrote: > >> > >> On 2023/11/6 10:44, Mina Almasry wrote: > >>> + > >>> +void netdev_free_devmem(struct page_pool_iov *ppiov) > >>> +{ > >>> + st

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-08 Thread Mina Almasry
On Tue, Nov 7, 2023 at 7:40 PM Yunsheng Lin wrote: > > On 2023/11/8 5:59, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 11:46 PM Yunsheng Lin wrote: > >> > >> On 2023/11/6 10:44, Mina Almasry wrote: > >>> + > >>> +void __netdev_dev

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-08 Thread Mina Almasry
On Wed, Nov 8, 2023 at 3:47 PM David Wei wrote: > > On 2023-11-05 18:44, Mina Almasry wrote: > > Add a netdev_dmabuf_binding struct which represents the > > dma-buf-to-netdevice binding. The netlink API will bind the dma-buf to > > rx queues on the netdevice. On the bin

Re: [RFC PATCH v3 10/12] tcp: RX path for devmem TCP

2023-11-08 Thread Mina Almasry
On Tue, Nov 7, 2023 at 4:01 PM David Ahern wrote: > > On 11/7/23 4:55 PM, Mina Almasry wrote: > > On Mon, Nov 6, 2023 at 4:03 PM Willem de Bruijn > > wrote: > >> > >> On Mon, Nov 6, 2023 at 3:55 PM David Ahern wrote: > >>> > >>> On 11

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-08 Thread Mina Almasry
On Wed, Nov 8, 2023 at 2:56 AM Yunsheng Lin wrote: > > On 2023/11/8 5:56, Mina Almasry wrote: > > On Tue, Nov 7, 2023 at 12:00 AM Yunsheng Lin wrote: > >> > >> On 2023/11/6 10:44, Mina Almasry wrote: > >>> Overload the LSB of struct p

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-09 Thread Mina Almasry
On Thu, Nov 9, 2023 at 1:30 AM Yunsheng Lin wrote: > > On 2023/11/9 11:20, Mina Almasry wrote: > > On Wed, Nov 8, 2023 at 2:56 AM Yunsheng Lin wrote: > > > > > Agreed everything above is undoable. > > > >> But we might be able to do something as foli

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-09 Thread Mina Almasry
On Thu, Nov 9, 2023 at 12:30 AM Paolo Abeni wrote: > > I'm trying to wrap my head around the whole infra... the above line is > confusing. Why do you increment dma_addr? it will be re-initialized in > the next iteration. > That is just a mistake, sorry. Will remove this increment. On Thu, Nov 9,

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-10 Thread Mina Almasry
On Thu, Nov 9, 2023 at 11:38 PM Yunsheng Lin wrote: > > On 2023/11/10 10:59, Mina Almasry wrote: > > On Thu, Nov 9, 2023 at 12:30 AM Paolo Abeni wrote: > >> > >> I'm trying to wrap my head around the whole infra... the above line is > >> confusing.

Re: [RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-10 Thread Mina Almasry
On Thu, Nov 9, 2023 at 1:15 AM Paolo Abeni wrote: > > On Sun, 2023-11-05 at 18:44 -0800, Mina Almasry wrote: > [...] > > @@ -3421,7 +3446,7 @@ static inline struct page *skb_frag_page(const > > skb_frag_t *frag) > > */ > > static inline voi

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-10 Thread Mina Almasry
On Fri, Nov 10, 2023 at 3:20 PM Jakub Kicinski wrote: > > On Sun, 5 Nov 2023 18:44:03 -0800 Mina Almasry wrote: > > --- a/include/linux/netdevice.h > > +++ b/include/linux/netdevice.h > > @@ -52,6 +52,8 @@ > > #include > > #include > > #include >

Re: [RFC PATCH v3 12/12] selftests: add ncdevmem, netcat for devmem TCP

2023-11-10 Thread Mina Almasry
On Fri, Nov 10, 2023 at 3:13 PM Jakub Kicinski wrote: > > My brain is slightly fried after trying to catch up on the thread > for close to 2h. So forgive me if I'm missing something. > This applies to all emails I'm about to send :) > > On Sun, 5 Nov 2023 18:44

Re: [RFC PATCH v3 02/12] net: page_pool: create hooks for custom page providers

2023-11-12 Thread Mina Almasry
On Fri, Nov 10, 2023 at 3:19 PM Jakub Kicinski wrote: > > On Sun, 5 Nov 2023 18:44:01 -0800 Mina Almasry wrote: > > diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h > > index 6fc5134095ed..d4bea053bb7e 100644 > > --- a/include/net/page_pool/types

Re: [RFC PATCH v3 12/12] selftests: add ncdevmem, netcat for devmem TCP

2023-11-12 Thread Mina Almasry
j On Fri, Nov 10, 2023 at 6:36 PM Jakub Kicinski wrote: > > On Fri, 10 Nov 2023 18:27:08 -0800 Mina Almasry wrote: > > Thanks for the clear requirement. I clearly had something different in mind. > > > > Might be dumb suggestions, but instead of creating a new ndo

Re: [RFC PATCH v3 06/12] memory-provider: dmabuf devmem memory provider

2023-11-12 Thread Mina Almasry
On Fri, Nov 10, 2023 at 3:16 PM Jakub Kicinski wrote: > > On Sun, 5 Nov 2023 18:44:05 -0800 Mina Almasry wrote: > > +static int mp_dmabuf_devmem_init(struct page_pool *pool) > > +{ > > + struct netdev_dmabuf_binding *binding = pool->mp_priv; &

Re: [RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-12 Thread Mina Almasry
On Fri, Nov 10, 2023 at 3:19 PM Jakub Kicinski wrote: > > On Sun, 5 Nov 2023 18:44:07 -0800 Mina Almasry wrote: > > #include > > #include > > +#include > > +#include > > > /** > > * DOC: skb checksums > > @@ -3402,15 +3404,38

[net-next v1 00/16] Device Memory TCP

2023-12-07 Thread Mina Almasry
p; RSS & flow steering support. Jakub Kicinski (2): net: page_pool: factor out releasing DMA from releasing the page net: page_pool: create hooks for custom page providers Mina Almasry (14): queue_api: define queue api gve: implement queue api net: netdev netlink api to bind dma-bu

[net-next v1 01/16] net: page_pool: factor out releasing DMA from releasing the page

2023-12-07 Thread Mina Almasry
From: Jakub Kicinski Releasing the DMA mapping will be useful for other types of pages, so factor it out. Make sure compiler inlines it, to avoid any regressions. Signed-off-by: Jakub Kicinski Signed-off-by: Mina Almasry --- This is implemented by Jakub in his RFC: https://lore.kernel.org

[net-next v1 02/16] net: page_pool: create hooks for custom page providers

2023-12-07 Thread Mina Almasry
references to be gone before feeding this page back into the pool. Signed-off-by: Jakub Kicinski Signed-off-by: Mina Almasry --- This is implemented by Jakub in his RFC: https://lore.kernel.org/netdev/f8270765-a27b-6ccf-33ea-cda097168...@redhat.com/T/ I take no credit for the idea or impleme

[net-next v1 03/16] queue_api: define queue api

2023-12-07 Thread Mina Almasry
This API enables the net stack to reset the queues used for devmem. Signed-off-by: Mina Almasry --- include/linux/netdevice.h | 24 1 file changed, 24 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1b935ee341b4..316f7dee86ce

[net-next v1 04/16] gve: implement queue api

2023-12-07 Thread Mina Almasry
the future. For simplicity the queue API is only supported by the diorite queue out-of-order (DQO) format without queue-page-lists (QPL). Support for other GVE formats can be added in the future as well. Signed-off-by: Mina Almasry --- drivers/net/ethernet/google/gve/gve_adminq.c | 6

[net-next v1 05/16] net: netdev netlink api to bind dma-buf to a net device

2023-12-07 Thread Mina Almasry
API takes the dma-buf fd as input, and binds it to the netdevice. The user can specify the rx queues to bind the dma-buf to. Suggested-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- Changes in v1: - Add rx-queue-type to distingish rx from tx (Jakub) - Return dma-buf ID from netlink

[net-next v1 06/16] netdev: support binding dma-buf to netdevice

2023-12-07 Thread Mina Almasry
gures its queues, and re-initializes its page pool. The netdev_dmabuf_binding struct is refcounted, and releases its resources only when all the refs are released. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- v1: - Introduce devmem.h instead of

[net-next v1 07/16] netdev: netdevice devmem allocator

2023-12-07 Thread Mina Almasry
truct. page_pool_iov are refcounted and are freed back to the binding when the refcount drops to 0. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- v1: - Rename devmem -> dmabuf (David). --- include/net/devmem.h| 13 inc

[net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-07 Thread Mina Almasry
DEV is omitted for simplicity. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- v1: - static_branch check in page_is_page_pool_iov() (Willem & Paolo). - PP_DEVMEM -> PP_IOV (David). - Require PP_FLAG_DMA_MAP (Jakub). --- include/net/page_pool

[net-next v1 10/16] page_pool: don't release iov on elevanted refcount

2023-12-07 Thread Mina Almasry
the page, and so no devmem iovs get recycled. To fix this, don't release iovs on elevated refcount. Signed-off-by: Mina Almasry --- net/core/page_pool.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index f014

[net-next v1 09/16] page_pool: device memory support

2023-12-07 Thread Mina Almasry
check for special handling of page_pool_iov. Signed-off-by: Mina Almasry --- v1: - Disable fragmentation support for iov properly. - fix napi_pp_put_page() path (Yunsheng). --- include/net/page_pool/helpers.h | 78 - net/core/page_pool.c

[net-next v1 11/16] net: support non paged skb frags

2023-12-07 Thread Mina Almasry
Make skb_frag_page() fail in the case where the frag is not backed by a page, and fix its relevant callers to handle this case. Correctly handle skb_frag refcounting in the page_pool_iovs case. Signed-off-by: Mina Almasry --- Changes in v1: - Fix illegal_highdma() (Yunsheng). - Rework

[net-next v1 14/16] net: add SO_DEVMEM_DONTNEED setsockopt to release RX frags

2023-12-07 Thread Mina Almasry
Add an interface for the user to notify the kernel that it is done reading the devmem dmabuf frags returned as cmsg. The kernel will drop the reference on the frags to make them available for re-use. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry

[net-next v1 12/16] net: add support for skbs with unreadable frags

2023-12-07 Thread Mina Almasry
frags of devmem skbs and avoid coalescing devmem skbs with non devmem skbs. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- Changes in v1: - Rename devmem -> dmabuf (David). - Flip skb_frags_not_readable (Jakub). --- include/linux/skbu

[net-next v1 13/16] tcp: RX path for devmem TCP

2023-12-07 Thread Mina Almasry
er_pages, and each page passed to userspace is get_page()'d. This reference is dropped once the userspace indicates that it is done reading this page. All pages are released when the socket is destroyed. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --

[net-next v1 16/16] selftests: add ncdevmem, netcat for devmem TCP

2023-12-07 Thread Mina Almasry
, ncdevmem has a validation mode, where it sends a specific pattern and validates this pattern on the receiver side to ensure data integrity. Suggested-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- Changes in v1: - Many more general cleanups (Willem). - Removed driver reset (Jakub). - Removed

[net-next v1 15/16] net: add devmem TCP documentation

2023-12-07 Thread Mina Almasry
Signed-off-by: Mina Almasry --- Documentation/networking/devmem.rst | 270 1 file changed, 270 insertions(+) create mode 100644 Documentation/networking/devmem.rst diff --git a/Documentation/networking/devmem.rst b/Documentation/networking/devmem.rst new file mode

Re: [net-next v1 00/16] Device Memory TCP

2023-12-07 Thread Mina Almasry
On Thu, Dec 7, 2023 at 4:52 PM Mina Almasry wrote: > > Major changes in v1: > -- > > 1. Implemented MVP queue API ndos to remove the userspace-visible >driver reset. > > 2. Fixed issues in the napi_pp_put_page() devmem frag unref path. > > 3. Rem

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 1:30 AM Yunsheng Lin wrote: > > > As mentioned before, it seems we need to have the above checking every > time we need to do some per-page handling in page_pool core, is there > a plan in your mind how to remove those kind of checking in the future? > I see 2 ways to remov

Re: [net-next v1 06/16] netdev: support binding dma-buf to netdevice

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 9:48 AM David Ahern wrote: > > On 12/7/23 5:52 PM, Mina Almasry wrote: ... > > + > > + xa_for_each(&binding->bound_rxq_list, xa_idx, rxq) { > > + if (rxq->binding == binding) { > > + /* We ho

Re: [net-next v1 13/16] tcp: RX path for devmem TCP

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 9:55 AM David Ahern wrote: > > On 12/7/23 5:52 PM, Mina Almasry wrote: > > In tcp_recvmsg_locked(), detect if the skb being received by the user > > is a devmem skb. In this case - if the user provided the MSG_SOCK_DEVMEM > > flag - pass it to

Re: [net-next v1 07/16] netdev: netdevice devmem allocator

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 9:56 AM David Ahern wrote: > > On 12/7/23 5:52 PM, Mina Almasry wrote: > > diff --git a/net/core/dev.c b/net/core/dev.c > > index b8c8be5a912e..30667e4c3b95 100644 > > --- a/net/core/dev.c > > +++ b/net/core/dev.c > &g

Re: [net-next v1 00/16] Device Memory TCP

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 9:57 AM David Ahern wrote: > > On 12/7/23 5:52 PM, Mina Almasry wrote: > > Major changes in v1: > > -- > > > > 1. Implemented MVP queue API ndos to remove the userspace-visible > >driver reset. > > > > 2. Fi

Re: [net-next v1 06/16] netdev: support binding dma-buf to netdevice

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 11:22 AM Mina Almasry wrote: > > On Fri, Dec 8, 2023 at 9:48 AM David Ahern wrote: > > > > On 12/7/23 5:52 PM, Mina Almasry wrote: > ... > > > + > > > + xa_for_each(&binding->bound_rxq_list, xa_idx, rxq) { &

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 2:56 PM Pavel Begunkov wrote: > > On 12/8/23 00:52, Mina Almasry wrote: ... > > + if (pool->p.queue) > > + binding = READ_ONCE(pool->p.queue->binding); > > + > > + if (binding) { > > + pool->mp_

Re: [net-next v1 06/16] netdev: support binding dma-buf to netdevice

2023-12-10 Thread Mina Almasry
On Sat, Dec 9, 2023 at 3:29 PM David Ahern wrote: > > On 12/8/23 12:22 PM, Mina Almasry wrote: > > On Fri, Dec 8, 2023 at 9:48 AM David Ahern wrote: > >> > >> On 12/7/23 5:52 PM, Mina Almasry wrote: > > ... > >>> + > >>

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-10 Thread Mina Almasry
On Sun, Dec 10, 2023 at 6:04 PM Yunsheng Lin wrote: > > On 2023/12/9 0:05, Mina Almasry wrote: > > On Fri, Dec 8, 2023 at 1:30 AM Yunsheng Lin wrote: > >> > >> > >> As mentioned before, it seems we need to have the above checking every > >> time w

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-10 Thread Mina Almasry
On Sat, Dec 9, 2023 at 7:05 PM Pavel Begunkov wrote: > > On 12/8/23 23:25, Mina Almasry wrote: > > On Fri, Dec 8, 2023 at 2:56 PM Pavel Begunkov > > wrote: > >> > >> On 12/8/23 00:52, Mina Almasry wrote: > > ... > >>> + if (pool-

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-10 Thread Mina Almasry
On Sun, Dec 10, 2023 at 6:26 PM Mina Almasry wrote: > > On Sun, Dec 10, 2023 at 6:04 PM Yunsheng Lin wrote: > > > > On 2023/12/9 0:05, Mina Almasry wrote: > > > On Fri, Dec 8, 2023 at 1:30 AM Yunsheng Lin > > > wrote: > > >> > > >> &g

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-11 Thread Mina Almasry
On Mon, Dec 11, 2023 at 3:51 AM Yunsheng Lin wrote: > > On 2023/12/11 12:04, Mina Almasry wrote: > > On Sun, Dec 10, 2023 at 6:26 PM Mina Almasry wrote: > >> > >> On Sun, Dec 10, 2023 at 6:04 PM Yunsheng Lin > >> wrote: > >>> > >>&

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 4:25 AM Jason Gunthorpe wrote: > > On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: > > > +static inline struct page_pool_iov *page_to_page_pool_iov(struct page > > *page) > > +{ > > + if (page_is_page_pool_iov(page))

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 3:17 AM Yunsheng Lin wrote: > > On 2023/12/12 2:14, Mina Almasry wrote: > > On Mon, Dec 11, 2023 at 3:51 AM Yunsheng Lin wrote: > >> > >> On 2023/12/11 12:04, Mina Almasry wrote: > >>> On Sun, Dec 10, 2023 at 6:26 PM Mina Almasr

Re: [net-next v1 02/16] net: page_pool: create hooks for custom page providers

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 12:07 AM Ilias Apalodimas wrote: > > Hi Mina, > > Apologies for not participating in the party earlier. > No worries, thanks for looking. > On Fri, 8 Dec 2023 at 02:52, Mina Almasry wrote: > > > > From: Jakub Kicinski > > > >

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 6:39 AM Jason Gunthorpe wrote: > > On Tue, Dec 12, 2023 at 06:26:51AM -0800, Mina Almasry wrote: > > On Tue, Dec 12, 2023 at 4:25 AM Jason Gunthorpe wrote: > > > > > > On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: >

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 7:08 AM Jason Gunthorpe wrote: > > On Tue, Dec 12, 2023 at 06:58:17AM -0800, Mina Almasry wrote: > > > Jason, we set the LSB on page_pool_iov pointers before casting it to > > struct page pointers. The resulting pointers are not useable as page >

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-12 Thread Mina Almasry
On Sun, Dec 10, 2023 at 8:04 PM Mina Almasry wrote: > > On Sun, Dec 10, 2023 at 6:26 PM Mina Almasry wrote: > > > > On Sun, Dec 10, 2023 at 6:04 PM Yunsheng Lin wrote: > > > > > > On 2023/12/9 0:05, Mina Almasry wrote: > > > > On Fri, Dec

Re: [net-next v1 00/16] Device Memory TCP

2023-12-13 Thread Mina Almasry
On Wed, Dec 13, 2023 at 10:49 PM Christoph Hellwig wrote: > > On Thu, Dec 14, 2023 at 06:20:27AM +, patchwork-bot+netdev...@kernel.org > wrote: > > Hello: > > > > This series was applied to netdev/net-next.git (main) > > by Jakub Kicinski : > > Umm, this is still very broken in intraction wit

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-14 Thread Mina Almasry
On Mon, Dec 11, 2023 at 12:37 PM Pavel Begunkov wrote: ... > >> If you remove the branch, let it fall into ->release and rely > >> on refcounting there, then the callback could also fix up > >> release_cnt or ask pp to do it, like in the patch I linked above > >> > > > > Sadly I don't think this i

[RFC PATCH net-next v5 00/14] Device Memory TCP

2023-12-17 Thread Mina Almasry
n Kaligineedi Jakub Kicinski (1): net: page_pool: create hooks for custom page providers Mina Almasry (13): net: page_pool: factor out page_pool recycle check net: netdev netlink api to bind dma-buf to a net device netdev: support binding dma-buf to netdevice netdev: netdevice devm

[RFC PATCH net-next v5 01/14] net: page_pool: create hooks for custom page providers

2023-12-17 Thread Mina Almasry
references to be gone before feeding this page back into the pool. Signed-off-by: Jakub Kicinski Signed-off-by: Mina Almasry --- This is implemented by Jakub in his RFC: https://lore.kernel.org/netdev/f8270765-a27b-6ccf-33ea-cda097168...@redhat.com/T/ I take no credit for the idea or impleme

[RFC PATCH net-next v5 02/14] net: page_pool: factor out page_pool recycle check

2023-12-17 Thread Mina Almasry
The check is duplicated in 2 places, factor it out into a common helper. Signed-off-by: Mina Almasry --- net/core/page_pool.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 45bb4210412d..0edb9251d98d 100644 --- a

[RFC PATCH net-next v5 03/14] net: netdev netlink api to bind dma-buf to a net device

2023-12-17 Thread Mina Almasry
API takes the dma-buf fd as input, and binds it to the netdevice. The user can specify the rx queues to bind the dma-buf to. Suggested-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- Changes in v1: - Add rx-queue-type to distingish rx from tx (Jakub) - Return dma-buf ID from netlink

[RFC PATCH net-next v5 04/14] netdev: support binding dma-buf to netdevice

2023-12-17 Thread Mina Almasry
s, and re-initializes its page pool. The netdev_dmabuf_binding struct is refcounted, and releases its resources only when all the refs are released. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- RFC v5: - Renamed page_pool_iov to net_iov, and m

[RFC PATCH net-next v5 05/14] netdev: netdevice devmem allocator

2023-12-17 Thread Mina Almasry
ff-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- v1: - Rename devmem -> dmabuf (David). --- include/net/devmem.h | 12 include/net/netmem.h | 26 ++ net/core/dev.c | 38 ++

[RFC PATCH net-next v5 06/14] page_pool: convert to use netmem

2023-12-17 Thread Mina Almasry
ge is factored out on its own to limit the code churn to this 1 patch, for ease of code review. Signed-off-by: Mina Almasry --- include/linux/skbuff.h | 4 +- include/net/netmem.h | 15 ++ include/net/page_pool/helpers.h | 106 include/net/page_pool/ty

[RFC PATCH net-next v5 07/14] page_pool: devmem support

2023-12-17 Thread Mina Almasry
hether the underlying type is page or net_iov. Implement checks for net_iov in netmem helpers which delegate to mm APIs, to ensure net_iov are never passed to the mm stack. Signed-off-by: Mina Almasry --- RFCv5: - Use netmem instead of page* with LSB set. - Use pp_ref_count for refcounting net_iov.

[RFC PATCH net-next v5 08/14] memory-provider: dmabuf devmem memory provider

2023-12-17 Thread Mina Almasry
is omitted for simplicity & p.order != 0. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- v2: - Disable devmem for p.order != 0 v1: - static_branch check in page_is_page_pool_iov() (Willem & Paolo). - PP_DEVMEM -> PP_IOV (Dav

[RFC PATCH net-next v5 09/14] net: support non paged skb frags

2023-12-17 Thread Mina Almasry
Make skb_frag_page() fail in the case where the frag is not backed by a page, and fix its relevant callers to handle this case. Signed-off-by: Mina Almasry --- Changes in v1: - Fix illegal_highdma() (Yunsheng). - Rework napi_pp_put_page() slightly to reduce code churn (Willem). (cherry

[RFC PATCH net-next v5 10/14] net: add support for skbs with unreadable frags

2023-12-17 Thread Mina Almasry
ags of devmem skbs and avoid coalescing devmem skbs with non devmem skbs. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --- Changes in v1: - Rename devmem -> dmabuf (David). - Flip skb_frags_not_readable (Jakub). --- include/linux/skbu

[RFC PATCH net-next v5 11/14] tcp: RX path for devmem TCP

2023-12-17 Thread Mina Almasry
er_frags, and each page passed to userspace is get_page()'d. This reference is dropped once the userspace indicates that it is done reading this page. All pages are released when the socket is destroyed. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry --

[RFC PATCH net-next v5 12/14] net: add SO_DEVMEM_DONTNEED setsockopt to release RX frags

2023-12-17 Thread Mina Almasry
Add an interface for the user to notify the kernel that it is done reading the devmem dmabuf frags returned as cmsg. The kernel will drop the reference on the frags to make them available for re-use. Signed-off-by: Willem de Bruijn Signed-off-by: Kaiyuan Zhang Signed-off-by: Mina Almasry

[RFC PATCH net-next v5 13/14] net: add devmem TCP documentation

2023-12-17 Thread Mina Almasry
Signed-off-by: Mina Almasry --- v1 -> v2: - Missing spdx (simon) - add to index.rst (simon) --- Documentation/networking/devmem.rst | 271 Documentation/networking/index.rst | 1 + 2 files changed, 272 insertions(+) create mode 100644 Documentation/network

[RFC PATCH net-next v5 14/14] selftests: add ncdevmem, netcat for devmem TCP

2023-12-17 Thread Mina Almasry
, ncdevmem has a validation mode, where it sends a specific pattern and validates this pattern on the receiver side to ensure data integrity. Suggested-by: Stanislav Fomichev Signed-off-by: Mina Almasry --- Changes in v1: - Many more general cleanups (Willem). - Removed driver reset (Jakub). - Removed

Re: [RFC PATCH net-next v5 05/14] netdev: netdevice devmem allocator

2024-02-13 Thread Mina Almasry
On Tue, Feb 13, 2024 at 5:24 AM Pavel Begunkov wrote: > > On 12/18/23 02:40, Mina Almasry wrote: > > Implement netdev devmem allocator. The allocator takes a given struct > > netdev_dmabuf_binding as input and allocates net_iov from that > > binding. > > > > Th

Re: [RFC PATCH net-next v5 07/14] page_pool: devmem support

2024-02-13 Thread Mina Almasry
On Tue, Feb 13, 2024 at 5:28 AM Pavel Begunkov wrote: > > On 12/18/23 02:40, Mina Almasry wrote: > > Convert netmem to be a union of struct page and struct netmem. Overload > > the LSB of struct netmem* to indicate that it's a net_iov, otherwise > > it's a page.

[RFC PATCH net-next v6 00/15] Device Memory TCP

2024-03-04 Thread Mina Almasry
p; flow steering support. Cc: Pavel Begunkov Cc: David Wei Cc: Jason Gunthorpe Cc: Yunsheng Lin Cc: Shailend Chand Cc: Harshitha Ramamurthy Cc: Shakeel Butt Cc: Jeroen de Borst Cc: Praveen Kaligineedi Jakub Kicinski (1): net: page_pool: create hooks for custom page providers Mina Almasry (14

[RFC PATCH net-next v6 01/15] queue_api: define queue api

2024-03-04 Thread Mina Almasry
This API enables the net stack to reset the queues used for devmem. Signed-off-by: Mina Almasry --- include/linux/netdevice.h | 24 1 file changed, 24 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c41019f34179..3105c586355d

  1   2   3   4   5   >