diff options
author | John Lo <loj@cisco.com> | 2016-12-15 23:25:04 -0500 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2016-12-16 14:29:31 +0000 |
commit | d6900496dd3ecc807fb2936d3b1bb8f58a2ddf29 (patch) | |
tree | 5cdd3acc86309e68e63e3f650c3a3421ef6bca7b /vnet | |
parent | 9225dee9655ce607130f9bab5472441b72e25858 (diff) |
Fix dpdk-input check for VLAN packets including VLAN strip case
For DPDK-16.11 or later, use packet_type to check packets with VLAN
tags. For earlier versions of DPDK, keep using ol_flags but include
PKT_RX_VLAN_STRIPPED bit as part of the VLAN tags check.
Change-Id: Ic4ad8f04e44658dc0a99de0232fdc949cfa13e93
Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/devices/dpdk/node.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/vnet/vnet/devices/dpdk/node.c b/vnet/vnet/devices/dpdk/node.c index 5f9c95aada2..4e668776530 100644 --- a/vnet/vnet/devices/dpdk/node.c +++ b/vnet/vnet/devices/dpdk/node.c @@ -34,6 +34,15 @@ static char *dpdk_error_strings[] = { #undef _ }; +#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) +always_inline int +dpdk_mbuf_is_vlan (struct rte_mbuf *mb) +{ + return (mb->packet_type & RTE_PTYPE_L2_ETHER_VLAN) == + RTE_PTYPE_L2_ETHER_VLAN; +} +#endif + always_inline int dpdk_mbuf_is_ip4 (struct rte_mbuf *mb) { @@ -58,7 +67,13 @@ dpdk_rx_next_from_mb (struct rte_mbuf *mb, vlib_buffer_t * b0, u32 * next0) { u32 n0; - if (PREDICT_FALSE ((mb->ol_flags & PKT_RX_VLAN_PKT))) +#if RTE_VERSION < RTE_VERSION_NUM(16, 11, 0, 0) + if (PREDICT_FALSE + ((mb->ol_flags & (PKT_RX_VLAN_PKT | PKT_RX_VLAN_STRIPPED)) == + PKT_RX_VLAN_PKT)) +#else + if (PREDICT_FALSE (dpdk_mbuf_is_vlan (mb))) +#endif n0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; else if (PREDICT_TRUE (dpdk_mbuf_is_ip4 (mb))) n0 = VNET_DEVICE_INPUT_NEXT_IP4_INPUT; |