Xen DOM0 runtime support
v3 cover Xen DOM0 runtime support
Rebase of patches to current Intel drivers in DPDK 2.2-rc1
Stephen Hemminger (5):
xen: allow determining DOM0 at runtime
e1000: use rte_eth_dma_zone_reserve
ixgbe: use rte_eth_dma_zone_reserve
i40e: use rte_eth_dma_zone_reserve
fm10k: use rte_eth_dma_zone_reserve
drivers/net/e1000/em_rxtx.c | 40 ++---------- drivers/net/e1000/igb_rxtx.c | 40 ++---------- drivers/net/fm10k/fm10k_ethdev.c | 48 ++------------ drivers/net/i40e/i40e_ethdev.c | 9 --- drivers/net/i40e/i40e_fdir.c | 5 +- drivers/net/i40e/i40e_rxtx.c | 93 +++++----------------------- drivers/net/ixgbe/ixgbe_rxtx.c | 47 ++------------ lib/librte_eal/common/include/rte_memory.h | 30 ++++++++- lib/librte_eal/linuxapp/eal/eal_memory.c | 7 +++ lib/librte_eal/linuxapp/eal/eal_xen_memory.c | 2 +- lib/librte_ether/rte_ethdev.c | 24 +++++++ lib/librte_ether/rte_ethdev.h | 24 +++++++ lib/librte_mempool/rte_mempool.c | 48 +++++++++----- lib/librte_mempool/rte_mempool.h | 3 +- 14 files changed, 162 insertions(+), 258 deletions(-)
Signature · 1 line
2.1.4
PATCH v3 1/5 xen: allow determining DOM0 at runtime
Add memory infrastructure for runtime Xen DOM0 support.
--- lib/librte_eal/common/include/rte_memory.h | 30 ++++++++++++++++- lib/librte_eal/linuxapp/eal/eal_memory.c | 7 ++++ lib/librte_eal/linuxapp/eal/eal_xen_memory.c | 2 +- lib/librte_ether/rte_ethdev.c | 24 ++++++++++++++ lib/librte_ether/rte_ethdev.h | 24 ++++++++++++++ lib/librte_mempool/rte_mempool.c | 48 ++++++++++++++++++++-------- lib/librte_mempool/rte_mempool.h | 3 +- 7 files changed, 120 insertions(+), 18 deletions(-)
lib/librte_eal/common/include/rte_memory.h +29 -1
@@ -52,6 +52,8 @@extern "C" {#endif +#include <rte_common.h> +enum rte_page_sizes {RTE_PGSIZE_4K =1ULL <<12 ,RTE_PGSIZE_64K =1ULL <<16 ,
@@ -180,6 +182,13 @@ 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 ); + +/**< Internal use only - phys to virt mapping for xen */ +phys_addr_t rte_xen_mem_phy2mch (uint32_t ,const phys_addr_t ); +/** * Return the physical address of elt, which is an element of the pool mp. *
@@ -191,7 +200,14 @@ unsigned rte_memory_get_nrank(void);* @return * The physical address or error. */ -phys_addr_t rte_mem_phy2mch (uint32_t memseg_id,const phys_addr_t phy_addr); +static inline phys_addr_t +rte_mem_phy2mch (uint32_t memseg_id,const phys_addr_t phy_addr) +{ +if (is_xen_dom0_supported ()) +return rte_xen_mem_phy2mch (memseg_id, phy_addr); +else +return phy_addr; +}/** * Memory init for supporting application running on Xen domain0.
@@ -214,7 +230,19 @@ int rte_xen_dom0_memory_init(void);* negative: error */ int rte_xen_dom0_memory_attach (void ); +#else +static inline int is_xen_dom0_supported (void ) +{ +return 0 ; +} + +static inline phys_addr_t +rte_mem_phy2mch(uint32_t memseg_id __rte_unused, const phys_addr_t phy_addr) +{ +return phy_addr; +}#endif + #ifdef __cplusplus }#endif
lib/librte_eal/linuxapp/eal/eal_memory.c +7 -0
@@ -97,6 +97,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_eal/linuxapp/eal/eal_xen_memory.c +1 -1
@@ -156,7 +156,7 @@ get_xen_memory_size(void)* Based on physical address to caculate MFN in Xen Dom0. */ phys_addr_t -rte_mem_phy2mch (uint32_t memseg_id,const phys_addr_t phy_addr) +rte_xen_mem_phy2mch (uint32_t memseg_id,const phys_addr_t phy_addr) {int mfn_id;uint64_t mfn, mfn_offset;
lib/librte_ether/rte_ethdev.c +24 -0
@@ -2699,6 +2699,30 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)return 0 ; } + +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; + +if (is_xen_dom0_supported ()) +return rte_memzone_reserve_bounded (z_name, size, socket_id, +0 , align,RTE_PGSIZE_2M ); +else +return rte_memzone_reserve_aligned (z_name, size, socket_id, +0 , align); +} int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
lib/librte_ether/rte_ethdev.h +24 -0
@@ -3768,6 +3768,30 @@ extern int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,extern void rte_eth_copy_pci_info (struct rte_eth_dev *eth_dev,struct rte_pci_device *pci_dev); +/** +* 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 +34 -14
60 lines not on this page · raw message
lib/librte_mempool/rte_mempool.h +1 -2
@@ -640,7 +640,6 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, int socket_id, unsigned flags, void *vaddr, const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift); -#ifdef RTE_LIBRTE_XEN_DOM0 /** * Create a new mempool named *name* in memory on Xen Dom0. *
@@ -728,7 +727,7 @@ rte_dom0_mempool_create(const char *name, unsigned n, unsigned elt_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, rte_mempool_obj_ctor_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags); -#endif +/** * Dump the status of the mempool to the console.
Signature · 1 line
2.1.4
PATCH v3 2/5 e1000: use rte_eth_dma_zone_reserve
In reply to Stephen HemmingerUse common code to handle Xen support at runtime.
--- drivers/net/e1000/em_rxtx.c | 40 ++++++---------------------------------- drivers/net/e1000/igb_rxtx.c | 40 ++++++---------------------------------- 2 files changed, 12 insertions(+), 68 deletions(-)
drivers/net/e1000/em_rxtx.c +6 -34
@@ -1084,28 +1084,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) {
@@ -1253,8 +1231,9 @@ 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 ]) *E1000_MAX_RING_DESC ; -if ((tz =ring_dma_zone_reserve (dev,"tx_ring" , queue_idx, tsize, - socket_id)) ==NULL ) + tz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_idx, tsize, +RTE_CACHE_LINE_SIZE , socket_id); +if (tz ==NULL )return (-ENOMEM );/* Allocate the tx queue data structure. */
@@ -1280,11 +1259,7 @@ eth_em_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 (queue_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 = (struct e1000_data_desc *) tz->addr; PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
@@ -1380,8 +1355,9 @@ 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 ]) *E1000_MAX_RING_DESC ; -if ((rz =ring_dma_zone_reserve (dev,"rx_ring" , queue_idx, rsize, - socket_id)) ==NULL ) + rz =rte_eth_dma_zone_reserve (dev,"rx_ring" , queue_idx, rsize, +RTE_CACHE_LINE_SIZE , socket_id); +if (rz ==NULL )return (-ENOMEM );/* Allocate the RX queue data structure. */
@@ -1410,11 +1386,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev, rxq->rdt_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_RDT (queue_idx)); rxq->rdh_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_RDH (queue_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 = (struct e1000_rx_desc *) rz->addr; PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
drivers/net/e1000/igb_rxtx.c +6 -34
@@ -1209,28 +1209,6 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,* desscriptors should meet the following condition: * (num_ring_desc * sizeof(struct e1000_rx/tx_desc)) % 128 == 0 */ -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 ,E1000_ALIGN ,RTE_PGSIZE_2M ); -#else -return rte_memzone_reserve_aligned (z_name, ring_size, - socket_id,0 ,E1000_ALIGN ); -#endif -}static void igb_tx_queue_release_mbufs (struct igb_tx_queue *txq)
@@ -1365,8 +1343,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 ) *E1000_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, +E1000_ALIGN , socket_id);if (tz ==NULL ) {igb_tx_queue_release (txq);return (-ENOMEM );
@@ -1384,12 +1362,9 @@ 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->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 e1000_adv_tx_desc *) tz->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,
@@ -1514,18 +1489,15 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev,* resizing in later calls to the queue setup function. */ size =sizeof (union e1000_adv_rx_desc ) *E1000_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, +E1000_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->reg_idx)); rxq->rdh_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_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 e1000_adv_rx_desc *) rz->addr;/* Allocate software ring. */
Signature · 1 line
2.1.4
PATCH v3 3/5 ixgbe: use rte_eth_dma_zone_reserve
In reply to Stephen HemmingerAdapt DMA memory for Xen at runtime.
--- drivers/net/ixgbe/ixgbe_rxtx.c | 47 ++++++------------------------------------ 1 file changed, 6 insertions(+), 41 deletions(-)
drivers/net/ixgbe/ixgbe_rxtx.c +6 -41
@@ -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;/*
Signature · 1 line
2.1.4
PATCH v3 4/5 i40e: use rte_eth_dma_zone_reserve
In reply to Stephen HemmingerHandle Xen support at runtime.
--- drivers/net/i40e/i40e_ethdev.c | 9 ---- drivers/net/i40e/i40e_fdir.c | 5 +-- drivers/net/i40e/i40e_rxtx.c | 93 ++++++++---------------------------------- 3 files changed, 18 insertions(+), 89 deletions(-)
drivers/net/i40e/i40e_ethdev.c +0 -9
@@ -2919,24 +2919,15 @@ 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,SOCKET_ID_ANY ,0 , alignment,RTE_PGSIZE_2M ); -#else - mz =rte_memzone_reserve_aligned (z_name, size,SOCKET_ID_ANY ,0 , - alignment); -#endif if (!mz)return I40E_ERR_NO_MEMORY ; mem->id = id; 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; -#endif return I40E_SUCCESS ; }
drivers/net/i40e/i40e_fdir.c +1 -4
@@ -275,11 +275,8 @@ i40e_fdir_setup(struct i40e_pf *pf) goto fail_mem; } 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; -#endif + 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);
drivers/net/i40e/i40e_rxtx.c +17 -76
165 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 5/5 fm10k: use rte_eth_dma_zone_reserve
In reply to Stephen HemmingerAdapt to Xen at runtime.
--- drivers/net/fm10k/fm10k_ethdev.c | 48 +++++----------------------------------- 1 file changed, 6 insertions(+), 42 deletions(-)
drivers/net/fm10k/fm10k_ethdev.c +6 -42
@@ -1492,34 +1492,6 @@ check_nb_desc(uint16_t min, uint16_t max, uint16_t mult, uint16_t request)return 0 ; } -/* -* Create a memzone for hardware descriptor rings. Malloc cannot be used since -* the physical address is required. If the memzone is already created, then -* this function returns a pointer to the existing memzone. -*/ -static inline const struct rte_memzone * -allocate_hw_ring (const char *driver_name,const char *ring_name, -uint8_t port_id,uint16_t queue_id,int socket_id, -uint32_t size,uint32_t align) -{ -char name[RTE_MEMZONE_NAMESIZE ]; -const struct rte_memzone *mz; - -snprintf (name,sizeof (name),"%s_%s_%d_%d_%d" , - driver_name, ring_name, port_id, queue_id, socket_id); - -/* return the memzone if it already exists */ - mz =rte_memzone_lookup (name); -if (mz) -return mz; - -#ifdef RTE_LIBRTE_XEN_DOM0 -return rte_memzone_reserve_bounded (name, size, socket_id,0 , align, -RTE_PGSIZE_2M ); -#else -return rte_memzone_reserve_aligned (name, size, socket_id,0 , align); -#endif -}static inline int check_thresh (uint16_t min,uint16_t max,uint16_t div,uint16_t request)
@@ -1667,9 +1639,9 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,* enough to hold the maximum ring size is requested to allow for * resizing in later calls to the queue setup function. */ - mz =allocate_hw_ring (dev->driver->pci_drv.name,"rx_ring" , - dev->data->port_id, queue_id, socket_id, -FM10K_MAX_RX_RING_SZ ,FM10K_ALIGN_RX_DESC ); + mz =rte_eth_dma_zone_reserve (dev,"rx_ring" , queue_id, +FM10K_MAX_RX_RING_SZ ,FM10K_ALIGN_RX_DESC , + socket_id);if (mz ==NULL ) {PMD_INIT_LOG (ERR ,"Cannot allocate hardware ring" );rte_free (q->sw_ring);
@@ -1677,11 +1649,7 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,return (-ENOMEM ); } q->hw_ring = mz->addr; -#ifdef RTE_LIBRTE_XEN_DOM0 q->hw_ring_phys_addr =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); -#else - q->hw_ring_phys_addr = mz->phys_addr; -#endif /* Check if number of descs satisfied Vector requirement */ if (!rte_is_power_of_2 (nb_desc)) {
@@ -1831,9 +1799,9 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,* enough to hold the maximum ring size is requested to allow for * resizing in later calls to the queue setup function. */ - mz =allocate_hw_ring (dev->driver->pci_drv.name,"tx_ring" , - dev->data->port_id, queue_id, socket_id, -FM10K_MAX_TX_RING_SZ ,FM10K_ALIGN_TX_DESC ); + mz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_id, +FM10K_MAX_TX_RING_SZ ,FM10K_ALIGN_TX_DESC , + socket_id);if (mz ==NULL ) {PMD_INIT_LOG (ERR ,"Cannot allocate hardware ring" );rte_free (q->sw_ring);
@@ -1841,11 +1809,7 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,return (-ENOMEM ); } q->hw_ring = mz->addr; -#ifdef RTE_LIBRTE_XEN_DOM0 q->hw_ring_phys_addr =rte_mem_phy2mch (mz->memseg_id, mz->phys_addr); -#else - q->hw_ring_phys_addr = mz->phys_addr; -#endif /* * allocate memory for the RS bit tracker. Enough slots to hold the
Signature · 1 line
2.1.4
Thomas Monjalon
Applied2015-11-05 16:09, Stephen Hemminger:
Quoted 8 lines
Rebase of patches to current Intel drivers in DPDK 2.2-rc1
Stephen Hemminger (5):
xen: allow determining DOM0 at runtime
e1000: userte_eth_dma_zone_reserve
ixgbe: userte_eth_dma_zone_reserve
i40e: userte_eth_dma_zone_reserve
fm10k: userte_eth_dma_zone_reserve
Applied, thanks
I think we need to check "git grep LIBRTE_XEN_DOM0" and see what can be improved to better reduce the number of ifdefs for Xen.