All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
@ 2022-11-22  6:39 ` Goh, Wei Sheng
  0 siblings, 0 replies; 8+ messages in thread
From: Goh, Wei Sheng @ 2022-11-22  6:39 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun, Goh Wei Sheng

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: 46f69ded988d ("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>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |  3 +++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index c25bfecb4a2d..369db308b1dd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -748,6 +748,9 @@ 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");
+		flow &= ~GMAC_RX_FLOW_CTRL_RFE;
 	}
 	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8273e6a175c8..ab7f48f32f5b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1061,8 +1061,16 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 		ctrl |= priv->hw->link.duplex;
 
 	/* Flow Control operation */
-	if (tx_pause && rx_pause)
-		stmmac_mac_flow_ctrl(priv, duplex);
+	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)
 		writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
@ 2022-11-22  6:39 ` Goh, Wei Sheng
  0 siblings, 0 replies; 8+ messages in thread
From: Goh, Wei Sheng @ 2022-11-22  6:39 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin
  Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun, Goh Wei Sheng

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: 46f69ded988d ("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>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c |  3 +++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index c25bfecb4a2d..369db308b1dd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -748,6 +748,9 @@ 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");
+		flow &= ~GMAC_RX_FLOW_CTRL_RFE;
 	}
 	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8273e6a175c8..ab7f48f32f5b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1061,8 +1061,16 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 		ctrl |= priv->hw->link.duplex;
 
 	/* Flow Control operation */
-	if (tx_pause && rx_pause)
-		stmmac_mac_flow_ctrl(priv, duplex);
+	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)
 		writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
  2022-11-22  6:39 ` Goh, Wei Sheng
@ 2022-11-22 18:11   ` Andrew Lunn
  -1 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2022-11-22 18:11 UTC (permalink / raw)
  To: Goh, Wei Sheng
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun

On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote:
> 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.

In future, please include a summary of what changed from version 1 of
the patch. This is generally placed under the --- marker.

> 
> Fixes: 46f69ded988d ("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>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
@ 2022-11-22 18:11   ` Andrew Lunn
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2022-11-22 18:11 UTC (permalink / raw)
  To: Goh, Wei Sheng
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun

On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote:
> 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.

In future, please include a summary of what changed from version 1 of
the patch. This is generally placed under the --- marker.

> 
> Fixes: 46f69ded988d ("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>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
  2022-11-22  6:39 ` Goh, Wei Sheng
@ 2022-11-22 18:40   ` Russell King (Oracle)
  -1 siblings, 0 replies; 8+ messages in thread
From: Russell King (Oracle) @ 2022-11-22 18:40 UTC (permalink / raw)
  To: Goh, Wei Sheng
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun

On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote:
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> index c25bfecb4a2d..369db308b1dd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> @@ -748,6 +748,9 @@ 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");
> +		flow &= ~GMAC_RX_FLOW_CTRL_RFE;
>  	}
>  	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);

This doesn't look correct to me. The function starts off:

        unsigned int flow = 0;

flow is not written to before the context above. So, the code you've
added effectively does:

	flow = 0 & ~GMAC_RX_FLOW_CTRL_RFE;

which is still zero. So, I don't think this hunk is meaningful apart
from adding the pr_debug().

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8273e6a175c8..ab7f48f32f5b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1061,8 +1061,16 @@ static void stmmac_mac_link_up(struct phylink_config *config,
>  		ctrl |= priv->hw->link.duplex;
>  
>  	/* Flow Control operation */
> -	if (tx_pause && rx_pause)
> -		stmmac_mac_flow_ctrl(priv, duplex);
> +	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)
>  		writel(ctrl, priv->ioaddr + MAC_CTRL_REG);

This looks like the true fix for correctly setting the flow control
depending on the phylink link_up() (which will contain the resuts of
pause negotiation, rate adaption or overriden by ethtool - but only
when operating in full duplex mode.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
@ 2022-11-22 18:40   ` Russell King (Oracle)
  0 siblings, 0 replies; 8+ messages in thread
From: Russell King (Oracle) @ 2022-11-22 18:40 UTC (permalink / raw)
  To: Goh, Wei Sheng
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun

On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote:
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> index c25bfecb4a2d..369db308b1dd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> @@ -748,6 +748,9 @@ 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");
> +		flow &= ~GMAC_RX_FLOW_CTRL_RFE;
>  	}
>  	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);

