netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next v2 00/11] Add a tool for configuration of DCB
@ 2020-10-30 12:29 Petr Machata
  2020-10-30 12:29 ` [PATCH iproute2-next v2 01/11] Unify batch processing across tools Petr Machata
                   ` (11 more replies)
  0 siblings, 12 replies; 27+ messages in thread
From: Petr Machata @ 2020-10-30 12:29 UTC (permalink / raw)
  To: netdev, dsahern, stephen
  Cc: john.fastabend, jiri, idosch, Jakub Kicinski, Roman Mashak,
	Petr Machata

The Linux DCB interface allows configuration of a broad range of
hardware-specific attributes, such as TC scheduling, flow control, per-port
buffer configuration, TC rate, etc.

Currently a common libre tool for configuration of DCB is OpenLLDP. This
suite contains a daemon that uses Linux DCB interface to configure HW
according to the DCB TLVs exchanged over an interface. The daemon can also
be controlled by a client, through which the user can adjust and view the
configuration. The downside of using OpenLLDP is that it is somewhat
heavyweight and difficult to use in scripts, and does not support
extensions such as buffer and rate commands.

For access to many HW features, one would be perfectly fine with a
fire-and-forget tool along the lines of "ip" or "tc". For scripting in
particular, this would be ideal. This author is aware of one such tool,
mlnx_qos from Mellanox OFED scripts collection[1].

The downside here is that the tool is very verbose, the command line
language is awkward to use, it is not packaged in Linux distros, and
generally has the appearance of a very vendor-specific tool, despite not
being one.

This patchset addresses the above issues by providing a seed of a clean,
well-documented, easily usable, extensible fire-and-forget tool for DCB
configuration:

    # dcb ets set dev eni1np1 \
                  tc-tsa all:strict 0:ets 1:ets 2:ets \
		  tc-bw all:0 0:33 1:33 2:34

    # dcb ets show dev eni1np1 tc-tsa tc-bw
    tc-tsa 0:ets 1:ets 2:ets 3:strict 4:strict 5:strict 6:strict 7:strict
    tc-bw 0:33 1:33 2:34 3:0 4:0 5:0 6:0 7:0

    # dcb ets set dev eni1np1 tc-bw 1:30 2:37

    # dcb -j ets show dev eni1np1 | jq '.tc_bw[2]'
    37

The patchset proceeds as follows:

- Many tools in iproute2 have an option to work in batch mode, where the
  commands to run are given in a file. The code to handle batching is
  largely the same independent of the tool in question. In patch #1, add a
  helper to handle the batching, and migrate individual tools to use it.

- A number of configuration options come in a form of an on-off switch.
  This in turn can be considered a special case of parsing one of a given
  set of strings. In patch #2, extract helpers to parse one of a number of
  strings, on top of which build an on-off parser.

  Currently each tool open-codes the logic to parse the on-off toggle. A
  future patch set will migrate instances of this code over to the new
  helpers.

- The on/off toggles from previous list item sometimes need to be dumped.
  While in the FP output, one typically wishes to maintain consistency with
  the command line and show actual strings, "on" and "off", in JSON output
  one would rather use booleans. This logic is somewhat annoying to have to
  open-code time and again. Therefore in patch #3, add a helper to do just
  that.

- The DCB tool is built on top of libmnl. Several routines will be
  basically the same in DCB as they are currently in devlink. In patches
  #4-#6, extract them to a new module, mnl_utils, for easy reuse.

- Much of DCB is built around arrays. A syntax similar to the iplink_vlan's
  ingress-qos-map / egress-qos-map is very handy for describing changes
  done to such arrays. Therefore in patch #7, extract a helper,
  parse_mapping(), which manages parsing of key-value arrays. In patch #8,
  fix a buglet in the helper, and in patch #9, extend it to allow setting
  of all array elements in one go.

- In patch #10, add a skeleton of "dcb", which contains common helpers and
  dispatches to subtools for handling of individual objects. The skeleton
  is empty as of this patch.

  In patch #11, add "dcb_ets", a module for handling of specifically DCB
  ETS objects.

  The intention is to gradually add handlers for at least PFC, APP, peer
  configuration, buffers and rates.

[1] https://github.com/Mellanox/mlnx-tools/tree/master/ofed_scripts

v2:
- A new function, print_on_off_bool(), has been introduced for showing
  on-off toggles in both FP and JSON modes.
  [Jakub Kicinski, Stephen Hemminger]

- This prompted refactoring in several existing files, and pushed the
  number of patches in the set too high. The cleanup patches have therefore
  been moved out to another patchset, which will follow after this one.

