Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

2024-06-09 Thread David Wei
On 2024-06-07 17:52, Jason Gunthorpe wrote: > IMHO it seems to compose poorly if you can only use the io_uring > lifecycle model with io_uring registered memory, and not with DMABUF > memory registered through Mina's mechanism. By this, do you mean io_uring must be exclusively used to use this

Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

2024-06-09 Thread David Wei
On 2024-06-07 17:27, David Ahern wrote: > I also do not understand why the ifq cache and overloading xdp functions > have stuck around; I always thought both were added by Jonathan to > simplify kernel ports during early POC days. Setting up an Rx queue for ZC w/ a different pp will be done

Re: [PATCH net-next v10 01/14] netdev: add netdev_rx_queue_restart()

2024-05-30 Thread David Wei
On 2024-05-30 13:16, Mina Almasry wrote: [...] > +err_start_queue: > + /* Restarting the queue with old_mem should be successful as we haven't > + * changed any of the queue configuration, and there is not much we can > + * do to recover from a failure here. > + * > + *

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

2024-05-23 Thread David Wei
On 2024-05-10 16:21, Mina Almasry wrote: > +/* On error, returns the -errno. On success, returns number of bytes sent to > the > + * user. May not consume all of @remaining_len. > + */ > +static int tcp_recvmsg_dmabuf(struct sock *sk, const struct sk_buff *skb, > +

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

2024-05-18 Thread David Wei
On 2024-05-10 16:21, Mina Almasry wrote: > -/* Stub */ > int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) > { > - return 0; > + struct nlattr *tb[ARRAY_SIZE(netdev_queue_dmabuf_nl_policy)]; > + struct net_devmem_dmabuf_binding *out_binding; > + struct

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

2024-05-18 Thread David Wei
On 2024-05-10 16:21, Mina Almasry wrote: > +void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding) > +{ > + struct netdev_rx_queue *rxq; > + unsigned long xa_idx; > + unsigned int rxq_idx; > + > + if (!binding) > + return; > + > + if

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

2024-05-17 Thread David Wei
On 2024-05-10 16:21, Mina Almasry wrote: > +/* This returns the absolute dma_addr_t calculated from > + * net_iov_owner(niov)->owner->base_dma_addr, not the page_pool-owned > + * niov->dma_addr. > + * > + * The absolute dma_addr_t is a dma_addr_t that is always uncompressed. > + * > + * The

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

2024-05-05 Thread David Wei
On 2024-05-01 00:55, Christoph Hellwig wrote: > On Fri, Apr 26, 2024 at 05:17:52PM -0700, David Wei wrote: >> On 2024-04-02 5:20 pm, Mina Almasry wrote: >>> @@ -69,20 +106,26 @@ net_iov_binding(const struct net_iov *niov) >>> */ >>> typedef unsigned long __b

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

2024-04-26 Thread David Wei
On 2024-04-02 5:20 pm, Mina Almasry wrote: > @@ -69,20 +106,26 @@ net_iov_binding(const struct net_iov *niov) > */ > typedef unsigned long __bitwise netmem_ref; > > +static inline bool netmem_is_net_iov(const netmem_ref netmem) > +{ > +#if defined(CONFIG_PAGE_POOL) &&

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

2024-04-24 Thread David Wei
On 2024-04-02 5:20 pm, 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 binding, the dma_buf_attach > & dma_buf_map_attachment will occur. The entries in the

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread David Wei
On 2024-04-02 10:31, Jakub Kicinski wrote: > On Tue, 2 Apr 2024 18:37:44 +0200 Petr Machata wrote: >> Yeah, this would be usually done through context managers, as I mention >> in the other e-mail. But then cfg would be lexically scoped, which IMHO >> is a good thing, but then it needs to be

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread David Wei
On 2024-04-01 18:05, Jakub Kicinski wrote: > Add a very simple test to make sure drivers report expected > stats. Drivers which implement FEC or pause configuration > should report relevant stats. Qstats must be reported, > at least packet and byte counts, and they must match > total device stats.

Re: [PATCH net-next 6/7] selftests: drivers: add scaffolding for Netlink tests in Python

2024-04-02 Thread David Wei
On 2024-04-01 18:05, Jakub Kicinski wrote: > Add drivers/net as a target for mixed-use tests. > The setup is expected to work similarly to the forwarding tests. > Since we only need one interface (unlike forwarding tests) > read the target device name from NETIF. If not present we'll > try to run

Re: [PATCH net-next 5/7] netdevsim: report stats by default, like a real device

2024-04-02 Thread David Wei
On 2024-04-01 18:05, Jakub Kicinski wrote: > Real devices should implement qstats. Devices which support > pause or FEC configuration should also report the relevant stats. > > nsim was missing FEC stats completely, some of the qstats > and pause stats required toggling a debugfs knob. > > Note

Re: [PATCH net-next 4/7] selftests: nl_netdev: add a trivial Netlink netdev test

2024-04-02 Thread David Wei
On 2024-04-01 18:05, Jakub Kicinski wrote: > Add a trivial test using YNL. > > $ ./tools/testing/selftests/net/nl_netdev.py > KTAP version 1 > 1..2 > ok 1 nl_netdev.empty_check > ok 2 nl_netdev.lo_check > > Instantiate the family once, it takes longer than the test itself. > >

Re: [PATCH net-next 3/7] selftests: net: add scaffolding for Netlink tests in Python

2024-04-02 Thread David Wei
On 2024-04-01 18:05, Jakub Kicinski wrote: > Add glue code for accessing the YNL library which lives under > tools/net and YAML spec files from under Documentation/. > Automatically figure out if tests are run in tree or not. > Since we'll want to use this library both from net and > drivers/net

Re: [RFC PATCH net-next v6 02/15] net: page_pool: create hooks for custom page providers

2024-03-17 Thread David Wei
On 2024-03-17 19:02, Christoph Hellwig wrote: > On Mon, Mar 04, 2024 at 06:01:37PM -0800, Mina Almasry wrote: >> From: Jakub Kicinski >> >> The page providers which try to reuse the same pages will >> need to hold onto the ref, even if page gets released from >> the pool - as in releasing the

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

2024-03-08 Thread David Wei
On 2024-03-04 18:01, Mina Almasry wrote: > 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

Re: [RFC PATCH net-next v6 02/15] net: page_pool: create hooks for custom page providers

2024-03-07 Thread David Wei
On 2024-03-04 18:01, Mina Almasry wrote: > From: Jakub Kicinski > > The page providers which try to reuse the same pages will > need to hold onto the ref, even if page gets released from > the pool - as in releasing the page from the pp just transfers > the "ownership" reference from pp to the

Re: [RFC PATCH net-next v6 09/15] memory-provider: dmabuf devmem memory provider

2024-03-05 Thread David Wei
On 2024-03-05 18:42, Mina Almasry wrote: > On Tue, Mar 5, 2024 at 6:28 PM David Wei wrote: >> >> On 2024-03-04 18:01, Mina Almasry wrote: >>> + if (pool->p.queue) >>> + binding = READ_ONCE(pool->p.queue->binding); >>> + >

Re: [RFC PATCH net-next v6 09/15] memory-provider: dmabuf devmem memory provider

2024-03-05 Thread David Wei
On 2024-03-04 18:01, Mina Almasry wrote: > + if (pool->p.queue) > + binding = READ_ONCE(pool->p.queue->binding); > + > + if (binding) { > + pool->mp_ops = _devmem_ops; > + pool->mp_priv = binding; > + } This is specific to TCP devmem. For ZC Rx we

Re: [RFC PATCH net-next v6 02/15] net: page_pool: create hooks for custom page providers

2024-03-05 Thread David Wei
On 2024-03-04 18:01, Mina Almasry wrote: > +struct memory_provider_ops { > + int (*init)(struct page_pool *pool); > + void (*destroy)(struct page_pool *pool); > + struct page *(*alloc_pages)(struct page_pool *pool, gfp_t gfp); > + bool (*release_page)(struct page_pool *pool, struct

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

2023-11-08 Thread David Wei
On 2023-11-07 15:03, Mina Almasry wrote: > 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

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

2023-11-08 Thread David Wei
On 2023-11-07 14:55, 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/linux/netdevice.h index eeeda849115c..1c351c138a5b

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

2023-11-08 Thread David Wei
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 binding, the dma_buf_attach > & dma_buf_map_attachment will occur. The entries in the