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 26DDCA04B8; Tue, 5 May 2020 17:47:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 387FD1D5FA; Tue, 5 May 2020 17:47:24 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 5459B1D5F8 for ; Tue, 5 May 2020 17:47:23 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200505154722euoutp022cbb5240a6f1e2d975214ed9c6af8e58~MLHNoOtx_2870128701euoutp02P for ; Tue, 5 May 2020 15:47:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200505154722euoutp022cbb5240a6f1e2d975214ed9c6af8e58~MLHNoOtx_2870128701euoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1588693642; bh=wxuCfDsFaEYAPlPSv1QSQ8rQ9hpHkU5tQAkDAKWj5LE=; h=Subject:To:From:Date:In-Reply-To:References:From; b=fv0MZmsF4aoCGDjZLmKouVGBTiB74XqX6265v+s6ZOZAKyKA5dvIsXbJF3wgctIaN 4JxrHGVLD6ySUrqnnvMWh/ObwIq3UReM/rCLE2UQUmSZhDtuSNxh2FeTL97z86oPZq h/XrjrBaUoe7ICIfXHPe/6Tr+OGpVVAh7hjRWdsA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200505154722eucas1p1ccf835c99b81b60a2c37516b35559ff2~MLHNjtt1C2976629766eucas1p1t; Tue, 5 May 2020 15:47:22 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 06.1A.60679.A8A81BE5; Tue, 5 May 2020 16:47:22 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200505154722eucas1p2a902c01cea3aa509b237ed82edc4c911~MLHNNhLGj2351723517eucas1p2n; Tue, 5 May 2020 15:47:22 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200505154722eusmtrp2e18c89139e49d7b5b58d880c4b490565~MLHNM-9R_1196711967eusmtrp2U; Tue, 5 May 2020 15:47:22 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-36-5eb18a8a35b9 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2C.39.08375.A8A81BE5; Tue, 5 May 2020 16:47:22 +0100 (BST) Received: from [106.210.88.70] (unknown [106.210.88.70]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200505154721eusmtip1658f444ffe3786adf8253e1b464b3fc0~MLHM35p6Q0835108351eusmtip1g; Tue, 5 May 2020 15:47:21 +0000 (GMT) To: Renata Saiakhova , dev@dpdk.org From: Lukasz Wojciechowski Message-ID: Date: Tue, 5 May 2020 17:47:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200503162636.5233-2-Renata.Saiakhova@ekinops.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42LZduzned2uro1xBhtuqVq8+7SdyeL+ihWs DkwevxYsZfWY/HQ6YwBTFJdNSmpOZllqkb5dAlfGsddf2Qr+yFRM6u5ib2BcJ97FyMkhIWAi 8fD0FkYQW0hgBaPEswvyXYxcQPYXRomTB5axQTifGSXeP7jAAtO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l H0YQm1nATGLe5ofMELa8RPPW2VC2uMStJ/OZJjAKzkLSPgtJyywkLbOQtCxgZFnFKJJaWpyb nltsqFecmFtcmpeul5yfu4kRGA3bjv3cvIPx0sbgQ4wCHIxKPLyG7hvjhFgTy4orcw8xSnAw K4nwLvuxIU6INyWxsiq1KD++qDQntfgQoynQbxOZpUST84GRmlcSb2hqaG5haWhubG5sZqEk ztshcDBGSCA9sSQ1OzW1ILUIpo+Jg1OqgbH3XeLLtbufLU+4fLX+7eqF8u3Rp4Rcvwotk7xW 0HxuYaWVdaiEtPZmCa2cguNPVufU708Ody4NyLhyutW4K+uvaGt99ckX344f+7BFuf28a4xb VV7f+yk3PdL+efqz5cdPzQnKnpA4f8qp39ZSn8omBXl6zrquKrjOaQFHeaz9sUMnZb++nK3E UpyRaKjFXFScCABXhfREnAIAAA== X-CMS-MailID: 20200505154722eucas1p2a902c01cea3aa509b237ed82edc4c911 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200504172809eucas1p2468ead2ef6274f05234dbc8a3f6b091f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200504172809eucas1p2468ead2ef6274f05234dbc8a3f6b091f References: <20200503162636.5233-1-Renata.Saiakhova@ekinops.com> <20200503162636.5233-2-Renata.Saiakhova@ekinops.com> 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 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_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); probably rc=snprintf(...) 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 >= RTE_MEMZONE_NAMESIZE) { > + RTE_ETHDEV_LOG(ERR, "ring name too long\n"); > + rte_errno = ENAMETOOLONG; > + return NULL; It's an int returning function so instead of setting rte_errno, just:     return -ENAMETOOLONG; > + } > + > + 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 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 *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; 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