netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Machata <petrm@mellanox.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Roopa Prabhu <roopa@cumulusnetworks.com>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Roman Mashak <mrv@mojatatu.com>,
	Ido Schimmel <idosch@mellanox.com>, Jiri Pirko <jiri@resnulli.us>
Subject: Re: [PATCH net-next mlxsw v2 00/10] Add a new Qdisc, ETS
Date: Thu, 19 Dec 2019 17:46:52 +0000	[thread overview]
Message-ID: <878sn8nr79.fsf@mellanox.com> (raw)
In-Reply-To: <5dfba6091d854_61ae2ac457a865c45f@john-XPS-13-9370.notmuch>


John Fastabend <john.fastabend@gmail.com> writes:

> Petr Machata wrote:
>>
>> John Fastabend <john.fastabend@gmail.com> writes:
>>
>> > Petr Machata wrote:
>> >> The IEEE standard 802.1Qaz (and 802.1Q-2014) specifies four principal
>> >> transmission selection algorithms: strict priority, credit-based shaper,
>> >> ETS (bandwidth sharing), and vendor-specific. All these have their
>> >> corresponding knobs in DCB. But DCB does not have interfaces to configure
>> >> RED and ECN, unlike Qdiscs.
>> >
>> > So the idea here (way back when I did this years ago) is that marking ECN
>> > traffic was not paticularly CPU intensive on any metrics I came up with.
>> > And I don't recall anyone ever wanting to do RED here. The configuration
>> > I usually recommended was to use mqprio + SO_PRIORITY + fq per qdisc. Then
>> > once we got the BPF egress hook we replaced SO_PRIORITY configurations with
>> > the more dynamic BPF action to set it. There was never a compelling perf
>> > reason to offload red/ecn.
>> >
>> > But these use cases were edge nodes. I believe this series is mostly about
>> > control path and maybe some light control traffic? This is for switches
>> > not for edge nodes right? I'm guessing because I don't see any performance
>> > analaysis on why this is useful, intuitively it makes sense if there is
>> > a small CPU sitting on a 48 port 10gbps box or something like that.
>>
>> Yes.
>>
>> Our particular use case is a switch that has throughput in Tbps. There
>> simply isn't enough bandwidth to even get all this traffic to the CPU,
>> let alone process it on the CPU. You need to offload, or it doesn't make
>> sense. 48 x 10Gbps with a small CPU is like that as well, yeah.
>
> Got it so I suspect primary usage will be offload then at least for
> the initial usage.

Yes, particularly configuration of offloaded forwarding path.

>> > offload is tricky with stacked qdiscs though ;)
>>
>> Offload and configuration both.
>>
>> Of course there could be a script to somehow generate and parse the
>> configuration on the front end, and some sort of library to consolidate
>> on the driver side, but it's far cleaner and easier to understand for
>> all involved if it's a Qdisc. Qdiscs are tricky, but people still
>> understand them well in comparison.
>
> At one point I wrote an app to sit on top of the tc netlink interface
> and create common (at least for the customers at the time) setups. But
> that tool is probably lost to history at this point.
>
> I don't think its paticularly difficult to build this type of tool
> on top of the API but also not against a new qdisc like this that
> folds in a more concrete usage and aligns with a spec. And Dave
> already merged it so good to see ;)
>
> [...]
>
>> >> The chosen interface makes the overall system both reasonably easy to
>> >> configure, and reasonably easy to offload. The extra code to support ETS in
>> >> mlxsw (which already supports PRIO) is about 150 lines, of which perhaps 20
>> >> lines is bona fide new business logic.
>> >
>> > Sorry maybe obvious question but I couldn't sort it out. When the qdisc is
>> > offloaded if packets are sent via software stack do they also hit the sw
>> > side qdisc enqueue logic? Or did I miss something in the graft logic that
>> > then skips adding the qdisc to software side? For example taprio has dequeue
>> > logic for both offload and software cases but I don't see that here.
>>
>> You mean the graft logic in the driver? All that stuff is in there just
>> to figure out how to configure the device. SW datapath packets are
>> still handled as usual.
>
> Got it just wasn't clear to me when viewing it from the software + smartnic
> use case. So is there a bug or maybe just missing feature, where if I
> offloaded this on a NIC that both software and hardware would do the ETS
> algorithm? How about on the switch would traffic from the CPU be both ETS
> classified in software and in hardware? Or maybe CPU uses different interface
> without offload on?

