From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: olivier.matz@6wind.com
Subject: [PATCH v3 2/3] net/tap: fix IPv4 checksum offloading
Date: Thu, 24 Aug 2023 09:18:21 +0200 [thread overview]
Message-ID: <20230824071822.337670-2-david.marchand@redhat.com> (raw)
In-Reply-To: <20230824071822.337670-1-david.marchand@redhat.com>
Checking that one of RTE_MBUF_F_TX_IPV4 or RTE_MBUF_F_TX_IP_CKSUM is
present is not compliant with the offloading API which specifies that IP
checksum requires RTE_MBUF_F_TX_IP_CKSUM.
On the other hand, RTE_MBUF_F_TX_IP_CKSUM is invalid for IPv6 packets,
so we can simply check for RTE_MBUF_F_TX_IP_CKSUM and assume this is an
IPv4 packet.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/net/tap/rte_eth_tap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 0ab214847a..30b45ddc67 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -559,7 +559,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len,
{
void *l3_hdr = packet + l2_len;
- if (ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4)) {
+ if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
struct rte_ipv4_hdr *iph = l3_hdr;
uint16_t cksum;
@@ -642,7 +642,7 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs,
nb_segs = mbuf->nb_segs;
if (txq->csum &&
- ((mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4) ||
+ ((mbuf->ol_flags & RTE_MBUF_F_TX_IP_CKSUM ||
(mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM ||
(mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_TCP_CKSUM))) {
unsigned int l4_len = 0;
--
2.41.0
next prev parent reply other threads:[~2023-08-24 7:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 7:32 [PATCH] net/tap: fix L4 checksum David Marchand
2023-08-22 8:55 ` Olivier Matz
2023-08-22 15:44 ` David Marchand
2023-08-23 16:01 ` [PATCH v2 1/3] net/tap: fix L4 checksum offloading David Marchand
2023-08-23 16:01 ` [PATCH v2 2/3] net/tap: fix IPv4 " David Marchand
2023-08-23 16:01 ` [PATCH v2 3/3] net/tap: rework " David Marchand
2023-08-24 7:18 ` [PATCH v3 1/3] net/tap: fix L4 " David Marchand
2023-08-24 7:18 ` David Marchand [this message]
2023-08-24 7:18 ` [PATCH v3 3/3] net/tap: rework " David Marchand
2023-11-02 1:21 ` [PATCH v3 1/3] net/tap: fix L4 " 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=20230824071822.337670-2-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
/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).