Skip to content

Commit 505f846

Browse files
maryamtahhanovsrobot
authored andcommitted
net/af_xdp: fix multi interface support for K8s
The original 'use_cni' implementation, was added to enable support for the AF_XDP PMD in a K8s env without any escalated privileges. However 'use_cni' used a hardcoded socket rather than a configurable one. If a DPDK pod is requesting multiple net devices and these devices are from different pools, then the AF_XDP PMD attempts to mount all the netdev UDSes in the pod as /tmp/afxdp.sock. Which means that at best only 1 netdev will handshake correctly with the AF_XDP DP. This patch addresses this by making the socket parameter configurable using a new vdev param called 'dp_path' alongside the original 'use_cni' param. If the 'dp_path' parameter is not set alongside the 'use_cni' parameter, then it's configured inside the AF_XDP PMD (transparently to the user). This change has been tested with the AF_XDP DP PR 81[1], with both single and multiple interfaces. [1] intel/afxdp-plugins-for-kubernetes#81 Fixes: 7fc6ae5 ("net/af_xdp: support CNI Integration") Cc: [email protected] Signed-off-by: Maryam Tahhan <[email protected]> Signed-off-by: 0-day Robot <[email protected]>
1 parent 09d38fb commit 505f846

File tree

4 files changed

+121
-56
lines changed

4 files changed

+121
-56
lines changed

doc/guides/howto/af_xdp_dp.rst

+41-21
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,33 @@ should be used when creating the socket
5252
to instruct libbpf not to load the default libbpf program on the netdev.
5353
Instead the loading is handled by the AF_XDP Device Plugin.
5454

