From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by dpdk.org (Postfix) with ESMTP id 2039F8D8A for ; Fri, 6 Nov 2015 01:09:29 +0100 (CET) Received: by padhx2 with SMTP id hx2so94211657pad.1 for ; Thu, 05 Nov 2015 16:09:28 -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=o3yJxNUGW3wb6zAzyh6PRd2MGBMByMPHEgARJ3WxIEY=; b=PDWONFDqzjI3WacmZ4xEaHUExF4/CjG/ulM9bLWx1i8Azk7+w2BO3ascAq44U3BAji SLFDpKwOvEL4sLCqxFZ7/AnYUk24i62qXIMP5npN1VlZRZL3p+anIe8Gb0r1EAcLnzCw Z6ooM0dj1MN8j5LiNCP4qzuUEoIhTu2NMwbHXjM8AJtx+3ERZ4jT6XqLI+I23OoAMRGd +TVcfAeyqdk1ai5mQqboblFpeL2x4013jDUmXLwQMu6YLuMKO627v2Dt8ypxphJg94dl BIbFHXZOfvaoPX1F8FFuP4E3lBfQk4rJux6RpmqaJ1N+9U21SzHNgInsJYYAr5YeC+36 qdAQ== 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=o3yJxNUGW3wb6zAzyh6PRd2MGBMByMPHEgARJ3WxIEY=; b=V+e6iNvW/hf/ugln2DIEC0Lu3jjEbT0L6v/JCdLoCjnEnAoeHvlwaAM4mpKH8t/SIi QBmZ9+u7ejZJVaHG16/vZdGqZptBqah6cqJpj7ULVBIVxqURCUc+I1ZV4mcosm/6+Hl/ su9/sNhXyxdfHg53FNu/dY8nHnA+4+5v6+47rzi4+dS/nNqa3mD65GV39NxtlkZ/TLVc xPQIQYK2tImz+3N4uJ8XCEg1bxOh7uI58xv24yYsYOxHPt5niJU7m1alXC5rP2EqZjvf 5BiTeFx3VnT0lm2U6Mw0tJsmT2NxXjpz1KvNhbpgAdm4mBVhofY/vag28FDRLkOv2QYO /n8w== X-Gm-Message-State: ALoCoQlb7arMgJemRRFkSch/B0H4pEdF5kusSjnSwWqYxNEr4oyI/Rvlhjk14HGl8XoyQX1/bEEr X-Received: by 10.68.226.105 with SMTP id rr9mr13185744pbc.29.1446768568468; Thu, 05 Nov 2015 16:09:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 16:09:27 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Thu, 5 Nov 2015 16:09:32 -0800 Message-Id: <1446768574-32310-4-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 3/5] 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, 06 Nov 2015 00:09:29 -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 5561195..62b0737 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -1819,35 +1819,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, * **********************************************************************/ -/* - * 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) { @@ -2082,9 +2053,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); @@ -2114,11 +2085,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 */ @@ -2388,8 +2356,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); @@ -2418,11 +2386,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