[PATCH net v5 3/6] net: dsa: mt7530: fix handling of BPDUs on MT7530 switch

Vladimir Oltean olteanv at gmail.com
Fri Jun 16 03:11:08 PDT 2023


On Fri, Jun 16, 2023 at 05:53:24AM +0300, arinc9.unal at gmail.com wrote:
> From: Arınç ÜNAL <arinc.unal at arinc9.com>
> 
> BPDUs are link-local frames, therefore they must be trapped to the CPU
> port. Currently, the MT7530 switch treats BPDUs as regular multicast
> frames, therefore flooding them to user ports. To fix this, set BPDUs to be
> trapped to the CPU port.
> 
> Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
> Signed-off-by: Arınç ÜNAL <arinc.unal at arinc9.com>
> ---
>  drivers/net/dsa/mt7530.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index e9fbe7ae6c2c..7b72cf3a0e30 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -2262,6 +2262,10 @@ mt7530_setup(struct dsa_switch *ds)
>  
>  	priv->p6_interface = PHY_INTERFACE_MODE_NA;
>  
> +	/* Trap BPDUs to the CPU port */
> +	mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
> +		   MT753X_BPDU_CPU_ONLY);
> +
>  	/* Enable and reset MIB counters */
>  	mt7530_mib_reset(ds);
>  
> -- 
> 2.39.2
> 

Ok, so this issue dates back to v4.12, but the patch won't apply that
far due to the difference in patch context.

Since the definition itself of the MT753X_BPC register was added as part
of commit c288575f7810 ("net: dsa: mt7530: Add the support of MT7531
switch") - dated v5.10 - then this patch cannot be practically be
backported beyond that.

So I see no possible objection to the request I'm about to make, which is:
please group this and the identical logic from mt7531_setup() into a
common function and call that.



More information about the linux-arm-kernel mailing list