sfxge(4): add accessor for default port mode

Extend efx_mcdi_get_port_modes() to optionally pass on the default
port mode field. This provides a more direct way of handling the case
where the dynamic config does not specify the port mode than the
alternative of a lookup table indexed by MCFW subtype.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18255
This commit is contained in:
Andrew Rybchenko 2018-11-30 07:04:48 +00:00
parent d86bef48a5
commit cd5e337110
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341293
5 changed files with 16 additions and 7 deletions

View File

@ -1154,7 +1154,8 @@ extern __checkReturn efx_rc_t
efx_mcdi_get_port_modes(
__in efx_nic_t *enp,
__out uint32_t *modesp,
__out_opt uint32_t *current_modep);
__out_opt uint32_t *current_modep,
__out_opt uint32_t *default_modep);
extern __checkReturn efx_rc_t
ef10_nic_get_port_mode_bandwidth(

View File

@ -90,7 +90,8 @@ efx_mcdi_get_port_assignment(
efx_mcdi_get_port_modes(
__in efx_nic_t *enp,
__out uint32_t *modesp,
__out_opt uint32_t *current_modep)
__out_opt uint32_t *current_modep,
__out_opt uint32_t *default_modep)
{
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_PORT_MODES_IN_LEN,
@ -137,6 +138,11 @@ efx_mcdi_get_port_modes(
GET_PORT_MODES_OUT_CURRENT_MODE);
}
if (default_modep != NULL) {
*default_modep = MCDI_OUT_DWORD(req,
GET_PORT_MODES_OUT_DEFAULT_MODE);
}
return (0);
fail3:
@ -1662,13 +1668,14 @@ ef10_external_port_mapping(
int32_t count = 1; /* Default 1-1 mapping */
int32_t offset = 1; /* Default starting external port number */
if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, &current)) != 0) {
if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, &current,
NULL)) != 0) {
/*
* No current port mode information (i.e. Huntington)
* - infer mapping from available modes
*/
if ((rc = efx_mcdi_get_port_modes(enp,
&port_modes, NULL)) != 0) {
&port_modes, NULL, NULL)) != 0) {
/*
* No port mode information available
* - use default mapping

View File

@ -57,7 +57,8 @@ hunt_nic_get_required_pcie_bandwidth(
* capable mode is in use.
*/
if ((rc = efx_mcdi_get_port_modes(enp, &port_modes, NULL)) != 0) {
if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
NULL, NULL)) != 0) {
/* No port mode info available */
bandwidth = 0;
goto out;

View File

@ -52,7 +52,7 @@ medford2_nic_get_required_pcie_bandwidth(
/* FIXME: support new Medford2 dynamic port modes */
if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
&current_mode)) != 0) {
&current_mode, NULL)) != 0) {
/* No port mode info available. */
bandwidth = 0;
goto out;

View File

@ -48,7 +48,7 @@ medford_nic_get_required_pcie_bandwidth(
efx_rc_t rc;
if ((rc = efx_mcdi_get_port_modes(enp, &port_modes,
&current_mode)) != 0) {
&current_mode, NULL)) != 0) {
/* No port mode info available. */
bandwidth = 0;
goto out;