aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/selftest.c
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2010-06-01 07:19:09 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-02 05:21:07 -0400
commitd730dc527a5abd4717f6320e82cfce54edc882a3 (patch)
treeff9ec087fc5f9a30d992a114b29b42b8cc3f1bf0 /drivers/net/sfc/selftest.c
parent901d3fe848d8c34988699592c9f4b98c2ce10a8b (diff)
sfc: Allow DRV_GEN events to be used outside of selftests
Formerly, efx_test_eventq_irq() assumed it was the only user of driver generated events. Allow it to interoperate with other users. We can create more than 16 channels, so align event codes with a multiple of 256 not 16. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/selftest.c')
-rw-r--r--drivers/net/sfc/selftest.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 52ac14af83a4..c088740e3493 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -161,23 +161,17 @@ static int efx_test_interrupts(struct efx_nic *efx,
161static int efx_test_eventq_irq(struct efx_channel *channel, 161static int efx_test_eventq_irq(struct efx_channel *channel,
162 struct efx_self_tests *tests) 162 struct efx_self_tests *tests)
163{ 163{
164 unsigned int magic, count; 164 unsigned int magic_count, count;
165
166 /* Channel specific code, limited to 20 bits */
167 magic = (0x00010150 + channel->channel);
168 EFX_LOG(channel->efx, "channel %d testing event queue with code %x\n",
169 channel->channel, magic);
170 165
171 tests->eventq_dma[channel->channel] = -1; 166 tests->eventq_dma[channel->channel] = -1;
172 tests->eventq_int[channel->channel] = -1; 167 tests->eventq_int[channel->channel] = -1;
173 tests->eventq_poll[channel->channel] = -1; 168 tests->eventq_poll[channel->channel] = -1;
174 169
175 /* Reset flag and zero magic word */ 170 magic_count = channel->magic_count;
176 channel->efx->last_irq_cpu = -1; 171 channel->efx->last_irq_cpu = -1;
177 channel->eventq_magic = 0;
178 smp_wmb(); 172 smp_wmb();
179 173
180 efx_nic_generate_test_event(channel, magic); 174 efx_nic_generate_test_event(channel);
181 175
182 /* Wait for arrival of interrupt */ 176 /* Wait for arrival of interrupt */
183 count = 0; 177 count = 0;
@@ -187,7 +181,7 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
187 if (channel->work_pending) 181 if (channel->work_pending)
188 efx_process_channel_now(channel); 182 efx_process_channel_now(channel);
189 183
190 if (channel->eventq_magic == magic) 184 if (channel->magic_count != magic_count)
191 goto eventq_ok; 185 goto eventq_ok;
192 } while (++count < 2); 186 } while (++count < 2);
193 187
@@ -204,7 +198,7 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
204 198
205 /* Check to see if event was received even if interrupt wasn't */ 199 /* Check to see if event was received even if interrupt wasn't */
206 efx_process_channel_now(channel); 200 efx_process_channel_now(channel);
207 if (channel->eventq_magic == magic) { 201 if (channel->magic_count != magic_count) {
208 EFX_ERR(channel->efx, "channel %d event was generated, but " 202 EFX_ERR(channel->efx, "channel %d event was generated, but "
209 "failed to trigger an interrupt\n", channel->channel); 203 "failed to trigger an interrupt\n", channel->channel);
210 tests->eventq_dma[channel->channel] = 1; 204 tests->eventq_dma[channel->channel] = 1;