This doesn't look correct to me. The function starts off:

        unsigned int flow = 0;

flow is not written to before the context above. So, the code you've
added effectively does:

	flow = 0 & ~GMAC_RX_FLOW_CTRL_RFE;

which is still zero. So, I don't think this hunk is meaningful apart
from adding the pr_debug().

> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8273e6a175c8..ab7f48f32f5b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1061,8 +1061,16 @@ static void stmmac_mac_link_up(struct phylink_config *config,
>  		ctrl |= priv->hw->link.duplex;
>  
>  	/* Flow Control operation */
> -	if (tx_pause && rx_pause)
> -		stmmac_mac_flow_ctrl(priv, duplex);
> +	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)
>  		writel(ctrl, priv->ioaddr + MAC_CTRL_REG);

This looks like the true fix for correctly setting the flow control
depending on the phylink link_up() (which will contain the resuts of
pause negotiation, rate adaption or overriden by ethtool - but only
when operating in full duplex mode.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
  2022-11-22 18:40   ` Russell King (Oracle)
@ 2022-11-22 18:54     ` Russell King (Oracle)
  -1 siblings, 0 replies; 8+ messages in thread
From: Russell King (Oracle) @ 2022-11-22 18:54 UTC (permalink / raw)
  To: Goh, Wei Sheng
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun

On Tue, Nov 22, 2022 at 06:40:33PM +0000, Russell King (Oracle) wrote:
> On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote:
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> > index c25bfecb4a2d..369db308b1dd 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> > @@ -748,6 +748,9 @@ 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");
> > +		flow &= ~GMAC_RX_FLOW_CTRL_RFE;
> >  	}
> >  	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
> 
> This doesn't look correct to me. The function starts off:
> 
>         unsigned int flow = 0;
> 
> flow is not written to before the context above. So, the code you've
> added effectively does:
> 
> 	flow = 0 & ~GMAC_RX_FLOW_CTRL_RFE;
> 
> which is still zero. So, I don't think this hunk is meaningful apart
> from adding the pr_debug().

It also should be noted that it looks like:

dwxgmac2_core.c::dwxgmac2_flow_ctrl() is definitely buggy - it will
only set flow control, never clearing it.

dwmac100_core.c::dwmac100_flow_ctrl() looks potentially buggy - always
enabling flow control irrespective of anything.

The other two implmentations look sane to me.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings
@ 2022-11-22 18:54     ` Russell King (Oracle)
  0 siblings, 0 replies; 8+ messages in thread
From: Russell King (Oracle) @ 2022-11-22 18:54 UTC (permalink / raw)
  To: Goh, Wei Sheng
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, Ong Boon Leong, Voon Wei Feng, Tan Tee Min,
	Ahmad Tarmizi Noor Azura, Looi Hong Aun

On Tue, Nov 22, 2022 at 06:40:33PM +0000, Russell King (Oracle) wrote:
> On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote:
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> > index c25bfecb4a2d..369db308b1dd 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> > @@ -748,6 +748,9 @@ 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");
> > +		flow &= ~GMAC_RX_FLOW_CTRL_RFE;
> >  	}
> >  	writel(flow, ioaddr + GMAC_RX_FLOW_CTRL);
> 
> This doesn't look correct to me. The function starts off:
> 
>         unsigned int flow = 0;
> 
> flow is not written to before the context above. So, the code you've
> added effectively does:
> 
> 	flow = 0 & ~GMAC_RX_FLOW_CTRL_RFE;
> 
> which is still zero. So, I don't think this hunk is meaningful apart
> from adding the pr_debug().

It also should be noted that it looks like:

dwxgmac2_core.c::dwxgmac2_flow_ctrl() is definitely buggy - it will
only set flow control, never clearing it.

dwmac100_core.c::dwmac100_flow_ctrl() looks potentially buggy - always
enabling flow control irrespective of anything.

The other two implmentations look sane to me.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-22 18:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  6:39 [PATCH net v2] net: stmmac: Set MAC's flow control register to reflect current settings Goh, Wei Sheng
2022-11-22  6:39 ` Goh, Wei Sheng
2022-11-22 18:11 ` Andrew Lunn
2022-11-22 18:11   ` Andrew Lunn
2022-11-22 18:40 ` Russell King (Oracle)
2022-11-22 18:40   ` Russell King (Oracle)
2022-11-22 18:54   ` Russell King (Oracle)
2022-11-22 18:54     ` Russell King (Oracle)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.