net/af_xdp: custom XDP program loading
PATCH 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.
Note: a netdev may only load one program.
--- doc/guides/nics/af_xdp.rst | 1 + drivers/net/af_xdp/rte_eth_af_xdp.c | 100 ++++++++++++++++++++++++++-- 2 files changed, 95 insertions(+), 6 deletions(-)
doc/guides/nics/af_xdp.rst +1 -0
@@ -32,6 +32,7 @@ The following options can be provided to set up an af_xdp port in DPDK. * ``iface`` - name of the Kernel interface to attach to (required); * ``start_queue`` - starting netdev queue id (optional, default 0); * ``queue_count`` - total netdev queue number (optional, default 1); +* ``xdp_prog`` - path to custom xdp program (optional, default none); Prerequisites -------------
drivers/net/af_xdp/rte_eth_af_xdp.c +94 -6
184 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 16 lines
-----Original Message-----
From: Loftus, Ciara <[email protected]>
Sent: Friday 28 August 2020 12:18
To: [email protected]
Cc: Loftus, Ciara <[email protected]>
Subject: [PATCH]net/af_xdp: custom XDP program loadingThe 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.
Note: a netdev may only load one program.
Quoted 2 lines
Signed-off-by Ciara Loftus <[email protected]>---
[MT] Stupid question :), AF_XDP is specifically related to loading an XDP program that allows you to redirect packets to an XSK... why would you want to allow a custom XDP program to be loaded?
Other than that the code itself looked GTM
<snip>
Quoted 9 lines
Quoted 2 lines
The new 'xdp_prog=<string>' vdev arg allows the user to specify the path
to
Quoted 6 lines
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.
Note: a netdev may only load one program.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Ciara Loftus <[email protected]>---
[MT] Stupid question :),
AF_XDPis specifically related to loading an XDP program that allows you to redirect packets to an XSK...
why would you want to allow a custom XDP program to be loaded?Other than that the code itself looked GTM
Hi Maryam,
Thanks for your feedback. It's a good question, and I will update the commit message in the v2 with the reasoning.
Sometimes it might be desired to redirect some not all packets to the xsk/PMD. eg. if the user wishes to drop or process a certain type of packet in the kernel. That logic can be put in the custom program. The key is that the custom program allows for *some* packets to still hit the xsk, and we check for that through checking the presence of the xsks_map.
Thanks,
Ciara
Quoted 2 lines
<snip>
Quoted 16 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ciara Loftus
Sent: Friday, August 28, 2020 7:18 PM
To: [email protected]
Cc: Loftus, Ciara <[email protected]>
Subject: [dpdk-dev] [PATCH]net/af_xdp: custom XDP program loadingThe 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.
Note: a netdev may only load one program.
Quoted 2 lines
Signed-off-by Ciara Loftus <[email protected]>---