From: Yaacov Hazan Date: Thu, 3 Mar 2016 14:27:39 +0000 (+0100) Subject: mlx5: fix Rx checksum offload in non L3/L4 packets X-Git-Tag: spdx-start~7298 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d0087d760f280566b4a4d82be2a50a35246420e3;p=dpdk.git mlx5: fix Rx checksum offload in non L3/L4 packets Change rxq_cq_to_ol_flags() to set checksum flags according to packet type, so for non L3/L4 packets the mbuf chksum_bad flags will not be set. Fixes: 67fa62bc672d ("mlx5: support checksum offload") Signed-off-by: Yaacov Hazan --- diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 5b386f1406..1cc11154c3 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -287,6 +287,10 @@ Drivers Prevented reception of multicast frames outside of configured VLANs. +* **mlx5: Fixed RX checksum offload in non L3/L4 packets.** + + Fixed report of bad checksum for packets of unknown type. + * **aesni_mb: Fixed wrong return value when creating a device.** cryptodev_aesni_mb_init() was returning the device id of the device created, diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 29185f0391..c4f7c5f57d 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -126,6 +126,11 @@ mlx5_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh infiniband/verbs.h \ enum IBV_EXP_DEVICE_ATTR_VLAN_OFFLOADS \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_EXP_CQ_RX_TCP_PACKET \ + infiniband/verbs.h \ + enum IBV_EXP_CQ_RX_TCP_PACKET \ + $(AUTOCONF_OUTPUT) $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 4c53c7a422..49191892d1 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -719,14 +719,24 @@ rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_t flags) { uint32_t ol_flags = 0; - if (rxq->csum) - ol_flags |= - TRANSPOSE(~flags, - IBV_EXP_CQ_RX_IP_CSUM_OK, - PKT_RX_IP_CKSUM_BAD) | - TRANSPOSE(~flags, - IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK, - PKT_RX_L4_CKSUM_BAD); + if (rxq->csum) { + /* Set IP checksum flag only for IPv4/IPv6 packets. */ + if (flags & + (IBV_EXP_CQ_RX_IPV4_PACKET | IBV_EXP_CQ_RX_IPV6_PACKET)) + ol_flags |= + TRANSPOSE(~flags, + IBV_EXP_CQ_RX_IP_CSUM_OK, + PKT_RX_IP_CKSUM_BAD); +#ifdef HAVE_EXP_CQ_RX_TCP_PACKET + /* Set L4 checksum flag only for TCP/UDP packets. */ + if (flags & + (IBV_EXP_CQ_RX_TCP_PACKET | IBV_EXP_CQ_RX_UDP_PACKET)) +#endif /* HAVE_EXP_CQ_RX_TCP_PACKET */ + ol_flags |= + TRANSPOSE(~flags, + IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK, + PKT_RX_L4_CKSUM_BAD); + } /* * PKT_RX_IP_CKSUM_BAD and PKT_RX_L4_CKSUM_BAD are used in place * of PKT_RX_EIP_CKSUM_BAD because the latter is not functional