net/mlx5e: Specify SQ stats struct for mlx5e_open_txqsq()
authorTariq Toukan <tariqt@nvidia.com>
Wed, 18 Aug 2021 11:17:33 +0000 (14:17 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 5 Oct 2021 01:10:51 +0000 (18:10 -0700)
Let the caller of mlx5e_open_txqsq() directly pass the SQ stats
structure pointer.
This replaces logic involving the qos_queue_group_id parameter,
and helps generalizing its role in the next patch.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@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/qos.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 038b5c2857302dc516e02693d29e01dbfd3496b2..e06c8b816a326cdec98f9e6f48b26189b1561278 100644 (file)
@@ -1002,7 +1002,8 @@ int mlx5e_modify_sq(struct mlx5_core_dev *mdev, u32 sqn,
                    struct mlx5e_modify_sq_param *p);
 int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,
                     struct mlx5e_params *params, struct mlx5e_sq_param *param,
-                    struct mlx5e_txqsq *sq, int tc, u16 qos_queue_group_id, u16 qos_qid);
+                    struct mlx5e_txqsq *sq, int tc, u16 qos_queue_group_id,
+                    struct mlx5e_sq_stats *sq_stats);
 void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq);
 void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq);
 void mlx5e_free_txqsq(struct mlx5e_txqsq *sq);
index e8a8d78e3e4d545841ec17886bb429957e854b19..17a607541af6d7008a5da68661fe61e24d0a3561 100644 (file)
@@ -238,7 +238,8 @@ static int mlx5e_open_qos_sq(struct mlx5e_priv *priv, struct mlx5e_channels *chs
        if (err)
                goto err_free_sq;
        err = mlx5e_open_txqsq(c, priv->tisn[c->lag_port][0], txq_ix, params,
-                              &param_sq, sq, 0, node->hw_id, node->qid);
+                              &param_sq, sq, 0, node->hw_id,
+                              priv->htb.qos_sq_stats[node->qid]);
        if (err)
                goto err_close_cq;
 
index 005eb3c92506a7a187d9e0118837b44625949923..9f6685d3b17b4e872cc9f063e399fda927c2f0cb 100644 (file)
@@ -1300,7 +1300,8 @@ static int mlx5e_set_sq_maxrate(struct net_device *dev,
 
 int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,
                     struct mlx5e_params *params, struct mlx5e_sq_param *param,
-                    struct mlx5e_txqsq *sq, int tc, u16 qos_queue_group_id, u16 qos_qid)
+                    struct mlx5e_txqsq *sq, int tc, u16 qos_queue_group_id,
+                    struct mlx5e_sq_stats *sq_stats)
 {
        struct mlx5e_create_sq_param csp = {};
        u32 tx_rate;
@@ -1310,10 +1311,7 @@ int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,
        if (err)
                return err;
 
-       if (qos_queue_group_id)
-               sq->stats = c->priv->htb.qos_sq_stats[qos_qid];
-       else
-               sq->stats = &c->priv->channel_stats[c->ix].sq[tc];
+       sq->stats = sq_stats;
 
        csp.tisn            = tisn;
        csp.tis_lst_sz      = 1;
@@ -1717,7 +1715,8 @@ static int mlx5e_open_sqs(struct mlx5e_channel *c,
                int txq_ix = c->ix + tc * params->num_channels;
 
                err = mlx5e_open_txqsq(c, c->priv->tisn[c->lag_port][tc], txq_ix,
-                                      params, &cparam->txq_sq, &c->sq[tc], tc, 0, 0);
+                                      params, &cparam->txq_sq, &c->sq[tc], tc, 0,
+                                      &c->priv->channel_stats[c->ix].sq[tc]);
                if (err)
                        goto err_close_sqs;
        }