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 494E0A034F; Sun, 3 Oct 2021 23:05:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F6764127C; Sun, 3 Oct 2021 23:05:23 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 84A4741275 for ; Sun, 3 Oct 2021 23:05:21 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10126"; a="225547132" X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="225547132" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2021 14:05:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="621199973" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga001.fm.intel.com with ESMTP; 03 Oct 2021 14:05:20 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 3 Oct 2021 14:05:20 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) 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.2242.12; Sun, 3 Oct 2021 14:05:20 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sun, 3 Oct 2021 14:05:20 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) 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.2242.12; Sun, 3 Oct 2021 14:05:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LSRiEvof6pv8xxEhQ11RkTgL7QOsb671fT85a+DTNQT/lEzLEng9EfedL9wMfy7GST2FrFiNn3D/Hk8Yvd4cScXG4Bfzr8CgJ6pYxF2Yy/QIzmF8mcBJKyObO4bi661K4ZCtioTcXM3x8q6p5wAAHwPRl5GIHxbSyEQAw6XL3uWR2SR3hfCojI07e4Wo9t+++AE9P6tQ/3HuH2BUsDyNJx973cXrqX5JW+l/Xi27J/P2wzY9DRVVI3fKES1T7Rgc/W1gGXvZ33W26bYL+Wp0x6CWbOHE1zF6bDpYn0hHGWj1PYEKJAeu9EN+RoyH/HGhzN9kvim8GPD5a0+7cCJP2A== 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=prpOgWuiFgvTzKGcI+q+Z8shdegFUnX0aY+HnBndr0Q=; b=Q1sYMiJNA8Wpqm8Tj/lTI6JLxJ/FiTpWgTey5/WZEZOWf1bccX4SSda+5jWHYQwNt2hdCosdq+aJOY5d1vi2FtAH+pv4AYdBvvR1FXKu8nIF1AL4ofMfehQJ3deAn3evLq+4vrz5yDN0CXU3WQxTafqMASLB4D0MNAuxraak688LdrlT+wUj6Usv8aFYavWwIkX68A/u5EnVYqinys+4dmGJyjiAEqKLNxhY9abfa1eP9vt2V8Bx1HA6g+GqlE2rtDz/ily7wcZbUXGGgQQGibNIjSGFHr9dU3+3FM2vXewRciGj3Di25/8sjw4S4t/pAPc6Oq9zLsY+036xQak2vQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=prpOgWuiFgvTzKGcI+q+Z8shdegFUnX0aY+HnBndr0Q=; b=X1MaH9eJUL6mpchN1O6+r/3L4AteMcYNQxIeHl2s7VMAlkLJ/SY5JNKMCQHVmw7POuHaP3hJqKOyU0iGY61JiEPsNgpgzB83nVJ/qzbd/Wu2FW9kbDhG3x5+Cco2qn6ovdYS2V3J0TlKi1hdk42ymOnO51QjZKNEX6fwOfpGzvo= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM5PR1101MB2251.namprd11.prod.outlook.com (2603:10b6:4:53::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Sun, 3 Oct 2021 21:05:15 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::740e:126e:c785:c8fd%4]) with mapi id 15.20.4566.022; Sun, 3 Oct 2021 21:05:15 +0000 From: "Ananyev, Konstantin" To: Pavan Nikhilesh Bhagavatula , "dev@dpdk.org" CC: "Li, Xiaoyun" , Anoob Joseph , Jerin Jacob Kollanukkaran , Nithin Kumar Dabilpuram , Ankur Dwivedi , "shepard.siegel@atomicrules.com" , "ed.czeck@atomicrules.com" , "john.miller@atomicrules.com" , Igor Russkikh , "ajit.khaparde@broadcom.com" , "somnath.kotur@broadcom.com" , "rahul.lakkireddy@chelsio.com" , "hemant.agrawal@nxp.com" , "sachin.saxena@oss.nxp.com" , "Wang, Haiyue" , "Daley, John" , "hyonkim@cisco.com" , "Zhang, Qi Z" , "Wang, Xiao W" , "humin29@huawei.com" , "yisen.zhuang@huawei.com" , "oulijun@huawei.com" , "Xing, Beilei" , "Wu, Jingjing" , "Yang, Qiming" , "matan@nvidia.com" , "viacheslavo@nvidia.com" , "sthemmin@microsoft.com" , "longli@microsoft.com" , "heinrich.kuhn@corigine.com" , Kiran Kumar Kokkilagadda , "andrew.rybchenko@oktetlabs.ru" , "Maciej Czekaj [C]" , "jiawenwu@trustnetic.com" , "jianwang@trustnetic.com" , "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "thomas@monjalon.net" , "Yigit, Ferruh" , "mdr@ashroe.eu" , "Jayatheerthan, Jay" Thread-Topic: [dpdk-dev] [PATCH v3 1/7] ethdev: allocate max space for internal queue array Thread-Index: Ade3IEFiI1H6sBPBRvyPrY+0CYjkgQBeS6tw Date: Sun, 3 Oct 2021 21:05:15 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, 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.200.16 authentication-results: marvell.com; dkim=none (message not signed) header.d=none;marvell.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2c58ecca-bc5e-4d57-b96c-08d986b17f8d x-ms-traffictypediagnostic: DM5PR1101MB2251: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EpwmYOfI+Mn44VZgPI+mDNfdfhr/Euks/Q8QoPrqomqZvcWXhA7Ir3D/uIRzXnzDizFmuGhpzGfa6t+jizUGp04yIj5a5LowMg89WegGxUSJaUY+6PNfcITABasgxOuSOLWKJj9mI4POCBATT3MFDlok63iq4Npn8Oskl4xmOHe7GnmstjDoNGkvQuR7zieK3NtVQo/E1p47yWyZFpZCDzR+y7TJKmLzDvoEiaPkvUVAC2bg/lCh6HPmGPF8pILDg3mFUte//KJx9v3rFPnpzd74z5NJ4WMZWDcbiOvP7MwXpgVnSz2KRSKYxf0Dsqj+gQ88DtqOUoIXrsXxBsNT8KdcD/QjmZEQ+qyeC3sMOe2EbeB70FxGqO76dhPu52Bava7kALEfK8xsi1BAqL14gLvW9trwlg5qLWhujpvTLQ9swtM3v5yyo9dWFxxvYCe8g3w2H5z/z6fh996iHeXNSW61xt7o4f8624YR65mYHHrc1X4bhTDXyF+OltHwvAHvhsTsrwqVjD6qQA4jysOc8ewYh25L0jUUOCYXmufzbtpQbQ+KnVJQqyEKIDTvGvWwnLRuZSutnidIe0NZTtq5LRfEIC26kQc1KVfVga9UT3D6in32V0nL8EvYy6+SPDmpQmwrW0vhCfx0OTrD7wwrTpNrXeVEGUeM2RTlrO1wG6qXxhefFJ0M1OJ1+/CeZcWmY3XJu3XeYBDOFV292Ba4fA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66556008)(26005)(64756008)(7696005)(186003)(83380400001)(55236004)(6506007)(66476007)(66946007)(76116006)(508600001)(33656002)(66446008)(4326008)(38100700002)(110136005)(54906003)(52536014)(86362001)(107886003)(5660300002)(55016002)(71200400001)(8936002)(38070700005)(8676002)(316002)(122000001)(7416002)(7406005)(9686003)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?E2ioW77Y4eKIPkz0WflzFkxJ1e0A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e8YIvnYUsqTTq2MB5VEyQtkVjpH1ewsUOWDnej0s4WwRe20jMW?= =?us-ascii?Q?zq2FP5Hhh6ncU0NBdIRtNjFpeDx1S8DqFzWZzflz9Yo050TBA1rdiKMNta+x?= =?us-ascii?Q?UCSia8KnpLxEYv9T3W5WGHpW5hYnlEBVKTPL3Llt7CIK4To1kIOBUy1LoZpp?= =?us-ascii?Q?JTn9TqaaNdXcxrXXjxizw5GZKtBz/i9yeqYZ5p9AFfCEJq7WS6Cj0sjcaIY5?= =?us-ascii?Q?BgKW/uWWgGcKO+eXKHwkPb5EJA78sKNNALJms9uUDlYSIkSd3jKLPnn6uG6w?= =?us-ascii?Q?lQpZElTtZo2dt3fo2cTvXoUOYZvnGYafXxZiD27rqN+UlGKRo/IKhc7qobn4?= =?us-ascii?Q?2NdnLUI/imE8NtiC5Atd5CXpqxITIZX/RXZ9YAX2vG2rtxoCbcO3nMX1aRza?= =?us-ascii?Q?JtwwdO0daMI2mSbjZa1fW8Nw?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c58ecca-bc5e-4d57-b96c-08d986b17f8d X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2021 21:05:15.5284 (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: xRNXqlwH1RTTTI+DzwW/SrjiEjSRMuYWTKb9h2k3YsU/khkLgw29KAwMs2rgjKzE1RQ8/0LSp/cnWAXA9LJFKevpoDo2Eik35RI66YnMHP8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1101MB2251 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 1/7] ethdev: allocate max space for internal queue array 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 Sender: "dev" >=20 > >At queue configure stage always allocate space for maximum possible > >number (RTE_MAX_QUEUES_PER_PORT) of queue pointers. > >That will allow 'fast' inline functions (eth_rx_burst, etc.) to refer > >pointer to internal queue data without extra checking of current > >number > >of configured queues. > >That would help in future to hide rte_eth_dev and related structures. > > > >Signed-off-by: Konstantin Ananyev > >--- > > lib/ethdev/rte_ethdev.c | 36 +++++++++--------------------------- > > 1 file changed, 9 insertions(+), 27 deletions(-) > > > >diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > >index daf5ca9242..424bc260fa 100644 > >--- a/lib/ethdev/rte_ethdev.c > >+++ b/lib/ethdev/rte_ethdev.c > >@@ -898,7 +898,8 @@ eth_dev_rx_queue_config(struct rte_eth_dev > >*dev, uint16_t nb_queues) > > > > if (dev->data->rx_queues =3D=3D NULL && nb_queues !=3D 0) { /* > >first time configuration */ > > dev->data->rx_queues =3D rte_zmalloc("ethdev- > >>rx_queues", > >- sizeof(dev->data->rx_queues[0]) * > >nb_queues, > >+ sizeof(dev->data->rx_queues[0]) * > >+ RTE_MAX_QUEUES_PER_PORT, > > RTE_CACHE_LINE_SIZE); > > if (dev->data->rx_queues =3D=3D NULL) { > > dev->data->nb_rx_queues =3D 0; >=20 > We could get rid of this zmalloc by declaring rx_queues as array of > pointers, it would make code much simpler. > I believe the original code dates back to "Initial" release. Yep we can, and yes it will simplify this peace of code. The main reason I decided no to do this change now - it will change layout of the_eth_dev_data structure. In this series I tried to mininize(/avoid) changes in rte_eth_dev and rte_e= th_dev_data, as much as possible to avoid any unforeseen performance and functional impa= cts. If we'll manage to make rte_eth_dev and rte_eth_dev_data private we can in = future consider that one and other changes in rte_eth_dev and rte_eth_dev_data lay= outs without worrying about ABI breakage. =20 >=20 >=20 > >@@ -909,21 +910,11 @@ eth_dev_rx_queue_config(struct > >rte_eth_dev *dev, uint16_t nb_queues) > > > > rxq =3D dev->data->rx_queues; > > > >- for (i =3D nb_queues; i < old_nb_queues; i++) > >+ for (i =3D nb_queues; i < old_nb_queues; i++) { > > (*dev->dev_ops->rx_queue_release)(rxq[i]); > >- rxq =3D rte_realloc(rxq, sizeof(rxq[0]) * nb_queues, > >- RTE_CACHE_LINE_SIZE); > >- if (rxq =3D=3D NULL) > >- return -(ENOMEM); > >- if (nb_queues > old_nb_queues) { > >- uint16_t new_qs =3D nb_queues - > >old_nb_queues; > >- > >- memset(rxq + old_nb_queues, 0, > >- sizeof(rxq[0]) * new_qs); > >+ rxq[i] =3D NULL; > > } > > > >- dev->data->rx_queues =3D rxq; > >- > > } else if (dev->data->rx_queues !=3D NULL && nb_queues =3D=3D 0) { > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >>rx_queue_release, -ENOTSUP); > > > >@@ -1138,8 +1129,9 @@ eth_dev_tx_queue_config(struct > >rte_eth_dev *dev, uint16_t nb_queues) > > > > if (dev->data->tx_queues =3D=3D NULL && nb_queues !=3D 0) { /* > >first time configuration */ > > dev->data->tx_queues =3D rte_zmalloc("ethdev- > >>tx_queues", > >- sizeof(dev->data- > >>tx_queues[0]) * nb_queues, > >- > >RTE_CACHE_LINE_SIZE); > >+ sizeof(dev->data->tx_queues[0]) * > >+ RTE_MAX_QUEUES_PER_PORT, > >+ RTE_CACHE_LINE_SIZE); > > if (dev->data->tx_queues =3D=3D NULL) { > > dev->data->nb_tx_queues =3D 0; > > return -(ENOMEM); > >@@ -1149,21 +1141,11 @@ eth_dev_tx_queue_config(struct > >rte_eth_dev *dev, uint16_t nb_queues) > > > > txq =3D dev->data->tx_queues; > > > >- for (i =3D nb_queues; i < old_nb_queues; i++) > >+ for (i =3D nb_queues; i < old_nb_queues; i++) { > > (*dev->dev_ops->tx_queue_release)(txq[i]); > >- txq =3D rte_realloc(txq, sizeof(txq[0]) * nb_queues, > >- RTE_CACHE_LINE_SIZE); > >- if (txq =3D=3D NULL) > >- return -ENOMEM; > >- if (nb_queues > old_nb_queues) { > >- uint16_t new_qs =3D nb_queues - > >old_nb_queues; > >- > >- memset(txq + old_nb_queues, 0, > >- sizeof(txq[0]) * new_qs); > >+ txq[i] =3D NULL; > > } > > > >- dev->data->tx_queues =3D txq; > >- > > } else if (dev->data->tx_queues !=3D NULL && nb_queues =3D=3D 0) { > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops- > >>tx_queue_release, -ENOTSUP); > > > >-- > >2.26.3