From: longli@linuxonhyperv.com
To: dev@dpdk.org, Stephen Hemminger <sthemmin@microsoft.com>
Cc: Long Li <longli@microsoft.com>
Subject: [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag
Date: Tue, 22 Mar 2022 21:28:07 -0700 [thread overview]
Message-ID: <1648009687-19957-1-git-send-email-longli@linuxonhyperv.com> (raw)
From: Long Li <longli@microsoft.com>
The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the value to decide
the correct way to calculate checksums.
Signed-off-by: Long Li <longli@microsoft.com>
---
drivers/net/netvsc/hn_rxtx.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 028f176c7e..34f40be5b8 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
*pi_data = NDIS_LSO2_INFO_MAKEIPV4(hlen,
m->tso_segsz);
}
- } else if (m->ol_flags &
- (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) {
+ } else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+ RTE_MBUF_F_TX_TCP_CKSUM ||
+ (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+ RTE_MBUF_F_TX_UDP_CKSUM ||
+ (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) {
pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE,
NDIS_PKTINFO_TYPE_CSUM);
*pi_data = 0;
@@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
*pi_data |= NDIS_TXCSUM_INFO_IPCS;
}
- if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM)
+ if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+ RTE_MBUF_F_TX_TCP_CKSUM)
*pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen);
- else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM)
+ else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
+ RTE_MBUF_F_TX_UDP_CKSUM)
*pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen);
}
--
2.32.0
next reply other threads:[~2022-03-23 4:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 4:28 longli [this message]
2022-03-23 8:39 ` [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag David Marchand
2022-03-23 21:31 ` Long Li
2022-03-23 14:57 ` Stephen Hemminger
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=1648009687-19957-1-git-send-email-longli@linuxonhyperv.com \
--to=longli@linuxonhyperv.com \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=sthemmin@microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.