From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by dpdk.org (Postfix) with ESMTP id 8F75156B7 for ; Tue, 29 Sep 2015 02:44:48 +0200 (CEST) Received: by pablk4 with SMTP id lk4so91651788pab.3 for ; Mon, 28 Sep 2015 17:44:48 -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=lPGdWkdo5/2lRgFY5/uegHDiVJNhcq0aHjiZxWbn4h7yN8UI0pfEr/1D/DfroA9tVU pdaECiy7Z5oiFeXXY7DkrLuXKEdjZCtHQltZfWR8HxogL0H/MD8V0Puy2yEiFcnxs7Sl eK4snl2cAxF6T8+vDrjtPPdbHgzXz/EhHBYu+YLLKA6p20+lQDKISE0T0P8wzwe3jwB7 PpB6oq40QjrhiEOHCjdxerM2f2yFQ0sbGIDtjgKaHHWQybgfzipeumJIjZgxg6GKzcqF QKyitG988kRuaf+4Mx0J8kt4yCpdTADtA9CGUCqDkT7IJQNrpn9R6R1vCLGHHS/hSEtZ gP3g== X-Gm-Message-State: ALoCoQmBV2LJZJbbO+ATqFl3IxSnSen54T/jS9Ln7QyEMzxhQn5Hk6lfnEaydnqZ8agDd76CUS0n X-Received: by 10.66.120.80 with SMTP id la16mr1469749pab.1.1443487487954; Mon, 28 Sep 2015 17:44:47 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id sl7sm21702971pbc.54.2015.09.28.17.44.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Sep 2015 17:44:47 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Mon, 28 Sep 2015 17:44:45 -0700 Message-Id: <1443487487-31915-5-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443487487-31915-1-git-send-email-stephen@networkplumber.org> References: <1443487487-31915-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: Tue, 29 Sep 2015 00:44:49 -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