Skip to content

Commit 4b66be7

Browse files
danielj-mellanoxkuba-moo
authored andcommitted
net/mlx5: Use set number of max EQs
If a maximum number of EQs has been set for an SF, use that amount. Signed-off-by: Daniel Jurgens <[email protected]> Reviewed-by: William Tu <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 20d80b9 commit 4b66be7

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,6 @@ static int get_num_eqs(struct mlx5_core_dev *dev)
11871187
{
11881188
struct mlx5_eq_table *eq_table = dev->priv.eq_table;
11891189
int max_dev_eqs;
1190-
int max_eqs_sf;
11911190
int num_eqs;
11921191

11931192
/* If ethernet is disabled we use just a single completion vector to
@@ -1202,7 +1201,11 @@ static int get_num_eqs(struct mlx5_core_dev *dev)
12021201
num_eqs = min_t(int, mlx5_irq_table_get_num_comp(eq_table->irq_table),
12031202
max_dev_eqs - MLX5_MAX_ASYNC_EQS);
12041203
if (mlx5_core_is_sf(dev)) {
1205-
max_eqs_sf = min_t(int, MLX5_COMP_EQS_PER_SF,
1204+
int max_eqs_sf = MLX5_CAP_GEN_2(dev, sf_eq_usage) ?
1205+
MLX5_CAP_GEN_2(dev, max_num_eqs_24b) :
1206+
MLX5_COMP_EQS_PER_SF;
1207+
1208+
max_eqs_sf = min_t(int, max_eqs_sf,
12061209
mlx5_irq_table_get_sfs_vec(eq_table->irq_table));
12071210
num_eqs = min_t(int, num_eqs, max_eqs_sf);
12081211
}

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#endif
1717

1818
#define MLX5_SFS_PER_CTRL_IRQ 64
19+
#define MLX5_MAX_MSIX_PER_SF 256
1920
#define MLX5_IRQ_CTRL_SF_MAX 8
2021
/* min num of vectors for SFs to be enabled */
2122
#define MLX5_IRQ_VEC_COMP_BASE_SF 2
@@ -589,8 +590,6 @@ static void irq_pool_free(struct mlx5_irq_pool *pool)
589590
static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
590591
{
591592
struct mlx5_irq_table *table = dev->priv.irq_table;
592-
int num_sf_ctrl_by_msix;
593-
int num_sf_ctrl_by_sfs;
594593
int num_sf_ctrl;
595594
int err;
596595

@@ -608,10 +607,8 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
608607
}
609608

610609
/* init sf_ctrl_pool */
611-
num_sf_ctrl_by_msix = DIV_ROUND_UP(sf_vec, MLX5_COMP_EQS_PER_SF);
612-
num_sf_ctrl_by_sfs = DIV_ROUND_UP(mlx5_sf_max_functions(dev),
613-
MLX5_SFS_PER_CTRL_IRQ);
614-
num_sf_ctrl = min_t(int, num_sf_ctrl_by_msix, num_sf_ctrl_by_sfs);
610+
num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev),
611+
MLX5_SFS_PER_CTRL_IRQ);
615612
num_sf_ctrl = min_t(int, MLX5_IRQ_CTRL_SF_MAX, num_sf_ctrl);
616613
table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl,
617614
"mlx5_sf_ctrl",
@@ -726,8 +723,7 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev)
726723

727724
total_vec = pcif_vec;
728725
if (mlx5_sf_max_functions(dev))
729-
total_vec += MLX5_IRQ_CTRL_SF_MAX +
730-
MLX5_COMP_EQS_PER_SF * mlx5_sf_max_functions(dev);
726+
total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev);
731727
total_vec = min_t(int, total_vec, pci_msix_vec_count(dev->pdev));
732728
pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));
733729

0 commit comments

Comments
 (0)