* [PATCH net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250
@ 2020-12-08 9:01 Rasmus Villemoes
2020-12-08 14:25 ` Andrew Lunn
2020-12-10 11:06 ` [PATCH net-next v2] " Rasmus Villemoes
0 siblings, 2 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2020-12-08 9:01 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, Vivien Didelot, Jakub Kicinski, David S. Miller,
Vladimir Oltean, Hubert Feurstein, Rasmus Villemoes
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;
+ }
return mv88e6xxx_g1_atu_set_age_time(chip, 300000);
}
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250
2020-12-08 9:01 [PATCH net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250 Rasmus Villemoes
@ 2020-12-08 14:25 ` Andrew Lunn
2020-12-10 11:06 ` [PATCH net-next v2] " Rasmus Villemoes
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2020-12-08 14:25 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: netdev, Vivien Didelot, Jakub Kicinski, David S. Miller,
Vladimir Oltean, Hubert Feurstein
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next v2] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250
2020-12-08 9:01 [PATCH net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250 Rasmus Villemoes
2020-12-08 14:25 ` Andrew Lunn
@ 2020-12-10 11:06 ` Rasmus Villemoes
2020-12-15 2:15 ` Jakub Kicinski
1 sibling, 1 reply; 4+ messages in thread
From: Rasmus Villemoes @ 2020-12-10 11:06 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S. Miller, Jakub Kicinski
Cc: Rasmus Villemoes, netdev, linux-kernel
The 6220 and 6250 switches do not have a learn2all bit in global1, ATU
control register; bit 3 is reserverd.
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>
---
v2: add comment explaining why ->port_setup_message_port is being used.
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 | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index d68074a2f240..2068f2759fc9 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1346,9 +1346,16 @@ 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;
+ /* The chips that have a "learn2all" bit in Global1, ATU
+ * Control are precisely those whose port registers have a
+ * Message Port bit in Port Control 1 and hence implement
+ * ->port_setup_message_port.
+ */
+ 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);
}
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v2] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250
2020-12-10 11:06 ` [PATCH net-next v2] " Rasmus Villemoes
@ 2020-12-15 2:15 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2020-12-15 2:15 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S. Miller, netdev, linux-kernel
On Thu, 10 Dec 2020 12:06:44 +0100 Rasmus Villemoes wrote:
> The 6220 and 6250 switches do not have a learn2all bit in global1, ATU
> control register; bit 3 is reserverd.
>
> 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>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-15 2:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 9:01 [PATCH net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250 Rasmus Villemoes
2020-12-08 14:25 ` Andrew Lunn
2020-12-10 11:06 ` [PATCH net-next v2] " Rasmus Villemoes
2020-12-15 2:15 ` Jakub Kicinski
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.