Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Colin Ian King and committed by
David S. Miller
b014d043 140ad6c8

+1 -1
+1 -1
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 1360 1360 /* Burst unit is 4kB */ 1361 1361 burst = DIV_ROUND_UP(cbs_qopt->hicredit, 4096); 1362 1362 /* Avoid using zero burst size */ 1363 - burst = clamp_t(u32, rate, 1, GENMASK(5, 0)); 1363 + burst = clamp_t(u32, burst, 1, GENMASK(5, 0)); 1364 1364 ocelot_write_gix(ocelot, 1365 1365 QSYS_CIR_CFG_CIR_RATE(rate) | 1366 1366 QSYS_CIR_CFG_CIR_BURST(burst),