net/mlx5: fix lro update tcp header cksum error
PATCH 1/1 net/mlx5: fix lro update tcp header cksum error
csum is the sum of three 16 bits value
it must be folded twice to ensure that the upper 16 bits are 0
--- drivers/net/mlx5/mlx5_rx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/mlx5/mlx5_rx.c +1 -0
@@ -1090,6 +1090,7 @@ mlx5_lro_update_tcp_hdr(struct rte_tcp_hdr *__rte_restrict tcp, tcp->cksum =0 ; csum +=rte_raw_cksum (tcp, (tcp->data_off >>4 ) *4 ); csum = ((csum &0xffff0000 ) >>16 ) + (csum &0xffff ); + csum = ((csum &0xffff0000 ) >>16 ) + (csum &0xffff ); csum = (~csum) &0xffff ;if (csum ==0 ) csum =0xffff ;
--
2.27.0
Hi, Jiangheng
You are right, the corner case of sum of 3 is 0x1FFFF gives the wrong result. Could you, please, format the patch according to the rules and send v2 ?
- add Fixes: tag with reference to appropriate commit
- add Cc: [email protected]
- fix typos in commit message - capitalize sentences, add trailing points, etc.
With best regards,
Slava
Quoted 28 lines
-----Original Message-----
From: jiangheng (G) <[email protected]>
Sent: среда, 12 апреля 2023 г. 14:39
To: [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: fix lro update tcp header cksum errorcsum is the sum of three 16 bits value
it must be folded twice to ensure that the upper 16 bits are 0--- drivers/net/mlx5/mlx5_rx.c | 1 + 1 file changed, 1 insertion(+)drivers/net/mlx5/mlx5_rx.c index renamed from drivers/net/mlx5/mlx5_rx.c +0
-0
a2be523e9e..ae537dfffa100644drivers/net/mlx5/mlx5_rx.c +1
-0@@ -1090,6 +1090,7 @@ mlx5_lro_update_tcp_hdr(struct rte_tcp_hdr *__rte_restrict tcp, tcp->cksum =0 ; csum +=rte_raw_cksum (tcp, (tcp->data_off >>4 ) *4 ); csum = ((csum &0xffff0000 ) >>16 ) + (csum &0xffff ); + csum = ((csum &0xffff0000 ) >>16 ) + (csum &0xffff ); csum = (~csum) &0xffff ;if (csum ==0 )csum = 0xffff;--
2.27.0