diff mbox series

[net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250

Message ID 20201208090109.363-1-rasmus.villemoes@prevas.dk (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Rasmus Villemoes Dec. 8, 2020, 9:01 a.m. UTC
The 6220 and 6250 switches do not have a learn2all bit in global1, ATU
control register; bit 3 is reserved.

On the switches that do have that bit, it is used to control whether
learning frames are sent out the ports that have the message_port bit
set. So rather than adding yet another chip method, use the existence
of the ->port_setup_message_port method as a proxy for determining
whether the learn2all bit exists (and should be set).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---

This doesn't fix anything from what I can tell, in particular not the
VLAN problems I'm having, so just tagging for net-next. But I do think
it's worth it on the general principle of not poking around in
undocumented/reserved bits.

 drivers/net/dsa/mv88e6xxx/chip.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Andrew Lunn Dec. 8, 2020, 2:25 p.m. UTC | #1
On Tue, Dec 08, 2020 at 10:01:09AM +0100, Rasmus Villemoes wrote:
> The 6220 and 6250 switches do not have a learn2all bit in global1, ATU
> control register; bit 3 is reserved.
> 
> On the switches that do have that bit, it is used to control whether
> learning frames are sent out the ports that have the message_port bit
> set. So rather than adding yet another chip method, use the existence
> of the ->port_setup_message_port method as a proxy for determining
> whether the learn2all bit exists (and should be set).
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
> 
> This doesn't fix anything from what I can tell, in particular not the
> VLAN problems I'm having, so just tagging for net-next. But I do think
> it's worth it on the general principle of not poking around in
> undocumented/reserved bits.
> 
>  drivers/net/dsa/mv88e6xxx/chip.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 25449f634889..0245f3dfc1cd 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -1347,9 +1347,11 @@ static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip)
>  	if (err)
>  		return err;
>  
> -	err = mv88e6xxx_g1_atu_set_learn2all(chip, true);
> -	if (err)
> -		return err;
> +	if (chip->info->ops->port_setup_message_port) {
> +		err = mv88e6xxx_g1_atu_set_learn2all(chip, true);
> +		if (err)
> +			return err;
> +	}

Hi Rasmus

This needs a comment in the code explaining why this odd structure is
used.

	Andrew
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 25449f634889..0245f3dfc1cd 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1347,9 +1347,11 @@  static int mv88e6xxx_atu_setup(struct mv88e6xxx_chip *chip)
 	if (err)
 		return err;
 
-	err = mv88e6xxx_g1_atu_set_learn2all(chip, true);
-	if (err)
-		return err;
+	if (chip->info->ops->port_setup_message_port) {
+		err = mv88e6xxx_g1_atu_set_learn2all(chip, true);
+		if (err)
+			return err;
+	}
 
 	return mv88e6xxx_g1_atu_set_age_time(chip, 300000);
 }