* [PATCH net] net: dsa: mv88e6xxx: Fix counting of ATU violations
@ 2019-02-05 23:02 Andrew Lunn
2019-02-06 0:38 ` David Miller
2019-02-06 18:28 ` Vivien Didelot
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-02-05 23:02 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Florian Fainelli, Andrew Lunn
The ATU port vector contains a bit per port of the switch. The code
wrongly used it as a port number, and incremented a port counter. This
resulted in the wrong interfaces counter being incremented, and
potentially going off the end of the array of ports.
Fix this by using the source port ID for the violation, which really
is a port number.
Reported-by: Chris Healy <Chris.Healy@zii.aero>
Tested-by: Chris Healy <Chris.Healy@zii.aero>
Fixes: 65f60e4582bd ("net: dsa: mv88e6xxx: Keep ATU/VTU violation statistics")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/mv88e6xxx/global1_atu.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/global1_atu.c b/drivers/net/dsa/mv88e6xxx/global1_atu.c
index 5200e4bdce93..ea243840ee0f 100644
--- a/drivers/net/dsa/mv88e6xxx/global1_atu.c
+++ b/drivers/net/dsa/mv88e6xxx/global1_atu.c
@@ -314,6 +314,7 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
{
struct mv88e6xxx_chip *chip = dev_id;
struct mv88e6xxx_atu_entry entry;
+ int spid;
int err;
u16 val;
@@ -336,6 +337,8 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
if (err)
goto out;
+ spid = entry.state;
+
if (val & MV88E6XXX_G1_ATU_OP_AGE_OUT_VIOLATION) {
dev_err_ratelimited(chip->dev,
"ATU age out violation for %pM\n",
@@ -344,23 +347,23 @@ static irqreturn_t mv88e6xxx_g1_atu_prob_irq_thread_fn(int irq, void *dev_id)
if (val & MV88E6XXX_G1_ATU_OP_MEMBER_VIOLATION) {
dev_err_ratelimited(chip->dev,
- "ATU member violation for %pM portvec %x\n",
- entry.mac, entry.portvec);
- chip->ports[entry.portvec].atu_member_violation++;
+ "ATU member violation for %pM portvec %x spid %d\n",
+ entry.mac, entry.portvec, spid);
+ chip->ports[spid].atu_member_violation++;
}
if (val & MV88E6XXX_G1_ATU_OP_MISS_VIOLATION) {
dev_err_ratelimited(chip->dev,
- "ATU miss violation for %pM portvec %x\n",
- entry.mac, entry.portvec);
- chip->ports[entry.portvec].atu_miss_violation++;
+ "ATU miss violation for %pM portvec %x spid %d\n",
+ entry.mac, entry.portvec, spid);
+ chip->ports[spid].atu_miss_violation++;
}
if (val & MV88E6XXX_G1_ATU_OP_FULL_VIOLATION) {
dev_err_ratelimited(chip->dev,
- "ATU full violation for %pM portvec %x\n",
- entry.mac, entry.portvec);
- chip->ports[entry.portvec].atu_full_violation++;
+ "ATU full violation for %pM portvec %x spid %d\n",
+ entry.mac, entry.portvec, spid);
+ chip->ports[spid].atu_full_violation++;
}
mutex_unlock(&chip->reg_lock);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: dsa: mv88e6xxx: Fix counting of ATU violations
2019-02-05 23:02 [PATCH net] net: dsa: mv88e6xxx: Fix counting of ATU violations Andrew Lunn
@ 2019-02-06 0:38 ` David Miller
2019-02-06 18:28 ` Vivien Didelot
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-02-06 0:38 UTC (permalink / raw)
To: andrew; +Cc: netdev, f.fainelli
From: Andrew Lunn <andrew@lunn.ch>
Date: Wed, 6 Feb 2019 00:02:58 +0100
> The ATU port vector contains a bit per port of the switch. The code
> wrongly used it as a port number, and incremented a port counter. This
> resulted in the wrong interfaces counter being incremented, and
> potentially going off the end of the array of ports.
>
> Fix this by using the source port ID for the violation, which really
> is a port number.
>
> Reported-by: Chris Healy <Chris.Healy@zii.aero>
> Tested-by: Chris Healy <Chris.Healy@zii.aero>
> Fixes: 65f60e4582bd ("net: dsa: mv88e6xxx: Keep ATU/VTU violation statistics")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Applied and queued up for -stable, thanks Andrew.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: dsa: mv88e6xxx: Fix counting of ATU violations
2019-02-05 23:02 [PATCH net] net: dsa: mv88e6xxx: Fix counting of ATU violations Andrew Lunn
2019-02-06 0:38 ` David Miller
@ 2019-02-06 18:28 ` Vivien Didelot
1 sibling, 0 replies; 3+ messages in thread
From: Vivien Didelot @ 2019-02-06 18:28 UTC (permalink / raw)
To: Andrew Lunn; +Cc: David Miller, netdev, Florian Fainelli, Andrew Lunn
Hi Andrew,
On Wed, 6 Feb 2019 00:02:58 +0100, Andrew Lunn <andrew@lunn.ch> wrote:
> The ATU port vector contains a bit per port of the switch. The code
> wrongly used it as a port number, and incremented a port counter. This
> resulted in the wrong interfaces counter being incremented, and
> potentially going off the end of the array of ports.
>
> Fix this by using the source port ID for the violation, which really
> is a port number.
>
> Reported-by: Chris Healy <Chris.Healy@zii.aero>
> Tested-by: Chris Healy <Chris.Healy@zii.aero>
> Fixes: 65f60e4582bd ("net: dsa: mv88e6xxx: Keep ATU/VTU violation statistics")
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Hey I guess you forgot to Cc me on this one. FWIW:
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-06 18:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 23:02 [PATCH net] net: dsa: mv88e6xxx: Fix counting of ATU violations Andrew Lunn
2019-02-06 0:38 ` David Miller
2019-02-06 18:28 ` Vivien Didelot
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).