diff options
Diffstat (limited to 'src/plugins/dpdk/device/node.c')
-rw-r--r-- | src/plugins/dpdk/device/node.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c index 9acf594ba19..46f0a4e98e4 100644 --- a/src/plugins/dpdk/device/node.c +++ b/src/plugins/dpdk/device/node.c @@ -36,10 +36,13 @@ static char *dpdk_error_strings[] = { }; /* make sure all flags we need are stored in lower 32 bits */ -STATIC_ASSERT ((u64) (PKT_RX_IP_CKSUM_BAD | PKT_RX_FDIR | PKT_RX_LRO) < - (1ULL << 32), +STATIC_ASSERT ((u64) (PKT_RX_IP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_FDIR | + PKT_RX_LRO) < (1ULL << 32), "dpdk flags not in lower word, fix needed"); +STATIC_ASSERT (PKT_RX_L4_CKSUM_BAD == (1ULL << 3), + "bit number of PKT_RX_L4_CKSUM_BAD is no longer 3!"); + static_always_inline uword dpdk_process_subseq_segs (vlib_main_t * vm, vlib_buffer_t * b, struct rte_mbuf *mb, vlib_buffer_t * bt) @@ -401,6 +404,23 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd, if (PREDICT_FALSE ((or_flags & PKT_RX_LRO))) dpdk_process_lro_offload (xd, ptd, n_rx_packets); + if (PREDICT_FALSE ((or_flags & PKT_RX_L4_CKSUM_BAD) && + (xd->buffer_flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT))) + { + for (n = 0; n < n_rx_packets; n++) + { + /* Check and reset VNET_BUFFER_F_L4_CHECKSUM_CORRECT flag + if PKT_RX_L4_CKSUM_BAD is set. + The magic num 3 is the bit number of PKT_RX_L4_CKSUM_BAD + which is defined in DPDK. + Have made a STATIC_ASSERT in this file to ensure this. + */ + b0 = vlib_buffer_from_rte_mbuf (ptd->mbufs[n]); + b0->flags ^= (ptd->flags[n] & PKT_RX_L4_CKSUM_BAD) + << (VNET_BUFFER_F_LOG2_L4_CHECKSUM_CORRECT - 3); + } + } + if (PREDICT_FALSE (or_flags & PKT_RX_FDIR)) { /* some packets will need to go to different next nodes */ |