From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 9CD3FD20F for ; Tue, 11 Apr 2017 17:45:06 +0200 (CEST) Received: by mail-wr0-f178.google.com with SMTP id o21so679268wrb.2 for ; Tue, 11 Apr 2017 08:45:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=x+rJHI5Wp61DCoqB8O0BBsncRFEwLwvbcdV13e1s/SA=; b=e48N28qRyBfSEajsMER09QbIIT+hLNxzW8Ss0N5OA8E6+vZ3rofGC/0ywKYdcH3Z/G m+jhyyP9SWyV+kMXQQvB5pgWYWz4+czbDM4nGZP4rHIOlWvDw0x63jIeoVP4ArtcAMVX 6RLO6Nc2AWLcTqPMe+UjCJOJwcQfWdqQ936LUgW0kuct7gQmfYOiu8dRLEqKAUFQoZjK wQhEYNsCVTU9O99nl/tB+UDeuGTiw+eKD4g4OnGTyEsZwu2PCNywb35PJjfLWaEVGjHd siuTSBGBBgizaW9CZFk0BSXKYlC311AdkJ+nk35hyzmcfSoyg0KOzv5fut5EzQQ/kUYW CMLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=x+rJHI5Wp61DCoqB8O0BBsncRFEwLwvbcdV13e1s/SA=; b=FmzkLBgdq2y8Bq9fsTbpJqe+aYakep6NL+S9+nJQSsUPBAdDyeBcgguK06wgqGHSWH +Eu/Qdj/wr4lMreDyU8uCfBOejCX8pxVqvi808nMX7FW6qWQYAn/7d6/F5ASTVJIsVXh eW9u3XNHu4jYHhgSD1gBeA3ae0/+Ip3pPC+kI4m5yJ1VIgPdDe3vrfc2PAhrRAk7tDcn q6+4u1/ni2RI4rZM+goDfLfgqEOX2AXoFhVqysmxQcxDbqUn6VYXwuxucMb9NE65uRec V5LrU7pflRycUbnGSydcZ/em+KjsijwD729QlU9k3eTPfY3c1SiSZuDBAqPmkCtmiwib CDUA== X-Gm-Message-State: AN3rC/6g1VM+npEak/nJGBCY7ohFc939fQcNDDQenymSbQLa9mSaLVb1F0gs/ruEMVbZ5YNF X-Received: by 10.223.133.133 with SMTP id 5mr15782828wrt.83.1491925506380; Tue, 11 Apr 2017 08:45:06 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id u63sm2933738wmu.22.2017.04.11.08.45.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Apr 2017 08:45:05 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Tue, 11 Apr 2017 17:44:10 +0200 Message-Id: <2c6eb459694855e7a0c118a90ae9ceede27c86bd.1491924900.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <1488794430-25179-1-git-send-email-jblunck@infradead.org> In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 03/42] net/nfp: use library function for DMA zone reserve 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: Tue, 11 Apr 2017 15:45:07 -0000 From: Jan Blunck This driver can use the library function rte_eth_dma_zone_reserve() instead of duplicating the code. Signed-off-by: Jan Blunck --- drivers/net/nfp/nfp_net.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 1a7a992..d06b10a 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -204,26 +204,6 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val) nn_writeq(rte_cpu_to_le_64(val), hw->ctrl_bar + off); } -/* Creating memzone for hardware rings. */ -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->driver->pci_drv.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, 0, - NFP_MEMZONE_ALIGN); -} - /* * Atomically reads link status information from global structure rte_eth_dev. * @@ -1455,9 +1435,10 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, * handle the maximum ring size is allocated in order to allow for * resizing in later calls to the queue setup function. */ - tz = ring_dma_zone_reserve(dev, "rx_ring", queue_idx, + tz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx, sizeof(struct nfp_net_rx_desc) * - NFP_NET_MAX_RX_DESC, socket_id); + NFP_NET_MAX_RX_DESC, NFP_MEMZONE_ALIGN, + socket_id); if (tz == NULL) { RTE_LOG(ERR, PMD, "Error allocatig rx dma\n"); @@ -1597,9 +1578,10 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, * handle the maximum ring size is allocated in order to allow for * resizing in later calls to the queue setup function. */ - tz = ring_dma_zone_reserve(dev, "tx_ring", queue_idx, + tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx, sizeof(struct nfp_net_tx_desc) * - NFP_NET_MAX_TX_DESC, socket_id); + NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN, + socket_id); if (tz == NULL) { RTE_LOG(ERR, PMD, "Error allocating tx dma\n"); nfp_net_tx_queue_release(txq); -- 2.1.4