Skip to content

Commit f5f502a

Browse files
committed
Merge tag 'mlx5-updates-2023-08-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2023-08-07 1) Few cleanups 2) Dynamic completion EQs The driver creates completion EQs for all vectors directly on driver load, even if those EQs will not be utilized later on. To allow more flexibility in managing completion EQs and to reduce the memory overhead of driver load, this series will adjust completion EQs creation to be dynamic. Meaning, completion EQs will be created only when needed. Patch #1 introduces a counter for tracking the current number of completion EQs. Patches #2-6 refactor the existing infrastructure of managing completion EQs and completion IRQs to be compatible with per-vector allocation/release requests. Patches #7-8 modify the CPU-to-IRQ affinity calculation to be resilient in case the affinity is requested but completion IRQ is not allocated yet. Patch #9 function rename. Patch #10 handles the corner case of SF performing an IRQ request when no SF IRQ pool is found, and no PF IRQ exists for the same vector. Patch #11 modify driver to use dynamically allocate completion EQs. * tag 'mlx5-updates-2023-08-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5: Bridge, Only handle registered netdev bridge events net/mlx5: E-Switch, Remove redundant arg ignore_flow_lvl net/mlx5: Fix typo reminder -> remainder net/mlx5: remove many unnecessary NULL values net/mlx5: Allocate completion EQs dynamically net/mlx5: Handle SF IRQ request in the absence of SF IRQ pool net/mlx5: Rename mlx5_comp_vectors_count() to mlx5_comp_vectors_max() net/mlx5: Add IRQ vector to CPU lookup function net/mlx5: Introduce mlx5_cpumask_default_spread net/mlx5: Implement single completion EQ create/destroy methods net/mlx5: Use xarray to store and manage completion EQs net/mlx5: Refactor completion IRQ request/release handlers in EQ layer net/mlx5: Use xarray to store and manage completion IRQs net/mlx5: Refactor completion IRQ request/release API net/mlx5: Track the current number of completion EQs ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 2c2b887 + b56fb19 commit f5f502a

File tree

22 files changed

+309
-280
lines changed

22 files changed

+309
-280
lines changed

drivers/infiniband/hw/mlx5/cq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
993993
INIT_WORK(&cq->notify_work, notify_soft_wc_handler);
994994
}
995995

996-
err = mlx5_vector2eqn(dev->mdev, vector, &eqn);
996+
err = mlx5_comp_eqn_get(dev->mdev, vector, &eqn);
997997
if (err)
998998
goto err_cqb;
999999

drivers/infiniband/hw/mlx5/devx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_QUERY_EQN)(
10021002
return PTR_ERR(c);
10031003
dev = to_mdev(c->ibucontext.device);
10041004

1005-
err = mlx5_vector2eqn(dev->mdev, user_vector, &dev_eqn);
1005+
err = mlx5_comp_eqn_get(dev->mdev, user_vector, &dev_eqn);
10061006
if (err < 0)
10071007
return err;
10081008

drivers/infiniband/hw/mlx5/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3685,7 +3685,7 @@ static int mlx5_ib_stage_init_init(struct mlx5_ib_dev *dev)
36853685
if (mlx5_use_mad_ifc(dev))
36863686
get_ext_port_caps(dev);
36873687

3688-
dev->ib_dev.num_comp_vectors = mlx5_comp_vectors_count(mdev);
3688+
dev->ib_dev.num_comp_vectors = mlx5_comp_vectors_max(mdev);
36893689

36903690
mutex_init(&dev->cap_mask_mutex);
36913691
INIT_LIST_HEAD(&dev->qp_list);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
193193
{
194194
return is_kdump_kernel() ?
195195
MLX5E_MIN_NUM_CHANNELS :
196-
min_t(int, mlx5_comp_vectors_count(mdev), MLX5E_MAX_NUM_CHANNELS);
196+
min_t(int, mlx5_comp_vectors_max(mdev), MLX5E_MAX_NUM_CHANNELS);
197197
}
198198

199199
/* The maximum WQE size can be retrieved by max_wqe_sz_sq in

drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ mlx5_esw_bridge_rep_vport_num_vhca_id_get(struct net_device *dev, struct mlx5_es
7777
return NULL;
7878

7979
priv = netdev_priv(dev);
80+
81+
if (!priv->mdev->priv.eswitch->br_offloads)
82+
return NULL;
83+
8084
rpriv = priv->ppriv;
8185
*vport_num = rpriv->rep->vport;
8286
*esw_owner_vhca_id = MLX5_CAP_GEN(priv->mdev, vhca_id);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static void mlx5e_build_trap_params(struct mlx5_core_dev *mdev,
127127

128128
static struct mlx5e_trap *mlx5e_open_trap(struct mlx5e_priv *priv)
129129
{
130-
int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(priv->mdev, 0));
130+
int cpu = mlx5_comp_vector_get_cpu(priv->mdev, 0);
131131
struct net_device *netdev = priv->netdev;
132132
struct mlx5e_trap *t;
133133
int err;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,7 @@ static int mlx5e_create_cq(struct mlx5e_cq *cq, struct mlx5e_cq_param *param)
19891989
int eqn;
19901990
int err;
19911991

1992-
err = mlx5_vector2eqn(mdev, param->eq_ix, &eqn);
1992+
err = mlx5_comp_eqn_get(mdev, param->eq_ix, &eqn);
19931993
if (err)
19941994
return err;
19951995

@@ -2445,14 +2445,14 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
24452445
struct xsk_buff_pool *xsk_pool,
24462446
struct mlx5e_channel **cp)
24472447
{
2448-
int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(priv->mdev, ix));
2448+
int cpu = mlx5_comp_vector_get_cpu(priv->mdev, ix);
24492449
struct net_device *netdev = priv->netdev;
24502450
struct mlx5e_xsk_param xsk;
24512451
struct mlx5e_channel *c;
24522452
unsigned int irq;
24532453
int err;
24542454

2455-
err = mlx5_vector2irqn(priv->mdev, ix, &irq);
2455+
err = mlx5_comp_irqn_get(priv->mdev, ix, &irq);
24562456
if (err)
24572457
return err;
24582458

@@ -2856,13 +2856,13 @@ static void mlx5e_set_default_xps_cpumasks(struct mlx5e_priv *priv,
28562856
struct mlx5_core_dev *mdev = priv->mdev;
28572857
int num_comp_vectors, ix, irq;
28582858

2859-
num_comp_vectors = mlx5_comp_vectors_count(mdev);
2859+
num_comp_vectors = mlx5_comp_vectors_max(mdev);
28602860

28612861
for (ix = 0; ix < params->num_channels; ix++) {
28622862
cpumask_clear(priv->scratchpad.cpumask);
28632863

28642864
for (irq = ix; irq < num_comp_vectors; irq += params->num_channels) {
2865-
int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(mdev, irq));
2865+
int cpu = mlx5_comp_vector_get_cpu(mdev, irq);
28662866

28672867
cpumask_set_cpu(cpu, priv->scratchpad.cpumask);
28682868
}

0 commit comments

Comments
 (0)