Commit cc3d2b5f authored by Goh, Wei Sheng's avatar Goh, Wei Sheng Committed by David S. Miller
Browse files

net: stmmac: Set MAC's flow control register to reflect current settings



Currently, pause frame register GMAC_RX_FLOW_CTRL_RFE is not updated
correctly when 'ethtool -A <IFACE> autoneg off rx off tx off' command
is issued. This fix ensures the flow control change is reflected directly
in the GMAC_RX_FLOW_CTRL_RFE register.

Fixes: 46f69ded ("net: stmmac: Use resolved link config in mac_link_up()")
Cc: <stable@vger.kernel.org> # 5.10.x
Signed-off-by: default avatarGoh, Wei Sheng <wei.sheng.goh@intel.com>
Signed-off-by: default avatarNoor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2a838911
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -748,6 +748,8 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
	if (fc & FLOW_RX) {
		pr_debug("\tReceive Flow-Control ON\n");
		flow |= GMAC_RX_FLOW_CTRL_RFE;
	} else {
		pr_debug("\tReceive Flow-Control OFF\n");
	}
	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);

+10 −2
Original line number Diff line number Diff line
@@ -1061,7 +1061,15 @@ static void stmmac_mac_link_up(struct phylink_config *config,
		ctrl |= priv->hw->link.duplex;

	/* Flow Control operation */
	if (tx_pause && rx_pause)
	if (rx_pause && tx_pause)
		priv->flow_ctrl = FLOW_AUTO;
	else if (rx_pause && !tx_pause)
		priv->flow_ctrl = FLOW_RX;
	else if (!rx_pause && tx_pause)
		priv->flow_ctrl = FLOW_TX;
	else
		priv->flow_ctrl = FLOW_OFF;

	stmmac_mac_flow_ctrl(priv, duplex);

	if (ctrl != old_ctrl)