diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-09-10 02:41:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-10 15:27:32 -0400 |
commit | f7d12cdcbb28207b3bdcf4affbf3935e4c015d03 (patch) | |
tree | ab94c3e81e355c8df47102ede2d5d0aa02738945 /drivers/net/sfc/selftest.c | |
parent | ba1e8a35b77f3bc7d109696dbd2a7fd5af208b62 (diff) |
sfc: Refactor channel and queue lookup and iteration
In preparation for changes to the way channels and queue structures
are allocated, revise the macros and functions used to look up and
iterator over them.
- Replace efx_for_each_tx_queue() with iteration over channels then TX
queues
- Replace efx_for_each_rx_queue() with iteration over channels then RX
queues (with one exception, shortly to be removed)
- Introduce efx_get_{channel,rx_queue,tx_queue}() functions to look up
channels and queues by index
- Introduce efx_channel_get_{rx,tx}_queue() functions to look up a
channel's queues
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.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index 85f015f005d5..11153d99bc2b 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
@@ -567,7 +567,7 @@ static int efx_wait_for_link(struct efx_nic *efx) | |||
567 | efx->type->monitor(efx); | 567 | efx->type->monitor(efx); |
568 | mutex_unlock(&efx->mac_lock); | 568 | mutex_unlock(&efx->mac_lock); |
569 | } else { | 569 | } else { |
570 | struct efx_channel *channel = &efx->channel[0]; | 570 | struct efx_channel *channel = efx_get_channel(efx, 0); |
571 | if (channel->work_pending) | 571 | if (channel->work_pending) |
572 | efx_process_channel_now(channel); | 572 | efx_process_channel_now(channel); |
573 | } | 573 | } |
@@ -594,6 +594,7 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests, | |||
594 | { | 594 | { |
595 | enum efx_loopback_mode mode; | 595 | enum efx_loopback_mode mode; |
596 | struct efx_loopback_state *state; | 596 | struct efx_loopback_state *state; |
597 | struct efx_channel *channel = efx_get_channel(efx, 0); | ||
597 | struct efx_tx_queue *tx_queue; | 598 | struct efx_tx_queue *tx_queue; |
598 | int rc = 0; | 599 | int rc = 0; |
599 | 600 | ||
@@ -634,7 +635,7 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests, | |||
634 | } | 635 | } |
635 | 636 | ||
636 | /* Test both types of TX queue */ | 637 | /* Test both types of TX queue */ |
637 | efx_for_each_channel_tx_queue(tx_queue, &efx->channel[0]) { | 638 | efx_for_each_channel_tx_queue(tx_queue, channel) { |
638 | state->offload_csum = (tx_queue->queue & | 639 | state->offload_csum = (tx_queue->queue & |
639 | EFX_TXQ_TYPE_OFFLOAD); | 640 | EFX_TXQ_TYPE_OFFLOAD); |
640 | rc = efx_test_loopback(tx_queue, | 641 | rc = efx_test_loopback(tx_queue, |