Skip to content

Commit cc3d2b5

Browse files
ws-inteldavem330
authored andcommitted
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: 46f69de ("net: stmmac: Use resolved link config in mac_link_up()") Cc: <stable@vger.kernel.org> # 5.10.x Signed-off-by: Goh, Wei Sheng <wei.sheng.goh@intel.com> Signed-off-by: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2a83891 commit cc3d2b5

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
748748
if (fc & FLOW_RX) {
749749
pr_debug("\tReceive Flow-Control ON\n");
750750
flow |= GMAC_RX_FLOW_CTRL_RFE;
751+
} else {
752+
pr_debug("\tReceive Flow-Control OFF\n");
751753
}
752754
writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
753755

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,16 @@ static void stmmac_mac_link_up(struct phylink_config *config,
10611061
ctrl |= priv->hw->link.duplex;
10621062

10631063
/* Flow Control operation */
1064-
if (tx_pause && rx_pause)
1065-
stmmac_mac_flow_ctrl(priv, duplex);
1064+
if (rx_pause && tx_pause)
1065+
priv->flow_ctrl = FLOW_AUTO;
1066+
else if (rx_pause && !tx_pause)
1067+
priv->flow_ctrl = FLOW_RX;
1068+
else if (!rx_pause && tx_pause)
1069+
priv->flow_ctrl = FLOW_TX;
1070+
else
1071+
priv->flow_ctrl = FLOW_OFF;
1072+
1073+
stmmac_mac_flow_ctrl(priv, duplex);
10661074

10671075
if (ctrl != old_ctrl)
10681076
writel(ctrl, priv->ioaddr + MAC_CTRL_REG);

0 commit comments

Comments
 (0)