summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/common.c5
-rw-r--r--src/plugins/dpdk/device/node.c24
2 files changed, 26 insertions, 3 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index b0aaaaf9d47..19c0c32243d 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -148,9 +148,12 @@ dpdk_device_setup (dpdk_device_t * xd)
xd->buffer_flags =
(VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_EXT_HDR_VALID);
- if (xd->port_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_CKSUM)
+ if ((xd->port_conf.rxmode.offloads &
+ (DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_UDP_CKSUM)) ==
+ (DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_UDP_CKSUM))
xd->buffer_flags |=
(VNET_BUFFER_F_L4_CHECKSUM_COMPUTED | VNET_BUFFER_F_L4_CHECKSUM_CORRECT);
+
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
dpdk_device_start (xd);
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 */