From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 627D7B4E0 for ; Sat, 14 Feb 2015 20:25:21 +0100 (CET) Received: from [67.210.173.2] (helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1YMiL5-0001Q1-GH; Sat, 14 Feb 2015 14:25:19 -0500 Date: Sat, 14 Feb 2015 14:25:07 -0500 From: Neil Horman To: Stephen Hemminger Message-ID: <20150214192507.GA15594@neilslaptop.think-freely.org> References: <1423937208-2063-1-git-send-email-shemming@brocade.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423937208-2063-1-git-send-email-shemming@brocade.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org, Stephen Hemminger Subject: Re: [dpdk-dev] [PATCH 1/4] xen: allow choosing dom0 support at runtime 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: Sat, 14 Feb 2015 19:25:21 -0000 On Sat, Feb 14, 2015 at 01:06:45PM -0500, Stephen Hemminger wrote: > The previous code would only allow building library and application > so that it ran on Xen DOM0 or not on DOM0. This changes that to > a runtime flag. > > Signed-off-by: Stephen Hemminger > --- > lib/librte_eal/common/include/rte_memory.h | 4 +++ > lib/librte_eal/linuxapp/eal/eal_memory.c | 7 ++++ > lib/librte_ether/rte_ethdev.c | 22 ++++++++++++ > lib/librte_ether/rte_ethdev.h | 23 ++++++++++++ > lib/librte_mempool/rte_mempool.c | 26 +++++++------- > lib/librte_pmd_e1000/em_rxtx.c | 30 +++------------- > lib/librte_pmd_e1000/igb_rxtx.c | 52 +++++++++------------------ > lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 58 +++++++++--------------------- > 8 files changed, 108 insertions(+), 114 deletions(-) > > diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h > index 7f8103f..ab6c1ff 100644 > --- a/lib/librte_eal/common/include/rte_memory.h > +++ b/lib/librte_eal/common/include/rte_memory.h > @@ -176,6 +176,10 @@ unsigned rte_memory_get_nchannel(void); > unsigned rte_memory_get_nrank(void); > > #ifdef RTE_LIBRTE_XEN_DOM0 > + > +/**< Internal use only - should DOM0 memory mapping be used */ > +extern int is_xen_dom0_supported(void); > + > /** > * Return the physical address of elt, which is an element of the pool mp. > * > diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c > index a67a1b0..4afda2a 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_memory.c > +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c > @@ -98,6 +98,13 @@ > #include "eal_filesystem.h" > #include "eal_hugepages.h" > > +#ifdef RTE_LIBRTE_XEN_DOM0 > +int is_xen_dom0_supported(void) > +{ > + return internal_config.xen_dom0_support; > +} > +#endif > + > /** > * @file > * Huge page mapping under linux > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index ea3a1fb..457e0bc 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2825,6 +2825,27 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev, > } > rte_spinlock_unlock(&rte_eth_dev_cb_lock); > } > + > +const struct rte_memzone * > +rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name, > + uint16_t queue_id, size_t size, unsigned align, > + 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; > + > + return rte_memzone_reserve_bounded(z_name, size, > + socket_id, 0, align, RTE_PGSIZE_2M); > +} > + > #ifdef RTE_NIC_BYPASS > int rte_eth_dev_bypass_init(uint8_t port_id) > { > @@ -3003,6 +3024,7 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id) > (*dev->dev_ops->bypass_wd_reset)(dev); > return 0; > } > + Nit: I think you meant to remove that space. > #endif > > int > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 1200c1c..747acb5 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -3664,6 +3664,29 @@ int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_ty > int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type, > enum rte_filter_op filter_op, void *arg); > > +/** > + * 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. > + * > + * @param eth_dev > + * The *eth_dev* pointer is the address of the *rte_eth_dev* structure > + * @param name > + * The name of the memory zone > + * @param queue_id > + * The index of the queue to add to name > + * @param size > + * The sizeof of the memory area > + * @param align > + * Alignment for resulting memzone. Must be a power of 2. > + * @param socket_id > + * The *socket_id* argument is the socket identifier in case of NUMA. > + */ > +const struct rte_memzone * > +rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name, > + uint16_t queue_id, size_t size, > + unsigned align, int socket_id); I think this is an exported funciton right? It needs to be added to the version map. neil