aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-09-01 07:45:08 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-09-03 09:53:42 -0400
commita0c2c19093bb326ecce4231e558f92e1e7985e37 (patch)
tree432ca30ec11605908bfd7449c1b53e6fb5f09ac1
parent60ac10658c2e234cf7bc27e0930e324c6c6fcf61 (diff)
sfc: Avoid mangling error codes in efx_test_loopback()
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>
-rw-r--r--drivers/net/sfc/selftest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 0a4778629178..c79ddcec0994 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -514,7 +514,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
514 struct efx_nic *efx = tx_queue->efx; 514 struct efx_nic *efx = tx_queue->efx;
515 struct efx_selftest_state *state = efx->loopback_selftest; 515 struct efx_selftest_state *state = efx->loopback_selftest;
516 struct efx_channel *channel; 516 struct efx_channel *channel;
517 int i, rc = 0; 517 int i, tx_rc, rx_rc;
518 518
519 for (i = 0; i < loopback_test_level; i++) { 519 for (i = 0; i < loopback_test_level; i++) {
520 /* Determine how many packets to send */ 520 /* Determine how many packets to send */
@@ -531,7 +531,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
531 state->packet_count); 531 state->packet_count);
532 532
533 efx_iterate_state(efx); 533 efx_iterate_state(efx);
534 rc = efx_tx_loopback(tx_queue); 534 tx_rc = efx_tx_loopback(tx_queue);
535 535
536 /* NAPI polling is not enabled, so process channels synchronously */ 536 /* NAPI polling is not enabled, so process channels synchronously */
537 schedule_timeout_uninterruptible(HZ / 50); 537 schedule_timeout_uninterruptible(HZ / 50);
@@ -540,14 +540,14 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
540 efx_process_channel_now(channel); 540 efx_process_channel_now(channel);
541 } 541 }
542 542
543 rc |= efx_rx_loopback(tx_queue, lb_tests); 543 rx_rc = efx_rx_loopback(tx_queue, lb_tests);
544 kfree(state->skbs); 544 kfree(state->skbs);
545 545
546 if (rc) { 546 if (tx_rc || rx_rc) {
547 /* Wait a while to ensure there are no packets 547 /* Wait a while to ensure there are no packets
548 * floating around after a failure. */ 548 * floating around after a failure. */
549 schedule_timeout_uninterruptible(HZ / 10); 549 schedule_timeout_uninterruptible(HZ / 10);
550 return rc; 550 return tx_rc ? tx_rc : rx_rc;
551 } 551 }
552 } 552 }
553 553
@@ -555,7 +555,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
555 "of %d packets\n", tx_queue->queue, LOOPBACK_MODE(efx), 555 "of %d packets\n", tx_queue->queue, LOOPBACK_MODE(efx),
556 state->packet_count); 556 state->packet_count);
557 557
558 return rc; 558 return 0;
559} 559}
560 560
561static int efx_test_loopbacks(struct efx_nic *efx, 561static int efx_test_loopbacks(struct efx_nic *efx,