55-
Limitations
56-
-----------
55+
The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` argument
56+
to explicitly tell the AF_XDP PMD where to find the UDS to interact with the
57+
AF_XDP Device Plugin. If this argument is not passed alongside the ``use_cni``
58+
argument then the AF_XDP PMD configures it internally.
5759

58-
For DPDK versions <= v23.11 the Unix Domain Socket file path appears in
59-
the pod at "/tmp/afxdp.sock". The handshake implementation in the AF_XDP PMD
60-
is only compatible with the AF_XDP Device Plugin up to commit id `38317c2`_
61-
and the pod is limited to a single netdev.
60+
.. note::
61+
62+
DPDK AF_XDP PMD <= v23.11 will only work with the AF_XDP Device Plugin
63+
<= commit id `38317c2`_.
6264

6365
.. note::
6466

65-
DPDK AF_XDP PMD <= v23.11 will not work with the latest version of the
66-
AF_XDP Device Plugin.
67+
DPDK AF_XDP PMD > v23.11 will work with latest version of the
68+
AF_XDP Device Plugin through a combination of the ``dp_path`` and/or
69+
the ``use_cni`` parameter. In these versions of the PMD if a user doesn't
70+
explicitly set the ``dp_path`` parameter when using ``use_cni`` then that
71+
path is transparently configured in the AF_XDP PMD to the default
72+
`AF_XDP Device Plugin for Kubernetes`_ mount point path. The path can
73+
be overridden by explicitly setting the ``dp_path`` param.
6774

68-
The issue is if a single pod requests different devices from different pools it
69-
results in multiple UDS servers serving the pod with the container using only a
70-
single mount point for their UDS as ``/tmp/afxdp.sock``. This means that at best one
71-
device might be able to complete the handshake. This has been fixed in the AF_XDP
72-
Device Plugin so that the mount point in the pods for the UDS appear at
73-
``/tmp/afxdp_dp/<netdev>/afxdp.sock``. Later versions of DPDK fix this hardcoded path
74-
in the PMD alongside the ``use_cni`` parameter.
75+
.. note::
7576

76-
.. _38317c2: https://github.com/intel/afxdp-plugins-for-kubernetes/commit/38317c256b5c7dfb39e013a0f76010c2ded03669
77+
DPDK AF_XDP PMD > v23.11 is backwards compatible with (older) versions
78+
of the AF_XDP DP <= commit id `38317c2`_ by explicitly setting ``dp_path`` to
79+
``/tmp/afxdp.sock``.
7780

81+
.. _38317c2: https://github.com/intel/afxdp-plugins-for-kubernetes/commit/38317c256b5c7dfb39e013a0f76010c2ded03669
7882

7983
Prerequisites
8084
-------------
@@ -105,10 +109,10 @@ Device Plugin and DPDK container prerequisites:
105109

106110
.. code-block:: console
107111
108-
cat << EOF | sudo tee /etc/systemd/system/containerd.service.d/limits.conf
109-
[Service]
110-
LimitMEMLOCK=infinity
111-
EOF
112+
cat << EOF | sudo tee /etc/systemd/system/containerd.service.d/limits.conf
113+
[Service]
114+
LimitMEMLOCK=infinity
115+
EOF
112116
113117
* dpdk-testpmd application should have AF_XDP feature enabled.
114118

@@ -284,7 +288,7 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + CNI
284288
emptyDir:
285289
medium: HugePages
286290
287-
For further reference please use the `pod.yaml`_
291+
For further reference please see the `pod.yaml`_
288292

289293
.. _pod.yaml: https://github.com/intel/afxdp-plugins-for-kubernetes/blob/main/examples/pod-spec.yaml
290294

@@ -297,3 +301,19 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + CNI
297301
--vdev=net_af_xdp0,use_cni=1,iface=<interface name> \
298302
--no-mlockall --in-memory \
299303
-- -i --a --nb-cores=2 --rxq=1 --txq=1 --forward-mode=macswap;
304+
305+
Or
306+
307+
.. code-block:: console
308+
309+
kubectl exec -i <Pod name> --container <containers name> -- \
310+
/<Path>/dpdk-testpmd -l 0,1 --no-pci \
311+
--vdev=net_af_xdp0,use_cni=1,iface=<interface name>,dp_path="/tmp/afxdp_dp/<interface name>/afxdp.sock" \
312+
--no-mlockall --in-memory \
313+
-- -i --a --nb-cores=2 --rxq=1 --txq=1 --forward-mode=macswap;
314+
315+
.. note::
316+
317+
If the ``dp_path`` parameter isn't explicitly set (like the example above)
318+
the AF_XDP PMD will set the parameter value to
319+
``/tmp/afxdp_dp/<<interface name>>/afxdp.sock``.

doc/guides/nics/af_xdp.rst

+14
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,20 @@ enable the `AF_XDP Device Plugin for Kubernetes`_ with a DPDK application/pod.
171171
so enabling and disabling of the promiscuous mode through the DPDK application
172172
is also not supported.
173173

174+
dp_path
175+
~~~~~~~
176+
177+
The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` argument
178+
to explicitly tell the AF_XDP PMD where to find the UDS to interact with the
179+
`AF_XDP Device Plugin for Kubernetes`_. If this argument is not passed
180+
alongside the ``use_cni`` argument then the AF_XDP PMD configures it internally.
181+
182+
.. _AF_XDP Device Plugin for Kubernetes: https://github.com/intel/afxdp-plugins-for-kubernetes
183+
184+
.. code-block:: console
185+
186+
--vdev=net_af_xdp0,use_cni=1,dp_path="/tmp/afxdp_dp/<<interface name>>/afxdp.sock"
187+
174188
Limitations
175189
-----------
176190

doc/guides/rel_notes/release_24_03.rst

+7
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ New Features
138138
to support TLS v1.2, TLS v1.3 and DTLS v1.2.
139139
* Added PMD API to allow raw submission of instructions to CPT.
140140

141+
* **Enabled AF_XDP PMD multi interface (UDS) support with AF_XDP Device Plugin**.
142+
143+
The EAL vdev argument for the AF_XDP PMD ``use_cni`` previously limited
144+
a pod to using only a single netdev/interface. The latest changes (adding
145+
the ``dp_path`` parameter) remove this limitation and maintain backward
146+
compatibility for any applications already using the ``use_cni`` vdev
147+
argument with the AF_XDP Device Plugin.
141148

142149
Removed Items
143150
-------------

0 commit comments

Comments
 (0)