diff mbox series

[v2,1/1] net: fix TSO packets checksum incorrect

Message ID 20200728170950.208532-1-yuying.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series [v2,1/1] net: fix TSO packets checksum incorrect | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Yuying Zhang July 28, 2020, 5:09 p.m. UTC
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.

Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 lib/librte_net/rte_net.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Xie, WeiX July 29, 2020, 2:28 a.m. UTC | #1
Tested-by: Zhang, XiX <xix.zhang@intel.com>

Regards,
Xie Wei

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yuying Zhang
Sent: Wednesday, July 29, 2020 1:10 AM
To: dev@dpdk.org; olivier.matz@6wind.com; Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
Cc: Zhang, Yuying <yuying.zhang@intel.com>
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.

Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
---
 lib/librte_net/rte_net.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 1edc283a4..94b06d9ee 100644
--- a/lib/librte_net/rte_net.h
+++ b/lib/librte_net/rte_net.h
@@ -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
Olivier Matz July 29, 2020, 7:49 a.m. UTC | #2
On Tue, Jul 28, 2020 at 05:09:50PM +0000, Yuying Zhang wrote:
> 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.

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.

> Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")
> 
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

> ---
>  lib/librte_net/rte_net.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> index 1edc283a4..94b06d9ee 100644
> --- a/lib/librte_net/rte_net.h
> +++ b/lib/librte_net/rte_net.h
> @@ -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
>
David Marchand July 29, 2020, 8:54 a.m. UTC | #3
On Tue, Jul 28, 2020 at 7:11 PM Yuying Zhang <yuying.zhang@intel.com> wrote:
>
> 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.
>
> Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")
>
> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> ---
>  lib/librte_net/rte_net.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
> index 1edc283a4..94b06d9ee 100644
> --- a/lib/librte_net/rte_net.h
> +++ b/lib/librte_net/rte_net.h
> @@ -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
>

Reviewed-by: David Marchand <david.marchand@redhat.com>

Olivier suggestion on the commitlog/title looks fine to me.
Ferruh Yigit July 29, 2020, 10:03 a.m. UTC | #4
On 7/29/2020 9:54 AM, David Marchand wrote:
> On Tue, Jul 28, 2020 at 7:11 PM Yuying Zhang <yuying.zhang@intel.com> wrote:
>>
>> 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.
>>
>> Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")
>>
>> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 

Applied to dpdk-next-net/master, thanks.

(Used the suggested commit log)
Andrew Rybchenko July 29, 2020, 4 p.m. UTC | #5
On 7/29/20 10:49 AM, Olivier Matz wrote:
> On Tue, Jul 28, 2020 at 05:09:50PM +0000, Yuying Zhang wrote:
>> 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.
> 
> 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.
> 
>> Fixes: 520059a41aa9 ("net: check fragmented headers in non-debug as well")
>>
>> Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

> 
>> ---
>>  lib/librte_net/rte_net.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
>> index 1edc283a4..94b06d9ee 100644
>> --- a/lib/librte_net/rte_net.h
>> +++ b/lib/librte_net/rte_net.h
>> @@ -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
>>
diff mbox series

Patch

diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
index 1edc283a4..94b06d9ee 100644
--- a/lib/librte_net/rte_net.h
+++ b/lib/librte_net/rte_net.h
@@ -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))