All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Michael Walle <michael@walle.cc>
Cc: Vladimir Oltean <olteanv@gmail.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"allan.nielsen@microchip.com" <allan.nielsen@microchip.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"idosch@mellanox.com" <idosch@mellanox.com>,
	"joergen.andreasen@microchip.com"
	<joergen.andreasen@microchip.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Po Liu <po.liu@nxp.com>,
	"vinicius.gomes@intel.com" <vinicius.gomes@intel.com>
Subject: Re: [net-next] net: dsa: felix: disable always guard band bit for TAS config
Date: Tue, 4 May 2021 21:33:00 +0000	[thread overview]
Message-ID: <20210504213259.l5rbnyhxrrbkykyg@skbuf> (raw)
In-Reply-To: <d933eef300cb1e1db7d36ca2cb876ef6@walle.cc>

[ trimmed the CC list, as this is most likely spam for most people ]

On Tue, May 04, 2021 at 10:23:11PM +0200, Michael Walle wrote:
> Am 2021-05-04 21:17, schrieb Vladimir Oltean:
> > On Tue, May 04, 2021 at 09:08:00PM +0200, Michael Walle wrote:
> > > > > > > As explained in another mail in this thread, all queues are marked as
> > > > > > > scheduled. So this is actually a no-op, correct? It doesn't matter if
> > > > > > > it set or not set for now. Dunno why we even care for this bit then.
> > > > > >
> > > > > > It matters because ALWAYS_GUARD_BAND_SCH_Q reduces the available
> > > > > > throughput when set.
> > > > >
> > > > > Ahh, I see now. All queues are "scheduled" but the guard band only
> > > > > applies
> > > > > for "non-scheduled" -> "scheduled" transitions. So the guard band is
> > > > > never
> > > > > applied, right? Is that really what we want?
> > > >
> > > > Xiaoliang explained that yes, this is what we want. If the end user
> > > > wants a guard band they can explicitly add a "sched-entry 00" in the
> > > > tc-taprio config.
> > > 
> > > You're disabling the guard band, then. I figured, but isn't that
> > > suprising for the user? Who else implements taprio? Do they do it in
> > > the
> > > same way? I mean this behavior is passed right to the userspace and
> > > have
> > > a direct impact on how it is configured. Of course a user can add it
> > > manually, but I'm not sure that is what we want here. At least it
> > > needs
> > > to be documented somewhere. Or maybe it should be a switchable option.
> > > 
> > > Consider the following:
> > > sched-entry S 01 25000
> > > sched-entry S fe 175000
> > > basetime 0
> > > 
> > > Doesn't guarantee, that queue 0 is available at the beginning of
> > > the cycle, in the worst case it takes up to
> > > <begin of cycle> + ~12.5us until the frame makes it through (given
> > > gigabit and 1518b frames).
> > > 
> > > Btw. there are also other implementations which don't need a guard
> > > band (because they are store-and-forward and cound the remaining
> > > bytes). So yes, using a guard band and scheduling is degrading the
> > > performance.
> > 
> > What is surprising for the user, and I mentioned this already in another
> > thread on this patch, is that the Felix switch overruns the time gate (a
> > packet taking 2 us to transmit will start transmission even if there is
> > only 1 us left of its time slot, delaying the packets from the next time
> > slot by 1 us). I guess that this is why the ALWAYS_GUARD_BAND_SCH_Q bit
> > exists, as a way to avoid these overruns, but it is a bit of a poor tool
> > for that job. Anyway, right now we disable it and live with the
> > overruns.
> 
> We are talking about the same thing here. Why is that a poor tool?

It is a poor tool because it revolves around the idea of "scheduled
queues" and "non-scheduled queues".

Consider the following tc-taprio schedule:

	sched-entry S 81 2000 # TC 7 and 0 open, all others closed
	sched-entry S 82 2000 # TC 7 and 1 open, all others closed
	sched-entry S 84 2000 # TC 7 and 2 open, all others closed
	sched-entry S 88 2000 # TC 7 and 3 open, all others closed
	sched-entry S 90 2000 # TC 7 and 4 open, all others closed
	sched-entry S a0 2000 # TC 7 and 5 open, all others closed
	sched-entry S c0 2000 # TC 7 and 6 open, all others closed

Otherwise said, traffic class 7 should be able to send any time it
wishes.

