net/mlx5: fix order of lines in loop

Message ID a48a3f51990c6959eb4cc34cfdf2de465baf2061.1565005897.git.dekelp@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix order of lines in loop |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Dekel Peled Aug. 5, 2019, 11:51 a.m. UTC
  Function flow_dv_zero_encap_udp_csum() uses a while loop to iterate
over vlan items in flow rule.
Pointer next_hdr is incremented to the next item before it is used,
so the first item is skipped.

This patch moves the incrementing of next_hdr to the correct place.

Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation")
Cc: elibr@mellanox.com

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Eli Britstein Aug. 5, 2019, 12:16 p.m. UTC | #1
Acked-by: Eli Britstein <elibr@mellanox.com>

On 8/5/2019 2:51 PM, Dekel Peled wrote:
> Function flow_dv_zero_encap_udp_csum() uses a while loop to iterate
> over vlan items in flow rule.
> Pointer next_hdr is incremented to the next item before it is used,
> so the first item is skipped.
>
> This patch moves the incrementing of next_hdr to the correct place.
>
> Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation")
> Cc: elibr@mellanox.com
>
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
>   drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
> index 536059d..6c58634 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1504,9 +1504,9 @@ struct field_modify_info modify_tcp[] = {
>   
>   	/* VLAN skipping */
>   	while (proto == RTE_ETHER_TYPE_VLAN || proto == RTE_ETHER_TYPE_QINQ) {
> -		next_hdr += sizeof(struct rte_vlan_hdr);
>   		vlan = (struct rte_vlan_hdr *)next_hdr;
>   		proto = RTE_BE16(vlan->eth_proto);
> +		next_hdr += sizeof(struct rte_vlan_hdr);
>   	}
>   
>   	/* HW calculates IPv4 csum. no need to proceed */
  
Slava Ovsiienko Aug. 5, 2019, 12:44 p.m. UTC | #2
> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Monday, August 5, 2019 14:51
> To: Yongseok Koh <yskoh@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>
> Cc: Ori Kam <orika@mellanox.com>; dev@dpdk.org; Eli Britstein
> <elibr@mellanox.com>
> Subject: [PATCH] net/mlx5: fix order of lines in loop
> 
> Function flow_dv_zero_encap_udp_csum() uses a while loop to iterate over
> vlan items in flow rule.
> Pointer next_hdr is incremented to the next item before it is used, so the first
> item is skipped.
> 
> This patch moves the incrementing of next_hdr to the correct place.
> 
> Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation")
> Cc: elibr@mellanox.com
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c index 536059d..6c58634 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1504,9 +1504,9 @@ struct field_modify_info modify_tcp[] = {
> 
>  	/* VLAN skipping */
>  	while (proto == RTE_ETHER_TYPE_VLAN || proto ==
> RTE_ETHER_TYPE_QINQ) {
> -		next_hdr += sizeof(struct rte_vlan_hdr);
>  		vlan = (struct rte_vlan_hdr *)next_hdr;
>  		proto = RTE_BE16(vlan->eth_proto);
> +		next_hdr += sizeof(struct rte_vlan_hdr);
>  	}
> 
>  	/* HW calculates IPv4 csum. no need to proceed */
> --
> 1.8.3.1
  
Raslan Darawsheh Aug. 5, 2019, 3:16 p.m. UTC | #3
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Dekel Peled
> Sent: Monday, August 5, 2019 2:51 PM
> To: Yongseok Koh <yskoh@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>
> Cc: Ori Kam <orika@mellanox.com>; dev@dpdk.org; Eli Britstein
> <elibr@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix order of lines in loop
> 
> Function flow_dv_zero_encap_udp_csum() uses a while loop to iterate
> over vlan items in flow rule.
> Pointer next_hdr is incremented to the next item before it is used,
> so the first item is skipped.
> 
> This patch moves the incrementing of next_hdr to the correct place.
> 
> Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation")
> Cc: elibr@mellanox.com
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 536059d..6c58634 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1504,9 +1504,9 @@ struct field_modify_info modify_tcp[] = {
> 
>  	/* VLAN skipping */
>  	while (proto == RTE_ETHER_TYPE_VLAN || proto ==
> RTE_ETHER_TYPE_QINQ) {
> -		next_hdr += sizeof(struct rte_vlan_hdr);
>  		vlan = (struct rte_vlan_hdr *)next_hdr;
>  		proto = RTE_BE16(vlan->eth_proto);
> +		next_hdr += sizeof(struct rte_vlan_hdr);
>  	}
> 
>  	/* HW calculates IPv4 csum. no need to proceed */
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 536059d..6c58634 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1504,9 +1504,9 @@  struct field_modify_info modify_tcp[] = {
 
 	/* VLAN skipping */
 	while (proto == RTE_ETHER_TYPE_VLAN || proto == RTE_ETHER_TYPE_QINQ) {
-		next_hdr += sizeof(struct rte_vlan_hdr);
 		vlan = (struct rte_vlan_hdr *)next_hdr;
 		proto = RTE_BE16(vlan->eth_proto);
+		next_hdr += sizeof(struct rte_vlan_hdr);
 	}
 
 	/* HW calculates IPv4 csum. no need to proceed */