lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25315234-d6c9-3b4e-d041-d2e0dcae0d5e@intel.com>
Date:   Wed, 18 Jan 2023 13:50:45 -0800
From:   Jacob Keller <jacob.e.keller@...el.com>
To:     Saeed Mahameed <saeed@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Eric Dumazet <edumazet@...gle.com>
CC:     Saeed Mahameed <saeedm@...dia.com>, <netdev@...r.kernel.org>,
        Tariq Toukan <tariqt@...dia.com>,
        Maor Dickman <maord@...dia.com>, Roi Dayan <roid@...dia.com>
Subject: Re: [net-next 14/15] net/mlx5e: Remove redundant allocation of spec
 in create indirect fwd group



On 1/18/2023 10:36 AM, Saeed Mahameed wrote:
> From: Maor Dickman <maord@...dia.com>
> 
> mlx5_add_flow_rules supports creating rules without any matches by passing NULL
> pointer instead of spec, if NULL is passed it will use a static empty spec.
> This make allocation of spec in mlx5_create_indir_fwd_group unnecessary.
> 
> Remove the redundant allocation.
> 

Yep. The code to handle this was added in 5c2aa8ae3a2c ("net/mlx5:
Accept flow rules without match").

Makes sense, saves an allocation and the zero_spec struct used was
already/always on the stack so no change there.

Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>

> Signed-off-by: Maor Dickman <maord@...dia.com>
> Reviewed-by: Roi Dayan <roid@...dia.com>
> Signed-off-by: Saeed Mahameed <saeedm@...dia.com>
> ---
>  .../net/ethernet/mellanox/mlx5/core/esw/indir_table.c  | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> index 8a94870c5b43..9959e9fd15a1 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.c
> @@ -212,19 +212,12 @@ static int mlx5_create_indir_fwd_group(struct mlx5_eswitch *esw,
>  	int err = 0, inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
>  	struct mlx5_flow_destination dest = {};
>  	struct mlx5_flow_act flow_act = {};
> -	struct mlx5_flow_spec *spec;
>  	u32 *in;
>  
>  	in = kvzalloc(inlen, GFP_KERNEL);
>  	if (!in)
>  		return -ENOMEM;
>  
> -	spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
> -	if (!spec) {
> -		kvfree(in);
> -		return -ENOMEM;
> -	}
> -
>  	/* Hold one entry */
>  	MLX5_SET(create_flow_group_in, in, start_flow_index, MLX5_ESW_INDIR_TABLE_FWD_IDX);
>  	MLX5_SET(create_flow_group_in, in, end_flow_index, MLX5_ESW_INDIR_TABLE_FWD_IDX);
> @@ -240,14 +233,13 @@ static int mlx5_create_indir_fwd_group(struct mlx5_eswitch *esw,
>  	dest.vport.num = e->vport;
>  	dest.vport.vhca_id = MLX5_CAP_GEN(esw->dev, vhca_id);
>  	dest.vport.flags = MLX5_FLOW_DEST_VPORT_VHCA_ID;
> -	e->fwd_rule = mlx5_add_flow_rules(e->ft, spec, &flow_act, &dest, 1);
> +	e->fwd_rule = mlx5_add_flow_rules(e->ft, NULL, &flow_act, &dest, 1);
>  	if (IS_ERR(e->fwd_rule)) {
>  		mlx5_destroy_flow_group(e->fwd_grp);
>  		err = PTR_ERR(e->fwd_rule);
>  	}
>  
>  err_out:
> -	kvfree(spec);
>  	kvfree(in);
>  	return err;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