linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
@ 2021-08-24  5:55 DENG Qingfang
  2021-08-24 15:29 ` Sasha Levin
  0 siblings, 1 reply; 8+ messages in thread
From: DENG Qingfang @ 2021-08-24  5:55 UTC (permalink / raw)
  To: stable
  Cc: Sean Wang, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

This is a partial backport of commit 5a30833b9a16f8d1aa15de06636f9317ca51f9df
("net: dsa: mt7530: support MDB and bridge flag operations") upstream.

Make sure that the standalone ports start up with learning disabled.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
---
 drivers/net/dsa/mt7530.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 6335c4ea0957..67dfab774618 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -803,6 +803,8 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
 			   PCR_MATRIX_MASK, PCR_MATRIX(port_bitmap));
 	priv->ports[port].pm |= PCR_MATRIX(port_bitmap);
 
+	mt7530_clear(priv, MT7530_PSC_P(port), SA_DIS);
+
 	mutex_unlock(&priv->reg_mutex);
 
 	return 0;
@@ -907,6 +909,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
 
 	mt7530_port_set_vlan_unaware(ds, port);
 
+	mt7530_set(priv, MT7530_PSC_P(port), SA_DIS);
+
 	mutex_unlock(&priv->reg_mutex);
 }
 
@@ -1287,11 +1291,15 @@ mt7530_setup(struct dsa_switch *ds)
 		mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
 			   PCR_MATRIX_CLR);
 
-		if (dsa_is_cpu_port(ds, i))
+		if (dsa_is_cpu_port(ds, i)) {
 			mt7530_cpu_port_enable(priv, i);
-		else
+		} else {
 			mt7530_port_disable(ds, i, NULL);
 
+			/* Disable learning by default on all user ports */
+			mt7530_set(priv, MT7530_PSC_P(i), SA_DIS);
+		}
+
 		/* Enable consistent egress tag */
 		mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK,
 			   PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
-- 
2.25.1


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-08-24  5:55 [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports DENG Qingfang
@ 2021-08-24 15:29 ` Sasha Levin
  2021-08-24 15:57   ` DENG Qingfang
  0 siblings, 1 reply; 8+ messages in thread
From: Sasha Levin @ 2021-08-24 15:29 UTC (permalink / raw)
  To: DENG Qingfang
  Cc: stable, Sean Wang, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Tue, Aug 24, 2021 at 01:55:08PM +0800, DENG Qingfang wrote:
>This is a partial backport of commit 5a30833b9a16f8d1aa15de06636f9317ca51f9df
>("net: dsa: mt7530: support MDB and bridge flag operations") upstream.
>
>Make sure that the standalone ports start up with learning disabled.

What's the reasoning behind:

1. Backporting this patch?
2. A partial backport of this patch?

-- 
Thanks,
Sasha

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-08-24 15:29 ` Sasha Levin
@ 2021-08-24 15:57   ` DENG Qingfang
  2021-08-27 10:19     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: DENG Qingfang @ 2021-08-24 15:57 UTC (permalink / raw)
  To: Sasha Levin
  Cc: stable, Sean Wang, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

Hi Sasha,

On Tue, Aug 24, 2021 at 11:29 PM Sasha Levin <sashal@kernel.org> wrote:
> What's the reasoning behind:
>
> 1. Backporting this patch?

Standalone ports should have address learning disabled, according to
the documentation:
https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags
function so it has to be done differently.

I've identified an issue related to this.

> 2. A partial backport of this patch?

The other part does not actually fix anything.

>
> --
> Thanks,
> Sasha

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-08-24 15:57   ` DENG Qingfang
@ 2021-08-27 10:19     ` Greg KH
  2021-09-02  5:36       ` DENG Qingfang
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2021-08-27 10:19 UTC (permalink / raw)
  To: DENG Qingfang
  Cc: Sasha Levin, stable, Sean Wang, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Tue, Aug 24, 2021 at 11:57:53PM +0800, DENG Qingfang wrote:
> Hi Sasha,
> 
> On Tue, Aug 24, 2021 at 11:29 PM Sasha Levin <sashal@kernel.org> wrote:
> > What's the reasoning behind:
> >
> > 1. Backporting this patch?
> 
> Standalone ports should have address learning disabled, according to
> the documentation:
> https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
> dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags
> function so it has to be done differently.
> 
> I've identified an issue related to this.

