From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id 8FE223772 for ; Mon, 6 Mar 2017 11:00:48 +0100 (CET) Received: by mail-wr0-f195.google.com with SMTP id u108so17051642wrb.2 for ; Mon, 06 Mar 2017 02:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=lnVE1c9paqy4Y/I7dIBvOESHnPQ6aJYkZLKf4ihdqjE=; b=A3bqyyL3Jp6lPdIn35QgUlOFZRUBiqzYppS+l23UUIz9zdYF8ggxEmBbP2rUyb5lUF IrVVGKaliyrhL+bHxSirQWS+fLrXr7AvKmDwZrHfLepWNqQUAOUhTykMVQaTxAt5qPrz tJA7sgcylE/MD1NpFH6oWkbttbwZW+7OW29ZcrOOFc6yBa6A2JbTqSF1ygxjhbizsozI 3TxLc80kqJu6mkrqasCjxb544Koh+wkk0zb6hBFB700bGklHgSaOq4dGHFJjGdVVp/UO Rnu3+m5NnHhtoDnq2x9xvSsw32n/bVtdm+FlbzrwhlNsZsTNaLRmGyEF7Kdgo/d8YROL 69cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=lnVE1c9paqy4Y/I7dIBvOESHnPQ6aJYkZLKf4ihdqjE=; b=SUueWqrpIAq43yq3Fl7z/dTok7aF6OO522GNeZANArnZ6hm3qyqPF9TkG/lXM9u4ZA bVeptQWGVjbbFAcUWgAx0TiQ8UXghKuFywYK8Qd8wbpik2dLblPZEVag4QeDASM/zI5c Q+yZvzLrszunFF6TxkwlQhEw8tBmmdO3vjRfRbCfGETiU1+UP4/iArHupwXgRU7MUV2X yeNWb79P8ej/VyCgKgfDW+Lqgxe8LNTNOc+d6d/BXHmFJpW9ckC0g0L81PAeRn5vBztn GWXwCf+enCtaz+KEFgHComuvyLbRDFaNqpjDNfr9NsD6PQe5ovQbBVaNK9Eys+8BtaAU clxQ== X-Gm-Message-State: AMke39lKEihc52ZanlQMYuQSbHzsjs4lMwqjww5SvJEV4HBDeSqFaMVNWhIEAS4v5qOwkw== X-Received: by 10.223.129.183 with SMTP id 52mr14760674wra.88.1488794448077; Mon, 06 Mar 2017 02:00:48 -0800 (PST) Received: from weierstrass.local.net ([91.200.109.169]) by smtp.gmail.com with ESMTPSA id u145sm3829237wmu.1.2017.03.06.02.00.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 02:00:47 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Mon, 6 Mar 2017 10:59:55 +0100 Message-Id: <1488794430-25179-4-git-send-email-jblunck@infradead.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488794430-25179-1-git-send-email-jblunck@infradead.org> References: <1488794430-25179-1-git-send-email-jblunck@infradead.org> Subject: [dpdk-dev] [PATCH 03/38] 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: Mon, 06 Mar 2017 10:00:48 -0000 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 d79f262..b9dfe80 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -205,26 +205,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. * @@ -1461,9 +1441,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"); @@ -1603,9 +1584,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.7.4