Hi Július, The ring clean up routines in i40e and ixgbe are asynchronous, so they will likely not be ready when you return from the xsk_socket__delete() call. What happens if you add a sleep(1) before you create it a second time? /Magnus On Wed, Sep 25, 2019 at 5:47 PM Július Milan <Julius.Milan@xxxxxxxxxxxxx> wrote: > > Hi folks > > > > I am stuck with proper cleanup of AF_XDP socket. Not sure if I am doing something wrong or is it a bug. > > I create xdp socket, then I remove it and then I am trying to create it again and got EBUSY from bind syscall > > of xsk_socket__create. > > > > My cleanup looks like this: > > xsk_socket__delete(); > > xsk_umem__delete(); > > bpf_set_link_xdp_fd(ifindex, -1, opt_xdp_flags); > > > > Attaching simple test case. It’s just reduced and modified xdpsock_user.c form kernel samples. > > Tested on kernel v5.3 4d856f72c10ecb060868ed10ff1b1453943fc6c8 and related libbpf. > > > > Thanks a lot > > Julius