]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/mlx5e: Trigger NAPI after activating an SQ
authorMaxim Mikityanskiy <maximmi@nvidia.com>
Tue, 30 Aug 2022 16:39:49 +0000 (19:39 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Sat, 4 Feb 2023 10:07:04 +0000 (02:07 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 6f8723cc687414a7f5ee127fce5de37bdca2ceda..125c7cb7d839cac7a7de2c0776a1ad903d7662aa 100644 (file)
@@ -454,6 +454,7 @@ struct mlx5e_txqsq {
        struct mlx5_clock         *clock;
        struct net_device         *netdev;
        struct mlx5_core_dev      *mdev;
+       struct mlx5e_channel      *channel;
        struct mlx5e_priv         *priv;
 
        /* control path */
index 8469e9c38670653499a2355c50b319491ae39460..9a1bc93b7dc6ee3237efb8e8d547d30efe2733bc 100644 (file)
@@ -771,8 +771,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)
        if (test_bit(MLX5E_PTP_STATE_RX, c->state)) {
                mlx5e_ptp_rx_set_fs(c->priv);
                mlx5e_activate_rq(&c->rq);
-               mlx5e_trigger_napi_sched(&c->napi);
        }
+       mlx5e_trigger_napi_sched(&c->napi);
 }
 
 void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c)
index b195dbbf6c90feba91b73b1d0935ceb70f897a3c..41e356d9d785f8ee130193bc4c72b747cd92383c 100644 (file)
@@ -81,6 +81,10 @@ static int mlx5e_tx_reporter_err_cqe_recover(void *ctx)
        sq->stats->recover++;
        clear_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state);
        mlx5e_activate_txqsq(sq);
+       if (sq->channel)
+               mlx5e_trigger_napi_icosq(sq->channel);
+       else
+               mlx5e_trigger_napi_sched(sq->cq.napi);
 
        return 0;
 out:
index 0e87432ec6f1c36ea57ab6946809bba63fd43321..27f90baac768854f9d95c681526d2fe9d20d9fc6 100644 (file)
@@ -1470,6 +1470,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
        sq->mkey_be   = c->mkey_be;
        sq->netdev    = c->netdev;
        sq->mdev      = c->mdev;
+       sq->channel   = c;
        sq->priv      = c->priv;
        sq->ch_ix     = c->ix;
        sq->txq_ix    = txq_ix;
@@ -2482,8 +2483,6 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c)
                mlx5e_activate_xsk(c);
        else
                mlx5e_activate_rq(&c->rq);
-
-       mlx5e_trigger_napi_icosq(c);
 }
 
 static void mlx5e_deactivate_channel(struct mlx5e_channel *c)
@@ -2575,13 +2574,19 @@ err_free:
        return err;
 }
 
-static void mlx5e_activate_channels(struct mlx5e_channels *chs)
+static void mlx5e_activate_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs)
 {
        int i;
 
        for (i = 0; i < chs->num; i++)
                mlx5e_activate_channel(chs->c[i]);
 
+       if (priv->htb)
+               mlx5e_qos_activate_queues(priv);
+
+       for (i = 0; i < chs->num; i++)
+               mlx5e_trigger_napi_icosq(chs->c[i]);
+
        if (chs->ptp)
                mlx5e_ptp_activate_channel(chs->ptp);
 }
@@ -2888,9 +2893,7 @@ out:
 void mlx5e_activate_priv_channels(struct mlx5e_priv *priv)
 {
        mlx5e_build_txq_maps(priv);
-       mlx5e_activate_channels(&priv->channels);
-       if (priv->htb)
-               mlx5e_qos_activate_queues(priv);
+       mlx5e_activate_channels(priv, &priv->channels);
        mlx5e_xdp_tx_enable(priv);
 
        /* dev_watchdog() wants all TX queues to be started when the carrier is