Skip to content

Commit

Permalink
xxxxx Add extended-ptys bits to mlxcx(4D) to support ConnectX-6
Browse files Browse the repository at this point in the history
  • Loading branch information
danmcd committed Jul 11, 2023
1 parent cab5c9e commit 0a7e8fd
Show file tree
Hide file tree
Showing 5 changed files with 320 additions and 47 deletions.
22 changes: 17 additions & 5 deletions usr/src/uts/common/io/mlxcx/mlxcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@
* Copyright 2021, The University of Queensland
* Copyright (c) 2018, Joyent, Inc.
* Copyright 2020 RackTop Systems, Inc.
* Copyright 2023 MNX Cloud, Inc.
*/

/*
* Mellanox Connect-X 4/5/6 driver.
*/

/*
* The PRM for this family of parts is freely available, and can be found at:
* https://www.mellanox.com/related-docs/user_manuals/ \
* Ethernet_Adapters_Programming_Manual.pdf
* The PRM for this family of parts was freely available at:
*
* BEGIN CSTYLED
* https://www.mellanox.com/related-docs/user_manuals/Ethernet_Adapters_Programming_Manual.pdf
* END CSTYLED
*
* But has since disappeared. The FreeBSD driver has some visibility into how
* things still work, but there have been changes in the 6-series that we are
* only beginning to adopt here.
*/
/*
* ConnectX glossary
Expand Down Expand Up @@ -481,12 +488,17 @@ mlxcx_load_prop_defaults(mlxcx_t *mlxp)
* maximum speed of 10Gb/s, and another for those above that.
*/
if ((port->mlp_max_proto & (MLXCX_PROTO_25G | MLXCX_PROTO_40G |
MLXCX_PROTO_50G | MLXCX_PROTO_100G)) != 0) {
MLXCX_PROTO_50G | MLXCX_PROTO_100G)) != 0 ||
(port->mlp_ext_max_proto & (MLXCX_EXTPROTO_25G |
MLXCX_EXTPROTO_40G | MLXCX_EXTPROTO_50G |
MLXCX_EXTPROTO_100G)) != 0) {
p->mldp_cq_size_shift_default = MLXCX_CQ_SIZE_SHIFT_25G;
p->mldp_rq_size_shift_default = MLXCX_RQ_SIZE_SHIFT_25G;
p->mldp_sq_size_shift_default = MLXCX_SQ_SIZE_SHIFT_25G;
} else if ((port->mlp_max_proto & (MLXCX_PROTO_100M | MLXCX_PROTO_1G |
MLXCX_PROTO_10G)) != 0) {
MLXCX_PROTO_10G)) != 0 ||
(port->mlp_ext_max_proto & (MLXCX_EXTPROTO_100M |
MLXCX_EXTPROTO_5G | MLXCX_EXTPROTO_1G | MLXCX_EXTPROTO_10G)) != 0) {
p->mldp_cq_size_shift_default = MLXCX_CQ_SIZE_SHIFT_DFLT;
p->mldp_rq_size_shift_default = MLXCX_RQ_SIZE_SHIFT_DFLT;
p->mldp_sq_size_shift_default = MLXCX_SQ_SIZE_SHIFT_DFLT;
Expand Down
7 changes: 6 additions & 1 deletion usr/src/uts/common/io/mlxcx/mlxcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright 2021, The University of Queensland
* Copyright (c) 2018, Joyent, Inc.
* Copyright 2020 RackTop Systems, Inc.
* Copyright 2023 MNX Cloud, Inc.
*/

/*
Expand Down Expand Up @@ -389,6 +390,9 @@ struct mlxcx_port {
mlxcx_eth_proto_t mlp_max_proto;
mlxcx_eth_proto_t mlp_admin_proto;
mlxcx_eth_proto_t mlp_oper_proto;
mlxcx_ext_eth_proto_t mlp_ext_max_proto;
mlxcx_ext_eth_proto_t mlp_ext_admin_proto;
mlxcx_ext_eth_proto_t mlp_ext_oper_proto;
mlxcx_pplm_fec_active_t mlp_fec_active;
link_fec_t mlp_fec_requested;

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

extern void mlxcx_update_link_state(mlxcx_t *, mlxcx_port_t *);

extern void mlxcx_eth_proto_to_string(mlxcx_eth_proto_t, char *, size_t);
extern void mlxcx_eth_proto_to_string(mlxcx_eth_proto_t, mlxcx_ext_eth_proto_t,
char *, size_t);
extern const char *mlxcx_port_status_string(mlxcx_port_status_t);

extern const char *mlxcx_event_name(mlxcx_event_t);
Expand Down
56 changes: 55 additions & 1 deletion usr/src/uts/common/io/mlxcx/mlxcx_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright 2020, The University of Queensland
* Copyright (c) 2018, Joyent, Inc.
* Copyright 2020 RackTop Systems, Inc.
* Copyright 2023 MNX Cloud, Inc.
*/

/*
Expand Down Expand Up @@ -416,7 +417,8 @@ mlxcx_port_status_string(mlxcx_port_status_t st)
}

void
mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, char *buf, size_t size)
mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, mlxcx_ext_eth_proto_t ep,
char *buf, size_t size)
{
if (p & MLXCX_PROTO_SGMII)
(void) strlcat(buf, "SGMII|", size);
Expand Down Expand Up @@ -446,12 +448,22 @@ mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, char *buf, size_t size)
(void) strlcat(buf, "40GBASE_LR4_ER4|", size);
if (p & MLXCX_PROTO_50GBASE_SR2)
(void) strlcat(buf, "50GBASE_SR2|", size);
if (p & MLXCX_PROTO_50GBASE_KR4)
(void) strlcat(buf, "50GBASE_KR4|", size);
if (p & MLXCX_PROTO_100GBASE_CR4)
(void) strlcat(buf, "100GBASE_CR4|", size);
if (p & MLXCX_PROTO_100GBASE_SR4)
(void) strlcat(buf, "100GBASE_SR4|", size);
if (p & MLXCX_PROTO_100GBASE_KR4)
(void) strlcat(buf, "100GBASE_KR4|", size);
if (p & MLXCX_PROTO_100GBASE_LR4)
(void) strlcat(buf, "100GBASE_LR4|", size);
if (p & MLXCX_PROTO_100BASE_T)
(void) strlcat(buf, "100BASE_T|", size);
if (p & MLXCX_PROTO_1000BASE_T)
(void) strlcat(buf, "1000BASE_T|", size);
if (p & MLXCX_PROTO_10GBASE_T)
(void) strlcat(buf, "10GBASE_T|", size);
if (p & MLXCX_PROTO_25GBASE_CR)
(void) strlcat(buf, "25GBASE_CR|", size);
if (p & MLXCX_PROTO_25GBASE_KR)
Expand All @@ -460,6 +472,40 @@ mlxcx_eth_proto_to_string(mlxcx_eth_proto_t p, char *buf, size_t size)
(void) strlcat(buf, "25GBASE_SR|", size);
if (p & MLXCX_PROTO_50GBASE_CR2)
(void) strlcat(buf, "50GBASE_CR2|", size);

/* Now, for the extended bits... */
if (ep & MLXCX_EXTPROTO_SGMII_100M)
(void) strlcat(buf, "SGMII_100M|", size);
if (ep & MLXCX_EXTPROTO_1000BASE_X_SGMII)
(void) strlcat(buf, "1000BASE_X_SGMII|", size);
if (ep & MLXCX_EXTPROTO_5GBASE_R)
(void) strlcat(buf, "5GBASE_R|", size);
if (ep & MLXCX_EXTPROTO_10GBASE_XFI_XAUI_1)
(void) strlcat(buf, "10GBASE_XFI_XAUI_1|", size);
if (ep & MLXCX_EXTPROTO_40GBASE_XLAUI_4_XLPPI_4)
(void) strlcat(buf, "40GBASE_XLAUI_4_XLPPI_4|", size);
if (ep & MLXCX_EXTPROTO_25GAUI_1_25GBASE_CR_KR)
(void) strlcat(buf, "25GAUI_1_25GBASE_CR_KR|", size);
if (ep & MLXCX_EXTPROTO_50GAUI_2_LAUI_2_50GBASE_CR2_KR2)
(void) strlcat(buf, "50GAUI_2_LAUI_2_50GBASE_CR2_KR2|", size);
if (ep & MLXCX_EXTPROTO_50GAUI_1_LAUI_1_50GBASE_CR_KR)
(void) strlcat(buf, "50GAUI_1_LAUI_1_50GBASE_CR_KR|", size);
if (ep & MLXCX_EXTPROTO_CAUI_4_100GBASE_CR4_KR4)
(void) strlcat(buf, "CAUI_4_100GBASE_CR4_KR4|", size);
if (ep & MLXCX_EXTPROTO_100GAUI_2_100GBASE_CR2_KR2)
(void) strlcat(buf, "100GAUI_2_100GBASE_CR2_KR2|", size);
if (ep & MLXCX_EXTPROTO_100GAUI_1_100GBASE_CR_KR)
(void) strlcat(buf, "100GAUI_1_100GBASE_CR_KR|", size);
/* Print these if we need 'em for debugging... */
if (ep & MLXCX_EXTPROTO_200GAUI_4_200GBASE_CR4_KR4)
(void) strlcat(buf, "200GAUI_4_200GBASE_CR4_KR4|", size);
if (ep & MLXCX_EXTPROTO_200GAUI_2_200GBASE_CR2_KR2)
(void) strlcat(buf, "200GAUI_2_200GBASE_CR2_KR2|", size);
if (ep & MLXCX_EXTPROTO_400GAUI_8)
(void) strlcat(buf, "400GAUI_8|", size);
if (ep & MLXCX_EXTPROTO_400GAUI_4_400GBASE_CR4_KR4)
(void) strlcat(buf, "400GAUI_4_400GBASE_CR4_KR4|", size);

/* Chop off the trailing '|' */
if (strlen(buf) > 0)
buf[strlen(buf) - 1] = '\0';
Expand Down Expand Up @@ -1929,6 +1975,12 @@ mlxcx_cmd_query_port_speed(mlxcx_t *mlxp, mlxcx_port_t *mlp)
from_bits32(data.mlrd_ptys.mlrd_ptys_proto_admin);
mlp->mlp_oper_proto =
from_bits32(data.mlrd_ptys.mlrd_ptys_proto_oper);
mlp->mlp_ext_max_proto =
from_bits32(data.mlrd_ptys.mlrd_ptys_ext_proto_cap);
mlp->mlp_ext_admin_proto =
from_bits32(data.mlrd_ptys.mlrd_ptys_ext_proto_admin);
mlp->mlp_ext_oper_proto =
from_bits32(data.mlrd_ptys.mlrd_ptys_ext_proto_oper);
}

return (ret);
Expand Down Expand Up @@ -3717,7 +3769,9 @@ CTASSERT(offsetof(mlxcx_cmd_create_rqt_in_t, mlxi_create_rqt_context) == 0x20);
CTASSERT(offsetof(mlxcx_reg_pmtu_t, mlrd_pmtu_oper_mtu) == 0x0C);

CTASSERT(sizeof (mlxcx_reg_ptys_t) == 64);
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_ext_proto_cap) == 0x08);
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_proto_cap) == 0x0c);
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_ext_proto_admin) == 0x14);
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_proto_admin) == 0x18);
CTASSERT(offsetof(mlxcx_reg_ptys_t, mlrd_ptys_proto_partner_advert) == 0x30);

Expand Down
Loading

0 comments on commit 0a7e8fd

Please sign in to comment.