summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dpdk/drivers/net/enic/enic_clsf.c42
-rw-r--r--src/dpdk/drivers/net/enic/enic_main.c6
-rw-r--r--src/dpdk_funcs.c108
-rw-r--r--src/main_dpdk.cpp29
4 files changed, 171 insertions, 14 deletions
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(&eth_mask, 0, sizeof(eth_mask));
+ memset(&eth_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,
+ &eth_mask, &eth_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, &params->input, &enic->rte_dev->data->dev_conf.fdir_conf.mask);
+ break;
+ default:
+#endif
+
enic->fdir.copy_fltr_fn(&fltr, &params->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_id<m_max_ports; port_id++) {
// PCI, MAC and Driver
- pci_addr = rte_eth_devices[port_id].pci_dev->addr;
+ 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];