@@ -331,8 +331,8 @@ void mlx5_ib_put_native_port_mdev(struct mlx5_ib_dev *ibdev, u8 port_num)
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,6 +389,61 @@ static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed,
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
{
@@ -401,6 +456,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
401
456
u16 qkey_viol_cntr ;
402
457
u32 eth_prot_oper ;
403
458
u8 mdev_port_num ;
459
+ bool ext ;
404
460
int err ;
405
461
406
462
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,
421
477
mdev_port_num );
422
478
if (err )
423
479
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 );
426
482
427
483
props -> active_width = IB_WIDTH_4X ;
428
484
props -> active_speed = IB_SPEED_QDR ;
429
485
430
486
translate_eth_proto_oper (eth_prot_oper , & props -> active_speed ,
431
- & props -> active_width );
487
+ & props -> active_width , ext );
432
488
433
489
props -> port_cap_flags |= IB_PORT_CM_SUP ;
434
490
props -> ip_gids = true;
0 commit comments