From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 1C1FD567C for ; Mon, 6 Mar 2017 11:00:49 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id v190so12805486wme.3 for ; Mon, 06 Mar 2017 02:00:49 -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=I7LpzvM5EEhdPFmmUn8hG+JrutyogPbm5Y/vBp92z68=; b=jjRrtx2C1KdMYE6VxaZmaRLSvZw6MxWrphJKY2S1QWnGV6MHKndXwRg43mSpzceJE2 QDYqkAFoMWjCC++oxFXQEp4FYoXpgGsjVYWXvSDeablwMu+khusoV4dku5vNx3CbQhLa 10e3d/AwtyGQmQ89wIcTtb3Ll/WZ4Yb3y1awIHXC8YxZAlgeM4XYt5xWrsLQ/qAOZsrb TLal9ZQXecO/xGXCx6gCgHxBMBZBAJKZvOahL6YxaHH8ThnyGmBI+7hO06c/cQka3ZJw S8DE1IWWmJWmgm/w0eSQ6jwH/tLsxpJkoEwPNdlPznYLlH0DAqZZR1vhYntXbEmrDsps KQNA== 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=I7LpzvM5EEhdPFmmUn8hG+JrutyogPbm5Y/vBp92z68=; b=Zu+ZeRxjsIDzP4G9blOQ5FTKD33VsHt+YnFzIo5woHZSaAVzPjnkwRJpgWPzKY1Yj+ OXMU1LsQmfqq2urA8zMX5MuN9OOt4RVhIH1lNmdy5b2YlBWDbeTD+RZBnFWF6PQmLzV7 /q9iUzu9RmO2FWtXhQYj6UiwJ+GTyvIKgz8gEOKxB/6CJr1eJ5NK+Kh295dQVsYINgY6 Hm6yi38B6fIuN7wgYjHSVJptms6d+0XqsB8g09hXtAnnLa2EsbimP+kdG54hjWpFQohH EcduRu2Xn2V8K6gdD3bo3GZ1UFUsOew9mndDg8vs903ImmqJFTd99Qo/jqeXV3bDw4Ds 7CSw== X-Gm-Message-State: AMke39md4OrZJx5nsqaawfEWdWNAIczbSGFpNCGUvf1FkpdUGahvi4PXKyap2wd5mQjkBg== X-Received: by 10.28.150.202 with SMTP id y193mr13187435wmd.106.1488794449525; Mon, 06 Mar 2017 02:00:49 -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.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 02:00:48 -0800 (PST) Sender: Jan Blunck From: Jan Blunck To: dev@dpdk.org Date: Mon, 6 Mar 2017 10:59:56 +0100 Message-Id: <1488794430-25179-5-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 04/38] net/vmxnet3: 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:50 -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/vmxnet3/vmxnet3_rxtx.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index b246884..5e1b68a 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -872,30 +872,6 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) return nb_rx; } -/* - * Create memzone for device rings. malloc can't be used as the physical address is - * needed. If the memzone is already created, then this function returns a ptr - * to the old one. - */ -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, VMXNET3_RING_BA_ALIGN); -} - int vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, @@ -963,7 +939,8 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, size += sizeof(struct Vmxnet3_TxCompDesc) * comp_ring->size; size += sizeof(struct Vmxnet3_TxDataDesc) * data_ring->size; - mz = ring_dma_zone_reserve(dev, "txdesc", queue_idx, size, socket_id); + mz = rte_eth_dma_zone_reserve(dev, "txdesc", queue_idx, size, + VMXNET3_RING_BA_ALIGN, socket_id); if (mz == NULL) { PMD_INIT_LOG(ERR, "ERROR: Creating queue descriptors zone"); return -ENOMEM; @@ -1065,7 +1042,8 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, size = sizeof(struct Vmxnet3_RxDesc) * (ring0->size + ring1->size); size += sizeof(struct Vmxnet3_RxCompDesc) * comp_ring->size; - mz = ring_dma_zone_reserve(dev, "rxdesc", queue_idx, size, socket_id); + mz = rte_eth_dma_zone_reserve(dev, "rxdesc", queue_idx, size, + VMXNET3_RING_BA_ALIGN, socket_id); if (mz == NULL) { PMD_INIT_LOG(ERR, "ERROR: Creating queue descriptors zone"); return -ENOMEM; -- 2.7.4