[PATCH 08/20] sfc: Fix post-reset MAC selection

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ben Hutchings
Date: Thursday, January 29, 2009 - 12:19 pm

From: Steve Hodgson <shodgson@solarflare.com>

Modify falcon_switch_mac() to always set NIC_STAT_REG, even if the the
MAC is the same as it was before.  This ensures that the value is
correct after an online reset.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/falcon.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index ae7b0b4..d9412f8 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -2283,16 +2283,12 @@ int falcon_switch_mac(struct efx_nic *efx)
 		efx->link_fd = true;
 	}
 
+	WARN_ON(!mutex_is_locked(&efx->mac_lock));
 	efx->mac_op = (EFX_IS10G(efx) ?
 		       &falcon_xmac_operations : &falcon_gmac_operations);
-	if (old_mac_op == efx->mac_op)
-		return 0;
-
-	WARN_ON(!mutex_is_locked(&efx->mac_lock));
-
-	/* Not all macs support a mac-level link state */
-	efx->mac_up = true;
 
+	/* Always push the NIC_STAT_REG setting even if the mac hasn't
+	 * changed, because this function is run post online reset */
 	falcon_read(efx, &nic_stat, NIC_STAT_REG);
 	strap_val = EFX_IS10G(efx) ? 5 : 3;
 	if (falcon_rev(efx) >= FALCON_REV_B0) {
@@ -2305,8 +2301,13 @@ int falcon_switch_mac(struct efx_nic *efx)
 		BUG_ON(EFX_OWORD_FIELD(nic_stat, STRAP_PINS) != strap_val);
 	}
 
+	if (old_mac_op == efx->mac_op)
+		return 0;
 
 	EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G');
+	/* Not all macs support a mac-level link state */
+	efx->mac_up = true;
+
 	return falcon_reset_macs(efx);
 }
 

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/20] sfc: Fixes and new PHY support for 2.6.29, Ben Hutchings, (Thu Jan 29, 12:12 pm)
[PATCH 02/20] sfc: Fix test for MDIO read failure, Ben Hutchings, (Thu Jan 29, 12:16 pm)
[PATCH 03/20] sfc: SFT9001: Enable robust link training, Ben Hutchings, (Thu Jan 29, 12:17 pm)
[PATCH 08/20] sfc: Fix post-reset MAC selection, Ben Hutchings, (Thu Jan 29, 12:19 pm)
[PATCH 13/20] sfc: SFX7101/SFT9001: Fix AN advertisements, Ben Hutchings, (Thu Jan 29, 12:20 pm)
[PATCH 15/20] sfc: Fix reporting of PHY id, Ben Hutchings, (Thu Jan 29, 12:20 pm)
[PATCH 16/20] sfc: Add support for QT2025C PHY, Ben Hutchings, (Thu Jan 29, 12:21 pm)
[PATCH 18/20] sfc: Clean up LED control, Ben Hutchings, (Thu Jan 29, 12:21 pm)
[PATCH 01/11] sfc: SFT9001: Enable robust link training, Ben Hutchings, (Thu Jan 29, 8:48 pm)
[PATCH 05/11] sfc: Fix post-reset MAC selection, Ben Hutchings, (Thu Jan 29, 8:49 pm)
[PATCH 10/11] sfc: SFX7101/SFT9001: Fix AN advertisements, Ben Hutchings, (Thu Jan 29, 8:59 pm)