Re: [PATCH net v4 5/7] net: dsa: mt7530: fix handling of LLDP frames

From: Russell King (Oracle)
Date: Wed Jun 14 2023 - 12:36:14 EST


On Mon, Jun 12, 2023 at 10:59:43AM +0300, arinc9.unal@xxxxxxxxx wrote:
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index e4c169843f2e..8388b058fbe4 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -2261,7 +2261,11 @@ mt7530_setup(struct dsa_switch *ds)
>
> /* Trap BPDUs to the CPU port */
> mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
> - MT753X_BPDU_CPU_ONLY);
> + MT753X_PORT_FW_CPU_ONLY);
> +
> + /* Trap LLDP frames with :0E MAC DA to the CPU port */
> + mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
> + MT753X_R0E_PORT_FW(MT753X_PORT_FW_CPU_ONLY));
>
> /* Enable and reset MIB counters */
> mt7530_mib_reset(ds);
> @@ -2364,7 +2368,11 @@ mt7531_setup_common(struct dsa_switch *ds)
>
> /* Trap BPDUs to the CPU port(s) */
> mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
> - MT753X_BPDU_CPU_ONLY);
> + MT753X_PORT_FW_CPU_ONLY);
> +
> + /* Trap LLDP frames with :0E MAC DA to the CPU port(s) */
> + mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
> + MT753X_R0E_PORT_FW(MT753X_PORT_FW_CPU_ONLY));

Looking at the above two hunks, they look 100% identical. Given that
they are both setting up trapping to the CPU port, maybe they should
be moved into their own common function called from both setup()
functions?

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