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 6FC4EA054D; Tue, 7 Jun 2022 15:18:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4AF504021D; Tue, 7 Jun 2022 15:18:42 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 1E1C540156 for ; Tue, 7 Jun 2022 15:18:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654607921; x=1686143921; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=dgYtBB7Sl2XK86YF+y7YiIUDwhPHAYSzcN0aMEan1bw=; b=P/38bjd6S7nCVF9cXbsdONH8ah4W17K4rnmKRc3btjKExKs8DP2JYPyk gnl4ogbKKXxc7CcIUMh5UyEfkk6pSgACiyMLVk0lhVx9w0mV5RIWXo312 2n4HTSlfKq+wdQChJ49+woqs/P+J8uOTpGiJq+Fy5qlYKmfQBUisovs1/ ADQP2k8Tf1m7KKfHfSJbq8RRrA9loB48VVgBa47RnRZt6MYWpiSwpVVS6 kIfhuMoEO8mTGetBvC/MduDCnUryJ1qAVk5yDIY0n6FngSCTH9QI4vKVY L+yaTze1SCX0MICefERPoUSaOxNUiyD9iQ7o5f1ykjgVXX9AW0emD/NRp w==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="274257123" X-IronPort-AV: E=Sophos;i="5.91,284,1647327600"; d="scan'208";a="274257123" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 06:18:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="565438247" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP; 07 Jun 2022 06:18:38 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2308.27; Tue, 7 Jun 2022 06:18:38 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 7 Jun 2022 06:18:37 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Tue, 7 Jun 2022 06:18:37 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) 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.2308.27; Tue, 7 Jun 2022 06:18:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HOpx5qUyARSbv9uCr7uyLzBOj+9QFqHgsy6xtC2SCGd/vNfa2nlDMwYkt0RpcvnnUiQ4e30+75E6URiwhSIDS+yIxCeXw8GctBbb+y5iCoDeucGLyliQlhsSSCrngbCpFOe0edGLE38se6O9vJY5JrMjEaIBY7fazAobL2JeVnW2v9DY0GcmhuIlpZMQFj76ipeteXmFX81WZItSS+HDG2tCRxg78veu8r+2/aNh9iQV+ADh+ybD9fISP8V1ZkHfczw8JIA1WnyCCikR6UQHmtae6UFXPD52EcdsSKocPMqBBTz3Xhpfud7YU9HLKVyVSl1PaSRrBJnDrPTC+doMAA== 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=yN3JCJDchAQWXXmYR/sa3sCDf2ri2vpWM5oCKi/xPHs=; b=BUJ/Ijvlu1YaKPFN7wn70Ojy4BE/ClPX5DV6ipF48tSMagSnnrN7Bcm+mdXmyT9w7ESobM2vpeQ2tdWm0pamLxGWErCnFzj+mo/AqaVMBEmeK2DanlTyS5q6mmEEkTkaup02TcFGCIiNDhbdgD3ggKK0PlqbuVNzTHqMQMR8WwOxpMJj0mpHY2QEAExX1TSVqZsW0IIC+LfqswNTPHWiWZ6VEA2FVPxz8nZUl6HToCfQKl0Vk3wndH0kF/N9kK8zhyCpL/je8mbWlKq40Loi7ekqkue0+j3lwHLmEjwmm4UVkoVuzzhH5n4erL5MdCSNXG2ScatRlBKxiHkfG4PGkQ== 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 DM6PR11MB4348.namprd11.prod.outlook.com (2603:10b6:5:1db::18) by IA1PR11MB6539.namprd11.prod.outlook.com (2603:10b6:208:3a1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Tue, 7 Jun 2022 13:18:35 +0000 Received: from DM6PR11MB4348.namprd11.prod.outlook.com ([fe80::d57f:4e1a:5ec7:118]) by DM6PR11MB4348.namprd11.prod.outlook.com ([fe80::d57f:4e1a:5ec7:118%7]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 13:18:35 +0000 From: "Jayatheerthan, Jay" To: "Kundapura, Ganapati" , "jerinjacobk@gmail.com" , "dev@dpdk.org" Subject: RE: [PATCH v3] eventdev: add adapter instance get API Thread-Topic: [PATCH v3] eventdev: add adapter instance get API Thread-Index: AQHYekeWdwAFJWwdUEOudHw5nI8ckq1D6Hzw Date: Tue, 7 Jun 2022 13:18:35 +0000 Message-ID: References: <20220607080730.3455482-1-ganapati.kundapura@intel.com> <20220607082115.3459593-1-ganapati.kundapura@intel.com> In-Reply-To: <20220607082115.3459593-1-ganapati.kundapura@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b2b60fd3-5797-43ff-e0aa-08da48883a25 x-ms-traffictypediagnostic: IA1PR11MB6539:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xz3KTHOtUVVQ9dlZVGCX8sYBSLqSyulJKBp+p33OOkxf/+bLZzCBZJBQxPY8NrBNyAhBBJ0fkIqBATTl9SMQMuMTAxusaYs44YLiGM9PHz5HuQFdjQqKg001MljzD5KodL9m9iJI5gG2gOKwHwqkWH+IC/Jfw9MKdYOBN/Ay2FgXKhyUmCYrIIPBC1D60zEdYGjjff/wXH3BUTeZ1rtl7q8WbXteOKp8sah8HaryIFb9VT6+usgbkZVXorhyl3bvPpgGatYSGA6FXolDdl6x/VO8kBxrnYs0eyZvAnAaWPajUgFSmlgIyWxT/jpBRaerXcI56Paws++9QqYIcnIUtZBuUVM431YIxwI7phz+9XZrkE71ggPMW7n1O1+mKye8oWnc4CzD9ZRZKFBDjaiR+Sfvg5VUaDq8y0TD6F3r3+0CefkLheTVgZwCoxh0ZlfXmPUgXkBTYTSmCZDkdpSdrgQUFHdOXyoZGsXYhn8tbI1im15CmHfvklw/Ue1qY5E8U0p5kkYb9ir65BQ/dQ08EJrrz5XZIbWPzBFPSB75IyeRAtD9mV0OL1Fd7nODAHY1iXYL0uGTbYS2VX79VnhpKDLViTbdDKQ6ZJejdgWF0DRmau0l/CGdoD9+blU5/JMmjZrB1as3S5e+SPnWOgjJPHcc4lwmCac2rdxhU/uv42BpQqpLtasTqjS31hSJF3Cu/noYJqpgv448LJ21iHFiMw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4348.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(82960400001)(8676002)(9686003)(86362001)(2906002)(186003)(64756008)(38100700002)(52536014)(5660300002)(122000001)(8936002)(38070700005)(53546011)(83380400001)(76116006)(26005)(66556008)(66476007)(66446008)(30864003)(66946007)(33656002)(110136005)(6506007)(55236004)(7696005)(55016003)(508600001)(71200400001)(316002)(559001)(579004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7M5yeSuDLsd0kHl1BNhKHmET6h9FhvMHY1vsFWU6LB0iPF8uU0Yz/F1KMdCi?= =?us-ascii?Q?ndYKZmqmx06lpT7ELXPHRbuCVDYCv4qQUdLKpyuhZ9C51GJpVUjtZW1Iaud2?= =?us-ascii?Q?IGl0z5NtHd77fAkNcTDxn9GAueJlsxlRhUIz211azd/aih1aJlcG14fpilvw?= =?us-ascii?Q?7a4GnDQy8e+JrVsJO8EHS+/iulQQ5uuIbsoI0tvrA1ZVpZirqnuOoCYMjHNj?= =?us-ascii?Q?Gsal/KK3MmI1wzpVhOHYOtVPdv6qBWRb71jGcW0LIzGK/1hkWDyKFIPZQk2t?= =?us-ascii?Q?//0stSLKcxebXIY2u9U2XIIT2sWc2kgrrbRaMK6nx2bS4jh8CcQ7S8kh92Vw?= =?us-ascii?Q?mEwyRtBPTqc4S3NXpRM9XUeVYkEYGdukgAKvhCMOtw77IWF4dxcu+JFEceMp?= =?us-ascii?Q?TxnDR/SlGb6rafaPhzTi0Pv3AswyOK/gzqg3lzk8FPNyVcESCkif7wJ+4kvE?= =?us-ascii?Q?LjsIqmoS7sh9aVDlpcjPaET8YO0cSycpGc6r8Xan+JJcXCjPmZI3ckAgmogG?= =?us-ascii?Q?jF8Ka9xGtNZaCLezmgFHRkD9x3YvI2ukTn7WhK8VP3UoWnFIdadDquUnwya+?= =?us-ascii?Q?qwJ/YBnNbLvuUiD0g7uLFNpemb/Ag4Qw8s7oevc+ysHlUyD+vyr7CBILhvDU?= =?us-ascii?Q?MD2+Rxug1nX4AscfBYdxjokm/9nfTKuwQ0KvaX43BK/OPzeri1wimfuRqiW0?= =?us-ascii?Q?dswfhEuJsrpHgs6+sTcvflOhN5dKlUThJ0BeV4deCWy/JQBvAg7AnvfGwjMs?= =?us-ascii?Q?ZYkGWvyVlJ9fZj1KxYJbpy6ILo8q/wNGbETV6u4zKYlTqWXJAcj8k27525Ku?= =?us-ascii?Q?UygSNLeFl299SzIRldrP++VWQL4BT5tnpV3RGwZn+vp42k6xjlZd5my3iTJq?= =?us-ascii?Q?EtIJbU2YL8IsTCrkCjN88PlKvsqtsyfwEF9+8J05LlQK8/UVShWVC1333Hhd?= =?us-ascii?Q?HgI6q7R/a4BxxCPt7UMXuKQm4jF1p3ZOwf9R7156sDdlSLZDOhSrbqxYUjBu?= =?us-ascii?Q?DDbXaQ+Alkya7+dgmqii8YuXQOOOJueVldBGwXIfdoe5hYJNYckhYicTV5M7?= =?us-ascii?Q?tLcCp3jb7cohn42BgHdi85VUzfUYFYsZ7cQOyqAu69/Pag+/L50zXR6vGvS4?= =?us-ascii?Q?+4DP7tM767trEYjOozvkQ4mojVvHLxuOaXEXoXTwZsPoH2SvTl+dqlnc/Rn/?= =?us-ascii?Q?LpW+k0bHmYLNpi9P7RFuzdjW+PdA5q6/xFjXOLnLrTbWEPNciypn6Kqwy/tr?= =?us-ascii?Q?Bd3/MOD6++zJLNWKC1Tzh+ci9mUVUJ5OFrL5sGPjSXybIjINWhNamiV3Ta1s?= =?us-ascii?Q?13Jjw7LQSni038TuWoIUuW+SOYQNVSndQjlqZe26LeX0hn1yEoTyggjOmgs1?= =?us-ascii?Q?wJQEJvuhwU5WfB2l2VbCWcvBP7+UZpc7l9Bg3SnP3tdFg/fd2hyR9aV8oPjp?= =?us-ascii?Q?xNImUM09ldHRsJosV4AfwE2Bru8oeSFDJR98fXb95qEDt9C/dpYa0eD5RrJe?= =?us-ascii?Q?UhsbT6eSiOK4+eB2dpZQir9oVzq+XpCzi/WHSWJupzWb/MQZyKCcIry9PEv9?= =?us-ascii?Q?+McS6lng9rkH0gcQBtG01WAMe5bZfd7kl1Y56Osm8HTnGdwDoNYka9mQMdDL?= =?us-ascii?Q?RFBWFzhbqObyjQNG5c1yJF4tAINimApQY3LYQJg5jOlBgX+NpyAlNIWZYMKZ?= =?us-ascii?Q?r6kyRr72jpjGYRy2J7wMkS3xEVFd0N0hvjPChFWoZ7bOR9nfDexKN195nWkZ?= =?us-ascii?Q?kQ+RwcNDGilEkwinrjKzpOAN/tBBOzg=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: DM6PR11MB4348.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2b60fd3-5797-43ff-e0aa-08da48883a25 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2022 13:18:35.4190 (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: /l+MIi1iMMPA6Xi6C34EZE3kFRge0McCx6p7tDkzqMbYG7g24vJgE5Yl3GTdo6iJrhK2B9VKKiQljI1gADq8Yia4IpV1IFJ9BwWtnbAZG64= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB6539 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 Ganapati, This patch could be split into multiple patches in a patchset to make it ea= sier to review. One way to split: 1. Rx adapter API 2. Telemetry changes for Rx adapter 3. Test changes for Rx adapter API 4. Tx adapter API 5. Telemetry changes for Tx adapter ? 6. Test changes for Tx adapter API 7. Document update. -Jay > -----Original Message----- > From: Kundapura, Ganapati > Sent: Tuesday, June 7, 2022 1:51 PM > To: jerinjacobk@gmail.com; dev@dpdk.org; Jayatheerthan, Jay > Subject: [PATCH v3] eventdev: add adapter instance get API >=20 > Added rte_event_eth_rx_adapter_instance_get() and > rte_event_eth_tx_adapter_instance_get() api's to get the > adapter instance id for a specified event port and > queue index. >=20 > Signed-off-by: Ganapati Kundapura > --- > v3: > * Fixed checkpatch error >=20 > v2: > * Fixed build issues > * Added telemetry support for rte_event_eth_rx_adapter_instance_get > * arranged functions in alphabetical order in version.map >=20 > diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_e= th_rx_adapter.c > index e358a70..878004b 100644 > --- a/app/test/test_event_eth_rx_adapter.c > +++ b/app/test/test_event_eth_rx_adapter.c > @@ -39,6 +39,7 @@ test_event_eth_rx_intr_adapter_common(void) > #define TEST_INST_ID 0 > #define TEST_DEV_ID 0 > #define TEST_ETHDEV_ID 0 > +#define TEST_ETH_QUEUE_ID 0 >=20 > struct event_eth_rx_adapter_test_params { > struct rte_mempool *mp; > @@ -1001,6 +1002,87 @@ adapter_queue_conf(void) > return TEST_SUCCESS; > } >=20 > +static int > +adapter_instance_get(void) > +{ > + int err; > + uint8_t inst_id; > + uint16_t eth_dev_id; > + struct rte_eth_dev_info dev_info; > + struct rte_event_eth_rx_adapter_queue_conf queue_conf =3D {0}; > + > + /* Case 1: Test without configuring eth */ > + err =3D rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Case 2: Test with wrong eth port */ > + eth_dev_id =3D rte_eth_dev_count_total() + 1; > + err =3D rte_event_eth_rx_adapter_instance_get(eth_dev_id, > + TEST_ETH_QUEUE_ID, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Case 3: Test with wrong rx queue */ > + err =3D rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, > + dev_info.max_rx_queues + 1, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Case 4: Test with right instance, port & rxq */ > + /* Add queue to Rx adapter */ > + queue_conf.ev.queue_id =3D TEST_ETH_QUEUE_ID; > + queue_conf.ev.sched_type =3D RTE_SCHED_TYPE_ATOMIC; > + queue_conf.ev.priority =3D RTE_EVENT_DEV_PRIORITY_NORMAL; > + > + err =3D rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID, > + &queue_conf); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID, > + &inst_id); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + /* Add another queue */ > + queue_conf.ev.queue_id =3D TEST_ETH_QUEUE_ID + 1; > + err =3D rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 1, > + &queue_conf); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 1, > + &inst_id); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + /* Case 5: Test with right instance, port & wrong rxq */ > + err =3D rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 2, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Delete queues from the Rx adapter */ > + err =3D rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 1); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + return TEST_SUCCESS; > +} > + > static struct unit_test_suite event_eth_rx_tests =3D { > .suite_name =3D "rx event eth adapter test suite", > .setup =3D testsuite_setup, > @@ -1019,6 +1101,8 @@ static struct unit_test_suite event_eth_rx_tests = =3D { > adapter_queue_event_buf_test), > TEST_CASE_ST(adapter_create_with_params, adapter_free, > adapter_queue_stats_test), > + TEST_CASE_ST(adapter_create, adapter_free, > + adapter_instance_get), > TEST_CASES_END() /**< NULL terminate unit test array */ > } > }; > diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_e= th_tx_adapter.c > index 2900532..ebbc622 100644 > --- a/app/test/test_event_eth_tx_adapter.c > +++ b/app/test/test_event_eth_tx_adapter.c > @@ -29,6 +29,7 @@ test_event_eth_tx_adapter_common(void) > #define MAX_NUM_QUEUE RTE_PMD_RING_MAX_RX_RINGS > #define TEST_INST_ID 0 > #define TEST_DEV_ID 0 > +#define TEST_ETH_QUEUE_ID 0 > #define SOCKET0 0 > #define RING_SIZE 256 > #define ETH_NAME_LEN 32 > @@ -639,6 +640,79 @@ tx_adapter_service(void) > } >=20 > static int > +tx_adapter_instance_get(void) > +{ > + int err; > + uint8_t inst_id; > + uint16_t eth_dev_id; > + struct rte_eth_dev_info dev_info; > + > + /* Case 1: Test without configuring eth */ > + err =3D rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Case 2: Test with wrong eth port */ > + eth_dev_id =3D rte_eth_dev_count_total() + 1; > + err =3D rte_event_eth_tx_adapter_instance_get(eth_dev_id, > + TEST_ETH_QUEUE_ID, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Case 3: Test with wrong tx queue */ > + err =3D rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, > + dev_info.max_tx_queues + 1, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Case 4: Test with right instance, port & rxq */ > + /* Add queue to tx adapter */ > + err =3D rte_event_eth_tx_adapter_queue_add(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID, > + &inst_id); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + /* Add another queue to tx adapter */ > + err =3D rte_event_eth_tx_adapter_queue_add(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 1); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 1, > + &inst_id); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + /* Case 5: Test with right instance, port & wrong rxq */ > + err =3D rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 2, > + &inst_id); > + TEST_ASSERT(err =3D=3D -EINVAL, "Expected -EINVAL got %d", err); > + > + /* Delete queues from the Tx adapter */ > + err =3D rte_event_eth_tx_adapter_queue_del(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + err =3D rte_event_eth_tx_adapter_queue_del(TEST_INST_ID, > + TEST_ETHDEV_ID, > + TEST_ETH_QUEUE_ID + 1); > + TEST_ASSERT(err =3D=3D 0, "Expected 0 got %d", err); > + > + return TEST_SUCCESS; > +} > + > +static int > tx_adapter_dynamic_device(void) > { > uint16_t port_id =3D rte_eth_dev_count_avail(); > @@ -695,6 +769,8 @@ static struct unit_test_suite event_eth_tx_tests =3D = { > tx_adapter_start_stop), > TEST_CASE_ST(tx_adapter_create, tx_adapter_free, > tx_adapter_service), > + TEST_CASE_ST(tx_adapter_create, tx_adapter_free, > + tx_adapter_instance_get), > TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device), > TEST_CASES_END() /**< NULL terminate unit test array */ > } > diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/gu= ides/prog_guide/event_ethernet_rx_adapter.rst > index 3b4ef50..a6d8987 100644 > --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst > +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst > @@ -177,6 +177,12 @@ used otherwise it returns -EINVAL. > The ``rte_event_eth_rx_adapter_queue_stats_reset`` function can be used = to > reset queue level stats when queue level event buffer is in use. >=20 > +Getting Adapter instance id > +~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +The ``rte_event_eth_rx_adapter_instance_get()`` function reports > +rx adapter instance id for a specified event port and rx queue index. > + > Interrupt Based Rx Queues > ~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/gu= ides/prog_guide/event_ethernet_tx_adapter.rst > index f80d226..b14131d 100644 > --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst > +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst > @@ -165,6 +165,12 @@ in struct ``rte_event_eth_tx_adapter_stats``. The co= unter values are the sum of > the counts from the eventdev PMD callback if the callback is supported, = and > the counts maintained by the service function, if one exists. >=20 > +Getting Adapter instance id > +~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +The ``rte_event_eth_tx_adapter_instanceget()`` function reports > +tx adapter instance id for a specified event port and tx queue index. > + > Tx event vectorization > ~~~~~~~~~~~~~~~~~~~~~~ >=20 > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_e= vent_eth_rx_adapter.c > index bf8741d..3095647 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > @@ -6,6 +6,7 @@ > #include > #endif > #include > +#include >=20 > #include > #include > @@ -42,7 +43,10 @@ > /* Sentinel value to detect initialized file handle */ > #define INIT_FD -1 >=20 > -#define RXA_ADAPTER_ARRAY "rte_event_eth_rx_adapter_array" > +#define RX_ADAPTER_DATA_ARRAY "rx_adapter_data_array" > +#define RX_ADAPTER_INSTANCE_ARRAY "rx_adapter_instance_array" > + > +#define INVALID_INSTANCE_ID UINT8_MAX >=20 > /* > * Used to store port and queue ID of interrupting Rx queue > @@ -251,7 +255,12 @@ struct eth_rx_queue_info { > struct rte_event_eth_rx_adapter_stats *stats; > }; >=20 > +struct event_eth_rxa_inst_info { > + uint8_t rxa_inst_id; > +}; > + > static struct event_eth_rx_adapter **event_eth_rx_adapter; > +static struct event_eth_rxa_inst_info **event_eth_rxa_inst_info; >=20 > /* Enable dynamic timestamp field in mbuf */ > static uint64_t event_eth_rx_timestamp_dynflag; > @@ -1415,15 +1424,13 @@ rxa_service_func(void *args) > return 0; > } >=20 > -static int > -rte_event_eth_rx_adapter_init(void) > +static void * > +rxa_memzone_array_get(const char *name, unsigned int elt_size, int nb_el= ems) > { > - const char *name =3D RXA_ADAPTER_ARRAY; > const struct rte_memzone *mz; > unsigned int sz; >=20 > - sz =3D sizeof(*event_eth_rx_adapter) * > - RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; > + sz =3D elt_size * nb_elems; > sz =3D RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); >=20 > mz =3D rte_memzone_lookup(name); > @@ -1431,13 +1438,46 @@ rte_event_eth_rx_adapter_init(void) > mz =3D rte_memzone_reserve_aligned(name, sz, rte_socket_id(), 0, > RTE_CACHE_LINE_SIZE); > if (mz =3D=3D NULL) { > - RTE_EDEV_LOG_ERR("failed to reserve memzone err =3D %" > - PRId32, rte_errno); > - return -rte_errno; > + RTE_EDEV_LOG_ERR("failed to reserve memzone" > + " name =3D %s, err =3D %" > + PRId32, name, rte_errno); > + return NULL; > } > } >=20 > - event_eth_rx_adapter =3D mz->addr; > + return mz->addr; > +} > + > +static int > +rte_event_eth_rx_adapter_init(void) > +{ > + uint8_t i; > + > + if (event_eth_rx_adapter =3D=3D NULL) { > + event_eth_rx_adapter =3D > + rxa_memzone_array_get(RX_ADAPTER_DATA_ARRAY, > + sizeof(*event_eth_rx_adapter), > + RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE); > + if (event_eth_rx_adapter =3D=3D NULL) > + return -ENOMEM; > + > + for (i =3D 0; i < RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; i++) > + event_eth_rx_adapter[i] =3D NULL; > + > + } > + > + if (event_eth_rxa_inst_info =3D=3D NULL) { > + event_eth_rxa_inst_info =3D > + rxa_memzone_array_get(RX_ADAPTER_INSTANCE_ARRAY, > + sizeof(*event_eth_rxa_inst_info), > + RTE_MAX_ETHPORTS); > + if (event_eth_rxa_inst_info =3D=3D NULL) > + return -ENOMEM; > + > + for (i =3D 0; i < RTE_MAX_ETHPORTS; i++) > + event_eth_rxa_inst_info[i] =3D NULL; > + } > + > return 0; > } >=20 > @@ -1447,12 +1487,21 @@ rxa_memzone_lookup(void) > const struct rte_memzone *mz; >=20 > if (event_eth_rx_adapter =3D=3D NULL) { > - mz =3D rte_memzone_lookup(RXA_ADAPTER_ARRAY); > + mz =3D rte_memzone_lookup(RX_ADAPTER_DATA_ARRAY); > if (mz =3D=3D NULL) > return -ENOMEM; > + > event_eth_rx_adapter =3D mz->addr; > } >=20 > + if (event_eth_rxa_inst_info =3D=3D NULL) { > + mz =3D rte_memzone_lookup(RX_ADAPTER_INSTANCE_ARRAY); > + if (mz =3D=3D NULL) > + return -ENOMEM; > + > + event_eth_rxa_inst_info =3D mz->addr; > + } > + > return 0; > } >=20 > @@ -1950,6 +1999,7 @@ rxa_sw_del(struct event_eth_rx_adapter *rx_adapter, > int pollq; > int intrq; > int sintrq; > + uint16_t eth_dev_id =3D dev_info->dev->data->port_id; >=20 >=20 > if (rx_adapter->nb_queues =3D=3D 0) > @@ -1993,6 +2043,11 @@ rxa_sw_del(struct event_eth_rx_adapter *rx_adapter= , > dev_info->rx_queue[rx_queue_id].event_buf =3D NULL; > dev_info->rx_queue[rx_queue_id].stats =3D NULL; > } > + > + /* unset rxa_inst_id for rx_queue_id */ > + if (event_eth_rxa_inst_info[eth_dev_id]) > + event_eth_rxa_inst_info[eth_dev_id][rx_queue_id].rxa_inst_id =3D > + INVALID_INSTANCE_ID; > } >=20 > static int > @@ -2085,6 +2140,33 @@ rxa_add_queue(struct event_eth_rx_adapter *rx_adap= ter, > } > } >=20 > + /* Allocate storage to store rxa_inst_id for rxq */ > + if (event_eth_rxa_inst_info[eth_dev_id] =3D=3D NULL) { > + uint16_t n, i; > + struct event_eth_rxa_inst_info *i_info; > + > + n =3D rte_eth_devices[eth_dev_id].data->nb_rx_queues; > + > + i_info =3D rte_zmalloc_socket("event_eth_rxa_inst_info", > + n * sizeof(struct event_eth_rxa_inst_info), > + 0, > + rx_adapter->socket_id); > + if (i_info =3D=3D NULL) { > + RTE_EDEV_LOG_ERR("Failed to allocate storage for " > + "event_eth_rxa_inst_info"); > + return -ENOMEM; > + } > + > + for (i =3D 0; i < n; i++) > + i_info[i].rxa_inst_id =3D INVALID_INSTANCE_ID; > + > + event_eth_rxa_inst_info[eth_dev_id] =3D i_info; > + } > + > + /* store rxa id for rx_queue_id in event_eth_rxa_inst_info */ > + event_eth_rxa_inst_info[eth_dev_id][rx_queue_id].rxa_inst_id =3D > + rx_adapter->id; > + > if (!rx_adapter->use_queue_event_buf) > return 0; >=20 > @@ -2523,6 +2605,10 @@ int > rte_event_eth_rx_adapter_free(uint8_t id) > { > struct event_eth_rx_adapter *rx_adapter; > + uint16_t eth_dev_id; > + > + if (rxa_memzone_lookup()) > + return -ENOMEM; >=20 > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); >=20 > @@ -2544,6 +2630,13 @@ rte_event_eth_rx_adapter_free(uint8_t id) > rte_free(rx_adapter); > event_eth_rx_adapter[id] =3D NULL; >=20 > + for (eth_dev_id =3D 0; eth_dev_id < RTE_MAX_ETHPORTS; eth_dev_id++) { > + if (event_eth_rxa_inst_info[eth_dev_id]) { > + rte_free(event_eth_rxa_inst_info[eth_dev_id]); > + event_eth_rxa_inst_info[eth_dev_id] =3D NULL; > + } > + } > + > rte_eventdev_trace_eth_rx_adapter_free(id); > return 0; > } > @@ -2561,6 +2654,9 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id, > struct eth_device_info *dev_info; > struct rte_event_eth_rx_adapter_vector_limits limits; >=20 > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); >=20 > @@ -2726,6 +2822,9 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint= 16_t eth_dev_id, > uint32_t *rx_wrr =3D NULL; > int num_intr_vec; >=20 > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); > RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); >=20 > @@ -2832,6 +2931,7 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint= 16_t eth_dev_id, >=20 > rte_eventdev_trace_eth_rx_adapter_queue_del(id, eth_dev_id, > rx_queue_id, ret); > + > return ret; > } >=20 > @@ -3286,6 +3386,49 @@ rte_event_eth_rx_adapter_queue_conf_get(uint8_t id= , > return 0; > } >=20 > +int > +rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id, > + uint16_t rx_queue_id, > + uint8_t *rxa_inst_id) > +{ > + uint8_t inst_id; > + > + if (rxa_memzone_lookup()) > + return -ENOMEM; > + > + if (eth_dev_id >=3D rte_eth_dev_count_avail()) { > + RTE_EDEV_LOG_ERR("Invalid ethernet port id %u", eth_dev_id); > + return -EINVAL; > + } > + > + if (rx_queue_id >=3D rte_eth_devices[eth_dev_id].data->nb_rx_queues) { > + RTE_EDEV_LOG_ERR("Invalid Rx queue %u", rx_queue_id); > + return -EINVAL; > + } > + > + if (rxa_inst_id =3D=3D NULL) { > + RTE_EDEV_LOG_ERR("rxa_inst_id cannot be NULL"); > + return -EINVAL; > + } > + > + if (event_eth_rxa_inst_info[eth_dev_id] =3D=3D NULL) { > + RTE_EDEV_LOG_ERR("No valid rxa instance for eth_dev_id %u", > + eth_dev_id); > + return -EINVAL; > + } > + > + inst_id =3D event_eth_rxa_inst_info[eth_dev_id][rx_queue_id].rxa_inst_i= d; > + if (inst_id =3D=3D INVALID_INSTANCE_ID) { > + RTE_EDEV_LOG_ERR("Invalid rxa instance for eth_dev_id %u, " > + "rx_queue_id %u", eth_dev_id, rx_queue_id); > + return -EINVAL; > + } > + > + *rxa_inst_id =3D inst_id; > + > + return 0; > +} > + > #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s) >=20 > static int > @@ -3554,6 +3697,68 @@ handle_rxa_queue_stats_reset(const char *cmd __rte= _unused, > return ret; > } >=20 > +static int > +handle_rxa_instance_get(const char *cmd __rte_unused, > + const char *params, > + struct rte_tel_data *d) > +{ > + uint8_t instance_id; > + uint16_t rx_queue_id; > + int eth_dev_id, ret =3D -1; > + char *token, *l_params; > + > + if (params =3D=3D NULL || strlen(params) =3D=3D 0 || !isdigit(*params)) > + return -1; > + > + l_params =3D strdup(params); > + if (l_params =3D=3D NULL) > + return -ENOMEM; > + token =3D strtok(l_params, ","); > + RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); > + > + /* Get device ID from parameter string */ > + eth_dev_id =3D strtoul(token, NULL, 10); > + RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); > + > + token =3D strtok(NULL, ","); > + RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); > + > + /* Get Rx queue ID from parameter string */ > + rx_queue_id =3D strtoul(token, NULL, 10); > + if (rx_queue_id >=3D rte_eth_devices[eth_dev_id].data->nb_rx_queues) { > + RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", rx_queue_id); > + ret =3D -EINVAL; > + goto error; > + } > + > + token =3D strtok(NULL, "\0"); > + if (token !=3D NULL) > + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" > + " telemetry command, ignoring"); > + > + /* Parsing parameter finished */ > + free(l_params); > + > + if (rte_event_eth_rx_adapter_instance_get(eth_dev_id, > + rx_queue_id, > + &instance_id)) { > + RTE_EDEV_LOG_ERR("Failed to get RX adapter instance ID " > + " for rx_queue_id =3D %d", rx_queue_id); > + return -1; > + } > + > + rte_tel_data_start_dict(d); > + rte_tel_data_add_dict_u64(d, "eth_dev_id", eth_dev_id); > + rte_tel_data_add_dict_u64(d, "rx_queue_id", rx_queue_id); > + rte_tel_data_add_dict_u64(d, "rxa_instance_id", instance_id); > + > + return 0; > + > +error: > + free(l_params); > + return ret; > +} > + > RTE_INIT(rxa_init_telemetry) > { > rte_telemetry_register_cmd("/eventdev/rxa_stats", > @@ -3575,4 +3780,8 @@ RTE_INIT(rxa_init_telemetry) > rte_telemetry_register_cmd("/eventdev/rxa_queue_stats_reset", > handle_rxa_queue_stats_reset, > "Reset Rx queue stats. Parameter: rxa_id, dev_id, queue_id"); > + > + rte_telemetry_register_cmd("/eventdev/rxa_rxq_instance_get", > + handle_rxa_instance_get, > + "Returns Rx adapter instance id. Parameter: dev_id, queue_id"); > } > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_e= vent_eth_rx_adapter.h > index 3608a7b..f56938d 100644 > --- a/lib/eventdev/rte_event_eth_rx_adapter.h > +++ b/lib/eventdev/rte_event_eth_rx_adapter.h > @@ -38,6 +38,7 @@ > * - rte_event_eth_rx_adapter_queue_stats_get() > * - rte_event_eth_rx_adapter_queue_stats_reset() > * - rte_event_eth_rx_adapter_event_port_get() > + * - rte_event_eth_rx_adapter_instance_get() > * > * The application creates an ethernet to event adapter using > * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_cre= ate() > @@ -704,6 +705,28 @@ __rte_experimental > int > rte_event_eth_rx_adapter_event_port_get(uint8_t id, uint8_t *event_port_= id); >=20 > +/** > + * Get RX adapter instance ID for a RX queue > + * > + * @param eth_dev_id > + * Port identifier of Ethernet device. > + * > + * @param rx_queue_id > + * Ethernet device receive queue index > + * > + * @param[out] rxa_inst_id > + * RX adapter instance identifier. > + * > + * @return > + * - 0: Success > + * - <0: Error code on failure > + */ > +__rte_experimental > +int > +rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id, > + uint16_t rx_queue_id, > + uint8_t *rxa_inst_id); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_e= vent_eth_tx_adapter.c > index 1b304f0..1c9f9fc 100644 > --- a/lib/eventdev/rte_event_eth_tx_adapter.c > +++ b/lib/eventdev/rte_event_eth_tx_adapter.c > @@ -1,6 +1,8 @@ > /* SPDX-License-Identifier: BSD-3-Clause > * Copyright(c) 2018 Intel Corporation. > */ > +#include > + > #include > #include > #include > @@ -17,6 +19,11 @@ > #define TXA_MAX_NB_TX 128 > #define TXA_INVALID_DEV_ID INT32_C(-1) > #define TXA_INVALID_SERVICE_ID INT64_C(-1) > +#define INVALID_INSTANCE_ID UINT8_MAX > + > +#define TXA_ADAPTER_ARRAY "txa_adapter_array" > +#define TXA_SERVICE_DATA_ARRAY "txa_service_data_array" > +#define TXA_ADAPTER_INSTANCE_ARRAY "txa_adapter_instance_array" >=20 > #define txa_evdev(id) (&rte_eventdevs[txa_dev_id_array[(id)]]) >=20 > @@ -140,6 +147,10 @@ struct txa_service_ethdev { > void *queues; > }; >=20 > +struct event_eth_txa_inst_info { > + uint8_t txa_inst_id; > +}; > + > /* Array of adapter instances, initialized with event device id > * when adapter is created > */ > @@ -148,6 +159,9 @@ static int *txa_dev_id_array; > /* Array of pointers to service implementation data */ > static struct txa_service_data **txa_service_data_array; >=20 > +/* array of adapter instances to store tx queue specific instance */ > +static struct event_eth_txa_inst_info **event_eth_txa_inst_info; > + > static int32_t txa_service_func(void *args); > static int txa_service_adapter_create_ext(uint8_t id, > struct rte_eventdev *dev, > @@ -194,12 +208,42 @@ txa_memzone_array_get(const char *name, unsigned in= t elt_size, int nb_elems) > } >=20 > static int > +txa_memzone_lookup(void) > +{ > + const struct rte_memzone *mz; > + > + if (txa_dev_id_array =3D=3D NULL) { > + mz =3D rte_memzone_lookup(TXA_ADAPTER_ARRAY); > + if (mz =3D=3D NULL) > + return -ENOMEM; > + txa_dev_id_array =3D mz->addr; > + } > + > + if (txa_service_data_array =3D=3D NULL) { > + mz =3D rte_memzone_lookup(TXA_SERVICE_DATA_ARRAY); > + if (mz =3D=3D NULL) > + return -ENOMEM; > + txa_service_data_array =3D mz->addr; > + } > + > + if (event_eth_txa_inst_info =3D=3D NULL) { > + mz =3D rte_memzone_lookup(TXA_ADAPTER_INSTANCE_ARRAY); > + if (mz =3D=3D NULL) > + return -ENOMEM; > + event_eth_txa_inst_info =3D mz->addr; > + } > + > + return 0; > +} > + > + > +static int > txa_dev_id_array_init(void) > { > if (txa_dev_id_array =3D=3D NULL) { > int i; >=20 > - txa_dev_id_array =3D txa_memzone_array_get("txa_adapter_array", > + txa_dev_id_array =3D txa_memzone_array_get(TXA_ADAPTER_ARRAY, > sizeof(int), > RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE); > if (txa_dev_id_array =3D=3D NULL) > @@ -221,15 +265,30 @@ txa_init(void) > static int > txa_service_data_init(void) > { > + uint8_t i; > + > if (txa_service_data_array =3D=3D NULL) { > txa_service_data_array =3D > - txa_memzone_array_get("txa_service_data_array", > + txa_memzone_array_get(TXA_SERVICE_DATA_ARRAY, > sizeof(int), > RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE); > if (txa_service_data_array =3D=3D NULL) > return -ENOMEM; > } >=20 > + if (event_eth_txa_inst_info =3D=3D NULL) { > + event_eth_txa_inst_info =3D > + txa_memzone_array_get(TXA_ADAPTER_INSTANCE_ARRAY, > + sizeof(*event_eth_txa_inst_info), > + RTE_MAX_ETHPORTS); > + if (event_eth_txa_inst_info =3D=3D NULL) > + return -ENOMEM; > + } > + > + /* Reset the txa instance pointers */ > + for (i =3D 0; i < RTE_MAX_ETHPORTS; i++) > + event_eth_txa_inst_info[i] =3D NULL; > + > return 0; > } >=20 > @@ -763,6 +822,7 @@ txa_service_queue_add(uint8_t id, > struct rte_eth_dev_tx_buffer *tb; > struct txa_retry *txa_retry; > int ret =3D 0; > + uint16_t eth_dev_id =3D eth_dev->data->port_id; >=20 > txa =3D txa_service_id_to_data(id); >=20 > @@ -836,6 +896,31 @@ txa_service_queue_add(uint8_t id, > tdi->nb_queues++; > txa->nb_queues++; >=20 > + /* Allocate storage to store txa_inst_id for txq */ > + if (event_eth_txa_inst_info[eth_dev_id] =3D=3D NULL) { > + uint16_t n, i; > + struct event_eth_txa_inst_info *i_info; > + > + n =3D eth_dev->data->nb_tx_queues; > + > + i_info =3D rte_zmalloc_socket("event_eth_txa_inst_info", > + n * sizeof(event_eth_txa_inst_info), > + 0, > + txa->socket_id); > + if (i_info =3D=3D NULL) { > + RTE_EDEV_LOG_ERR("Failed to allocate storage for " > + "event_eth_txa_inst_info"); > + goto err_unlock; > + } > + > + for (i =3D 0; i < n; i++) > + i_info[i].txa_inst_id =3D INVALID_INSTANCE_ID; > + > + event_eth_txa_inst_info[eth_dev_id] =3D i_info; > + } > + > + event_eth_txa_inst_info[eth_dev_id][tx_queue_id].txa_inst_id =3D id; > + > ret_unlock: > rte_spinlock_unlock(&txa->tx_lock); > return 0; > @@ -902,6 +987,12 @@ txa_service_queue_del(uint8_t id, > txa->nb_queues--; > txa->txa_ethdev[port_id].nb_queues--; >=20 > + /* unset txa_inst_id for tx_queue_id */ > + if (event_eth_txa_inst_info[port_id]) > + event_eth_txa_inst_info[port_id][tx_queue_id].txa_inst_id =3D > + INVALID_INSTANCE_ID; > + > + > txa_service_queue_array_free(txa, port_id); > return 0; > } > @@ -1056,6 +1147,10 @@ int > rte_event_eth_tx_adapter_free(uint8_t id) > { > int ret; > + uint16_t eth_dev_id; > + > + if (txa_memzone_lookup()) > + return -ENOMEM; >=20 > TXA_CHECK_OR_ERR_RET(id); >=20 > @@ -1067,6 +1162,13 @@ rte_event_eth_tx_adapter_free(uint8_t id) > ret =3D txa_service_adapter_free(id); > txa_dev_id_array[id] =3D TXA_INVALID_DEV_ID; >=20 > + for (eth_dev_id =3D 0; eth_dev_id < RTE_MAX_ETHPORTS; eth_dev_id++) { > + if (event_eth_txa_inst_info[eth_dev_id]) { > + rte_free(event_eth_txa_inst_info[eth_dev_id]); > + event_eth_txa_inst_info[eth_dev_id] =3D NULL; > + } > + } > + > rte_eventdev_trace_eth_tx_adapter_free(id, ret); > return ret; > } > @@ -1080,6 +1182,9 @@ rte_event_eth_tx_adapter_queue_add(uint8_t id, > int ret; > uint32_t caps; >=20 > + if (txa_memzone_lookup()) > + return -ENOMEM; > + > RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); > TXA_CHECK_OR_ERR_RET(id); >=20 > @@ -1113,6 +1218,9 @@ rte_event_eth_tx_adapter_queue_del(uint8_t id, > int ret; > uint32_t caps; >=20 > + if (txa_memzone_lookup()) > + return -ENOMEM; > + > RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); > TXA_CHECK_OR_ERR_RET(id); >=20 > @@ -1218,3 +1326,46 @@ rte_event_eth_tx_adapter_stop(uint8_t id) > rte_eventdev_trace_eth_tx_adapter_stop(id, ret); > return ret; > } > + > +int > +rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id, > + uint16_t tx_queue_id, > + uint8_t *txa_inst_id) > +{ > + uint8_t inst_id; > + > + if (txa_memzone_lookup()) > + return -ENOMEM; > + > + if (eth_dev_id >=3D rte_eth_dev_count_avail()) { > + RTE_EDEV_LOG_ERR("Invalid ethernet port id %u", eth_dev_id); > + return -EINVAL; > + } > + > + if (tx_queue_id >=3D rte_eth_devices[eth_dev_id].data->nb_tx_queues) { > + RTE_EDEV_LOG_ERR("Invalid tx queue id %u", tx_queue_id); > + return -EINVAL; > + } > + > + if (txa_inst_id =3D=3D NULL) { > + RTE_EDEV_LOG_ERR("txa_instance_id cannot be NULL"); > + return -EINVAL; > + } > + > + if (event_eth_txa_inst_info[eth_dev_id] =3D=3D NULL) { > + RTE_EDEV_LOG_ERR("No valid txa instance for eth_dev_id %d", > + eth_dev_id); > + return -EINVAL; > + } > + > + inst_id =3D event_eth_txa_inst_info[eth_dev_id][tx_queue_id].txa_inst_i= d; > + if (inst_id =3D=3D INVALID_INSTANCE_ID) { > + RTE_EDEV_LOG_ERR("Invalid txa instance for eth_dev_id %u, " > + "tx_queue_id %u", eth_dev_id, tx_queue_id); > + return -EINVAL; > + } > + > + *txa_inst_id =3D inst_id; > + > + return 0; > +} > diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_e= vent_eth_tx_adapter.h > index 3908c2d..28f4fa9 100644 > --- a/lib/eventdev/rte_event_eth_tx_adapter.h > +++ b/lib/eventdev/rte_event_eth_tx_adapter.h > @@ -34,6 +34,7 @@ > * - rte_event_eth_tx_adapter_enqueue() > * - rte_event_eth_tx_adapter_event_port_get() > * - rte_event_eth_tx_adapter_service_id_get() > + * - rte_event_eth_tx_adapter_instance_get() > * > * The application creates the adapter using > * rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_= ext(). > @@ -423,6 +424,24 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id); > int > rte_event_eth_tx_adapter_service_id_get(uint8_t id, uint32_t *service_id= ); >=20 > +/** > + * Get TX adapter instance id for TX queue > + * > + * @param eth_dev_id > + * Port identifier of Ethernet device > + * > + * @param tx_queue_id > + * Etherdev device TX queue index > + * > + * @param[out] txa_inst_id > + * Pointer to TX adapter instance identifier > + */ > +__rte_experimental > +int > +rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id, > + uint16_t tx_queue_id, > + uint8_t *txa_inst_id); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map > index 886e2ec..1c99d52 100644 > --- a/lib/eventdev/version.map > +++ b/lib/eventdev/version.map > @@ -102,9 +102,11 @@ EXPERIMENTAL { >=20 > # added in 21.11 > rte_event_eth_rx_adapter_create_with_params; > + rte_event_eth_rx_adapter_instance_get; > rte_event_eth_rx_adapter_queue_conf_get; > rte_event_eth_rx_adapter_queue_stats_get; > rte_event_eth_rx_adapter_queue_stats_reset; > + rte_event_eth_tx_adapter_instance_get; >=20 > # added in 22.03 > rte_event_eth_rx_adapter_event_port_get; > -- > 2.6.4