Skip to content

Commit 31f114c

Browse files
Tariq Toukankuba-moo
authored andcommitted
net/mlx5e: SD, Use correct mdev to build channel param
In a multi-PF netdev, each traffic channel creates its own resources against a specific PF. In the cited commit, where this support was added, the channel_param logic was mistakenly kept unchanged, so it always used the primary PF which is found at priv->mdev. In this patch we fix this by moving the logic to be per-channel, and passing the correct mdev instance. This bug happened to be usually harmless, as the resulting cparam structures would be the same for all channels, due to identical FW logic and decisions. However, in some use cases, like fwreset, this gets broken. This could lead to different symptoms. Example: Error cqe on cqn 0x428, ci 0x0, qn 0x10a9, opcode 0xe, syndrome 0x4, vendor syndrome 0x32 Fixes: e4f9686 ("net/mlx5e: Let channels be SD-aware") Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Lama Kayal <[email protected]> Reviewed-by: Gal Pressman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent d04c81a commit 31f114c

File tree

1 file changed

+17
-15
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+17
-15
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,11 +2680,11 @@ void mlx5e_trigger_napi_sched(struct napi_struct *napi)
26802680

26812681
static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
26822682
struct mlx5e_params *params,
2683-
struct mlx5e_channel_param *cparam,
26842683
struct xsk_buff_pool *xsk_pool,
26852684
struct mlx5e_channel **cp)
26862685
{
26872686
struct net_device *netdev = priv->netdev;
2687+
struct mlx5e_channel_param *cparam;
26882688
struct mlx5_core_dev *mdev;
26892689
struct mlx5e_xsk_param xsk;
26902690
struct mlx5e_channel *c;
@@ -2706,8 +2706,15 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
27062706
return err;
27072707

27082708
c = kvzalloc_node(sizeof(*c), GFP_KERNEL, cpu_to_node(cpu));
2709-
if (!c)
2710-
return -ENOMEM;
2709+
cparam = kvzalloc(sizeof(*cparam), GFP_KERNEL);
2710+
if (!c || !cparam) {
2711+
err = -ENOMEM;
2712+
goto err_free;
2713+
}
2714+
2715+
err = mlx5e_build_channel_param(mdev, params, cparam);
2716+
if (err)
2717+
goto err_free;
27112718

27122719
c->priv = priv;
27132720
c->mdev = mdev;
@@ -2741,6 +2748,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
27412748

27422749
*cp = c;
27432750

2751+
kvfree(cparam);
27442752
return 0;
27452753

27462754
err_close_queues:
@@ -2749,6 +2757,8 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
27492757
err_napi_del:
27502758
netif_napi_del(&c->napi);
27512759

2760+
err_free:
2761+
kvfree(cparam);
27522762
kvfree(c);
27532763

27542764
return err;
@@ -2807,28 +2817,22 @@ static void mlx5e_close_channel(struct mlx5e_channel *c)
28072817
int mlx5e_open_channels(struct mlx5e_priv *priv,
28082818
struct mlx5e_channels *chs)
28092819
{
2810-
struct mlx5e_channel_param *cparam;
28112820
int err = -ENOMEM;
28122821
int i;
28132822

28142823
chs->num = chs->params.num_channels;
28152824

28162825
chs->c = kcalloc(chs->num, sizeof(struct mlx5e_channel *), GFP_KERNEL);
2817-
cparam = kvzalloc(sizeof(struct mlx5e_channel_param), GFP_KERNEL);
2818-
if (!chs->c || !cparam)
2819-
goto err_free;
2820-
2821-
err = mlx5e_build_channel_param(priv->mdev, &chs->params, cparam);
2822-
if (err)
2823-
goto err_free;
2826+
if (!chs->c)
2827+
goto err_out;
28242828

28252829
for (i = 0; i < chs->num; i++) {
28262830
struct xsk_buff_pool *xsk_pool = NULL;
28272831

28282832
if (chs->params.xdp_prog)
28292833
xsk_pool = mlx5e_xsk_get_pool(&chs->params, chs->params.xsk, i);
28302834

2831-
err = mlx5e_open_channel(priv, i, &chs->params, cparam, xsk_pool, &chs->c[i]);
2835+
err = mlx5e_open_channel(priv, i, &chs->params, xsk_pool, &chs->c[i]);
28322836
if (err)
28332837
goto err_close_channels;
28342838
}
@@ -2846,7 +2850,6 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
28462850
}
28472851

28482852
mlx5e_health_channels_update(priv);
2849-
kvfree(cparam);
28502853
return 0;
28512854

28522855
err_close_ptp:
@@ -2857,9 +2860,8 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
28572860
for (i--; i >= 0; i--)
28582861
mlx5e_close_channel(chs->c[i]);
28592862

2860-
err_free:
28612863
kfree(chs->c);
2862-
kvfree(cparam);
2864+
err_out:
28632865
chs->num = 0;
28642866
return err;
28652867
}

0 commit comments

Comments
 (0)