Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2015 06:27:17 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279096 - head/sys/dev/sfxge/common
Message-ID:  <201502210627.t1L6RHjq053059@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Sat Feb 21 06:27:16 2015
New Revision: 279096
URL: https://svnweb.freebsd.org/changeset/base/279096

Log:
  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)

Modified:
  head/sys/dev/sfxge/common/efx_phy.c

Modified: head/sys/dev/sfxge/common/efx_phy.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_phy.c	Sat Feb 21 06:26:10 2015	(r279095)
+++ head/sys/dev/sfxge/common/efx_phy.c	Sat Feb 21 06:27:16 2015	(r279096)
@@ -427,6 +427,7 @@ efx_phy_adv_cap_set(
 {
 	efx_port_t *epp = &(enp->en_port);
 	efx_phy_ops_t *epop = epp->ep_epop;
+	uint32_t old_mask;
 	int rc;
 
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -440,6 +441,7 @@ efx_phy_adv_cap_set(
 	if (epp->ep_adv_cap_mask == mask)
 		goto done;
 
+	old_mask = epp->ep_adv_cap_mask;
 	epp->ep_adv_cap_mask = mask;
 
 	if ((rc = epop->epo_reconfigure(enp)) != 0)
@@ -450,6 +452,17 @@ done:
 
 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:
 	EFSYS_PROBE1(fail1, int, rc);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502210627.t1L6RHjq053059>