diff options
author | Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> | 2013-02-09 13:29:51 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-11 11:04:13 +0400 |
commit | ba4468dbf3364c35652dda14e2ef90c5cf09ab16 (patch) | |
tree | c4c17ea14da629b8762c471ca6368458cf42267c /drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |
parent | 483202d590cd76fc794f3aa11a342b718a804a28 (diff) | |
download | linux-ba4468dbf3364c35652dda14e2ef90c5cf09ab16.tar.xz |
qlcnic: refactor 83xx diagnostic loopback test
Cleanly separate 83xx diagnostic loopback test routines from 82xx
Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 6320d551c63d..58e255437d5a 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c @@ -883,7 +883,7 @@ int qlcnic_check_loopback_buff(unsigned char *data, u8 mac[]) return memcmp(data, buff, QLCNIC_ILB_PKT_SIZE); } -static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) +int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) { struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0]; @@ -925,7 +925,7 @@ static int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode) return 0; } -static int qlcnic_loopback_test(struct net_device *netdev, u8 mode) +int qlcnic_loopback_test(struct net_device *netdev, u8 mode) { struct qlcnic_adapter *adapter = netdev_priv(netdev); int max_sds_rings = adapter->max_sds_rings; @@ -935,13 +935,14 @@ static int qlcnic_loopback_test(struct net_device *netdev, u8 mode) int ret; if (qlcnic_83xx_check(adapter)) - goto skip_cap; + return qlcnic_83xx_loopback_test(netdev, mode); + if (!(ahw->capabilities & QLCNIC_FW_CAPABILITY_MULTI_LOOPBACK)) { dev_info(&adapter->pdev->dev, "Firmware do not support loopback test\n"); return -EOPNOTSUPP; } -skip_cap: + dev_warn(&adapter->pdev->dev, "%s loopback test in progress\n", mode == QLCNIC_ILB_MODE ? "internal" : "external"); if (ahw->op_mode == QLCNIC_NON_PRIV_FUNC) { @@ -962,9 +963,6 @@ skip_cap: if (ret) goto free_res; - if (qlcnic_83xx_check(adapter)) - goto skip_fw_msg; - ahw->diag_cnt = 0; do { msleep(500); @@ -979,21 +977,9 @@ skip_cap: goto free_res; } } while (!QLCNIC_IS_LB_CONFIGURED(ahw->loopback_state)); -skip_fw_msg: - if (qlcnic_83xx_check(adapter)) { - /* wait until firmware report link up before running traffic */ - loop = 0; - do { - msleep(500); - if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { - dev_info(&adapter->pdev->dev, - "No linkup event after LB req\n"); - ret = -QLCNIC_FW_NOT_RESPOND; - goto free_res; - } - } while ((adapter->ahw->linkup && ahw->has_link_events) != 1); - } + ret = qlcnic_do_lb_test(adapter, mode); + qlcnic_clear_lb_mode(adapter, mode); free_res: |