- When dumping JSON, format keys so that they are valid jq identifiers.
  E.g. "tc_tsa" instead of "tc-tsa". Additionally, do not dump arrays as
  objects with string indices, but as true arrays. This allows for more
  natural access to individual items, e.g.:
    # dcb ets -j show dev eth0 | jq '.tc_tsa[3]'
  Instead of:
    # dcb ets -j show dev eth0 | jq '.["tc-tsa"]["3"]'

- Patch #4:
  - Add SPDX-License-Identifier

- Patch #7:
  - In parse_qos_mapping(), propagate return value from addattr_l()
    [Roman Mashak]

Petr Machata (11):
  Unify batch processing across tools
  lib: Add parse_one_of(), parse_on_off()
  lib: utils: Add print_on_off_bool()
  lib: Extract from devlink/mnlg a helper, mnlu_socket_open()
  lib: Extract from devlink/mnlg a helper, mnlu_msg_prepare()
  lib: Extract from devlink/mnlg a helper, mnlu_socket_recv_run()
  lib: Extract from iplink_vlan a helper to parse key:value arrays
  lib: parse_mapping: Update argc, argv on error
  lib: parse_mapping: Recognize a keyword "all"
  Add skeleton of a new tool, dcb
  dcb: Add a subtool for the DCB ETS object

 Makefile            |   2 +-
 bridge/bridge.c     |  38 +---
 dcb/Makefile        |  24 +++
 dcb/dcb.c           | 403 +++++++++++++++++++++++++++++++++++++++++
 dcb/dcb.h           |  39 ++++
 dcb/dcb_ets.c       | 430 ++++++++++++++++++++++++++++++++++++++++++++
 devlink/Makefile    |   2 +-
 devlink/devlink.c   |  41 +----
 devlink/mnlg.c      |  93 ++--------
 include/mnl_utils.h |  11 ++
 include/utils.h     |  12 ++
 ip/ip.c             |  46 ++---
 ip/iplink_vlan.c    |  36 ++--
 ip/ipmacsec.c       |  52 ++----
 lib/Makefile        |   2 +-
 lib/mnl_utils.c     | 110 ++++++++++++
 lib/utils.c         | 111 ++++++++++++
 man/man8/dcb-ets.8  | 185 +++++++++++++++++++
 man/man8/dcb.8      | 114 ++++++++++++
 rdma/rdma.c         |  38 +---
 tc/tc.c             |  38 +---
 21 files changed, 1518 insertions(+), 309 deletions(-)
 create mode 100644 dcb/Makefile
 create mode 100644 dcb/dcb.c
 create mode 100644 dcb/dcb.h
 create mode 100644 dcb/dcb_ets.c
 create mode 100644 include/mnl_utils.h
 create mode 100644 lib/mnl_utils.c
 create mode 100644 man/man8/dcb-ets.8
 create mode 100644 man/man8/dcb.8

-- 
2.25.1


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

end of thread, other threads:[~2020-11-05 20:59 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-30 12:29 [PATCH iproute2-next v2 00/11] Add a tool for configuration of DCB Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 01/11] Unify batch processing across tools Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 02/11] lib: Add parse_one_of(), parse_on_off() Petr Machata
2020-10-31 15:37   ` David Ahern
2020-10-31 21:25     ` Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 03/11] lib: utils: Add print_on_off_bool() Petr Machata
2020-10-30 16:05   ` Stephen Hemminger
2020-10-31 21:24     ` Petr Machata
2020-10-31 15:38   ` David Ahern
2020-10-31 21:23     ` Petr Machata
2020-11-01 23:55       ` David Ahern
2020-11-02  6:37         ` Leon Romanovsky
2020-11-02 15:10           ` David Ahern
2020-11-02 23:05           ` Petr Machata
2020-11-03  6:24             ` Leon Romanovsky
2020-11-03 21:01               ` Petr Machata
2020-11-04  8:15                 ` Leon Romanovsky
2020-11-05 20:59                   ` Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 04/11] lib: Extract from devlink/mnlg a helper, mnlu_socket_open() Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 05/11] lib: Extract from devlink/mnlg a helper, mnlu_msg_prepare() Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 06/11] lib: Extract from devlink/mnlg a helper, mnlu_socket_recv_run() Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 07/11] lib: Extract from iplink_vlan a helper to parse key:value arrays Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 08/11] lib: parse_mapping: Update argc, argv on error Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 09/11] lib: parse_mapping: Recognize a keyword "all" Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 10/11] Add skeleton of a new tool, dcb Petr Machata
2020-10-30 12:29 ` [PATCH iproute2-next v2 11/11] dcb: Add a subtool for the DCB ETS object Petr Machata
2020-10-31 15:51 ` [PATCH iproute2-next v2 00/11] Add a tool for configuration of DCB David Ahern

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).