xen: allow choosing dom0 support at runtime
PATCH 1/4 xen: allow choosing dom0 support at runtime
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.
--- 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(-)
lib/librte_eal/common/include/rte_memory.h +4 -0
@@ -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. *
lib/librte_eal/linuxapp/eal/eal_memory.c +7 -0
@@ -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
lib/librte_ether/rte_ethdev.c +22 -0
@@ -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; } +#endif int
lib/librte_ether/rte_ethdev.h +23 -0
@@ -3664,6 +3664,29 @@ int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_tyint 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); #ifdef __cplusplus }#endif
lib/librte_mempool/rte_mempool.c +14 -12
@@ -372,19 +372,21 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size, int socket_id, unsigned flags) {#ifdef RTE_LIBRTE_XEN_DOM0 -return (rte_dom0_mempool_create (name, n, elt_size, - cache_size, private_data_size, - mp_init, mp_init_arg, - obj_init, obj_init_arg, - socket_id, flags)); -#else -return (rte_mempool_xmem_create (name, n, elt_size, - cache_size, private_data_size, - mp_init, mp_init_arg, - obj_init, obj_init_arg, - socket_id, flags, -NULL ,NULL ,MEMPOOL_PG_NUM_DEFAULT ,MEMPOOL_PG_SHIFT_MAX )); +if (is_xen_dom0_supported ()) +return (rte_dom0_mempool_create (name, n, elt_size, + cache_size, private_data_size, + mp_init, mp_init_arg, + obj_init, obj_init_arg, + socket_id, flags)); + else#endif +return (rte_mempool_xmem_create (name, n, elt_size, + cache_size, private_data_size, + mp_init, mp_init_arg, + obj_init, obj_init_arg, + socket_id, flags, +NULL ,NULL ,MEMPOOL_PG_NUM_DEFAULT , +MEMPOOL_PG_SHIFT_MAX )); }/*
lib/librte_pmd_e1000/em_rxtx.c +4 -26
@@ -1104,28 +1104,6 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,#define EM_MAX_BUF_SIZE 16384#define EM_RCTL_FLXBUF_STEP 1024 -static const struct rte_memzone * -ring_dma_zone_reserve (struct rte_eth_dev *dev,const char *ring_name, -uint16_t queue_id,uint32_t ring_size,int socket_id) -{ -const struct rte_memzone *mz; -char z_name[RTE_MEMZONE_NAMESIZE ]; - -snprintf (z_name,sizeof (z_name),"%s_%s_%d_%d" , - dev->driver->pci_drv.name, ring_name, dev->data->port_id, - queue_id); - -if ((mz =rte_memzone_lookup (z_name)) !=0 ) -return (mz); - -#ifdef RTE_LIBRTE_XEN_DOM0 -return rte_memzone_reserve_bounded (z_name, ring_size, - socket_id,0 ,RTE_CACHE_LINE_SIZE ,RTE_PGSIZE_2M ); -#else -return rte_memzone_reserve (z_name, ring_size, socket_id,0 ); -#endif -} -static void em_tx_queue_release_mbufs (struct em_tx_queue *txq) {
@@ -1273,8 +1251,8 @@ eth_em_tx_queue_setup(struct rte_eth_dev *dev,* resizing in later calls to the queue setup function. */ tsize =sizeof (txq->tx_ring[0 ]) *EM_MAX_RING_DESC ; -if ((tz =ring_dma_zone_reserve (dev,"tx_ring" , queue_idx, tsize, - socket_id)) ==NULL ) +if ((tz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_idx, tsize, +RTE_CACHE_LINE_SIZE , socket_id)) ==NULL )return (-ENOMEM );/* Allocate the tx queue data structure. */
@@ -1400,8 +1378,8 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,/* Allocate RX ring for max possible mumber of hardware descriptors. */ rsize =sizeof (rxq->rx_ring[0 ]) *EM_MAX_RING_DESC ; -if ((rz =ring_dma_zone_reserve (dev,"rx_ring" , queue_idx, rsize, - socket_id)) ==NULL ) +if ((rz =rte_eth_dma_zone_reserve (dev,"rx_ring" , queue_idx, rsize, +RTE_CACHE_LINE_SIZE , socket_id)) ==NULL )return (-ENOMEM );/* Allocate the RX queue data structure. */
lib/librte_pmd_e1000/igb_rxtx.c +17 -35
84 lines not on this page · raw message
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +17 -41
91 lines not on this page · raw message
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1423937208-2063-1-git-send-email-shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org
PATCH 2/4 xen: add phys-addr command line argument
Allow overriding default Xen DOM0 behavior to
use physical addresses insted of mfn.
--- lib/librte_eal/common/eal_common_options.c | 5 +++++ lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/common/include/rte_memory.h | 3 +++ lib/librte_eal/linuxapp/eal/eal_memory.c | 5 +++++ lib/librte_mempool/rte_dom0_mempool.c | 10 ++++++++-- 6 files changed, 24 insertions(+), 2 deletions(-)
lib/librte_eal/common/eal_common_options.c +5 -0
@@ -83,6 +83,7 @@ eal_long_options[] = { {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM}, {OPT_BASE_VIRTADDR, 1, 0, OPT_BASE_VIRTADDR_NUM}, {OPT_XEN_DOM0, 0, 0, OPT_XEN_DOM0_NUM}, + {OPT_XEN_PHYS_ADDR, 0, 0, OPT_XEN_PHYS_ADDR_NUM}, {OPT_CREATE_UIO_DEV, 1, NULL, OPT_CREATE_UIO_DEV_NUM}, {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM}, {0, 0, 0, 0}
@@ -491,6 +492,10 @@ eal_parse_common_option(int opt, const char *optarg, } conf->log_level = log;break ; + +case OPT_XEN_PHYS_ADDR_NUM : + conf->xen_phys_addr_support =1 ; +break ; }/* don't know what to do, leave this to caller */
lib/librte_eal/common/eal_internal_cfg.h +1 -0
@@ -65,6 +65,7 @@ struct internal_config {volatile unsigned force_nrank;/**< force number of ranks */ volatile unsigned no_hugetlbfs;/**< true to disable hugetlbfs */ volatile unsigned xen_dom0_support;/**< support app running on Xen Dom0*/ +volatile unsigned xen_phys_addr_support;/**< support phys addr */ volatile unsigned no_pci;/**< true to disable PCI */ volatile unsigned no_hpet;/**< true to disable HPET */ volatile unsigned vmware_tsc_map;/**< true to use VMware TSC mapping
lib/librte_eal/common/eal_options.h +2 -0
@@ -73,6 +73,8 @@ enum {OPT_BASE_VIRTADDR_NUM , #define OPT_XEN_DOM0 "xen-dom0"OPT_XEN_DOM0_NUM , +#define OPT_XEN_PHYS_ADDR "xen-phys-addr" +OPT_XEN_PHYS_ADDR_NUM , #define OPT_CREATE_UIO_DEV "create-uio-dev"OPT_CREATE_UIO_DEV_NUM , #define OPT_VFIO_INTR "vfio-intr"
lib/librte_eal/common/include/rte_memory.h +3 -0
@@ -180,6 +180,9 @@ unsigned rte_memory_get_nrank(void);/**< Internal use only - should DOM0 memory mapping be used */ extern int is_xen_dom0_supported (void ); +/**< Internal use only - should DOM0 use physical addresses insted of mfn */ +extern int is_xen_phys_addr_supported (void ); +/** * Return the physical address of elt, which is an element of the pool mp. *
lib/librte_eal/linuxapp/eal/eal_memory.c +5 -0
@@ -103,6 +103,11 @@ int is_xen_dom0_supported(void) {return internal_config.xen_dom0_support; } + +int is_xen_phys_addr_supported (void ) +{ +return internal_config.xen_phys_addr_support; +}#endif /**
lib/librte_mempool/rte_dom0_mempool.c +8 -2
@@ -74,8 +74,14 @@ get_phys_map(void *va, phys_addr_t pa[], uint32_t pg_num, virt_addr =(uintptr_t ) mcfg->memseg[memseg_id].addr;for (i =0 ; i != pg_num; i++) { - mfn_id = ((uintptr_t )va + i * pg_sz - virt_addr) /RTE_PGSIZE_2M ; - pa[i] = mcfg->memseg[memseg_id].mfn[mfn_id] * page_size; +if (!is_xen_phys_addr_supported ()) { + mfn_id = ((uintptr_t )va + i * pg_sz - + virt_addr) /RTE_PGSIZE_2M ; + pa[i] = mcfg->memseg[memseg_id].mfn[mfn_id] * page_size; + }else { + pa[i] = mcfg->memseg[memseg_id].phys_addr + i * pg_sz + + (uintptr_t )va - virt_addr; + } } }
Signature · 1 line
2.1.4
PATCH 3/4 xen: add uio driver
In reply to a message not in the archiveNew uio helper kernel driver for use by Xen netfront UIO poll mode driver.
--- lib/librte_eal/linuxapp/Makefile | 3 + lib/librte_eal/linuxapp/xen_uio/Makefile | 55 ++ lib/librte_eal/linuxapp/xen_uio/xen_uio.c | 837 ++++++++++++++++++++++++++++++ 3 files changed, 895 insertions(+) create mode 100644 lib/librte_eal/linuxapp/xen_uio/Makefile create mode 100644 lib/librte_eal/linuxapp/xen_uio/xen_uio.c
lib/librte_eal/linuxapp/Makefile +3 -0
@@ -41,5 +41,8 @@ endif ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y) DIRS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += xen_dom0 endif +ifeq ($(CONFIG_RTE_LIBRTE_XEN_PMD),y) +DIRS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += xen_uio +endif include $(RTE_SDK)/mk/rte.subdir.mk
lib/librte_eal/linuxapp/xen_uio/Makefile new file +55 -0
55 lines not on this page · raw message
lib/librte_eal/linuxapp/xen_uio/xen_uio.c new file +837 -0
837 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 4/4 xen: net-front poll mode driver
In reply to a message not in the archiveThis driver implements DPDK driver that has the same functionality as net-front driver in Linux kernel.
--- config/common_linuxapp | 6 + lib/Makefile | 1 + lib/librte_eal/common/eal_private.h | 7 + lib/librte_eal/linuxapp/eal/eal.c | 8 + lib/librte_pmd_xen/Makefile | 30 ++ lib/librte_pmd_xen/virt_dev.c | 400 +++++++++++++++++++++++++ lib/librte_pmd_xen/virt_dev.h | 30 ++ lib/librte_pmd_xen/xen_adapter_info.h | 64 ++++ lib/librte_pmd_xen/xen_dev.c | 369 +++++++++++++++++++++++ lib/librte_pmd_xen/xen_dev.h | 96 ++++++ lib/librte_pmd_xen/xen_logs.h | 23 ++ lib/librte_pmd_xen/xen_rxtx.c | 546 ++++++++++++++++++++++++++++++++++ lib/librte_pmd_xen/xen_rxtx.h | 110 +++++++ mk/rte.app.mk | 4 + 14 files changed, 1694 insertions(+) create mode 100644 lib/librte_pmd_xen/Makefile create mode 100644 lib/librte_pmd_xen/virt_dev.c create mode 100644 lib/librte_pmd_xen/virt_dev.h create mode 100644 lib/librte_pmd_xen/xen_adapter_info.h create mode 100644 lib/librte_pmd_xen/xen_dev.c create mode 100644 lib/librte_pmd_xen/xen_dev.h create mode 100644 lib/librte_pmd_xen/xen_logs.h create mode 100644 lib/librte_pmd_xen/xen_rxtx.c create mode 100644 lib/librte_pmd_xen/xen_rxtx.h
config/common_linuxapp +6 -0
@@ -232,6 +232,12 @@ CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y CONFIG_RTE_LIBRTE_PMD_XENVIRT=n # +# Compile XEN net-front PMD driver +# +CONFIG_RTE_LIBRTE_XEN_PMD=n +CONFIG_RTE_LIBRTE_XEN_DEBUG_INIT=n + +# # Do prefetch of packet data within PMD driver receive function # CONFIG_RTE_PMD_PACKET_PREFETCH=y
lib/Makefile +1 -0
@@ -52,6 +52,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += librte_pmd_af_packet DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += librte_pmd_virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += librte_pmd_vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += librte_pmd_xenvirt +DIRS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += librte_pmd_xen DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
lib/librte_eal/common/eal_private.h +7 -0
@@ -128,6 +128,13 @@ int rte_eal_log_init(const char *id, int facility);*/ int rte_eal_pci_init (void ); +#ifdef RTE_LIBRTE_XEN_PMD +/** +* Init of the xen driver +*/ +extern int rte_xen_pmd_init (void ); +#endif +#ifdef RTE_LIBRTE_IVSHMEM /** * Init the memory from IVSHMEM devices
lib/librte_eal/linuxapp/eal/eal.c +8 -0
@@ -760,6 +760,14 @@ rte_eal_init(int argc, char **argv)rte_panic ("Cannot init IVSHMEM\n" );#endif +#ifdef RTE_LIBRTE_XEN_PMD + ret =rte_xen_pmd_init (); +if (ret !=0 ) { +RTE_LOG (ERR ,PMD ,"Cannot init xen PMD\n" ); +return ret; + } +#endif /* RTE_LIBRTE_XEN_PMD */ +if (rte_eal_memory_init () <0 )rte_panic ("Cannot init memory\n" );
lib/librte_pmd_xen/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +# +# Copyright (c) 2013-2015 Brocade Communications Systems, Inc. +# All rights reserved. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_xen.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +VPATH += $(RTE_SDK)/lib/librte_pmd_xen + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += virt_dev.c +SRCS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += xen_dev.c +SRCS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += xen_rxtx.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += lib/librte_eal lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += lib/librte_mempool lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_XEN_PMD) += lib/librte_net lib/librte_malloc + +include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pmd_xen/virt_dev.c new file +400 -0
400 lines not on this page · raw message
lib/librte_pmd_xen/virt_dev.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (c) 2013-2015 Brocade Communications Systems, Inc. +* All rights reserved. +*/ + +#ifndef _VIRT_ETHDEV_H_ +#define _VIRT_ETHDEV_H_ + +struct virt_eth_driver ; + +typedef int (*virt_is_eth_device_dir_t )(const char *dir); +typedef int (*virt_eth_dev_init_t )(struct virt_eth_driver *virt_eth_drv, +struct rte_eth_dev *dev,const char *dirname); + +struct virt_eth_driver { +struct eth_driver eth_driver; +const char *sysfs_bind_dir; +const char *sysfs_unbind_dir; +virt_is_eth_device_dir_t is_eth_device_dir; +virt_eth_dev_init_t virt_eth_dev_init; +const char *module_name; +}; + +int virt_eth_driver_register (struct virt_eth_driver *virt_eth_drv); +int virt_uio_map_addresses (const char *dirname,void **addresses, +size_t *lens,int max_addresses); +void virt_uio_unmap_addresses (void **addresses, +size_t *lens,int max_addresses); + +#endif /* _VIRT_ETHDEV_H_ */
lib/librte_pmd_xen/xen_adapter_info.h new file +64 -0
64 lines not on this page · raw message
lib/librte_pmd_xen/xen_dev.c new file +369 -0
369 lines not on this page · raw message
lib/librte_pmd_xen/xen_dev.h new file +96 -0
96 lines not on this page · raw message
lib/librte_pmd_xen/xen_logs.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef _XEN_LOGS_H_ +#define _XEN_LOGS_H_ + + +#ifdef RTE_LIBRTE_XEN_DEBUG_INIT + +#define PMD_INIT_LOG(level, fmt, args...) \ + do { \ + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args);\ + fflush(stdout);\ + } while (0) + +#else + +#define PMD_INIT_LOG(level, fmt, args...) \ + do { } while (0) + +#endif + +#define PMD_INIT_FUNC_TRACE () \ + PMD_INIT_LOG(DEBUG, " >>") + +#endif /* _XEN_LOGS_H_ */
lib/librte_pmd_xen/xen_rxtx.c new file +546 -0
546 lines not on this page · raw message
lib/librte_pmd_xen/xen_rxtx.h new file +110 -0
110 lines not on this page · raw message
mk/rte.app.mk +4 -0
@@ -192,6 +192,10 @@ LDLIBS += -lrte_pmd_xenvirt LDLIBS += -lxenstore endif +ifeq ($(CONFIG_RTE_LIBRTE_XEN_PMD),y) +LDLIBS += -lrte_pmd_xen +endif + ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries)
Signature · 1 line
2.1.4
A message that is not in the archive (sent off-list or not yet received): 1423937208-2063-4-git-send-email-shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org
Re: [PATCH 4/4] xen: net-front poll mode driver
Quoted 37 lines · Stephen Hemminger
This driver implements DPDK driver that has the same functionality as net-front driver in Linux kernel.
Signed-off-by Stephen Hemminger <[email protected]>--- config/common_linuxapp | 6 + lib/Makefile | 1 + lib/librte_eal/common/eal_private.h | 7 + lib/librte_eal/linuxapp/eal/eal.c | 8 + lib/librte_pmd_xen/Makefile | 30 ++ lib/librte_pmd_xen/virt_dev.c | 400 +++++++++++++++++++++++++ lib/librte_pmd_xen/virt_dev.h | 30 ++ lib/librte_pmd_xen/xen_adapter_info.h | 64 ++++ lib/librte_pmd_xen/xen_dev.c | 369 +++++++++++++++++++++++ lib/librte_pmd_xen/xen_dev.h | 96 ++++++ lib/librte_pmd_xen/xen_logs.h | 23 ++ lib/librte_pmd_xen/xen_rxtx.c | 546 ++++++++++++++++++++++++++++++++++ lib/librte_pmd_xen/xen_rxtx.h | 110 +++++++ mk/rte.app.mk | 4 + 14 files changed, 1694 insertions(+) create mode 100644 lib/librte_pmd_xen/Makefile create mode 100644 lib/librte_pmd_xen/virt_dev.c create mode 100644 lib/librte_pmd_xen/virt_dev.h create mode 100644 lib/librte_pmd_xen/xen_adapter_info.h create mode 100644 lib/librte_pmd_xen/xen_dev.c create mode 100644 lib/librte_pmd_xen/xen_dev.h create mode 100644 lib/librte_pmd_xen/xen_logs.h create mode 100644 lib/librte_pmd_xen/xen_rxtx.c create mode 100644 lib/librte_pmd_xen/xen_rxtx.h<snip>
lib/librte_pmd_xen/xen_dev.c new file +7
-0+ +int +rte_xen_pmd_init (void ) +{ +PMD_INIT_FUNC_TRACE (); + + xen_evt_fd =open ("/dev/" XEN_PMD_UIO_NAME ,O_RDWR );
lib/librte_pmd_xen/xen_dev.c line 369
Quoted 10 lines
lib/librte_pmd_xen/xen_dev.c new file +10
-0+ +if (xen_evt_fd ==-1 ) { +if (errno !=ENOENT ) +PMD_INIT_LOG (ERR ,"cannot open event device %s" , +"/dev/" XEN_PMD_UIO_NAME ); +return 0 ; + } + +return virt_eth_driver_register (&rte_xen_pmd); +}
It looks like you've created a new method of registering a pmd here? Why not use the existing REGISTER_PMD_DRIVER macro? It seems like this method will break the DSO build.
Neil
Quoted 1 line
Quoted 82 lines · Stephen Hemminger
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 <[email protected]>--- 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(-)lib/librte_eal/common/include/rte_memory.h +4
-0@@ -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. * lib/librte_eal/linuxapp/eal/eal_memory.c +7
-0@@ -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 lib/librte_ether/rte_ethdev.c +21
-0@@ -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) {
lib/librte_ether/rte_ethdev.c rte_eth_dev_bypass_wd_reset(uint8_t port_id) · line 3027
Quoted 4 lines
lib/librte_ether/rte_ethdev.c +1
-0@@ -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.
Quoted 24 lines
lib/librte_ether/rte_ethdev.c +0
-0#endif int lib/librte_ether/rte_ethdev.h +13
-0@@ -3664,6 +3664,29 @@ int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_tyint 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
lib/librte_ether/rte_ethdev.h int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_ty · line 3689
Quoted 10 lines
lib/librte_ether/rte_ethdev.h +10
-0+* 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