Re: Error creating a AF_XDP socket after deleting

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

 



On Sun, Apr 26, 2020 at 08:38:03PM +0200, Magnus Karlsson wrote:
> On Sun, Apr 26, 2020 at 6:08 PM Jesse DuMond <suttonshiredev@xxxxxxxxx> wrote:
> >
> > Hi there,
> >
> > I am writing some test code that tries  repeatedly to create a umem
> > and socket and then deletes them both. I'm using the libbpf function
> > xsk_umem__create/delete and xsk_socket__create/xsk_socket__delete. I
> > am getting an EBUSY from xsk_socket__create when trying to create a
> > socket after deleting a socket on the same interface and queue number.
> > The attached program reproduces the error.
> >
> > I've traced the EBUSY error to this call to xdp_umem_assign_dev in the
> > kernel: https://github.com/torvalds/linux/blob/v5.3/net/xdp/xsk.c#L500
> > That call is made during the bind call in xsk_socket__create. As far
> > as I can tell this error is because the work of xdp_umem_clear_dev is
> > actually called asynchronously after xsk_socket__delete. Putting a
> > sleep between xsk_socket__delete and xsk_socket__create makes this
> > code succeed.
> >
> > Am I trying to do something that is not supposed to be supported?
> 
> No, you are doing everything correctly. The tear down of a socket is
> unfortunately asynchronous due to legacy reasons that are not true
> anymore. We do have a item in the backlog to make this synchronous,
> but have not gotten around to it yet. So sorry, we have to live with
> this for a while more.

For now I guess that in case of EBUSY the application can just repeat the
call to xsk_socket__create?

> 
> /Magnus



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux