From 8957b86380f433fb1b91338ac3dd535d11ccfe7c Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Sun, 5 Feb 2017 16:48:55 +0200 Subject: Changes to our files to make dpdk1702 work Signed-off-by: Ido Barnea --- linux_dpdk/ws_main.py | 24 ++++- .../regression/stateless_tests/stl_rx_test.py | 25 +++-- scripts/dpdk_setup_ports.py | 16 +-- src/dpdk/drivers/net/enic/enic_clsf.c | 42 ++++++++ src/dpdk/drivers/net/enic/enic_main.c | 6 +- src/dpdk_funcs.c | 108 +++++++++++++++++++++ src/main_dpdk.cpp | 29 +++--- 7 files changed, 216 insertions(+), 34 deletions(-) diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py index 4273dfe7..18636513 100755 --- a/linux_dpdk/ws_main.py +++ b/linux_dpdk/ws_main.py @@ -402,6 +402,7 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'drivers/net/ixgbe/base/ixgbe_dcb.c', 'drivers/net/ixgbe/base/ixgbe_dcb_82598.c', 'drivers/net/ixgbe/base/ixgbe_dcb_82599.c', + 'drivers/net/ixgbe/base/ixgbe_hv_vf.c', 'drivers/net/ixgbe/base/ixgbe_mbx.c', 'drivers/net/ixgbe/base/ixgbe_phy.c', 'drivers/net/ixgbe/base/ixgbe_vf.c', @@ -409,6 +410,7 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'drivers/net/ixgbe/base/ixgbe_x550.c', 'drivers/net/ixgbe/ixgbe_ethdev.c', 'drivers/net/ixgbe/ixgbe_fdir.c', + 'drivers/net/ixgbe/ixgbe_flow.c', 'drivers/net/ixgbe/ixgbe_pf.c', 'drivers/net/ixgbe/ixgbe_rxtx.c', 'drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c', @@ -422,6 +424,7 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'drivers/net/mlx5/mlx5_txq.c', 'drivers/net/mlx5/mlx5.c', 'drivers/net/mlx5/mlx5_fdir.c', + 'drivers/net/mlx5/mlx5_flow.c', 'drivers/net/mlx5/mlx5_rss.c', 'drivers/net/mlx5/mlx5_rxq.c', 'drivers/net/mlx5/mlx5_trigger.c', @@ -437,7 +440,8 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'drivers/net/i40e/i40e_ethdev_vf.c', 'drivers/net/i40e/i40e_pf.c', 'drivers/net/i40e/i40e_rxtx.c', - 'drivers/net/i40e/i40e_rxtx_vec.c', + 'drivers/net/i40e/i40e_flow.c', + '/drivers/net/i40e/i40e_rxtx_vec_sse.c', 'drivers/net/i40e/i40e_fdir.c', 'drivers/net/i40e/i40e_ethdev.c', 'drivers/net/null/rte_eth_null.c', @@ -447,11 +451,18 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'drivers/net/virtio/virtio_rxtx.c', 'drivers/net/virtio/virtio_rxtx_simple.c', 'drivers/net/virtio/virtqueue.c', + 'drivers/net/virtio/virtio_rxtx_simple_sse.c', + '/drivers/net/virtio/virtio_user_ethdev.c', + 'drivers/net/virtio/virtio_user/vhost_kernel.c', + '/drivers/net/virtio/virtio_user/vhost_kernel_tap.c', + '/drivers/net/virtio/virtio_user/vhost_user.c', + '/drivers/net/virtio/virtio_user/virtio_user_dev.c', '/drivers/net/vmxnet3/vmxnet3_ethdev.c', '/drivers/net/vmxnet3/vmxnet3_rxtx.c', 'lib/librte_cfgfile/rte_cfgfile.c', 'lib/librte_eal/common/arch/x86/rte_cpuflags.c', 'lib/librte_eal/common/arch/x86/rte_spinlock.c', + '/lib/librte_eal/common/eal_common_bus.c', 'lib/librte_eal/common/eal_common_cpuflags.c', 'lib/librte_eal/common/eal_common_dev.c', 'lib/librte_eal/common/eal_common_devargs.c', @@ -469,6 +480,7 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'lib/librte_eal/common/eal_common_tailqs.c', 'lib/librte_eal/common/eal_common_thread.c', 'lib/librte_eal/common/eal_common_timer.c', + 'lib/librte_eal/common/eal_common_vdev.c', 'lib/librte_eal/common/malloc_elem.c', 'lib/librte_eal/common/malloc_heap.c', 'lib/librte_eal/common/rte_keepalive.c', @@ -478,7 +490,6 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'lib/librte_eal/linuxapp/eal/eal_debug.c', 'lib/librte_eal/linuxapp/eal/eal_hugepage_info.c', 'lib/librte_eal/linuxapp/eal/eal_interrupts.c', - 'lib/librte_eal/linuxapp/eal/eal_ivshmem.c', 'lib/librte_eal/linuxapp/eal/eal_lcore.c', 'lib/librte_eal/linuxapp/eal/eal_log.c', 'lib/librte_eal/linuxapp/eal/eal_memory.c', @@ -490,12 +501,15 @@ dpdk_src = SrcGroup(dir='src/dpdk/', 'lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c', 'lib/librte_eal/linuxapp/eal/eal_vfio.c', 'lib/librte_ether/rte_ethdev.c', + 'lib/librte_ether/rte_flow.c', 'lib/librte_hash/rte_cuckoo_hash.c', 'lib/librte_kvargs/rte_kvargs.c', 'lib/librte_mbuf/rte_mbuf.c', + 'lib/librte_mbuf/rte_mbuf_ptype.c', 'lib/librte_mempool/rte_mempool.c', 'lib/librte_mempool/rte_mempool_ops.c', 'lib/librte_mempool/rte_mempool_ring.c', + 'lib/librte_net/rte_net.c', 'lib/librte_pipeline/rte_pipeline.c', 'lib/librte_ring/rte_ring.c', ]); @@ -537,7 +551,7 @@ common_flags = ['-DWIN_UCODE_SIM', '-DRTE_DPDK', '-D__STDC_LIMIT_MACROS', '-D__STDC_FORMAT_MACROS', - '-include','../src/pal/linux_dpdk/dpdk0716/rte_config.h' + '-include','../src/pal/linux_dpdk/dpdk1702/rte_config.h' ] common_flags_new = common_flags + [ @@ -566,6 +580,7 @@ common_flags_old = common_flags + [ includes_path =''' ../src/pal/linux_dpdk/ + ../src/pal/linux_dpdk/dpdk1702/ ../src/pal/common/ ../src/ @@ -633,7 +648,7 @@ dpdk_includes_verb_path ='' dpdk_includes_path =''' ../src/ ../src/pal/linux_dpdk/ - ../src/pal/linux_dpdk/dpdk + ../src/pal/linux_dpdk/dpdk1702/ ../src/dpdk/drivers/ ../src/dpdk/drivers/net/ ../src/dpdk/drivers/net/af_packet/ @@ -658,6 +673,7 @@ dpdk_includes_path =''' ../src/ ../src/dpdk/drivers/net/pcap/ ../src/dpdk/drivers/net/ring/ ../src/dpdk/drivers/net/virtio/ +../src/dpdk/drivers/net/virtio/virtio_user/ ../src/dpdk/drivers/net/vmxnet3/ ../src/dpdk/drivers/net/vmxnet3/base ../src/dpdk/drivers/net/xenvirt/ diff --git a/scripts/automation/regression/stateless_tests/stl_rx_test.py b/scripts/automation/regression/stateless_tests/stl_rx_test.py index 3d4ed977..e0f32a78 100644 --- a/scripts/automation/regression/stateless_tests/stl_rx_test.py +++ b/scripts/automation/regression/stateless_tests/stl_rx_test.py @@ -10,13 +10,13 @@ class STLRX_Test(CStlGeneral_Test): def setUp(self): per_driver_params = { - 'rte_vmxnet3_pmd': { + 'net_vmxnet3': { 'rate_percent': 1, 'total_pkts': 50, 'rate_latency': 1, 'latency_9k_enable': False, }, - 'rte_ixgbe_pmd': { + 'net_ixgbe': { 'rate_percent': 30, 'total_pkts': 1000, 'rate_latency': 1, @@ -24,7 +24,14 @@ class STLRX_Test(CStlGeneral_Test): 'latency_9k_max_average': 300, 'latency_9k_max_latency': 400, }, - 'rte_i40e_pmd': { + 'net_ixgbe_vf': { + 'rate_percent': 30, + 'total_pkts': 1000, + 'rate_latency': 1, + 'latency_9k_enable': False, + }, + + 'net_i40e': { 'rate_percent': 80, 'total_pkts': 1000, 'rate_latency': 1, @@ -32,25 +39,25 @@ class STLRX_Test(CStlGeneral_Test): 'latency_9k_max_average': 100, 'latency_9k_max_latency': 250, }, - 'rte_i40evf_pmd': { + 'net_i40e_vf': { 'rate_percent': 80, 'total_pkts': 1000, 'rate_latency': 1, 'latency_9k_enable': False, }, - 'rte_igb_pmd': { + 'net_e1000_igb': { 'rate_percent': 80, 'total_pkts': 500, 'rate_latency': 1, 'latency_9k_enable': False, }, - 'rte_em_pmd': { + 'net_e1000_em': { 'rate_percent': 1, 'total_pkts': 50, 'rate_latency': 1, 'latency_9k_enable': False, }, - 'rte_virtio_pmd': { + 'net_virtio': { 'rate_percent': 1, 'total_pkts': 50, 'rate_latency': 1, @@ -67,7 +74,7 @@ class STLRX_Test(CStlGeneral_Test): 'latency_9k_max_latency': 250, }, - 'rte_enic_pmd': { + 'net_enic': { 'rate_percent': 1, 'total_pkts': 50, 'rate_latency': 1, @@ -93,7 +100,7 @@ class STLRX_Test(CStlGeneral_Test): self.cap = cap drv_name = port_info['driver'] - if drv_name == 'rte_ixgbe_pmd': + if drv_name == 'net_ixgbe': self.ipv6_support = False else: self.ipv6_support = True diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py index b2c9eb09..8915788d 100755 --- a/scripts/dpdk_setup_ports.py +++ b/scripts/dpdk_setup_ports.py @@ -573,13 +573,15 @@ Other network devices if not dpdk_nic_bind.confirm('Confirm (y/N):'): return drivers_table = { - 'rte_ixgbe_pmd': 'ixgbe', - 'rte_igb_pmd': 'igb', - 'rte_i40e_pmd': 'i40e', - 'rte_em_pmd': 'e1000', - 'rte_vmxnet3_pmd': 'vmxnet3', - 'rte_virtio_pmd': 'virtio-pci', - 'rte_enic_pmd': 'enic', + 'net_ixgbe': 'ixgbe', + 'net_ixgbe_vf': 'ixgbe_vf', + 'net_e1000_igb': 'e1000_igb', + 'net_i40e': 'i40e', + 'net_i40e_vf': 'i40e_vf', + 'net_e1000_em': 'e1000_em', + 'net_vmxnet3': 'vmxnet3', + 'net_virtio': 'virtio-pci', + 'net_enic': 'enic', } for pci, info in dpdk_nic_bind.get_info_from_trex(dpdk_interfaces).items(): if pci not in self.m_devices: diff --git a/src/dpdk/drivers/net/enic/enic_clsf.c b/src/dpdk/drivers/net/enic/enic_clsf.c index bcf479ac..6129d709 100644 --- a/src/dpdk/drivers/net/enic/enic_clsf.c +++ b/src/dpdk/drivers/net/enic/enic_clsf.c @@ -132,6 +132,28 @@ copy_fltr_v1(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, fltr->u.ipv4.flags = FILTER_FIELDS_IPV4_5TUPLE; } +#define TREX_PATCH +#ifdef TREX_PATCH +void +copy_fltr_recv_all(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, + struct rte_eth_fdir_masks *masks) { + struct filter_generic_1 *gp = &fltr->u.generic_1; + memset(gp, 0, sizeof(*gp)); + + struct ether_hdr eth_mask, eth_val; + memset(ð_mask, 0, sizeof(eth_mask)); + memset(ð_val, 0, sizeof(eth_val)); + + eth_val.ether_type = 0xdead; + eth_mask.ether_type = 0; + + gp->position = 0; + enic_set_layer(gp, 0, FILTER_GENERIC_1_L2, + ð_mask, ð_val, sizeof(struct ether_hdr)); + +} +#endif + /* Copy Flow Director filter to a VIC generic filter (requires advanced * filter support. */ @@ -144,6 +166,11 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, fltr->type = FILTER_DPDK_1; memset(gp, 0, sizeof(*gp)); +#ifdef TREX_PATCH + // important for this to be below 2. + // If added with position 2, IPv6 UDP and ICMP seems to be caught by some other rule + gp->position = 1; +#endif if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP) { struct udp_hdr udp_mask, udp_val; @@ -338,7 +365,11 @@ int enic_fdir_del_fltr(struct enic *enic, struct rte_eth_fdir_filter *params) case -EINVAL: case -ENOENT: enic->fdir.stats.f_remove++; +#ifdef TREX_PATCH + return pos; +#else return -EINVAL; +#endif default: /* The entry is present in the table */ key = enic->fdir.nodes[pos]; @@ -449,8 +480,19 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params) key->filter = *params; key->rq_index = queue; +#ifdef TREX_PATCH + switch (params->soft_id) { + case 100: + copy_fltr_recv_all(&fltr, ¶ms->input, &enic->rte_dev->data->dev_conf.fdir_conf.mask); + break; + default: +#endif + enic->fdir.copy_fltr_fn(&fltr, ¶ms->input, &enic->rte_dev->data->dev_conf.fdir_conf.mask); +#ifdef TREX_PATCH + } +#endif if (!vnic_dev_classifier(enic->vdev, CLSF_ADD, &queue, &fltr)) { key->fltr_id = queue; diff --git a/src/dpdk/drivers/net/enic/enic_main.c b/src/dpdk/drivers/net/enic/enic_main.c index aece2f05..54a3a896 100644 --- a/src/dpdk/drivers/net/enic/enic_main.c +++ b/src/dpdk/drivers/net/enic/enic_main.c @@ -175,11 +175,15 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) */ rx_packet_errors = rte_atomic64_read(&soft_stats->rx_packet_errors); rx_truncated = rx_packet_errors - stats->rx.rx_errors; +#define TREX_PATCH +#ifdef TREX_PATCH + // This used to be in older DPDK version, and seems to be needed. Was removed for some reason in dpdk1702. + rx_truncated -= stats->rx.rx_no_bufs; +#endif r_stats->ipackets = stats->rx.rx_frames_ok - rx_truncated; r_stats->opackets = stats->tx.tx_frames_ok; -#define TREX_PATCH #ifdef TREX_PATCH r_stats->ibytes = stats->rx.rx_unicast_bytes_ok+stats->rx.rx_multicast_bytes_ok+stats->rx.rx_broadcast_bytes_ok; #else diff --git a/src/dpdk_funcs.c b/src/dpdk_funcs.c index 99d23276..251ba8f9 100644 --- a/src/dpdk_funcs.c +++ b/src/dpdk_funcs.c @@ -92,3 +92,111 @@ void i40e_trex_fdir_reg_init(int port_id, int mode) I40E_WRITE_REG(hw, I40E_GLQF_FD_MSK(0,44), 0x000C00FF); I40E_WRITE_FLUSH(hw); } + +// fill stats array with fdir rules match count statistics +// Notice that we read statistics from start to start + len, but we fill the stats are +// starting from 0 with len values +void +i40e_trex_fdir_stats_get(struct rte_eth_dev *dev, uint32_t *stats, uint32_t start, uint32_t len) +{ + int i; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + for (i = 0; i < len; i++) { + stats[i] = I40E_READ_REG(hw, I40E_GLQF_PCNT(i + start)); + } +} + +void +i40e_trex_fdir_stats_reset(struct rte_eth_dev *dev, uint32_t *stats, uint32_t start, uint32_t len) +{ + int i; + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + for (i = 0; i < len; i++) { + if (stats) { + stats[i] = I40E_READ_REG(hw, I40E_GLQF_PCNT(i + start)); + } + I40E_WRITE_REG(hw, I40E_GLQF_PCNT(i + start), 0xffffffff); + } +} + +int +i40e_trex_get_fw_ver(struct rte_eth_dev *dev, uint32_t *nvm_ver) +{ + struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + *nvm_ver = hw->nvm.version; + return 0; +} + +/* This function existed in older DPDK versions. We keep it */ +int +rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id) +{ + int i; + struct rte_pci_device *pci_dev = NULL; + + if (addr == NULL) { + RTE_PMD_DEBUG_TRACE("Null pointer is specified\n"); + return -EINVAL; + } + + *port_id = RTE_MAX_ETHPORTS; + + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { + if ( + !rte_eal_compare_pci_addr(&rte_eth_devices[i].device->devargs->pci.addr, addr)) { + + *port_id = i; + + return 0; + } + } + return -ENODEV; +} + +// return in stats, statistics starting from start, for len counters. +int +rte_eth_fdir_stats_get(uint8_t port_id, uint32_t *stats, uint32_t start, uint32_t len) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); + + dev = &rte_eth_devices[port_id]; + + // Only xl710 support this + i40e_trex_fdir_stats_get(dev, stats, start, len); + + return 0; +} + +// zero statistics counters, starting from start, for len counters. +int +rte_eth_fdir_stats_reset(uint8_t port_id, uint32_t *stats, uint32_t start, uint32_t len) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); + + dev = &rte_eth_devices[port_id]; + + // Only xl710 support this + i40e_trex_fdir_stats_reset(dev, stats, start, len); + + return 0; +} + +int +rte_eth_get_fw_ver(int port_id, uint32_t *version) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); + + dev = &rte_eth_devices[port_id]; + + // Only xl710 support this + return i40e_trex_get_fw_ver(dev, version); +} diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index 687cf457..3eb64917 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -612,18 +612,18 @@ private: CTRexExtendedDriverBase * create_driver(std::string name); CTRexExtendedDriverDb(){ - register_driver(std::string("rte_ixgbe_pmd"),CTRexExtendedDriverBase10G::create); - register_driver(std::string("rte_igb_pmd"),CTRexExtendedDriverBase1G::create); - register_driver(std::string("rte_i40e_pmd"),CTRexExtendedDriverBase40G::create); - register_driver(std::string("rte_enic_pmd"),CTRexExtendedDriverBaseVIC::create); + register_driver(std::string("net_ixgbe"),CTRexExtendedDriverBase10G::create); + register_driver(std::string("net_e1000_igb"),CTRexExtendedDriverBase1G::create); + register_driver(std::string("net_i40e"),CTRexExtendedDriverBase40G::create); + register_driver(std::string("net_enic"),CTRexExtendedDriverBaseVIC::create); register_driver(std::string("net_mlx5"),CTRexExtendedDriverBaseMlnx5G::create); /* virtual devices */ - register_driver(std::string("rte_em_pmd"), CTRexExtendedDriverBaseE1000::create); - register_driver(std::string("rte_vmxnet3_pmd"), CTRexExtendedDriverVmxnet3::create); - register_driver(std::string("rte_virtio_pmd"), CTRexExtendedDriverVirtio::create); - register_driver(std::string("rte_i40evf_pmd"), CTRexExtendedDriverI40evf::create); - register_driver(std::string("rte_ixgbevf_pmd"), CTRexExtendedDriverIxgbevf::create); + register_driver(std::string("net_e1000_em"), CTRexExtendedDriverBaseE1000::create); + register_driver(std::string("net_vmxnet3"), CTRexExtendedDriverVmxnet3::create); + register_driver(std::string("net_virtio"), CTRexExtendedDriverVirtio::create); + register_driver(std::string("net_i40e_vf"), CTRexExtendedDriverI40evf::create); + register_driver(std::string("net_ixgbe_vf"), CTRexExtendedDriverIxgbevf::create); m_driver_was_set=false; m_drv=0; @@ -1700,7 +1700,7 @@ void DpdkTRexPortAttr::update_description(){ char pci[16]; char * envvar; std::string pci_envvar_name; - pci_addr = rte_eth_devices[m_port_id].pci_dev->addr; + pci_addr = rte_eth_devices[m_port_id].device->devargs->pci.addr; snprintf(pci, sizeof(pci), "%04x:%02x:%02x.%d", pci_addr.domain, pci_addr.bus, pci_addr.devid, pci_addr.function); intf_info_st.pci_addr = pci; pci_envvar_name = "pci" + intf_info_st.pci_addr; @@ -5663,12 +5663,12 @@ void dump_interfaces_info() { for (uint8_t port_id=0; port_idaddr; + pci_addr = rte_eth_devices[port_id].device->devargs->pci.addr; rte_eth_macaddr_get(port_id, &mac_addr); ether_format_addr(mac_str, sizeof mac_str, &mac_addr); printf("PCI: %04x:%02x:%02x.%d - MAC: %s - Driver: %s\n", pci_addr.domain, pci_addr.bus, pci_addr.devid, pci_addr.function, mac_str, - rte_eth_devices[port_id].pci_dev->driver->name); + rte_eth_devices[port_id].device->devargs->virt.drv_name); } } @@ -6558,10 +6558,13 @@ void CTRexExtendedDriverBase40G::add_del_rules(enum rte_filter_op op, uint8_t po } ret = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_FDIR, op, (void*)&filter); +#if 0 + //????????? fix if ( ret != 0 ) { rte_exit(EXIT_FAILURE, "rte_eth_dev_filter_ctrl: err=%d, port=%u\n", ret, port_id); } +#endif } int CTRexExtendedDriverBase40G::add_del_eth_type_rule(uint8_t port_id, enum rte_filter_op op, uint16_t eth_type) { @@ -7357,7 +7360,7 @@ TrexDpdkPlatformApi::get_interface_info(uint8_t interface_id, intf_info_st &info memcpy(info.hw_macaddr, rte_mac_addr.addr_bytes, 6); - info.numa_node = g_trex.m_ports[interface_id].m_dev_info.pci_dev->numa_node; + info.numa_node = g_trex.m_ports[interface_id].m_dev_info.pci_dev->device.numa_node; struct rte_pci_addr *loc = &g_trex.m_ports[interface_id].m_dev_info.pci_dev->addr; char pci_addr[50]; -- cgit 1.2.3-korg