aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJitendra Kalsaria <jitendra.kalsaria@qlogic.com>2013-06-22 04:12:02 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-23 21:29:58 -0400
commit2c4a787847c243b725a7bac510d3ebaa35c90fab (patch)
treecddcb53138248a6e40e2af1203d69b8c6c70a607 /drivers
parent52e493d01cbf85871f0d1fdaeffdf376444e5d50 (diff)
qlcnic: Minimize sleep duration within loopback diagnostic test.
o Minimize sleep duration and check for adapter status. o Exit from loopback test if adapter reset is detected. Signed-off-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c57
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h3
2 files changed, 41 insertions, 19 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index ab664107ac9b..1c463dd562e2 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -1676,13 +1676,19 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode)
1676 1676
1677 /* Poll for link up event before running traffic */ 1677 /* Poll for link up event before running traffic */
1678 do { 1678 do {
1679 msleep(500); 1679 msleep(QLC_83XX_LB_MSLEEP_COUNT);
1680 if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) 1680 if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
1681 qlcnic_83xx_process_aen(adapter); 1681 qlcnic_83xx_process_aen(adapter);
1682 1682
1683 if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { 1683 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) {
1684 dev_info(&adapter->pdev->dev, 1684 netdev_info(netdev,
1685 "Firmware didn't sent link up event to loopback request\n"); 1685 "Device is resetting, free LB test resources\n");
1686 ret = -EIO;
1687 goto free_diag_res;
1688 }
1689 if (loop++ > QLC_83XX_LB_WAIT_COUNT) {
1690 netdev_info(netdev,
1691 "Firmware didn't sent link up event to loopback request\n");
1686 ret = -QLCNIC_FW_NOT_RESPOND; 1692 ret = -QLCNIC_FW_NOT_RESPOND;
1687 qlcnic_83xx_clear_lb_mode(adapter, mode); 1693 qlcnic_83xx_clear_lb_mode(adapter, mode);
1688 goto free_diag_res; 1694 goto free_diag_res;
@@ -1711,6 +1717,7 @@ fail_diag_alloc:
1711int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode) 1717int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1712{ 1718{
1713 struct qlcnic_hardware_context *ahw = adapter->ahw; 1719 struct qlcnic_hardware_context *ahw = adapter->ahw;
1720 struct net_device *netdev = adapter->netdev;
1714 int status = 0, loop = 0; 1721 int status = 0, loop = 0;
1715 u32 config; 1722 u32 config;
1716 1723
@@ -1728,9 +1735,9 @@ int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1728 1735
1729 status = qlcnic_83xx_set_port_config(adapter); 1736 status = qlcnic_83xx_set_port_config(adapter);
1730 if (status) { 1737 if (status) {
1731 dev_err(&adapter->pdev->dev, 1738 netdev_err(netdev,
1732 "Failed to Set Loopback Mode = 0x%x.\n", 1739 "Failed to Set Loopback Mode = 0x%x.\n",
1733 ahw->port_config); 1740 ahw->port_config);
1734 ahw->port_config = config; 1741 ahw->port_config = config;
1735 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status); 1742 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status);
1736 return status; 1743 return status;
@@ -1738,13 +1745,19 @@ int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1738 1745
1739 /* Wait for Link and IDC Completion AEN */ 1746 /* Wait for Link and IDC Completion AEN */
1740 do { 1747 do {
1741 msleep(300); 1748 msleep(QLC_83XX_LB_MSLEEP_COUNT);
1742 if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) 1749 if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
1743 qlcnic_83xx_process_aen(adapter); 1750 qlcnic_83xx_process_aen(adapter);
1744 1751
1745 if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { 1752 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) {
1746 dev_err(&adapter->pdev->dev, 1753 netdev_info(netdev,
1747 "FW did not generate IDC completion AEN\n"); 1754 "Device is resetting, free LB test resources\n");
1755 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status);
1756 return -EIO;
1757 }
1758 if (loop++ > QLC_83XX_LB_WAIT_COUNT) {
1759 netdev_err(netdev,
1760 "Did not receive IDC completion AEN\n");
1748 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status); 1761 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status);
1749 qlcnic_83xx_clear_lb_mode(adapter, mode); 1762 qlcnic_83xx_clear_lb_mode(adapter, mode);
1750 return -EIO; 1763 return -EIO;
@@ -1759,6 +1772,7 @@ int qlcnic_83xx_set_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1759int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode) 1772int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1760{ 1773{
1761 struct qlcnic_hardware_context *ahw = adapter->ahw; 1774 struct qlcnic_hardware_context *ahw = adapter->ahw;
1775 struct net_device *netdev = adapter->netdev;
1762 int status = 0, loop = 0; 1776 int status = 0, loop = 0;
1763 u32 config = ahw->port_config; 1777 u32 config = ahw->port_config;
1764 1778
@@ -1770,9 +1784,9 @@ int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1770 1784
1771 status = qlcnic_83xx_set_port_config(adapter); 1785 status = qlcnic_83xx_set_port_config(adapter);
1772 if (status) { 1786 if (status) {
1773 dev_err(&adapter->pdev->dev, 1787 netdev_err(netdev,
1774 "Failed to Clear Loopback Mode = 0x%x.\n", 1788 "Failed to Clear Loopback Mode = 0x%x.\n",
1775 ahw->port_config); 1789 ahw->port_config);
1776 ahw->port_config = config; 1790 ahw->port_config = config;
1777 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status); 1791 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status);
1778 return status; 1792 return status;
@@ -1780,13 +1794,20 @@ int qlcnic_83xx_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
1780 1794
1781 /* Wait for Link and IDC Completion AEN */ 1795 /* Wait for Link and IDC Completion AEN */
1782 do { 1796 do {
1783 msleep(300); 1797 msleep(QLC_83XX_LB_MSLEEP_COUNT);
1784 if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) 1798 if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
1785 qlcnic_83xx_process_aen(adapter); 1799 qlcnic_83xx_process_aen(adapter);
1786 1800
1787 if (loop++ > QLCNIC_ILB_MAX_RCV_LOOP) { 1801 if (test_bit(__QLCNIC_RESETTING, &adapter->state)) {
1788 dev_err(&adapter->pdev->dev, 1802 netdev_info(netdev,
1789 "Firmware didn't sent IDC completion AEN\n"); 1803 "Device is resetting, free LB test resources\n");
1804 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status);
1805 return -EIO;
1806 }
1807
1808 if (loop++ > QLC_83XX_LB_WAIT_COUNT) {
1809 netdev_err(netdev,
1810 "Did not receive IDC completion AEN\n");
1790 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status); 1811 clear_bit(QLC_83XX_IDC_COMP_AEN, &ahw->idc.status);
1791 return -EIO; 1812 return -EIO;
1792 } 1813 }
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
index e821ee47324a..e356ee87a9a6 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
@@ -36,7 +36,8 @@
36#define QLC_83XX_MAX_DRV_LOCK_RECOVERY_ATTEMPT 3 36#define QLC_83XX_MAX_DRV_LOCK_RECOVERY_ATTEMPT 3
37#define QLC_83XX_DRV_LOCK_RECOVERY_DELAY 200 37#define QLC_83XX_DRV_LOCK_RECOVERY_DELAY 200
38#define QLC_83XX_DRV_LOCK_RECOVERY_STATUS_MASK 0x3 38#define QLC_83XX_DRV_LOCK_RECOVERY_STATUS_MASK 0x3
39 39#define QLC_83XX_LB_WAIT_COUNT 250
40#define QLC_83XX_LB_MSLEEP_COUNT 20
40#define QLC_83XX_NO_NIC_RESOURCE 0x5 41#define QLC_83XX_NO_NIC_RESOURCE 0x5
41#define QLC_83XX_MAC_PRESENT 0xC 42#define QLC_83XX_MAC_PRESENT 0xC
42#define QLC_83XX_MAC_ABSENT 0xD 43#define QLC_83XX_MAC_ABSENT 0xD