From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by dpdk.org (Postfix) with ESMTP id 181AD8D8A for ; Fri, 6 Nov 2015 01:09:31 +0100 (CET) Received: by padhx2 with SMTP id hx2so94212516pad.1 for ; Thu, 05 Nov 2015 16:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ziuhr/gjGgPsGCkwj66u63YFRbuvXrbc2VZHtp17Mj8=; b=FE63TLWHTMxBNfVvdG0xBB5HS5IkUc/vANme2SeQMFiVGEJ8KwSvuEaok3mKbXJJz4 D2e/GYvyrG6T0Kc0YuovxjPlFPaJZT+MYyZeganxvbO4H3UMh/OpSwXVer0C8yXtNryw KbR2TMGfwwbaUcNyN6ip3NjukF5wdBJykVm9xlGqU0hcZqMGZ3TylAn2uKWrE6XNdc/M NrQzJcVUDUVDdtpRA0GA4edKF87jt9ds1G8BuK0EEBXH7cvk6TAEvdV9dwGIveha8Utp f+Iqcll1K/sYpGjVkVm7/DmsImioJB5i5FGo/BR2Xm7QzgGaZTAEhW8gLa7SMkOD6yP2 YV/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ziuhr/gjGgPsGCkwj66u63YFRbuvXrbc2VZHtp17Mj8=; b=CPhM775IFMOiMWIDqN98HHRWfv/zWhZn3f9ncJbAJxqSGmP1zzgHlXYXanmvoHUe6i KkTVg8UkzTjtkX4Ds9fL3W3gPO6faO5rUwykY4BKJDtCS8xoPG203ZqXhXpJfykugFKk pkFX/iLEvEXTXZi9FmfdWU23Eyu58gG3qIxgVjlSBqcxgXjLQlJxs7rgXdTCvi6LpAod sI4JfHL49K7uexBZapgBoTVWBNo2RewiAY0vaJWarPVEkAzvJHZeybCmxenmmmOjOyxE lsPyAKnok6fN6IqP/Zj+udRBjdBSt3uztNyN7Klk6DYB3WEgdZD3K7LRcrH5jVd8KtFJ cw2Q== X-Gm-Message-State: ALoCoQnnTNTvqJ25cI2/c/Xs0l6E0E0VcaolJlCf7R1GnJn110cpEnnR6M9B6uDszfhpDllhoRBl X-Received: by 10.68.163.195 with SMTP id yk3mr12813988pbb.120.1446768570413; Thu, 05 Nov 2015 16:09:30 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id rz9sm9963592pbb.61.2015.11.05.16.09.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 16:09:29 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Thu, 5 Nov 2015 16:09:34 -0800 Message-Id: <1446768574-32310-6-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446768574-32310-1-git-send-email-stephen@networkplumber.org> References: <1446768574-32310-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 5/5] fm10k: use rte_eth_dma_zone_reserve X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2015 00:09:31 -0000 Adapt to Xen at runtime. Signed-off-by: Stephen Hemminger --- drivers/net/fm10k/fm10k_ethdev.c | 48 +++++----------------------------------- 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index cf7ada7..441f713 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1492,34 +1492,6 @@ check_nb_desc(uint16_t min, uint16_t max, uint16_t mult, uint16_t request) return 0; } -/* - * Create a memzone for hardware descriptor rings. Malloc cannot be used since - * the physical address is required. If the memzone is already created, then - * this function returns a pointer to the existing memzone. - */ -static inline const struct rte_memzone * -allocate_hw_ring(const char *driver_name, const char *ring_name, - uint8_t port_id, uint16_t queue_id, int socket_id, - uint32_t size, uint32_t align) -{ - char name[RTE_MEMZONE_NAMESIZE]; - const struct rte_memzone *mz; - - snprintf(name, sizeof(name), "%s_%s_%d_%d_%d", - driver_name, ring_name, port_id, queue_id, socket_id); - - /* return the memzone if it already exists */ - mz = rte_memzone_lookup(name); - if (mz) - return mz; - -#ifdef RTE_LIBRTE_XEN_DOM0 - return rte_memzone_reserve_bounded(name, size, socket_id, 0, align, - RTE_PGSIZE_2M); -#else - return rte_memzone_reserve_aligned(name, size, socket_id, 0, align); -#endif -} static inline int check_thresh(uint16_t min, uint16_t max, uint16_t div, uint16_t request) @@ -1667,9 +1639,9 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, * enough to hold the maximum ring size is requested to allow for * resizing in later calls to the queue setup function. */ - mz = allocate_hw_ring(dev->driver->pci_drv.name, "rx_ring", - dev->data->port_id, queue_id, socket_id, - FM10K_MAX_RX_RING_SZ, FM10K_ALIGN_RX_DESC); + mz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_id, + FM10K_MAX_RX_RING_SZ, FM10K_ALIGN_RX_DESC, + socket_id); if (mz == NULL) { PMD_INIT_LOG(ERR, "Cannot allocate hardware ring"); rte_free(q->sw_ring); @@ -1677,11 +1649,7 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, return (-ENOMEM); } q->hw_ring = mz->addr; -#ifdef RTE_LIBRTE_XEN_DOM0 q->hw_ring_phys_addr = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr); -#else - q->hw_ring_phys_addr = mz->phys_addr; -#endif /* Check if number of descs satisfied Vector requirement */ if (!rte_is_power_of_2(nb_desc)) { @@ -1831,9 +1799,9 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, * enough to hold the maximum ring size is requested to allow for * resizing in later calls to the queue setup function. */ - mz = allocate_hw_ring(dev->driver->pci_drv.name, "tx_ring", - dev->data->port_id, queue_id, socket_id, - FM10K_MAX_TX_RING_SZ, FM10K_ALIGN_TX_DESC); + mz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_id, + FM10K_MAX_TX_RING_SZ, FM10K_ALIGN_TX_DESC, + socket_id); if (mz == NULL) { PMD_INIT_LOG(ERR, "Cannot allocate hardware ring"); rte_free(q->sw_ring); @@ -1841,11 +1809,7 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, return (-ENOMEM); } q->hw_ring = mz->addr; -#ifdef RTE_LIBRTE_XEN_DOM0 q->hw_ring_phys_addr = rte_mem_phy2mch(mz->memseg_id, mz->phys_addr); -#else - q->hw_ring_phys_addr = mz->phys_addr; -#endif /* * allocate memory for the RS bit tracker. Enough slots to hold the -- 2.1.4