diff options
author | Dave Barach <dbarach@cisco.com> | 2017-03-14 12:23:30 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-03-14 19:09:42 +0000 |
commit | 803c51d7a17109eb0881a0b9da20a45f3a0391ab (patch) | |
tree | 5cae2f29521525d9dfaef6a7314b91c2a46400fe /src/plugins | |
parent | 1c82cd4f491ff83127fbacfb6b09b9492eff1b62 (diff) |
Fix packet trace output: dpdk_rx_trace must decode the actual ethertype
As opposed to rubbish (typically) 14 octets past the ethertype.
Also fix buffer error code setup in dpdk-input node single loop.
Change-Id: Ide7c4097d3bb91e62749ed4e1d69a7b4b90225de
Signed-off-by: Dave Barach <dbarach@cisco.com>
Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/dpdk/device/node.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index e8d502ca692..e740fd18422 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -73,6 +73,35 @@ dpdk_rx_next_from_etype (struct rte_mbuf * mb, vlib_buffer_t * b0) return VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; } +always_inline u32 +dpdk_rx_next_from_packet_start (struct rte_mbuf * mb, vlib_buffer_t * b0) +{ + word start_delta; + int rv; + + start_delta = b0->current_data - + ((mb->buf_addr + mb->data_off) - (void *) b0->data); + + vlib_buffer_advance (b0, -start_delta); + + if (PREDICT_TRUE (vlib_buffer_is_ip4 (b0))) + { + if (PREDICT_TRUE ((mb->ol_flags & PKT_RX_IP_CKSUM_GOOD) != 0)) + rv = VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT; + else + rv = VNET_DEVICE_INPUT_NEXT_IP4_INPUT; + } + else if (PREDICT_TRUE (vlib_buffer_is_ip6 (b0))) + rv = VNET_DEVICE_INPUT_NEXT_IP6_INPUT; + else if (PREDICT_TRUE (vlib_buffer_is_mpls (b0))) + rv = VNET_DEVICE_INPUT_NEXT_MPLS_INPUT; + else + rv = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; + + vlib_buffer_advance (b0, start_delta); + return rv; +} + always_inline void dpdk_rx_error_from_mb (struct rte_mbuf *mb, u32 * next, u8 * error) { @@ -115,7 +144,7 @@ dpdk_rx_trace (dpdk_main_t * dm, if (PREDICT_FALSE (xd->per_interface_next_index != ~0)) next0 = xd->per_interface_next_index; else - next0 = dpdk_rx_next_from_etype (mb, b0); + next0 = dpdk_rx_next_from_packet_start (mb, b0); dpdk_rx_error_from_mb (mb, &next0, &error0); @@ -488,6 +517,7 @@ dpdk_device_input (dpdk_main_t * dm, dpdk_device_t * xd, next0 = dpdk_rx_next_from_etype (mb0, b0); dpdk_rx_error_from_mb (mb0, &next0, &error0); + b0->error = node->errors[error0]; vlib_buffer_advance (b0, device_input_next_node_advance[next0]); |