Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: felix: re-enable TAS guard band mode

Commit 316bcffe4479 ("net: dsa: felix: disable always guard band bit for
TAS config") disabled the guard band and broke 802.3Qbv compliance.

There are two issues here:
(1) Without the guard band the end of the scheduling window could be
overrun by a frame in transit.
(2) Frames that don't fit into a configured window will still be sent.

The reason for both issues is that the switch will schedule the _start_
of a frame transmission inside the predefined window without taking the
length of the frame into account. Thus, we'll need the guard band which
will close the gate early, so that a complete frame can still be sent.
Revert the commit and add a note.

For a lengthy discussion see [1].

[1] https://lore.kernel.org/netdev/c7618025da6723418c56a54fe4683bd7@walle.cc/

Fixes: 316bcffe4479 ("net: dsa: felix: disable always guard band bit for TAS config")
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michael Walle and committed by
David S. Miller
297c4de6 3058e01d

+10 -5
+10 -5
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 1227 1227 if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX) 1228 1228 return -ERANGE; 1229 1229 1230 - /* Set port num and disable ALWAYS_GUARD_BAND_SCH_Q, which means set 1231 - * guard band to be implemented for nonschedule queues to schedule 1232 - * queues transition. 1230 + /* Enable guard band. The switch will schedule frames without taking 1231 + * their length into account. Thus we'll always need to enable the 1232 + * guard band which reserves the time of a maximum sized frame at the 1233 + * end of the time window. 1234 + * 1235 + * Although the ALWAYS_GUARD_BAND_SCH_Q bit is global for all ports, we 1236 + * need to set PORT_NUM, because subsequent writes to PARAM_CFG_REG_n 1237 + * operate on the port number. 1233 1238 */ 1234 - ocelot_rmw(ocelot, 1235 - QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port), 1239 + ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port) | 1240 + QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q, 1236 1241 QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M | 1237 1242 QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q, 1238 1243 QSYS_TAS_PARAM_CFG_CTRL);