diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_common.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.c | 272 |
1 files changed, 143 insertions, 129 deletions
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index 0cc3c47cb453..96a185953777 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
31 | #include <linux/list.h> | ||
32 | #include <linux/netdevice.h> | ||
31 | 33 | ||
32 | #include "ixgbe.h" | 34 | #include "ixgbe.h" |
33 | #include "ixgbe_common.h" | 35 | #include "ixgbe_common.h" |
@@ -83,6 +85,9 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) | |||
83 | IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); | 85 | IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); |
84 | IXGBE_WRITE_FLUSH(hw); | 86 | IXGBE_WRITE_FLUSH(hw); |
85 | 87 | ||
88 | /* Setup flow control */ | ||
89 | ixgbe_setup_fc(hw, 0); | ||
90 | |||
86 | /* Clear adapter stopped flag */ | 91 | /* Clear adapter stopped flag */ |
87 | hw->adapter_stopped = false; | 92 | hw->adapter_stopped = false; |
88 | 93 | ||
@@ -101,13 +106,17 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) | |||
101 | **/ | 106 | **/ |
102 | s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw) | 107 | s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw) |
103 | { | 108 | { |
109 | s32 status; | ||
110 | |||
104 | /* Reset the hardware */ | 111 | /* Reset the hardware */ |
105 | hw->mac.ops.reset_hw(hw); | 112 | status = hw->mac.ops.reset_hw(hw); |
106 | 113 | ||
107 | /* Start the HW */ | 114 | if (status == 0) { |
108 | hw->mac.ops.start_hw(hw); | 115 | /* Start the HW */ |
116 | status = hw->mac.ops.start_hw(hw); | ||
117 | } | ||
109 | 118 | ||
110 | return 0; | 119 | return status; |
111 | } | 120 | } |
112 | 121 | ||
113 | /** | 122 | /** |
@@ -1356,15 +1365,14 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq) | |||
1356 | * Drivers using secondary unicast addresses must set user_set_promisc when | 1365 | * Drivers using secondary unicast addresses must set user_set_promisc when |
1357 | * manually putting the device into promiscuous mode. | 1366 | * manually putting the device into promiscuous mode. |
1358 | **/ | 1367 | **/ |
1359 | s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, | 1368 | s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, |
1360 | u32 addr_count, ixgbe_mc_addr_itr next) | 1369 | struct list_head *uc_list) |
1361 | { | 1370 | { |
1362 | u8 *addr; | ||
1363 | u32 i; | 1371 | u32 i; |
1364 | u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; | 1372 | u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; |
1365 | u32 uc_addr_in_use; | 1373 | u32 uc_addr_in_use; |
1366 | u32 fctrl; | 1374 | u32 fctrl; |
1367 | u32 vmdq; | 1375 | struct netdev_hw_addr *ha; |
1368 | 1376 | ||
1369 | /* | 1377 | /* |
1370 | * Clear accounting of old secondary address list, | 1378 | * Clear accounting of old secondary address list, |
@@ -1382,10 +1390,9 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, | |||
1382 | } | 1390 | } |
1383 | 1391 | ||
1384 | /* Add the new addresses */ | 1392 | /* Add the new addresses */ |
1385 | for (i = 0; i < addr_count; i++) { | 1393 | list_for_each_entry(ha, uc_list, list) { |
1386 | hw_dbg(hw, " Adding the secondary addresses:\n"); | 1394 | hw_dbg(hw, " Adding the secondary addresses:\n"); |
1387 | addr = next(hw, &addr_list, &vmdq); | 1395 | ixgbe_add_uc_addr(hw, ha->addr, 0); |
1388 | ixgbe_add_uc_addr(hw, addr, vmdq); | ||
1389 | } | 1396 | } |
1390 | 1397 | ||
1391 | if (hw->addr_ctrl.overflow_promisc) { | 1398 | if (hw->addr_ctrl.overflow_promisc) { |
@@ -1577,17 +1584,16 @@ s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw) | |||
1577 | } | 1584 | } |
1578 | 1585 | ||
1579 | /** | 1586 | /** |
1580 | * ixgbe_fc_enable - Enable flow control | 1587 | * ixgbe_fc_enable_generic - Enable flow control |
1581 | * @hw: pointer to hardware structure | 1588 | * @hw: pointer to hardware structure |
1582 | * @packetbuf_num: packet buffer number (0-7) | 1589 | * @packetbuf_num: packet buffer number (0-7) |
1583 | * | 1590 | * |
1584 | * Enable flow control according to the current settings. | 1591 | * Enable flow control according to the current settings. |
1585 | **/ | 1592 | **/ |
1586 | s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) | 1593 | s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num) |
1587 | { | 1594 | { |
1588 | s32 ret_val = 0; | 1595 | s32 ret_val = 0; |
1589 | u32 mflcn_reg; | 1596 | u32 mflcn_reg, fccfg_reg; |
1590 | u32 fccfg_reg; | ||
1591 | u32 reg; | 1597 | u32 reg; |
1592 | u32 rx_pba_size; | 1598 | u32 rx_pba_size; |
1593 | 1599 | ||
@@ -1596,7 +1602,12 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1596 | goto out; | 1602 | goto out; |
1597 | 1603 | ||
1598 | #endif /* CONFIG_DCB */ | 1604 | #endif /* CONFIG_DCB */ |
1605 | /* Negotiate the fc mode to use */ | ||
1606 | ret_val = ixgbe_fc_autoneg(hw); | ||
1607 | if (ret_val) | ||
1608 | goto out; | ||
1599 | 1609 | ||
1610 | /* Disable any previous flow control settings */ | ||
1600 | mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); | 1611 | mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); |
1601 | mflcn_reg &= ~(IXGBE_MFLCN_RFCE | IXGBE_MFLCN_RPFCE); | 1612 | mflcn_reg &= ~(IXGBE_MFLCN_RFCE | IXGBE_MFLCN_RPFCE); |
1602 | 1613 | ||
@@ -1616,7 +1627,10 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1616 | */ | 1627 | */ |
1617 | switch (hw->fc.current_mode) { | 1628 | switch (hw->fc.current_mode) { |
1618 | case ixgbe_fc_none: | 1629 | case ixgbe_fc_none: |
1619 | /* Flow control completely disabled by software override. */ | 1630 | /* |
1631 | * Flow control is disabled by software override or autoneg. | ||
1632 | * The code below will actually disable it in the HW. | ||
1633 | */ | ||
1620 | break; | 1634 | break; |
1621 | case ixgbe_fc_rx_pause: | 1635 | case ixgbe_fc_rx_pause: |
1622 | /* | 1636 | /* |
@@ -1645,7 +1659,7 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1645 | case ixgbe_fc_pfc: | 1659 | case ixgbe_fc_pfc: |
1646 | goto out; | 1660 | goto out; |
1647 | break; | 1661 | break; |
1648 | #endif | 1662 | #endif /* CONFIG_DCB */ |
1649 | default: | 1663 | default: |
1650 | hw_dbg(hw, "Flow control param set incorrectly\n"); | 1664 | hw_dbg(hw, "Flow control param set incorrectly\n"); |
1651 | ret_val = -IXGBE_ERR_CONFIG; | 1665 | ret_val = -IXGBE_ERR_CONFIG; |
@@ -1653,7 +1667,7 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1653 | break; | 1667 | break; |
1654 | } | 1668 | } |
1655 | 1669 | ||
1656 | /* Enable 802.3x based flow control settings. */ | 1670 | /* Set 802.3x based flow control settings. */ |
1657 | mflcn_reg |= IXGBE_MFLCN_DPF; | 1671 | mflcn_reg |= IXGBE_MFLCN_DPF; |
1658 | IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); | 1672 | IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); |
1659 | IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); | 1673 | IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); |
@@ -1661,10 +1675,12 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1661 | reg = IXGBE_READ_REG(hw, IXGBE_MTQC); | 1675 | reg = IXGBE_READ_REG(hw, IXGBE_MTQC); |
1662 | /* Thresholds are different for link flow control when in DCB mode */ | 1676 | /* Thresholds are different for link flow control when in DCB mode */ |
1663 | if (reg & IXGBE_MTQC_RT_ENA) { | 1677 | if (reg & IXGBE_MTQC_RT_ENA) { |
1678 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num)); | ||
1679 | |||
1664 | /* Always disable XON for LFC when in DCB mode */ | 1680 | /* Always disable XON for LFC when in DCB mode */ |
1665 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), 0); | 1681 | reg = (rx_pba_size >> 5) & 0xFFE0; |
1682 | IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), reg); | ||
1666 | 1683 | ||
1667 | rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num)); | ||
1668 | reg = (rx_pba_size >> 2) & 0xFFE0; | 1684 | reg = (rx_pba_size >> 2) & 0xFFE0; |
1669 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) | 1685 | if (hw->fc.current_mode & ixgbe_fc_tx_pause) |
1670 | reg |= IXGBE_FCRTH_FCEN; | 1686 | reg |= IXGBE_FCRTH_FCEN; |
@@ -1709,100 +1725,41 @@ out: | |||
1709 | * ixgbe_fc_autoneg - Configure flow control | 1725 | * ixgbe_fc_autoneg - Configure flow control |
1710 | * @hw: pointer to hardware structure | 1726 | * @hw: pointer to hardware structure |
1711 | * | 1727 | * |
1712 | * Negotiates flow control capabilities with link partner using autoneg and | 1728 | * Compares our advertised flow control capabilities to those advertised by |
1713 | * applies the results. | 1729 | * our link partner, and determines the proper flow control mode to use. |
1714 | **/ | 1730 | **/ |
1715 | s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) | 1731 | s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) |
1716 | { | 1732 | { |
1717 | s32 ret_val = 0; | 1733 | s32 ret_val = 0; |
1718 | u32 i, reg, pcs_anadv_reg, pcs_lpab_reg; | 1734 | ixgbe_link_speed speed; |
1719 | 1735 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; | |
1720 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); | 1736 | bool link_up; |
1721 | 1737 | ||
1722 | /* | 1738 | /* |
1723 | * The possible values of fc.current_mode are: | 1739 | * AN should have completed when the cable was plugged in. |
1724 | * 0: Flow control is completely disabled | 1740 | * Look for reasons to bail out. Bail out if: |
1725 | * 1: Rx flow control is enabled (we can receive pause frames, | 1741 | * - FC autoneg is disabled, or if |
1726 | * but not send pause frames). | 1742 | * - we don't have multispeed fiber, or if |
1727 | * 2: Tx flow control is enabled (we can send pause frames but | 1743 | * - we're not running at 1G, or if |
1728 | * we do not support receiving pause frames). | 1744 | * - link is not up, or if |
1729 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | 1745 | * - link is up but AN did not complete, or if |
1730 | * 4: Priority Flow Control is enabled. | 1746 | * - link is up and AN completed but timed out |
1731 | * other: Invalid. | 1747 | * |
1748 | * Since we're being called from an LSC, link is already know to be up. | ||
1749 | * So use link_up_wait_to_complete=false. | ||
1732 | */ | 1750 | */ |
1733 | switch (hw->fc.current_mode) { | 1751 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
1734 | case ixgbe_fc_none: | 1752 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); |
1735 | /* Flow control completely disabled by software override. */ | 1753 | |
1736 | reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | 1754 | if (hw->fc.disable_fc_autoneg || |
1737 | break; | 1755 | !hw->phy.multispeed_fiber || |
1738 | case ixgbe_fc_rx_pause: | 1756 | (speed != IXGBE_LINK_SPEED_1GB_FULL) || |
1739 | /* | 1757 | !link_up || |
1740 | * Rx Flow control is enabled and Tx Flow control is | 1758 | ((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || |
1741 | * disabled by software override. Since there really | 1759 | ((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) { |
1742 | * isn't a way to advertise that we are capable of RX | 1760 | hw->fc.fc_was_autonegged = false; |
1743 | * Pause ONLY, we will advertise that we support both | 1761 | hw->fc.current_mode = hw->fc.requested_mode; |
1744 | * symmetric and asymmetric Rx PAUSE. Later, we will | 1762 | hw_dbg(hw, "Autoneg FC was skipped.\n"); |
1745 | * disable the adapter's ability to send PAUSE frames. | ||
1746 | */ | ||
1747 | reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | ||
1748 | break; | ||
1749 | case ixgbe_fc_tx_pause: | ||
1750 | /* | ||
1751 | * Tx Flow control is enabled, and Rx Flow control is | ||
1752 | * disabled by software override. | ||
1753 | */ | ||
1754 | reg |= (IXGBE_PCS1GANA_ASM_PAUSE); | ||
1755 | reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE); | ||
1756 | break; | ||
1757 | case ixgbe_fc_full: | ||
1758 | /* Flow control (both Rx and Tx) is enabled by SW override. */ | ||
1759 | reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | ||
1760 | break; | ||
1761 | #ifdef CONFIG_DCB | ||
1762 | case ixgbe_fc_pfc: | ||
1763 | goto out; | ||
1764 | break; | ||
1765 | #endif | ||
1766 | default: | ||
1767 | hw_dbg(hw, "Flow control param set incorrectly\n"); | ||
1768 | ret_val = -IXGBE_ERR_CONFIG; | ||
1769 | goto out; | ||
1770 | break; | ||
1771 | } | ||
1772 | |||
1773 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); | ||
1774 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); | ||
1775 | |||
1776 | /* Set PCS register for autoneg */ | ||
1777 | /* Enable and restart autoneg */ | ||
1778 | reg |= IXGBE_PCS1GLCTL_AN_ENABLE | IXGBE_PCS1GLCTL_AN_RESTART; | ||
1779 | |||
1780 | /* Disable AN timeout */ | ||
1781 | if (hw->fc.strict_ieee) | ||
1782 | reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; | ||
1783 | |||
1784 | hw_dbg(hw, "Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg); | ||
1785 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); | ||
1786 | |||
1787 | /* See if autonegotiation has succeeded */ | ||
1788 | hw->mac.autoneg_succeeded = 0; | ||
1789 | for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) { | ||
1790 | msleep(10); | ||
1791 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); | ||
1792 | if ((reg & (IXGBE_PCS1GLSTA_LINK_OK | | ||
1793 | IXGBE_PCS1GLSTA_AN_COMPLETE)) == | ||
1794 | (IXGBE_PCS1GLSTA_LINK_OK | | ||
1795 | IXGBE_PCS1GLSTA_AN_COMPLETE)) { | ||
1796 | if (!(reg & IXGBE_PCS1GLSTA_AN_TIMED_OUT)) | ||
1797 | hw->mac.autoneg_succeeded = 1; | ||
1798 | break; | ||
1799 | } | ||
1800 | } | ||
1801 | |||
1802 | if (!hw->mac.autoneg_succeeded) { | ||
1803 | /* Autoneg failed to achieve a link, so we turn fc off */ | ||
1804 | hw->fc.current_mode = ixgbe_fc_none; | ||
1805 | hw_dbg(hw, "Flow Control = NONE.\n"); | ||
1806 | goto out; | 1763 | goto out; |
1807 | } | 1764 | } |
1808 | 1765 | ||
@@ -1845,21 +1802,23 @@ s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) | |||
1845 | hw_dbg(hw, "Flow Control = NONE.\n"); | 1802 | hw_dbg(hw, "Flow Control = NONE.\n"); |
1846 | } | 1803 | } |
1847 | 1804 | ||
1805 | /* Record that current_mode is the result of a successful autoneg */ | ||
1806 | hw->fc.fc_was_autonegged = true; | ||
1807 | |||
1848 | out: | 1808 | out: |
1849 | return ret_val; | 1809 | return ret_val; |
1850 | } | 1810 | } |
1851 | 1811 | ||
1852 | /** | 1812 | /** |
1853 | * ixgbe_setup_fc_generic - Set up flow control | 1813 | * ixgbe_setup_fc - Set up flow control |
1854 | * @hw: pointer to hardware structure | 1814 | * @hw: pointer to hardware structure |
1855 | * | 1815 | * |
1856 | * Sets up flow control. | 1816 | * Called at init time to set up flow control. |
1857 | **/ | 1817 | **/ |
1858 | s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | 1818 | s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) |
1859 | { | 1819 | { |
1860 | s32 ret_val = 0; | 1820 | s32 ret_val = 0; |
1861 | ixgbe_link_speed speed; | 1821 | u32 reg; |
1862 | bool link_up; | ||
1863 | 1822 | ||
1864 | #ifdef CONFIG_DCB | 1823 | #ifdef CONFIG_DCB |
1865 | if (hw->fc.requested_mode == ixgbe_fc_pfc) { | 1824 | if (hw->fc.requested_mode == ixgbe_fc_pfc) { |
@@ -1881,16 +1840,14 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1881 | * because it causes the controller to just blast out fc packets. | 1840 | * because it causes the controller to just blast out fc packets. |
1882 | */ | 1841 | */ |
1883 | if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) { | 1842 | if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) { |
1884 | if (hw->fc.requested_mode != ixgbe_fc_none) { | 1843 | hw_dbg(hw, "Invalid water mark configuration\n"); |
1885 | hw_dbg(hw, "Invalid water mark configuration\n"); | 1844 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; |
1886 | ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS; | 1845 | goto out; |
1887 | goto out; | ||
1888 | } | ||
1889 | } | 1846 | } |
1890 | 1847 | ||
1891 | /* | 1848 | /* |
1892 | * Validate the requested mode. Strict IEEE mode does not allow | 1849 | * Validate the requested mode. Strict IEEE mode does not allow |
1893 | * ixgbe_fc_rx_pause because it will cause testing anomalies. | 1850 | * ixgbe_fc_rx_pause because it will cause us to fail at UNH. |
1894 | */ | 1851 | */ |
1895 | if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { | 1852 | if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) { |
1896 | hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict " | 1853 | hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict " |
@@ -1907,21 +1864,77 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
1907 | hw->fc.requested_mode = ixgbe_fc_full; | 1864 | hw->fc.requested_mode = ixgbe_fc_full; |
1908 | 1865 | ||
1909 | /* | 1866 | /* |
1910 | * Save off the requested flow control mode for use later. Depending | 1867 | * Set up the 1G flow control advertisement registers so the HW will be |
1911 | * on the link partner's capabilities, we may or may not use this mode. | 1868 | * able to do fc autoneg once the cable is plugged in. If we end up |
1869 | * using 10g instead, this is harmless. | ||
1912 | */ | 1870 | */ |
1913 | hw->fc.current_mode = hw->fc.requested_mode; | 1871 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); |
1914 | |||
1915 | /* Decide whether to use autoneg or not. */ | ||
1916 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | ||
1917 | if (!hw->fc.disable_fc_autoneg && hw->phy.multispeed_fiber && | ||
1918 | (speed == IXGBE_LINK_SPEED_1GB_FULL)) | ||
1919 | ret_val = ixgbe_fc_autoneg(hw); | ||
1920 | 1872 | ||
1921 | if (ret_val) | 1873 | /* |
1874 | * The possible values of fc.requested_mode are: | ||
1875 | * 0: Flow control is completely disabled | ||
1876 | * 1: Rx flow control is enabled (we can receive pause frames, | ||
1877 | * but not send pause frames). | ||
1878 | * 2: Tx flow control is enabled (we can send pause frames but | ||
1879 | * we do not support receiving pause frames). | ||
1880 | * 3: Both Rx and Tx flow control (symmetric) are enabled. | ||
1881 | #ifdef CONFIG_DCB | ||
1882 | * 4: Priority Flow Control is enabled. | ||
1883 | #endif | ||
1884 | * other: Invalid. | ||
1885 | */ | ||
1886 | switch (hw->fc.requested_mode) { | ||
1887 | case ixgbe_fc_none: | ||
1888 | /* Flow control completely disabled by software override. */ | ||
1889 | reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | ||
1890 | break; | ||
1891 | case ixgbe_fc_rx_pause: | ||
1892 | /* | ||
1893 | * Rx Flow control is enabled and Tx Flow control is | ||
1894 | * disabled by software override. Since there really | ||
1895 | * isn't a way to advertise that we are capable of RX | ||
1896 | * Pause ONLY, we will advertise that we support both | ||
1897 | * symmetric and asymmetric Rx PAUSE. Later, we will | ||
1898 | * disable the adapter's ability to send PAUSE frames. | ||
1899 | */ | ||
1900 | reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | ||
1901 | break; | ||
1902 | case ixgbe_fc_tx_pause: | ||
1903 | /* | ||
1904 | * Tx Flow control is enabled, and Rx Flow control is | ||
1905 | * disabled by software override. | ||
1906 | */ | ||
1907 | reg |= (IXGBE_PCS1GANA_ASM_PAUSE); | ||
1908 | reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE); | ||
1909 | break; | ||
1910 | case ixgbe_fc_full: | ||
1911 | /* Flow control (both Rx and Tx) is enabled by SW override. */ | ||
1912 | reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); | ||
1913 | break; | ||
1914 | #ifdef CONFIG_DCB | ||
1915 | case ixgbe_fc_pfc: | ||
1916 | goto out; | ||
1917 | break; | ||
1918 | #endif /* CONFIG_DCB */ | ||
1919 | default: | ||
1920 | hw_dbg(hw, "Flow control param set incorrectly\n"); | ||
1921 | ret_val = -IXGBE_ERR_CONFIG; | ||
1922 | goto out; | 1922 | goto out; |
1923 | break; | ||
1924 | } | ||
1923 | 1925 | ||
1924 | ret_val = ixgbe_fc_enable(hw, packetbuf_num); | 1926 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg); |
1927 | reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL); | ||
1928 | |||
1929 | /* Enable and restart autoneg to inform the link partner */ | ||
1930 | reg |= IXGBE_PCS1GLCTL_AN_ENABLE | IXGBE_PCS1GLCTL_AN_RESTART; | ||
1931 | |||
1932 | /* Disable AN timeout */ | ||
1933 | if (hw->fc.strict_ieee) | ||
1934 | reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN; | ||
1935 | |||
1936 | IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg); | ||
1937 | hw_dbg(hw, "Set up FC; PCS1GLCTL = 0x%08X\n", reg); | ||
1925 | 1938 | ||
1926 | out: | 1939 | out: |
1927 | return ret_val; | 1940 | return ret_val; |
@@ -2068,6 +2081,7 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index) | |||
2068 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | 2081 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
2069 | 2082 | ||
2070 | if (!link_up) { | 2083 | if (!link_up) { |
2084 | autoc_reg |= IXGBE_AUTOC_AN_RESTART; | ||
2071 | autoc_reg |= IXGBE_AUTOC_FLU; | 2085 | autoc_reg |= IXGBE_AUTOC_FLU; |
2072 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); | 2086 | IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); |
2073 | msleep(10); | 2087 | msleep(10); |