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 E04F5436FD; Fri, 15 Dec 2023 12:51:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF89E40299; Fri, 15 Dec 2023 12:51:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mails.dpdk.org (Postfix) with ESMTP id 0DBAC4021F for ; Fri, 15 Dec 2023 12:51:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702641110; x=1734177110; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=31o6Es2u4GjZq7TgcHbge/ZFWldYmDbvYO3qS5u2bEQ=; b=AXsCED+XIp9ySJtENGNn8furhCdsDHwhQdIIkH+aLeO2Jn3UXDiTsEDa ufTGTT38yTkRXp5HI9vD572rWr71oDTHbOEy4MuHZVQg8mlOdCGYSgehJ 5c+pALFfN7I+gbVMJfELlWNHkCPz651WcDcUwOZCBkPOhi8eGNC4Hn47q I3PJ1tEM5JeoPAN738RtrNNl809sP6U0uqmqrHyStjvhlfNns+tyGLDiX oCYAXtaWx3ogkSRVmF0Gv+/tJHG1TUrVtAo7DKUGJ4X/TDhVLYlOTcd2Z qo7U2FAy+L/sLo0omZyfkwu7odGn+jE0z4oHegfzbWQbnhXfGhUn+yV3S Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="2086311" X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="2086311" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2023 03:51:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10924"; a="808943876" X-IronPort-AV: E=Sophos;i="6.04,278,1695711600"; d="scan'208";a="808943876" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 15 Dec 2023 03:51:47 -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; Fri, 15 Dec 2023 03:51:47 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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; Fri, 15 Dec 2023 03:51:47 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 15 Dec 2023 03:51:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nD/ULvSVvrIJFrbzfMNjUu6UNe1Xpvbz37cKa0qB8UsCqftndG0YU7auj06szPECgobEl/fqcMVE0RSdhsyrcH9j3Gy7nvyhWhxidwBY6BkgKxAk/YiP0z54ChlRHFGXtmGpRM2zddKA7Xcevrom61M51oeU17LrAxziWrfVOQbeEUVI5OzxLj1Zl2U7ahJ7syFT/vIU+NLZFG2gP+o6AFRE+hv1l2UmzwAgfmBtEM3JCthoXwmxtWevrxt31/WQf59IHD440LstoIi1BlSDsDDcbmIPXrzgQgX8iQpPGGSdWhkZDJbpKL8WtzLy2Z1vCeiliC1J2Wbpd2cd1gUEoA== 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=v68D0BYvuUJ8MNQRMSkNm08yPnHE8IzXxgN8EJEcJ9A=; b=msUSQLjjIpBJ5MeH2SLqNEa/++rMefyE3uhEp5Xf5+6TnVVrbIoKwrlPC4d4f826XAKjPRjarqjhAkoAAVeD6LgB0Lv70qwpSajir8pdWTtIS7ah50ifPGG68gDXD0mZnslMbO6PVyOffskqHbXxZ7rox8MyPNatlT4p1xfWZtGh650hB3/HKidTN40m3+2jbzdd9ELKvg6ZThGo7W0vsa3xfA4ZWnpMQZc7tL+xRaKq6mQfxUOUEdAmwti/fuEn++kuEb5ifU24s6QC8gPsrGH0XnIpBt1XWACPDYGa5nEOOTZ6I5Szi7GrPaWGhiEq95txErkm0NdJmN7QYLpKLg== 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 SN7PR11MB7568.namprd11.prod.outlook.com (2603:10b6:806:34e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.31; Fri, 15 Dec 2023 11:51:42 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::2f2f:41ab:b556:7257]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::2f2f:41ab:b556:7257%3]) with mapi id 15.20.7091.030; Fri, 15 Dec 2023 11:51:42 +0000 From: "Loftus, Ciara" To: "Tahhan, Maryam" , "ferruh.yigit@amd.com" , "stephen@networkplumber.org" , "lihuisong@huawei.com" , "fengchengwen@huawei.com" , "liuyonglong@huawei.com" , "Koikkara Reeny, Shibin" CC: "dev@dpdk.org" , "Tahhan, Maryam" Subject: RE: [v5] net/af_xdp: enable uds_path instead of use_cni Thread-Topic: [v5] net/af_xdp: enable uds_path instead of use_cni Thread-Index: AQHaL0YwvUjEs2KaPU+MDczBqyDzrbCqMtUQ Date: Fri, 15 Dec 2023 11:51:42 +0000 Message-ID: References: <20231215105704.615466-1-mtahhan@redhat.com> In-Reply-To: <20231215105704.615466-1-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_|SN7PR11MB7568:EE_ x-ms-office365-filtering-correlation-id: c65e9f50-c6d7-4a31-1e7e-08dbfd6434b0 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: g8co9muMiVdJ+Qa7Czv+HLe8rr5acORgaPG4vMsTPrXULcIIFIuGufznBlN3wTw2uFYsd/Kw8S8H4bFl8FOPMzmm8sNfaXyPr+mQ/HJicZd88Y5th3jcr3Xo0fUsEpzmLTETnLdrltbF7OvhMLahhFjLqGakHIi/eKUhhZCPg+z4bgZUEz3N5dOq9p4DlqqUh3KD4QWpOqrKNR5nP0Rb1UmhXNamfvwKKbyVqtlejRFvnxJ2wc8dk4SlRbdhZRdP/P4WFMZ3nqYGeom6OlJGY4xZsM9ZW1G2vhE9Bax/NMkRaLQKGVHMxqZYzkowPyLbJJBf/U3yo59pN7VgrM1PDjRdX2K65eu8xsrDuKQgIyw2Bp/YfyKCtTjxaZ2sC/NJG3krfESN3/+lxb2nP8Jo/grB98AwinJ0CFSQNjgHjDUARywaRnJhrVqclzz5wbNE7MHKiPly0Z2XLuRn+ZCMM/hf+F7LQ2ZHtzAwKgoygBPf6X1Tqp+HEulesmYrabhPuoXifWeDFoAqH1wToZuDCIqmfRuMmtvvZBla4SxA6yszHQ8frxZR5FGUmeCEkV+jhOCoMtqytqPbBF1x5gkfCWnJDF1r24nIXu+TIDFtTCfkb66GOakRcaVaRqvOdO73 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)(376002)(39860400002)(136003)(346002)(396003)(366004)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(83380400001)(71200400001)(26005)(122000001)(38100700002)(4326008)(8676002)(8936002)(5660300002)(52536014)(41300700001)(30864003)(2906002)(478600001)(966005)(6506007)(7696005)(9686003)(54906003)(64756008)(66446008)(66476007)(66556008)(66946007)(316002)(6636002)(76116006)(110136005)(86362001)(33656002)(82960400001)(38070700009)(84970400001)(55016003)(579004)(559001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?h89x3QulVyrpmhPINZN+Kf8Gh+4k5HaZHLNaqmD41e9ZmEHPmOOySt67QIsU?= =?us-ascii?Q?l9z+D00ZNXlZ2PabL/g3PdeUBs1IzLsZh/EzCsN5ioL45pIb/R6XQxbgvOLL?= =?us-ascii?Q?CSUf0LwsKyrgoTSVLQeDHJ0xL89nVkzNEVIpC7wn/tLl5hHnVLFAfbQ10Wrd?= =?us-ascii?Q?uWuEYIznUF2XSMWKSr2pcgGHHsSoP5rV9jr0k3gx766MVOlW2EeGOL2IGT20?= =?us-ascii?Q?n+G7bt7xL7z72E3wqUS9jFzIwK0fuio9LDfCA+h+SlG7KC1wi3gRQ1R1j9kt?= =?us-ascii?Q?ptQi/dl3Ct/C2M1nJC24S6RU/LbFYrRlv3TB1dBFOTqlGY8d6iTg7ZdK1CWi?= =?us-ascii?Q?D1w7nJcdtoqyRN36M7DDQ8Su7fHzWqrvGDKAqHf87b4dr16+OYB0ziGV+H5b?= =?us-ascii?Q?2FJDsLt6aQ+qmIZwsYGJIoUsHDiehbfLwm9XYjg+XrYPl//f6+K9cooa9FJ6?= =?us-ascii?Q?92ox6H0rGnIDvKgCx5cP/3jf+nLal8cqj2nMyIXW9Ohv9BXiD2TXgQGieZGV?= =?us-ascii?Q?OTunEp5J0x0LqaIJ7keRdVW9ONR9uh06mS5qX2sIiX0q5Ri0xCIG+aq49+vD?= =?us-ascii?Q?pIVn/SgJ4EZT7GgkjDJTQ8F3QyRYUmOHOilOlxlenA+9xTcW/MClCUgOg1Bj?= =?us-ascii?Q?8qU1LyKfxHRvyFsegnbaX03BkGlCkch+kHjLr1BmGmHG0Tx1saWubzf7L6B9?= =?us-ascii?Q?s8TvxkfhBNB9lY732GyabH+X7g1sHhmdRP1zkeVxo7LCkh+RFGd63YmmuGVv?= =?us-ascii?Q?zqNcmAzbsSlDEeaPv43b2sAmWLkMTCsoU0HoMP+IpPhGAC7O/BUWjfvL+0x+?= =?us-ascii?Q?tNPg7o/GrgZ63QpQIwZ3NVfy56K07h3eNYPwzMhnYKXCWFgk/i797O0amoQB?= =?us-ascii?Q?TsLvnWEeLTxRLKDVbGyFwfcp2HWbhyleAkt+H4a65dKPoyI5dAwpPD8mx/2j?= =?us-ascii?Q?SO8edNxQ6muhyT6CTRqhvcWOobX+kKvHkwAwg6yF+NIhw9BFEwWvtuEIdDbL?= =?us-ascii?Q?muHOeqB1Olv5ENd1fruwvF1EXElBBlPjusd+i4peoxUjAlHqwOMCkeQBm04O?= =?us-ascii?Q?MNC32MoG6GLP+9Afyz0xoRpoAgJ5qoL9cdNDTVSYD8d6JiJXgJRvylNTptt3?= =?us-ascii?Q?yNatMNkId+r01lQ6DzOHBQ5nVWejOfJjVQ1nd/ak+haM5fyO4ynAz9QPK/QL?= =?us-ascii?Q?wc3HpDZVSk0BrvL2yPZS6ejNljxEY6I5sa12FXFtowSMZ9LDiiyBRqhILY+R?= =?us-ascii?Q?1of3CGO3HT2xAkAOyVQ+hA4JiJ8dtx03LsOK1G1fV8ClTcJyosyku0fe9wzY?= =?us-ascii?Q?HBzhQRfzlWmuOHOuGEAOmhqRc3hwV4vMi5q+bl8bRY7sgRRkXXhzyXJzjfeN?= =?us-ascii?Q?gE7Ca/kD7ADvS8Pb3xsfabYwYiYSfQvZjI+jC5K81B4d0DsgPB1JpB3tbsJt?= =?us-ascii?Q?yuv7Fr87ja8aAk/SEoSdezbKrqCR4ZY6wjqTMmeUrnrS4mRcpnfIFJeI6DF0?= =?us-ascii?Q?CPuULgF3IYqrre17VtuZT6Bx5bindcxQcrsHy+gaXA43jV36rCJfDzZelhNe?= =?us-ascii?Q?wLV0jcLU8CqROGXYaVduVWpCDD0wpSU7IWiiYTqG?= 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: c65e9f50-c6d7-4a31-1e7e-08dbfd6434b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2023 11:51:42.4983 (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: OM32Qq8DCpO4aHondczbKgbGwoErii/Y8op2OxUdBHegTiOmUAngQr0+A71jnS13bPdI8pwgZXI/aTXfKQ3d1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7568 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 >=20 > With the original 'use_cni' implementation, (using 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 container 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 > 'uds_path' and removing the previous 'use_cni' param. > This patch also fixes incorrect references to the > AF_XDP DP as CNI and updates the documentation with a > working example. This change has been tested with the > AF_XDP DP PR 81, with both single and multiple interfaces. >=20 > v5: > * Fix alignment for ETH_AF_XDP_USE_DP_UDS_PATH_ARG > * Remove use_cni references in af_xdp.rst >=20 > v4: > * Rename af_xdp_cni.rst to af_xdp_dp.rst > * Removed all incorrect references to CNI throughout af_xdp > PMD file. > * Fixed Typos in af_xdp_dp.rst >=20 > v3: > * Remove `use_cni` vdev argument as it's no longer needed. > * Update incorrect CNI references for the AF_XDP DP in the > documentation. > * Update the documentation to run a simple example with the > AF_XDP DP plugin in K8s. >=20 > v2: > * Rename sock_path to uds_path. > * Update documentation to reflect when CAP_BPF is needed. > * Fix testpmd arguments in the provided example for Pods. > * Use AF_XDP API to update the xskmap entry. >=20 > Signed-off-by: Maryam Tahhan Thanks for the changes. LGTM. Reviewed-by: Ciara Loftus Would like to wait for Shibin to review this latest patch before it's consi= dered for merging as I know he had some feedback on earlier versions. Thanks, Ciara > --- > doc/guides/howto/af_xdp_cni.rst | 253 ------------------------- > doc/guides/howto/af_xdp_dp.rst | 278 > ++++++++++++++++++++++++++++ > doc/guides/howto/index.rst | 2 +- > doc/guides/nics/af_xdp.rst | 27 ++- > drivers/net/af_xdp/rte_eth_af_xdp.c | 100 +++++----- > 5 files changed, 345 insertions(+), 315 deletions(-) > delete mode 100644 doc/guides/howto/af_xdp_cni.rst > create mode 100644 doc/guides/howto/af_xdp_dp.rst >=20 > diff --git a/doc/guides/howto/af_xdp_cni.rst > b/doc/guides/howto/af_xdp_cni.rst > deleted file mode 100644 > index a1a6d5b99c..0000000000 > --- a/doc/guides/howto/af_xdp_cni.rst > +++ /dev/null > @@ -1,253 +0,0 @@ > -.. SPDX-License-Identifier: BSD-3-Clause > - Copyright(c) 2023 Intel Corporation. > - > -Using a CNI with the AF_XDP driver > -=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 > - > -Introduction > ------------- > - > -CNI, the Container Network Interface, is a technology for configuring > -container network interfaces > -and which can be used to setup Kubernetes networking. > -AF_XDP is a Linux socket Address Family that enables an XDP program > -to redirect packets to a memory buffer in userspace. > - > -This document explains how to enable the `AF_XDP Plugin for Kubernetes`_ > within > -a DPDK application using the :doc:`../nics/af_xdp` to connect and use th= ese > technologies. > - > -.. _AF_XDP Plugin for Kubernetes: https://github.com/intel/afxdp-plugins= - > for-kubernetes > - > - > -Background > ----------- > - > -The standard :doc:`../nics/af_xdp` initialization process involves loadi= ng an > eBPF program > -onto the kernel netdev to be used by the PMD. > -This operation requires root or escalated Linux privileges > -and thus prevents the PMD from working in an unprivileged container. > -The AF_XDP CNI plugin handles this situation > -by providing a device plugin that performs the program loading. > - > -At a technical level the CNI opens a Unix Domain Socket and listens for = a client > -to make requests over that socket. > -A DPDK application acting as a client connects and initiates a configura= tion > "handshake". > -The client then receives a file descriptor which points to the XSKMAP > -associated with the loaded eBPF program. > -The XSKMAP is a BPF map of AF_XDP sockets (XSK). > -The client can then proceed with creating an AF_XDP socket > -and inserting that socket into the XSKMAP pointed to by the descriptor. > - > -The EAL vdev argument ``use_cni`` is used to indicate that the user wish= es > -to run the PMD in unprivileged mode and to receive the XSKMAP file > descriptor > -from the CNI. > -When this flag is set, > -the ``XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD`` libbpf flag > -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 CNI. > - > -.. note:: > - > - The Unix Domain Socket file path appear in the end user is > "/tmp/afxdp.sock". > - > - > -Prerequisites > -------------- > - > -Docker and container prerequisites: > - > -* Set up the device plugin > - as described in the instructions for `AF_XDP Plugin for Kubernetes`_. > - > -* The Docker image should contain the libbpf and libxdp libraries, > - which are dependencies for AF_XDP, > - and should include support for the ``ethtool`` command. > - > -* The Pod should have enabled the capabilities ``CAP_NET_RAW`` and > ``CAP_BPF`` > - for AF_XDP along with support for hugepages. > - > -* Increase locked memory limit so containers have enough memory for pack= et > buffers. > - For example: > - > - .. code-block:: console > - > - cat << EOF | sudo tee > /etc/systemd/system/containerd.service.d/limits.conf > - [Service] > - LimitMEMLOCK=3Dinfinity > - EOF > - > -* dpdk-testpmd application should have AF_XDP feature enabled. > - > - For further information see the docs for the: :doc:`../../nics/af_xdp`= . > - > - > -Example > -------- > - > -Howto run dpdk-testpmd with CNI plugin: > - > -* Clone the CNI plugin > - > - .. code-block:: console > - > - # git clone https://github.com/intel/afxdp-plugins-for-kubernetes.g= it > - > -* Build the CNI plugin > - > - .. code-block:: console > - > - # cd afxdp-plugins-for-kubernetes/ > - # make build > - > - .. note:: > - > - CNI plugin has a dependence on the config.json. > - > - Sample Config.json > - > - .. code-block:: json > - > - { > - "logLevel":"debug", > - "logFile":"afxdp-dp-e2e.log", > - "pools":[ > - { > - "name":"e2e", > - "mode":"primary", > - "timeout":30, > - "ethtoolCmds" : ["-L -device- combined 1"], > - "devices":[ > - { > - "name":"ens785f0" > - } > - ] > - } > - ] > - } > - > - For further reference please use the `config.json`_ > - > - .. _config.json: https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/v0.0.2/test/e2e/config.json > - > -* Create the Network Attachment definition > - > - .. code-block:: console > - > - # kubectl create -f nad.yaml > - > - Sample nad.yml > - > - .. code-block:: yaml > - > - apiVersion: "k8s.cni.cncf.io/v1" > - kind: NetworkAttachmentDefinition > - metadata: > - name: afxdp-e2e-test > - annotations: > - k8s.v1.cni.cncf.io/resourceName: afxdp/e2e > - spec: > - config: '{ > - "cniVersion": "0.3.0", > - "type": "afxdp", > - "mode": "cdq", > - "logFile": "afxdp-cni-e2e.log", > - "logLevel": "debug", > - "ipam": { > - "type": "host-local", > - "subnet": "192.168.1.0/24", > - "rangeStart": "192.168.1.200", > - "rangeEnd": "192.168.1.216", > - "routes": [ > - { "dst": "0.0.0.0/0" } > - ], > - "gateway": "192.168.1.1" > - } > - }' > - > - For further reference please use the `nad.yaml`_ > - > - .. _nad.yaml: https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/v0.0.2/test/e2e/nad.yaml > - > -* Build the Docker image > - > - .. code-block:: console > - > - # docker build -t afxdp-e2e-test -f Dockerfile . > - > - Sample Dockerfile: > - > - .. code-block:: console > - > - FROM ubuntu:20.04 > - RUN apt-get update -y > - RUN apt install build-essential libelf-dev -y > - RUN apt-get install iproute2 acl -y > - RUN apt install python3-pyelftools ethtool -y > - RUN apt install libnuma-dev libjansson-dev libpcap-dev net-tools -y > - RUN apt-get install clang llvm -y > - COPY ./libbpf.tar.gz /tmp > - RUN cd /tmp && tar -xvmf libbpf.tar.gz && cd libbpf/src && > make install > - COPY ./libxdp.tar.gz /tmp > - RUN cd /tmp && tar -xvmf libxdp.tar.gz && cd libxdp && mak= e > install > - > - .. note:: > - > - All the files that need to COPY-ed should be in the same directory = as the > Dockerfile > - > -* Run the Pod > - > - .. code-block:: console > - > - # kubectl create -f pod.yaml > - > - Sample pod.yaml: > - > - .. code-block:: yaml > - > - apiVersion: v1 > - kind: Pod > - metadata: > - name: afxdp-e2e-test > - annotations: > - k8s.v1.cni.cncf.io/networks: afxdp-e2e-test > - spec: > - containers: > - - name: afxdp > - image: afxdp-e2e-test:latest > - imagePullPolicy: Never > - env: > - - name: LD_LIBRARY_PATH > - value: /usr/lib64/:/usr/local/lib/ > - command: ["tail", "-f", "/dev/null"] > - securityContext: > - capabilities: > - add: > - - CAP_NET_RAW > - - CAP_BPF > - resources: > - requests: > - hugepages-2Mi: 2Gi > - memory: 2Gi > - afxdp/e2e: '1' > - limits: > - hugepages-2Mi: 2Gi > - memory: 2Gi > - afxdp/e2e: '1' > - > - For further reference please use the `pod.yaml`_ > - > - .. _pod.yaml: https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/v0.0.2/test/e2e/pod-1c1d.yaml > - > -* Run DPDK with a command like the following: > - > - .. code-block:: console > - > - kubectl exec -i --container -- \ > - //dpdk-testpmd -l 0,1 --no-pci \ > - --vdev=3Dnet_af_xdp0,use_cni=3D1,iface=3D \ > - -- --no-mlockall --in-memory > - > -For further reference please use the `e2e`_ test case in `AF_XDP Plugin = for > Kubernetes`_ > - > - .. _e2e: https://github.com/intel/afxdp-plugins-for- > kubernetes/tree/v0.0.2/test/e2e > diff --git a/doc/guides/howto/af_xdp_dp.rst > b/doc/guides/howto/af_xdp_dp.rst > new file mode 100644 > index 0000000000..7717d59224 > --- /dev/null > +++ b/doc/guides/howto/af_xdp_dp.rst > @@ -0,0 +1,278 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2023 Intel Corporation. > + > +Using the AF_XDP Device Plugin with the AF_XDP driver > +=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 > + > +Introduction > +------------ > + > +The `AF_XDP Device Plugin for Kubernetes`_ is a project that provisions > +and advertises interfaces (that can be used with AF_XDP) to Kubernetes. > +The project also includes a `CNI`_. > + > +AF_XDP is a Linux socket Address Family that enables an XDP program > +to redirect packets to a memory buffer in userspace. > + > +This document explains how to use the `AF_XDP Device Plugin for > Kubernetes`_ with > +a DPDK :doc:`../nics/af_xdp` based application running in a Pod. > + > +.. _AF_XDP Device Plugin for Kubernetes: https://github.com/intel/afxdp- > plugins-for-kubernetes > +.. _CNI: https://github.com/containernetworking/cni > + > +Background > +---------- > + > +The standard :doc:`../nics/af_xdp` initialization process involves > +loading an eBPF program onto the Kernel netdev to be used by the PMD. > +This operation requires root or escalated Linux privileges and prevents > +the PMD from working in an unprivileged container. The AF_XDP Device > Plugin (DP) > +addresses this situation by providing an entity that manages eBPF progra= m > +lifecycle for Pod interfaces that wish to use AF_XDP, this in turn allow= s > +the pod to be used without privilege escalation. > + > +In order for the pod to run without privilege escalation, the AF_XDP DP > +creates a Unix Domain Socket (UDS) and listens for Pods to make requests > +for XSKMAP(s) File Descriptors (FDs) for interfaces in their network > namespace. > +In other words, the DPDK application running in the Pod connects to this= UDS > and > +initiates a "handshake" to retrieve the XSKMAP(s) FD(s). Upon a successf= ul > "handshake", > +the DPDK application receives the FD(s) for the XSKMAP(s) associated wit= h > the relevant > +netdevs. The DPDK application can then create the AF_XDP socket(s), and > attach > +the socket(s) to the netdev queue(s) by inserting the socket(s) into the > XSKMAP(s). > + > +The EAL vdev argument ``uds_path`` is used to indicate that the user > +wishes to run the AF_XDP PMD in unprivileged mode and to receive the > XSKMAP > +FD from the AF_XDP DP. When this param is used, the > +``XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD`` libbpf flag is used when > creating the > +AF_XDP socket to instruct libbpf/libxdp not to load the default eBPF red= irect > +program for AF_XDP on the netdev. Instead the lifecycle management of th= e > eBPF > +program is handled by the AF_XDP DP. > + > +.. note:: > + > + The UDS file path inside the pod appears at > "/tmp/afxdp_dp//afxdp.sock". > + > +Prerequisites > +------------- > + > +Device Plugin and DPDK container prerequisites: > + > +* Create a DPDK container image. > + > +* Set up the device plugin and prepare the Pod Spec as described in > + the instructions for `AF_XDP Device Plugin for Kubernetes`_. > + > +* Increase locked memory limit so containers have enough memory for > packet buffers. > + For example: > + > + .. code-block:: console > + > + cat << EOF | sudo tee > /etc/systemd/system/containerd.service.d/limits.conf > + [Service] > + LimitMEMLOCK=3Dinfinity > + EOF > + > +* dpdk-testpmd application should have AF_XDP feature enabled. > + > + For further information see the docs for the: :doc:`../../nics/af_xdp`= . > + > + > +Example > +------- > + > +How to run dpdk-testpmd with the AF_XDP Device plugin: > + > +* Clone the AF_XDP Device plugin > + > + .. code-block:: console > + > + # git clone https://github.com/intel/afxdp-plugins-for-kubernetes.g= it > + > +* Build the AF_XDP Device plugin and the CNI > + > + .. code-block:: console > + > + # cd afxdp-plugins-for-kubernetes/ > + # make image > + > +* Make sure to modify the image used by the `daemonset.yml`_ file in the > deployments directory with > + the following configuration: > + > + .. _daemonset.yml : https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/main/deployments/daemonset.yml > + > + .. code-block:: yaml > + > + image: afxdp-device-plugin:latest > + > + .. note:: > + > + This will select the AF_XDP DP image that was built locally. Detaile= d > configuration > + options can be found in the AF_XDP Device Plugin `readme`_ . > + > + .. _readme: https://github.com/intel/afxdp-plugins-for-kubernetes#read= me > + > +* Deploy the AF_XDP Device Plugin and CNI > + > + .. code-block:: console > + > + # kubectl create -f deployments/daemonset.yml > + > +* Create a Network Attachment Definition (NAD) > + > + .. code-block:: console > + > + # kubectl create -f nad.yaml > + > + Sample nad.yml > + > + .. code-block:: yaml > + > + apiVersion: "k8s.cni.cncf.io/v1" > + kind: NetworkAttachmentDefinition > + metadata: > + name: afxdp-network > + annotations: > + k8s.v1.cni.cncf.io/resourceName: afxdp/myPool > + spec: > + config: '{ > + "cniVersion": "0.3.0", > + "type": "afxdp", > + "mode": "primary", > + "logFile": "afxdp-cni.log", > + "logLevel": "debug", > + "ethtoolCmds" : ["-N -device- rx-flow-hash udp4 fn", > + "-N -device- flow-type udp4 dst-port 2152 act= ion 22" > + ], > + "ipam": { > + "type": "host-local", > + "subnet": "192.168.1.0/24", > + "rangeStart": "192.168.1.200", > + "rangeEnd": "192.168.1.220", > + "routes": [ > + { "dst": "0.0.0.0/0" } > + ], > + "gateway": "192.168.1.1" > + } > + }' > + > + For further reference please use the example provided by the AF_XDP DP > `nad.yaml`_ > + > + .. _nad.yaml: https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/main/examples/network-attachment-definition.yaml > + > +* Build a DPDK container image (using Docker) > + > + .. code-block:: console > + > + # docker build -t dpdk -f Dockerfile . > + > + Sample Dockerfile (should be placed in top level DPDK directory): > + > + .. code-block:: console > + > + FROM fedora:38 > + > + # Setup container to build DPDK applications > + RUN dnf -y upgrade && dnf -y install \ > + libbsd-devel \ > + numactl-libs \ > + libbpf-devel \ > + libbpf \ > + meson \ > + ninja-build \ > + libxdp-devel \ > + libxdp \ > + numactl-devel \ > + python3-pyelftools \ > + python38 \ > + iproute > + RUN dnf groupinstall -y 'Development Tools' > + > + # Create DPDK dir and copy over sources > + WORKDIR /dpdk > + COPY app app > + COPY builddir builddir > + COPY buildtools buildtools > + COPY config config > + COPY devtools devtools > + COPY drivers drivers > + COPY dts dts > + COPY examples examples > + COPY kernel kernel > + COPY lib lib > + COPY license license > + COPY MAINTAINERS MAINTAINERS > + COPY Makefile Makefile > + COPY meson.build meson.build > + COPY meson_options.txt meson_options.txt > + COPY usertools usertools > + COPY VERSION VERSION > + COPY ABI_VERSION ABI_VERSION > + COPY doc doc > + > + # Build DPDK > + RUN meson setup build > + RUN ninja -C build > + > + .. note:: > + > + Ensure the Dockerfile is placed in the top level DPDK directory. > + > +* Run the Pod > + > + .. code-block:: console > + > + # kubectl create -f pod.yaml > + > + Sample pod.yaml: > + > + .. code-block:: yaml > + > + apiVersion: v1 > + kind: Pod > + metadata: > + name: dpdk > + annotations: > + k8s.v1.cni.cncf.io/networks: afxdp-network > + spec: > + containers: > + - name: testpmd > + image: dpdk:latest > + command: ["tail", "-f", "/dev/null"] > + securityContext: > + capabilities: > + add: > + - NET_RAW > + - IPC_LOCK > + resources: > + requests: > + afxdp/myPool: '1' > + limits: > + hugepages-1Gi: 2Gi > + cpu: 2 > + memory: 256Mi > + afxdp/myPool: '1' > + volumeMounts: > + - name: hugepages > + mountPath: /dev/hugepages > + volumes: > + - name: hugepages > + emptyDir: > + medium: HugePages > + > + For further reference please use the `pod.yaml`_ > + > + .. _pod.yaml: https://github.com/intel/afxdp-plugins-for- > kubernetes/blob/main/examples/pod-spec.yaml > + > +.. note:: > + > + For Kernel versions older than 5.19 `CAP_BPF` is also required in > + the container capabilities stanza. > + > +* Run DPDK with a command like the following: > + > + .. code-block:: console > + > + kubectl exec -i dpdk --container testpmd -- \ > + ./build/app/dpdk-testpmd -l 0-2 --no-pci --main-lcore=3D2 \ > + --vdev net_af_xdp,iface=3D name>,start_queue=3D22,queue_count=3D1,uds_path=3D/tmp/afxdp_dp/ -name>/afxdp.sock \ > + -- -i --a --nb-cores=3D2 --rxq=3D1 --txq=3D1 --forward-mode= =3Dmacswap; > diff --git a/doc/guides/howto/index.rst b/doc/guides/howto/index.rst > index 71a3381c36..a7692e8a97 100644 > --- a/doc/guides/howto/index.rst > +++ b/doc/guides/howto/index.rst > @@ -8,7 +8,7 @@ HowTo Guides > :maxdepth: 2 > :numbered: >=20 > - af_xdp_cni > + af_xdp_dp > lm_bond_virtio_sriov > lm_virtio_vhost_user > flow_bifurcation > diff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst > index 1932525d4d..0edc84328d 100644 > --- a/doc/guides/nics/af_xdp.rst > +++ b/doc/guides/nics/af_xdp.rst > @@ -151,25 +151,32 @@ instead of zero copy mode (if available). >=20 > --vdev net_af_xdp,iface=3Dens786f1,force_copy=3D1 >=20 > -use_cni > -~~~~~~~ > +uds_path > +~~~~~~~~~ >=20 > -The EAL vdev argument ``use_cni`` is used to indicate that the user wish= es to > -enable the `AF_XDP Plugin for Kubernetes`_ within a DPDK application. > +The EAL vdev argument ``uds_path`` is used to indicate that the user wis= hes > to > +use the `AF_XDP Plugin for Kubernetes`_ with a DPDK application running = in a > Pod. >=20 > .. _AF_XDP Plugin for Kubernetes: https://github.com/intel/afxdp-plugins= - > for-kubernetes >=20 > .. code-block:: console >=20 > - --vdev=3Dnet_af_xdp0,use_cni=3D1 > + --vdev=3Dnet_af_xdp0,uds_path=3D=3D/tmp/afxdp_dp/ name>/afxdp.sock >=20 > .. note:: >=20 > - When using `use_cni`_, both parameters `xdp_prog`_ and `busy_budget`_ > are disabled > - as both of these will be handled by the AF_XDP plugin. > - Since the DPDK application is running in limited privileges > - so enabling and disabling of the promiscuous mode through the DPDK > application > - is also not supported. > + The UDS ``afxdp.sock`` is available in the DPDK container through a > + volume mounted by the `AF_XDP Plugin for Kubernetes`_ at the path > + specified in the example above. > + > +.. note:: > + > + When using `uds_path`_, both parameters `xdp_prog`_ and `busy_budget`= _ > are disabled > + as both of these will be handled by the AF_XDP Device plugin (if requ= ired). > + Since the pod/container is running with limited privileges enabling a= nd > disabling > + of promiscuous mode through the DPDK application is also not supporte= d. > + > +For more details please see: :doc:`../howto/af_xdp_dp` >=20 > Limitations > ----------- > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c > b/drivers/net/af_xdp/rte_eth_af_xdp.c > index 353c8688ec..db6724b9e5 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -88,7 +88,6 @@ RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, NOTICE); > #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" > @@ -170,7 +169,7 @@ struct pmd_internals { > char prog_path[PATH_MAX]; > bool custom_prog_configured; > bool force_copy; > - bool use_cni; > + char uds_path[PATH_MAX]; > struct bpf_map *map; >=20 > struct rte_ether_addr eth_addr; > @@ -190,7 +189,7 @@ struct pmd_process_private { > #define ETH_AF_XDP_PROG_ARG "xdp_prog" > #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_USE_DP_UDS_PATH_ARG "uds_path" >=20 > static const char * const valid_arguments[] =3D { > ETH_AF_XDP_IFACE_ARG, > @@ -200,7 +199,7 @@ static const char * const valid_arguments[] =3D { > ETH_AF_XDP_PROG_ARG, > ETH_AF_XDP_BUDGET_ARG, > ETH_AF_XDP_FORCE_COPY_ARG, > - ETH_AF_XDP_USE_CNI_ARG, > + ETH_AF_XDP_USE_DP_UDS_PATH_ARG, > NULL > }; >=20 > @@ -1351,7 +1350,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 *uds_path) > { > int sock; >=20 > @@ -1362,7 +1361,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, uds_path, sizeof(server->sun_path)); >=20 > if (connect(sock, (struct sockaddr *)server, sizeof(struct > sockaddr_un)) < 0) { > close(sock); > @@ -1382,7 +1381,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 *uds_path) > { > int snd; > struct iovec iov; > @@ -1393,7 +1392,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, uds_path, sizeof(dst.sun_path)); >=20 > /* Initialize message header structure */ > memset(&msgh, 0, sizeof(msgh)); > @@ -1470,8 +1469,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 > *uds_path) > { > int rval; >=20 > @@ -1483,7 +1482,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, uds_path); >=20 > if (rval < 0) { > AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno)); > @@ -1507,7 +1506,7 @@ check_response(char *response, char *exp_resp, > long size) > } >=20 > static int > -get_cni_fd(char *if_name) > +get_xskmap_fd(char *if_name, const char *uds_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 +1519,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, uds_path); > if (sock < 0) > return -1; >=20 > - /* Initiates handshake to CNI send: /connect,hostname */ > + /* Initiates handshake to 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, uds_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1541,7 +1540,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, uds_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1549,7 +1548,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, uds_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1571,7 +1570,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, uds_path) < 0) { > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", request); > goto err_close; > } > @@ -1640,7 +1639,7 @@ xsk_configure(struct pmd_internals *internals, > struct pkt_rx_queue *rxq, > #endif >=20 > /* Disable libbpf from loading XDP program */ > - if (internals->use_cni) > + if (strnlen(internals->uds_path, PATH_MAX)) > cfg.libbpf_flags |=3D XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD; >=20 > if (strnlen(internals->prog_path, PATH_MAX)) { > @@ -1694,18 +1693,17 @@ xsk_configure(struct pmd_internals *internals, > struct pkt_rx_queue *rxq, > } > } >=20 > - if (internals->use_cni) { > - int err, fd, map_fd; > + if (strnlen(internals->uds_path, PATH_MAX)) { > + 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 get_xskmap_fd(internals->if_name, internals- > >uds_path); > if (map_fd < 0) { > - AF_XDP_LOG(ERR, "Failed to receive CNI plugin fd\n"); > + AF_XDP_LOG(ERR, "Failed to receive AF_XDP Device > plugin fd\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 +1879,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. > - **/ > -static const struct eth_dev_ops ops_cni =3D { > +/* AF_XDP Device Plugin option works in unprivileged > + * container environment and ethernet device functionality > + * will be reduced. So additional customized eth_dev_ops > + * struct is needed for the AF_XDP Device Plugin. Promiscuous > + * enable and disable functionality is removed. > + */ > +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, > @@ -1957,7 +1955,7 @@ parse_name_arg(const char *key __rte_unused, >=20 > /** parse xdp prog argument */ > static int > -parse_prog_arg(const char *key __rte_unused, > +parse_path_arg(const char *key __rte_unused, > const char *value, void *extra_args) > { > char *path =3D extra_args; > @@ -2023,7 +2021,7 @@ 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, char *uds_path) > { > int ret; >=20 > @@ -2050,7 +2048,7 @@ parse_parameters(struct rte_kvargs *kvlist, char > *if_name, int *start_queue, > goto free_kvlist; >=20 > ret =3D rte_kvargs_process(kvlist, ETH_AF_XDP_PROG_ARG, > - &parse_prog_arg, prog_path); > + &parse_path_arg, prog_path); > if (ret < 0) > goto free_kvlist; >=20 > @@ -2064,8 +2062,8 @@ 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_USE_CNI_ARG, > - &parse_integer_arg, use_cni); > + ret =3D rte_kvargs_process(kvlist, > ETH_AF_XDP_USE_DP_UDS_PATH_ARG, > + &parse_path_arg, uds_path); > if (ret < 0) > goto free_kvlist; >=20 > @@ -2108,7 +2106,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) > + const char *uds_path) > { > const char *name =3D rte_vdev_device_name(dev); > const unsigned int numa_node =3D dev->device.numa_node; > @@ -2137,7 +2135,7 @@ init_internals(struct rte_vdev_device *dev, const > char *if_name, > #endif > internals->shared_umem =3D shared_umem; > internals->force_copy =3D force_copy; > - internals->use_cni =3D use_cni; > + strlcpy(internals->uds_path, uds_path, PATH_MAX); >=20 > if (xdp_get_channels_info(if_name, &internals->max_queue_cnt, > &internals->combined_queue_cnt)) { > @@ -2196,10 +2194,10 @@ init_internals(struct rte_vdev_device *dev, const > char *if_name, > eth_dev->data->dev_link =3D pmd_link; > eth_dev->data->mac_addrs =3D &internals->eth_addr; > eth_dev->data->dev_flags |=3D > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > - if (!internals->use_cni) > + if (!strnlen(internals->uds_path, PATH_MAX)) > 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; > @@ -2327,7 +2325,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > *dev) > char prog_path[PATH_MAX] =3D {'\0'}; > int busy_budget =3D -1, ret; > int force_copy =3D 0; > - int use_cni =3D 0; > + char uds_path[PATH_MAX] =3D {'\0'}; > struct rte_eth_dev *eth_dev =3D NULL; > const char *name =3D rte_vdev_device_name(dev); >=20 > @@ -2370,20 +2368,20 @@ 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, uds_path) < 0) { > AF_XDP_LOG(ERR, "Invalid kvargs value\n"); > return -EINVAL; > } >=20 > - if (use_cni && busy_budget > 0) { > + if (strnlen(uds_path, PATH_MAX) && busy_budget > 0) { > AF_XDP_LOG(ERR, "When '%s' parameter is used, '%s' > parameter is not valid\n", > - ETH_AF_XDP_USE_CNI_ARG, > ETH_AF_XDP_BUDGET_ARG); > + ETH_AF_XDP_USE_DP_UDS_PATH_ARG, > ETH_AF_XDP_BUDGET_ARG); > return -EINVAL; > } >=20 > - if (use_cni && strnlen(prog_path, PATH_MAX)) { > + if (strnlen(uds_path, PATH_MAX) && 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); > + ETH_AF_XDP_USE_DP_UDS_PATH_ARG, > ETH_AF_XDP_PROG_ARG); > return -EINVAL; > } >=20 > @@ -2410,7 +2408,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, uds_path); > if (eth_dev =3D=3D NULL) { > AF_XDP_LOG(ERR, "Failed to init internals\n"); > return -1; > @@ -2471,4 +2469,4 @@ RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp, > "xdp_prog=3D " > "busy_budget=3D " > "force_copy=3D " > - "use_cni=3D "); > + "uds_path=3D "); > -- > 2.41.0