Skip to contentSkip to conversation

sfc: Generalise link state monitoring

PATCH Applied Ben Hutchings 2 participants 2 messages Nov 29, 2009 – Nov 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/12 sfc: Generalise link state monitoring

From: Steve Hodgson <[email protected]>

Use the efx_nic_type::monitor operation or event handling as appropriate.

---
 drivers/net/sfc/efx.c      |   16 ++++++++-
 drivers/net/sfc/selftest.c |   79 ++++++++++++++++++++++++++------------------
 2 files changed, 61 insertions(+), 34 deletions(-)
drivers/net/sfc/efx.c +14 -2
index 4210121..14ef27f 100644
@@ -1174,10 +1174,18 @@ static void efx_start_all(struct efx_nic *efx)
 
 	falcon_enable_interrupts(efx);
 
-	/* Start the hardware monitor (if there is one) if we're in RUNNING */
-	if (efx->state == STATE_RUNNING && efx->type->monitor != NULL)
+	/* Start the hardware monitor if there is one. Otherwise (we're link
+	 * event driven), we have to poll the PHY because after an event queue
+	 * flush, we could have a missed a link state change */
+	if (efx->type->monitor != NULL) {
 		queue_delayed_work(efx->workqueue, &efx->monitor_work,
 				   efx_monitor_interval);
+	} else {
+		mutex_lock(&efx->mac_lock);
+		if (efx->phy_op->poll(efx))
+			efx_link_status_changed(efx);
+		mutex_unlock(&efx->mac_lock);
+	}
 
 	efx->type->start_stats(efx);
 }
@@ -1421,6 +1429,10 @@ static int efx_net_open(struct net_device *net_dev)
 	if (efx->phy_mode & PHY_MODE_SPECIAL)
 		return -EBUSY;
 
+	/* Notify the kernel of the link state polled during driver load,
+	 * before the monitor starts running */
+	efx_link_status_changed(efx);
+
 	efx_start_all(efx);
 	return 0;
 }
drivers/net/sfc/selftest.c +47 -32

104 lines not on this page · raw message

Signature · 9 lines
1.6.5.3




-- 
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.