From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F7BC43B75; Thu, 22 Feb 2024 14:46:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C890E4069D; Thu, 22 Feb 2024 14:46:20 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mails.dpdk.org (Postfix) with ESMTP id 001D34027F for ; Thu, 22 Feb 2024 14:46:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708609579; x=1740145579; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5aQuw55snn6INp1CtrQtzwcdOelVsAX9Ox4/r91Kkm4=; b=ftvtwjcumLKmfAqX+HqbL1rlDr8bphM7pYwCxIHvD+01nfo5575V1hNy bLtOw0whTuugzPxDpu6fh4mLcl4XtrKcBSJj9tabPcoZjdlacOb8kq9GX msR8Hi5xf20POeeV5U3uAhRD8x5ivrg3+B/6IN3Sv3jrUC1otdUcCXh6X VM/ImzmJca0TJFjBgOHiqbx+s2/+3TqINgClfa7QOnb+aA3Hj1DFX/oOi 9LaYbfIdS2GoezOQLssp+eqKpnCQ72nSQgfSrw3/K8fBIa68P/bQoV+KV biTPVghp2Lvar8ShudRD5DnGf2YRXDGw+cT+y6mS/sYFpc6G9TKx5FXUQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="6652968" X-IronPort-AV: E=Sophos;i="6.06,177,1705392000"; d="scan'208";a="6652968" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 05:46:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,177,1705392000"; d="scan'208";a="5446334" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa009.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 Feb 2024 05:46:18 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 22 Feb 2024 05:46:17 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 22 Feb 2024 05:46:17 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 22 Feb 2024 05:46:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ID3Skx2ZQDgHd9vMOZWT9qr3lNwHfXGu1oPPALZsiyOoCn+Ov2viYq9wOJ4hTCrZEVkbrYQVp/ypGdb6FURxMej8ZPeVz+GlXu8YCa3Y5ul43qzwXX2Dgw4GjGXSQyqyqZna5v1Q2Ei4xwoPFWzT90taKOP0Se1TMqxNELTdl3yj7laRBT9+N3gpwPU9fDuSgbj+HzH0je177d2exOUskJqazbp1nrhtumauvCtmlLMS0TB8TMzB5l5Lqy5r267MIkPHncp2fhFxpCohn+5u4Rj2g7JWxgJP4R2/J9+82gvJ+l/qYP8BpMsNGnkUndDYuv1XR+c88Yvkm3v+IN5yuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JooYq2nptZURPeSMH+nvxw0ll/ZCwj1DpQ9XeUUltCs=; b=KG8yb4j+EsVoUkKH6NV0by8Bo2WqteRsLHgnOWHCdnZXvYGmiqP0u8t89W0RPRimWLiRJyaoUMnoEHNMx0MEn4KJOV9ICIPX135cyWD4EFnEv/waXbIPzQmiI93iWoL1Pq4EyYrrCexhgaL8LiCN/nLu9gJmAz0/KW7gd0s5a0XmuABJ8LEXfITuxb/z6YuHNBTwD4syyAPyMu8dLb+4R6TqHE9XvFASmDwyxQhA2b+r0IYW0IZLx8JC+QM2F3sCV4vBbJjDPheMRkL1QJJcdvQAGagvujxc3b/iywMJlcllJrhHbwME2mOPfoFC8zYrujRuz5WugD/cXbHcpjz31g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by PH8PR11MB8038.namprd11.prod.outlook.com (2603:10b6:510:25e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Thu, 22 Feb 2024 13:46:08 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::92a7:f6a2:9262:d150]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::92a7:f6a2:9262:d150%3]) with mapi id 15.20.7316.018; Thu, 22 Feb 2024 13:46:08 +0000 From: "Loftus, Ciara" To: "Tahhan, Maryam" , "ferruh.yigit@amd.com" , "stephen@networkplumber.org" , "lihuisong@huawei.com" , "fengchengwen@huawei.com" , "liuyonglong@huawei.com" , "Marchand, David" , "Koikkara Reeny, Shibin" CC: "dev@dpdk.org" , "Tahhan, Maryam" , "stable@dpdk.org" Subject: RE: [v9 2/3] net/af_xdp: fix multi interface support for K8s Thread-Topic: [v9 2/3] net/af_xdp: fix multi interface support for K8s Thread-Index: AQHaX2fflhWv6jM+3kCkVDRjliDrnLEWao7g Date: Thu, 22 Feb 2024 13:46:07 +0000 Message-ID: References: <20240214170404.3318857-1-mtahhan@redhat.com> <20240214170404.3318857-3-mtahhan@redhat.com> In-Reply-To: <20240214170404.3318857-3-mtahhan@redhat.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5872:EE_|PH8PR11MB8038:EE_ x-ms-office365-filtering-correlation-id: e47cc2b2-d090-4242-b4e3-08dc33ac9f4d x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oiyjuc4RMacJ1IgD5q1BdCaU0JNQ3ReKrRgiGEJ4VVvFOtkvtcfaApAGXnJZdffuBgkIb/jp0Ih6cQq+qA+zBhpoJ2nBrPKqz7pnlRJWZO8GR7QWfTMBuioa4t1MpogqkAspOvsBuAnKTTXoBFAyWWIDbmyNIEgUEUBxOscBAk0R24R9USuFXHhrplRPvw/N1R8nSuStfsQwqhAVFOya1uBjEvsYUle3yjypdI7mCeM59m2Ha69vntl516lDRbjSucKRo98DIrbA+LTMrCSfw6hk3gFL/910Yy/LSZT6dNUTcC54NXuXADUV0IC5QpBWZN6d/qZ2BHi0ozv8APszadOezuopk2duRh+gZ4WRu7i1mb7fsYlKDRoMfwy7IYDrZFHK/CzekZtsvRPFGuw2mM93iT/HMzpRui5SRI2wq7Kt6hqvX+97YA0nfp+YBx+gQt199SlAV9IGbNnuFihTlUJiLiDFNakGNQOND99KgCUlLioY4cQwoc0T9tdY9i6sfbfOMFjnI3xp+80ollKaHArgyPmaeHEVgdcYqgI0QBhgEkGgqV+no5vDugJHS2zpSVn2474Gw03kkArNraXvx2sWEPQgSSTZ34ZJPhbXoACmAB+DiAyT9Uekw/dVJr/4 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5872.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(921011)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nCMw+aU23/Tj16f8W1Lj1BKA2ZTVuKdLUGa6HfwFxyDyoInCCHybaIz/X9+W?= =?us-ascii?Q?A/tKsaPdHT2T/ngMy3Jkh4dZLiTt+nAB049UdML5mj6C5Qxrix0PAst7zSgO?= =?us-ascii?Q?+JNnknRQpn+kCsPw4ulHRU1kOfLzm/BXSsnSNlCHmdhk8Fg9hk5qc+MN0aBh?= =?us-ascii?Q?nZeoUB71DHWX5SSC5nYonwJEdKEED7m9LJ0xeDldiZpjG0Q01s/eZTUjKf3J?= =?us-ascii?Q?FcmB6U6u2+j3rizftRE16Ae982ioSFsdB99e354xhxi60a/4ycO6o9JtrI36?= =?us-ascii?Q?vZWyv993fpgesz542NAJGcZJHq6L2OsuF7n7U9GuMR2LT5aZhgD+zo6I6kyA?= =?us-ascii?Q?btoCT+IYDSjxIFip0eMAAIJ+FBNzsANsTEpNid/zS7Orl6wscU/lVk7mb/dF?= =?us-ascii?Q?0T08ANFzyfMlrL2JPRfhMtpYoao7IZUYO25MXykLodhtNs/Sp+gbNEhkSq5F?= =?us-ascii?Q?llHqoSelS9W6jduBdFz0GEJdUPxmM2P4l/U9QBxzPqPxw0Ma+tl154n7J3A6?= =?us-ascii?Q?v+co3zYktsiV5ki2t2UmmBXnCo18l+blLOI2klgvjg4VZEBogqHGLcAEHpu0?= =?us-ascii?Q?NnPCv4dCnsBGGobdKVkMxu5SU7N9ySpcI9xBQj0/jYQ2y8d4xULDYR+7xY8c?= =?us-ascii?Q?Y8+Vd/IjasjU7Q2A9gIOfq51Xv+QHLWRY82037aiWK9vQrara8r3OTqN4fcg?= =?us-ascii?Q?tcsaCtsex90/07UCxLIhCBRmgC5Vfz/QYuhovRLUx9cPyjC+K6lphGnoSgZD?= =?us-ascii?Q?7jIoLaqkfLJTENjMLqveIzp/YHtPdVS2YsVt2pZAw48yyYgK32StuKwvTTvg?= =?us-ascii?Q?0xsr+Mo5Gg5ToRTiNgrefCdnONp6y6xQ7VVdsTcD5vB6Zd/3sx5rrbfArpL3?= =?us-ascii?Q?8MPYK7fDdRwstkvACHg/GOo0px7A4pQHatCMYIi6y09wrxm3VJS9DNHkqv+z?= =?us-ascii?Q?eZ6y2PHUzjGj+uSV1XZbJQ4A0hKq2q/7alGPS41mucbgr60Obb+tTwD+apoJ?= =?us-ascii?Q?uSCZmmay3CXBuSb1rgXTceoaN6/1w0xR4YepZ5uNkPtf9NiRnDUhLU+FG7Vp?= =?us-ascii?Q?6x4ZIeKNNi7lwt3yTd13K2y/LlQLzu1jnUKGnWY4dxGnGNAY/qayRBAITE9Y?= =?us-ascii?Q?JENCGGEJVw5e4Bd6aXplwcCwrD+bLa1S0KlW4nlTF7j8eRe0m/4HgQZc3hz/?= =?us-ascii?Q?ebeOwHYlRMOsGIQqdDoo84bo52QCIWMKgsloIGYRlT+f+zTKJfYR+Lf5r11v?= =?us-ascii?Q?wl7MTZ1+mxhgLK+TDqL8hDq2dSld9mcK2GpZBbpqSJJt3pd85igGrZsVMETE?= =?us-ascii?Q?sRUwV81gEEpAmlQc/cLTkMwCt9U85kJOKyufTr/8FcVdI8LnGRHJQwfM9UnW?= =?us-ascii?Q?ofp+olSldjn79hi43drQ4r+g9j15XwebfSU39yONixE3AXqu/oLdVl03wYMv?= =?us-ascii?Q?aK0f3J4Q+L2r3MX3LQ3Mz0W22ZJD5TDID3u5RF1HQDcYP0U6gTF5lYNkOBCn?= =?us-ascii?Q?8WyIVwU98OzbxFg84NdgfD41khRZDgsQe/7VkQONIlWYxJO61TMDNxy5/bXk?= =?us-ascii?Q?WV2XAORSAlNUVzK9WDNZZ0YWmEKOhIF3oQmnpoP/?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e47cc2b2-d090-4242-b4e3-08dc33ac9f4d X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Feb 2024 13:46:07.9574 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4ezuE3f5gif0PSV6kZvD1NnvLXnOoB1JEiuKxlvulcUeV4VY5UKz23115JJQ11LcJ9q4ypXfNeUTRNHg4gCyug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB8038 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > Subject: [v9 2/3] net/af_xdp: fix multi interface support for K8s >=20 > 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 [1] does not point to any reference. > multiple interfaces. >=20 > Fixes: 7fc6ae50369d ("net/af_xdp: support CNI Integration") > Cc: stable@dpdk.org >=20 > Signed-off-by: Maryam Tahhan > --- > doc/guides/howto/af_xdp_dp.rst | 43 ++++++++++-- > doc/guides/nics/af_xdp.rst | 14 ++++ > doc/guides/rel_notes/release_24_03.rst | 7 ++ > drivers/net/af_xdp/rte_eth_af_xdp.c | 94 ++++++++++++++++---------- > 4 files changed, 116 insertions(+), 42 deletions(-) >=20 > diff --git a/doc/guides/howto/af_xdp_dp.rst > b/doc/guides/howto/af_xdp_dp.rst > index 657fc8d52c..8a64ec5599 100644 > --- a/doc/guides/howto/af_xdp_dp.rst > +++ b/doc/guides/howto/af_xdp_dp.rst > @@ -52,13 +52,18 @@ should be used when creating the socket > to instruct libbpf not to load the default libbpf program on the netdev. > Instead the loading is handled by the AF_XDP Device Plugin. >=20 > +The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` > argument > +to explicitly tell the AF_XDP PMD where to find the UDS to interact with= the > +AF_XDP Device Plugin. If this argument is not passed alongside the ``use= _cni`` > +argument then the AF_XDP PMD configures it internally. > + > Limitations > ----------- >=20 > For DPDK versions <=3D v23.11 the Unix Domain Socket file path appears i= n > the pod at "/tmp/afxdp.sock". The handshake implementation in the AF_XDP > PMD > -is only compatible with the AF_XDP Device Plugin up to commit id `38317c= 2`_ > -and the pod is limited to a single netdev. > +is only compatible with the `AF_XDP Device Plugin for Kubernetes`_ up t= o > +commit id `38317c2`_ and the pod is limited to a single netdev. >=20 > .. note:: >=20 > @@ -75,6 +80,14 @@ in the PMD alongside the `use_cni` parameter. >=20 > .. _38317c2: https://github.com/intel/afxdp-plugins-for- > kubernetes/commit/38317c256b5c7dfb39e013a0f76010c2ded03669 >=20 > +.. note:: > + > + The introduction of the ``dp_path`` EAL vdev argument fixes the limi= tation > above. If a > + user doesn't explicitly set the ``dp_path``parameter when using ``us= e_cni`` > then that > + path is transparently configured in the AF_XDP PMD to the default > + `AF_XDP Device Plugin for Kubernetes`_ mount point path. This is > compatible with the latest > + AF_XDP Device Plugin. For backwards compatibility with versions of t= he > AF_XDP DP <=3D commit > + id `38317c2`_ please explicitly set ``dp_path`` to ``/tmp/afxdp.sock= ``. I think instead of adding a note here we can just simply remove the limitat= ion. When the user has this patch, they most likely will not care about lim= itations that were previously present. Just make sure that the information about the behaviour when dp_path is not= set and how to set dp_path to be backwards compatible is still captured in= the docs somewhere. I just think it's confusing to state a limitation followed by a note that i= t is resolved. The remainder of the changes in this series LGTM. Thanks, Ciara >=20 > Prerequisites > ------------- > @@ -105,10 +118,10 @@ Device Plugin and DPDK container prerequisites: >=20 > .. code-block:: console >=20 > - cat << EOF | sudo tee > /etc/systemd/system/containerd.service.d/limits.conf > - [Service] > - LimitMEMLOCK=3Dinfinity > - EOF > + cat << EOF | sudo tee > /etc/systemd/system/containerd.service.d/limits.conf > + [Service] > + LimitMEMLOCK=3Dinfinity > + EOF >=20 > * dpdk-testpmd application should have AF_XDP feature enabled. >=20 > @@ -284,7 +297,7 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + > CNI > emptyDir: > medium: HugePages >=20 > - For further reference please use the `pod.yaml`_ > + For further reference please see the `pod.yaml`_ >=20 > .. _pod.yaml: https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/main/examples/pod-spec.yaml >=20 > @@ -297,3 +310,19 @@ Run dpdk-testpmd with the AF_XDP Device Plugin + > CNI > --vdev=3Dnet_af_xdp0,use_cni=3D1,iface=3D \ > --no-mlockall --in-memory \ > -- -i --a --nb-cores=3D2 --rxq=3D1 --txq=3D1 --forward-mode= =3Dmacswap; > + > + Or > + > + .. code-block:: console > + > + kubectl exec -i --container -- \ > + //dpdk-testpmd -l 0,1 --no-pci \ > + --vdev=3Dnet_af_xdp0,use_cni=3D1,iface=3D name>,dp_path=3D"/tmp/afxdp_dp//afxdp.sock" \ > + --no-mlockall --in-memory \ > + -- -i --a --nb-cores=3D2 --rxq=3D1 --txq=3D1 --forward-mode= =3Dmacswap; > + > +.. note:: > + > + If the ``dp_path`` parameter isn't explicitly set (like the example = above) > + the AF_XDP PMD will set the parameter value to > + ``/tmp/afxdp_dp/<>/afxdp.sock``. > diff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst > index 4dd9c73742..7f8651beda 100644 > --- a/doc/guides/nics/af_xdp.rst > +++ b/doc/guides/nics/af_xdp.rst > @@ -171,6 +171,20 @@ enable the `AF_XDP Device Plugin for Kubernetes`_ > with a DPDK application/pod. > so enabling and disabling of the promiscuous mode through the DPDK > application > is also not supported. >=20 > +dp_path > +~~~~~~~ > + > +The EAL vdev argument ``dp_path`` is used alongside the ``use_cni`` > argument > +to explicitly tell the AF_XDP PMD where to find the UDS to interact with= the > +`AF_XDP Device Plugin for Kubernetes`_. If this argument is not passed > +alongside the ``use_cni`` argument then the AF_XDP PMD configures it > internally. > + > +.. _AF_XDP Device Plugin for Kubernetes: https://github.com/intel/afxdp- > plugins-for-kubernetes > + > +.. code-block:: console > + > + --vdev=3Dnet_af_xdp0,use_cni=3D1,dp_path=3D"/tmp/afxdp_dp/< name>>/afxdp.sock" > + > Limitations > ----------- >=20 > diff --git a/doc/guides/rel_notes/release_24_03.rst > b/doc/guides/rel_notes/release_24_03.rst > index 39088da303..b27c85c232 100644 > --- a/doc/guides/rel_notes/release_24_03.rst > +++ b/doc/guides/rel_notes/release_24_03.rst > @@ -55,6 +55,13 @@ New Features > Also, make sure to start the actual text at the margin. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D >=20 > +* **Enabled AF_XDP PMD multi interface (UDS) support with AF_XDP Device > Plugin**. > + > + The EAL vdev argument for the AF_XDP PMD ``use_cni`` previously limite= d > + a pod to using only a single netdev/interface. The latest changes (add= ing > + the ``dp_path`` parameter) remove this limitation and maintain backwar= d > + compatibility for any applications already using the ``use_cni`` vdev > + argument with the AF_XDP Device Plugin. >=20 > Removed Items > ------------- > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c > b/drivers/net/af_xdp/rte_eth_af_xdp.c > index 353c8688ec..caa489567d 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -83,12 +83,13 @@ RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, > NOTICE); >=20 > #define ETH_AF_XDP_MP_KEY "afxdp_mp_send_fds" >=20 > +#define DP_BASE_PATH "/tmp/afxdp_dp" > +#define DP_UDS_SOCK "afxdp.sock" > #define MAX_LONG_OPT_SZ 64 > #define UDS_MAX_FD_NUM 2 > #define UDS_MAX_CMD_LEN 64 > #define UDS_MAX_CMD_RESP 128 > #define UDS_XSK_MAP_FD_MSG "/xsk_map_fd" > -#define UDS_SOCK "/tmp/afxdp.sock" > #define UDS_CONNECT_MSG "/connect" > #define UDS_HOST_OK_MSG "/host_ok" > #define UDS_HOST_NAK_MSG "/host_nak" > @@ -171,6 +172,7 @@ struct pmd_internals { > bool custom_prog_configured; > bool force_copy; > bool use_cni; > + char dp_path[PATH_MAX]; > struct bpf_map *map; >=20 > struct rte_ether_addr eth_addr; > @@ -191,6 +193,7 @@ struct pmd_process_private { > #define ETH_AF_XDP_BUDGET_ARG "busy_budget" > #define ETH_AF_XDP_FORCE_COPY_ARG "force_copy" > #define ETH_AF_XDP_USE_CNI_ARG "use_cni" > +#define ETH_AF_XDP_DP_PATH_ARG "dp_path" >=20 > static const char * const valid_arguments[] =3D { > ETH_AF_XDP_IFACE_ARG, > @@ -201,6 +204,7 @@ static const char * const valid_arguments[] =3D { > ETH_AF_XDP_BUDGET_ARG, > ETH_AF_XDP_FORCE_COPY_ARG, > ETH_AF_XDP_USE_CNI_ARG, > + ETH_AF_XDP_DP_PATH_ARG, > NULL > }; >=20 > @@ -1351,7 +1355,7 @@ configure_preferred_busy_poll(struct > pkt_rx_queue *rxq) > } >=20 > static int > -init_uds_sock(struct sockaddr_un *server) > +init_uds_sock(struct sockaddr_un *server, const char *dp_path) > { > int sock; >=20 > @@ -1362,7 +1366,7 @@ init_uds_sock(struct sockaddr_un *server) > } >=20 > server->sun_family =3D AF_UNIX; > - strlcpy(server->sun_path, UDS_SOCK, sizeof(server->sun_path)); > + strlcpy(server->sun_path, dp_path, sizeof(server->sun_path)); >=20 > if (connect(sock, (struct sockaddr *)server, sizeof(struct > sockaddr_un)) < 0) { > close(sock); > @@ -1382,7 +1386,7 @@ struct msg_internal { > }; >=20 > static int > -send_msg(int sock, char *request, int *fd) > +send_msg(int sock, char *request, int *fd, const char *dp_path) > { > int snd; > struct iovec iov; > @@ -1393,7 +1397,7 @@ send_msg(int sock, char *request, int *fd) >=20 > memset(&dst, 0, sizeof(dst)); > dst.sun_family =3D AF_UNIX; > - strlcpy(dst.sun_path, UDS_SOCK, sizeof(dst.sun_path)); > + strlcpy(dst.sun_path, dp_path, sizeof(dst.sun_path)); >=20 > /* Initialize message header structure */ > memset(&msgh, 0, sizeof(msgh)); > @@ -1470,8 +1474,8 @@ read_msg(int sock, char *response, struct > sockaddr_un *s, int *fd) > } >=20 > static int > -make_request_cni(int sock, struct sockaddr_un *server, char *request, > - int *req_fd, char *response, int *out_fd) > +make_request_dp(int sock, struct sockaddr_un *server, char *request, > + int *req_fd, char *response, int *out_fd, const char *dp_path) > { > int rval; >=20 > @@ -1483,7 +1487,7 @@ make_request_cni(int sock, struct sockaddr_un > *server, char *request, > if (req_fd =3D=3D NULL) > rval =3D write(sock, request, strlen(request)); > else > - rval =3D send_msg(sock, request, req_fd); > + rval =3D send_msg(sock, request, req_fd, dp_path); >=20 > if (rval < 0) { > AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno)); > @@ -1507,7 +1511,7 @@ check_response(char *response, char *exp_resp, > long size) > } >=20 > static int > -get_cni_fd(char *if_name) > +uds_get_xskmap_fd(char *if_name, const char *dp_path) > { > char request[UDS_MAX_CMD_LEN], > response[UDS_MAX_CMD_RESP]; > char hostname[MAX_LONG_OPT_SZ], > exp_resp[UDS_MAX_CMD_RESP]; > @@ -1520,14 +1524,14 @@ get_cni_fd(char *if_name) > return -1; >=20 > memset(&server, 0, sizeof(server)); > - sock =3D init_uds_sock(&server); > + sock =3D init_uds_sock(&server, dp_path); > if (sock < 0) > return -1; >=20 > - /* Initiates handshake to CNI send: /connect,hostname */ > + /* Initiates handshake to the AF_XDP Device Plugin send: > /connect,hostname */ > snprintf(request, sizeof(request), "%s,%s", UDS_CONNECT_MSG, > hostname); > memset(response, 0, sizeof(response)); > - if (make_request_cni(sock, &server, request, NULL, response, > &out_fd) < 0) { > + if (make_request_dp(sock, &server, request, NULL, response, > &out_fd, dp_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1541,7 +1545,7 @@ get_cni_fd(char *if_name) > /* Request for "/version" */ > strlcpy(request, UDS_VERSION_MSG, UDS_MAX_CMD_LEN); > memset(response, 0, sizeof(response)); > - if (make_request_cni(sock, &server, request, NULL, response, > &out_fd) < 0) { > + if (make_request_dp(sock, &server, request, NULL, response, > &out_fd, dp_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1549,7 +1553,7 @@ get_cni_fd(char *if_name) > /* Request for file descriptor for netdev name*/ > snprintf(request, sizeof(request), "%s,%s", UDS_XSK_MAP_FD_MSG, > if_name); > memset(response, 0, sizeof(response)); > - if (make_request_cni(sock, &server, request, NULL, response, > &out_fd) < 0) { > + if (make_request_dp(sock, &server, request, NULL, response, > &out_fd, dp_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1571,7 +1575,7 @@ get_cni_fd(char *if_name) > /* Initiate close connection */ > strlcpy(request, UDS_FIN_MSG, UDS_MAX_CMD_LEN); > memset(response, 0, sizeof(response)); > - if (make_request_cni(sock, &server, request, NULL, response, > &out_fd) < 0) { > + if (make_request_dp(sock, &server, request, NULL, response, > &out_fd, dp_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1695,17 +1699,16 @@ xsk_configure(struct pmd_internals *internals, > struct pkt_rx_queue *rxq, > } >=20 > if (internals->use_cni) { > - int err, fd, map_fd; > + int err, map_fd; >=20 > - /* get socket fd from CNI plugin */ > - map_fd =3D get_cni_fd(internals->if_name); > + /* get socket fd from AF_XDP Device Plugin */ > + map_fd =3D uds_get_xskmap_fd(internals->if_name, internals- > >dp_path); > if (map_fd < 0) { > - AF_XDP_LOG(ERR, "Failed to receive CNI plugin fd\n"); > + AF_XDP_LOG(ERR, "Failed to receive xskmap fd from > AF_XDP Device Plugin\n"); > goto out_xsk; > } > - /* get socket fd */ > - fd =3D xsk_socket__fd(rxq->xsk); > - err =3D bpf_map_update_elem(map_fd, &rxq->xsk_queue_idx, > &fd, 0); > + > + err =3D xsk_socket__update_xskmap(rxq->xsk, map_fd); > if (err) { > AF_XDP_LOG(ERR, "Failed to insert unprivileged xsk in > map.\n"); > goto out_xsk; > @@ -1881,13 +1884,13 @@ static const struct eth_dev_ops ops =3D { > .get_monitor_addr =3D eth_get_monitor_addr, > }; >=20 > -/* CNI option works in unprivileged container environment > - * and ethernet device functionality will be reduced. So > - * additional customiszed eth_dev_ops struct is needed > - * for cni. Promiscuous enable and disable functionality > - * is removed. > +/* AF_XDP Device Plugin option works in unprivileged > + * container environments and ethernet device functionality > + * will be reduced. So additional customised eth_dev_ops > + * struct is needed for the Device Plugin. Promiscuous > + * enable and disable functionality is removed. > **/ > -static const struct eth_dev_ops ops_cni =3D { > +static const struct eth_dev_ops ops_afxdp_dp =3D { > .dev_start =3D eth_dev_start, > .dev_stop =3D eth_dev_stop, > .dev_close =3D eth_dev_close, > @@ -2023,7 +2026,8 @@ xdp_get_channels_info(const char *if_name, int > *max_queues, > static int > parse_parameters(struct rte_kvargs *kvlist, char *if_name, int *start_qu= eue, > int *queue_cnt, int *shared_umem, char *prog_path, > - int *busy_budget, int *force_copy, int *use_cni) > + int *busy_budget, int *force_copy, int *use_cni, > + char *dp_path) > { > int ret; >=20 > @@ -2069,6 +2073,11 @@ parse_parameters(struct rte_kvargs *kvlist, char > *if_name, int *start_queue, > if (ret < 0) > goto free_kvlist; >=20 > + ret =3D rte_kvargs_process(kvlist, ETH_AF_XDP_DP_PATH_ARG, > + &parse_prog_arg, dp_path); > + if (ret < 0) > + goto free_kvlist; > + > free_kvlist: > rte_kvargs_free(kvlist); > return ret; > @@ -2108,7 +2117,7 @@ static struct rte_eth_dev * > init_internals(struct rte_vdev_device *dev, const char *if_name, > int start_queue_idx, int queue_cnt, int shared_umem, > const char *prog_path, int busy_budget, int force_copy, > - int use_cni) > + int use_cni, const char *dp_path) > { > const char *name =3D rte_vdev_device_name(dev); > const unsigned int numa_node =3D dev->device.numa_node; > @@ -2138,6 +2147,7 @@ init_internals(struct rte_vdev_device *dev, const > char *if_name, > internals->shared_umem =3D shared_umem; > internals->force_copy =3D force_copy; > internals->use_cni =3D use_cni; > + strlcpy(internals->dp_path, dp_path, PATH_MAX); >=20 > if (xdp_get_channels_info(if_name, &internals->max_queue_cnt, > &internals->combined_queue_cnt)) { > @@ -2199,7 +2209,7 @@ init_internals(struct rte_vdev_device *dev, const > char *if_name, > if (!internals->use_cni) > eth_dev->dev_ops =3D &ops; > else > - eth_dev->dev_ops =3D &ops_cni; > + eth_dev->dev_ops =3D &ops_afxdp_dp; >=20 > eth_dev->rx_pkt_burst =3D eth_af_xdp_rx; > eth_dev->tx_pkt_burst =3D eth_af_xdp_tx; > @@ -2328,6 +2338,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > *dev) > int busy_budget =3D -1, ret; > int force_copy =3D 0; > int use_cni =3D 0; > + char dp_path[PATH_MAX] =3D {'\0'}; > struct rte_eth_dev *eth_dev =3D NULL; > const char *name =3D rte_vdev_device_name(dev); >=20 > @@ -2370,7 +2381,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > *dev) >=20 > if (parse_parameters(kvlist, if_name, &xsk_start_queue_idx, > &xsk_queue_cnt, &shared_umem, prog_path, > - &busy_budget, &force_copy, &use_cni) < 0) { > + &busy_budget, &force_copy, &use_cni, dp_path) < > 0) { > AF_XDP_LOG(ERR, "Invalid kvargs value\n"); > return -EINVAL; > } > @@ -2384,7 +2395,19 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > *dev) > if (use_cni && strnlen(prog_path, PATH_MAX)) { > AF_XDP_LOG(ERR, "When '%s' parameter is used, '%s' > parameter is not valid\n", > ETH_AF_XDP_USE_CNI_ARG, > ETH_AF_XDP_PROG_ARG); > - return -EINVAL; > + return -EINVAL; > + } > + > + if (use_cni && !strnlen(dp_path, PATH_MAX)) { > + snprintf(dp_path, sizeof(dp_path), "%s/%s/%s", > DP_BASE_PATH, if_name, DP_UDS_SOCK); > + AF_XDP_LOG(INFO, "'%s' parameter not provided, setting > value to '%s'\n", > + ETH_AF_XDP_DP_PATH_ARG, dp_path); > + } > + > + if (!use_cni && strnlen(dp_path, PATH_MAX)) { > + AF_XDP_LOG(ERR, "'%s' parameter is set, but '%s' was not > enabled\n", > + ETH_AF_XDP_DP_PATH_ARG, > ETH_AF_XDP_USE_CNI_ARG); > + return -EINVAL; > } >=20 > if (strlen(if_name) =3D=3D 0) { > @@ -2410,7 +2433,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > *dev) >=20 > eth_dev =3D init_internals(dev, if_name, xsk_start_queue_idx, > xsk_queue_cnt, shared_umem, prog_path, > - busy_budget, force_copy, use_cni); > + busy_budget, force_copy, use_cni, dp_path); > if (eth_dev =3D=3D NULL) { > AF_XDP_LOG(ERR, "Failed to init internals\n"); > return -1; > @@ -2471,4 +2494,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp, > "xdp_prog=3D " > "busy_budget=3D " > "force_copy=3D " > - "use_cni=3D "); > + "use_cni=3D " > + "dp_path=3D "); > -- > 2.41.0