What issue is that?  Where was it reported?

> > 2. A partial backport of this patch?
> 
> The other part does not actually fix anything.

Then why is it not ok to just take the whole thing?

When backporting not-identical-patches, something almost always goes
wrong, so we prefer to take the original commit when ever possible.

thanks,

greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-08-27 10:19     ` Greg KH
@ 2021-09-02  5:36       ` DENG Qingfang
  2021-09-02  5:58         ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: DENG Qingfang @ 2021-09-02  5:36 UTC (permalink / raw)
  To: Greg KH
  Cc: Sasha Levin, stable, Sean Wang, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Fri, Aug 27, 2021 at 12:19:23PM +0200, Greg KH wrote:
> On Tue, Aug 24, 2021 at 11:57:53PM +0800, DENG Qingfang wrote:
> > Standalone ports should have address learning disabled, according to
> > the documentation:
> > https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
> > dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags
> > function so it has to be done differently.
> > 
> > I've identified an issue related to this.
> 
> What issue is that?  Where was it reported?

See Florian's message here
https://lore.kernel.org/stable/20210317003549.3964522-2-f.fainelli@gmail.com/

> 
> > > 2. A partial backport of this patch?
> > 
> > The other part does not actually fix anything.
> 
> Then why is it not ok to just take the whole thing?
> 
> When backporting not-identical-patches, something almost always goes
> wrong, so we prefer to take the original commit when ever possible.

Okay. MDB and tag ops can be backported as is, and broadcast/multicast
flooding can be implemented in .port_egress_floods. 

> 
> thanks,
> 
> greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-09-02  5:36       ` DENG Qingfang
@ 2021-09-02  5:58         ` Greg KH
  2021-09-03  9:14           ` DENG Qingfang
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2021-09-02  5:58 UTC (permalink / raw)
  To: DENG Qingfang
  Cc: Sasha Levin, stable, Sean Wang, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Sep 02, 2021 at 01:36:19PM +0800, DENG Qingfang wrote:
> On Fri, Aug 27, 2021 at 12:19:23PM +0200, Greg KH wrote:
> > On Tue, Aug 24, 2021 at 11:57:53PM +0800, DENG Qingfang wrote:
> > > Standalone ports should have address learning disabled, according to
> > > the documentation:
> > > https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
> > > dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags
> > > function so it has to be done differently.
> > > 
> > > I've identified an issue related to this.
> > 
> > What issue is that?  Where was it reported?
> 
> See Florian's message here
> https://lore.kernel.org/stable/20210317003549.3964522-2-f.fainelli@gmail.com/

THat is just the patch changelog text, or is it unique to this
stable-only patch?  It is not obvious at all.

> > > > 2. A partial backport of this patch?
> > > 
> > > The other part does not actually fix anything.
> > 
> > Then why is it not ok to just take the whole thing?
> > 
> > When backporting not-identical-patches, something almost always goes
> > wrong, so we prefer to take the original commit when ever possible.
> 
> Okay. MDB and tag ops can be backported as is, and broadcast/multicast
> flooding can be implemented in .port_egress_floods. 

So what are we supposed to do here?

totally confused,

greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-09-02  5:58         ` Greg KH
@ 2021-09-03  9:14           ` DENG Qingfang
  2021-09-07 15:18             ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: DENG Qingfang @ 2021-09-03  9:14 UTC (permalink / raw)
  To: Greg KH
  Cc: Sasha Levin, stable, Sean Wang, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Sep 02, 2021 at 07:58:37AM +0200, Greg KH wrote:
> On Thu, Sep 02, 2021 at 01:36:19PM +0800, DENG Qingfang wrote:
> > On Fri, Aug 27, 2021 at 12:19:23PM +0200, Greg KH wrote:
> > > On Tue, Aug 24, 2021 at 11:57:53PM +0800, DENG Qingfang wrote:
> > > > Standalone ports should have address learning disabled, according to
> > > > the documentation:
> > > > https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
> > > > dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags
> > > > function so it has to be done differently.
> > > > 
> > > > I've identified an issue related to this.
> > > 
> > > What issue is that?  Where was it reported?
> > 
> > See Florian's message here
> > https://lore.kernel.org/stable/20210317003549.3964522-2-f.fainelli@gmail.com/
> 
> THat is just the patch changelog text, or is it unique to this
> stable-only patch?  It is not obvious at all.

The issue is with all DSA drivers that do not disable address learning
on standalone ports.

"With learning enabled we would end up with the switch having
incorrectly learned the address of the CPU port which typically results
in a complete break down of network connectivity until the address
learned ages out and gets re-learned, from the correct port this time."

> 
> > > > > 2. A partial backport of this patch?
> > > > 
> > > > The other part does not actually fix anything.
> > > 
> > > Then why is it not ok to just take the whole thing?
> > > 
> > > When backporting not-identical-patches, something almost always goes
> > > wrong, so we prefer to take the original commit when ever possible.
> > 
> > Okay. MDB and tag ops can be backported as is, and broadcast/multicast
> > flooding can be implemented in .port_egress_floods. 
> 
> So what are we supposed to do here?

Function port_egress_floods is refactored to port_bridge_flags in commit
a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags"). I can
backport the mt7530_port_bridge_flags function as port_egress_floods.

> 
> totally confused,
> 
> greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports
  2021-09-03  9:14           ` DENG Qingfang
