From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 0210B201 for ; Sun, 14 Oct 2018 22:47:53 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 95046215B2; Sun, 14 Oct 2018 16:47:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 14 Oct 2018 16:47:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=4E9/oei6RM 0kZ8W9GfVDh8sC8elmUxUgHjAehQDRL3c=; b=B/QDIddHYRHGxh34qcdy9SkSF8 e6Oa7lFJy5ncMS1D6Z6aGAxSF3I+MlkQQO/JfiuFBtQzHAT5+gZpEok6h1/aQRPe vTU3h0N9T71X+0Ww6HMqWbLAC+XGA+P63LBMZgNJkGUxUZ0sP1QLE5Hw7SHem3HW HRe5b4HgXQrkHGd1A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=4E9/oei6RM0kZ8W9GfVDh8sC8elmUxUgHjAehQDRL3c=; b=v71spTyR 0NA/EHBLYcwXxUYrobXftJYSvrFZqZfKusix9SSk2jXR9Q8TQmu2VlEDjmPjHxtN t1J0jq2O2SEq8dNBN+3xxR5DpCf2hk1xHXCiIwohVAUXbSwv6SNh0M8P8DcPrpTx Bctw4F9KILdM7FlYrWjFgB1z9xVCB1JR1LoFPaFW12bMZcp4L6MZv1tAO4HsU/Si mg+K0veH+5Lz29TB9DyI/H0E/avHTV5GEXZwmjZkaaXyUtzoeRoDWuYnB1Yzc1mf F/GosGo8lLk6FytrLEwA0EfiK0O5nUxPE9UKNHfc6p8HiZKvBteNsl2FAHQwUhYM lq0RxrBQWpHcOw== X-ME-Sender: X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 7262EE482E; Sun, 14 Oct 2018 16:47:51 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: gaetan.rivet@6wind.com, ophirmu@mellanox.com, qi.z.zhang@intel.com, ferruh.yigit@intel.com Date: Sun, 14 Oct 2018 22:47:42 +0200 Message-Id: <20181014204747.26621-3-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181014204747.26621-1-thomas@monjalon.net> References: <20180907230958.21402-1-thomas@monjalon.net> <20181014204747.26621-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 2/7] ethdev: rename memzones allocated for DMA 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: , X-List-Received-Date: Sun, 14 Oct 2018 20:47:53 -0000 The helper rte_eth_dma_zone_reserve() is called by PMDs when probing a new port. It creates a new memzone with an unique name. The name of this memzone was using the name of the driver doing the probe. In order to avoid assigning the driver before the end of the probing, the driver name is removed from these memzone names. The ethdev name (data->name) is not used because it may be too long and may be not set at this stage of probing. Syntax of old name: ___ Syntax of new name: eth_p_q_ Signed-off-by: Thomas Monjalon Tested-by: Andrew Rybchenko --- app/test-pmd/config.c | 4 ++-- drivers/net/bnx2x/bnx2x_rxtx.c | 15 ++------------- drivers/net/cxgbe/sge.c | 24 ++++++++++-------------- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 ++-- lib/librte_ethdev/rte_ethdev.c | 5 ++--- 5 files changed, 18 insertions(+), 34 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index bf3cd0a8c..a6db5df0c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1479,8 +1479,8 @@ ring_dma_zone_lookup(const char *ring_name, portid_t port_id, uint16_t q_id) char mz_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; - snprintf(mz_name, sizeof(mz_name), "%s_%s_%d_%d", - ports[port_id].dev_info.driver_name, ring_name, port_id, q_id); + snprintf(mz_name, sizeof(mz_name), "eth_p%d_q%d_%s", + port_id, q_id, ring_name); mz = rte_memzone_lookup(mz_name); if (mz == NULL) printf("%s ring memory zoneof (port %d, queue %d) not" diff --git a/drivers/net/bnx2x/bnx2x_rxtx.c b/drivers/net/bnx2x/bnx2x_rxtx.c index 589735ecd..ca28aaccf 100644 --- a/drivers/net/bnx2x/bnx2x_rxtx.c +++ b/drivers/net/bnx2x/bnx2x_rxtx.c @@ -12,19 +12,8 @@ static const struct rte_memzone * ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name, uint16_t queue_id, uint32_t ring_size, int socket_id) { - char z_name[RTE_MEMZONE_NAMESIZE]; - const struct rte_memzone *mz; - - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - dev->device->driver->name, ring_name, - dev->data->port_id, queue_id); - - mz = rte_memzone_lookup(z_name); - if (mz) - return mz; - - return rte_memzone_reserve_aligned(z_name, ring_size, socket_id, - RTE_MEMZONE_IOVA_CONTIG, BNX2X_PAGE_SIZE); + return rte_eth_dma_zone_reserve(dev, ring_name, queue_id, + ring_size, BNX2X_PAGE_SIZE, socket_id); } static void diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 4ea40d191..f9d2d48a0 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1873,10 +1873,9 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, /* Size needs to be multiple of 16, including status entry. */ iq->size = cxgbe_roundup(iq->size, 16); - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - eth_dev->device->driver->name, - fwevtq ? "fwq_ring" : "rx_ring", - eth_dev->data->port_id, queue_id); + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + eth_dev->data->port_id, queue_id, + fwevtq ? "fwq_ring" : "rx_ring"); snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); iq->desc = alloc_ring(iq->size, iq->iqe_len, 0, &iq->phys_addr, NULL, 0, @@ -1938,10 +1937,9 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, fl->size = s->fl_starve_thres - 1 + 2 * 8; fl->size = cxgbe_roundup(fl->size, 8); - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - eth_dev->device->driver->name, - fwevtq ? "fwq_ring" : "fl_ring", - eth_dev->data->port_id, queue_id); + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + eth_dev->data->port_id, queue_id, + fwevtq ? "fwq_ring" : "fl_ring"); snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); fl->desc = alloc_ring(fl->size, sizeof(__be64), @@ -2144,9 +2142,8 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, /* Add status entries */ nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - eth_dev->device->driver->name, "tx_ring", - eth_dev->data->port_id, queue_id); + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + eth_dev->data->port_id, queue_id, "tx_ring"); snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); txq->q.desc = alloc_ring(txq->q.size, sizeof(struct tx_desc), @@ -2223,9 +2220,8 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, /* Add status entries */ nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - eth_dev->device->driver->name, "ctrl_tx_ring", - eth_dev->data->port_id, queue_id); + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + eth_dev->data->port_id, queue_id, "ctrl_tx_ring"); snprintf(z_name_sw, sizeof(z_name_sw), "%s_sw_ring", z_name); txq->q.desc = alloc_ring(txq->q.size, sizeof(struct tx_desc), diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index e41fa499b..78e5b7680 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -161,8 +161,8 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size, char z_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; - snprintf(z_name, sizeof(z_name), "%s_%d_%s", - dev->device->driver->name, dev->data->port_id, post_string); + snprintf(z_name, sizeof(z_name), "eth_p%d_%s", + dev->data->port_id, post_string); mz = rte_memzone_lookup(z_name); if (!reuse) { diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 21f1dfbe4..14fc7e328 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3481,9 +3481,8 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, char z_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; - snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d", - dev->device->driver->name, ring_name, - dev->data->port_id, queue_id); + snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s", + dev->data->port_id, queue_id, ring_name); mz = rte_memzone_lookup(z_name); if (mz) -- 2.19.0