diff options
-rw-r--r-- | dpdk/dpdk-16.04_patches/0017-i40e-Set-PKT_RX_VLAN_PKT-flag-for-VLAN-packets.patch | 41 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/device.c | 16 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/dpdk.h | 3 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/node.c | 4 |
4 files changed, 17 insertions, 47 deletions
diff --git a/dpdk/dpdk-16.04_patches/0017-i40e-Set-PKT_RX_VLAN_PKT-flag-for-VLAN-packets.patch b/dpdk/dpdk-16.04_patches/0017-i40e-Set-PKT_RX_VLAN_PKT-flag-for-VLAN-packets.patch deleted file mode 100644 index a40b537fa5b..00000000000 --- a/dpdk/dpdk-16.04_patches/0017-i40e-Set-PKT_RX_VLAN_PKT-flag-for-VLAN-packets.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 2c75df63533e1eaa97c24f41bbd6a5b131ff52ce Mon Sep 17 00:00:00 2001 -From: Georgi Savov <gsavov@cisco.com> -Date: Tue, 10 May 2016 10:59:55 -0400 -Subject: [PATCH 17/17] i40e Set PKT_RX_VLAN_PKT flag for VLAN packets - ---- - drivers/net/i40e/i40e_rxtx.c | 18 +++++++++++++++++- - 1 file changed, 17 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c -index 4d35d83..a2bb9a9 100644 ---- a/drivers/net/i40e/i40e_rxtx.c -+++ b/drivers/net/i40e/i40e_rxtx.c -@@ -94,7 +94,23 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp) - PMD_RX_LOG(DEBUG, "Descriptor l2tag1: %u", - rte_le_to_cpu_16(rxdp->wb.qword0.lo_dword.l2tag1)); - } else { -- mb->vlan_tci = 0; -+ struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); -+ u16 eth_type = eth_hdr->ether_type; -+ -+ // The i40e firmware does not flag VLAN tagged packets if -+ // VLAN stripping is disabled so we need to check the -+ // ethernet header to find out if the received packet -+ // is a VLAN packet -+ if ((eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN)) || -+ (eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN_AD)) || -+ (eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN_9100)) || -+ (eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN_9200))) { -+ struct vlan_hdr *vhdr = (struct vlan_hdr *)(eth_hdr+1); -+ mb->ol_flags |= PKT_RX_VLAN_PKT; -+ mb->vlan_tci = rte_be_to_cpu_16(vhdr->vlan_tci); -+ } else { -+ mb->vlan_tci = 0; -+ } - } - #ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC - if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) & --- -2.7.4 - diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index 7f759d6104d..bad149f03c6 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -1136,7 +1136,10 @@ dpdk_subif_add_del_function (vnet_main_t * vnm, dpdk_device_t * xd = vec_elt_at_index (xm->devices, hw->dev_instance); vnet_sw_interface_t * t = (vnet_sw_interface_t *) st; int r, vlan_offload; + u32 prev_subifs = xd->vlan_subifs; + if (is_add) xd->vlan_subifs++; + else if (xd->vlan_subifs) xd->vlan_subifs--; if (xd->dev_type != VNET_DPDK_DEV_ETH) return 0; @@ -1149,21 +1152,26 @@ dpdk_subif_add_del_function (vnet_main_t * vnm, if (t->sub.eth.flags.no_tags == 1) return 0; - if ((t->sub.eth.flags.one_tag != 1) || (t->sub.eth.flags.exact_match != 1 )) + if ((t->sub.eth.flags.one_tag != 1) || (t->sub.eth.flags.exact_match != 1 )) { + xd->vlan_subifs = prev_subifs; return clib_error_return (0, "unsupported VLAN setup"); - + } vlan_offload = rte_eth_dev_get_vlan_offload(xd->device_index); vlan_offload |= ETH_VLAN_FILTER_OFFLOAD; - if ((r = rte_eth_dev_set_vlan_offload(xd->device_index, vlan_offload))) + if ((r = rte_eth_dev_set_vlan_offload(xd->device_index, vlan_offload))) { + xd->vlan_subifs = prev_subifs; return clib_error_return (0, "rte_eth_dev_set_vlan_offload[%d]: err %d", xd->device_index, r); + } - if ((r = rte_eth_dev_vlan_filter(xd->device_index, t->sub.eth.outer_vlan_id, is_add))) + if ((r = rte_eth_dev_vlan_filter(xd->device_index, t->sub.eth.outer_vlan_id, is_add))) { + xd->vlan_subifs = prev_subifs; return clib_error_return (0, "rte_eth_dev_vlan_filter[%d]: err %d", xd->device_index, r); + } return 0; } diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index 4123cc9cbef..23c8eb3eaf5 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -210,6 +210,9 @@ typedef struct { /* per-worker destination frame queue */ dpdk_frame_t * frames; + /* number of sub-interfaces */ + u16 vlan_subifs; + dpdk_device_type_t dev_type:8; dpdk_pmd_t pmd:8; i8 cpu_socket; diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c index 2c90d80a31e..d22838f1f06 100644 --- a/vnet/vnet/devices/dpdk/node.c +++ b/vnet/vnet/devices/dpdk/node.c @@ -305,9 +305,9 @@ dpdk_rx_next_and_error_from_mb_flags_x1 (dpdk_device_t *xd, struct rte_mbuf *mb, else { *error0 = DPDK_ERROR_NONE; - if (xd->per_interface_next_index != ~0) + if (PREDICT_FALSE(xd->per_interface_next_index != ~0)) n0 = xd->per_interface_next_index; - else if (mb_flags & PKT_RX_VLAN_PKT) + else if (PREDICT_FALSE(xd->vlan_subifs || (mb_flags & PKT_RX_VLAN_PKT))) n0 = DPDK_RX_NEXT_ETHERNET_INPUT; else { |