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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 24, 2024 at 6:49 AM Mina Almasry <almasrymina@xxxxxxxxxx> wrote:
>
> On Tue, Jul 9, 2024 at 8:37 AM Taehee Yoo <ap420073@xxxxxxxxx> wrote:
> ...
> > Reproducer:
> > ./ncdevmem -f <interface name> -l -p 5201 -v 7 -t 0 -q 2 &
> > sleep 10
> > modprobe -rv bnxt_en
> > killall ncdevmem
> >
> > I think it's a devmemTCP core bug so this issue would be reproduced
> > with other drivers.
>
> Sorry for the late reply. I was out at netdev.
>
> I'm also having trouble reproducing this, not because the bug doesn't
> exist, but quirks with my test setup that I need to figure out. AFAICT
> this diff should fix the issue. If you have time to confirm, let me
> know if it doesn't work for you. It should apply on top of v16:
>
> commit 795b8ff01906d ("fix for release issue")
> Author: Mina Almasry <almasrymina@xxxxxxxxxx>
> Date:   Tue Jul 23 00:18:23 2024 +0000
>
>     fix for release issue
>
>     Change-Id: Ib45a0aa6cba2918db5f7ba535414ffa860911fa4
>
>
>
> diff --git a/include/net/devmem.h b/include/net/devmem.h
> index 51b25ba193c96..df52526bb516a 100644
> --- a/include/net/devmem.h
> +++ b/include/net/devmem.h
> @@ -68,6 +68,9 @@ net_devmem_bind_dmabuf(struct net_device *dev,
> unsigned int dmabuf_fd);
>  void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding);
>  int net_devmem_bind_dmabuf_to_queue(struct net_device *dev, u32 rxq_idx,
>                                     struct net_devmem_dmabuf_binding *binding);
> +
> +void dev_dmabuf_uninstall(struct net_device *dev);
> +
>  struct net_iov *
>  net_devmem_alloc_dmabuf(struct net_devmem_dmabuf_binding *binding);
>  void net_devmem_free_dmabuf(struct net_iov *ppiov);
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 5882ddc3f8592..7be084e4936e4 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -11320,6 +11320,7 @@ void unregister_netdevice_many_notify(struct
> list_head *head,
>                 dev_tcx_uninstall(dev);
>                 dev_xdp_uninstall(dev);
>                 bpf_dev_bound_netdev_unregister(dev);
> +               dev_dmabuf_uninstall(dev);
>
>                 netdev_offload_xstats_disable_all(dev);
>
> diff --git a/net/core/devmem.c b/net/core/devmem.c
> index e75057ecfa6de..227bcb1070ec0 100644
> --- a/net/core/devmem.c
> +++ b/net/core/devmem.c
> @@ -362,4 +362,20 @@ bool mp_dmabuf_devmem_release_page(struct
> page_pool *pool, netmem_ref netmem)
>         return false;
>  }
>
> +void dev_dmabuf_uninstall(struct net_device *dev)
> +{
> +       unsigned int i, count = dev->num_rx_queues;
> +       struct net_devmem_dmabuf_binding *binding;
> +       struct netdev_rx_queue *rxq;
> +       unsigned long xa_idx;
> +
> +       for (i = 0; i < count; i++) {
> +               binding = dev->_rx[i].mp_params.mp_priv;
> +               if (binding)
> +                       xa_for_each(&binding->bound_rxqs, xa_idx, rxq)
> +                               if (rxq == &dev->_rx[i])
> +                                       xa_erase(&binding->bound_rxqs, xa_idx);
> +       }
> +}
> +
>  #endif
>

I tested this patch and it works well.
Thanks a lot for this work!

Thanks a lot!
Taehee Yoo

> --
> Thanks,
> Mina





[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux