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: 67fa62bc67 ("mlx5: support checksum offload")

Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
This commit is contained in:
Yaacov Hazan 2016-03-03 15:27:39 +01:00 committed by Thomas Monjalon
parent 188b8ccdfe
commit d0087d760f
3 changed files with 27 additions and 8 deletions

View File

@ -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,

View File

@ -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

View File

@ -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