Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Aya Levin and committed by
Saeed Mahameed
08e8676f a08b4ed1

+61 -5
+61 -5
drivers/infiniband/hw/mlx5/main.c
··· 331 331 spin_unlock(&port->mp.mpi_lock); 332 332 } 333 333 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) 336 336 { 337 337 switch (eth_proto_oper) { 338 338 case MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII): ··· 389 389 return 0; 390 390 } 391 391 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 + 392 447 static int mlx5_query_port_roce(struct ib_device *device, u8 port_num, 393 448 struct ib_port_attr *props) 394 449 { ··· 456 401 u16 qkey_viol_cntr; 457 402 u32 eth_prot_oper; 458 403 u8 mdev_port_num; 404 + bool ext; 459 405 int err; 460 406 461 407 mdev = mlx5_ib_get_native_port_mdev(dev, port_num, &mdev_port_num); ··· 477 421 mdev_port_num); 478 422 if (err) 479 423 goto out; 480 - eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, false, 481 - eth_proto_oper); 424 + ext = MLX5_CAP_PCAM_FEATURE(dev->mdev, ptys_extended_ethernet); 425 + eth_prot_oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper); 482 426 483 427 props->active_width = IB_WIDTH_4X; 484 428 props->active_speed = IB_SPEED_QDR; 485 429 486 430 translate_eth_proto_oper(eth_prot_oper, &props->active_speed, 487 - &props->active_width); 431 + &props->active_width, ext); 488 432 489 433 props->port_cap_flags |= IB_PORT_CM_SUP; 490 434 props->ip_gids = true;