net: fix TSO packet checksum incorrect
PATCH 1/1 net: fix TSO packet checksum incorrect
The ol_flags check lacks of PKT_TX_IPV6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue using PKT_TX_OFFLOAD_MASK.
--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_net/rte_net.h +1 -1
@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags &PKT_TX_OFFLOAD_MASK ))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))
Signature · 1 line
2.25.1
Hi,
Quoted 27 lines · Yuying Zhang
The
ol_flagscheck lacks ofPKT_TX_IPV6which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue usingPKT_TX_OFFLOAD_MASK.Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_net/rte_net.h +1
-1@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags &PKT_TX_OFFLOAD_MASK ))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))Signature · 1 line
2.25.1
I think the PKT_TX_TCP_SEG flag is missing in the test above, it should be like this:
if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG)))
It would be more precise than having the whole list of offload flags.
The reason is because in case of TSOv4, there is always the flag PKT_TX_IP_CKSUM, so this test is always wrong and we continue in the function. In case of TSOv6, there is neither PKT_TX_IP_CKSUM nor PKT_TX_L4_TCP (which is not mandatory, the doc says that PKT_TX_TCP_SEG implies PKT_TX_L4_TCP).
Thanks for spotting this. Can you please submit a v2 with PKT_TX_TCP_SEG?
Olivier
Quoted 36 lines · Olivier Matz
Hi,
Quoted 27 lines · Yuying Zhang
The
ol_flagscheck lacks ofPKT_TX_IPV6which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue usingPKT_TX_OFFLOAD_MASK.Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_net/rte_net.h +1
-1@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags &PKT_TX_OFFLOAD_MASK ))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))Signature · 1 line
2.25.1I think the
PKT_TX_TCP_SEGflag is missing in the test above, it should be like this:if (!(ol_flags & (
PKT_TX_IP_CKSUM|PKT_TX_L4_MASK|PKT_TX_TCP_SEG)))
Quoted 7 lines
It would be more precise than having the whole list of offload flags.
The reason is because in case of TSOv4, there is always the flag
PKT_TX_IP_CKSUM, so this test is always wrong and we continue in the function. In case of TSOv6, there is neitherPKT_TX_IP_CKSUMnorPKT_TX_L4_TCP(which is not mandatory, the doc says thatPKT_TX_TCP_SEGimpliesPKT_TX_L4_TCP).
I thought that PKT_TX_L4_TCP is required anyway and missed the fact that PKT_TX_TCP_SEG implies PKT_TX_L4_TCP. Thanks.
Quoted 6 lines
Thanks for spotting this. Can you please submit a v2 with
PKT_TX_TCP_SEG?Olivier
PATCH v2 1/1 net: fix TSO packets checksum incorrect
In reply to Yuying ZhangThe ol_flags check lacks of flag for IPv6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue by adding PKT_TX_TCP_SEG flag.
--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_net/rte_net.h +1 -1
@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets checksum incorrect
Regards,
Xie Wei
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Yuying Zhang
Sent: Wednesday, July 29, 2020 1:10 AM
To: [email protected]; [email protected]; Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: Zhang, Yuying <[email protected]>
Subject: [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets checksum incorrect
The ol_flags check lacks of flag for IPv6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue by adding PKT_TX_TCP_SEG flag.
--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_net/rte_net.h +1 -1
@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))
--
2.25.1
Re: [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets checksum incorrect
In reply to Yuying ZhangQuoted 3 lines · Yuying Zhang
The
ol_flagscheck lacks of flag for IPv6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue by addingPKT_TX_TCP_SEGflag.
Thanks Yuying for the new version. I have another suggestion for the title/commit log:
net: fix bad checksum in offloaded TSOv6 packets
The rte_net_intel_cksum_flags_prepare() function prepares the pseudoheader checksum in packet data when doing checksum or TSO offload.
It does nothing when no checksum offload flag is set in mbuf. But in case of a IPv6/TCP TSO packet, it is not mandatory to have a checksum flag. We also need to check the PKT_TX_TCP_SEG flag in addition to checksum flags to fix offload preparation for such packets.
Quoted 3 lines
Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>
Quoted 20 lines
--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_net/rte_net.h +1
-1@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))Signature · 1 line
2.25.1
Andrew Rybchenko
Acked-byRe: [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets checksum incorrect
Quoted 19 lines · Olivier Matz
Quoted 3 lines · Yuying Zhang
The
ol_flagscheck lacks of flag for IPv6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue by addingPKT_TX_TCP_SEGflag.Thanks Yuying for the new version. I have another suggestion for the title/commit log:
net: fix bad checksum in offloaded TSOv6 packets
The
rte_net_intel_cksum_flags_prepare()function prepares the pseudoheader checksum in packet data when doing checksum or TSO offload.It does nothing when no checksum offload flag is set in mbuf. But in case of a IPv6/TCP TSO packet, it is not mandatory to have a checksum flag. We also need to check the
PKT_TX_TCP_SEGflag in addition to checksum flags to fix offload preparation for such packets.
Quoted 5 lines
Quoted 3 lines
Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>Acked-by Olivier Matz <[email protected]>
Quoted 21 lines
Quoted 21 lines
--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_net/rte_net.h +1
-1@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets checksum incorrect
In reply to Yuying ZhangQuoted 26 lines · Yuying Zhang
The
ol_flagscheck lacks of flag for IPv6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue by addingPKT_TX_TCP_SEGflag.Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_net/rte_net.h +1
-2@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 )) --
Quoted 2 lines
2.25.1
Olivier suggestion on the commitlog/title looks fine to me.
Signature · 1 line
David Marchand
Ferruh Yigit
AppliedRe: [dpdk-dev] [PATCH v2 1/1] net: fix TSO packets checksum incorrect
Quoted 6 lines · David Marchand
Quoted 5 lines · Yuying Zhang
The
ol_flagscheck lacks of flag for IPv6 which causes checksum flag configuration error while IPv6/TCP TSO packet is sent. This patch fixes the issue by addingPKT_TX_TCP_SEGflag.
Quoted 8 lines
Quoted 3 lines
Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>Acked-by Olivier Matz <[email protected]>Reviewed-by David Marchand <[email protected]>
Applied to dpdk-next-net/master, thanks.
(Used the suggested commit log)
PATCH v3 1/1 net: fix bad checksum in offloaded TSOv6 packets
In reply to Yuying ZhangThe rte_net_intel_cksum_flags_prepare() function prepares the pseudoheader checksum in packet data when doing checksum or TSO offload.
It does nothing when no checksum offload flag is set in mbuf. But in case of a IPv6/TCP TSO packet, it is not mandatory to have a checksum flag. We also need to check the PKT_TX_TCP_SEG flag in addition to checksum flags to fix offload preparation for such packets.
--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_net/rte_net.h +1 -1
@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)* Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;if (ol_flags & (PKT_TX_OUTER_IPV4 |PKT_TX_OUTER_IPV6 ))
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 1/1] net: fix bad checksum in offloaded TSOv6 packets
Quoted 40 lines
-----Original Message-----
From: Zhang, Yuying <[email protected]>
Sent: 2020年7月30日 10:01
To: [email protected]; [email protected]; Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: Zhang, Yuying <[email protected]>; David Marchand <[email protected]>
Subject: [PATCH v3 1/1] net: fix bad checksum in offloaded TSOv6 packetsThe
rte_net_intel_cksum_flags_prepare()function prepares the pseudoheader checksum in packet data when doing checksum or TSO offload.It does nothing when no checksum offload flag is set in mbuf. But in case of a IPv6/TCP TSO packet, it is not mandatory to have a checksum flag. We also need to check the
PKT_TX_TCP_SEGflag in addition to checksum flags to fix offload preparation for such packets.Fixes 520059a41aa9 ("net: check fragmented headers in non-debug as well")Signed-off-by Yuying Zhang <[email protected]>Acked-by Olivier Matz <[email protected]>Reviewed-by David Marchand <[email protected]>--- lib/librte_net/rte_net.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/librte_net/rte_net.h index renamed from lib/librte_net/rte_net.h +0
-0
1edc283a4..94b06d9ee100644lib/librte_net/rte_net.h +1
-1@@ -125,7 +125,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m,uint64_t ol_flags) * Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ -if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK ))) +if (!(ol_flags & (PKT_TX_IP_CKSUM |PKT_TX_L4_MASK |PKT_TX_TCP_SEG )))return 0 ;
Quoted 3 lines
if (
ol_flags& (PKT_TX_OUTER_IPV4|PKT_TX_OUTER_IPV6))
--
2.25.1
Please drop this patch since it has been merged into dpdk-next-net/master. I am so sorry.