aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_ethtool.c
diff options
context:
space:
mode:
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>2010-12-02 15:41:23 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-03 12:33:20 -0500
commit97319a270da37a5eab14a770f1417d8229245270 (patch)
treeb44c0a44d1ee6f7dc05fdd2a4e03b6a6037639f5 /drivers/net/qlcnic/qlcnic_ethtool.c
parent7e300bc8e6736d41e7b92978f415572ac60fd59b (diff)
qlcnic: Disable loopback support
Loopback mode can not be supported in CNA mode. Removing it until FW is fixed. Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_ethtool.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c104
1 files changed, 1 insertions, 103 deletions
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index c3892963648..2aa9d8b2bab 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -101,8 +101,7 @@ static const char qlcnic_device_gstrings_stats[][ETH_GSTRING_LEN] = {
101static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { 101static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = {
102 "Register_Test_on_offline", 102 "Register_Test_on_offline",
103 "Link_Test_on_offline", 103 "Link_Test_on_offline",
104 "Interrupt_Test_offline", 104 "Interrupt_Test_offline"
105 "Loopback_Test_offline"
106}; 105};
107 106
108#define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test) 107#define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test)
@@ -643,104 +642,6 @@ static int qlcnic_get_sset_count(struct net_device *dev, int sset)
643 } 642 }
644} 643}
645 644
646#define QLC_ILB_PKT_SIZE 64
647#define QLC_NUM_ILB_PKT 16
648#define QLC_ILB_MAX_RCV_LOOP 10
649
650static void qlcnic_create_loopback_buff(unsigned char *data)
651{
652 unsigned char random_data[] = {0xa8, 0x06, 0x45, 0x00};
653 memset(data, 0x4e, QLC_ILB_PKT_SIZE);
654 memset(data, 0xff, 12);
655 memcpy(data + 12, random_data, sizeof(random_data));
656}
657
658int qlcnic_check_loopback_buff(unsigned char *data)
659{
660 unsigned char buff[QLC_ILB_PKT_SIZE];
661 qlcnic_create_loopback_buff(buff);
662 return memcmp(data, buff, QLC_ILB_PKT_SIZE);
663}
664
665static int qlcnic_do_ilb_test(struct qlcnic_adapter *adapter)
666{
667 struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx;
668 struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0];
669 struct sk_buff *skb;
670 int i, loop, cnt = 0;
671
672 for (i = 0; i < QLC_NUM_ILB_PKT; i++) {
673 skb = dev_alloc_skb(QLC_ILB_PKT_SIZE);
674 qlcnic_create_loopback_buff(skb->data);
675 skb_put(skb, QLC_ILB_PKT_SIZE);
676
677 adapter->diag_cnt = 0;
678 qlcnic_xmit_frame(skb, adapter->netdev);
679
680 loop = 0;
681 do {
682 msleep(1);
683 qlcnic_process_rcv_ring_diag(sds_ring);
684 } while (loop++ < QLC_ILB_MAX_RCV_LOOP &&
685 !adapter->diag_cnt);
686
687 dev_kfree_skb_any(skb);
688
689 if (!adapter->diag_cnt)
690 dev_warn(&adapter->pdev->dev, "ILB Test: %dth packet"
691 " not recevied\n", i + 1);
692 else
693 cnt++;
694 }
695 if (cnt != i) {
696 dev_warn(&adapter->pdev->dev, "ILB Test failed\n");
697 return -1;
698 }
699 return 0;
700}
701
702static int qlcnic_loopback_test(struct net_device *netdev)
703{
704 struct qlcnic_adapter *adapter = netdev_priv(netdev);
705 int max_sds_rings = adapter->max_sds_rings;
706 int ret;
707
708 if (adapter->op_mode == QLCNIC_NON_PRIV_FUNC) {
709 dev_warn(&adapter->pdev->dev, "Loopback test not supported"
710 "for non privilege function\n");
711 return 0;
712 }
713
714 if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state))
715 return -EIO;
716
717 if (qlcnic_request_quiscent_mode(adapter)) {
718 clear_bit(__QLCNIC_RESETTING, &adapter->state);
719 return -EIO;
720 }
721
722 ret = qlcnic_diag_alloc_res(netdev, QLCNIC_LOOPBACK_TEST);
723 if (ret)
724 goto clear_it;
725
726 ret = qlcnic_set_ilb_mode(adapter);
727 if (ret)
728 goto done;
729
730 ret = qlcnic_do_ilb_test(adapter);
731
732 qlcnic_clear_ilb_mode(adapter);
733
734done:
735 qlcnic_diag_free_res(netdev, max_sds_rings);
736
737clear_it:
738 qlcnic_clear_quiscent_mode(adapter);
739 adapter->max_sds_rings = max_sds_rings;
740 clear_bit(__QLCNIC_RESETTING, &adapter->state);
741 return ret;
742}
743
744static int qlcnic_irq_test(struct net_device *netdev) 645static int qlcnic_irq_test(struct net_device *netdev)
745{ 646{
746 struct qlcnic_adapter *adapter = netdev_priv(netdev); 647 struct qlcnic_adapter *adapter = netdev_priv(netdev);
@@ -793,9 +694,6 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
793 if (data[2]) 694 if (data[2])
794 eth_test->flags |= ETH_TEST_FL_FAILED; 695 eth_test->flags |= ETH_TEST_FL_FAILED;
795 696
796 data[3] = qlcnic_loopback_test(dev);
797 if (data[3])
798 eth_test->flags |= ETH_TEST_FL_FAILED;
799 697
800 } 698 }
801} 699}