linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: felix: re-enable TAS guard band mode
@ 2021-05-10 11:07 Michael Walle
  2021-05-10 12:23 ` Vladimir Oltean
  2021-05-10 21:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Walle @ 2021-05-10 11:07 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S . Miller, Jakub Kicinski, Xiaoliang Yang, Michael Walle

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>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 2473bebe48e6..f966a253d1c7 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -1227,12 +1227,17 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
 	if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX)
 		return -ERANGE;
 
-	/* Set port num and disable ALWAYS_GUARD_BAND_SCH_Q, which means set
-	 * guard band to be implemented for nonschedule queues to schedule
-	 * queues transition.
+	/* Enable guard band. The switch will schedule frames without taking
+	 * their length into account. Thus we'll always need to enable the
+	 * guard band which reserves the time of a maximum sized frame at the
+	 * end of the time window.
+	 *
+	 * Although the ALWAYS_GUARD_BAND_SCH_Q bit is global for all ports, we
+	 * need to set PORT_NUM, because subsequent writes to PARAM_CFG_REG_n
+	 * operate on the port number.
 	 */
-	ocelot_rmw(ocelot,
-		   QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port),
+	ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port) |
+		   QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q,
 		   QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M |
 		   QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q,
 		   QSYS_TAS_PARAM_CFG_CTRL);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: dsa: felix: re-enable TAS guard band mode
  2021-05-10 11:07 [PATCH net] net: dsa: felix: re-enable TAS guard band mode Michael Walle
@ 2021-05-10 12:23 ` Vladimir Oltean
  2021-05-10 21:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2021-05-10 12:23 UTC (permalink / raw)
  To: Michael Walle
  Cc: netdev, linux-kernel, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	David S . Miller, Jakub Kicinski, Xiaoliang Yang

On Mon, May 10, 2021 at 01:07:08PM +0200, Michael Walle wrote:
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: dsa: felix: re-enable TAS guard band mode
  2021-05-10 11:07 [PATCH net] net: dsa: felix: re-enable TAS guard band mode Michael Walle
  2021-05-10 12:23 ` Vladimir Oltean
@ 2021-05-10 21:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-10 21:50 UTC (permalink / raw)
  To: Michael Walle
  Cc: netdev, linux-kernel, vladimir.oltean, claudiu.manoil,
	alexandre.belloni, UNGLinuxDriver, andrew, vivien.didelot,
	f.fainelli, davem, kuba, xiaoliang.yang_1

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 10 May 2021 13:07:08 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net: dsa: felix: re-enable TAS guard band mode
    https://git.kernel.org/netdev/net/c/297c4de6f780

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-10 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 11:07 [PATCH net] net: dsa: felix: re-enable TAS guard band mode Michael Walle
2021-05-10 12:23 ` Vladimir Oltean
2021-05-10 21:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).