From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67EB2A034F; Wed, 6 May 2020 12:40:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C14F11D926; Wed, 6 May 2020 12:40:20 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-eopbgr90114.outbound.protection.outlook.com [40.107.9.114]) by dpdk.org (Postfix) with ESMTP id 280881D68F for ; Tue, 5 May 2020 19:25:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gzrgj9M13ro9dxEYsgrKALpoMObQkMG2/p6MOivVkB4tKXyJBqJ+LICnUuM0PvpJXR4bnveitXEzoRptDFTZT8R/B8Je4xjSQM7HoNofheKeabuMOC1/X4I3QGqYpkL+FTxbAKBfM7J+EPQSBo/fBY66/cneOKu3shaC4ZKvfWNTSOwn3eeKuclx061ySZMOPZEMRYmQNpIMgMJ08j2thXxOsBmeJUgByu8WWPUTtc3eHoeBivtYVMOQ5nBBwhyDmLKWLyDISv1q/7+ACKCPzWV+itrQv24/WxlLzzYJw6O8fmTjlVGsykqIomQY0ykM1ol2NsKbYjULaj1/Wk9i3g== 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-SenderADCheck; bh=4Mmicm8Vogh7m/XKgUm3XelvL5UIzlxY/KEpOlfPir8=; b=LNoOYzxV5ezCMuLdNS92SK3YxprmCGoTfBefkSxpRoUvOd2y1xSWG5ZEsOsRVWjDxPgiS6xXk9iKNEaVIhaccCqsE5bnJtICAbPC1hERh4Ji/K6pia57fYzei95YJ76UY+C7CmSETSI7nu9hzFmbHUi6SPbphr4iVB+be/fRILCtCJ4NHpBLDQnifW1wAlxUMdF2WQgNP6uwGcStmBiVJZrdoXssp15oU3QbutrUXcSTdJHP51w/1Bb61fhTLD9IIZZhehXq2wp/ZjOqhjmMfBYTCIpYP4JlHHKxWFKdx5vsyV2fzCbM0/smcCQhsRh/HiREQJHjR0UVPbI7TzrUpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ekinops.com; dmarc=pass action=none header.from=ekinops.com; dkim=pass header.d=ekinops.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ekinops.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4Mmicm8Vogh7m/XKgUm3XelvL5UIzlxY/KEpOlfPir8=; b=KjsSu4/ntlrSEQl+X0sUulwvGOojZw1YUSIxNvVoyuPY2E+8DZsaMXZlUjJLkGlQ1nfsbD8V0jZI9lsXADNulMcVThEhMXVzKDhiLBM453SsL5Tsi/rvaDjqU83Io0yFnDoWosyd0zfLHQrXzTqsA3+x1nWy5s7nT1Ml00ES5wk= Received: from PR0P264MB0332.FRAP264.PROD.OUTLOOK.COM (52.133.67.17) by PR0P264MB0492.FRAP264.PROD.OUTLOOK.COM (52.133.69.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.27; Tue, 5 May 2020 17:25:55 +0000 Received: from PR0P264MB0332.FRAP264.PROD.OUTLOOK.COM ([fe80::d0e6:9d90:7d7f:34ea]) by PR0P264MB0332.FRAP264.PROD.OUTLOOK.COM ([fe80::d0e6:9d90:7d7f:34ea%4]) with mapi id 15.20.2958.030; Tue, 5 May 2020 17:25:55 +0000 From: Renata Saiakhova To: "Burakov, Anatoly" , Lukasz Wojciechowski , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/2] librte_ethdev: Introduce a function to release HW rings Thread-Index: AQHWIWekAriR6I+3OkSvwfpRDqlAwqiZph2AgAAX9Aw= Date: Tue, 5 May 2020 17:25:55 +0000 Message-ID: References: <20200503162636.5233-1-Renata.Saiakhova@ekinops.com> <20200503162636.5233-2-Renata.Saiakhova@ekinops.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=ekinops.com; x-originating-ip: [2a02:a03f:8b18:1c00:1508:b5de:e9ba:7c4e] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 82fb5312-0d02-40d2-f7f2-08d7f1195e3f x-ms-traffictypediagnostic: PR0P264MB0492: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0394259C80 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RVz78hy7ZTp7J8JthB9veWLi/aCVKVnXM7N+S3hykL8BXyD9iUdCumV0MU/GURZ4npOcaGwxfco4iYy6VMZPQSF2MdiTKHi6Kocw82I+CUiMySCa8fOVTUPdHQNdKn44B9UtVANPjOM3FeKDnfsEDP6cEYnYRkp70w++54IQhvLRBX5PlRCJ4EdP0Wgz8MZMlk1wSs+Lp3JKKXIfjq7sHVD6TChk/ANX+HPDkMsNQGqxrDpm49IMHjTk0O/CIZkCfVnbSOZYA82f+kI+67sAJYW56TIXUMEDAVzMl7CRBGzmmqla/WJ90jbxEG47izg87ZHeKe1sK7Ldmu9SibpUycLGRoftCbcqYmiFpoDaQKozZICPQjdgaZQ4s/WBM6yOfLfCzKKvUAvlVJw+m9ikD08tpgdNXxmvssDfrRuMLh39LDZrXM6lOapPwEfYEhIRh662T45GhB5XND+wYKjybF7+q3MA+Dn05c/8pHH9+dydbbkXl3Eq79rMrpmMNfdRstGGsTWl+c+ebIlsQiTpaw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR0P264MB0332.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(39830400003)(366004)(346002)(396003)(376002)(136003)(33430700001)(110136005)(53546011)(186003)(66946007)(8676002)(44832011)(6506007)(76116006)(33440700001)(478600001)(52536014)(316002)(55016002)(7696005)(71200400001)(64756008)(66556008)(9686003)(66476007)(66446008)(2906002)(19627405001)(86362001)(8936002)(33656002)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: NY7P2RdAyTZSLEV162xKbRKAJUsjFX1Tn9vRuiCVRiguLkBuiLzOuD2Ckzptu8oKmkpdCn6/YFH2jEdn9BjVjLBjKmSQoje1QDlVJGqpL/O929G1tPg6a9NeLDb7Ps+EIFBghvtPmSIFvhjyn2uMSOiF3MzNw4dsuP3SLkaU4btHz+QvFImCE7DU7QjK7pRdQhWTLwpFeMYYxl+zYpNozeFWugcN7kDwyntWCJ5M048lPQKN0MjwmKnwBtEjnEjYwgNwP+PwRjcl8+DQ2S3oG04iAetuIbfiT+oXeVDaljFjSsyRqmQHMUqUlS+jTkmWSuHKx1pklVwHKKpygOOHHxU/zClUP4AWHUrPLlTfR9aeKjTbJbUhPPLyaSUj8M/x3EDziT8vmxFHJVif/fMmGzzsxMXMIwueuw+3Bl8radk8lXjAd3bn8jg1uQkYn6/xNUdt64KfZO9mEAuSf287UJtsq9XX8mu6s8ntcCp7UAWdKJEkB33n8mrUVdudWPEGn1iV7+RUhGbG4YVsvo5Vs4fNbQ9FjxroZRis91GCITWis3xAp8bQE9xFvxnzqJkBZlN/nk1HS0slxb37QZnaUOibqS904DPZWBFvNYnu5+wNxSVy/wxMQ5CDYc+CZOxzbFCodda+DdkGlHeWls0sHriY8Rt/nTCyiMD4ii2uD4Ct0pXcEJOHOO8ILO+BllGk1aj2qQImB/gp+xDBlx/g+UOTaBhspbGYoY0Ou0RlZUbEjIGmATOXNA5OzdaFizzfsth/m84dgCeHzz4abRW92GGOJI4bHHZcY1Jw43UBjhF9PIo10ez9nsHSVA9AKt2bhEsMwO+PLjkjRtk+oQSVm6DTwoIAm+PENKHcw42HXYC8MpD/q3D28aaxM7wDisgr x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: ekinops.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82fb5312-0d02-40d2-f7f2-08d7f1195e3f X-MS-Exchange-CrossTenant-originalarrivaltime: 05 May 2020 17:25:55.2602 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f57b78a6-c654-4771-a72f-837275f46179 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HHPZ72IqZgz2YfHYgQeYDkj8sfBC3bzRadrzeGizOOKDcqUMF5aQIk+P/AsCrJ2cB5nakumb4OGm+EyUfa3QNJN2ZaTOCfNAs9nU/nsMP2Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR0P264MB0492 X-Mailman-Approved-At: Wed, 06 May 2020 12:40:17 +0200 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 1/2] librte_ethdev: Introduce a function to release HW rings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi Lukasz, thanks for your comments! I understand Anatoly is going to to make a fix ra= ther in memzone API level, to introduce atomic "find and allocate" and "fin= d and free" operations, so this patch code won't stay long and in this case= maybe better not to disturb the original code of rte_eth_dma_zone_reserve(= ) ? Just a question. Kind regards, Renata ________________________________ From: Lukasz Wojciechowski Sent: Tuesday, May 5, 2020 5:47 PM To: Renata Saiakhova ; dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/2] librte_ethdev: Introduce a function to = release HW rings Hi Renata, few minor hints inline W dniu 03.05.2020 o 18:26, Renata Saiakhova pisze: > Free previously allocated memzone for HW rings > > Signed-off-by: Renata Saiakhova > --- > lib/librte_ethdev/rte_ethdev.c | 23 +++++++++++++++++++++++ > lib/librte_ethdev/rte_ethdev_driver.h | 14 ++++++++++++++ > lib/librte_ethdev/rte_ethdev_version.map | 1 + > 3 files changed, 38 insertions(+) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 72aed59a5..c6d27e1aa 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -4206,6 +4206,29 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev = *dev, const char *ring_name, > RTE_MEMZONE_IOVA_CONTIG, align); > } > > +int > +rte_eth_dma_zone_free(const struct rte_eth_dev *dev, const char *ring_na= me, > + uint16_t queue_id) > +{ > + char z_name[RTE_MEMZONE_NAMESIZE]; > + const struct rte_memzone *mz; > + int rc =3D 0; > + > + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", > + dev->data->port_id, queue_id, ring_name); probably rc=3Dsnprintf(...) but maybe create a macro for that fancy memzone name as the same code appears already in rte_eth_dma_zone_reserve and keeping it in one place seems to be better idea to me. > + if (rc >=3D RTE_MEMZONE_NAMESIZE) { > + RTE_ETHDEV_LOG(ERR, "ring name too long\n"); > + rte_errno =3D ENAMETOOLONG; > + return NULL; It's an int returning function so instead of setting rte_errno, just: return -ENAMETOOLONG; > + } > + > + mz =3D rte_memzone_lookup(z_name); > + if (mz) > + rc =3D rte_memzone_free(mz); > + > + return rc; > +} > + > int > rte_eth_dev_create(struct rte_device *device, const char *name, > size_t priv_data_size, > diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rt= e_ethdev_driver.h > index 99d4cd6cd..2769a185b 100644 > --- a/lib/librte_ethdev/rte_ethdev_driver.h > +++ b/lib/librte_ethdev/rte_ethdev_driver.h > @@ -180,6 +180,20 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *e= th_dev, const char *name, > uint16_t queue_id, size_t size, > unsigned align, int socket_id); > > +/** > + * Free previously allocated memzone for HW rings. > + * > + * @param eth_dev > + * The *eth_dev* pointer is the address of the *rte_eth_dev* structure param name is dev > + * @param name > + * The name of the memory zone param name is ring_name > + * @param queue_id > + * The index of the queue to add to name > + * @param size There is no size param, but some info about return would be probably nice: * @return * Negative errno value on error, 0 on success. And as it's a new API function maybe it should be experimental. Should it? > + */ > +int rte_eth_dma_zone_free(const struct rte_eth_dev *dev, const char *rin= g_name, > + uint16_t queue_id); > + > /** > * @internal > * Atomically set the link status for the specific device. > diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev= /rte_ethdev_version.map > index 715505604..5d3c209bc 100644 > --- a/lib/librte_ethdev/rte_ethdev_version.map > +++ b/lib/librte_ethdev/rte_ethdev_version.map > @@ -82,6 +82,7 @@ DPDK_20.0 { > rte_eth_dev_vlan_filter; > rte_eth_devices; > rte_eth_dma_zone_reserve; > + rte_eth_dma_zone_free; > rte_eth_find_next; > rte_eth_find_next_owned_by; > rte_eth_iterator_cleanup; Best regards Lukasz -- Lukasz Wojciechowski Principal Software Engineer Samsung R&D Institute Poland Samsung Electronics Office +48 22 377 88 25 l.wojciechow@partner.samsung.com