sfxge: keep fw and driver view of autoneg parameters consistent

Previously the driver's view was the expected outcome of any
reconfiguration even if that reconfiguration failed.

Submitted by:   Ben Horgan
Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)
This commit is contained in:
Andrew Rybchenko 2015-02-21 06:27:16 +00:00
parent f95b698965
commit 4e41fb10cb

View File

@ -427,6 +427,7 @@ efx_phy_adv_cap_set(
{ {
efx_port_t *epp = &(enp->en_port); efx_port_t *epp = &(enp->en_port);
efx_phy_ops_t *epop = epp->ep_epop; efx_phy_ops_t *epop = epp->ep_epop;
uint32_t old_mask;
int rc; int rc;
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@ -440,6 +441,7 @@ efx_phy_adv_cap_set(
if (epp->ep_adv_cap_mask == mask) if (epp->ep_adv_cap_mask == mask)
goto done; goto done;
old_mask = epp->ep_adv_cap_mask;
epp->ep_adv_cap_mask = mask; epp->ep_adv_cap_mask = mask;
if ((rc = epop->epo_reconfigure(enp)) != 0) if ((rc = epop->epo_reconfigure(enp)) != 0)
@ -450,6 +452,17 @@ efx_phy_adv_cap_set(
fail2: fail2:
EFSYS_PROBE(fail2); EFSYS_PROBE(fail2);
epp->ep_adv_cap_mask = old_mask;
/* Reconfigure for robustness */
if (epop->epo_reconfigure(enp) != 0) {
/*
* We may have an inconsistent view of our advertised speed
* capabilities.
*/
EFSYS_ASSERT(0);
}
fail1: fail1:
EFSYS_PROBE1(fail1, int, rc); EFSYS_PROBE1(fail1, int, rc);