diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-06-28 17:52:38 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-06-30 21:18:16 -0700 |
commit | 837ced3a1a5d8bb1a637dd584711f31ae6b54d93 (patch) | |
tree | 5ff0dddc936cd8561624623fe3ae925492460bff /drivers/net/dsa | |
parent | 55a515b1f5a97df5704a1788fe97a4a740be2b9e (diff) | |
download | linux-837ced3a1a5d8bb1a637dd584711f31ae6b54d93.tar.bz2 |
time64.h: consolidate uses of PSEC_PER_NSEC
Time-sensitive networking code needs to work with PTP times expressed in
nanoseconds, and with packet transmission times expressed in
picoseconds, since those would be fractional at higher than gigabit
speed when expressed in nanoseconds.
Convert the existing uses in tc-taprio and the ocelot/felix DSA driver
to a PSEC_PER_NSEC macro. This macro is placed in include/linux/time64.h
as opposed to its relatives (PSEC_PER_SEC etc) from include/vdso/time64.h
because the vDSO library does not (yet) need/use it.
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com> # for the vDSO parts
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/ocelot/felix_vsc9959.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index f51d9d5f0d82..61ed317602e7 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -16,6 +16,7 @@ #include <linux/iopoll.h> #include <linux/mdio.h> #include <linux/pci.h> +#include <linux/time.h> #include "felix.h" #define VSC9959_NUM_PORTS 6 @@ -1235,7 +1236,7 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) u32 max_sdu; if (min_gate_len[tc] == U64_MAX /* Gate always open */ || - min_gate_len[tc] * 1000 > needed_bit_time_ps) { + min_gate_len[tc] * PSEC_PER_NSEC > needed_bit_time_ps) { /* Setting QMAXSDU_CFG to 0 disables oversized frame * dropping. */ @@ -1249,7 +1250,7 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) * frame, make sure to enable oversize frame dropping * for frames larger than the smallest that would fit. */ - max_sdu = div_u64(min_gate_len[tc] * 1000, + max_sdu = div_u64(min_gate_len[tc] * PSEC_PER_NSEC, picos_per_byte); /* A TC gate may be completely closed, which is a * special case where all packets are oversized. |