Skip to content

Commit 08e8676

Browse files
ayalevin123Saeed Mahameed
authored andcommitted
IB/mlx5: Add support for 50Gbps per lane link modes
Driver now supports new link modes: 50Gbps per lane support for 50G/100G/200G. This patch reads the correct field (legacy vs. extended) based on a FW indication bit, and adds a translation function (link modes to IB width and speed) to the new link modes. Signed-off-by: Aya Levin <ayal@mellanox.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent a08b4ed commit 08e8676

File tree

1 file changed

+61
-5
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+61
-5
lines changed

drivers/infiniband/hw/mlx5/main.c

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ void mlx5_ib_put_native_port_mdev(struct mlx5_ib_dev *ibdev, u8 port_num)
331331
spin_unlock(&port->mp.mpi_lock);
332332
}
333333

334-
static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
335-
u8 *active_width)
334+
static int translate_eth_legacy_proto_oper(u32 eth_proto_oper, u8 *active_speed,
335+
u8 *active_width)
336336
{
337337
switch (eth_proto_oper) {
338338
case MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII):
@@ -389,6 +389,61 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
389389
return 0;
390390
}
391391

392+
static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed,
393+
u8 *active_width)
394+
{
395+
switch (eth_proto_oper) {
396+
case MLX5E_PROT_MASK(MLX5E_SGMII_100M):
397+
case MLX5E_PROT_MASK(MLX5E_1000BASE_X_SGMII):
398+
*active_width = IB_WIDTH_1X;
399+
*active_speed = IB_SPEED_SDR;
400+
break;
401+
case MLX5E_PROT_MASK(MLX5E_5GBASE_R):
402+
*active_width = IB_WIDTH_1X;
403+
*active_speed = IB_SPEED_DDR;
404+
break;
405+
case MLX5E_PROT_MASK(MLX5E_10GBASE_XFI_XAUI_1):
406+
*active_width = IB_WIDTH_1X;
407+
*active_speed = IB_SPEED_QDR;
408+
break;
409+
case MLX5E_PROT_MASK(MLX5E_40GBASE_XLAUI_4_XLPPI_4):
410+
*active_width = IB_WIDTH_4X;
411+
*active_speed = IB_SPEED_QDR;
412+
break;
413+
case MLX5E_PROT_MASK(MLX5E_25GAUI_1_25GBASE_CR_KR):
414+
*active_width = IB_WIDTH_1X;
415+
*active_speed = IB_SPEED_EDR;
416+
break;
417+
case MLX5E_PROT_MASK(MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2):
418+
case MLX5E_PROT_MASK(MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR):
419+
*active_width = IB_WIDTH_1X;
420+
*active_speed = IB_SPEED_HDR;
421+
break;
422+
case MLX5E_PROT_MASK(MLX5E_100GAUI_2_100GBASE_CR2_KR2):
423+
*active_width = IB_WIDTH_2X;
424+
*active_speed = IB_SPEED_HDR;
425+
break;
426+
case MLX5E_PROT_MASK(MLX5E_200GAUI_4_200GBASE_CR4_KR4):
427+
*active_width = IB_WIDTH_4X;
428+
*active_speed = IB_SPEED_HDR;
429+
break;
430+
default:
431+
return -EINVAL;
432+
}
433+
434+
return 0;
435+
}
436+
437+
static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
438+
u8 *active_width, bool ext)
439+
{
440+
return ext ?
441+
translate_eth_ext_proto_oper(eth_proto_oper, active_speed,
442+
active_width) :
443+
translate_eth_legacy_proto_oper(eth_proto_oper, active_speed,
444+
active_width);
445+
}
446+
392447
static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
393448
struct ib_port_attr *props)
394449
{
@@ -401,6 +456,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
401456
u16 qkey_viol_cntr;
402457
u32 eth_prot_oper;
403458
u8 mdev_port_num;
459+
bool ext;
404460
int err;
405461

406462
mdev = mlx5_ib_get_native_port_mdev(dev, port_num, &mdev_port_num);
@@ -421,14 +477,14 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
421477
mdev_port_num);
422478
if (err)
423479
goto out;
424-
eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, false,
425-
eth_proto_oper);
480+
ext = MLX5_CAP_PCAM_FEATURE(dev->mdev, ptys_extended_ethernet);
481+
eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper);
426482

427483
props->active_width = IB_WIDTH_4X;
428484
props->active_speed = IB_SPEED_QDR;
429485

430486
translate_eth_proto_oper(eth_prot_oper, &props->active_speed,
431-
&props->active_width);
487+
&props->active_width, ext);
432488

433489
props->port_cap_flags |= IB_PORT_CM_SUP;
434490
props->ip_gids = true;

0 commit comments

Comments
 (0)