From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: Tue, 8 Jun 2021 14:15:35 +0300
Subject: net: dsa: felix: re-enable TX flow control in ocelot_port_flush()
Git-commit: 1650bdb1c516c248fb06f6d076559ff6437a5853
Patch-mainline: v5.13-rc7
References: git-fixes
Because flow control is set up statically in ocelot_init_port(), and not
in phylink_mac_link_up(), what happens is that after the blamed commit,
the flow control remains disabled after the port flushing procedure.
Fixes: eb4733d7cffc ("net: dsa: felix: implement port flushing on .phylink_mac_link_down")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
---
drivers/net/ethernet/mscc/ocelot.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -404,6 +404,7 @@ static u32 ocelot_read_eq_avail(struct o
int ocelot_port_flush(struct ocelot *ocelot, int port)
{
+ unsigned int pause_ena;
int err, val;
/* Disable dequeuing from the egress queues */
@@ -412,6 +413,8 @@ int ocelot_port_flush(struct ocelot *oce
QSYS_PORT_MODE, port);
/* Disable flow control */
+ pause_ena = ocelot_read_rix(ocelot, SYS_PAUSE_CFG, port) &
+ SYS_PAUSE_CFG_PAUSE_ENA;
ocelot_rmw_rix(ocelot, 0, SYS_PAUSE_CFG_PAUSE_ENA, SYS_PAUSE_CFG, port);
/* Disable priority flow control */
@@ -447,6 +450,9 @@ int ocelot_port_flush(struct ocelot *oce
/* Clear flushing again. */
ocelot_rmw_gix(ocelot, 0, REW_PORT_CFG_FLUSH_ENA, REW_PORT_CFG, port);
+ /* Re-enable flow control */
+ ocelot_rmw_rix(ocelot, pause_ena, SYS_PAUSE_CFG_PAUSE_ENA, SYS_PAUSE_CFG, port);
+
return err;
}
EXPORT_SYMBOL(ocelot_port_flush);