From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 6/7] mlx5: fix RX checksum offload in non L3/L4 packets
Date: Thu, 3 Mar 2016 15:27:39 +0100 [thread overview]
Message-ID: <1457015260-3041-7-git-send-email-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com>
From: Yaacov Hazan <yaacovh@mellanox.com>
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 <yaacovh@mellanox.com>
---
doc/guides/rel_notes/release_16_04.rst | 4 ++++
drivers/net/mlx5/Makefile | 5 +++++
drivers/net/mlx5/mlx5_rxtx.c | 26 ++++++++++++++++++--------
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 6e94bbe..8669515 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -163,6 +163,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.
+
Libraries
~~~~~~~~~
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 39cdf2c..7076ae3 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -132,6 +132,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 4c53c7a..4919189 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
--
2.1.4
next prev parent reply other threads:[~2016-03-03 14:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 1/7] mlx5: fix possible crash during initialization Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 2/7] mlx5: check if port is configured as Ethernet device Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 3/7] mlx5: manage all special flow types at once Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 6/7] mlx5: fix RX checksum offload in non L3/L4 packets Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 7/7] mlx4: make sure that number of RX queues is a power of 2 Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 1/7] mlx5: fix possible crash during initialization Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 2/7] mlx5: check if port is configured as Ethernet device Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 3/7] mlx5: manage all special flow types at once Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows Adrien Mazarguil
2016-03-03 14:27 ` Adrien Mazarguil [this message]
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 7/7] mlx4: make sure that number of RX queues is a power of 2 Adrien Mazarguil
2016-03-10 22:15 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457015260-3041-7-git-send-email-adrien.mazarguil@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).