linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations
@ 2019-09-26  8:59 Michal Vokáč
  2019-09-30 13:34 ` Michal Vokáč
  2019-09-30 18:06 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Vokáč @ 2019-09-26  8:59 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, netdev
  Cc: Vivien Didelot, linux-kernel, Florian Fainelli, Heiner Kallweit,
	Michal Vokáč

The QCA8K family supports up to 7 ports. So use the existing
QCA8K_NUM_PORTS define to allocate the switch structure and limit all
operations with the switch ports.

This was not an issue until commit 0394a63acfe2 ("net: dsa: enable and
disable all ports") disabled all unused ports. Since the unused ports 7-11
are outside of the correct register range on this switch some registers
were rewritten with invalid content.

Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family")
Fixes: a0c02161ecfc ("net: dsa: variable number of ports")
Fixes: 0394a63acfe2 ("net: dsa: enable and disable all ports")
Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
I am not sure which of the fixes tags should be used but this definetelly
fixes something..

IMHO the 0394a63acfe2 ("net: dsa: enable and disable all ports") did not
cause the issue but made it visible.

 drivers/net/dsa/qca8k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 16f15c93a102..bbeeb8618c80 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -705,7 +705,7 @@ qca8k_setup(struct dsa_switch *ds)
 		    BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
 
 	/* Setup connection between CPU port & user ports */
-	for (i = 0; i < DSA_MAX_PORTS; i++) {
+	for (i = 0; i < QCA8K_NUM_PORTS; i++) {
 		/* CPU port gets connected to all user ports of the switch */
 		if (dsa_is_cpu_port(ds, i)) {
 			qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
@@ -1074,7 +1074,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
 	if (id != QCA8K_ID_QCA8337)
 		return -ENODEV;
 
-	priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
+	priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS);
 	if (!priv->ds)
 		return -ENOMEM;
 
-- 
2.1.4


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

* Re: [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations
  2019-09-26  8:59 [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations Michal Vokáč
@ 2019-09-30 13:34 ` Michal Vokáč
  2019-09-30 13:46   ` Andrew Lunn
  2019-09-30 18:06 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Vokáč @ 2019-09-30 13:34 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, netdev
  Cc: Vivien Didelot, linux-kernel, Florian Fainelli, Heiner Kallweit

On 26. 09. 19 10:59, Michal Vokáč wrote:
> The QCA8K family supports up to 7 ports. So use the existing
> QCA8K_NUM_PORTS define to allocate the switch structure and limit all
> operations with the switch ports.
> 
> This was not an issue until commit 0394a63acfe2 ("net: dsa: enable and
> disable all ports") disabled all unused ports. Since the unused ports 7-11
> are outside of the correct register range on this switch some registers
> were rewritten with invalid content.
> 
> Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family")
> Fixes: a0c02161ecfc ("net: dsa: variable number of ports")
> Fixes: 0394a63acfe2 ("net: dsa: enable and disable all ports")
> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>

More recent patches on the list are getting attention.
Is this one falling through the cracks?

> ---
> I am not sure which of the fixes tags should be used but this definetelly
> fixes something..
> 
> IMHO the 0394a63acfe2 ("net: dsa: enable and disable all ports") did not
> cause the issue but made it visible.
> 
>   drivers/net/dsa/qca8k.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
> index 16f15c93a102..bbeeb8618c80 100644
> --- a/drivers/net/dsa/qca8k.c
> +++ b/drivers/net/dsa/qca8k.c
> @@ -705,7 +705,7 @@ qca8k_setup(struct dsa_switch *ds)
>   		    BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
>   
>   	/* Setup connection between CPU port & user ports */
> -	for (i = 0; i < DSA_MAX_PORTS; i++) {
> +	for (i = 0; i < QCA8K_NUM_PORTS; i++) {
>   		/* CPU port gets connected to all user ports of the switch */
>   		if (dsa_is_cpu_port(ds, i)) {
>   			qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
> @@ -1074,7 +1074,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
>   	if (id != QCA8K_ID_QCA8337)
>   		return -ENODEV;
>   
> -	priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS);
> +	priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS);
>   	if (!priv->ds)
>   		return -ENOMEM;
>   
> 


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

* Re: [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations
  2019-09-30 13:34 ` Michal Vokáč
@ 2019-09-30 13:46   ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2019-09-30 13:46 UTC (permalink / raw)
  To: Michal Vokáč
  Cc: David S. Miller, netdev, Vivien Didelot, linux-kernel,
	Florian Fainelli, Heiner Kallweit

On Mon, Sep 30, 2019 at 03:34:31PM +0200, Michal Vokáč wrote:
> On 26. 09. 19 10:59, Michal Vokáč wrote:
> > The QCA8K family supports up to 7 ports. So use the existing
> > QCA8K_NUM_PORTS define to allocate the switch structure and limit all
> > operations with the switch ports.
> > 
> > This was not an issue until commit 0394a63acfe2 ("net: dsa: enable and
> > disable all ports") disabled all unused ports. Since the unused ports 7-11
> > are outside of the correct register range on this switch some registers
> > were rewritten with invalid content.
> > 
> > Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family")
> > Fixes: a0c02161ecfc ("net: dsa: variable number of ports")
> > Fixes: 0394a63acfe2 ("net: dsa: enable and disable all ports")
> > Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> 
> More recent patches on the list are getting attention.
> Is this one falling through the cracks?

Probably not, it is missing a review-by, from somebody David trusts.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations
  2019-09-26  8:59 [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations Michal Vokáč
  2019-09-30 13:34 ` Michal Vokáč
@ 2019-09-30 18:06 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2019-09-30 18:06 UTC (permalink / raw)
  To: michal.vokac
  Cc: andrew, netdev, vivien.didelot, linux-kernel, f.fainelli, hkallweit1

From: Michal Vokáč <michal.vokac@ysoft.com>
Date: Thu, 26 Sep 2019 10:59:17 +0200

> The QCA8K family supports up to 7 ports. So use the existing
> QCA8K_NUM_PORTS define to allocate the switch structure and limit all
> operations with the switch ports.
> 
> This was not an issue until commit 0394a63acfe2 ("net: dsa: enable and
> disable all ports") disabled all unused ports. Since the unused ports 7-11
> are outside of the correct register range on this switch some registers
> were rewritten with invalid content.
> 
> Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family")
> Fixes: a0c02161ecfc ("net: dsa: variable number of ports")
> Fixes: 0394a63acfe2 ("net: dsa: enable and disable all ports")
> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>

Applied.

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

end of thread, other threads:[~2019-09-30 21:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26  8:59 [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations Michal Vokáč
2019-09-30 13:34 ` Michal Vokáč
2019-09-30 13:46   ` Andrew Lunn
2019-09-30 18:06 ` David Miller

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).