aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_common.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c316
1 files changed, 177 insertions, 139 deletions
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 186a65069b33..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"
@@ -71,12 +73,6 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
71 /* Identify the PHY */ 73 /* Identify the PHY */
72 hw->phy.ops.identify(hw); 74 hw->phy.ops.identify(hw);
73 75
74 /*
75 * Store MAC address from RAR0, clear receive address registers, and
76 * clear the multicast table
77 */
78 hw->mac.ops.init_rx_addrs(hw);
79
80 /* Clear the VLAN filter table */ 76 /* Clear the VLAN filter table */
81 hw->mac.ops.clear_vfta(hw); 77 hw->mac.ops.clear_vfta(hw);
82 78
@@ -89,6 +85,9 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
89 IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext); 85 IXGBE_WRITE_REG(hw, IXGBE_CTRL_EXT, ctrl_ext);
90 IXGBE_WRITE_FLUSH(hw); 86 IXGBE_WRITE_FLUSH(hw);
91 87
88 /* Setup flow control */
89 ixgbe_setup_fc(hw, 0);
90
92 /* Clear adapter stopped flag */ 91 /* Clear adapter stopped flag */
93 hw->adapter_stopped = false; 92 hw->adapter_stopped = false;
94 93
@@ -107,13 +106,17 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
107 **/ 106 **/
108s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw) 107s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw)
109{ 108{
109 s32 status;
110
110 /* Reset the hardware */ 111 /* Reset the hardware */
111 hw->mac.ops.reset_hw(hw); 112 status = hw->mac.ops.reset_hw(hw);
112 113
113 /* Start the HW */ 114 if (status == 0) {
114 hw->mac.ops.start_hw(hw); 115 /* Start the HW */
116 status = hw->mac.ops.start_hw(hw);
117 }
115 118
116 return 0; 119 return status;
117} 120}
118 121
119/** 122/**
@@ -1362,15 +1365,14 @@ static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq)
1362 * Drivers using secondary unicast addresses must set user_set_promisc when 1365 * Drivers using secondary unicast addresses must set user_set_promisc when
1363 * manually putting the device into promiscuous mode. 1366 * manually putting the device into promiscuous mode.
1364 **/ 1367 **/
1365s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list, 1368s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw,
1366 u32 addr_count, ixgbe_mc_addr_itr next) 1369 struct list_head *uc_list)
1367{ 1370{
1368 u8 *addr;
1369 u32 i; 1371 u32 i;
1370 u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc; 1372 u32 old_promisc_setting = hw->addr_ctrl.overflow_promisc;
1371 u32 uc_addr_in_use; 1373 u32 uc_addr_in_use;
1372 u32 fctrl; 1374 u32 fctrl;
1373 u32 vmdq; 1375 struct netdev_hw_addr *ha;
1374 1376
1375 /* 1377 /*
1376 * Clear accounting of old secondary address list, 1378 * Clear accounting of old secondary address list,
@@ -1388,10 +1390,9 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list,
1388 } 1390 }
1389 1391
1390 /* Add the new addresses */ 1392 /* Add the new addresses */
1391 for (i = 0; i < addr_count; i++) { 1393 list_for_each_entry(ha, uc_list, list) {
1392 hw_dbg(hw, " Adding the secondary addresses:\n"); 1394 hw_dbg(hw, " Adding the secondary addresses:\n");
1393 addr = next(hw, &addr_list, &vmdq); 1395 ixgbe_add_uc_addr(hw, ha->addr, 0);
1394 ixgbe_add_uc_addr(hw, addr, vmdq);
1395 } 1396 }
1396 1397
1397 if (hw->addr_ctrl.overflow_promisc) { 1398 if (hw->addr_ctrl.overflow_promisc) {
@@ -1583,19 +1584,30 @@ s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw)
1583} 1584}
1584 1585
1585/** 1586/**
1586 * ixgbe_fc_enable - Enable flow control 1587 * ixgbe_fc_enable_generic - Enable flow control
1587 * @hw: pointer to hardware structure 1588 * @hw: pointer to hardware structure
1588 * @packetbuf_num: packet buffer number (0-7) 1589 * @packetbuf_num: packet buffer number (0-7)
1589 * 1590 *
1590 * Enable flow control according to the current settings. 1591 * Enable flow control according to the current settings.
1591 **/ 1592 **/
1592s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num) 1593s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num)
1593{ 1594{
1594 s32 ret_val = 0; 1595 s32 ret_val = 0;
1595 u32 mflcn_reg; 1596 u32 mflcn_reg, fccfg_reg;
1596 u32 fccfg_reg;
1597 u32 reg; 1597 u32 reg;
1598 u32 rx_pba_size;
1598 1599
1600#ifdef CONFIG_DCB
1601 if (hw->fc.requested_mode == ixgbe_fc_pfc)
1602 goto out;
1603
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;
1609
1610 /* Disable any previous flow control settings */
1599 mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); 1611 mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN);
1600 mflcn_reg &= ~(IXGBE_MFLCN_RFCE | IXGBE_MFLCN_RPFCE); 1612 mflcn_reg &= ~(IXGBE_MFLCN_RFCE | IXGBE_MFLCN_RPFCE);
1601 1613
@@ -1615,7 +1627,10 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
1615 */ 1627 */
1616 switch (hw->fc.current_mode) { 1628 switch (hw->fc.current_mode) {
1617 case ixgbe_fc_none: 1629 case ixgbe_fc_none:
1618 /* 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 */
1619 break; 1634 break;
1620 case ixgbe_fc_rx_pause: 1635 case ixgbe_fc_rx_pause:
1621 /* 1636 /*
@@ -1644,7 +1659,7 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
1644 case ixgbe_fc_pfc: 1659 case ixgbe_fc_pfc:
1645 goto out; 1660 goto out;
1646 break; 1661 break;
1647#endif 1662#endif /* CONFIG_DCB */
1648 default: 1663 default:
1649 hw_dbg(hw, "Flow control param set incorrectly\n"); 1664 hw_dbg(hw, "Flow control param set incorrectly\n");
1650 ret_val = -IXGBE_ERR_CONFIG; 1665 ret_val = -IXGBE_ERR_CONFIG;
@@ -1652,25 +1667,48 @@ s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packetbuf_num)
1652 break; 1667 break;
1653 } 1668 }
1654 1669
1655 /* Enable 802.3x based flow control settings. */ 1670 /* Set 802.3x based flow control settings. */
1671 mflcn_reg |= IXGBE_MFLCN_DPF;
1656 IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg); 1672 IXGBE_WRITE_REG(hw, IXGBE_MFLCN, mflcn_reg);
1657 IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg); 1673 IXGBE_WRITE_REG(hw, IXGBE_FCCFG, fccfg_reg);
1658 1674
1659 /* Set up and enable Rx high/low water mark thresholds, enable XON. */ 1675 reg = IXGBE_READ_REG(hw, IXGBE_MTQC);
1660 if (hw->fc.current_mode & ixgbe_fc_tx_pause) { 1676 /* Thresholds are different for link flow control when in DCB mode */
1661 if (hw->fc.send_xon) 1677 if (reg & IXGBE_MTQC_RT_ENA) {
1662 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), 1678 rx_pba_size = IXGBE_READ_REG(hw, IXGBE_RXPBSIZE(packetbuf_num));
1663 (hw->fc.low_water | IXGBE_FCRTL_XONE)); 1679
1664 else 1680 /* Always disable XON for LFC when in DCB mode */
1665 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), 1681 reg = (rx_pba_size >> 5) & 0xFFE0;
1666 hw->fc.low_water); 1682 IXGBE_WRITE_REG(hw, IXGBE_FCRTL_82599(packetbuf_num), reg);
1683
1684 reg = (rx_pba_size >> 2) & 0xFFE0;
1685 if (hw->fc.current_mode & ixgbe_fc_tx_pause)
1686 reg |= IXGBE_FCRTH_FCEN;
1687 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(packetbuf_num), reg);
1688 } else {
1689 /*
1690 * Set up and enable Rx high/low water mark thresholds,
1691 * enable XON.
1692 */
1693 if (hw->fc.current_mode & ixgbe_fc_tx_pause) {
1694 if (hw->fc.send_xon) {
1695 IXGBE_WRITE_REG(hw,
1696 IXGBE_FCRTL_82599(packetbuf_num),
1697 (hw->fc.low_water |
1698 IXGBE_FCRTL_XONE));
1699 } else {
1700 IXGBE_WRITE_REG(hw,
1701 IXGBE_FCRTL_82599(packetbuf_num),
1702 hw->fc.low_water);
1703 }
1667 1704
1668 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(packetbuf_num), 1705 IXGBE_WRITE_REG(hw, IXGBE_FCRTH_82599(packetbuf_num),
1669 (hw->fc.high_water | IXGBE_FCRTH_FCEN)); 1706 (hw->fc.high_water | IXGBE_FCRTH_FCEN));
1707 }
1670 } 1708 }
1671 1709
1672 /* Configure pause time (2 TCs per register) */ 1710 /* Configure pause time (2 TCs per register) */
1673 reg = IXGBE_READ_REG(hw, IXGBE_FCTTV(packetbuf_num)); 1711 reg = IXGBE_READ_REG(hw, IXGBE_FCTTV(packetbuf_num / 2));
1674 if ((packetbuf_num & 1) == 0) 1712 if ((packetbuf_num & 1) == 0)
1675 reg = (reg & 0xFFFF0000) | hw->fc.pause_time; 1713 reg = (reg & 0xFFFF0000) | hw->fc.pause_time;
1676 else 1714 else
@@ -1687,100 +1725,41 @@ out:
1687 * ixgbe_fc_autoneg - Configure flow control 1725 * ixgbe_fc_autoneg - Configure flow control
1688 * @hw: pointer to hardware structure 1726 * @hw: pointer to hardware structure
1689 * 1727 *
1690 * Negotiates flow control capabilities with link partner using autoneg and 1728 * Compares our advertised flow control capabilities to those advertised by
1691 * applies the results. 1729 * our link partner, and determines the proper flow control mode to use.
1692 **/ 1730 **/
1693s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) 1731s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
1694{ 1732{
1695 s32 ret_val = 0; 1733 s32 ret_val = 0;
1696 u32 i, reg, pcs_anadv_reg, pcs_lpab_reg; 1734 ixgbe_link_speed speed;
1697 1735 u32 pcs_anadv_reg, pcs_lpab_reg, linkstat;
1698 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); 1736 bool link_up;
1699 1737
1700 /* 1738 /*
1701 * The possible values of fc.current_mode are: 1739 * AN should have completed when the cable was plugged in.
1702 * 0: Flow control is completely disabled 1740 * Look for reasons to bail out. Bail out if:
1703 * 1: Rx flow control is enabled (we can receive pause frames, 1741 * - FC autoneg is disabled, or if
1704 * but not send pause frames). 1742 * - we don't have multispeed fiber, or if
1705 * 2: Tx flow control is enabled (we can send pause frames but 1743 * - we're not running at 1G, or if
1706 * we do not support receiving pause frames). 1744 * - link is not up, or if
1707 * 3: Both Rx and Tx flow control (symmetric) are enabled. 1745 * - link is up but AN did not complete, or if
1708 * 4: Priority Flow Control is enabled. 1746 * - link is up and AN completed but timed out
1709 * 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.
1710 */ 1750 */
1711 switch (hw->fc.current_mode) { 1751 hw->mac.ops.check_link(hw, &speed, &link_up, false);
1712 case ixgbe_fc_none: 1752 linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
1713 /* Flow control completely disabled by software override. */ 1753
1714 reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); 1754 if (hw->fc.disable_fc_autoneg ||
1715 break; 1755 !hw->phy.multispeed_fiber ||
1716 case ixgbe_fc_rx_pause: 1756 (speed != IXGBE_LINK_SPEED_1GB_FULL) ||
1717 /* 1757 !link_up ||
1718 * Rx Flow control is enabled and Tx Flow control is 1758 ((linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) ||
1719 * disabled by software override. Since there really 1759 ((linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) {
1720 * isn't a way to advertise that we are capable of RX 1760 hw->fc.fc_was_autonegged = false;
1721 * Pause ONLY, we will advertise that we support both 1761 hw->fc.current_mode = hw->fc.requested_mode;
1722 * symmetric and asymmetric Rx PAUSE. Later, we will 1762 hw_dbg(hw, "Autoneg FC was skipped.\n");
1723 * disable the adapter's ability to send PAUSE frames.
1724 */
1725 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
1726 break;
1727 case ixgbe_fc_tx_pause:
1728 /*
1729 * Tx Flow control is enabled, and Rx Flow control is
1730 * disabled by software override.
1731 */
1732 reg |= (IXGBE_PCS1GANA_ASM_PAUSE);
1733 reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE);
1734 break;
1735 case ixgbe_fc_full:
1736 /* Flow control (both Rx and Tx) is enabled by SW override. */
1737 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
1738 break;
1739#ifdef CONFIG_DCB
1740 case ixgbe_fc_pfc:
1741 goto out;
1742 break;
1743#endif
1744 default:
1745 hw_dbg(hw, "Flow control param set incorrectly\n");
1746 ret_val = -IXGBE_ERR_CONFIG;
1747 goto out;
1748 break;
1749 }
1750
1751 IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg);
1752 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL);
1753
1754 /* Set PCS register for autoneg */
1755 /* Enable and restart autoneg */
1756 reg |= IXGBE_PCS1GLCTL_AN_ENABLE | IXGBE_PCS1GLCTL_AN_RESTART;
1757
1758 /* Disable AN timeout */
1759 if (hw->fc.strict_ieee)
1760 reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN;
1761
1762 hw_dbg(hw, "Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg);
1763 IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg);
1764
1765 /* See if autonegotiation has succeeded */
1766 hw->mac.autoneg_succeeded = 0;
1767 for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
1768 msleep(10);
1769 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
1770 if ((reg & (IXGBE_PCS1GLSTA_LINK_OK |
1771 IXGBE_PCS1GLSTA_AN_COMPLETE)) ==
1772 (IXGBE_PCS1GLSTA_LINK_OK |
1773 IXGBE_PCS1GLSTA_AN_COMPLETE)) {
1774 if (!(reg & IXGBE_PCS1GLSTA_AN_TIMED_OUT))
1775 hw->mac.autoneg_succeeded = 1;
1776 break;
1777 }
1778 }
1779
1780 if (!hw->mac.autoneg_succeeded) {
1781 /* Autoneg failed to achieve a link, so we turn fc off */
1782 hw->fc.current_mode = ixgbe_fc_none;
1783 hw_dbg(hw, "Flow Control = NONE.\n");
1784 goto out; 1763 goto out;
1785 } 1764 }
1786 1765
@@ -1823,21 +1802,23 @@ s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
1823 hw_dbg(hw, "Flow Control = NONE.\n"); 1802 hw_dbg(hw, "Flow Control = NONE.\n");
1824 } 1803 }
1825 1804
1805 /* Record that current_mode is the result of a successful autoneg */
1806 hw->fc.fc_was_autonegged = true;
1807
1826out: 1808out:
1827 return ret_val; 1809 return ret_val;
1828} 1810}
1829 1811
1830/** 1812/**
1831 * ixgbe_setup_fc_generic - Set up flow control 1813 * ixgbe_setup_fc - Set up flow control
1832 * @hw: pointer to hardware structure 1814 * @hw: pointer to hardware structure
1833 * 1815 *
1834 * Sets up flow control. 1816 * Called at init time to set up flow control.
1835 **/ 1817 **/
1836s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num) 1818s32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num)
1837{ 1819{
1838 s32 ret_val = 0; 1820 s32 ret_val = 0;
1839 ixgbe_link_speed speed; 1821 u32 reg;
1840 bool link_up;
1841 1822
1842#ifdef CONFIG_DCB 1823#ifdef CONFIG_DCB
1843 if (hw->fc.requested_mode == ixgbe_fc_pfc) { 1824 if (hw->fc.requested_mode == ixgbe_fc_pfc) {
@@ -1866,7 +1847,7 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num)
1866 1847
1867 /* 1848 /*
1868 * Validate the requested mode. Strict IEEE mode does not allow 1849 * Validate the requested mode. Strict IEEE mode does not allow
1869 * ixgbe_fc_rx_pause because it will cause testing anomalies. 1850 * ixgbe_fc_rx_pause because it will cause us to fail at UNH.
1870 */ 1851 */
1871 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) {
1872 hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict " 1853 hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict "
@@ -1883,21 +1864,77 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num)
1883 hw->fc.requested_mode = ixgbe_fc_full; 1864 hw->fc.requested_mode = ixgbe_fc_full;
1884 1865
1885 /* 1866 /*
1886 * 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
1887 * 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.
1888 */ 1870 */
1889 hw->fc.current_mode = hw->fc.requested_mode; 1871 reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
1890
1891 /* Decide whether to use autoneg or not. */
1892 hw->mac.ops.check_link(hw, &speed, &link_up, false);
1893 if (!hw->fc.disable_fc_autoneg && hw->phy.multispeed_fiber &&
1894 (speed == IXGBE_LINK_SPEED_1GB_FULL))
1895 ret_val = ixgbe_fc_autoneg(hw);
1896 1872
1897 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;
1898 goto out; 1922 goto out;
1923 break;
1924 }
1899 1925
1900 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);
1901 1938
1902out: 1939out:
1903 return ret_val; 1940 return ret_val;
@@ -2044,6 +2081,7 @@ s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
2044 hw->mac.ops.check_link(hw, &speed, &link_up, false); 2081 hw->mac.ops.check_link(hw, &speed, &link_up, false);
2045 2082
2046 if (!link_up) { 2083 if (!link_up) {
2084 autoc_reg |= IXGBE_AUTOC_AN_RESTART;
2047 autoc_reg |= IXGBE_AUTOC_FLU; 2085 autoc_reg |= IXGBE_AUTOC_FLU;
2048 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg); 2086 IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
2049 msleep(10); 2087 msleep(10);