]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
octeontx2-pf: tc: fix egress ratelimiting
authorHariprasad Kelam <hkelam@marvell.com>
Fri, 17 Jul 2026 08:43:49 +0000 (14:13 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Jul 2026 15:30:07 +0000 (08:30 -0700)
commitbb0d96ebe5f4d1acccf4dc36ca7f01f9a8fa1ba1
treed12c5947a0f96f82e339c4d101ad1a0e34455b4b
parent1087ba5497ae84281750da0020c30a9074782714
octeontx2-pf: tc: fix egress ratelimiting

The egress rate calculation computes an incorrect mantissa and exponent,
causing up to ~50% deviation from the configured rate at lower speeds.

Rework the computation to follow the hardware rate formula:

rate = 2 * (1 + mantissa/256) * 2^exp / (1 << div_exp)

Keep div_exp = 0 and derive exp and mantissa from half of the requested
rate. Rates below 2 Mbps are floored to the smallest encodable step
(exp = 0, mantissa = 0).

Fixes: e638a83f167e ("octeontx2-pf: TC_MATCHALL egress ratelimiting offload")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Nitin Shetty J <nshettyj@marvell.com>
Link: https://patch.msgid.link/20260717084349.2227796-1-nshettyj@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c