mbox series

[bpf-next,0/3] Introduce bpf_link in libbpf's xsk

Message ID 20210215154638.4627-1-maciej.fijalkowski@intel.com (mailing list archive)
Headers show
Series Introduce bpf_link in libbpf's xsk | expand

Message

Maciej Fijalkowski Feb. 15, 2021, 3:46 p.m. UTC
Hi,

This set is another approach towards addressing the below issue:

// load xdp prog and xskmap and add entry to xskmap at idx 10
$ sudo ./xdpsock -i ens801f0 -t -q 10

// add entry to xskmap at idx 11
$ sudo ./xdpsock -i ens801f0 -t -q 11

terminate one of the processes and another one is unable to work due to
the fact that the XDP prog was unloaded from interface.

Previous attempt was, to put it mildly, a bit broken, as there was no
synchronization between updates to additional map, as Bjorn pointed out.
See https://lore.kernel.org/netdev/20190603131907.13395-5-maciej.fijalkowski@intel.com/

In the meantime bpf_link was introduced and it seems that it can address
the issue of refcounting the XDP prog on interface. More info on commit
messages.

Thanks.

Maciej Fijalkowski (3):
  libbpf: xsk: use bpf_link
  libbpf: clear map_info before each bpf_obj_get_info_by_fd
  samples: bpf: do not unload prog within xdpsock

 samples/bpf/xdpsock_user.c |  55 ++++----------
 tools/lib/bpf/xsk.c        | 147 +++++++++++++++++++++++++++++++------
 2 files changed, 139 insertions(+), 63 deletions(-)

Comments

Björn Töpel Feb. 15, 2021, 4:07 p.m. UTC | #1
On 2021-02-15 16:46, Maciej Fijalkowski wrote:
> Hi,
> 
> This set is another approach towards addressing the below issue:
> 
> // load xdp prog and xskmap and add entry to xskmap at idx 10
> $ sudo ./xdpsock -i ens801f0 -t -q 10
> 
> // add entry to xskmap at idx 11
> $ sudo ./xdpsock -i ens801f0 -t -q 11
> 
> terminate one of the processes and another one is unable to work due to
> the fact that the XDP prog was unloaded from interface.
> 
> Previous attempt was, to put it mildly, a bit broken, as there was no
> synchronization between updates to additional map, as Bjorn pointed out.
> See https://lore.kernel.org/netdev/20190603131907.13395-5-maciej.fijalkowski@intel.com/
> 
> In the meantime bpf_link was introduced and it seems that it can address
> the issue of refcounting the XDP prog on interface. More info on commit
> messages.
>

For the series:

Reviewed-by: Björn Töpel <bjorn.topel@intel.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>

Finally, bpf_link/scoped XDP support! Thanks a lot!


Björn



> Thanks.
> 
> Maciej Fijalkowski (3):
>    libbpf: xsk: use bpf_link
>    libbpf: clear map_info before each bpf_obj_get_info_by_fd
>    samples: bpf: do not unload prog within xdpsock
> 
>   samples/bpf/xdpsock_user.c |  55 ++++----------
>   tools/lib/bpf/xsk.c        | 147 +++++++++++++++++++++++++++++++------
>   2 files changed, 139 insertions(+), 63 deletions(-)
>