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 30300A04B2; Mon, 4 May 2020 19:27:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C87AC1D55B; Mon, 4 May 2020 19:26:53 +0200 (CEST) Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120138.outbound.protection.outlook.com [40.107.12.138]) by dpdk.org (Postfix) with ESMTP id 239111D447 for ; Sun, 3 May 2020 18:26:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UKoEm8WDvthOaHCVtOX5scDj/ZeHG9YvcMjikAmjhtND8i6LGUMpResZF9SDgWi74BSI3ZuASqkAgjjjnAnraeIRlDfF/diyNmux+cTwkQcYdxI0b1Mgt5UhVzSR0bl4pFbnlKSjOc+c+A72hViHmgX96WzLjMa8i70U6tdhGWiK7BBHLWjriH71TrNS+VJs56L1E5qVcTGFVYyBt5es9hpdonovWWc8uHn8Ej9hsUKKmTFrmWLD7duxRPsCLKwTtIGp1WhRPl9KEOK7iGBCSp8wgffIBVraUibA5MrGbOnKMFRUTeoXEmbsfa4A5kfA6XdUjAyhAlEo22LLC8UXmA== 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=sqj7u8H1a+0fSdmzaup1at2MwyovdyPOlVPg60yojYU=; b=lTvJH5zZT++jwvoXE13s2fHHib1WjL9Nh9JuF7NfFsdJ7ZBYZg4jXluYW41nVwlNdEr6jT9NOR8e26fiPPpyZ2jv4mXfTCQCQxcYYQttj3n1Ch/qRV3VolzY6za0tbTcblCY1fradHnW9FM10oPM/8qj4SbqSIkxIyzSi03Fceo2B2LeuWMncGeqs3xqj5syLJa8UhuMTHU0uigfaX5Shqj9nuuVDY1hf7BEDKPGH9mPySDlqtLGeVxGXsUwAJIJJa1qpUaSu7gP4pUlRkgrSHZIdy9Ibt7W93dJEOyrPz4dscR74iWOykmyE4jh/9irkerC0YNjUqEMAOqFe2oJqA== 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=sqj7u8H1a+0fSdmzaup1at2MwyovdyPOlVPg60yojYU=; b=VpwFmQZzSTG9NU2nGTGcIQbXLZ7TahupnU+VDAtflA8oJt7rNSZpYbP2wQhq60vSJ9bLGtU9vZVjiSAt9fP9UZa2LPE2N/p+Cpie6NuI86tui++WperHPcW+Zgm450nIEzM+vyt0j0ScUpyenng1VfpHGe9DXRa/Dm3NEBbpbIk= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=ekinops.com; Received: from MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM (52.134.49.19) by MRXP264MB0566.FRAP264.PROD.OUTLOOK.COM (52.134.47.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Sun, 3 May 2020 16:26:48 +0000 Received: from MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM ([fe80::41a7:e761:6112:5c08]) by MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM ([fe80::41a7:e761:6112:5c08%7]) with mapi id 15.20.2958.029; Sun, 3 May 2020 16:26:48 +0000 From: Renata Saiakhova To: dev@dpdk.org Date: Sun, 3 May 2020 18:26:35 +0200 Message-Id: <20200503162636.5233-2-Renata.Saiakhova@ekinops.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200503162636.5233-1-Renata.Saiakhova@ekinops.com> References: <20200503162636.5233-1-Renata.Saiakhova@ekinops.com> Content-Type: text/plain X-ClientProxiedBy: AM0PR06CA0087.eurprd06.prod.outlook.com (2603:10a6:208:fa::28) To MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:22::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from renataOAB.oneaccess.intra (91.183.184.98) by AM0PR06CA0087.eurprd06.prod.outlook.com (2603:10a6:208:fa::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Sun, 3 May 2020 16:26:47 +0000 X-Mailer: git-send-email 2.17.2 X-Originating-IP: [91.183.184.98] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1c532b06-d1d3-4eaf-d96a-08d7ef7ec6cd X-MS-TrafficTypeDiagnostic: MRXP264MB0566: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0392679D18 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CBZ6L8XsF2wJBn5F4KvHV4qir9tBxfzsWSjzdCylHXGaH+DOmpYlLPye5r5C6QrEe8Aah0/HnD9nYiiV2rCGvaiwmnIIWvN7yuKDM09rFIueam+1RzUmXNpHckAQhapPMBEGtiaPD/yvV16Fc/uVNlTaZndwfNpLHM8lZUoJqxmX/obM4SEkIyMJ0CScRM8HW5cU+4nf+mk8Aw6OIIV+JiEiOCb6xUVtiMq9BHqzONk5kksmselTmViWedCmKpHqQ53lnXYarTIJqRTBNpYPwX3RaD+gWnNvC11BAiwLXXtCXMWFaCRGjLPWAO4hqNl8hLiqkJndftDQElSsGmQjMHrmyJHlXrqiSnpXH+ltfmT50j7qKhNQUlpcfR3qwvINsAYY4e4z4kHDlpYabQgq7aINnkWYJhMi4X7/kkjj+NTjFjuW8DLUKxS2InyX4G0e X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MRXP264MB0325.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFTY:; SFS:(136003)(396003)(366004)(376002)(346002)(39830400003)(6506007)(5660300002)(6916009)(8676002)(8936002)(478600001)(86362001)(1076003)(16526019)(66476007)(66946007)(66556008)(2906002)(186003)(26005)(6666004)(52116002)(956004)(2616005)(36756003)(6486002)(6512007)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 9i+3KeQpWeVYLebUTA3X1VCRbcnNMOkdXWZ6TkXwYM65ZKUVNpUByMYChWT3ti2zcg426rPSOwKedxFVJfHDFink3dMr2WnHDw4YuVHIkQFFIAd+TiamrLXYnXoaVPrvxaZdX/NKuXz9h2jVIV/e8cxSqzSTDOPDUUF5mXsNLbt+Va+Lpn6n3IShrFYilN0w5p85phVY2rmnxgLRLPc4bTRsiFejyPOyRE/0Nt6ijWqskvkNVy7bD9jn6IlJBkIPJVuofF1MXmBQllNOlwf/HLmBqNNoG5py48BqTibHHyIju1ggw5zayYfoamW04poZ12rbbCKQR7v1rXq4KOvx3qXNZ86jQJMGEijPPFyLJP0qITL9cc16U4bYwwjGDXRSHOq32BC+lmJ8j31NjcQKx/iFWo8XkGmvKq+uopt/ywDC46Gig/eAoumCah7JtbXVxHULO1JVS+Kv1gSUZDXu/OtXbw+37oSBpFNgSIVoA/g9nBddOIOYQfMpFXl8L0b3KcGDd0tX0BIPIvRhfopUGd6/eU4qikTzsKF9i4dy390r/w3C7wZ2wj3qb/wnCB+He8NEh5YdjbmDRuNNnBLv99G/Q7YsCo47xzvWwzCnyGJjK4h2kKwDlsOnPZeS5/FWsSmq18P9fRcWuNlUeahR9zaLHagIVnmGXff/keuV9fkWq/a0b5Ccpd0VuyQhwS8nO0LBJgV8mQBXp5iXpPSVt7zH87aF7cd3zLskM5tEuUqrUGrDssAjwfv+YNm6Y7/2qvJRtrbBdyiBRlz7HiWd5KBY0mcAwCQrQ41yTSaJ/0U= X-OriginatorOrg: ekinops.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c532b06-d1d3-4eaf-d96a-08d7ef7ec6cd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2020 16:26:47.7680 (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: 3NPrSBhyKgwInJsg/R/bnV8z7x1kzyPDLpOx2Rdn+svb0mUrhRYhdRfApdlwGsrrf0w2Cp7jm9RrdiSMCYp5uqbyYT3R6vHOQxQn71xcl3Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MRXP264MB0566 X-Mailman-Approved-At: Mon, 04 May 2020 19:26:43 +0200 Subject: [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" 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_ethdev.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_name, + uint16_t queue_id) +{ + char z_name[RTE_MEMZONE_NAMESIZE]; + const struct rte_memzone *mz; + int rc = 0; + + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + dev->data->port_id, queue_id, ring_name); + if (rc >= RTE_MEMZONE_NAMESIZE) { + RTE_ETHDEV_LOG(ERR, "ring name too long\n"); + rte_errno = ENAMETOOLONG; + return NULL; + } + + mz = rte_memzone_lookup(z_name); + if (mz) + rc = 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/rte_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 *eth_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 + * The name of the memory zone + * @param queue_id + * The index of the queue to add to name + * @param size + */ +int rte_eth_dma_zone_free(const struct rte_eth_dev *dev, const char *ring_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; -- 2.17.1