You would get SW scheduling if there's more traffic than the host
interface can handle.

In the HW, control traffic gets TC 16, which the chip hardcodes as the
highest priority and handles in a dedicated set of queues. So there's no
second classification.

>> >> Credit-based shaping transmission selection algorithm can be configured by
>> >> adding a CBS Qdisc under one of the strict bands (e.g. TBF can be used to a
>> >> similar effect as well). As a non-work-conserving Qdisc, CBS can't be
>> >> hooked under the ETS bands. This is detected and handled identically to DRR
>> >> Qdisc at runtime. Note that offloading CBS is not subject of this patchset.
>> >
>> > Any performance data showing how accurate we get on software side? The
>> > advantage of hardware always to me seemed to be precision in the WRR algorithm.
>>
>> Quantum is specified as a number of bytes allowed to dequeue before a
>> queue loses the medium. Over time, the amount of traffic dequeued from
>> individual queues should average out to be the quanta your specified. At
>> any point in time, size of the packets matters: if I push 1000B packets
>> into a 10000B-quantum queue, it will use 100% of its allocation. If they
>> are 800B packets, there will be some waste (and it will compensate next
>> round).
>>
>> As far as the Qdisc is defined, the SW side is as accurate as possible
>> under given traffic patterns. For HW, we translate to %, and rounding
>> might lead to artifacts. You kinda get the same deal with DCB, where
>> there's no way to split 100% among 8 TCs perfectly fairly.
>>
>> > Also data showing how much overhead we get hit with from basic mq case
>> > would help me understand if this is even useful for software or just a
>> > exercise in building some offload logic.
>>
>> So the Qdisc is written to do something reasonable in the SW datapath.
>> In that respect it's as useful as PRIO and DRR are. Not sure that as a
>> switch operator you really want to handle this much traffic on the CPU
>> though.
>
> I was more thinking of using it in the smart nic case.

I'm not really familiar with this.

I can imagine some knobs that map the individual bands to NIC queues for
example. I think that's something that mlxsw_spectrum could actually
use. We do have several queues to the chip, and currently round-robin
them by hand in the driver. Logic to determine which queues to use for
which traffic seems to make sense. But currently we simply don't see
these use cases at all.

>> > FWIW I like the idea I meant to write an ETS sw qdisc for years with
>> > the expectation that it could get close enough to hardware offload case
>> > for most use cases, all but those that really need <5% tolerance or something.
>
> Anyways thanks for the answers clears it up on my side. One remaining
> question is if software does send packets if they get both classified
> via software and hardware. Might be worth thinking about fixing if
> that is the case or probably more likely switch knows not to do
> this.

Yeah, traffic from the CPU is handled specially.

  reply	other threads:[~2019-12-19 17:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 14:55 [PATCH net-next mlxsw v2 00/10] Add a new Qdisc, ETS Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 01/10] net: pkt_cls: Clarify a comment Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 02/10] mlxsw: spectrum_qdisc: " Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 03/10] mlxsw: spectrum: Rename MLXSW_REG_QEEC_HIERARCY_* enumerators Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 04/10] net: sch_ets: Add a new Qdisc Petr Machata
2019-12-18 15:02   ` Jiri Pirko
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 05/10] net: sch_ets: Make the ETS qdisc offloadable Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 06/10] mlxsw: spectrum_qdisc: Generalize PRIO offload to support ETS Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 07/10] mlxsw: spectrum_qdisc: Support offloading of ETS Qdisc Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 08/10] selftests: forwarding: Move start_/stop_traffic from mlxsw to lib.sh Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 09/10] selftests: forwarding: sch_ets: Add test coverage for ETS Qdisc Petr Machata
2019-12-18 14:55 ` [PATCH net-next mlxsw v2 10/10] selftests: qdiscs: " Petr Machata
2019-12-18 16:22 ` [PATCH net-next mlxsw v2 00/10] Add a new Qdisc, ETS John Fastabend
2019-12-18 18:35   ` Petr Machata
2019-12-19 16:32     ` John Fastabend
2019-12-19 17:46       ` Petr Machata [this message]
2019-12-18 23:16 ` David Miller

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=878sn8nr79.fsf@mellanox.com \
    --to=petrm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=mrv@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.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 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).