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 C4E43A0032; Sat, 2 Oct 2021 02:02:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 460EC4067B; Sat, 2 Oct 2021 02:02:34 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 009C840042 for ; Sat, 2 Oct 2021 02:02:31 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 191Dss3B032259; Fri, 1 Oct 2021 17:02:09 -0700 Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2047.outbound.protection.outlook.com [104.47.74.47]) by mx0a-0016f401.pphosted.com with ESMTP id 3be3mmt0t6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Oct 2021 17:02:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erdMEfjnSxn7z2K0DWfM007rn5e7V+FDb/BN/Y37AWizJbqiibyjKOeBEMZUkBrOc2Wx2tmM+LyvxMGCTfMtBDefpo/jiDX3+fHYq5jbLMwX9cdkEwww5ovZMpOAfII3bjrUyDlam8vps6aaW0VsoaeF1uEC/qBXIW9hhIoHEabZ9/bDkVJS1AA4QBLpj90YTzKGzDbcbA1Q6gIRyZ1UPXci/UqLyCPP89xT5G3Y1l8u/yucDAzNQRAnDla66Rfuh7Nsqr4yVQTm8X6UOW9jBRxeJUFcKt9E9PsIOP9dqlYP/izf7bHdeLWiDTedlpdG/HUrQocsrX2UoZZtM39veA== 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=MQyKkSVzv6xNpiCKd6Vne/oH56RrnRHS3ou5YS1IrY8=; b=jGW7EV3jUA28gwxT22ycB5XD3kXu+aqBKig7RUwivKgMl/goLJUgAsJRTM1xmjn5hviO/OwA47sw5Q5RG9P5FIuermEDcxGW+s2WlE5gzp4Xx+EWFsjRjFLc+uhPQhT40+tdVyHpBUaF30zEEbMnLjoVZSY9jBFUST3NcRlY8NHXj3BtFcG0rZJYXFyXysuuwwed1P5MJ5A2+XR0IGtI+RQjEae24NRNtVA08Bt+s0FKH9vxMFi3qYdqm7EQ6g9NRa+Ghlztuf0Y3ojnmBdIIcarNdY3MnIws1+4KaYMiuiLd+0vGIpBvQSnYY7w0QYc7K8+WzDwFV64ExugnbXFaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MQyKkSVzv6xNpiCKd6Vne/oH56RrnRHS3ou5YS1IrY8=; b=dH1jwd5FJC7rFCLorOZUn62wyKZFNQxZbf3/CU7oaVdMyWmaFrhQZHhR0Znm/3g4QRBOe6NHOlJ5a5vy6CGLxQ/ylS6X6FU8D3h8s4XlBsjK/0gNz973UzV2aoNAbqfbeViqu3+O5AuY2BQ2PHoYwhYayQIxu3xBOeVTtR9chjQ= Received: from PH0PR18MB4086.namprd18.prod.outlook.com (2603:10b6:510:3::9) by PH0PR18MB3990.namprd18.prod.outlook.com (2603:10b6:510:28::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Sat, 2 Oct 2021 00:02:05 +0000 Received: from PH0PR18MB4086.namprd18.prod.outlook.com ([fe80::94d1:2b0c:115f:5a75]) by PH0PR18MB4086.namprd18.prod.outlook.com ([fe80::94d1:2b0c:115f:5a75%7]) with mapi id 15.20.4566.019; Sat, 2 Oct 2021 00:02:05 +0000 From: Pavan Nikhilesh Bhagavatula To: Konstantin Ananyev , "dev@dpdk.org" CC: "xiaoyun.li@intel.com" , 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" , "haiyue.wang@intel.com" , "johndale@cisco.com" , "hyonkim@cisco.com" , "qi.z.zhang@intel.com" , "xiao.w.wang@intel.com" , "humin29@huawei.com" , "yisen.zhuang@huawei.com" , "oulijun@huawei.com" , "beilei.xing@intel.com" , "jingjing.wu@intel.com" , "qiming.yang@intel.com" , "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" , "chenbo.xia@intel.com" , "thomas@monjalon.net" , "ferruh.yigit@intel.com" , "mdr@ashroe.eu" , "jay.jayatheerthan@intel.com" Thread-Topic: [dpdk-dev] [PATCH v3 1/7] ethdev: allocate max space for internal queue array Thread-Index: Ade3IEFiI1H6sBPBRvyPrY+0CYjkgQ== Date: Sat, 2 Oct 2021 00:02:04 +0000 Message-ID: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e61d3a8d-4e63-405f-c7f8-08d98537de98 x-ms-traffictypediagnostic: PH0PR18MB3990: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dD0ugPAbxHZkeQnIyuhALsb02QBUIoov0tp3XJsBRvvZOyTcT1Jht6gP3lQDAgyaQGC+IfMtQ4gVLVIVRvfbIgSl7MJRYw0ZAWy4PNu/UJRwkekpAwE9jIzb8ANrFNZYOaCmm8S6NG9VAjnfQ6A8Q1MhqKGbcD7xMx2AwrYIuJMjRGzI8AbtIMmdwng765He6maxELQmiNydAFM4CXZSzlxPtzg4wSpnXQUw49K8zjOcjKqoa8s9vmxw+V9p2xdoO9/A30gEzZhTRT/Y6EnnZlrLhfgUAuQFX+Dh/iM31zp9Bo41bYX3SXlBJYJ6nynrMoH6+F/FHrwc/In/9NKx//oJjbHi6ZZq40j13lJ3WdtDpzlx4BgzENwml4CEyKwXTBLftveX7N4Hng0J6HnztNB3PTv1e1tmayIRv6etbTor/XxPrgPdy8CvO31GSuEIosRi+OV84aWjN6ZcrwMXZE+e08v1ZtOKlEbFZV6hJPX59nN+cO4ipvKwt0GYg6lE4GZaefpL+mwb6QHa24Aps3IJ5H4XmMzkCdzQrpEe112o8o0ElQFnpdkvzbFGJKQ0rAheguQH2rFfbGU4T2oUODzmeFsQqz5wVK089zotZa86iEPB165t+pDlGZYUkEUpKt/NxAWt8gDvurN40axPJxg7hQXVlymnI7I4oFvK1rnhfCSnHf2Rdd+em0w6LfpNPKCwwqsOqwvZiiPrinzM8A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR18MB4086.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(33656002)(9686003)(86362001)(55016002)(83380400001)(110136005)(316002)(2906002)(54906003)(6506007)(26005)(8936002)(76116006)(38070700005)(7696005)(38100700002)(7406005)(122000001)(71200400001)(66946007)(7416002)(8676002)(52536014)(64756008)(4326008)(508600001)(5660300002)(66446008)(66556008)(66476007); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AGynmgYF2kBNzmxi33dj6xlgUGGbZxzOsqmdHOB5pp7+3up/Qx9YMLjcCu7z?= =?us-ascii?Q?/1mTeOO08a1Jug/J8olpIf4n2FRy6juDy6Ku5Di+SkYYfcd/vnLflE8J7OaE?= =?us-ascii?Q?52HoI+qkzM+9ouKhdh+1PW6LsnBRCaBzswgFy/pP+cmx7UjvKKcY7odiLqpl?= =?us-ascii?Q?PFzRXBj9PtOLmukpZcoZ7z3DIUNZ9gXgYfDVxToQkfw70gHT73IE6Rdovzdy?= =?us-ascii?Q?ISjtA521a2KKWbjWMu/Zcrkc43bmj2eafSnIZKdBi3LVFM3ZKN7qlGaxQMEX?= =?us-ascii?Q?P61cXXaXwfcfE2dJIBozAiOMaSBMR7f0pau6YKQ6JPenOBie9WURJjOgjG5u?= =?us-ascii?Q?x9aqimFeUiIUOZBbkN1bA491qCD7cF/74eZs7SigLzT24Of13fT2N4hqvshm?= =?us-ascii?Q?6iLILENIZyylp6m5BGfwtDIdXrKih1hK5pn8KSvyF027mF5Q3RJryqUzy4aG?= =?us-ascii?Q?dgZwqYp0/kRP1+FWQ33SDYrStLmIpUP767OAs4w9PqACBH+3guTOOJyDQOMY?= =?us-ascii?Q?GgN+VaHAwy29miGtqBWB5Sn2hQQzbr3KFmLk8y/qJjMI/+k+T2r1yVwE0Jrj?= =?us-ascii?Q?5HEShU6i60XrO2U6SWRbpxO7+TRKiJrhNzVdJoLObGjBZXtClmMNMH3AmOWa?= =?us-ascii?Q?cjboGIZWrwdhmS+rOnCAp6kZ0ZWhPXJ2P5XlrqH9JovKKFY+i7eGkjXTTpUk?= =?us-ascii?Q?iewkWUh3xCxgdKwg2we0l0w42F9r6a4jo6dN+nX+hMem/rwmGqbPFcVdXpCj?= =?us-ascii?Q?1eZhZxMaR1CyTONSu6gwy8Q7m1vwp8mn+ymtl/1Tzw2PNnD/D6VHr53ij1U/?= =?us-ascii?Q?D5WX7V/8GniOf6jpvxsSEtkNwjzT8UiCCe0zfHGA9i++NBHnZ9NqAc3rWJ2N?= =?us-ascii?Q?PdO2Eb9+7aJ1OCGC1BYWxEqfkYjM5GQqbv5S7Xco2TUb6OYgiO2B+/ffjkOz?= =?us-ascii?Q?+DZNxIyicNRwx0q2l8IWm9KmPWFUkN2EYuEx6dSSDqzBI/KzpBYrlAeX0gGb?= =?us-ascii?Q?IDh0Sx+TrY6m4x0vd6is8WvU6MBOfQ3hGqPbu6AbI2ffnEaEt1fn5N3+powk?= =?us-ascii?Q?A5rYvylvsVn7jTly4rgGpmhMql+CGJB6FlE8fmb1JoH8bgu8ICqQG4n0+hHD?= =?us-ascii?Q?X3/690sJXQI85RQQowSQJzDZIOS9AhlZ3SHH4Hxd9dYqRz8rygDL1JAYsI79?= =?us-ascii?Q?BcV8TgcFvInLdnBW8LD6at1/4AlYxWEILrEn61vML/IY2POdxze+nUXLFPvm?= =?us-ascii?Q?oV2Mao6wDHsLPcHIcpN0DXcYdrN7Jc7EK+czN1Gb7hTvShZ9Zw6b6LLK5ZUJ?= =?us-ascii?Q?iT7Hu33ZQG/dG6ypjapgIr9r?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR18MB4086.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e61d3a8d-4e63-405f-c7f8-08d98537de98 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Oct 2021 00:02:04.9505 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fsFqjt/7t07b5xu6HJA7SDXXIdYnRPDvzqCGzafe+tKHLuH5kkHsshEk04AmPZhKN2QfTbeSbRnSY2FkaTCRPItUTyt8N3zpbI1P1wZaD4w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB3990 X-Proofpoint-GUID: mAKyxc6q13EYSE4CYoDc73KDnCttbuKI X-Proofpoint-ORIG-GUID: mAKyxc6q13EYSE4CYoDc73KDnCttbuKI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-01_05,2021-10-01_02,2020-04-07_01 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" >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; We could get rid of this zmalloc by declaring rx_queues as array of=20 pointers, it would make code much simpler. I believe the original code dates back to "Initial" release. >@@ -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