Hi Vinicius,
On Tue, 12 May 2020 9:42:23 Vinicius Costa Gomes wrote:
quoted
+
+ /* Rate unit is 100 kbps */
+ cir = DIV_ROUND_UP(cbs_qopt->idleslope, 100);
+ cir = (cir ? cir : 1);
+ cir = min_t(u32, GENMASK(14, 0), cir);
Please rename 'cir' to "rate" or "idleslope".
Also consider using clamp_t here and below (I just found out about it).
quoted
+ /* Burst unit is 4kB */
+ cbs = DIV_ROUND_UP(cbs_qopt->hicredit, 4096);
+ /* Avoid using zero burst size */
+ cbs = (cbs ? cbs : 1);
+ cbs = min_t(u32, GENMASK(5, 0), cbs);
And please(!) rename 'cbs' to "burst" or "hicredit". Re-using the name "cbs" with a completely different meaning here is confusing.
I will update this, using clamp_t seems more concise in the codes.
Regards,
Xiaoliang