net/mlx5e: Nullify table pointer when failing to create

[ Upstream commit 1b540decd0 ]

On failing to create promisc flow steering table, the pointer is
returned with an error. Nullify it so unloading the driver won't try to
destroy a non existing table.

Failing to create promisc table may happen over BF devices when the ARM
side is going through a firmware tear down. The host side start a
reload flow. While the driver unloads, it tries to remove the promisc
table. Remove WARN in this state as it is a valid error flow.

Fixes: 1c46d7409f ("net/mlx5e: Optimize promiscuous mode")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Aya Levin
2023-03-12 16:37:36 +02:00
committed by Greg Kroah-Hartman
parent 15968f6508
commit fd40d2eb5e

View File

@@ -776,6 +776,7 @@ static int mlx5e_create_promisc_table(struct mlx5e_flow_steering *fs)
ft->t = mlx5_create_auto_grouped_flow_table(fs->ns, &ft_attr); ft->t = mlx5_create_auto_grouped_flow_table(fs->ns, &ft_attr);
if (IS_ERR(ft->t)) { if (IS_ERR(ft->t)) {
err = PTR_ERR(ft->t); err = PTR_ERR(ft->t);
ft->t = NULL;
fs_err(fs, "fail to create promisc table err=%d\n", err); fs_err(fs, "fail to create promisc table err=%d\n", err);
return err; return err;
} }
@@ -803,7 +804,7 @@ static void mlx5e_del_promisc_rule(struct mlx5e_flow_steering *fs)
static void mlx5e_destroy_promisc_table(struct mlx5e_flow_steering *fs) static void mlx5e_destroy_promisc_table(struct mlx5e_flow_steering *fs)
{ {
if (WARN(!fs->promisc.ft.t, "Trying to remove non-existing promiscuous table")) if (!fs->promisc.ft.t)
return; return;
mlx5e_del_promisc_rule(fs); mlx5e_del_promisc_rule(fs);
mlx5_destroy_flow_table(fs->promisc.ft.t); mlx5_destroy_flow_table(fs->promisc.ft.t);