summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/selftest.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-02-28 23:40:21 +0000
committerBen Hutchings <bhutchings@solarflare.com>2012-03-06 18:14:15 +0000
commitdd40781e3a4e9d3177a548c389232ee9496dae8e (patch)
tree6308028fab5fa47ec105eb77888e3cc8a59b4323 /drivers/net/ethernet/sfc/selftest.c
parenteee6f6a9e0c83811de77a137989d4a3289e297cc (diff)
downloadlinux-dd40781e3a4e9d3177a548c389232ee9496dae8e.tar.bz2
sfc: Run event/IRQ self-test asynchronously when interface is brought up
Generate a test event on each event queue whenever the interface is brought up, then after 1 second check that we have either handled a test event or handled another IRQ for each event queue. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/selftest.c')
-rw-r--r--drivers/net/ethernet/sfc/selftest.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/selftest.c b/drivers/net/ethernet/sfc/selftest.c
index aa4ab53cac57..de4c0069f5b2 100644
--- a/drivers/net/ethernet/sfc/selftest.c
+++ b/drivers/net/ethernet/sfc/selftest.c
@@ -702,6 +702,8 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
enum reset_type reset_method = RESET_TYPE_INVISIBLE;
int rc_test = 0, rc_reset = 0, rc;
+ efx_selftest_async_cancel(efx);
+
/* Online (i.e. non-disruptive) testing
* This checks interrupt generation, event delivery and PHY presence. */
@@ -794,3 +796,36 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
return rc_test;
}
+void efx_selftest_async_start(struct efx_nic *efx)
+{
+ struct efx_channel *channel;
+
+ efx_for_each_channel(channel, efx)
+ efx_nic_event_test_start(channel);
+ schedule_delayed_work(&efx->selftest_work, IRQ_TIMEOUT);
+}
+
+void efx_selftest_async_cancel(struct efx_nic *efx)
+{
+ cancel_delayed_work_sync(&efx->selftest_work);
+}
+
+void efx_selftest_async_work(struct work_struct *data)
+{
+ struct efx_nic *efx = container_of(data, struct efx_nic,
+ selftest_work.work);
+ struct efx_channel *channel;
+ int cpu;
+
+ efx_for_each_channel(channel, efx) {
+ cpu = efx_nic_event_test_irq_cpu(channel);
+ if (cpu < 0)
+ netif_err(efx, ifup, efx->net_dev,
+ "channel %d failed to trigger an interrupt\n",
+ channel->channel);
+ else
+ netif_dbg(efx, ifup, efx->net_dev,
+ "channel %d triggered interrupt on CPU %d\n",
+ channel->channel, cpu);
+ }
+}