From: Petr Machata <petrm@mellanox.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Petr Machata <petrm@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>,
Roopa Prabhu <roopa@cumulusnetworks.com>
Subject: [RFC PATCH 00/10] Add a new Qdisc, ETS
Date: Wed, 20 Nov 2019 13:05:08 +0000 [thread overview]
Message-ID: <cover.1574253236.git.petrm@mellanox.com> (raw)
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.
In the Qdisc land, strict priority is implemented by PRIO. Credit-based
transmission selection algorithm can then be modeled by having e.g. TBF or
CBS Qdisc below some of the PRIO bands. ETS would then be modeled by
placing a DRR Qdisc under the last PRIO band.
The problem with this approach is that DRR on its own, as well as the
combination of PRIO and DRR, are tricky to configure and tricky to offload
to 802.1Qaz-compliant hardware. This is due to several reasons:
- As any classful Qdisc, DRR supports adding classifiers to decide in which
class to enqueue packets. Unlike PRIO, there's however no fallback in the
form of priomap. A way to achieve classification based on packet priority
is e.g. like this:
# tc filter add dev swp1 root handle 1: \
basic match 'meta(priority eq 0)' flowid 1:10
Expressing the priomap in this manner however forces drivers to deep dive
into the classifier block to parse the individual rules.
A possible solution would be to extend the classes with a "defmap" a la
split / defmap mechanism of CBQ, and introduce this as a last resort
classification. However, unlike priomap, this doesn't have the guarantee
of covering all priorities. Traffic whose priority is not covered is
dropped by DRR as unclassified. But ASICs tend to implement dropping in
the ACL block, not in scheduling pipelines. The need to treat these
configurations correctly (if only to decide to not offload at all)
complicates a driver.
It's not clear how to retrofit priomap with all its benefits to DRR
without changing it beyond recognition.
- The interplay between PRIO and DRR is also causing problems. 802.1Qaz has
all ETS TCs as a last resort. I believe switch ASICs that support ETS at
all will handle ETS traffic likewise. However the Linux model is more
generic, allowing the DRR block in any band. Drivers would need to be
careful to handle this case correctly, otherwise the offloaded model
might not match the slow-path one.
In a similar vein, PRIO and DRR need to agree on the list of priorities
assigned to DRR. This is doubly problematic--the user needs to take care
to keep the two in sync, and the driver needs to watch for any holes in
DRR coverage and treat the traffic correctly, as discussed above.
Note that at the time that DRR Qdisc is added, it has no classes, and
thus any priorities assigned to that PRIO band are not covered. Thus this
case is surprisingly rather common, and needs to be handled gracefully by
the driver.
- Similarly due to DRR flexibility, when a Qdisc (such as RED) is attached
below it, it is not immediately clear which TC the class represents. This
is unlike PRIO with its straightforward classid scheme. When DRR is
combined with PRIO, the relationship between classes and TCs gets even
more murky.
This is a problem for users as well: the TC mapping is rather important
for (devlink) shared buffer configuration and (ethtool) counters.
So instead, this patch set introduces a new Qdisc, which is based on
802.1Qaz wording. It is PRIO-like in how it is configured, meaning one
needs to specify how many bands there are, how many are strict and how many
are ETS, quanta for the latter, and priomap.
The new Qdisc operates like the PRIO / DRR combo would when configured as
per the standard. The strict classes, if any, are tried for traffic first.
When there's no traffic in any of the strict queues, the ETS ones (if any)
are treated in the same way as in DRR.
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.
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.
The patchset proceeds in four stages:
- Patches #1-#3 are cleanups.
- Patches #4 and #5 contain the new Qdisc.
- Patches #6 and #7 update mlxsw to offload the new Qdisc.
- Patches #8-#10 add selftests for ETS.
Examples:
- Add a Qdisc with 6 bands, 3 strict and 3 ETS with 45%-30%-25% weights:
# tc qdisc add dev swp1 root handle 1: \
ets strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5
# tc qdisc sh dev swp1
qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 4500 3000 2500 priomap 0 1 1 1 2 3 4 5 0 0 0 0 0 0 0 0
- Tweak quantum of one of the classes of the previous Qdisc:
# tc class ch dev swp1 classid 1:4 ets quantum 1000
# tc qdisc sh dev swp1
qdisc ets 1: root refcnt 2 bands 6 strict 3 quanta 1000 3000 2500 priomap 0 1 1 1 2 3 4 5 0 0 0 0 0 0 0 0
# tc class ch dev swp1 classid 1:3 ets quantum 1000
Error: Strict bands do not have a configurable quantum.
- Purely strict Qdisc with 1:1 mapping between priorities and TCs:
# tc qdisc add dev swp1 root handle 1: \
ets strict 8 priomap 7 6 5 4 3 2 1 0
# tc qdisc sh dev swp1
qdisc ets 1: root refcnt 2 bands 8 strict 8 priomap 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0
- Use "bands" to specify number of bands explicitly. Underspecified bands
are implicitly ETS and their quantum is taken from MTU. The following
thus gives each band the same weight:
# tc qdisc add dev swp1 root handle 1: \
ets bands 8 priomap 7 6 5 4 3 2 1 0
# tc qdisc sh dev swp1
qdisc ets 1: root refcnt 2 bands 8 quanta 1514 1514 1514 1514 1514 1514 1514 1514 priomap 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0
Petr Machata (10):
net: pkt_cls: Clarify a comment
mlxsw: spectrum_qdisc: Clarify a comment
mlxsw: spectrum: Fix typos in MLXSW_REG_QEEC_HIERARCHY_* enumerators
net: sch_ets: Add a new Qdisc
net: sch_ets: Make the ETS qdisc offloadable
mlxsw: spectrum_qdisc: Generalize PRIO offload to support ETS
mlxsw: spectrum_qdisc: Support offloading of ETS Qdisc
selftests: forwarding: Move start_/stop_traffic from mlxsw to lib.sh
selftests: forwarding: sch_ets: Add test coverage for ETS Qdisc
selftests: qdiscs: Add test coverage for ETS Qdisc
drivers/net/ethernet/mellanox/mlxsw/reg.h | 10 +-
.../net/ethernet/mellanox/mlxsw/spectrum.c | 26 +-
.../net/ethernet/mellanox/mlxsw/spectrum.h | 2 +
.../ethernet/mellanox/mlxsw/spectrum_dcb.c | 16 +-
.../ethernet/mellanox/mlxsw/spectrum_qdisc.c | 205 ++++-
include/linux/netdevice.h | 1 +
include/net/pkt_cls.h | 36 +-
include/uapi/linux/pkt_sched.h | 29 +
net/sched/Kconfig | 11 +
net/sched/Makefile | 1 +
net/sched/sch_ets.c | 796 ++++++++++++++++++
.../selftests/drivers/net/mlxsw/qos_lib.sh | 46 +-
.../selftests/drivers/net/mlxsw/sch_ets.sh | 54 ++
tools/testing/selftests/net/forwarding/lib.sh | 18 +
.../selftests/net/forwarding/sch_ets.sh | 30 +
.../selftests/net/forwarding/sch_ets_core.sh | 229 +++++
.../selftests/net/forwarding/sch_ets_tests.sh | 230 +++++
.../tc-testing/tc-tests/qdiscs/ets.json | 709 ++++++++++++++++
18 files changed, 2371 insertions(+), 78 deletions(-)
create mode 100644 net/sched/sch_ets.c
create mode 100755 tools/testing/selftests/drivers/net/mlxsw/sch_ets.sh
create mode 100755 tools/testing/selftests/net/forwarding/sch_ets.sh
create mode 100644 tools/testing/selftests/net/forwarding/sch_ets_core.sh
create mode 100644 tools/testing/selftests/net/forwarding/sch_ets_tests.sh
create mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/ets.json
--
2.20.1
next reply other threads:[~2019-11-20 13:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-20 13:05 Petr Machata [this message]
2019-11-20 13:05 ` [RFC PATCH 01/10] net: pkt_cls: Clarify a comment Petr Machata
2019-11-20 13:05 ` [RFC PATCH 02/10] mlxsw: spectrum_qdisc: " Petr Machata
2019-11-20 13:05 ` [RFC PATCH 03/10] mlxsw: spectrum: Fix typos in MLXSW_REG_QEEC_HIERARCHY_* enumerators Petr Machata
2019-11-20 13:05 ` [RFC PATCH 04/10] net: sch_ets: Add a new Qdisc Petr Machata
2019-11-20 13:05 ` [RFC PATCH 05/10] net: sch_ets: Make the ETS qdisc offloadable Petr Machata
2019-11-20 13:05 ` [RFC PATCH 06/10] mlxsw: spectrum_qdisc: Generalize PRIO offload to support ETS Petr Machata
2019-11-20 13:05 ` [RFC PATCH 07/10] mlxsw: spectrum_qdisc: Support offloading of ETS Qdisc Petr Machata
2019-11-20 13:05 ` [RFC PATCH 08/10] selftests: forwarding: Move start_/stop_traffic from mlxsw to lib.sh Petr Machata
2019-11-20 13:05 ` [RFC PATCH 09/10] selftests: forwarding: sch_ets: Add test coverage for ETS Qdisc Petr Machata
2019-11-20 13:05 ` [RFC PATCH 10/10] selftests: qdiscs: " Petr Machata
2019-11-20 15:15 ` Roman Mashak
2019-11-20 15:42 ` Petr Machata
2019-11-20 21:22 ` Roman Mashak
2019-11-20 13:05 ` [RFC PATCH 1/3] libnetlink: parse_rtattr_nested should allow NLA_F_NESTED flag Petr Machata
2019-11-20 13:05 ` [RFC PATCH 2/3] uapi: Update for the ETS Qdisc Petr Machata
2019-11-20 13:05 ` [RFC PATCH 3/3] tc: Add support for " Petr Machata
2019-11-20 23:25 ` [RFC PATCH 00/10] Add a new Qdisc, ETS Jakub Kicinski
2019-11-21 12:43 ` Petr Machata
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=cover.1574253236.git.petrm@mellanox.com \
--to=petrm@mellanox.com \
--cc=idosch@mellanox.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).