From: Michal Krawczyk <mk@semihalf.com>
To: dev@dpdk.org
Cc: mw@semihalf.com, igorch@amazon.com, gtzalik@amazon.com,
Michal Krawczyk <mk@semihalf.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/6] net/ena: fix setting Rx checksum flags in mbuf
Date: Fri, 30 Oct 2020 12:31:17 +0100 [thread overview]
Message-ID: <20201030113121.1310305-3-mk@semihalf.com> (raw)
In-Reply-To: <20201030113121.1310305-1-mk@semihalf.com>
The driver was never setting PKT_RX_*_CKSUM_GOOD flags, so the only way
of checking if the checksum was checked was by testing for the
PKT_RX_*_CKSUM_BAD. In that situation, the application couldn't detect
if the checksum was valid or unknown, as unknown flag is equal to 0.
Moreover, the l3_csum_err value is only valid if the l3_proto is
indicating IPv4, so it shouldn't be checked for other protocols.
Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
---
drivers/net/ena/ena_ethdev.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 7ab9b93ba9..ad593c882c 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -296,21 +296,23 @@ static inline void ena_rx_mbuf_prepare(struct rte_mbuf *mbuf,
else if (ena_rx_ctx->l4_proto == ENA_ETH_IO_L4_PROTO_UDP)
packet_type |= RTE_PTYPE_L4_UDP;
- if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4)
+ if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV4) {
packet_type |= RTE_PTYPE_L3_IPV4;
- else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6)
+ if (unlikely(ena_rx_ctx->l3_csum_err))
+ ol_flags |= PKT_RX_IP_CKSUM_BAD;
+ else
+ ol_flags |= PKT_RX_IP_CKSUM_GOOD;
+ } else if (ena_rx_ctx->l3_proto == ENA_ETH_IO_L3_PROTO_IPV6) {
packet_type |= RTE_PTYPE_L3_IPV6;
+ }
- if (!ena_rx_ctx->l4_csum_checked)
+ if (!ena_rx_ctx->l4_csum_checked || ena_rx_ctx->frag)
ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
else
- if (unlikely(ena_rx_ctx->l4_csum_err) && !ena_rx_ctx->frag)
+ if (unlikely(ena_rx_ctx->l4_csum_err))
ol_flags |= PKT_RX_L4_CKSUM_BAD;
else
- ol_flags |= PKT_RX_L4_CKSUM_UNKNOWN;
-
- if (unlikely(ena_rx_ctx->l3_csum_err))
- ol_flags |= PKT_RX_IP_CKSUM_BAD;
+ ol_flags |= PKT_RX_L4_CKSUM_GOOD;
mbuf->ol_flags = ol_flags;
mbuf->packet_type = packet_type;
--
2.25.1
next prev parent reply other threads:[~2020-10-30 11:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 11:31 [dpdk-dev] [PATCH 0/6] net/ena: fixes and missing version/doc udate Michal Krawczyk
2020-10-30 11:31 ` [dpdk-dev] [PATCH 1/6] net/ena: fix getting xstats global stats offset Michal Krawczyk
2020-10-30 11:31 ` Michal Krawczyk [this message]
2020-10-30 11:31 ` [dpdk-dev] [PATCH 3/6] net/ena: change name of the supported PCI device IDs Michal Krawczyk
2020-10-30 11:31 ` [dpdk-dev] [PATCH 4/6] net/ena/base: align IO cq allocation to a 4K Michal Krawczyk
2020-10-30 11:31 ` [dpdk-dev] [PATCH 5/6] doc: mark ARMv8 as supported by ENA PMD Michal Krawczyk
2020-10-30 11:31 ` [dpdk-dev] [PATCH 6/6] net/ena: upgrade driver version to v2.2.0 Michal Krawczyk
2020-10-30 23:48 ` [dpdk-dev] [PATCH 0/6] net/ena: fixes and missing version/doc udate Ferruh Yigit
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=20201030113121.1310305-3-mk@semihalf.com \
--to=mk@semihalf.com \
--cc=dev@dpdk.org \
--cc=gtzalik@amazon.com \
--cc=igorch@amazon.com \
--cc=mw@semihalf.com \
--cc=stable@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).