net/af_xdp: custom XDP program loading
PATCH v3 1/1 net/af_xdp: custom XDP program loading
The new 'xdp_prog=<string>' vdev arg allows the user to specify the path to a custom XDP program to be set on the device, instead of the default libbpf one. The program must have an XSK_MAP of name 'xsks_map' which will allow for the redirection of some packets to userspace and thus the PMD, using some criteria defined in the program. This can be useful for filtering purposes, for example if we only want a subset of packets to reach userspace or to drop or process a subset of packets in the kernel.
Note: a netdev may only load one program.
---
v3:
* Rebased to next-net
v2:
* Modified error checking for strnlen return.
* Fixed copyright header edits
doc/guides/nics/af_xdp.rst | 1 + drivers/net/af_xdp/rte_eth_af_xdp.c | 99 +++++++++++++++++++++++++++-- 2 files changed, 95 insertions(+), 5 deletions(-)
doc/guides/nics/af_xdp.rst +1 -0
@@ -34,6 +34,7 @@ The following options can be provided to set up an af_xdp port in DPDK. * ``queue_count`` - total netdev queue number (optional, default 1); * ``shared_umem`` - PMD will attempt to share UMEM with others (optional, default 0); +* ``xdp_prog`` - path to custom xdp program (optional, default none); Prerequisites -------------
drivers/net/af_xdp/rte_eth_af_xdp.c +94 -5
180 lines not on this page · raw message
Signature · 1 line
2.17.1
Ferruh Yigit
AppliedQuoted 8 lines · Ciara Loftus
The new 'xdp_prog=<string>' vdev arg allows the user to specify the path to a custom XDP program to be set on the device, instead of the default libbpf one. The program must have an
XSK_MAPof name 'xsks_map' which will allow for the redirection of some packets to userspace and thus the PMD, using some criteria defined in the program. This can be useful for filtering purposes, for example if we only want a subset of packets to reach userspace or to drop or process a subset of packets in the kernel.
Quoted 4 lines
Note: a netdev may only load one program.
Signed-off-by Ciara Loftus <[email protected]>Tested-by Xuekun Hu <[email protected]>
Applied to dpdk-next-net/main, thanks.