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 3BD5B43411; Thu, 30 Nov 2023 14:56:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 266EB42E8B; Thu, 30 Nov 2023 14:56:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D9BD1402F0 for ; Thu, 30 Nov 2023 14:56:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701352611; x=1732888611; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=nHaE7a/+xcViv9M9zAtnQnp70DvQ7ToDlVVKSr3Dkpw=; b=e6qPRb2GCpdVIhAkueun+E9wwwH0ZQEiQuRxWvB04j3CpKZVAJ7jxNtM KjwfzICItOfvWvDqZWg8ozcCHM0CKStWxaMuXmdmemjxxuUemmaCNUWNj vrgqn7j2cKENJaQlKCYohxeRY1EfPAPjOH1mn/2rtCYZmpgfv166BoxSI QjHZqTTJcjhhZ9thB2S/mqVAgl8v69ZkH+dI3yz9fvOGHyEg9adPjQEOc 8s5Jww8Od8I67I5whtefqvhHwF8+RSyfaHtk0wZUT9p9Z5QWsPb7B7eUt EVjU0mgWetu2F94b1aqTaEdnrsF1n/iZLxkVEY2NW/Kel6oWw4pJLiWLi A==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="378354906" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="378354906" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 05:56:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="719130257" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="719130257" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 30 Nov 2023 05:56:49 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 30 Nov 2023 05:56:49 -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.34 via Frontend Transport; Thu, 30 Nov 2023 05:56:48 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) 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.34; Thu, 30 Nov 2023 05:56:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DXjzfzYg7/bdKknop6TX/hT4hiBWvvjyZHAxTsqkUz+489HExbMP/TmS/Ru9/AskqvBHdk9NjSFDrf8/SFXqsgebsYAuX692TA+0FjpP3fXfMzZ/yyYYaTgj+2J2AIy9hIjZj9kJOZLEZmyEy6mxtsuFg1TnpZF8cWXmgwJLKEZDEndxzxMs2Syb30wypUQI2FeomZxjjk+fz4/2gLs1QDVUdr4kZjA4jpguOUHo+8dJ5SUhnZ8yxMHze0N/j5/H5BdfFEkFAJWYh5dAw8LA+mZY9Ns8pAWsVpRee1DlqSTlbocOOkvUcrffspT5O70Xn1IUCZYysUKhNB6h9R+ydA== 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=EthDEWn3dR7DpVeu07EyDw0KQQ9c5dbfKeRABJeh5YI=; b=N6dfwR0xX9/9uxSC3FVV/RHMYxWPEMu8yB9Nb3+jw4n2djmI0OMcEckFOF9O6yKUEyqKcYo+uXQ9YZKYbG2XRNDIAOHeaN5yXgo2z5XmwbCBG4kQZ6ksKQuumRBpt1O8Nd74ldMt573Yhtl6qCyqhVvYrKaa8OXBNZ8n2LZdSB1moshK4A/ahqlNbTXZ+R2ssiUKGBrUlrh99384PiJXW8tiKcHtU1Fdx4kUAt5rtSroo/sTHf+PnfZ0OJoSjwDdcR8rsrH/RkcW31EBpHaoZedmhu/NFfymQJmCgsDCSgBLCG9KOp9R67fmgluyqRDuJ4cOTtMfx5++Kk0sB1TJ4g== 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 DM6PR11MB3995.namprd11.prod.outlook.com (2603:10b6:5:6::12) by DS0PR11MB6349.namprd11.prod.outlook.com (2603:10b6:8:ce::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.23; Thu, 30 Nov 2023 13:56:46 +0000 Received: from DM6PR11MB3995.namprd11.prod.outlook.com ([fe80::7c33:4ba9:947f:d875]) by DM6PR11MB3995.namprd11.prod.outlook.com ([fe80::7c33:4ba9:947f:d875%4]) with mapi id 15.20.7046.024; Thu, 30 Nov 2023 13:56:46 +0000 From: "Koikkara Reeny, Shibin" To: "Koikkara Reeny, Shibin" , "Tahhan, Maryam" , "ferruh.yigit@amd.com" , "stephen@networkplumber.org" , "lihuisong@huawei.com" , "fengchengwen@huawei.com" , "liuyonglong@huawei.com" CC: "dev@dpdk.org" , "Tahhan, Maryam" Subject: RE: [v1] net/af_xdp: enable a sock path alongside use_cni Thread-Topic: [v1] net/af_xdp: enable a sock path alongside use_cni Thread-Index: AQHaI22UiKYic4MAX06499Pb1NlPqbCSwTWQgAAhxFA= Date: Thu, 30 Nov 2023 13:56:46 +0000 Message-ID: References: <20231130091332.2315572-1-mtahhan@redhat.com> In-Reply-To: Accept-Language: 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: DM6PR11MB3995:EE_|DS0PR11MB6349:EE_ x-ms-office365-filtering-correlation-id: 13d8a92a-004b-4ea6-75df-08dbf1ac3104 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: FtcK81u6PBv51Uur7TG88bBLHGToSrazOPPLwMXFyhfJWeMS1nKVpUZ6zpQOdTijpu2gEnGeFBfh73p5EJmhZv8UABF0CJtZz0N5/Lpvw7SBICKTVvzLlJXLb73xqCOYI0aCAtv09Bv9KBo+v16mOf62n3m30bvzzos/5JqWLDRAP54FxxyNgrbiA85U9WV3t+1cmwgpgXPd3SzbWPLzbsIlTb21wfk8Xd9nZwiURP6kcLbnsWlyjD20+XJm695hYBnI3V4k22SRm8q/uc1chAyiM8pgXLc0f6hsjBHV/0jWEItPyFisjw9xEP7e6QcLOAfmIRtlJVdwOOUgunh+vlygxzR4wHVSEE3/6r75Io+nbie8TXrYLn1GO3XVOR6PIEgYJ0qyl3N4OGZFzmzykvhddaHs/J/LUyun3k4reTvKld51X0cAuRTcTyM5aWtlQcKSlCSGTnheCg2zexVt+tr+WOchhdCQJ+rjSv6Oyy5JZ5bdfnKP/Jr3iZTC7yG4lq0z7G0JbMA1M2tVFDcAJh/tQLU0nkEF7IqPcyL8RZhJLZtQf0ZnG7j1xPrBKUm0jE9Gz0CdEmTwJQRMnbsevwon6DmrNOC3AE51m2ONkRM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3995.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(136003)(366004)(346002)(376002)(396003)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(4326008)(38070700009)(38100700002)(30864003)(86362001)(26005)(66946007)(64756008)(76116006)(110136005)(54906003)(66476007)(66556008)(66446008)(316002)(2906002)(83380400001)(7696005)(53546011)(71200400001)(55016003)(9686003)(6506007)(8936002)(8676002)(52536014)(82960400001)(33656002)(41300700001)(478600001)(2940100002)(122000001)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?eezErYSwlm+DJrU6H9IDkMeEcN06+tMkAm+3kercV20lJV1l8A/GD6a+IYs4?= =?us-ascii?Q?AGcJKXHNxtulFdSs/WUi+C1Qak3Axta14KQob1cJSZG9l+efXMunc+59ZTeh?= =?us-ascii?Q?PGdgMTb4H472xeB+JSQlK86QQTaqWw8iL+Vs1zpgbyDIz8cUrN5dvRiKhgK6?= =?us-ascii?Q?JuVDSXBKx7v8HUY76B6DJ+CTVLLA8L7TnFwmNGg8BsCGnFUoTjxQS4kxuxAR?= =?us-ascii?Q?iPQL/tt7z3273Mrhawuuf3T0Dj0m1Tyl2a+L6/e9RhcgRwODxSDTRwerv0FO?= =?us-ascii?Q?ThjQU4XOqr9sLRGzYkmYk4X2gIuadHytogQ/bQb6wTG4JjYOV9gEsD5jVIuO?= =?us-ascii?Q?tgXKTDksm50UHv7BqrCfgWcH3SuxKRzFxO74KyoZU9HkpwEUjqS2GtCV9qyL?= =?us-ascii?Q?3NsGMkXkzVAI9qYpA2l7ppBhEeNb2PNcMA89oJAiGlmy910bbTHX/foD9I0f?= =?us-ascii?Q?mGvAJXxv6g8ozLCWHCKt7kN/nxCEheWCOtNbkOISdib2Kfg+ew7/hPSNHjy9?= =?us-ascii?Q?CUQ7w1nPew4vv/fai7HH4TIzAR+zKPLfjsmIl217wBLpHqgk18vyCld/q9+o?= =?us-ascii?Q?hF4u0taa0zUzJnOXpybvWx6L5tOCgOqxPLdb0i01ayyRDggwajk+kf0bm1Rf?= =?us-ascii?Q?veI1eURIdnbwpfBQrt5ZtJc0Fdomyz1foMu4QxhbZX/KaH1SYl1NJJY1odEo?= =?us-ascii?Q?Kpn0KdSibUGEIqt5wIzbBIBjl0yJ6XhrvosUTiEEG7gfAd5hPZExNAs9km3S?= =?us-ascii?Q?Mm++D2Meg1hr5pdYRxGjeUbkuI89WvKfyUtRHgRAZOGrH/T6/Mpg+tIrJK8+?= =?us-ascii?Q?JCXssfaXviuq/qtjMo3qqs4TcxzYrhT4E4YkcccJXkAIDQPIS+MLZyRxnUj9?= =?us-ascii?Q?OBKKwxh7hvdGoovLeClxHRJ6o9pb5ciutN7CytTpGvviWIW0t6Nio91Fg4Na?= =?us-ascii?Q?OIG6/hzwks2G96qpkPPlNPzeROXtgl6fJ9J5d7gJU2XPywNLzr+spGwTWvkZ?= =?us-ascii?Q?nsEJAtUIivgiWDY7Pc45UC00QGjVu2374kWZTHPxrzYoJ68RfYHLOg0QQYuv?= =?us-ascii?Q?+9zEg7EGra4fKKEOTe2FrkUJRmfWGjYlv2QCtr3TVYsRePvNvsT8bx0awdQ8?= =?us-ascii?Q?rjDHDIxKgF9+H0jgSiK/l/5tQ02dLKlPvFXxfHbCIQBOkM8UJj3wvT83eyUZ?= =?us-ascii?Q?PFL8SSUw/LV1HodgkUH+Ngl47U76/XD26qM6fch+oEuUpF1MvCtrRR2nHonJ?= =?us-ascii?Q?JJjwDzlP1fu2jq6I+2WELDKBVHnv0c6YE2raEgH/HLxD3L7NMbTQESZxeQJB?= =?us-ascii?Q?J4j73yP/tbHW/j3CXp/4NoIJX51gSYd5O99NcVogfmghI6xNGIehvMLD2oh/?= =?us-ascii?Q?e1VgG7PuSOmKNib2ZL+mWeCSNOq6d4UNJU4z51lCSm/U8PITf9GdcwnhIjeN?= =?us-ascii?Q?TDGb8yQ+mp797sCNYQL0K78Fu9af4Ap6GfFKANH3Nz75rhGFs0pZWMb9k7Nx?= =?us-ascii?Q?ChCSlo2ptLGapS6pFVGUL4peL/5eTmuWrK3eWA3mo2YknIaUQdQPPyzMHyij?= =?us-ascii?Q?FHhtQ8rf1F4rsTXgmqDDLh+ZYJBFfIAJqsMW+Ne2fq0cYYH0v2fONm63ecgU?= =?us-ascii?Q?3A=3D=3D?= 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: DM6PR11MB3995.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13d8a92a-004b-4ea6-75df-08dbf1ac3104 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2023 13:56:46.1580 (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: zYWhJtitG1sLFpvJljsoifFgg6yCQewST3cuAAlRL+h0Wf+GWDAaCzhGzI5d5gZJqmQmKeRS2nVIQvuy5mYIlcps2Fdix7GiBj2VsCSkSOw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6349 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 Hi Maryam, I have one more question. Regards, Shibin > -----Original Message----- > From: Koikkara Reeny, Shibin > Sent: Thursday, November 30, 2023 12:14 PM > To: Tahhan, Maryam ; ferruh.yigit@amd.com; > stephen@networkplumber.org; lihuisong@huawei.com; > fengchengwen@huawei.com; liuyonglong@huawei.com > Cc: dev@dpdk.org; Tahhan, Maryam > Subject: RE: [v1] net/af_xdp: enable a sock path alongside use_cni >=20 > Hi Maryam, >=20 > I have added some suggestion below. >=20 > Regrads, > Shibin >=20 > > -----Original Message----- > > From: Maryam Tahhan > > Sent: Thursday, November 30, 2023 9:14 AM > > To: ferruh.yigit@amd.com; stephen@networkplumber.org; > > lihuisong@huawei.com; fengchengwen@huawei.com; > liuyonglong@huawei.com > > Cc: dev@dpdk.org; Tahhan, Maryam > > Subject: [v1] net/af_xdp: enable a sock path alongside use_cni > > > > With the original 'use_cni' implementation, (using a hardcoded socket > > rather than a configurable one), if a single 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 alongside the 'use_cni' param. > > Tested with the AF_XDP DP CNI PR 81. > > > > Signed-off-by: Maryam Tahhan > > --- > > doc/guides/howto/af_xdp_cni.rst | 18 +++++++--- > > drivers/net/af_xdp/rte_eth_af_xdp.c | 56 > > +++++++++++++++++++---------- > > 2 files changed, 51 insertions(+), 23 deletions(-) > > > > diff --git a/doc/guides/howto/af_xdp_cni.rst > > b/doc/guides/howto/af_xdp_cni.rst index a1a6d5b99c..a2d90c665d 100644 > > --- a/doc/guides/howto/af_xdp_cni.rst > > +++ b/doc/guides/howto/af_xdp_cni.rst > > @@ -38,9 +38,10 @@ 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 > > wishes > > +The EAL vdev arguments ``use_cni`` and ``sock`` are used to indicate > > +that the user wishes > > 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 @@ -49,7 +50,7 @@ Instead the loading is > > handled by the CNI. > > > > .. note:: > > > > - The Unix Domain Socket file path appear in the end user is > > "/tmp/afxdp.sock". > > + The Unix Domain Socket file path appears to the end user at > > "/tmp/afxdp_dp//afxdp.sock". > > > > > > Prerequisites > > @@ -224,7 +225,6 @@ Howto run dpdk-testpmd with CNI plugin: > > capabilities: > > add: > > - CAP_NET_RAW > > - - CAP_BPF Why the CAP_BPF is removed? > > resources: > > requests: > > hugepages-2Mi: 2Gi > > @@ -245,7 +245,17 @@ Howto run dpdk-testpmd with CNI plugin: > > > > kubectl exec -i --container -- \ > > //dpdk-testpmd -l 0,1 --no-pci \ > > - --vdev=3Dnet_af_xdp0,use_cni=3D1,iface=3D \ > > + --vdev=3Dnet_af_xdp0,use_cni=3D1,iface=3D > name>,sock=3D/tmp/afxdp_dp//afxdp.sock \ > > + -- --no-mlockall --in-memory > > + > > +for multiple devices use: > > + > > + .. code-block:: console > > + > > + kubectl exec -i --container -- \ > > + //dpdk-testpmd -l 0-2 --no-pci \ > > + --vdev=3Dnet_af_xdp0,use_cni=3D1,iface=3D > name>,sock=3D/tmp/afxdp_dp//afxdp.sock \ > > + --vdev=3Dnet_af_xdp1,use_cni=3D1,iface=3D > + name>,sock=3D/tmp/afxdp_dp//afxdp.sock \ > > -- --no-mlockall --in-memory > > > > For further reference please use the `e2e`_ test case in `AF_XDP > > Plugin for Kubernetes`_ diff --git > > a/drivers/net/af_xdp/rte_eth_af_xdp.c > > b/drivers/net/af_xdp/rte_eth_af_xdp.c > > index 353c8688ec..f728dae2f9 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" > > @@ -171,6 +170,7 @@ struct pmd_internals { > > bool custom_prog_configured; > > bool force_copy; > > bool use_cni; > > + char sock_path[PATH_MAX]; > I would recommend using variable name as "uds_path". >=20 > > struct bpf_map *map; > > > > struct rte_ether_addr eth_addr; > > @@ -191,6 +191,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_SOCK_ARG "sock" > To make it clear would recommend using "sock_path" and also > ETH_AF_XDP_CNI_UDS_PATH_ARG or ETH_AF_XDP_SOCK_PATH_ARG. >=20 > > > > static const char * const valid_arguments[] =3D { > > ETH_AF_XDP_IFACE_ARG, > > @@ -201,6 +202,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_SOCK_ARG, > > NULL > > }; > > > > @@ -1351,7 +1353,7 @@ configure_preferred_busy_poll(struct > > pkt_rx_queue *rxq) } > > > > static int > > -init_uds_sock(struct sockaddr_un *server) > > +init_uds_sock(struct sockaddr_un *server, const char *sock_path) > > { > > int sock; > > > > @@ -1362,7 +1364,7 @@ init_uds_sock(struct sockaddr_un *server) > > } > > > > server->sun_family =3D AF_UNIX; > > - strlcpy(server->sun_path, UDS_SOCK, sizeof(server->sun_path)); > > + strlcpy(server->sun_path, sock_path, sizeof(server->sun_path)); > > > > if (connect(sock, (struct sockaddr *)server, sizeof(struct > > sockaddr_un)) < 0) { > > close(sock); > > @@ -1382,7 +1384,7 @@ struct msg_internal { }; > > > > static int > > -send_msg(int sock, char *request, int *fd) > > +send_msg(int sock, char *request, int *fd, const char *sock_path) > > { > > int snd; > > struct iovec iov; > > @@ -1393,7 +1395,7 @@ send_msg(int sock, char *request, int *fd) > > > > 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, sock_path, sizeof(dst.sun_path)); > > > > /* Initialize message header structure */ > > memset(&msgh, 0, sizeof(msgh)); > > @@ -1471,7 +1473,7 @@ read_msg(int sock, char *response, struct > > sockaddr_un *s, int *fd) > > > > static int > > make_request_cni(int sock, struct sockaddr_un *server, char *request, > > - int *req_fd, char *response, int *out_fd) > > + int *req_fd, char *response, int *out_fd, const char > > *sock_path) > > { > > int rval; > > > > @@ -1483,7 +1485,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, sock_path); > > > > if (rval < 0) { > > AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno)); @@ > > -1507,7 +1509,7 @@ check_response(char *response, char *exp_resp, > long > > size) } > > > > static int > > -get_cni_fd(char *if_name) > > +get_cni_fd(char *if_name, const char *sock_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 +1522,14 @@ > get_cni_fd(char > > *if_name) > > return -1; > > > > memset(&server, 0, sizeof(server)); > > - sock =3D init_uds_sock(&server); > > + sock =3D init_uds_sock(&server, sock_path); > > if (sock < 0) > > return -1; > > > > /* Initiates handshake to CNI 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_cni(sock, &server, request, NULL, response, > > &out_fd, > > +sock_path) < 0) { > Why do we need to pass "sock_path" here as we have already connected > the sock with sock_path in init_uds_sock()? >=20 > > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", > request); > > goto err_close; > > } > > @@ -1541,7 +1543,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_cni(sock, &server, request, NULL, response, > > &out_fd, > > +sock_path) < 0) { > Same question as above. >=20 > > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", > request); > > goto err_close; > > } > > @@ -1549,7 +1551,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_cni(sock, &server, request, NULL, response, > > &out_fd, > > +sock_path) < 0) { >=20 > Same question as above. >=20 > > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", > request); > > goto err_close; > > } > > @@ -1571,7 +1573,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_cni(sock, &server, request, NULL, response, > > &out_fd, > > +sock_path) < 0) { >=20 > Same question as above. >=20 > > AF_XDP_LOG(ERR, "Error in processing cmd [%s]\n", > request); > > goto err_close; > > } > > @@ -1698,7 +1700,7 @@ xsk_configure(struct pmd_internals *internals, > > struct pkt_rx_queue *rxq, > > int err, fd, map_fd; > > > > /* get socket fd from CNI plugin */ > > - map_fd =3D get_cni_fd(internals->if_name); > > + map_fd =3D get_cni_fd(internals->if_name, internals- > > >sock_path); > > if (map_fd < 0) { > > AF_XDP_LOG(ERR, "Failed to receive CNI plugin > fd\n"); > > goto out_xsk; > > @@ -2023,7 +2025,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_queue, > > 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 *sock_path) > > { > > int ret; > > > > @@ -2069,6 +2072,11 @@ parse_parameters(struct rte_kvargs *kvlist, > > char *if_name, int *start_queue, > > if (ret < 0) > > goto free_kvlist; > > > > + ret =3D rte_kvargs_process(kvlist, ETH_AF_XDP_SOCK_ARG, > > + &parse_prog_arg, sock_path); >=20 > Parse_prog_arg does 2 things copy the sock_arg value and also check the > access to the socket. > Checking access here has a chance of causing raise condition so I would > recommend to skip this check here as this will be taken care in the > init_uds_sock(). >=20 > > + if (ret < 0) > > + goto free_kvlist; > > + > > free_kvlist: > > rte_kvargs_free(kvlist); > > return ret; > > @@ -2108,7 +2116,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 *sock_path) > > { > > const char *name =3D rte_vdev_device_name(dev); > > const unsigned int numa_node =3D dev->device.numa_node; @@ - > > 2138,6 +2146,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->sock_path, sock_path, PATH_MAX); > > > > if (xdp_get_channels_info(if_name, &internals->max_queue_cnt, > > &internals->combined_queue_cnt)) { @@ - > > 2328,6 +2337,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 sock_path[PATH_MAX] =3D {'\0'}; > > struct rte_eth_dev *eth_dev =3D NULL; > > const char *name =3D rte_vdev_device_name(dev); > > > > @@ -2370,7 +2380,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > > *dev) > > > > 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, > > sock_path) < 0) { > > AF_XDP_LOG(ERR, "Invalid kvargs value\n"); > > return -EINVAL; > > } > > @@ -2387,6 +2397,13 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > > *dev) > > return -EINVAL; > > } > > > > + if (use_cni && !strnlen(sock_path, PATH_MAX)) { > > + AF_XDP_LOG(ERR, "When '%s' parameter is used, '%s' must > > also be provided\n", > > + ETH_AF_XDP_USE_CNI_ARG, > > ETH_AF_XDP_SOCK_ARG); > > + return -EINVAL; > > + } > > + > > + > > if (strlen(if_name) =3D=3D 0) { > > AF_XDP_LOG(ERR, "Network interface must be > specified\n"); > > return -EINVAL; > > @@ -2410,7 +2427,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device > > *dev) > > > > 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, > > sock_path); > > if (eth_dev =3D=3D NULL) { > > AF_XDP_LOG(ERR, "Failed to init internals\n"); > > return -1; > > @@ -2471,4 +2488,5 @@ > > RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp, > > "xdp_prog=3D " > > "busy_budget=3D " > > "force_copy=3D " > > - "use_cni=3D "); > > + "use_cni=3D " > > + "sock=3D "); > > -- > > 2.41.0