xen: allow choosing dom0 support at runtime
Subsystems (2)
PATCH 1/5 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.
---
v2 -- fix i40e as well
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_i40e/i40e_ethdev.c | 16 +++++---- lib/librte_pmd_i40e/i40e_fdir.c | 8 +++-- lib/librte_pmd_i40e/i40e_rxtx.c | 57 +++++++++++++++++------------ lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 58 +++++++++--------------------- 11 files changed, 156 insertions(+), 147 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_i40e/i40e_ethdev.c +9 -7
@@ -1979,11 +1979,12 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw, id++;snprintf (z_name,sizeof (z_name),"i40e_dma_%" PRIu64, id);#ifdef RTE_LIBRTE_XEN_DOM0 - mz =rte_memzone_reserve_bounded (z_name, size,0 ,0 , alignment, -RTE_PGSIZE_2M ); -#else - mz =rte_memzone_reserve_aligned (z_name, size,0 ,0 , alignment); +if (is_xen_dom0_supported ()) + mz =rte_memzone_reserve_bounded (z_name, size,0 ,0 , alignment, +RTE_PGSIZE_2M ); + else#endif + mz =rte_memzone_reserve_aligned (z_name, size,0 ,0 , alignment);if (!mz)return I40E_ERR_NO_MEMORY ;
@@ -1991,10 +1992,11 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw, mem->size = size; mem->va = mz->addr;#ifdef RTE_LIBRTE_XEN_DOM0 - mem->pa =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); -#else - mem->pa = mz->phys_addr; +if (is_xen_dom0_supported ()) + mem->pa =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); + else#endif + mem->pa = mz->phys_addr;return I40E_SUCCESS ; }
lib/librte_pmd_i40e/i40e_fdir.c +5 -3
@@ -274,10 +274,12 @@ i40e_fdir_setup(struct i40e_pf *pf) } pf->fdir.prg_pkt = mz->addr;#ifdef RTE_LIBRTE_XEN_DOM0 - pf->fdir.dma_addr =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); -#else - pf->fdir.dma_addr = (uint64_t )mz->phys_addr; +if (is_xen_dom0_supported ()) + pf->fdir.dma_addr =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); + else#endif + pf->fdir.dma_addr = (uint64_t )mz->phys_addr; + pf->fdir.match_counter_index =I40E_COUNTER_INDEX_FDIR (hw->pf_id);PMD_DRV_LOG (INFO ,"FDIR setup successfully, with programming queue %u." , vsi->base_queue);
lib/librte_pmd_i40e/i40e_rxtx.c +34 -23
98 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
PATCH 2/5 enic: fix device to work with Xen DOM0
In reply to a message not in the archiveIt is possible to passthrough a PCI device when running in Xen Paravirt mode. The device driver has to accomodate by using memory zones differently. This patch models the memory allocation for ENIC device based on changes already done for ixgbe and igb.
Build tested only; has not been tested on ENIC hardware.
---
v2 -- this patch is added
lib/librte_pmd_enic/enic_main.c | 19 ++++++++++++++++--- lib/librte_pmd_enic/vnic/vnic_dev.c | 19 +++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-)
lib/librte_pmd_enic/enic_main.c +16 -3
@@ -537,8 +537,14 @@ enic_alloc_consistent(__rte_unused void *priv, size_t size,const struct rte_memzone *rz; *dma_handle =0 ; - rz =rte_memzone_reserve_aligned ((const char *)name, - size,0 ,0 ,ENIC_ALIGN ); +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + rz =rte_memzone_reserve_bounded ((char *)name, size, +0 ,0 ,ENIC_ALIGN ,RTE_PGSIZE_2M ); + else +#endif + rz =rte_memzone_reserve_aligned ((char *)name, size, +0 ,0 ,ENIC_ALIGN );if (!rz) {pr_err ("%s : Failed to allocate memory requested for %s" , __func__, name);
@@ -546,7 +552,14 @@ enic_alloc_consistent(__rte_unused void *priv, size_t size, } vaddr = rz->addr; - *dma_handle = (dma_addr_t )rz->phys_addr; + +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + *dma_handle =rte_mem_phy2mch (rz->memseg_id, + rz->phys_addr); + else +#endif + *dma_handle = (dma_addr_t )rz->phys_addr;return vaddr; }
lib/librte_pmd_enic/vnic/vnic_dev.c +15 -4
@@ -276,9 +276,14 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused)) struct vnic_dev *vdev,vnic_dev_desc_ring_size (ring, desc_count, desc_size); - rz =rte_memzone_reserve_aligned (z_name, - ring->size_unaligned, socket_id, -0 ,ENIC_ALIGN ); +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + rz =rte_memzone_reserve_bounded (z_name, ring->size_unaligned, + socket_id,0 ,ENIC_ALIGN ,RTE_PGSIZE_2M ); + else +#endif + rz =rte_memzone_reserve_aligned (z_name, ring->size_unaligned, + socket_id,0 ,ENIC_ALIGN );if (!rz) {pr_err ("Failed to allocate ring (size=%d), aborting\n" , (int )ring->size);
@@ -292,7 +297,13 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused)) struct vnic_dev *vdev,return -ENOMEM ; } - ring->base_addr_unaligned = (dma_addr_t )rz->phys_addr; +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + ring->base_addr_unaligned =rte_mem_phy2mch (rz->memseg_id, + rz->phys_addr); + else +#endif + ring->base_addr_unaligned = (dma_addr_t )rz->phys_addr; ring->base_addr =ALIGN (ring->base_addr_unaligned, ring->base_align);
Signature · 1 line
2.1.4
PATCH 3/5 xen: add phys-addr command line argument
In reply to a message not in the archiveAllow overriding default Xen DOM0 behavior to
use physical addresses insted of mfn
---
v2 -- no changes
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 4/5 xen: add uio driver
In reply to a message not in the archiveNew uio helper kernel driver for Xen netfront UIO poll mode driver.
---
v2 -- use PMD_REGISTER
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 5/5 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.
---
v2 -- no changes
config/common_linuxapp | 6 + lib/Makefile | 1 + 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 | 375 +++++++++++++++++++++++ lib/librte_pmd_xen/xen_dev.h | 97 ++++++ 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 + 12 files changed, 1686 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_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 +375 -0
375 lines not on this page · raw message
lib/librte_pmd_xen/xen_dev.h new file +97 -0
97 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
Re: [PATCH 3/5] xen: add phys-addr command line argument
In reply to a message not in the archiveQuoted 11 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Sunday, February 15, 2015 11:25 PM
To: [email protected]
Cc: Stephen Hemminger
Subject: [dpdk-dev] [PATCH 3/5] xen: add phys-addr command line argumentAllow overriding default Xen DOM0 behavior to use physical addresses insted of mfn
If the application is built with DOM0 support , the application will run in non Dom0 environment when using the new argument, correct?
Quoted 120 lines
Signed-off-by Stephen Hemminger <[email protected]>---
v2 -- no changeslib/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 */ diff --git
a/lib/librte_eal/common/eal_internal_cfg.hb/lib/librte_eal/common/eal_internal_cfg.h
index e2ecb0d..41b4169 100644lib/librte_eal/common/eal_internal_cfg.h +0
-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*/
lib/librte_eal/common/eal_internal_cfg.h +1
-0+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 diff --git
a/lib/librte_eal/common/eal_options.hb/lib/librte_eal/common/eal_options.h
index e476f8d..8aee959 100644lib/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 +0
-0@@ -180,6 +180,9 @@ unsigned rte_memory_get_nrank(void); /**< Internaluse only - should DOM0 memory mapping be used */ extern int
is_xen_dom0_supported(void);lib/librte_eal/common/include/rte_memory.h +3
-0+/**< 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
-3@@ -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; + } } } --2.1.4
Re: [PATCH 3/5] xen: add phys-addr command line argument
In reply to a message not in the archiveQuoted 1 line · Jijiang
If the application is built with DOM0 support , the application will run in non Dom0 environment when using the new argument, correct?
Yes.
Our startup script has
if [ -d /proc/xen ] ; then
log_progress_msg "xen_uio"
modprobe xen_uio
if [ "$(cat /proc/xen/domain)" == "pv" ]; then
log_progress_msg "rte_dom0_mm" modprobe rte_dom0_mm xen_phys_addr=y set_domU_memsize XEN_ARGS="--xen-dom0 --xen-phys-addr"
fi
fi
Liu, Jijiang
Acked-byQuoted 626 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Sunday, February 15, 2015 11:25 PM
To: [email protected]
Cc: Stephen Hemminger
Subject: [dpdk-dev] [PATCH 1/5] xen: allow choosing dom0 support at runtimeThe 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]>---
v2 -- fix i40e as welllib/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_i40e/i40e_ethdev.c | 16 +++++---- lib/librte_pmd_i40e/i40e_fdir.c | 8 +++-- lib/librte_pmd_i40e/i40e_rxtx.c | 57 +++++++++++++++++------------ lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 58 +++++++++--------------------- 11 files changed, 156 insertions(+), 147 deletions(-)lib/librte_eal/common/include/rte_memory.h +4
-0@@ -176,6 +176,10 @@ unsigned rte_memory_get_nchannel(void); unsignedrte_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 +5
-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 index renamed from lib/librte_ether/rte_ethdev.c +0
-0ea3a1fb..457e0bc 100644
lib/librte_ether/rte_ethdev.c +20
-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)lib/librte_ether/rte_ethdev.c +1
-0(*dev->dev_ops->bypass_wd_reset)(dev); return 0; } +#endif int lib/librte_ether/rte_ethdev.h index renamed from lib/librte_ether/rte_ethdev.h +0
-01200c1c..747acb5 100644
lib/librte_ether/rte_ethdev.h +0
-0@@ -3664,6 +3664,29 @@ int rte_eth_dev_filter_supported(uint8_t port_id,enum
rte_filter_typefilter_tyint rte_eth_dev_filter_ctrl(uint8_tport_id, enumrte_filter_typefilter_type,lib/librte_ether/rte_ethdev.h +21
-0enum 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,
lib/librte_ether/rte_ethdev.h +2
-0+ 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 +3
-24@@ -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)
lib/librte_pmd_e1000/em_rxtx.c +0
-0return (-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.
*/lib/librte_pmd_e1000/em_rxtx.c +2
-2rsize =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)
lib/librte_pmd_e1000/em_rxtx.c +0
-0return (-ENOMEM ); /* Allocate the RX queue data structure. */ diff --git
a/lib/librte_pmd_e1000/igb_rxtx.cb/lib/librte_pmd_e1000/igb_rxtx.cindex 5c394a9..d36469b 100644lib/librte_pmd_e1000/igb_rxtx.c +0
-0@@ -1109,29 +1109,6 @@ eth_igb_recv_scattered_pkts(void *rx_queue,struct
rte_mbuf**rx_pkts, #defineIGB_MIN_RING_DESC32 #defineIGB_MAX_RING_DESC4096lib/librte_pmd_e1000/igb_rxtx.c +3
-25-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) -{ -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, IGB_ALIGN, RTE_PGSIZE_2M); -#else -return rte_memzone_reserve_aligned(z_name, ring_size, -socket_id, 0, IGB_ALIGN); -#endif -} -static void igb_tx_queue_release_mbufs(struct igb_tx_queue *txq) { @@ -1265,8 +1242,8 @@ eth_igb_tx_queue_setup(struct rte_eth_dev *dev, * resizing in later calls to the queue setup function. */ size =sizeof (union e1000_adv_tx_desc ) *IGB_MAX_RING_DESC ; - tz =ring_dma_zone_reserve (dev,"tx_ring" , queue_idx, - size, socket_id); + tz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_idx, size, +IGB_ALIGN , socket_id);if (tz ==NULL ) {igb_tx_queue_release (txq);return (-ENOMEM );@@ -1284,12 +1261,14 @@ eth_igb_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->tdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_TDT(txq-Quoted 1 line
reg_idx)); -#ifndefRTE_LIBRTE_XEN_DOM0lib/librte_pmd_e1000/igb_rxtx.c +0
-3- txq->tx_ring_phys_addr = (uint64_t ) tz->phys_addr; -#else - txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id, tz-Quoted 1 line
phys_addr);lib/librte_pmd_e1000/igb_rxtx.c +3
-0+#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + txq->tx_ring_phys_addr = rte_mem_phy2mch(tz->memseg_id,
tz->phys_addr);lib/librte_pmd_e1000/igb_rxtx.c +4
-1+ else#endif - txq->tx_ring = (union e1000_adv_tx_desc *) tz->addr; + txq->tx_ring_phys_addr = (uint64_t ) tz->phys_addr; + + txq->tx_ring = (union e1000_adv_tx_desc *) tz->addr;/* Allocate software ring */ txq->sw_ring = rte_zmalloc("txq->sw_ring", sizeof(struct igb_tx_entry) * nb_desc, @@ -1414,18 +1393,21 @@ eth_igb_rx_queue_setup(struct
rte_eth_dev*dev,lib/librte_pmd_e1000/igb_rxtx.c +2
-1* resizing in later calls to the queue setup function. */ size =sizeof (union e1000_adv_rx_desc ) *IGB_MAX_RING_DESC ; - rz =ring_dma_zone_reserve (dev,"rx_ring" , queue_idx, size, socket_id); + rz =rte_eth_dma_zone_reserve (dev,"rx_ring" , queue_idx, size, +IGB_ALIGN , socket_id);if (rz ==NULL ) {igb_rx_queue_release (rxq);return (-ENOMEM ); } rxq->rdt_reg_addr = E1000_PCI_REG_ADDR(hw, E1000_RDT(rxq-Quoted 1 line
reg_idx));
rxq->rdh_reg_addr= E1000_PCI_REG_ADDR(hw, E1000_RDH(rxq-Quoted 1 line
reg_idx)); -#ifndefRTE_LIBRTE_XEN_DOM0lib/librte_pmd_e1000/igb_rxtx.c +0
-3- rxq->rx_ring_phys_addr = (uint64_t ) rz->phys_addr; -#else - rxq->rx_ring_phys_addr = rte_mem_phy2mch(rz->memseg_id, rz-Quoted 1 line
phys_addr);lib/librte_pmd_e1000/igb_rxtx.c +6
-0+#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + rxq->rx_ring_phys_addr = +rte_mem_phy2mch (rz->memseg_id, rz->phys_addr); + else#endif + rxq->rx_ring_phys_addr = (uint64_t ) rz->phys_addr; rxq->rx_ring = (union e1000_adv_rx_desc *) rz->addr;/* Allocate software ring. */ lib/librte_pmd_i40e/i40e_ethdev.c +0
-0@@ -1979,11 +1979,12 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw, id++; snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id); #ifdef
RTE_LIBRTE_XEN_DOM0lib/librte_pmd_i40e/i40e_ethdev.c +2
-4- mz =rte_memzone_reserve_bounded (z_name, size,0 ,0 , alignment, -RTE_PGSIZE_2M ); -#else - mz =rte_memzone_reserve_aligned (z_name, size,0 ,0 , alignment); +if (is_xen_dom0_supported ()) + mz = rte_memzone_reserve_bounded(z_name, size, 0, 0,alignment,
lib/librte_pmd_i40e/i40e_ethdev.c +3
-0+ RTE_PGSIZE_2M); + else #endif + mz = rte_memzone_reserve_aligned(z_name, size, 0, 0,alignment);
lib/librte_pmd_i40e/i40e_ethdev.c +4
-3if (!mz)return I40E_ERR_NO_MEMORY ;@@ -1991,10 +1992,11 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw, mem->size = size; mem->va = mz->addr;#ifdef RTE_LIBRTE_XEN_DOM0 - mem->pa =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); -#else - mem->pa = mz->phys_addr; +if (is_xen_dom0_supported ()) + mem->pa =rte_mem_phy2mch (mz->memseg_id, mz- >phys_addr); + else#endif + mem->pa = mz->phys_addr;lib/librte_pmd_i40e/i40e_ethdev.c +0
-0return I40E_SUCCESS ; }lib/librte_pmd_i40e/i40e_fdir.c +5
-3@@ -274,10 +274,12 @@ i40e_fdir_setup(struct i40e_pf *pf) } pf->fdir.prg_pkt = mz->addr;#ifdef RTE_LIBRTE_XEN_DOM0 - pf->fdir.dma_addr =rte_mem_phy2mch (mz->memseg_id, mz- >phys_addr); -#else - pf->fdir.dma_addr = (uint64_t )mz->phys_addr; +if (is_xen_dom0_supported ()) + pf->fdir.dma_addr =rte_mem_phy2mch (mz->memseg_id, mz- >phys_addr); + else#endif + pf->fdir.dma_addr = (uint64_t )mz->phys_addr; + pf->fdir.match_counter_index = I40E_COUNTER_INDEX_FDIR(hw-Quoted 1 line
pf_id);PMD_DRV_LOG(INFO, "FDIR setup successfully, with programming
queue %u.",lib/librte_pmd_i40e/i40e_fdir.c +0
-0vsi->base_queue);lib/librte_pmd_i40e/i40e_rxtx.c +4
-3@@ -1796,10 +1796,11 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,memset (rz->addr,0 , ring_size);#ifdef RTE_LIBRTE_XEN_DOM0 - rxq->rx_ring_phys_addr =rte_mem_phy2mch (rz->memseg_id, rz- >phys_addr); -#else - rxq->rx_ring_phys_addr = (uint64_t )rz->phys_addr; +if (is_xen_dom0_supported ()) + rxq->rx_ring_phys_addr =rte_mem_phy2mch (rz->memseg_id, rz->phys_addr); + else#endif + rxq->rx_ring_phys_addr = (uint64_t )rz->phys_addr;lib/librte_pmd_i40e/i40e_rxtx.c +4
-3rxq->rx_ring = (union i40e_rx_desc *)rz->addr;@@ -2079,10 +2080,11 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->tx_deferred_start = tx_conf->tx_deferred_start;#ifdef RTE_LIBRTE_XEN_DOM0 - txq->tx_ring_phys_addr =rte_mem_phy2mch (tz->memseg_id, tz- >phys_addr); -#else - txq->tx_ring_phys_addr = (uint64_t )tz->phys_addr; +if (is_xen_dom0_supported ()) + txq->tx_ring_phys_addr =rte_mem_phy2mch (tz->memseg_id, tz->phys_addr); + else#endif + txq->tx_ring_phys_addr = (uint64_t )tz->phys_addr;lib/librte_pmd_i40e/i40e_rxtx.c +7
-6txq->tx_ring = (struct i40e_tx_desc *)tz->addr;/* Allocate software ring */ @@ -2147,12 +2149,13 @@ i40e_ring_dma_zone_reserve(struct rte_eth_dev *dev, return mz;#ifdef RTE_LIBRTE_XEN_DOM0 -return rte_memzone_reserve_bounded (z_name, ring_size, - socket_id,0 ,I40E_ALIGN ,RTE_PGSIZE_2M ); -#else -return rte_memzone_reserve_aligned (z_name, ring_size, - socket_id,0 ,I40E_ALIGN ); -#endif +if (is_xen_dom0_supported ()) +return rte_memzone_reserve_bounded (z_name, ring_size, + socket_id,0 ,I40E_ALIGN ,RTE_PGSIZE_2M ); + else +#endif +return rte_memzone_reserve_aligned (z_name, ring_size, + socket_id,0 ,I40E_ALIGN ); }const struct
rte_memzone*lib/librte_pmd_i40e/i40e_rxtx.c +13
-8@@ -2164,12 +2167,14 @@ i40e_memzone_reserve(const char *name, uint32_t len, int socket_id) if (mz) return mz;#ifdef RTE_LIBRTE_XEN_DOM0 - mz =rte_memzone_reserve_bounded (name, len, - socket_id,0 ,I40E_ALIGN ,RTE_PGSIZE_2M ); -#else - mz =rte_memzone_reserve_aligned (name, len, - socket_id,0 ,I40E_ALIGN ); +if (is_xen_dom0_supported ()) + mz =rte_memzone_reserve_bounded (name, len, + socket_id,0 ,I40E_ALIGN ,RTE_PGSIZE_2M ); + else#endif + mz =rte_memzone_reserve_aligned (name, len, + socket_id,0 ,I40E_ALIGN ); +return mz; }@@ -2573,10 +2578,13 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) txq->vsi = pf->fdir.fdir_vsi;#ifdef RTE_LIBRTE_XEN_DOM0 - txq->tx_ring_phys_addr =rte_mem_phy2mch (tz->memseg_id, tz- >phys_addr); -#else - txq->tx_ring_phys_addr = (uint64_t )tz->phys_addr; +if (is_xen_dom0_supported ()) + txq->tx_ring_phys_addr =rte_mem_phy2mch (tz->memseg_id, + tz->phys_addr); + else#endif + txq->tx_ring_phys_addr = (uint64_t )tz->phys_addr; + txq->tx_ring = (struct i40e_tx_desc *)tz->addr;/* * don't need to allocate software ring and reset for the fdir @@ -
2633,10 +2641,13 @@i40e_fdir_setup_rx_resources(struct i40e_pf *pf)lib/librte_pmd_i40e/i40e_rxtx.c +0
-1rxq->vsi = pf->fdir.fdir_vsi;#ifdef RTE_LIBRTE_XEN_DOM0 - rxq->rx_ring_phys_addr = rte_mem_phy2mch(rz->memseg_id, rz-Quoted 1 line
phys_addr);lib/librte_pmd_i40e/i40e_rxtx.c +6
-2-#else - rxq->rx_ring_phys_addr = (uint64_t )rz->phys_addr; +if (is_xen_dom0_supported ()) + rxq->rx_ring_phys_addr =rte_mem_phy2mch (rz->memseg_id, + rz->phys_addr); + else#endif + rxq->rx_ring_phys_addr = (uint64_t )rz->phys_addr; + rxq->rx_ring = (union i40e_rx_desc *)rz->addr;/* lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0
-0@@ -1656,35 +1656,6 @@ ixgbe_recv_scattered_pkts(void *rx_queue, struct
rte_mbuf**rx_pkts, #defineIXGBE_MIN_RING_DESC32 #defineIXGBE_MAX_RING_DESC4096lib/librte_pmd_ixgbe/ixgbe_rxtx.c +2
-30-/* -* 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 * -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 ixgbe_tx_queue_release_mbufs(struct igb_tx_queue *txq) { @@ -1920,9 +1891,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,lib/librte_pmd_ixgbe/ixgbe_rxtx.c +10
-7- socket_id); + IXGBE_ALIGN, socket_id);if (tz ==NULL ) {ixgbe_tx_queue_release (txq);return (-ENOMEM );@@ -1950,11 +1921,14 @@ 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); + +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + txq->tx_ring_phys_addr = +rte_mem_phy2mch (tz->memseg_id, tz->phys_addr); + else#endif + txq->tx_ring_phys_addr = (uint64_t ) tz->phys_addr; txq->tx_ring = (union ixgbe_adv_tx_desc *) tz->addr;/* Allocate software ring */ @@ -2195,8 +2169,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);lib/librte_pmd_ixgbe/ixgbe_rxtx.c +6
-4return (-ENOMEM );@@ -2223,11 +2197,13 @@ 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); +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + rxq->rx_ring_phys_addr = +rte_mem_phy2mch (rz->memseg_id, rz->phys_addr); + else#endif + rxq->rx_ring_phys_addr = (uint64_t ) rz->phys_addr; rxq->rx_ring = (union ixgbe_adv_rx_desc *) rz->addr;
Quoted 3 lines
/*
--
2.1.4
Liu, Jijiang
Acked-byRe: [PATCH 2/5] enic: fix device to work with Xen DOM0
In reply to a message not in the archiveQuoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Sunday, February 15, 2015 11:25 PM
To: [email protected]
Cc: Stephen Hemminger
Subject: [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0
Quoted 7 lines
It is possible to passthrough a PCI device when running in Xen Paravirt mode. The device driver has to accomodate by using memory zones differently. This patch models the memory allocation for ENIC device based on changes already done for ixgbe and igb.
Build tested only; has not been tested on ENIC hardware.
---
Quoted 91 lines
v2 -- this patch is added
lib/librte_pmd_enic/enic_main.c | 19 ++++++++++++++++--- lib/librte_pmd_enic/vnic/vnic_dev.c | 19 +++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-)lib/librte_pmd_enic/enic_main.c +8
-2@@ -537,8 +537,14 @@ enic_alloc_consistent(__rte_unused void *priv, size_t size, const struct rte_memzone *rz; *dma_handle =0 ; - rz =rte_memzone_reserve_aligned ((const char *)name, - size,0 ,0 ,ENIC_ALIGN ); +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + rz =rte_memzone_reserve_bounded ((char *)name, size, +0 ,0 ,ENIC_ALIGN ,RTE_PGSIZE_2M ); + else +#endif + rz =rte_memzone_reserve_aligned ((char *)name, size, +0 ,0 ,ENIC_ALIGN );if (!rz) { pr_err("%s : Failed to allocate memory requested for %s",lib/librte_pmd_enic/enic_main.c +8
-1__func__, name);@@ -546,7 +552,14 @@ enic_alloc_consistent(__rte_unused void *priv, size_t size, } vaddr = rz->addr; - *dma_handle = (dma_addr_t )rz->phys_addr; + +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + *dma_handle =rte_mem_phy2mch (rz->memseg_id, + rz->phys_addr); + else +#endif + *dma_handle = (dma_addr_t )rz->phys_addr;return vaddr;}
lib/librte_pmd_enic/vnic/vnic_dev.c +7
-3@@ -276,9 +276,14 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused))struct vnic_dev *vdev,vnic_dev_desc_ring_size (ring ,desc_count ,desc_size ); - rz =rte_memzone_reserve_aligned (z_name, - ring->size_unaligned, socket_id, -0 ,ENIC_ALIGN ); +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + rz =rte_memzone_reserve_bounded (z_name, ring- >size_unaligned, + socket_id,0 ,ENIC_ALIGN ,RTE_PGSIZE_2M ); + else +#endif + rz = rte_memzone_reserve_aligned(z_name, ring-Quoted 1 line
size_unaligned,lib/librte_pmd_enic/vnic/vnic_dev.c +8
-1+ socket_id, 0, ENIC_ALIGN);if (!rz) {pr_err ("Failed to allocate ring (size=%d), aborting\n" , (int )ring->size);@@ -292,7 +297,13 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused))struct vnic_dev *vdev, return -ENOMEM; } - ring->base_addr_unaligned = (dma_addr_t )rz->phys_addr; +#ifdef RTE_LIBRTE_XEN_DOM0 +if (is_xen_dom0_supported ()) + ring->base_addr_unaligned =rte_mem_phy2mch (rz- >memseg_id, + rz->phys_addr); + else +#endif + ring->base_addr_unaligned = (dma_addr_t )rz->phys_addr;lib/librte_pmd_enic/vnic/vnic_dev.c +0
-1ring->base_addr =ALIGN (ring->base_addr_unaligned, ring->base_align); --2.1.4
Please, could you try to rebase it?
v3 cover xen: netfront poll mode driver
In reply to Stephen Hemmingerv3 changes:
- removed fake PCI interface
- removed struct virt_eth_driver
- check for UIO name and version
- added basic documentation
Jan Blunck (3):
xen: Add UIO kernel driver
xen: Add netfront poll mode driver
xen: Add documentation
config/common_base | 6 + doc/guides/nics/overview.rst | 28 +- doc/guides/nics/xen.rst | 101 ++++ drivers/net/Makefile | 1 + drivers/net/xen/Makefile | 30 + drivers/net/xen/uio.c | 245 ++++++++ drivers/net/xen/uio.h | 54 ++ drivers/net/xen/xen_adapter_info.h | 64 ++ drivers/net/xen/xen_dev.c | 489 +++++++++++++++ drivers/net/xen/xen_dev.h | 30 + drivers/net/xen/xen_logs.h | 19 + drivers/net/xen/xen_rxtx.c | 757 ++++++++++++++++++++++++ drivers/net/xen/xen_rxtx.h | 131 ++++ lib/librte_eal/linuxapp/Makefile | 1 + lib/librte_eal/linuxapp/xen_uio/Makefile | 56 ++ lib/librte_eal/linuxapp/xen_uio/compat.h | 47 ++ lib/librte_eal/linuxapp/xen_uio/xen_uio.c | 954 ++++++++++++++++++++++++++++++ 17 files changed, 2999 insertions(+), 14 deletions(-) create mode 100644 doc/guides/nics/xen.rst create mode 100644 drivers/net/xen/Makefile create mode 100644 drivers/net/xen/uio.c create mode 100644 drivers/net/xen/uio.h create mode 100644 drivers/net/xen/xen_adapter_info.h create mode 100644 drivers/net/xen/xen_dev.c create mode 100644 drivers/net/xen/xen_dev.h create mode 100644 drivers/net/xen/xen_logs.h create mode 100644 drivers/net/xen/xen_rxtx.c create mode 100644 drivers/net/xen/xen_rxtx.h create mode 100644 lib/librte_eal/linuxapp/xen_uio/Makefile create mode 100644 lib/librte_eal/linuxapp/xen_uio/compat.h create mode 100644 lib/librte_eal/linuxapp/xen_uio/xen_uio.c
Signature · 1 line
2.5.5
PATCH v3 1/3 xen: Add UIO kernel driver
New UIO helper kernel driver for Xen netfront UIO poll mode driver.
--- lib/librte_eal/linuxapp/Makefile | 1 + lib/librte_eal/linuxapp/xen_uio/Makefile | 56 ++ lib/librte_eal/linuxapp/xen_uio/compat.h | 47 ++ lib/librte_eal/linuxapp/xen_uio/xen_uio.c | 954 ++++++++++++++++++++++++++++++ 4 files changed, 1058 insertions(+) create mode 100644 lib/librte_eal/linuxapp/xen_uio/Makefile create mode 100644 lib/librte_eal/linuxapp/xen_uio/compat.h create mode 100644 lib/librte_eal/linuxapp/xen_uio/xen_uio.c
lib/librte_eal/linuxapp/Makefile +1 -0
@@ -35,5 +35,6 @@ DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal DIRS-$(CONFIG_RTE_EAL_IGB_UIO) += igb_uio DIRS-$(CONFIG_RTE_KNI_KMOD) += kni DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += xen_dom0 +DIRS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += xen_uio include $(RTE_SDK)/mk/rte.subdir.mk
lib/librte_eal/linuxapp/xen_uio/Makefile new file +56 -0
56 lines not on this page · raw message
lib/librte_eal/linuxapp/xen_uio/compat.h new file +47 -0
47 lines not on this page · raw message
lib/librte_eal/linuxapp/xen_uio/xen_uio.c new file +954 -0
954 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH v3 2/3 xen: Add netfront poll mode driver
In reply to Jan BlunckThis implements a poll mode driver that has the same functionality as the Xen netfront driver in the Linux kernel.
--- config/common_base | 6 + drivers/net/Makefile | 1 + drivers/net/xen/Makefile | 30 ++ drivers/net/xen/uio.c | 245 ++++++++++++ drivers/net/xen/uio.h | 54 +++ drivers/net/xen/xen_adapter_info.h | 64 ++++ drivers/net/xen/xen_dev.c | 489 ++++++++++++++++++++++++ drivers/net/xen/xen_dev.h | 30 ++ drivers/net/xen/xen_logs.h | 19 + drivers/net/xen/xen_rxtx.c | 757 +++++++++++++++++++++++++++++++++++++ drivers/net/xen/xen_rxtx.h | 131 +++++++ 11 files changed, 1826 insertions(+) create mode 100644 drivers/net/xen/Makefile create mode 100644 drivers/net/xen/uio.c create mode 100644 drivers/net/xen/uio.h create mode 100644 drivers/net/xen/xen_adapter_info.h create mode 100644 drivers/net/xen/xen_dev.c create mode 100644 drivers/net/xen/xen_dev.h create mode 100644 drivers/net/xen/xen_logs.h create mode 100644 drivers/net/xen/xen_rxtx.c create mode 100644 drivers/net/xen/xen_rxtx.h
config/common_base +6 -0
@@ -306,6 +306,12 @@ CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n CONFIG_RTE_LIBRTE_PMD_XENVIRT=n # +# Compile XEN UIO net-front PMD driver +# +CONFIG_RTE_LIBRTE_PMD_XEN=n +CONFIG_RTE_LIBRTE_PMD_XEN_DEBUG_INIT=n + +# # Compile null PMD # CONFIG_RTE_LIBRTE_PMD_NULL=y
drivers/net/Makefile +1 -0
@@ -51,5 +51,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt +DIRS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += xen include $(RTE_SDK)/mk/rte.subdir.mk
drivers/net/xen/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +# +# Copyright (c) 2013-2016 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)/drivers/net/xen + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += uio.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += xen_dev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += xen_rxtx.c + +# this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += lib/librte_eal lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += lib/librte_mempool lib/librte_mbuf +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XEN) += lib/librte_net lib/librte_malloc + +include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/xen/uio.c new file +245 -0
245 lines not on this page · raw message
drivers/net/xen/uio.h new file +54 -0
54 lines not on this page · raw message
drivers/net/xen/xen_adapter_info.h new file +64 -0
64 lines not on this page · raw message
drivers/net/xen/xen_dev.c new file +489 -0
489 lines not on this page · raw message
drivers/net/xen/xen_dev.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (c) 2013-2016 Brocade Communications Systems, Inc. +* All rights reserved. +*/ + +#ifndef _XEN_ETHDEV_H_ +#define _XEN_ETHDEV_H_ + +#include "uio.h" + +#include <inttypes.h> +#include <stdlib.h> +#include <sys/user.h> + +#include <xen/io/netif.h> +#include "xen_adapter_info.h" + +struct xen_adapter { +/* it's a place for all uio resources */ +struct uio_resource uio; + +/*pointer to the info page*/ +struct xen_adapter_info *info_page; +uint8_t vlan_strip; +}; + +int +xen_evtchn_notify_grant_rxtx (struct ioctl_evtchn_notify_grant *ng); + +#endif /* _XEN_ETHDEV_H_ */
drivers/net/xen/xen_logs.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef _XEN_LOGS_H_ +#define _XEN_LOGS_H_ + +#ifdef RTE_LIBRTE_PMD_XEN_DEBUG_INIT + +#define PMD_INIT_LOG(level, fmt, args...) \ + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) + +#else /* RTE_LIBRTE_PMD_XEN_DEBUG_INIT */ + +#define PMD_INIT_LOG(level, fmt, args...) \ + do { } while (0) + +#endif /* RTE_LIBRTE_PMD_XEN_DEBUG_INIT */ + +#define PMD_INIT_FUNC_TRACE () \ + PMD_INIT_LOG(DEBUG, " >>") + +#endif /* _XEN_LOGS_H_ */
drivers/net/xen/xen_rxtx.c new file +757 -0
757 lines not on this page · raw message
drivers/net/xen/xen_rxtx.h new file +131 -0
131 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH v3 3/3 xen: Add documentation
In reply to Jan BlunckAdd basic documentation for Xen Netfront PMD compilation and testpmd invocation.
--- doc/guides/nics/overview.rst | 28 ++++++------ doc/guides/nics/xen.rst | 101 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 14 deletions(-) create mode 100644 doc/guides/nics/xen.rst
doc/guides/nics/overview.rst +14 -14
@@ -74,18 +74,18 @@ Most of these differences are summarized below. .. table:: Features availability in networking drivers - ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = - Feature a b b b c e e i i i i i i i i i i f f m m m n n p r s v v v x - f n n o x 1 n 4 4 4 4 g g x x x x m m l l p f u c i z i i m e - p x x n g 0 i 0 0 0 0 b b g g g g 1 1 x x i p l a n e r r x n - a 2 2 d b 0 c e e e e v b b b b 0 0 4 5 p l p g d t t n v - c x x i e 0 . v v f e e e e k k e a i i e i - k v n . f f . v v . t o o t r - e f g . . . f f . a . 3 t + ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + Feature a b b b c e e i i i i i i i i i i f f m m m n n p r s v v v x x + f n n o x 1 n 4 4 4 4 g g x x x x m m l l p f u c i z i i m e e + p x x n g 0 i 0 0 0 0 b b g g g g 1 1 x x i p l a n e r r x n n + a 2 2 d b 0 c e e e e v b b b b 0 0 4 5 p l p g d t t n v + c x x i e 0 . v v f e e e e k k e a i i e i + k v n . f f . v v . t o o t r + e f g . . . f f . a . 3 t t v v v v v 2 v e e e e e e c c c c c c - ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = link status X X X X link status event X X Rx interrupt X X X X
@@ -125,23 +125,23 @@ Most of these differences are summarized below. inner L4 checksum X X packet type parsing X X X timesync X X - basic stats X X X X X X + basic stats X X X X X X X extended stats X X X X stats per queue X X EEPROM dump registers dump multiprocess aware X X X X BSD nic_uio X X X X X - Linux UIO X X X X X + Linux UIO X X X X X X Linux VFIO X X X X X other kdrv X ARMv7 ARMv8 Power8 TILE-Gx - x86-32 X X X X X - x86-64 X X X X X X + x86-32 X X X X X X + x86-64 X X X X X X X usage doc X X design doc perf doc - ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = + ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
doc/guides/nics/xen.rst new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
2.5.5
Re: [PATCH v3 2/3] xen: Add netfront poll mode driver
In reply to Jan BlunckHello,
Quoted 6 lines · Jan Blunck
drivers/net/xen/xen_dev.c new file +6
-0+static struct eth_dev_ops xen_eth_dev_ops = { +/*dev*/ + .dev_configure = xen_dev_configure, + .dev_close = xen_dev_close, + .dev_start = xen_dev_start, + .dev_stop = xen_dev_stop,
drivers/net/xen/xen_dev.c line 263
Quoted 10 lines
drivers/net/xen/xen_dev.c new file +10
-0+ .dev_infos_get = xen_dev_info_get, + .link_update = xen_dev_link_update, + /*rxtx*/ + .stats_get = xen_dev_stats_get, + .stats_reset = xen_dev_stats_reset, + .rx_queue_setup = xen_dev_rx_queue_setup, + .rx_queue_release = xen_dev_rx_queue_release, + .tx_queue_setup = xen_dev_tx_queue_setup, + .tx_queue_release = xen_dev_tx_queue_release, +};
Is there anything preventing it from being const ?
Signature · 1 line
David Marchand
Re: [PATCH v3 2/3] xen: Add netfront poll mode driver
Quoted 13 lines · David Marchand
Hello,
Quoted 10 lines · Jan Blunck
drivers/net/xen/xen_dev.c new file +10
-0+static struct eth_dev_ops xen_eth_dev_ops = { +/*dev*/ + .dev_configure = xen_dev_configure, + .dev_close = xen_dev_close, + .dev_start = xen_dev_start, + .dev_stop = xen_dev_stop, + .dev_infos_get = xen_dev_info_get, + .link_update = xen_dev_link_update, +/*rxtx*/ + .stats_get = xen_dev_stats_get,
Quoted 9 lines
drivers/net/xen/xen_dev.c line 263
Quoted 6 lines
drivers/net/xen/xen_dev.c new file +6
-0+ .stats_reset = xen_dev_stats_reset, + .rx_queue_setup = xen_dev_rx_queue_setup, + .rx_queue_release = xen_dev_rx_queue_release, + .tx_queue_setup = xen_dev_tx_queue_setup, + .tx_queue_release = xen_dev_tx_queue_release, +};Is there anything preventing it from being const ?
I don't think so. Will constify it for the next round.
Thanks,
Jan
Quoted 3 lines
--
David Marchand
Re: [PATCH v3 1/3] xen: Add UIO kernel driver
In reply to Jan Blunck2016-03-22 10:55, Jan Blunck:
Quoted 4 lines
New UIO helper kernel driver for Xen netfront UIO poll mode driver.
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Jan Blunck <[email protected]>
Is it contributed upstream?
Is there something common with igb_uio?
Re: [PATCH v3 1/3] xen: Add UIO kernel driver
Quoted 7 lines · Thomas Monjalon
2016-03-22 10:55, Jan Blunck:
Quoted 4 lines
New UIO helper kernel driver for Xen netfront UIO poll mode driver.
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Jan Blunck <[email protected]>Is it contributed upstream?
No. Haven't planed that yet.
Quoted 1 line
Is there something common with
igb_uio?
AFAIK igb_uio is mapping the bars via UIO. The Xen netfront driver isn't simulating a PCI interface. Instead it directly maps the TX/RX ring.
Overlap is limited to reading sysfs files. Don't know if that is worth being extracted into a standalone header.
Re: [PATCH v3 1/3] xen: Add UIO kernel driver
2016-03-22 12:04, Jan Blunck:
Quoted 11 lines
Quoted 7 lines · Thomas Monjalon
2016-03-22 10:55, Jan Blunck:
Quoted 4 lines
New UIO helper kernel driver for Xen netfront UIO poll mode driver.
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Jan Blunck <[email protected]>Is it contributed upstream?
No. Haven't planed that yet.
Integrating new kernel modules in DPDK, without upstream work, is not planned.
Quoted 8 lines
Quoted 1 line
Is there something common with
igb_uio?AFAIK
igb_uiois mapping the bars via UIO. The Xen netfront driver isn't simulating a PCI interface. Instead it directly maps the TX/RX ring.Overlap is limited to reading sysfs files. Don't know if that is worth being extracted into a standalone header.
No it is not worth extracting. I'm just trying to understand what this module is, because the log doesn't say much.
Re: [PATCH v3 1/3] xen: Add UIO kernel driver
Quoted 9 lines · Thomas Monjalon
2016-03-22 12:04, Jan Blunck:
Quoted 8 lines
Quoted 6 lines · Thomas Monjalon
2016-03-22 10:55, Jan Blunck:
Quoted 4 lines
New UIO helper kernel driver for Xen netfront UIO poll mode driver.
Signed-off-by Stephen Hemminger <[email protected]>Signed-off-by Jan Blunck <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Is it contributed upstream?
No. Haven't planed that yet.
Integrating new kernel modules in DPDK, without upstream work, is not planned.
I'll look into the existing Linux kernel netfront driver and check if upstream is actually willing to integrate the UIO part.
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Is there something common with
igb_uio?AFAIK
igb_uiois mapping the bars via UIO. The Xen netfront driver isn't simulating a PCI interface. Instead it directly maps the TX/RX ring.
Quoted 6 lines
Quoted 2 lines
Overlap is limited to reading sysfs files. Don't know if that is worth being extracted into a standalone header.
No it is not worth extracting. I'm just trying to understand what this module is, because the log doesn't say much.
I can address that for the upstream submission and drop it from this series.
Re: [PATCH v3 0/3] xen: netfront poll mode driver
In reply to Jan BlunckQuoted 11 lines · Jan Blunck
v3 changes:
- removed fake PCI interface
- removed structvirt_eth_driver
- check for UIO name and version
- added basic documentationJan Blunck (3):
xen: Add UIO kernel driver
xen: Add netfront poll mode driver
xen: Add documentation
Hi Jan,
any update on this series?
/Bruce
Re: [PATCH v3 0/3] xen: netfront poll mode driver
Quoted 12 lines · Bruce Richardson
Quoted 11 lines · Jan Blunck
v3 changes:
- removed fake PCI interface
- removed structvirt_eth_driver
- check for UIO name and version
- added basic documentationJan Blunck (3):
xen: Add UIO kernel driver
xen: Add netfront poll mode driver
xen: Add documentation
Quoted 6 lines
Hi Jan,
any update on this series?
/Bruce
Jan and Bruce:
I will find time to review this starting from this week. It takes time. Please stay tuned.
/huawei
Re: [PATCH v3 0/3] xen: netfront poll mode driver
In reply to Jan BlunckHi Jan,
2016-03-22 10:55, Jan Blunck:
Quoted 10 lines
v3 changes:
- removed fake PCI interface
- removed structvirt_eth_driver
- check for UIO name and version
- added basic documentationJan Blunck (3):
xen: Add UIO kernel driver
xen: Add netfront poll mode driver
xen: Add documentation
Any news about this series?
It is a long time since last discussion.
There is a new maintainer Xen-related things: Jianfeng.
Re: [PATCH v3 0/3] xen: netfront poll mode driver
Quoted 9 lines · Thomas Monjalon
Hi Jan,
2016-03-22 10:55, Jan Blunck:
Quoted 6 lines
v3 changes:
- removed fake PCI interface
- removed structvirt_eth_driver
- check for UIO name and version
- added basic documentation
Quoted 6 lines
Quoted 4 lines
Jan Blunck (3):
xen: Add UIO kernel driver
xen: Add netfront poll mode driver
xen: Add documentationAny news about this series?
Perhaps reposted with xen-devel being CC-ed?
Quoted 2 lines
It is a long time since last discussion.
There is a new maintainer Xen-related things: Jianfeng.