From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by dpdk.org (Postfix) with ESMTP id AB07FC482 for ; Fri, 23 Oct 2015 08:34:47 +0200 (CEST) Received: by pacfv9 with SMTP id fv9so114571405pac.3 for ; Thu, 22 Oct 2015 23:34:47 -0700 (PDT) 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=EkEDkLWvBRHo54xh4DlQH5UGlnSTQvU9ZaIqneW//+k=; b=G7fIxn89oZj+0n4u6tuvWaFINKntIiQtOmb/YABu0aRVkj+IykTTV+imxTy/Q3YOOJ hV36s9JxiZE39kiTlEMSlHZb5n4zcGhVAsd8bvBXY1NIlR2EFSa57hqh5VUj2oHNNvNh UUDwYgvBVRVARD+0+wYbalvVKJcH336jlG0Gy9PsK2LytgnhbCskZ3fLxB11boyRpvah SrWWlFRqp472PrU84YwJReq0gDXl6ogtCUpWpZNLnbj3nYlJjy08DE66rYCUU3gbDJnU 91pduUDM3RCkIW304Nq3a7pqt7bcxTXhwAzz8YnK8zEkejVL8QUZCMDn38OdyVjyxVPM Zo3Q== X-Gm-Message-State: ALoCoQn47/zzMkmGf8l/+OJSwwNvZZWnjNgtt8U4eEHAWoEeBs5Sy79Q001WLQ/kwnhsBWXGP91v X-Received: by 10.66.164.10 with SMTP id ym10mr2914795pab.26.1445582087083; Thu, 22 Oct 2015 23:34:47 -0700 (PDT) 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 ot8sm17078910pbb.26.2015.10.22.23.34.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Oct 2015 23:34:46 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Thu, 22 Oct 2015 23:34:48 -0700 Message-Id: <1445582090-5927-5-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445582090-5927-1-git-send-email-stephen@networkplumber.org> References: <1445582090-5927-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 4/6] ixgbe: 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, 23 Oct 2015 06:34:48 -0000 Adapt DMA memory for Xen at runtime. Signed-off-by: Stephen Hemminger --- drivers/net/ixgbe/ixgbe_rxtx.c | 47 ++++++------------------------------------ 1 file changed, 6 insertions(+), 41 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index a598a72..b6cbb64 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1839,35 +1839,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, #define IXGBE_MIN_RING_DESC 32 #define IXGBE_MAX_RING_DESC 4096 -/* - * Create memzone for HW 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 * __attribute__((cold)) -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.name, ring_name, - dev->data->port_id, queue_id); - - mz = rte_memzone_lookup(z_name); - if (mz) - return mz; - -#ifdef RTE_LIBRTE_XEN_DOM0 - return rte_memzone_reserve_bounded(z_name, ring_size, - socket_id, 0, IXGBE_ALIGN, RTE_PGSIZE_2M); -#else - return rte_memzone_reserve_aligned(z_name, ring_size, - socket_id, 0, IXGBE_ALIGN); -#endif -} - static void __attribute__((cold)) ixgbe_tx_queue_release_mbufs(struct ixgbe_tx_queue *txq) { @@ -2102,9 +2073,9 @@ ixgbe_dev_tx_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, "tx_ring", queue_idx, + tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx, sizeof(union ixgbe_adv_tx_desc) * IXGBE_MAX_RING_DESC, - socket_id); + IXGBE_ALIGN, socket_id); if (tz == NULL) { ixgbe_tx_queue_release(txq); return (-ENOMEM); @@ -2134,11 +2105,8 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, IXGBE_VFTDT(queue_idx)); else txq->tdt_reg_addr = IXGBE_PCI_REG_ADDR(hw, IXGBE_TDT(txq->reg_idx)); -#ifndef RTE_LIBRTE_XEN_DOM0 - txq->tx_ring_phys_addr = (uint64_t) tz->phys_addr; -#else + txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz->phys_addr); -#endif txq->tx_ring = (union ixgbe_adv_tx_desc *) tz->addr; /* Allocate software ring */ @@ -2408,8 +2376,8 @@ ixgbe_dev_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. */ - rz = ring_dma_zone_reserve(dev, "rx_ring", queue_idx, - RX_RING_SZ, socket_id); + rz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx, + RX_RING_SZ, IXGBE_ALIGN, socket_id); if (rz == NULL) { ixgbe_rx_queue_release(rxq); return (-ENOMEM); @@ -2438,11 +2406,8 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev, rxq->rdh_reg_addr = IXGBE_PCI_REG_ADDR(hw, IXGBE_RDH(rxq->reg_idx)); } -#ifndef RTE_LIBRTE_XEN_DOM0 - rxq->rx_ring_phys_addr = (uint64_t) rz->phys_addr; -#else + rxq->rx_ring_phys_addr = rte_mem_phy2mch(rz->memseg_id, rz->phys_addr); -#endif rxq->rx_ring = (union ixgbe_adv_rx_desc *) rz->addr; /* -- 2.1.4