Skip to content

Commit 79efecb

Browse files
nvmmaxSaeed Mahameed
authored andcommitted
net/mlx5e: Trigger NAPI after activating an SQ
If an SQ is deactivated and reactivated again, some packets could be sent after MLX5E_SQ_STATE_ENABLED is cleared, but before netif_tx_stop_queue, meaning that NAPI might miss some completions. In order to handle them, make sure to trigger NAPI after SQ activation in all cases where it can be relevant. Regular SQs, XDP SQs and XSK SQs are good. Missing cases added: after recovery, after activating HTB SQs and after activating PTP SQs. Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent a738518 commit 79efecb

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ struct mlx5e_txqsq {
454454
struct mlx5_clock *clock;
455455
struct net_device *netdev;
456456
struct mlx5_core_dev *mdev;
457+
struct mlx5e_channel *channel;
457458
struct mlx5e_priv *priv;
458459

459460
/* control path */

drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
771771
if (test_bit(MLX5E_PTP_STATE_RX, c->state)) {
772772
mlx5e_ptp_rx_set_fs(c->priv);
773773
mlx5e_activate_rq(&c->rq);
774-
mlx5e_trigger_napi_sched(&c->napi);
775774
}
775+
mlx5e_trigger_napi_sched(&c->napi);
776776
}
777777

778778
void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c)

drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx)
8181
sq->stats->recover++;
8282
clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state);
8383
mlx5e_activate_txqsq(sq);
84+
if (sq->channel)
85+
mlx5e_trigger_napi_icosq(sq->channel);
86+
else
87+
mlx5e_trigger_napi_sched(sq->cq.napi);
8488

8589
return 0;
8690
out:

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
14701470
sq->mkey_be = c->mkey_be;
14711471
sq->netdev = c->netdev;
14721472
sq->mdev = c->mdev;
1473+
sq->channel = c;
14731474
sq->priv = c->priv;
14741475
sq->ch_ix = c->ix;
14751476
sq->txq_ix = txq_ix;
@@ -2482,8 +2483,6 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
24822483
mlx5e_activate_xsk(c);
24832484
else
24842485
mlx5e_activate_rq(&c->rq);
2485-
2486-
mlx5e_trigger_napi_icosq(c);
24872486
}
24882487

24892488
static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
@@ -2575,13 +2574,19 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
25752574
return err;
25762575
}
25772576

2578-
static void mlx5e_activate_channels(struct mlx5e_channels *chs)
2577+
static void mlx5e_activate_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs)
25792578
{
25802579
int i;
25812580

25822581
for (i = 0; i < chs->num; i++)
25832582
mlx5e_activate_channel(chs->c[i]);
25842583

2584+
if (priv->htb)
2585+
mlx5e_qos_activate_queues(priv);
2586+
2587+
for (i = 0; i < chs->num; i++)
2588+
mlx5e_trigger_napi_icosq(chs->c[i]);
2589+
25852590
if (chs->ptp)
25862591
mlx5e_ptp_activate_channel(chs->ptp);
25872592
}
@@ -2888,9 +2893,7 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)
28882893
void mlx5e_activate_priv_channels(struct mlx5e_priv *priv)
28892894
{
28902895
mlx5e_build_txq_maps(priv);
2891-
mlx5e_activate_channels(&priv->channels);
2892-
if (priv->htb)
2893-
mlx5e_qos_activate_queues(priv);
2896+
mlx5e_activate_channels(priv, &priv->channels);
28942897
mlx5e_xdp_tx_enable(priv);
28952898

28962899
/* dev_watchdog() wants all TX queues to be started when the carrier is

0 commit comments

Comments
 (0)