diff options
author | Ido Barnea <ibarnea@cisco.com> | 2017-02-08 12:24:23 +0200 |
---|---|---|
committer | Ido Barnea <ibarnea@cisco.com> | 2017-02-13 12:32:26 +0200 |
commit | 93f15e3020f641feaa187ce3b7beb62c4cacae6b (patch) | |
tree | 8d8399925fc2d1fd9b7b2a496a89888878e2edaf /src/dpdk/drivers | |
parent | 984a76ad385760ddd045e8a6c8d71fb07f5c3f78 (diff) |
dpdk1702-rc3 upstream changes
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/dpdk/drivers')
24 files changed, 292 insertions, 175 deletions
diff --git a/src/dpdk/drivers/net/bnx2x/bnx2x.c b/src/dpdk/drivers/net/bnx2x/bnx2x.c index cc380bd5..1a7e1c8e 100644 --- a/src/dpdk/drivers/net/bnx2x/bnx2x.c +++ b/src/dpdk/drivers/net/bnx2x/bnx2x.c @@ -31,7 +31,7 @@ #define BNX2X_PMD_VER_PREFIX "BNX2X PMD" #define BNX2X_PMD_VERSION_MAJOR 1 #define BNX2X_PMD_VERSION_MINOR 0 -#define BNX2X_PMD_VERSION_REVISION 1 +#define BNX2X_PMD_VERSION_REVISION 5 #define BNX2X_PMD_VERSION_PATCH 1 static inline const char * diff --git a/src/dpdk/drivers/net/e1000/base/README b/src/dpdk/drivers/net/e1000/base/README index 8d48135a..de1ae4cf 100644 --- a/src/dpdk/drivers/net/e1000/base/README +++ b/src/dpdk/drivers/net/e1000/base/README @@ -1,7 +1,7 @@ .. BSD LICENSE - Copyright(c) 2010-2015 Intel Corporation. All rights reserved. + Copyright(c) 2010-2016 Intel Corporation. All rights reserved. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -31,9 +31,30 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This directory contains source code of FreeBSD em & igb drivers of version -cid-shared-code.2015.10.09 released by ND. The sub-directory of base/ +cid-shared-code.2016.11.22 released by ND. The sub-directory of base/ contains the original source package. +This driver is valid for the product(s) listed below +* Intel® Ethernet Controller 82540 +* Intel® Ethernet Controller 82545 Series +* Intel® Ethernet Controller 82546 Series +* Intel® Ethernet Controller 82571 Series +* Intel® Ethernet Controller 82572 Series +* Intel® Ethernet Controller 82573 +* Intel® Ethernet Controller 82574 +* Intel® Ethernet Controller 82583 +* Intel® Ethernet Controller I217 Series +* Intel® Ethernet Controller I218 Series +* Intel® Ethernet Controller I219 Series +* Intel® Ethernet Controller 82576 Series +* Intel® Ethernet Controller 82575 Series +* Intel® Ethernet Controller 82580 Series +* Intel® Ethernet Controller I350 Series +* Intel® Ethernet Controller I210 Series +* Intel® Ethernet Controller I211 +* Intel® Ethernet Controller I354 Series +* Intel® Ethernet Controller DH89XXCC Series + Updating the driver =================== diff --git a/src/dpdk/drivers/net/e1000/em_ethdev.c b/src/dpdk/drivers/net/e1000/em_ethdev.c index d778785d..4066ef9a 100644 --- a/src/dpdk/drivers/net/e1000/em_ethdev.c +++ b/src/dpdk/drivers/net/e1000/em_ethdev.c @@ -339,7 +339,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; hw->hw_addr = (void *)pci_dev->mem_resource[0].addr; hw->device_id = pci_dev->id.device_id; diff --git a/src/dpdk/drivers/net/e1000/igb_ethdev.c b/src/dpdk/drivers/net/e1000/igb_ethdev.c index d9397744..a112b380 100644 --- a/src/dpdk/drivers/net/e1000/igb_ethdev.c +++ b/src/dpdk/drivers/net/e1000/igb_ethdev.c @@ -777,7 +777,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; hw->hw_addr= (void *)pci_dev->mem_resource[0].addr; @@ -986,7 +986,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) pci_dev = E1000_DEV_TO_PCI(eth_dev); rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id; diff --git a/src/dpdk/drivers/net/e1000/igb_rxtx.c b/src/dpdk/drivers/net/e1000/igb_rxtx.c index 45f3f249..c9cf3924 100644 --- a/src/dpdk/drivers/net/e1000/igb_rxtx.c +++ b/src/dpdk/drivers/net/e1000/igb_rxtx.c @@ -72,12 +72,18 @@ #include "base/e1000_api.h" #include "e1000_ethdev.h" +#ifdef RTE_LIBRTE_IEEE1588 +#define IGB_TX_IEEE1588_TMST PKT_TX_IEEE1588_TMST +#else +#define IGB_TX_IEEE1588_TMST 0 +#endif /* Bit Mask to indicate what bits required for building TX context */ #define IGB_TX_OFFLOAD_MASK ( \ PKT_TX_VLAN_PKT | \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ - PKT_TX_TCP_SEG) + PKT_TX_TCP_SEG | \ + IGB_TX_IEEE1588_TMST) #define IGB_TX_OFFLOAD_NOTSUP_MASK \ (PKT_TX_OFFLOAD_MASK ^ IGB_TX_OFFLOAD_MASK) diff --git a/src/dpdk/drivers/net/enic/enic.h b/src/dpdk/drivers/net/enic/enic.h index a4540178..e921de40 100644 --- a/src/dpdk/drivers/net/enic/enic.h +++ b/src/dpdk/drivers/net/enic/enic.h @@ -103,6 +103,7 @@ struct enic_fdir { struct enic_soft_stats { rte_atomic64_t rx_nombuf; rte_atomic64_t rx_packet_errors; + rte_atomic64_t tx_oversized; }; struct enic_memzone_entry { diff --git a/src/dpdk/drivers/net/enic/enic_clsf.c b/src/dpdk/drivers/net/enic/enic_clsf.c index 6129d709..792a2896 100644 --- a/src/dpdk/drivers/net/enic/enic_clsf.c +++ b/src/dpdk/drivers/net/enic/enic_clsf.c @@ -166,6 +166,7 @@ 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 @@ -238,15 +239,15 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, memset(&ip4_val, 0, sizeof(struct ipv4_hdr)); if (input->flow.ip4_flow.tos) { - ip4_mask.type_of_service = 0xff; + ip4_mask.type_of_service = masks->ipv4_mask.tos; ip4_val.type_of_service = input->flow.ip4_flow.tos; } if (input->flow.ip4_flow.ttl) { - ip4_mask.time_to_live = 0xff; + ip4_mask.time_to_live = masks->ipv4_mask.ttl; ip4_val.time_to_live = input->flow.ip4_flow.ttl; } if (input->flow.ip4_flow.proto) { - ip4_mask.next_proto_id = 0xff; + ip4_mask.next_proto_id = masks->ipv4_mask.proto; ip4_val.next_proto_id = input->flow.ip4_flow.proto; } if (input->flow.ip4_flow.src_ip) { @@ -326,7 +327,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, memset(&ipv6_val, 0, sizeof(struct ipv6_hdr)); if (input->flow.ipv6_flow.proto) { - ipv6_mask.proto = 0xff; + ipv6_mask.proto = masks->ipv6_mask.proto; ipv6_val.proto = input->flow.ipv6_flow.proto; } for (i = 0; i < 4; i++) { @@ -342,11 +343,11 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow.ipv6_flow.dst_ip[i]; } if (input->flow.ipv6_flow.tc) { - ipv6_mask.vtc_flow = 0x00ff0000; - ipv6_val.vtc_flow = input->flow.ipv6_flow.tc << 16; + ipv6_mask.vtc_flow = masks->ipv6_mask.tc << 12; + ipv6_val.vtc_flow = input->flow.ipv6_flow.tc << 12; } if (input->flow.ipv6_flow.hop_limits) { - ipv6_mask.hop_limits = 0xff; + ipv6_mask.hop_limits = masks->ipv6_mask.hop_limits; ipv6_val.hop_limits = input->flow.ipv6_flow.hop_limits; } @@ -487,7 +488,6 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params) break; default: #endif - enic->fdir.copy_fltr_fn(&fltr, ¶ms->input, &enic->rte_dev->data->dev_conf.fdir_conf.mask); #ifdef TREX_PATCH diff --git a/src/dpdk/drivers/net/enic/enic_main.c b/src/dpdk/drivers/net/enic/enic_main.c index 54a3a896..b051584e 100644 --- a/src/dpdk/drivers/net/enic/enic_main.c +++ b/src/dpdk/drivers/net/enic/enic_main.c @@ -137,6 +137,7 @@ static void enic_clear_soft_stats(struct enic *enic) struct enic_soft_stats *soft_stats = &enic->soft_stats; rte_atomic64_clear(&soft_stats->rx_nombuf); rte_atomic64_clear(&soft_stats->rx_packet_errors); + rte_atomic64_clear(&soft_stats->tx_oversized); } static void enic_init_soft_stats(struct enic *enic) @@ -144,6 +145,7 @@ static void enic_init_soft_stats(struct enic *enic) struct enic_soft_stats *soft_stats = &enic->soft_stats; rte_atomic64_init(&soft_stats->rx_nombuf); rte_atomic64_init(&soft_stats->rx_packet_errors); + rte_atomic64_init(&soft_stats->tx_oversized); enic_clear_soft_stats(enic); } @@ -192,7 +194,8 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) r_stats->obytes = stats->tx.tx_bytes_ok; r_stats->ierrors = stats->rx.rx_errors + stats->rx.rx_drop; - r_stats->oerrors = stats->tx.tx_errors; + r_stats->oerrors = stats->tx.tx_errors + + rte_atomic64_read(&soft_stats->tx_oversized); r_stats->imissed = stats->rx.rx_no_bufs + rx_truncated; diff --git a/src/dpdk/drivers/net/enic/enic_res.c b/src/dpdk/drivers/net/enic/enic_res.c index 8a230a16..867bd25c 100644 --- a/src/dpdk/drivers/net/enic/enic_res.c +++ b/src/dpdk/drivers/net/enic/enic_res.c @@ -89,10 +89,11 @@ int enic_get_vnic_config(struct enic *enic) /* max packet size is only defined in newer VIC firmware * and will be 0 for legacy firmware and VICs */ - if (c->max_pkt_size > ENIC_DEFAULT_MAX_PKT_SIZE) + if (c->max_pkt_size > ENIC_DEFAULT_RX_MAX_PKT_SIZE) enic->max_mtu = c->max_pkt_size - (ETHER_HDR_LEN + 4); else - enic->max_mtu = ENIC_DEFAULT_MAX_PKT_SIZE - (ETHER_HDR_LEN + 4); + enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE + - (ETHER_HDR_LEN + 4); if (c->mtu == 0) c->mtu = 1500; diff --git a/src/dpdk/drivers/net/enic/enic_res.h b/src/dpdk/drivers/net/enic/enic_res.h index 303530ef..1135d2e1 100644 --- a/src/dpdk/drivers/net/enic/enic_res.h +++ b/src/dpdk/drivers/net/enic/enic_res.h @@ -48,7 +48,10 @@ #define ENIC_MIN_MTU 68 /* Does not include (possible) inserted VLAN tag and FCS */ -#define ENIC_DEFAULT_MAX_PKT_SIZE 9022 +#define ENIC_DEFAULT_RX_MAX_PKT_SIZE 9022 + +/* Does not include (possible) inserted VLAN tag and FCS */ +#define ENIC_TX_MAX_PKT_SIZE 9208 #define ENIC_MULTICAST_PERFECT_FILTERS 32 #define ENIC_UNICAST_PERFECT_FILTERS 32 diff --git a/src/dpdk/drivers/net/enic/enic_rxtx.c b/src/dpdk/drivers/net/enic/enic_rxtx.c index 26b83ae9..343dabc6 100644 --- a/src/dpdk/drivers/net/enic/enic_rxtx.c +++ b/src/dpdk/drivers/net/enic/enic_rxtx.c @@ -546,16 +546,23 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, for (index = 0; index < nb_pkts; index++) { tx_pkt = *tx_pkts++; + pkt_len = tx_pkt->pkt_len; + data_len = tx_pkt->data_len; + ol_flags = tx_pkt->ol_flags; nb_segs = tx_pkt->nb_segs; + + if (pkt_len > ENIC_TX_MAX_PKT_SIZE) { + rte_pktmbuf_free(tx_pkt); + rte_atomic64_inc(&enic->soft_stats.tx_oversized); + continue; + } + if (nb_segs > wq_desc_avail) { if (index > 0) goto post; goto done; } - pkt_len = tx_pkt->pkt_len; - data_len = tx_pkt->data_len; - ol_flags = tx_pkt->ol_flags; mss = 0; vlan_id = 0; vlan_tag_insert = 0; diff --git a/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c b/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c index dd021e46..c4fe746c 100644 --- a/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c +++ b/src/dpdk/drivers/net/fm10k/fm10k_ethdev.c @@ -2858,7 +2858,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) return 0; rte_eth_copy_pci_info(dev, pdev); - dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; macvlan = FM10K_DEV_PRIVATE_TO_MACVLAN(dev->data->dev_private); memset(macvlan, 0, sizeof(*macvlan)); diff --git a/src/dpdk/drivers/net/i40e/i40e_ethdev.c b/src/dpdk/drivers/net/i40e/i40e_ethdev.c index f8ee5a60..8bf8554a 100644 --- a/src/dpdk/drivers/net/i40e/i40e_ethdev.c +++ b/src/dpdk/drivers/net/i40e/i40e_ethdev.c @@ -1048,7 +1048,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) intr_handle = &pci_dev->intr_handle; rte_eth_copy_pci_info(dev, pci_dev); - dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; pf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); pf->adapter->eth_dev = dev; @@ -2223,11 +2223,11 @@ i40e_dev_link_update(struct rte_eth_dev *dev, } link.link_status = link_status.link_info & I40E_AQ_LINK_UP; - if (!wait_to_complete) + if (!wait_to_complete || link.link_status) break; rte_delay_ms(CHECK_INTERVAL); - } while (!link.link_status && rep_cnt--); + } while (--rep_cnt); if (!link.link_status) goto out; @@ -6777,6 +6777,12 @@ i40e_tunnel_filter_convert(struct i40e_aqc_add_remove_cloud_filters_element_data ether_addr_copy((struct ether_addr *)&cld_filter->inner_mac, (struct ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->inner_vlan; + if ((rte_le_to_cpu_16(cld_filter->flags) & + I40E_AQC_ADD_CLOUD_FLAGS_IPV6) == + I40E_AQC_ADD_CLOUD_FLAGS_IPV6) + tunnel_filter->input.ip_type = I40E_TUNNEL_IPTYPE_IPV6; + else + tunnel_filter->input.ip_type = I40E_TUNNEL_IPTYPE_IPV4; tunnel_filter->input.flags = cld_filter->flags; tunnel_filter->input.tenant_id = cld_filter->tenant_id; tunnel_filter->queue = cld_filter->queue_number; @@ -8804,6 +8810,10 @@ i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype) #define I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x011f0200 #define I40E_GL_SWR_PRI_JOIN_MAP_2 0x26CE08 +/* For X722 */ +#define I40E_X722_GL_SWR_PRI_JOIN_MAP_0_VALUE 0x20000200 +#define I40E_X722_GL_SWR_PRI_JOIN_MAP_2_VALUE 0x013F0200 + /* For X710 */ #define I40E_GL_SWR_PM_UP_THR_EF_VALUE 0x03030303 /* For XL710 */ @@ -8826,7 +8836,6 @@ i40e_dev_sync_phy_type(struct i40e_hw *hw) return 0; } - static void i40e_configure_registers(struct i40e_hw *hw) { @@ -8834,8 +8843,8 @@ i40e_configure_registers(struct i40e_hw *hw) uint32_t addr; uint64_t val; } reg_table[] = { - {I40E_GL_SWR_PRI_JOIN_MAP_0, I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE}, - {I40E_GL_SWR_PRI_JOIN_MAP_2, I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE}, + {I40E_GL_SWR_PRI_JOIN_MAP_0, 0}, + {I40E_GL_SWR_PRI_JOIN_MAP_2, 0}, {I40E_GL_SWR_PM_UP_THR, 0}, /* Compute value dynamically */ }; uint64_t reg; @@ -8843,6 +8852,24 @@ i40e_configure_registers(struct i40e_hw *hw) int ret; for (i = 0; i < RTE_DIM(reg_table); i++) { + if (reg_table[i].addr == I40E_GL_SWR_PRI_JOIN_MAP_0) { + if (hw->mac.type == I40E_MAC_X722) /* For X722 */ + reg_table[i].val = + I40E_X722_GL_SWR_PRI_JOIN_MAP_0_VALUE; + else /* For X710/XL710/XXV710 */ + reg_table[i].val = + I40E_GL_SWR_PRI_JOIN_MAP_0_VALUE; + } + + if (reg_table[i].addr == I40E_GL_SWR_PRI_JOIN_MAP_2) { + if (hw->mac.type == I40E_MAC_X722) /* For X722 */ + reg_table[i].val = + I40E_X722_GL_SWR_PRI_JOIN_MAP_2_VALUE; + else /* For X710/XL710/XXV710 */ + reg_table[i].val = + I40E_GL_SWR_PRI_JOIN_MAP_2_VALUE; + } + if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) { if (I40E_PHY_TYPE_SUPPORT_40G(hw->phy.phy_types) || /* For XL710 */ I40E_PHY_TYPE_SUPPORT_25G(hw->phy.phy_types)) /* For XXV710 */ @@ -10338,16 +10365,14 @@ i40e_filter_restore(struct i40e_pf *pf) i40e_fdir_filter_restore(pf); } -static int -is_i40e_pmd(const char *driver_name) +static bool +is_device_supported(struct rte_eth_dev *dev, struct eth_driver *drv) { - if (!strstr(driver_name, "i40e")) - return -ENOTSUP; - - if (strstr(driver_name, "i40e_vf")) - return -ENOTSUP; + if (strcmp(dev->driver->pci_drv.driver.name, + drv->pci_drv.driver.name)) + return false; - return 0; + return true; } int @@ -10360,7 +10385,7 @@ rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10389,7 +10414,7 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10493,7 +10518,7 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf_id, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10751,7 +10776,7 @@ rte_pmd_i40e_set_tx_loopback(uint8_t port, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10793,7 +10818,7 @@ rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10834,7 +10859,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port, uint16_t vf_id, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10880,7 +10905,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id, dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10917,7 +10942,7 @@ rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf_id, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -10960,7 +10985,7 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id, dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -11024,7 +11049,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id, dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -11080,7 +11105,7 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on) dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -11143,7 +11168,7 @@ int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; if (vlan_id > ETHER_MAX_VLAN_ID) { @@ -11206,7 +11231,7 @@ rte_pmd_i40e_get_vf_stats(uint8_t port, dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -11250,7 +11275,7 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port, dev = &rte_eth_devices[port]; - if (is_i40e_pmd(dev->data->drv_name)) + if (!is_device_supported(dev, &rte_i40e_pmd)) return -ENOTSUP; pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); diff --git a/src/dpdk/drivers/net/i40e/i40e_ethdev.h b/src/dpdk/drivers/net/i40e/i40e_ethdev.h index 9e2f7a28..f5458506 100644 --- a/src/dpdk/drivers/net/i40e/i40e_ethdev.h +++ b/src/dpdk/drivers/net/i40e/i40e_ethdev.h @@ -290,7 +290,7 @@ struct i40e_bw_info { /* Relative credits within same TC with respect to other VSIs or Comps */ uint8_t bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS]; /* Bandwidth limit per TC */ - uint8_t bw_ets_credits[I40E_MAX_TRAFFIC_CLASS]; + uint16_t bw_ets_credits[I40E_MAX_TRAFFIC_CLASS]; /* Max bandwidth limit per TC */ uint8_t bw_ets_max[I40E_MAX_TRAFFIC_CLASS]; }; @@ -499,11 +499,17 @@ struct i40e_ethertype_rule { /* Tunnel filter number HW supports */ #define I40E_MAX_TUNNEL_FILTER_NUM 400 +enum i40e_tunnel_iptype { + I40E_TUNNEL_IPTYPE_IPV4, + I40E_TUNNEL_IPTYPE_IPV6, +}; + /* Tunnel filter struct */ struct i40e_tunnel_filter_input { uint8_t outer_mac[6]; /* Outer mac address to match */ uint8_t inner_mac[6]; /* Inner mac address to match */ uint16_t inner_vlan; /* Inner vlan address to match */ + enum i40e_tunnel_iptype ip_type; uint16_t flags; /* Filter type flag */ uint32_t tenant_id; /* Tenant id to match */ }; diff --git a/src/dpdk/drivers/net/i40e/i40e_ethdev_vf.c b/src/dpdk/drivers/net/i40e/i40e_ethdev_vf.c index a606aefe..55fd3442 100644 --- a/src/dpdk/drivers/net/i40e/i40e_ethdev_vf.c +++ b/src/dpdk/drivers/net/i40e/i40e_ethdev_vf.c @@ -980,7 +980,7 @@ i40evf_get_statistics(struct rte_eth_dev *dev, struct rte_eth_stats *stats) pstats->rx_broadcast; stats->opackets = pstats->tx_broadcast + pstats->tx_multicast + pstats->tx_unicast; - stats->ierrors = pstats->rx_discards; + stats->imissed = pstats->rx_discards; stats->oerrors = pstats->tx_errors + pstats->tx_discards; stats->ibytes = pstats->rx_bytes; stats->obytes = pstats->tx_bytes; @@ -1478,7 +1478,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) } rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; hw->vendor_id = pci_dev->id.vendor_id; hw->device_id = pci_dev->id.device_id; diff --git a/src/dpdk/drivers/net/i40e/i40e_flow.c b/src/dpdk/drivers/net/i40e/i40e_flow.c index 76bb3320..c6e4d877 100644 --- a/src/dpdk/drivers/net/i40e/i40e_flow.c +++ b/src/dpdk/drivers/net/i40e/i40e_flow.c @@ -1223,6 +1223,7 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, bool is_vni_masked = 0; enum rte_flow_item_type item_type; bool vxlan_flag = 0; + uint32_t tenant_id_be = 0; for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->last) { @@ -1306,16 +1307,40 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, } break; case RTE_FLOW_ITEM_TYPE_IPV4: + filter->ip_type = RTE_TUNNEL_IPTYPE_IPV4; + /* IPv4 is used to describe protocol, + * spec amd mask should be NULL. + */ + if (item->spec || item->mask) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid IPv4 item"); + return -rte_errno; + } + break; case RTE_FLOW_ITEM_TYPE_IPV6: + filter->ip_type = RTE_TUNNEL_IPTYPE_IPV6; + /* IPv6 is used to describe protocol, + * spec amd mask should be NULL. + */ + if (item->spec || item->mask) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid IPv6 item"); + return -rte_errno; + } + break; case RTE_FLOW_ITEM_TYPE_UDP: - /* IPv4/IPv6/UDP are used to describe protocol, + /* UDP is used to describe protocol, * spec amd mask should be NULL. */ if (item->spec || item->mask) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, - "Invalid IPv4 item"); + "Invalid UDP item"); return -rte_errno; } break; @@ -1364,8 +1389,9 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, & I40E_TCI_MASK; if (vxlan_spec && vxlan_mask && !is_vni_masked) { /* If there's vxlan */ - rte_memcpy(&filter->tenant_id, vxlan_spec->vni, - RTE_DIM(vxlan_spec->vni)); + rte_memcpy(((uint8_t *)&tenant_id_be + 1), + vxlan_spec->vni, 3); + filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); if (!o_eth_spec && !o_eth_mask && i_eth_spec && i_eth_mask) filter->filter_type = @@ -1402,8 +1428,9 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, /* If there's no inner vlan */ if (vxlan_spec && vxlan_mask && !is_vni_masked) { /* If there's vxlan */ - rte_memcpy(&filter->tenant_id, vxlan_spec->vni, - RTE_DIM(vxlan_spec->vni)); + rte_memcpy(((uint8_t *)&tenant_id_be + 1), + vxlan_spec->vni, 3); + filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); if (!o_eth_spec && !o_eth_mask && i_eth_spec && i_eth_mask) filter->filter_type = diff --git a/src/dpdk/drivers/net/i40e/i40e_rxtx.c b/src/dpdk/drivers/net/i40e/i40e_rxtx.c index 8aa55eef..947081db 100644 --- a/src/dpdk/drivers/net/i40e/i40e_rxtx.c +++ b/src/dpdk/drivers/net/i40e/i40e_rxtx.c @@ -75,6 +75,12 @@ #define I40E_TXD_CMD (I40E_TX_DESC_CMD_EOP | I40E_TX_DESC_CMD_RS) +#ifdef RTE_LIBRTE_IEEE1588 +#define I40E_TX_IEEE1588_TMST PKT_TX_IEEE1588_TMST +#else +#define I40E_TX_IEEE1588_TMST 0 +#endif + #define I40E_TX_CKSUM_OFFLOAD_MASK ( \ PKT_TX_IP_CKSUM | \ PKT_TX_L4_MASK | \ @@ -87,7 +93,9 @@ PKT_TX_OUTER_IP_CKSUM | \ PKT_TX_TCP_SEG | \ PKT_TX_QINQ_PKT | \ - PKT_TX_VLAN_PKT) + PKT_TX_VLAN_PKT | \ + PKT_TX_TUNNEL_MASK | \ + I40E_TX_IEEE1588_TMST) #define I40E_TX_OFFLOAD_NOTSUP_MASK \ (PKT_TX_OFFLOAD_MASK ^ I40E_TX_OFFLOAD_MASK) diff --git a/src/dpdk/drivers/net/ixgbe/base/README b/src/dpdk/drivers/net/ixgbe/base/README index 76e78051..0a6054f8 100644 --- a/src/dpdk/drivers/net/ixgbe/base/README +++ b/src/dpdk/drivers/net/ixgbe/base/README @@ -34,7 +34,8 @@ Intel® IXGBE driver =================== This directory contains source code of FreeBSD ixgbe driver of version -cid-10g-shared-code.2016.04.12 released by ND. The sub-directory of base/ +cid-10g-shared-code.2017.01.05 released by the team which develop +basic drivers for any ixgbe NIC. The sub-directory of base/ contains the original source package. This driver is valid for the product(s) listed below diff --git a/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c b/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c index 0b988b28..03caf568 100644 --- a/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/src/dpdk/drivers/net/ixgbe/ixgbe_ethdev.c @@ -253,7 +253,8 @@ static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); static void ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr); static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config); -static int is_ixgbe_pmd(const char *driver_name); +static bool is_device_supported(struct rte_eth_dev *dev, + struct eth_driver *drv); /* For Virtual Function support */ static int eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev); @@ -1172,7 +1173,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) } rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; /* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id; @@ -1626,7 +1627,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; hw->device_id = pci_dev->id.device_id; hw->vendor_id = pci_dev->id.vendor_id; @@ -4380,16 +4381,14 @@ ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) ixgbe_add_rar(dev, addr, 0, 0); } -static int -is_ixgbe_pmd(const char *driver_name) +static bool +is_device_supported(struct rte_eth_dev *dev, struct eth_driver *drv) { - if (!strstr(driver_name, "ixgbe")) - return -ENOTSUP; + if (strcmp(dev->driver->pci_drv.driver.name, + drv->pci_drv.driver.name)) + return false; - if (strstr(driver_name, "ixgbe_vf")) - return -ENOTSUP; - - return 0; + return true; } int @@ -4401,17 +4400,17 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf, int rar_entry; uint8_t *new_mac = (uint8_t *)(mac_addr); struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4902,17 +4901,17 @@ rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on) struct ixgbe_hw *hw; struct ixgbe_mac_info *mac; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (on > 1) @@ -4932,17 +4931,17 @@ rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on) struct ixgbe_hw *hw; struct ixgbe_mac_info *mac; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (on > 1) @@ -4961,17 +4960,17 @@ rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, uint16_t vlan_id) struct ixgbe_hw *hw; uint32_t ctrl; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (vlan_id > ETHER_MAX_VLAN_ID) @@ -4997,14 +4996,12 @@ rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on) struct ixgbe_hw *hw; uint32_t ctrl; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; if (on > 1) @@ -5031,14 +5028,12 @@ rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on) int i; int num_queues = (int)(IXGBE_QDE_IDX_MASK >> IXGBE_QDE_IDX_SHIFT); struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; if (on > 1) @@ -5061,18 +5056,18 @@ rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on) struct ixgbe_hw *hw; uint32_t reg_value; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; /* only support VF's 0 to 63 */ - if ((vf >= dev_info.max_vfs) || (vf > 63)) + if ((vf >= pci_dev->max_vfs) || (vf > 63)) return -EINVAL; if (on > 1) @@ -5094,19 +5089,21 @@ int rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; + struct ixgbe_hw *hw; uint16_t queues_per_pool; uint32_t q; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); + hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (on > 1) @@ -5122,8 +5119,12 @@ rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on) * first 124 queues 0-123 will be allocated to VF's and only * the last 4 queues 123-127 will be assigned to the PF. */ - - queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools; + if (hw->mac.type == ixgbe_mac_82598EB) + queues_per_pool = (uint16_t)hw->mac.max_rx_queues / + ETH_16_POOLS; + else + queues_per_pool = (uint16_t)hw->mac.max_rx_queues / + ETH_64_POOLS; for (q = 0; q < queues_per_pool; q++) (*dev->dev_ops->vlan_strip_queue_set)(dev, @@ -5136,19 +5137,19 @@ rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t { int val = 0; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; struct ixgbe_hw *hw; uint32_t vmolr; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (on > 1) @@ -5181,7 +5182,7 @@ int rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; uint32_t reg, addr; uint32_t val; const uint8_t bit1 = 0x1; @@ -5190,12 +5191,12 @@ rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on) RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (on > 1) @@ -5231,7 +5232,7 @@ int rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on) { struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; + struct rte_pci_device *pci_dev; uint32_t reg, addr; uint32_t val; const uint8_t bit1 = 0x1; @@ -5241,12 +5242,12 @@ rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on) RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (on > 1) @@ -5282,7 +5283,6 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask, uint8_t vlan_on) { struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; int ret = 0; uint16_t vf_idx; struct ixgbe_hw *hw; @@ -5290,9 +5290,8 @@ rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; if ((vlan > ETHER_MAX_VLAN_ID) || (vf_mask == 0)) @@ -5318,7 +5317,6 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate, uint64_t q_msk) { struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; struct ixgbe_hw *hw; struct ixgbe_vf_info *vfinfo; struct rte_eth_link link; @@ -5332,13 +5330,13 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); dev = &rte_eth_devices[port]; - rte_eth_dev_info_get(port, &dev_info); + pci_dev = IXGBE_DEV_TO_PCI(dev); rte_eth_link_get_nowait(port, &link); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - if (vf >= dev_info.max_vfs) + if (vf >= pci_dev->max_vfs) return -EINVAL; if (tx_rate > link.link_speed) @@ -5347,7 +5345,6 @@ int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, if (q_msk == 0) return 0; - pci_dev = IXGBE_DEV_TO_PCI(dev); hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool; @@ -8232,16 +8229,15 @@ rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp) { struct ixgbe_hw *hw; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; uint32_t ctrl; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + dev = &rte_eth_devices[port]; + + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - dev = &rte_eth_devices[port]; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); /* Stop the data paths */ @@ -8316,16 +8312,15 @@ rte_pmd_ixgbe_macsec_disable(uint8_t port) { struct ixgbe_hw *hw; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; uint32_t ctrl; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + dev = &rte_eth_devices[port]; + + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - dev = &rte_eth_devices[port]; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); /* Stop the data paths */ @@ -8381,16 +8376,15 @@ rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac) { struct ixgbe_hw *hw; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; uint32_t ctrl; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + dev = &rte_eth_devices[port]; + + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - dev = &rte_eth_devices[port]; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); ctrl = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24); @@ -8407,16 +8401,15 @@ rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi) { struct ixgbe_hw *hw; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; uint32_t ctrl; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + dev = &rte_eth_devices[port]; + + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - dev = &rte_eth_devices[port]; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); ctrl = mac[0] | (mac[1] << 8) | (mac[2] << 16) | (mac[3] << 24); @@ -8435,16 +8428,15 @@ rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an, { struct ixgbe_hw *hw; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; uint32_t ctrl, i; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + dev = &rte_eth_devices[port]; + + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - dev = &rte_eth_devices[port]; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (idx != 0 && idx != 1) @@ -8492,16 +8484,15 @@ rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an, { struct ixgbe_hw *hw; struct rte_eth_dev *dev; - struct rte_eth_dev_info dev_info; uint32_t ctrl, i; RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); - rte_eth_dev_info_get(port, &dev_info); - if (is_ixgbe_pmd(dev_info.driver_name) != 0) + dev = &rte_eth_devices[port]; + + if (!is_device_supported(dev, &rte_ixgbe_pmd)) return -ENOTSUP; - dev = &rte_eth_devices[port]; hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (idx != 0 && idx != 1) diff --git a/src/dpdk/drivers/net/ixgbe/ixgbe_flow.c b/src/dpdk/drivers/net/ixgbe/ixgbe_flow.c index 82aceed7..546c5929 100644 --- a/src/dpdk/drivers/net/ixgbe/ixgbe_flow.c +++ b/src/dpdk/drivers/net/ixgbe/ixgbe_flow.c @@ -1400,7 +1400,7 @@ ixgbe_parse_fdir_act_attr(const struct rte_flow_attr *attr, * ETH dst_addr {0xAC, 0x7B, 0xA1, {0xFF, 0xFF, 0xFF, 0x2C, 0x6D, 0x36} 0xFF, 0xFF, 0xFF} - * MAC VLAN tci 0x2016 0xFFFF + * MAC VLAN tci 0x2016 0xEFFF * tpid 0x8100 0xFFFF * END * Other members in mask and spec should set to 0x00. @@ -1617,6 +1617,7 @@ ixgbe_parse_fdir_filter_normal(const struct rte_flow_attr *attr, return -rte_errno; } rule->mask.vlan_tci_mask = vlan_mask->tci; + rule->mask.vlan_tci_mask &= rte_cpu_to_be_16(0xEFFF); /* More than one tags are not supported. */ /** @@ -2132,15 +2133,16 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, rte_memcpy(&rule->mask.tunnel_id_mask, vxlan_mask->vni, RTE_DIM(vxlan_mask->vni)); - rule->mask.tunnel_id_mask <<= 8; if (item->spec) { rule->b_spec = TRUE; vxlan_spec = (const struct rte_flow_item_vxlan *) item->spec; - rte_memcpy(&rule->ixgbe_fdir.formatted.tni_vni, + rte_memcpy(((uint8_t *) + &rule->ixgbe_fdir.formatted.tni_vni + 1), vxlan_spec->vni, RTE_DIM(vxlan_spec->vni)); - rule->ixgbe_fdir.formatted.tni_vni <<= 8; + rule->ixgbe_fdir.formatted.tni_vni = rte_be_to_cpu_32( + rule->ixgbe_fdir.formatted.tni_vni); } } @@ -2360,6 +2362,7 @@ ixgbe_parse_fdir_filter_tunnel(const struct rte_flow_attr *attr, return -rte_errno; } rule->mask.vlan_tci_mask = vlan_mask->tci; + rule->mask.vlan_tci_mask &= rte_cpu_to_be_16(0xEFFF); /* More than one tags are not supported. */ /** diff --git a/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx.c b/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx.c index f4fb3582..06499244 100644 --- a/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx.c @@ -80,6 +80,11 @@ #include "base/ixgbe_common.h" #include "ixgbe_rxtx.h" +#ifdef RTE_LIBRTE_IEEE1588 +#define IXGBE_TX_IEEE1588_TMST PKT_TX_IEEE1588_TMST +#else +#define IXGBE_TX_IEEE1588_TMST 0 +#endif /* Bit Mask to indicate what bits required for building TX context */ #define IXGBE_TX_OFFLOAD_MASK ( \ PKT_TX_VLAN_PKT | \ @@ -87,7 +92,8 @@ PKT_TX_L4_MASK | \ PKT_TX_TCP_SEG | \ PKT_TX_MACSEC | \ - PKT_TX_OUTER_IP_CKSUM) + PKT_TX_OUTER_IP_CKSUM | \ + IXGBE_TX_IEEE1588_TMST) #define IXGBE_TX_OFFLOAD_NOTSUP_MASK \ (PKT_TX_OFFLOAD_MASK ^ IXGBE_TX_OFFLOAD_MASK) @@ -1460,17 +1466,19 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq) for (i = 0; i < RTE_PMD_IXGBE_RX_MAX_BURST; i += LOOK_AHEAD, rxdp += LOOK_AHEAD, rxep += LOOK_AHEAD) { /* Read desc statuses backwards to avoid race condition */ - for (j = LOOK_AHEAD-1; j >= 0; --j) + for (j = 0; j < LOOK_AHEAD; j++) s[j] = rte_le_to_cpu_32(rxdp[j].wb.upper.status_error); - for (j = LOOK_AHEAD - 1; j >= 0; --j) - pkt_info[j] = rte_le_to_cpu_32(rxdp[j].wb.lower. - lo_dword.data); + rte_smp_rmb(); /* Compute how many status bits were set */ - nb_dd = 0; - for (j = 0; j < LOOK_AHEAD; ++j) - nb_dd += s[j] & IXGBE_RXDADV_STAT_DD; + for (nb_dd = 0; nb_dd < LOOK_AHEAD && + (s[nb_dd] & IXGBE_RXDADV_STAT_DD); nb_dd++) + ; + + for (j = 0; j < nb_dd; j++) + pkt_info[j] = rte_le_to_cpu_32(rxdp[j].wb.lower. + lo_dword.data); nb_rx += nb_dd; diff --git a/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c index f96cc85c..e2715cb9 100644 --- a/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +++ b/src/dpdk/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c @@ -196,7 +196,6 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, struct ixgbe_rx_entry *sw_ring; uint16_t nb_pkts_recd; int pos; - uint64_t var; uint8x16_t shuf_msk = { 0xFF, 0xFF, 0xFF, 0xFF, /* skip 32 bits pkt_type */ @@ -255,26 +254,24 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, uint64x2_t mbp1, mbp2; uint8x16_t staterr; uint16x8_t tmp; + uint32_t var = 0; uint32_t stat; /* B.1 load 1 mbuf point */ mbp1 = vld1q_u64((uint64_t *)&sw_ring[pos]); - /* Read desc statuses backwards to avoid race condition */ - /* A.1 load 4 pkts desc */ - descs[3] = vld1q_u64((uint64_t *)(rxdp + 3)); - rte_rmb(); - /* B.2 copy 2 mbuf point into rx_pkts */ vst1q_u64((uint64_t *)&rx_pkts[pos], mbp1); /* B.1 load 1 mbuf point */ mbp2 = vld1q_u64((uint64_t *)&sw_ring[pos + 2]); - descs[2] = vld1q_u64((uint64_t *)(rxdp + 2)); - /* B.1 load 2 mbuf point */ - descs[1] = vld1q_u64((uint64_t *)(rxdp + 1)); + /* A. load 4 pkts descs */ descs[0] = vld1q_u64((uint64_t *)(rxdp)); + descs[1] = vld1q_u64((uint64_t *)(rxdp + 1)); + descs[2] = vld1q_u64((uint64_t *)(rxdp + 2)); + descs[3] = vld1q_u64((uint64_t *)(rxdp + 3)); + rte_smp_rmb(); /* B.2 copy 2 mbuf point into rx_pkts */ vst1q_u64((uint64_t *)&rx_pkts[pos + 2], mbp2); @@ -349,11 +346,19 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, vst1q_u8((uint8_t *)&rx_pkts[pos]->rx_descriptor_fields1, pkt_mb1); + stat &= IXGBE_VPMD_DESC_DD_MASK; + /* C.4 calc avaialbe number of desc */ - var = __builtin_popcount(stat & IXGBE_VPMD_DESC_DD_MASK); - nb_pkts_recd += var; - if (likely(var != RTE_IXGBE_DESCS_PER_LOOP)) + if (likely(stat != IXGBE_VPMD_DESC_DD_MASK)) { + while (stat & 0x01) { + ++var; + stat = stat >> 8; + } + nb_pkts_recd += var; break; + } else { + nb_pkts_recd += RTE_IXGBE_DESCS_PER_LOOP; + } } /* Update our internal tail pointer */ diff --git a/src/dpdk/drivers/net/virtio/virtio_ethdev.c b/src/dpdk/drivers/net/virtio/virtio_ethdev.c index 1d572b5d..4dc03b9c 100644 --- a/src/dpdk/drivers/net/virtio/virtio_ethdev.c +++ b/src/dpdk/drivers/net/virtio/virtio_ethdev.c @@ -1835,6 +1835,8 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) uint64_t tso_mask, host_features; struct virtio_hw *hw = dev->data->dev_private; + dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */ + dev_info->pci_dev = dev->device ? RTE_DEV_TO_PCI(dev->device) : NULL; dev_info->max_rx_queues = RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES); @@ -1869,7 +1871,6 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) (1ULL << VIRTIO_NET_F_HOST_TSO6); if ((hw->guest_features & tso_mask) == tso_mask) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO; - dev_info->speed_capa = ETH_LINK_SPEED_10G; } /* diff --git a/src/dpdk/drivers/net/vmxnet3/vmxnet3_ethdev.c b/src/dpdk/drivers/net/vmxnet3/vmxnet3_ethdev.c index ff63a536..b7b5377a 100644 --- a/src/dpdk/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/src/dpdk/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -250,7 +250,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return 0; rte_eth_copy_pci_info(eth_dev, pci_dev); - eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE; + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; /* Vendor and Device ID need to be set before init of shared code */ hw->device_id = pci_dev->id.device_id; |