diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-10-04 00:20:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-05 01:46:48 -0400 |
commit | 31dee692e22eedaf2540fa543fa9c91df6ab8bda (patch) | |
tree | 10e544e30a4dfe906282b8ddfaf7a9f379bd9535 /drivers/net/qlcnic/qlcnic_ethtool.c | |
parent | 21a180cda012e1f93e362dd4a9b0bfd3d8c92940 (diff) |
qlcnic: fix internal loopback test
o Loop 10 times with delay of 1 ms to rcv packet.
o Print garbage packet.
o Try send/receive MAX(16) packet, instead of exit from test,
if a packet is not received.
Signed-off-by: Amit Kumar Salecha <amit.salecha@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.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index cb9463bd6b1..550cfe9a1b1 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -636,6 +636,8 @@ static int qlcnic_get_sset_count(struct net_device *dev, int sset) | |||
636 | } | 636 | } |
637 | 637 | ||
638 | #define QLC_ILB_PKT_SIZE 64 | 638 | #define QLC_ILB_PKT_SIZE 64 |
639 | #define QLC_NUM_ILB_PKT 16 | ||
640 | #define QLC_ILB_MAX_RCV_LOOP 10 | ||
639 | 641 | ||
640 | static void qlcnic_create_loopback_buff(unsigned char *data) | 642 | static void qlcnic_create_loopback_buff(unsigned char *data) |
641 | { | 643 | { |
@@ -657,24 +659,34 @@ static int qlcnic_do_ilb_test(struct qlcnic_adapter *adapter) | |||
657 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 659 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; |
658 | struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0]; | 660 | struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0]; |
659 | struct sk_buff *skb; | 661 | struct sk_buff *skb; |
660 | int i; | 662 | int i, loop, cnt = 0; |
661 | 663 | ||
662 | for (i = 0; i < 16; i++) { | 664 | for (i = 0; i < QLC_NUM_ILB_PKT; i++) { |
663 | skb = dev_alloc_skb(QLC_ILB_PKT_SIZE); | 665 | skb = dev_alloc_skb(QLC_ILB_PKT_SIZE); |
664 | qlcnic_create_loopback_buff(skb->data); | 666 | qlcnic_create_loopback_buff(skb->data); |
665 | skb_put(skb, QLC_ILB_PKT_SIZE); | 667 | skb_put(skb, QLC_ILB_PKT_SIZE); |
666 | 668 | ||
667 | adapter->diag_cnt = 0; | 669 | adapter->diag_cnt = 0; |
668 | |||
669 | qlcnic_xmit_frame(skb, adapter->netdev); | 670 | qlcnic_xmit_frame(skb, adapter->netdev); |
670 | 671 | ||
671 | msleep(5); | 672 | loop = 0; |
672 | 673 | do { | |
673 | qlcnic_process_rcv_ring_diag(sds_ring); | 674 | msleep(1); |
675 | qlcnic_process_rcv_ring_diag(sds_ring); | ||
676 | } while (loop++ < QLC_ILB_MAX_RCV_LOOP && | ||
677 | !adapter->diag_cnt); | ||
674 | 678 | ||
675 | dev_kfree_skb_any(skb); | 679 | dev_kfree_skb_any(skb); |
680 | |||
676 | if (!adapter->diag_cnt) | 681 | if (!adapter->diag_cnt) |
677 | return -1; | 682 | dev_warn(&adapter->pdev->dev, "ILB Test: %dth packet" |
683 | " not recevied\n", i + 1); | ||
684 | else | ||
685 | cnt++; | ||
686 | } | ||
687 | if (cnt != i) { | ||
688 | dev_warn(&adapter->pdev->dev, "ILB Test failed\n"); | ||
689 | return -1; | ||
678 | } | 690 | } |
679 | return 0; | 691 | return 0; |
680 | } | 692 | } |