With the ALWAYS_GUARD_BAND_SCH_Q bit, there will be hiccups in packet
transmission for TC 7. For example, at the end of every time slot,
the hardware will insert a guard band for TC 7 because there is a
scheduled-queue-to-scheduled-queue transition, and it has been told to
do that. But a packet with TC 7 should be transmitted at any time,
because that's what we told the port to do!

Alternatively, we could tell the switch that TC 7 is "scheduled", and
the others are "not scheduled". Then it would implement the guard band
at the end of TCs 0-6, but it wouldn't for packets sent in TC 7. But
when you look at the overall schedule I described above, it kinds looks
like TCs 0-6 are the ones that are "scheduled" and TC 7 looks like the
one which isn't "scheduled" but can send at any time it pleases.

Odd, just odd. It's clear that someone had something in mind, it's just
not clear what. I would actually appreciate if somebody from Microchip
could chime in and say "no, you're wrong", and then explain.

> > FWIW, the ENETC does not overrun the time gate, the SJA1105 does. You
> > can't really tell just by looking at the driver code, just by testing.
> > It's a bit of a crapshoot.
> 
> I was speaking of other switches, I see there is also a hirschmann
> switch (hellcreek) supported in linux, for example.
> 
> Shouldn't the goal to make the configuration of the taprio qdisc
> independent of the switch. If on one you'll have to manually define the
> guard band by inserting dead-time scheduler entries and on another this
> is already handled by the hardware (like it would be with
> ALWAYS_GUARD_BAND_SCH_Q or if it doesn't need it at all), this goal
> isn't met.
> 
> Also what do you expect if you use the following configuration:
> sched-entry S 01 5000
> sched-entry S fe <some large number>
> 
> Will queue 0 be able to send traffic? To me, with this patch, it seems
> to me that this isn't always the case anymore. If there is a large packet
> just sent at the end of the second cycle, the first might even be skipped
> completely.
> Will a user of the taprio (without knowledge of the underlying switch)
> assume that it can send traffic up to ~600 bytes? I'd say yes.

Yeah, I think that if a switch overruns a packet's reserved time gate,
then the above tc-taprio schedule is as good as not having any. I didn't
say that overruns are not a problem, I just said that the ALWAYS_blah_blah
bit isn't as silver-bullet for a solution as you think.

  reply	other threads:[~2021-05-04 21:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 10:25 [net-next] net: dsa: felix: disable always guard band bit for TAS config Xiaoliang Yang
2021-04-19 12:38 ` Vladimir Oltean
2021-04-20  3:06   ` [EXT] " Xiaoliang Yang
2021-04-20  8:26     ` Vladimir Oltean
2021-04-20 10:28       ` Xiaoliang Yang
2021-04-20 10:30         ` Vladimir Oltean
2021-04-20 10:42           ` Vladimir Oltean
2021-04-21  2:51             ` Xiaoliang Yang
2021-04-20 10:33 ` Vladimir Oltean
2021-04-20 23:20 ` patchwork-bot+netdevbpf
2021-05-04 17:05 ` Michael Walle
2021-05-04 18:18   ` Vladimir Oltean
2021-05-04 18:38     ` Michael Walle
2021-05-04 18:50       ` Vladimir Oltean
2021-05-04 19:08         ` Michael Walle
2021-05-04 19:17           ` Vladimir Oltean
2021-05-04 20:23             ` Michael Walle
2021-05-04 21:33               ` Vladimir Oltean [this message]
2021-05-06 13:25                 ` Michael Walle
2021-05-06 13:50                   ` Vladimir Oltean
2021-05-06 14:20                     ` Michael Walle
2021-05-06 14:41                     ` Michael Walle
2021-05-06 15:07                       ` Vladimir Oltean
2021-05-06 18:28                         ` Michael Walle
2021-05-07  7:16                   ` [EXT] " Xiaoliang Yang
2021-05-07  7:35                     ` Michael Walle
2021-05-07 11:09                       ` Xiaoliang Yang
2021-05-07 12:19                         ` Vladimir Oltean
2021-05-07 12:43                           ` Michael Walle
2021-06-07 11:26                           ` Michael Walle
2021-06-09  8:06                             ` [EXT] " Xiaoliang Yang
2021-06-09  8:41                               ` Michael Walle
2021-05-07 12:19                         ` Michael Walle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210504213259.l5rbnyhxrrbkykyg@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=allan.nielsen@microchip.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=joergen.andreasen@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=po.liu@nxp.com \
    --cc=vinicius.gomes@intel.com \
    --cc=xiaoliang.yang_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.