Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgbe: Allow Priority Flow Control settings to survive a device reset

When changing DCB parameters, ixgbe needs to have the MAC reset. The way
the flow control code is setup today, PFC will be disabled on a reset.
This patch adds a new flow control type for PFC, and then has the netlink
layer take care of toggling which type of flow control to enable.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

PJ Waskiewicz and committed by
David S. Miller
bb3daa4a ede5ad0e

+26 -6
+21 -2
drivers/net/ixgbe/ixgbe_common.c
··· 1654 1654 * 0: Flow control is completely disabled 1655 1655 * 1: Rx flow control is enabled (we can receive pause frames, 1656 1656 * but not send pause frames). 1657 - * 2: Tx flow control is enabled (we can send pause frames but 1658 - * we do not support receiving pause frames). 1657 + * 2: Tx flow control is enabled (we can send pause frames but 1658 + * we do not support receiving pause frames). 1659 1659 * 3: Both Rx and Tx flow control (symmetric) are enabled. 1660 + * 4: Priority Flow Control is enabled. 1660 1661 * other: Invalid. 1661 1662 */ 1662 1663 switch (hw->fc.current_mode) { ··· 1687 1686 mflcn_reg |= IXGBE_MFLCN_RFCE; 1688 1687 fccfg_reg |= IXGBE_FCCFG_TFCE_802_3X; 1689 1688 break; 1689 + #ifdef CONFIG_DCB 1690 + case ixgbe_fc_pfc: 1691 + goto out; 1692 + break; 1693 + #endif 1690 1694 default: 1691 1695 hw_dbg(hw, "Flow control param set incorrectly\n"); 1692 1696 ret_val = -IXGBE_ERR_CONFIG; ··· 1752 1746 * 2: Tx flow control is enabled (we can send pause frames but 1753 1747 * we do not support receiving pause frames). 1754 1748 * 3: Both Rx and Tx flow control (symmetric) are enabled. 1749 + * 4: Priority Flow Control is enabled. 1755 1750 * other: Invalid. 1756 1751 */ 1757 1752 switch (hw->fc.current_mode) { ··· 1783 1776 /* Flow control (both Rx and Tx) is enabled by SW override. */ 1784 1777 reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE); 1785 1778 break; 1779 + #ifdef CONFIG_DCB 1780 + case ixgbe_fc_pfc: 1781 + goto out; 1782 + break; 1783 + #endif 1786 1784 default: 1787 1785 hw_dbg(hw, "Flow control param set incorrectly\n"); 1788 1786 ret_val = -IXGBE_ERR_CONFIG; ··· 1886 1874 ixgbe_link_speed speed; 1887 1875 bool link_up; 1888 1876 1877 + #ifdef CONFIG_DCB 1878 + if (hw->fc.requested_mode == ixgbe_fc_pfc) { 1879 + hw->fc.current_mode = hw->fc.requested_mode; 1880 + goto out; 1881 + } 1882 + 1883 + #endif 1889 1884 /* Validate the packetbuf configuration */ 1890 1885 if (packetbuf_num < 0 || packetbuf_num > 7) { 1891 1886 hw_dbg(hw, "Invalid packet buffer number [%d], expected range "
-1
drivers/net/ixgbe/ixgbe_dcb_82598.c
··· 298 298 reg = IXGBE_READ_REG(hw, IXGBE_RMCS); 299 299 reg &= ~IXGBE_RMCS_TFCE_802_3X; 300 300 /* correct the reporting of our flow control status */ 301 - hw->fc.current_mode = ixgbe_fc_none; 302 301 reg |= IXGBE_RMCS_TFCE_PRIORITY; 303 302 IXGBE_WRITE_REG(hw, IXGBE_RMCS, reg); 304 303
-3
drivers/net/ixgbe/ixgbe_dcb_82599.c
··· 299 299 goto out; 300 300 } 301 301 302 - /* PFC is mutually exclusive with link flow control */ 303 - hw->fc.current_mode = ixgbe_fc_none; 304 - 305 302 /* Configure PFC Tx thresholds per TC */ 306 303 for (i = 0; i < MAX_TRAFFIC_CLASS; i++) { 307 304 /* Config and remember Tx */
+2
drivers/net/ixgbe/ixgbe_dcb_nl.c
··· 130 130 adapter->tx_ring = NULL; 131 131 adapter->rx_ring = NULL; 132 132 133 + adapter->hw.fc.requested_mode = ixgbe_fc_pfc; 133 134 adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; 134 135 adapter->flags |= IXGBE_FLAG_DCB_ENABLED; 135 136 ixgbe_init_interrupt_scheme(adapter); ··· 139 138 } else { 140 139 /* Turn off DCB */ 141 140 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 141 + adapter->hw.fc.requested_mode = ixgbe_fc_default; 142 142 if (netif_running(netdev)) 143 143 netdev->netdev_ops->ndo_stop(netdev); 144 144 ixgbe_reset_interrupt_capability(adapter);
+3
drivers/net/ixgbe/ixgbe_type.h
··· 1939 1939 ixgbe_fc_rx_pause, 1940 1940 ixgbe_fc_tx_pause, 1941 1941 ixgbe_fc_full, 1942 + #ifdef CONFIG_DCB 1943 + ixgbe_fc_pfc, 1944 + #endif 1942 1945 ixgbe_fc_default 1943 1946 }; 1944 1947