OSDN Git Service

net/mlx5e: Pass q_counter indentifier as parameter to rq_param builders
authorTariq Toukan <tariqt@nvidia.com>
Sun, 7 Mar 2021 13:13:23 +0000 (15:13 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 26 Mar 2021 02:49:49 +0000 (19:49 -0700)
Pass q_counter idintifier, instead of reading it from mlx5e_priv
parameter.
This is a step towards removing the mlx5e_priv parameter from all
params function and logic in the next patches of the series.

Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Aya Levin <ayal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/params.h
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index ea2cfb0..97a5bf5 100644 (file)
@@ -115,6 +115,7 @@ void mlx5e_build_create_cq_param(struct mlx5e_create_cq_param *ccp, struct mlx5e
 void mlx5e_build_rq_param(struct mlx5e_priv *priv,
                          struct mlx5e_params *params,
                          struct mlx5e_xsk_param *xsk,
+                         u16 q_counter,
                          struct mlx5e_rq_param *param);
 void mlx5e_build_sq_param_common(struct mlx5e_priv *priv,
                                 struct mlx5e_sq_param *param);
index 41db938..0bfbc8c 100644 (file)
@@ -245,7 +245,7 @@ static void mlx5e_build_trap_params(struct mlx5e_priv *priv, struct mlx5e_trap *
        params->rq_wq_type = MLX5_WQ_TYPE_CYCLIC;
        mlx5e_init_rq_type_params(priv->mdev, params);
        params->sw_mtu = priv->netdev->max_mtu;
-       mlx5e_build_rq_param(priv, params, NULL, &t->rq_param);
+       mlx5e_build_rq_param(priv, params, NULL, priv->q_counter, &t->rq_param);
 }
 
 static struct mlx5e_trap *mlx5e_open_trap(struct mlx5e_priv *priv)
index f4bce13..d84a229 100644 (file)
@@ -40,7 +40,7 @@ static void mlx5e_build_xsk_cparam(struct mlx5e_priv *priv,
                                   struct mlx5e_xsk_param *xsk,
                                   struct mlx5e_channel_param *cparam)
 {
-       mlx5e_build_rq_param(priv, params, xsk, &cparam->rq);
+       mlx5e_build_rq_param(priv, params, xsk, priv->q_counter, &cparam->rq);
        mlx5e_build_xdpsq_param(priv, params, &cparam->xdp_sq);
 }
 
index d40fc26..6aae2bc 100644 (file)
@@ -2190,6 +2190,7 @@ static u8 mlx5e_get_rq_log_wq_sz(void *rqc)
 void mlx5e_build_rq_param(struct mlx5e_priv *priv,
                          struct mlx5e_params *params,
                          struct mlx5e_xsk_param *xsk,
+                         u16 q_counter,
                          struct mlx5e_rq_param *param)
 {
        struct mlx5_core_dev *mdev = priv->mdev;
@@ -2218,7 +2219,7 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,
        MLX5_SET(wq, wq, log_wq_stride,
                 mlx5e_get_rqwq_log_stride(params->rq_wq_type, ndsegs));
        MLX5_SET(wq, wq, pd,               mdev->mlx5e_res.hw_objs.pdn);
-       MLX5_SET(rqc, rqc, counter_set_id, priv->q_counter);
+       MLX5_SET(rqc, rqc, counter_set_id, q_counter);
        MLX5_SET(rqc, rqc, vsd,            params->vlan_strip_disable);
        MLX5_SET(rqc, rqc, scatter_fcs,    params->scatter_fcs_en);
 
@@ -2227,6 +2228,7 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,
 }
 
 static void mlx5e_build_drop_rq_param(struct mlx5e_priv *priv,
+                                     u16 q_counter,
                                      struct mlx5e_rq_param *param)
 {
        struct mlx5_core_dev *mdev = priv->mdev;
@@ -2236,7 +2238,7 @@ static void mlx5e_build_drop_rq_param(struct mlx5e_priv *priv,
        MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_CYCLIC);
        MLX5_SET(wq, wq, log_wq_stride,
                 mlx5e_get_rqwq_log_stride(MLX5_WQ_TYPE_CYCLIC, 1));
-       MLX5_SET(rqc, rqc, counter_set_id, priv->drop_rq_q_counter);
+       MLX5_SET(rqc, rqc, counter_set_id, q_counter);
 
        param->wq.buf_numa_node = dev_to_node(mlx5_core_dma_dev(mdev));
 }
@@ -2386,11 +2388,12 @@ static u8 mlx5e_build_async_icosq_log_wq_sz(struct net_device *netdev)
 
 static void mlx5e_build_channel_param(struct mlx5e_priv *priv,
                                      struct mlx5e_params *params,
+                                     u16 q_counter,
                                      struct mlx5e_channel_param *cparam)
 {
        u8 icosq_log_wq_sz, async_icosq_log_wq_sz;
 
-       mlx5e_build_rq_param(priv, params, NULL, &cparam->rq);
+       mlx5e_build_rq_param(priv, params, NULL, q_counter, &cparam->rq);
 
        icosq_log_wq_sz = mlx5e_build_icosq_log_wq_sz(params, &cparam->rq);
        async_icosq_log_wq_sz = mlx5e_build_async_icosq_log_wq_sz(priv->netdev);
@@ -2415,7 +2418,7 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
        if (!chs->c || !cparam)
                goto err_free;
 
-       mlx5e_build_channel_param(priv, &chs->params, cparam);
+       mlx5e_build_channel_param(priv, &chs->params, priv->q_counter, cparam);
        for (i = 0; i < chs->num; i++) {
                struct xsk_buff_pool *xsk_pool = NULL;
 
@@ -3376,7 +3379,7 @@ int mlx5e_open_drop_rq(struct mlx5e_priv *priv,
        struct mlx5e_cq *cq = &drop_rq->cq;
        int err;
 
-       mlx5e_build_drop_rq_param(priv, &rq_param);
+       mlx5e_build_drop_rq_param(priv, priv->drop_rq_q_counter, &rq_param);
 
        err = mlx5e_alloc_drop_cq(priv, cq, &cq_param);
        if (err)