Skip to contentSkip to conversation

net/af_xdp: custom XDP program loading

PATCH Applied Ciara Loftus 2 participants 2 messages Sep 25, 2020 – Sep 30, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

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
index 78a088468f..be268fe7ff 100644
@@ -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
Applied
#1 lore raw
Quoted 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_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.

Quoted 4 lines

Note: a netdev may only load one program.

Applied to dpdk-next-net/main, thanks.