Skip to content

Commit

Permalink
sfc: Avoid mangling error codes in efx_test_loopback()
Browse files Browse the repository at this point in the history
efx_test_loopback() used "|" to combine the results of the RX and TX
phases.  If both phases fail with different error codes, this results
in a bogus error code.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
  • Loading branch information
Ben Hutchings authored and Jeff Garzik committed Sep 3, 2008
1 parent 60ac106 commit a0c2c19
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/net/sfc/selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
struct efx_nic *efx = tx_queue->efx;
struct efx_selftest_state *state = efx->loopback_selftest;
struct efx_channel *channel;
int i, rc = 0;
int i, tx_rc, rx_rc;

for (i = 0; i < loopback_test_level; i++) {
/* Determine how many packets to send */
Expand All @@ -531,7 +531,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
state->packet_count);

efx_iterate_state(efx);
rc = efx_tx_loopback(tx_queue);
tx_rc = efx_tx_loopback(tx_queue);

/* NAPI polling is not enabled, so process channels synchronously */
schedule_timeout_uninterruptible(HZ / 50);
Expand All @@ -540,22 +540,22 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
efx_process_channel_now(channel);
}

rc |= efx_rx_loopback(tx_queue, lb_tests);
rx_rc = efx_rx_loopback(tx_queue, lb_tests);
kfree(state->skbs);

if (rc) {
if (tx_rc || rx_rc) {
/* Wait a while to ensure there are no packets
* floating around after a failure. */
schedule_timeout_uninterruptible(HZ / 10);
return rc;
return tx_rc ? tx_rc : rx_rc;
}
}

EFX_LOG(efx, "TX queue %d passed %s loopback test with a burst length "
"of %d packets\n", tx_queue->queue, LOOPBACK_MODE(efx),
state->packet_count);

return rc;
return 0;
}

static int efx_test_loopbacks(struct efx_nic *efx,
Expand Down

0 comments on commit a0c2c19

Please sign in to comment.