Skip to content

Commit 4dca650

Browse files
mikijoyLeon Romanovsky
authored andcommitted
net/mlx5: Enable QP number request when creating IPoIB underlay QP
If in the process of creating the underlay QP for an IPoIB interface the user has set the address and specifically the 1st-3rd bytes representing the QP number, use the requested QP number when creating the underlay QP. For a user to be able to request a QP number on QP creation, the MKEY_BY_NAME NVCONFIG should be set. As mkey_by_name and qp_by_name are coupled in FW. This requires driver to query the mkey_by_name max cap during initialization and set the current cap if it was enabled in FW. Signed-off-by: Michael Guralnik <[email protected]> Reviewed-by: Saeed Mahameed <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 2d1b69e commit 4dca650

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,20 @@ void mlx5i_uninit_underlay_qp(struct mlx5e_priv *priv)
226226

227227
int mlx5i_create_underlay_qp(struct mlx5e_priv *priv)
228228
{
229+
unsigned char *dev_addr = priv->netdev->dev_addr;
229230
u32 out[MLX5_ST_SZ_DW(create_qp_out)] = {};
230231
u32 in[MLX5_ST_SZ_DW(create_qp_in)] = {};
231232
struct mlx5i_priv *ipriv = priv->ppriv;
232233
void *addr_path;
234+
int qpn = 0;
233235
int ret = 0;
234236
void *qpc;
235237

238+
if (MLX5_CAP_GEN(priv->mdev, mkey_by_name)) {
239+
qpn = (dev_addr[1] << 16) + (dev_addr[2] << 8) + dev_addr[3];
240+
MLX5_SET(create_qp_in, in, input_qpn, qpn);
241+
}
242+
236243
qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
237244
MLX5_SET(qpc, qpc, st, MLX5_QP_ST_UD);
238245
MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
557557
if (MLX5_CAP_GEN_MAX(dev, release_all_pages))
558558
MLX5_SET(cmd_hca_cap, set_hca_cap, release_all_pages, 1);
559559

560+
if (MLX5_CAP_GEN_MAX(dev, mkey_by_name))
561+
MLX5_SET(cmd_hca_cap, set_hca_cap, mkey_by_name, 1);
562+
560563
return set_caps(dev, set_ctx, MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE);
561564
}
562565

include/linux/mlx5/mlx5_ifc.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,10 @@ struct mlx5_ifc_cmd_hca_cap_bits {
13921392
u8 bf[0x1];
13931393
u8 driver_version[0x1];
13941394
u8 pad_tx_eth_packet[0x1];
1395-
u8 reserved_at_263[0x8];
1395+
u8 reserved_at_263[0x3];
1396+
u8 mkey_by_name[0x1];
1397+
u8 reserved_at_267[0x4];
1398+
13961399
u8 log_bf_reg_size[0x5];
13971400

13981401
u8 reserved_at_270[0x8];
@@ -7712,8 +7715,10 @@ struct mlx5_ifc_create_qp_in_bits {
77127715
u8 reserved_at_20[0x10];
77137716
u8 op_mod[0x10];
77147717

7715-
u8 reserved_at_40[0x40];
7718+
u8 reserved_at_40[0x8];
7719+
u8 input_qpn[0x18];
77167720

7721+
u8 reserved_at_60[0x20];
77177722
u8 opt_param_mask[0x20];
77187723

77197724
u8 ece[0x20];

0 commit comments

Comments
 (0)