Re: [PATCH net] net: dsa: felix: fix taprio guard band overflow at 10Mbps with jumbo frames

From: Vladimir Oltean
Date: Wed Jun 14 2023 - 08:18:13 EST


On Wed, Jun 14, 2023 at 02:05:15PM +0200, Simon Horman wrote:
> Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>

Thanks.

> In a similar vein, you may want to consider the following suggestion from
> Coccinelle.
>
> .../felix_vsc9959.c:1382:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>

Yeah, but there, there's an earlier restriction for cycle_time to never
exceed NSEC_PER_SEC (1000000000L) which fits on 32 bits.

Nonetheless, it is a good reminder that there are too many disjoint
places in the kernel already that open-code the logic to advance a
taprio base time. It would indeed be good to consolidate all of those
into a static inline function offered by include/net/pkt_sched.h, which
is also warning-free.