On Fri, Dec 01, 2023 at 03:57:59PM +0200, Roger Quadros wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c
index 49ae9d1cd948..2733bac55bfa 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-qos.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c
@@ -15,6 +15,8 @@
#include "am65-cpts.h"
#include "cpsw_ale.h"
+#define TO_MBPS(x) ((x) * 8 / 1000000)
Can be rewritten as ((x) * BITS_PER_BYTE / MEGA)
and further as ((x) / BYTES_PER_MBIT).
Also, I wonder if it wouldn't be better to do a DIV_ROUND_UP(x, BYTES_PER_MBIT)
instead. When user space requests a certain bandwidth, it expects to get it.
If the hardware is not fine grained enough, it should prefer giving it slightly
more rather than slightly less.