Skip to content

Commit 76e39cc

Browse files
Eli Cohendavem330
authored andcommitted
net/mlx4_core: Fix backward compatibility on VFs
Commit 85743f1 ("net/mlx4_core: Set UAR page size to 4KB regardless of system page size") introduced dependency where old VF drivers without this fix fail to load if the PF driver runs with this commit. To resolve this add a module parameter which disables that functionality by default. If both the PF and VFs are running with a driver with that commit the administrator may set the module param to true. The module parameter is called enable_4k_uar. Fixes: 85743f1 ('net/mlx4_core: Set UAR page size to 4KB ...') Signed-off-by: Eli Cohen <eli@mellanox.com> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e2ad1f9 commit 76e39cc

File tree

1 file changed

+18
-6
lines changed
  • drivers/net/ethernet/mellanox/mlx4

1 file changed

+18
-6
lines changed

drivers/net/ethernet/mellanox/mlx4/main.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ module_param(enable_64b_cqe_eqe, bool, 0444);
105105
MODULE_PARM_DESC(enable_64b_cqe_eqe,
106106
"Enable 64 byte CQEs/EQEs when the FW supports this (default: True)");
107107

108+
static bool enable_4k_uar;
109+
module_param(enable_4k_uar, bool, 0444);
110+
MODULE_PARM_DESC(enable_4k_uar,
111+
"Enable using 4K UAR. Should not be enabled if have VFs which do not support 4K UARs (default: false)");
112+
108113
#define PF_CONTEXT_BEHAVIOUR_MASK (MLX4_FUNC_CAP_64B_EQE_CQE | \
109114
MLX4_FUNC_CAP_EQE_CQE_STRIDE | \
110115
MLX4_FUNC_CAP_DMFS_A0_STATIC)
@@ -423,7 +428,11 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
423428
/* Virtual PCI function needs to determine UAR page size from
424429
* firmware. Only master PCI function can set the uar page size
425430
*/
426-
dev->uar_page_shift = DEFAULT_UAR_PAGE_SHIFT;
431+
if (enable_4k_uar)
432+
dev->uar_page_shift = DEFAULT_UAR_PAGE_SHIFT;
433+
else
434+
dev->uar_page_shift = PAGE_SHIFT;
435+
427436
mlx4_set_num_reserved_uars(dev, dev_cap);
428437
}
429438

@@ -2233,11 +2242,14 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
22332242

22342243
dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1;
22352244

2236-
/* Always set UAR page size 4KB, set log_uar_sz accordingly */
2237-
init_hca.log_uar_sz = ilog2(dev->caps.num_uars) +
2238-
PAGE_SHIFT -
2239-
DEFAULT_UAR_PAGE_SHIFT;
2240-
init_hca.uar_page_sz = DEFAULT_UAR_PAGE_SHIFT - 12;
2245+
if (enable_4k_uar) {
2246+
init_hca.log_uar_sz = ilog2(dev->caps.num_uars) +
2247+
PAGE_SHIFT - DEFAULT_UAR_PAGE_SHIFT;
2248+
init_hca.uar_page_sz = DEFAULT_UAR_PAGE_SHIFT - 12;
2249+
} else {
2250+
init_hca.log_uar_sz = ilog2(dev->caps.num_uars);
2251+
init_hca.uar_page_sz = PAGE_SHIFT - 12;
2252+
}
22412253

22422254
init_hca.mw_enabled = 0;
22432255
if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||

0 commit comments

Comments
 (0)