sfxge(4): add new loopback modes

Report supported loopback modes for new Medford2 link speeds.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18169
This commit is contained in:
arybchik 2018-11-27 13:00:28 +00:00
parent 0dbe2bd982
commit 7ec8e6393c
3 changed files with 46 additions and 4 deletions

View File

@ -837,6 +837,9 @@ typedef enum efx_loopback_type_e {
EFX_LOOPBACK_SD_FEP1_5_WS = 32,
EFX_LOOPBACK_SD_FEP_WS = 33,
EFX_LOOPBACK_SD_FES_WS = 34,
EFX_LOOPBACK_AOE_INT_NEAR = 35,
EFX_LOOPBACK_DATA_WS = 36,
EFX_LOOPBACK_FORCE_EXT_LINK = 37,
EFX_LOOPBACK_NTYPES
} efx_loopback_type_t;

View File

@ -725,6 +725,9 @@ efx_loopback_mask(
LOOPBACK_CHECK(SD_FEP1_5_WS, SD_FEP1_5_WS);
LOOPBACK_CHECK(SD_FEP_WS, SD_FEP_WS);
LOOPBACK_CHECK(SD_FES_WS, SD_FES_WS);
LOOPBACK_CHECK(AOE_INT_NEAR, AOE_INT_NEAR);
LOOPBACK_CHECK(DATA_WS, DATA_WS);
LOOPBACK_CHECK(FORCE_EXT_LINK, FORCE_EXT_LINK);
#undef LOOPBACK_CHECK
/* Build bitmask of possible loopback types */
@ -783,7 +786,7 @@ efx_mcdi_get_loopback_modes(
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_LOOPBACK_MODES_IN_LEN,
MC_CMD_GET_LOOPBACK_MODES_OUT_LEN)];
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_LEN)];
efx_qword_t mask;
efx_qword_t modes;
efx_rc_t rc;
@ -793,7 +796,7 @@ efx_mcdi_get_loopback_modes(
req.emr_in_buf = payload;
req.emr_in_length = MC_CMD_GET_LOOPBACK_MODES_IN_LEN;
req.emr_out_buf = payload;
req.emr_out_length = MC_CMD_GET_LOOPBACK_MODES_OUT_LEN;
req.emr_out_length = MC_CMD_GET_LOOPBACK_MODES_OUT_V2_LEN;
efx_mcdi_execute(enp, &req);
@ -834,18 +837,51 @@ efx_mcdi_get_loopback_modes(
MC_CMD_GET_LOOPBACK_MODES_OUT_40G_OFST +
MC_CMD_GET_LOOPBACK_MODES_OUT_40G_LEN) {
/* Response includes 40G loopback modes */
modes =
*MCDI_OUT2(req, efx_qword_t, GET_LOOPBACK_MODES_OUT_40G);
modes = *MCDI_OUT2(req, efx_qword_t,
GET_LOOPBACK_MODES_OUT_40G);
EFX_AND_QWORD(modes, mask);
encp->enc_loopback_types[EFX_LINK_40000FDX] = modes;
}
if (req.emr_out_length_used >=
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_25G_OFST +
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_25G_LEN) {
/* Response includes 25G loopback modes */
modes = *MCDI_OUT2(req, efx_qword_t,
GET_LOOPBACK_MODES_OUT_V2_25G);
EFX_AND_QWORD(modes, mask);
encp->enc_loopback_types[EFX_LINK_25000FDX] = modes;
}
if (req.emr_out_length_used >=
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_50G_OFST +
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_50G_LEN) {
/* Response includes 50G loopback modes */
modes = *MCDI_OUT2(req, efx_qword_t,
GET_LOOPBACK_MODES_OUT_V2_50G);
EFX_AND_QWORD(modes, mask);
encp->enc_loopback_types[EFX_LINK_50000FDX] = modes;
}
if (req.emr_out_length_used >=
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_100G_OFST +
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_100G_LEN) {
/* Response includes 100G loopback modes */
modes = *MCDI_OUT2(req, efx_qword_t,
GET_LOOPBACK_MODES_OUT_V2_100G);
EFX_AND_QWORD(modes, mask);
encp->enc_loopback_types[EFX_LINK_100000FDX] = modes;
}
EFX_ZERO_QWORD(modes);
EFX_SET_QWORD_BIT(modes, EFX_LOOPBACK_OFF);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_100FDX]);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_1000FDX]);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_10000FDX]);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_40000FDX]);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_25000FDX]);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_50000FDX]);
EFX_OR_QWORD(modes, encp->enc_loopback_types[EFX_LINK_100000FDX]);
encp->enc_loopback_types[EFX_LINK_UNKNOWN] = modes;
return (0);

View File

@ -209,6 +209,9 @@ static const char * const __efx_loopback_type_name[] = {
"SD_FEP1_5_WS",
"SD_FEP_WS",
"SD_FES_WS",
"AOE_INT_NEAR",
"DATA_WS",
"FORCE_EXT_LINK",
};
__checkReturn const char *