@ 2021-09-07 15:18             ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2021-09-07 15:18 UTC (permalink / raw)
  To: DENG Qingfang
  Cc: Sasha Levin, stable, Sean Wang, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, David S. Miller, Matthias Brugger,
	open list:MEDIATEK SWITCH DRIVER, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Fri, Sep 03, 2021 at 05:14:30PM +0800, DENG Qingfang wrote:
> On Thu, Sep 02, 2021 at 07:58:37AM +0200, Greg KH wrote:
> > On Thu, Sep 02, 2021 at 01:36:19PM +0800, DENG Qingfang wrote:
> > > On Fri, Aug 27, 2021 at 12:19:23PM +0200, Greg KH wrote:
> > > > On Tue, Aug 24, 2021 at 11:57:53PM +0800, DENG Qingfang wrote:
> > > > > Standalone ports should have address learning disabled, according to
> > > > > the documentation:
> > > > > https://www.kernel.org/doc/html/v5.14-rc7/networking/dsa/dsa.html#bridge-layer
> > > > > dsa_switch_ops on 5.10 or earlier does not have .port_bridge_flags
> > > > > function so it has to be done differently.
> > > > > 
> > > > > I've identified an issue related to this.
> > > > 
> > > > What issue is that?  Where was it reported?
> > > 
> > > See Florian's message here
> > > https://lore.kernel.org/stable/20210317003549.3964522-2-f.fainelli@gmail.com/
> > 
> > THat is just the patch changelog text, or is it unique to this
> > stable-only patch?  It is not obvious at all.
> 
> The issue is with all DSA drivers that do not disable address learning
> on standalone ports.
> 
> "With learning enabled we would end up with the switch having
> incorrectly learned the address of the CPU port which typically results
> in a complete break down of network connectivity until the address
> learned ages out and gets re-learned, from the correct port this time."
> 
> > 
> > > > > > 2. A partial backport of this patch?
> > > > > 
> > > > > The other part does not actually fix anything.
> > > > 
> > > > Then why is it not ok to just take the whole thing?
> > > > 
> > > > When backporting not-identical-patches, something almost always goes
> > > > wrong, so we prefer to take the original commit when ever possible.
> > > 
> > > Okay. MDB and tag ops can be backported as is, and broadcast/multicast
> > > flooding can be implemented in .port_egress_floods. 
> > 
> > So what are we supposed to do here?
> 
> Function port_egress_floods is refactored to port_bridge_flags in commit
> a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags"). I can
> backport the mt7530_port_bridge_flags function as port_egress_floods.

I am sorry, I still do not understand what to do here.

Ideally we want to take the original patches as get merged into Linus's
tree.  If that is not possible for some reason, we need to have it
documented very well why that is so, and to get everyone to agree with
the different patch that is submitted.

thanks,

greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

end of thread, other threads:[~2021-09-07 15:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  5:55 [PATCH 4.19.y] net: dsa: mt7530: disable learning on standalone ports DENG Qingfang
2021-08-24 15:29 ` Sasha Levin
2021-08-24 15:57   ` DENG Qingfang
2021-08-27 10:19     ` Greg KH
2021-09-02  5:36       ` DENG Qingfang
2021-09-02  5:58         ` Greg KH
2021-09-03  9:14           ` DENG Qingfang
2021-09-07 15:18             ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).