Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-07 Thread Jakub Kicinski
On Mon, 4 Mar 2024 18:01:40 -0800 Mina Almasry wrote: > + if (!dev || !dev->netdev_ops) > + return -EINVAL; too defensive > + if (!dev->netdev_ops->ndo_queue_stop || > + !dev->netdev_ops->ndo_queue_mem_free || > + !dev->netdev_ops->ndo_queue_mem_alloc || > +

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-07 Thread Yunsheng Lin
On 2024/3/7 6:10, Mina Almasry wrote: ... > +static int netdev_restart_rx_queue(struct net_device *dev, int rxq_idx) > +{ > + void *new_mem; > + void *old_mem; > + int err; > + > + if (!dev || !dev->netdev_ops) > + return -EINVAL; >

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-06 Thread Mina Almasry
On Wed, Mar 6, 2024 at 4:38 AM Yunsheng Lin wrote: > > On 2024/3/6 5:17, Mina Almasry wrote: > > On Tue, Mar 5, 2024 at 4:55 AM Yunsheng Lin wrote: > >> > >> On 2024/3/5 10:01, Mina Almasry wrote: > >> > >> ... > >> > >>> > >>> The netdev_dmabuf_binding struct is refcounted, and releases its > >>

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-06 Thread Yunsheng Lin
On 2024/3/6 5:17, Mina Almasry wrote: > On Tue, Mar 5, 2024 at 4:55 AM Yunsheng Lin wrote: >> >> On 2024/3/5 10:01, Mina Almasry wrote: >> >> ... >> >>> >>> The netdev_dmabuf_binding struct is refcounted, and releases its >>> resources only when all the refs are released. >>> >>> Signed-off-by: Wi

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-05 Thread Arnd Bergmann
On Tue, Mar 5, 2024, at 21:00, Mina Almasry wrote: > On Tue, Mar 5, 2024 at 1:05 AM Arnd Bergmann wrote: >> On Tue, Mar 5, 2024, at 03:01, Mina Almasry wrote: > > A key goal of this patch series is that the kernel does not try to > parse the skb frags that reside in the dma-buf for that precise >

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-05 Thread Mina Almasry
On Tue, Mar 5, 2024 at 4:55 AM Yunsheng Lin wrote: > > On 2024/3/5 10:01, Mina Almasry wrote: > > ... > > > > > 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 Zh

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-05 Thread Mina Almasry
On Tue, Mar 5, 2024 at 1:05 AM Arnd Bergmann wrote: > > On Tue, Mar 5, 2024, at 03:01, Mina Almasry wrote: > > > +int netdev_bind_dmabuf(struct net_device *dev, unsigned int dmabuf_fd, > > +struct netdev_dmabuf_binding **out) > > +{ > > + struct netdev_dmabuf_binding *bindi

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-05 Thread Yunsheng Lin
On 2024/3/5 10:01, Mina Almasry wrote: ... > > 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 v6: > - Validate

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-05 Thread Arnd Bergmann
On Tue, Mar 5, 2024, at 03:01, Mina Almasry wrote: > +int netdev_bind_dmabuf(struct net_device *dev, unsigned int dmabuf_fd, > +struct netdev_dmabuf_binding **out) > +{ > + struct netdev_dmabuf_binding *binding; > + static u32 id_alloc_next; > + struct scatterlist *

[RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-04 Thread Mina Almasry
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 sg_table from mapping will be inserted into a genpool