patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix unnecessary init in MARK action conversion
@ 2020-07-21 12:04 Michael Baum
  2020-07-22 15:30 ` [dpdk-stable] [dpdk-dev] " Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Baum @ 2020-07-21 12:04 UTC (permalink / raw)
  To: dev; +Cc: matan, viacheslavo, stable

The flow_dv_convert_action_mark function defines an array of
field_modify_info structures and initializes the first entity.

In the first entity id field, it initializes to 0, even though its type
is an enum that has no value of 0.
In fact, the function does not use this id field before assigning the
appropriate register id into it, so the initialization is unnecessary.
Moreover, this initialization is int into enum, and it would be better
not to create a type conflict for no reason.

Wait for the first entity initialization until the appropriate register
id is already known.

Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index caeafd9..0f258b4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1151,8 +1151,7 @@ struct field_modify_info modify_tcp[] = {
 		.mask = &mask,
 	};
 	struct field_modify_info reg_c_x[] = {
-		{4, 0, 0}, /* dynamic instead of MLX5_MODI_META_REG_C_1. */
-		{0, 0, 0},
+		[1] = {0, 0, 0},
 	};
 	int reg;
 
@@ -1172,7 +1171,7 @@ struct field_modify_info modify_tcp[] = {
 		mask = rte_cpu_to_be_32(mask) & msk_c0;
 		mask = rte_cpu_to_be_32(mask << shl_c0);
 	}
-	reg_c_x[0].id = reg_to_field[reg];
+	reg_c_x[0] = (struct field_modify_info){4, 0, reg_to_field[reg]};
 	return flow_dv_convert_modify_action(&item, reg_c_x, NULL, resource,
 					     MLX5_MODIFICATION_TYPE_SET, error);
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/mlx5: fix unnecessary init in MARK action conversion
  2020-07-21 12:04 [dpdk-stable] [PATCH] net/mlx5: fix unnecessary init in MARK action conversion Michael Baum
@ 2020-07-22 15:30 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2020-07-22 15:30 UTC (permalink / raw)
  To: Michael Baum, dev; +Cc: Matan Azrad, Slava Ovsiienko, stable

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Michael Baum
> Sent: Tuesday, July 21, 2020 3:05 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix unnecessary init in MARK action
> conversion
> 
> The flow_dv_convert_action_mark function defines an array of
> field_modify_info structures and initializes the first entity.
> 
> In the first entity id field, it initializes to 0, even though its type
> is an enum that has no value of 0.
> In fact, the function does not use this id field before assigning the
> appropriate register id into it, so the initialization is unnecessary.
> Moreover, this initialization is int into enum, and it would be better
> not to create a type conflict for no reason.
> 
> Wait for the first entity initialization until the appropriate register
> id is already known.
> 
> Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Michael Baum <michaelba@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index caeafd9..0f258b4 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1151,8 +1151,7 @@ struct field_modify_info modify_tcp[] = {
>  		.mask = &mask,
>  	};
>  	struct field_modify_info reg_c_x[] = {
> -		{4, 0, 0}, /* dynamic instead of
> MLX5_MODI_META_REG_C_1. */
> -		{0, 0, 0},
> +		[1] = {0, 0, 0},
>  	};
>  	int reg;
> 
> @@ -1172,7 +1171,7 @@ struct field_modify_info modify_tcp[] = {
>  		mask = rte_cpu_to_be_32(mask) & msk_c0;
>  		mask = rte_cpu_to_be_32(mask << shl_c0);
>  	}
> -	reg_c_x[0].id = reg_to_field[reg];
> +	reg_c_x[0] = (struct field_modify_info){4, 0, reg_to_field[reg]};
>  	return flow_dv_convert_modify_action(&item, reg_c_x, NULL,
> resource,
>  					     MLX5_MODIFICATION_TYPE_SET,
> error);
>  }
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-22 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 12:04 [dpdk-stable] [PATCH] net/mlx5: fix unnecessary init in MARK action conversion Michael Baum
2020-07-22 15:30 ` [dpdk-stable] [dpdk-dev] " Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).