Skip to content

Commit 0cab04f

Browse files
committed
xxxxx Add extended-ptys bits to mlxcx(4D) to support ConnectX-6
1 parent fab2b22 commit 0cab04f

5 files changed

Lines changed: 319 additions & 47 deletions

File tree

usr/src/uts/common/io/mlxcx/mlxcx.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,23 @@
1313
* Copyright 2021, The University of Queensland
1414
* Copyright (c) 2018, Joyent, Inc.
1515
* Copyright 2020 RackTop Systems, Inc.
16+
* Copyright 2023 MNX Cloud, Inc.
1617
*/
1718

1819
/*
1920
* Mellanox Connect-X 4/5/6 driver.
2021
*/
2122

2223
/*
23-
* The PRM for this family of parts is freely available, and can be found at:
24-
* https://www.mellanox.com/related-docs/user_manuals/ \
25-
* Ethernet_Adapters_Programming_Manual.pdf
24+
* The PRM for this family of parts was freely available at:
25+
*
26+
* BEGIN CSTYLED
27+
* https://www.mellanox.com/related-docs/user_manuals/Ethernet_Adapters_Programming_Manual.pdf
28+
* END CSTYLED
29+
*
30+
* But has since disappeared. The FreeBSD driver has some visibility into how
31+
* things still work, but there have been changes in the 6-series that we are
32+
* only beginning to adopt here.
2633
*/
2734
/*
2835
* ConnectX glossary
@@ -481,12 +488,17 @@ mlxcx_load_prop_defaults(mlxcx_t *mlxp)
481488
* maximum speed of 10Gb/s, and another for those above that.
482489
*/
483490
if ((port->mlp_max_proto & (MLXCX_PROTO_25G | MLXCX_PROTO_40G |
484-
MLXCX_PROTO_50G | MLXCX_PROTO_100G)) != 0) {
491+
MLXCX_PROTO_50G | MLXCX_PROTO_100G)) != 0 ||
492+
(port->mlp_ext_max_proto & (MLXCX_EXTPROTO_25G |
493+
MLXCX_EXTPROTO_40G | MLXCX_EXTPROTO_50G |
494+
MLXCX_EXTPROTO_100G)) != 0) {
485495
p->mldp_cq_size_shift_default = MLXCX_CQ_SIZE_SHIFT_25G;
486496
p->mldp_rq_size_shift_default = MLXCX_RQ_SIZE_SHIFT_25G;
487497
p->mldp_sq_size_shift_default = MLXCX_SQ_SIZE_SHIFT_25G;
488498
} else if ((port->mlp_max_proto & (MLXCX_PROTO_100M | MLXCX_PROTO_1G |
489-
MLXCX_PROTO_10G)) != 0) {
499+
MLXCX_PROTO_10G)) != 0 ||
500+
(port->mlp_ext_max_proto & (MLXCX_EXTPROTO_100M |
501+
MLXCX_EXTPROTO_5G | MLXCX_EXTPROTO_1G | MLXCX_EXTPROTO_10G)) != 0) {
490502
p->mldp_cq_size_shift_default = MLXCX_CQ_SIZE_SHIFT_DFLT;
491503
p->mldp_rq_size_shift_default = MLXCX_RQ_SIZE_SHIFT_DFLT;
492504
p->mldp_sq_size_shift_default = MLXCX_SQ_SIZE_SHIFT_DFLT;

usr/src/uts/common/io/mlxcx/mlxcx.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Copyright 2021, The University of Queensland
1414
* Copyright (c) 2018, Joyent, Inc.
1515
* Copyright 2020 RackTop Systems, Inc.
16+
* Copyright 2023 MNX Cloud, Inc.
1617
*/
1718

1819
/*
@@ -389,6 +390,9 @@ struct mlxcx_port {
389390
mlxcx_eth_proto_t mlp_max_proto;
390391
mlxcx_eth_proto_t mlp_admin_proto;
391392
mlxcx_eth_proto_t mlp_oper_proto;
393+
mlxcx_ext_eth_proto_t mlp_ext_max_proto;
394+
mlxcx_ext_eth_proto_t mlp_ext_admin_proto;
395+
mlxcx_ext_eth_proto_t mlp_ext_oper_proto;
392396
mlxcx_pplm_fec_active_t mlp_fec_active;
393397
link_fec_t mlp_fec_requested;
394398

@@ -1459,7 +1463,8 @@ extern int mlxcx_page_compare(const void *, const void *);
14591463

14601464
extern void mlxcx_update_link_state(mlxcx_t *, mlxcx_port_t *);
14611465

1462-
extern void mlxcx_eth_proto_to_string(mlxcx_eth_proto_t, char *, size_t);
1466+
extern void mlxcx_eth_proto_to_string(mlxcx_eth_proto_t, mlxcx_ext_eth_proto_t,
1467+
char *, size_t);
14631468
extern const char *mlxcx_port_status_string(mlxcx_port_status_t);
14641469

14651470
extern const char *mlxcx_event_name(mlxcx_event_t);

usr/src/uts/common/io/mlxcx/mlxcx_cmd.c

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Copyright 2020, The University of Queensland
1414
* Copyright (c) 2018, Joyent, Inc.
1515
* Copyright 2020 RackTop Systems, Inc.
16+
* Copyright 2023 MNX Cloud, Inc.
1617
*/
1718

1819
/*
@@ -416,7 +417,8 @@ mlxcx_port_status_string(mlxcx_port_status_t st)
416417
}
417418

418419
void
419-
mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, char *buf, size_t size)
420+
mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, mlxcx_ext_eth_proto_t ep,
421+
char *buf, size_t size)
420422
{
421423
if (p & MLXCX_PROTO_SGMII)
422424
(void) strlcat(buf, "SGMII|", size);
@@ -446,12 +448,22 @@ mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, char *buf, size_t size)
446448
(void) strlcat(buf, "40GBASE_LR4_ER4|", size);
447449
if (p & MLXCX_PROTO_50GBASE_SR2)
448450
(void) strlcat(buf, "50GBASE_SR2|", size);
451+
if (p & MLXCX_PROTO_50GBASE_KR4)
452+
(void) strlcat(buf, "50GBASE_KR4|", size);
449453
if (p & MLXCX_PROTO_100GBASE_CR4)
450454
(void) strlcat(buf, "100GBASE_CR4|", size);
451455
if (p & MLXCX_PROTO_100GBASE_SR4)
452456
(void) strlcat(buf, "100GBASE_SR4|", size);
453457
if (p & MLXCX_PROTO_100GBASE_KR4)
454458
(void) strlcat(buf, "100GBASE_KR4|", size);
459+
if (p & MLXCX_PROTO_100GBASE_LR4)
460+
(void) strlcat(buf, "100GBASE_LR4|", size);
461+
if (p & MLXCX_PROTO_100BASE_T)
462+
(void) strlcat(buf, "100BASE_T|", size);
463+
if (p & MLXCX_PROTO_1000BASE_T)
464+
(void) strlcat(buf, "1000BASE_T|", size);
465+
if (p & MLXCX_PROTO_10GBASE_T)
466+
(void) strlcat(buf, "10GBASE_T|", size);
455467
if (p & MLXCX_PROTO_25GBASE_CR)
456468
(void) strlcat(buf, "25GBASE_CR|", size);
457469
if (p & MLXCX_PROTO_25GBASE_KR)
@@ -460,6 +472,40 @@ mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, char *buf, size_t size)
460472
(void) strlcat(buf, "25GBASE_SR|", size);
461473
if (p & MLXCX_PROTO_50GBASE_CR2)
462474
(void) strlcat(buf, "50GBASE_CR2|", size);
475+
476+
/* Now, for the extended bits... */
477+
if (ep & MLXCX_EXTPROTO_SGMII_100M)
478+
(void) strlcat(buf, "SGMII_100M|", size);
479+
if (ep & MLXCX_EXTPROTO_1000BASE_X_SGMII)
480+
(void) strlcat(buf, "1000BASE_X_SGMII|", size);
481+
if (ep & MLXCX_EXTPROTO_5GBASE_R)
482+
(void) strlcat(buf, "5GBASE_R|", size);
483+
if (ep & MLXCX_EXTPROTO_10GBASE_XFI_XAUI_1)
484+
(void) strlcat(buf, "10GBASE_XFI_XAUI_1|", size);
485+
if (ep & MLXCX_EXTPROTO_40GBASE_XLAUI_4_XLPPI_4)
486+
(void) strlcat(buf, "40GBASE_XLAUI_4_XLPPI_4|", size);
487+
if (ep & MLXCX_EXTPROTO_25GAUI_1_25GBASE_CR_KR)
488+
(void) strlcat(buf, "25GAUI_1_25GBASE_CR_KR|", size);
489+
if (ep & MLXCX_EXTPROTO_50GAUI_2_LAUI_2_50GBASE_CR2_KR2)
490+
(void) strlcat(buf, "50GAUI_2_LAUI_2_50GBASE_CR2_KR2|", size);
491+
if (ep & MLXCX_EXTPROTO_50GAUI_1_LAUI_1_50GBASE_CR_KR)
492+
(void) strlcat(buf, "50GAUI_1_LAUI_1_50GBASE_CR_KR|", size);
493+
if (ep & MLXCX_EXTPROTO_CAUI_4_100GBASE_CR4_KR4)
494+
(void) strlcat(buf, "CAUI_4_100GBASE_CR4_KR4|", size);
495+
if (ep & MLXCX_EXTPROTO_100GAUI_2_100GBASE_CR2_KR2)
496+
(void) strlcat(buf, "100GAUI_2_100GBASE_CR2_KR2|", size);
497+
if (ep & MLXCX_EXTPROTO_100GAUI_1_100GBASE_CR_KR)
498+
(void) strlcat(buf, "100GAUI_1_100GBASE_CR_KR|", size);
499+
/* Print these if we need 'em for debugging... */
500+
if (ep & MLXCX_EXTPROTO_200GAUI_4_200GBASE_CR4_KR4)
501+
(void) strlcat(buf, "200GAUI_4_200GBASE_CR4_KR4|", size);
502+
if (ep & MLXCX_EXTPROTO_200GAUI_2_200GBASE_CR2_KR2)
503+
(void) strlcat(buf, "200GAUI_2_200GBASE_CR2_KR2|", size);
504+
if (ep & MLXCX_EXTPROTO_400GAUI_8)
505+
(void) strlcat(buf, "400GAUI_8|", size);
506+
if (ep & MLXCX_EXTPROTO_400GAUI_4_400GBASE_CR4_KR4)
507+
(void) strlcat(buf, "400GAUI_4_400GBASE_CR4_KR4|", size);
508+
463509
/* Chop off the trailing '|' */
464510
if (strlen(buf) > 0)
465511
buf[strlen(buf) - 1] = '\0';
@@ -1929,6 +1975,12 @@ mlxcx_cmd_query_port_speed(mlxcx_t *mlxp, mlxcx_port_t *mlp)
19291975
from_bits32(data.mlrd_ptys.mlrd_ptys_proto_admin);
19301976
mlp->mlp_oper_proto =
19311977
from_bits32(data.mlrd_ptys.mlrd_ptys_proto_oper);
1978+
mlp->mlp_ext_max_proto =
1979+
from_bits32(data.mlrd_ptys.mlrd_ptys_ext_proto_cap);
1980+
mlp->mlp_ext_admin_proto =
1981+
from_bits32(data.mlrd_ptys.mlrd_ptys_ext_proto_admin);
1982+
mlp->mlp_ext_oper_proto =
1983+
from_bits32(data.mlrd_ptys.mlrd_ptys_ext_proto_oper);
19321984
}
19331985

19341986
return (ret);
@@ -3717,7 +3769,9 @@ CTASSERT(offsetof(mlxcx_cmd_create_rqt_in_t, mlxi_create_rqt_context) == 0x20);
37173769
CTASSERT(offsetof(mlxcx_reg_pmtu_t, mlrd_pmtu_oper_mtu) == 0x0C);
37183770

37193771
CTASSERT(sizeof (mlxcx_reg_ptys_t) == 64);
3772+
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_ext_proto_cap) == 0x08);
37203773
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_proto_cap) == 0x0c);
3774+
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_ext_proto_admin) == 0x14);
37213775
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_proto_admin) == 0x18);
37223776
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_proto_partner_advert) == 0x30);
37233777

0 commit comments

Comments
 (0)