Skip to contentSkip to conversation

net: dsa: felix: fix incorrect clamp calculation for burst

PATCH Applied Colin King 3 participants 3 messages May 14, 2020 – May 15, 2020

Subsystems (5)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 net: dsa: felix: fix incorrect clamp calculation for burst

From: Colin Ian King <[email protected]>

Currently burst is clamping on rate and not burst, the assignment of burst from the clamping discards the previous assignment of burst. This looks like a cut-n-paste error from the previous clamping calculation on ramp. Fix this by replacing ramp with burst.

Addresses-Coverity: ("Unused value")

Fixes 0fbabf875d18 ("net: dsa: felix: add support Credit Based Shaper(CBS) for hardware offload")
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -1
index df4498c0e864..85e34d85cc51 100644
@@ -1360,7 +1360,7 @@ static int vsc9959_qos_port_cbs_set(struct dsa_switch *ds, int port,
 	/* Burst unit is 4kB */
 	burst = DIV_ROUND_UP(cbs_qopt->hicredit, 4096);
 	/* Avoid using zero burst size */
-	burst = clamp_t(u32, rate, 1, GENMASK(5, 0));
+	burst = clamp_t(u32, burst, 1, GENMASK(5, 0));
 	ocelot_write_gix(ocelot,
 			 QSYS_CIR_CFG_CIR_RATE(rate) |
 			 QSYS_CIR_CFG_CIR_BURST(burst),
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Colin,

Quoted 8 lines · Colin King

From: Colin Ian King <[email protected]>

Currently burst is clamping on rate and not burst, the assignment of burst from the clamping discards the previous assignment of burst. This looks like a cut-n-paste error from the previous clamping calculation on ramp. Fix this by replacing ramp with burst.

Quoted 4 lines

Addresses-Coverity: ("Unused value")

Fixes 0fbabf875d18 ("net: dsa: felix: add support Credit Based Shaper(CBS) for hardware offload")

---

Quoted 17 lines
 drivers/net/dsa/ocelot/felix_vsc9959.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -2
index df4498c0e864..85e34d85cc51 100644
@@ -1360,7 +1360,7 @@ static int vsc9959_qos_port_cbs_set(struct dsa_switch *ds, int port,
        /* Burst unit is 4kB */
        burst = DIV_ROUND_UP(cbs_qopt->hicredit, 4096);
        /* Avoid using zero burst size */
-       burst = clamp_t(u32, rate, 1, GENMASK(5, 0));
+       burst = clamp_t(u32, burst, 1, GENMASK(5, 0));
        ocelot_write_gix(ocelot,
                         QSYS_CIR_CFG_CIR_RATE(rate) |
                         QSYS_CIR_CFG_CIR_BURST(burst),
--
Quoted 2 lines

2.25.1

Thanks!
-Vladimir

maintainer Applied
#2 lore raw
In reply to Colin King

From: Colin King <[email protected]>
Date: Thu, 14 May 2020 19:33:02 +0100

Quoted 10 lines

From: Colin Ian King <[email protected]>

Currently burst is clamping on rate and not burst, the assignment of burst from the clamping discards the previous assignment of burst. This looks like a cut-n-paste error from the previous clamping calculation on ramp. Fix this by replacing ramp with burst.

Addresses-Coverity: ("Unused value")

Fixes 0fbabf875d18 ("net: dsa: felix: add support Credit Based Shaper(CBS) for hardware offload")

Applied.