Thread (12 messages) flat view 12 messages, 5 authors, 2020-05-12

RE: [EXT] Re: [PATCH v1 net-next 3/3] net: dsa: felix: add support Credit Based Shaper(CBS) for hardware offload

From: Xiaoliang Yang <hidden>
Date: 2020-05-12 09:18:05
Also in: lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help