aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/selftest.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index c79ddcec0994..8ad517c61946 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -566,8 +566,8 @@ static int efx_test_loopbacks(struct efx_nic *efx,
566 struct ethtool_cmd ecmd, ecmd_loopback; 566 struct ethtool_cmd ecmd, ecmd_loopback;
567 struct efx_tx_queue *tx_queue; 567 struct efx_tx_queue *tx_queue;
568 enum efx_loopback_mode old_mode, mode; 568 enum efx_loopback_mode old_mode, mode;
569 int count, rc = 0, link_up; 569 int count, rc, link_up;
570 570
571 rc = efx_ethtool_get_settings(efx->net_dev, &ecmd); 571 rc = efx_ethtool_get_settings(efx->net_dev, &ecmd);
572 if (rc) { 572 if (rc) {
573 EFX_ERR(efx, "could not get GMII settings\n"); 573 EFX_ERR(efx, "could not get GMII settings\n");
@@ -641,8 +641,8 @@ static int efx_test_loopbacks(struct efx_nic *efx,
641 efx_for_each_tx_queue(tx_queue, efx) { 641 efx_for_each_tx_queue(tx_queue, efx) {
642 state->offload_csum = (tx_queue->queue == 642 state->offload_csum = (tx_queue->queue ==
643 EFX_TX_QUEUE_OFFLOAD_CSUM); 643 EFX_TX_QUEUE_OFFLOAD_CSUM);
644 rc |= efx_test_loopback(tx_queue, 644 rc = efx_test_loopback(tx_queue,
645 &tests->loopback[mode]); 645 &tests->loopback[mode]);
646 if (rc) 646 if (rc)
647 goto out; 647 goto out;
648 } 648 }
@@ -668,22 +668,20 @@ static int efx_test_loopbacks(struct efx_nic *efx,
668int efx_online_test(struct efx_nic *efx, struct efx_self_tests *tests) 668int efx_online_test(struct efx_nic *efx, struct efx_self_tests *tests)
669{ 669{
670 struct efx_channel *channel; 670 struct efx_channel *channel;
671 int rc = 0; 671 int rc;
672 672
673 EFX_LOG(efx, "performing online self-tests\n"); 673 rc = efx_test_interrupts(efx, tests);
674 674 if (rc)
675 rc |= efx_test_interrupts(efx, tests); 675 return rc;
676 efx_for_each_channel(channel, efx) { 676 efx_for_each_channel(channel, efx) {
677 if (channel->has_interrupt) 677 if (channel->has_interrupt)
678 rc |= efx_test_eventq_irq(channel, tests); 678 rc = efx_test_eventq_irq(channel, tests);
679 else 679 else
680 rc |= efx_test_eventq(channel, tests); 680 rc = efx_test_eventq(channel, tests);
681 if (rc)
682 return rc;
681 } 683 }
682 rc |= efx_test_phy(efx, tests); 684 rc = efx_test_phy(efx, tests);
683
684 if (rc)
685 EFX_ERR(efx, "failed online self-tests\n");
686
687 return rc; 685 return rc;
688} 686}
689 687
@@ -693,16 +691,12 @@ int efx_offline_test(struct efx_nic *efx,
693 struct efx_self_tests *tests, unsigned int loopback_modes) 691 struct efx_self_tests *tests, unsigned int loopback_modes)
694{ 692{
695 struct efx_selftest_state *state; 693 struct efx_selftest_state *state;
696 int rc = 0; 694 int rc;
697
698 EFX_LOG(efx, "performing offline self-tests\n");
699 695
700 /* Create a selftest_state structure to hold state for the test */ 696 /* Create a selftest_state structure to hold state for the test */
701 state = kzalloc(sizeof(*state), GFP_KERNEL); 697 state = kzalloc(sizeof(*state), GFP_KERNEL);
702 if (state == NULL) { 698 if (state == NULL)
703 rc = -ENOMEM; 699 return -ENOMEM;
704 goto out;
705 }
706 700
707 /* Set the port loopback_selftest member. From this point on 701 /* Set the port loopback_selftest member. From this point on
708 * all received packets will be dropped. Mark the state as 702 * all received packets will be dropped. Mark the state as
@@ -717,10 +711,6 @@ int efx_offline_test(struct efx_nic *efx,
717 wmb(); 711 wmb();
718 kfree(state); 712 kfree(state);
719 713
720 out:
721 if (rc)
722 EFX_ERR(efx, "failed offline self-tests\n");
723
724 return rc; 714 return rc;
725} 715}
726 716