From patchwork Sun Nov 8 15:07:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 322128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E5B2C388F9 for ; Sun, 8 Nov 2020 15:08:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECBE020731 for ; Sun, 8 Nov 2020 15:08:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pmachata.org header.i=@pmachata.org header.b="UHFtDjns" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728471AbgKHPIc (ORCPT ); Sun, 8 Nov 2020 10:08:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728104AbgKHPIb (ORCPT ); Sun, 8 Nov 2020 10:08:31 -0500 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [IPv6:2001:67c:2050::465:103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 000FCC0613CF for ; Sun, 8 Nov 2020 07:08:30 -0800 (PST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4CTcvb71m3zQl9v; Sun, 8 Nov 2020 16:08:27 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmachata.org; s=MBO0001; t=1604848106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I7QPqgldd5bRpbnFKP5pPO4Fyu4g+hlUXzRjdqHYhf4=; b=UHFtDjnsy1WheDkKzPfdT886h9OffKw9y93HbftA8p8fRyWkW3ERwvCy6tWwNvdBN7Jjzt WXGoSi2CeJo1CGuasUmIS9LFNtV5Ud7hfavpnbD4SdxYu8OpovMQCgRB+7GMsk4fvj8KpK Fo6ScT/hii7vWKTN2MWjJ4KsgrqIie9enHMXrd7FEokobG2+aqjn8ozCJyU3LQBI+b/7fF I0JKfFYB+W+FZ+KhPKRS98BpJO+VnDOOBsOZT8l1g2/P62WIr5cvWU7udh8yJqwaHIqEUc Vr4uOnq/kgCIb1KRm8AF8uu1BR0lVb9e80Ls0Q/CsDiKt++hWShLmJkkGR9YFQ== Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id 5STEOa8pOVMp; Sun, 8 Nov 2020 16:08:24 +0100 (CET) From: Petr Machata To: netdev@vger.kernel.org, dsahern@gmail.com, stephen@networkplumber.org Cc: john.fastabend@gmail.com, jiri@nvidia.com, idosch@nvidia.com, Jakub Kicinski , Roman Mashak , Leon Romanovsky , Petr Machata Subject: [PATCH iproute2-next v3 01/11] Unify batch processing across tools Date: Sun, 8 Nov 2020 16:07:22 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.08 / 15.00 / 15.00 X-Rspamd-Queue-Id: E1BDBEF7 X-Rspamd-UID: 6c2883 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The code for handling batches is largely the same across iproute2 tools. Extract a helper to handle the batch, and adjust the tools to dispatch to this helper. Sandwitch the invocation between prologue / epilogue code specific for each tool. Signed-off-by: Petr Machata --- bridge/bridge.c | 38 +++++++------------------------------- devlink/devlink.c | 41 +++++++---------------------------------- include/utils.h | 3 +++ ip/ip.c | 46 ++++++++++------------------------------------ lib/utils.c | 40 ++++++++++++++++++++++++++++++++++++++++ rdma/rdma.c | 38 +++++++------------------------------- tc/tc.c | 38 +++++++------------------------------- 7 files changed, 81 insertions(+), 163 deletions(-) diff --git a/bridge/bridge.c b/bridge/bridge.c index 453d689732bd..8f691cfdd466 100644 --- a/bridge/bridge.c +++ b/bridge/bridge.c @@ -77,20 +77,14 @@ static int do_cmd(const char *argv0, int argc, char **argv) return -1; } -static int batch(const char *name) +static int br_batch_cmd(int argc, char *argv[], void *data) { - char *line = NULL; - size_t len = 0; - int ret = EXIT_SUCCESS; + return do_cmd(argv[0], argc, argv); +} - if (name && strcmp(name, "-") != 0) { - if (freopen(name, "r", stdin) == NULL) { - fprintf(stderr, - "Cannot open file \"%s\" for reading: %s\n", - name, strerror(errno)); - return EXIT_FAILURE; - } - } +static int batch(const char *name) +{ + int ret; if (rtnl_open(&rth, 0) < 0) { fprintf(stderr, "Cannot open rtnetlink\n"); @@ -99,25 +93,7 @@ static int batch(const char *name) rtnl_set_strict_dump(&rth); - cmdlineno = 0; - while (getcmdline(&line, &len, stdin) != -1) { - char *largv[100]; - int largc; - - largc = makeargs(line, largv, 100); - if (largc == 0) - continue; /* blank line */ - - if (do_cmd(largv[0], largc, largv)) { - fprintf(stderr, "Command failed %s:%d\n", - name, cmdlineno); - ret = EXIT_FAILURE; - if (!force) - break; - } - } - if (line) - free(line); + ret = do_batch(name, force, br_batch_cmd, NULL); rtnl_close(&rth); return ret; diff --git a/devlink/devlink.c b/devlink/devlink.c index 1ff865bc5c22..5bb00b3a5b8c 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -7912,43 +7912,16 @@ static void dl_free(struct dl *dl) free(dl); } -static int dl_batch(struct dl *dl, const char *name, bool force) +static int dl_batch_cmd(int argc, char *argv[], void *data) { - char *line = NULL; - size_t len = 0; - int ret = EXIT_SUCCESS; - - if (name && strcmp(name, "-") != 0) { - if (freopen(name, "r", stdin) == NULL) { - fprintf(stderr, - "Cannot open file \"%s\" for reading: %s\n", - name, strerror(errno)); - return EXIT_FAILURE; - } - } - - cmdlineno = 0; - while (getcmdline(&line, &len, stdin) != -1) { - char *largv[100]; - int largc; - - largc = makeargs(line, largv, 100); - if (!largc) - continue; /* blank line */ - - if (dl_cmd(dl, largc, largv)) { - fprintf(stderr, "Command failed %s:%d\n", - name, cmdlineno); - ret = EXIT_FAILURE; - if (!force) - break; - } - } + struct dl *dl = data; - if (line) - free(line); + return dl_cmd(dl, argc, argv); +} - return ret; +static int dl_batch(struct dl *dl, const char *name, bool force) +{ + return do_batch(name, force, dl_batch_cmd, dl); } int main(int argc, char **argv) diff --git a/include/utils.h b/include/utils.h index 7041c4612e46..085b17b1f6e3 100644 --- a/include/utils.h +++ b/include/utils.h @@ -322,4 +322,7 @@ int get_time64(__s64 *time, const char *str); char *sprint_time(__u32 time, char *buf); char *sprint_time64(__s64 time, char *buf); +int do_batch(const char *name, bool force, + int (*cmd)(int argc, char *argv[], void *user), void *user); + #endif /* __UTILS_H__ */ diff --git a/ip/ip.c b/ip/ip.c index ac4450235370..5e31957f2420 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -121,56 +121,30 @@ static int do_cmd(const char *argv0, int argc, char **argv) return EXIT_FAILURE; } -static int batch(const char *name) +static int ip_batch_cmd(int argc, char *argv[], void *data) { - char *line = NULL; - size_t len = 0; - int ret = EXIT_SUCCESS; - int orig_family = preferred_family; + const int *orig_family = data; - batch_mode = 1; + preferred_family = *orig_family; + return do_cmd(argv[0], argc, argv); +} - if (name && strcmp(name, "-") != 0) { - if (freopen(name, "r", stdin) == NULL) { - fprintf(stderr, - "Cannot open file \"%s\" for reading: %s\n", - name, strerror(errno)); - return EXIT_FAILURE; - } - } +static int batch(const char *name) +{ + int orig_family = preferred_family; + int ret; if (rtnl_open(&rth, 0) < 0) { fprintf(stderr, "Cannot open rtnetlink\n"); return EXIT_FAILURE; } - cmdlineno = 0; - while (getcmdline(&line, &len, stdin) != -1) { - char *largv[100]; - int largc; - - preferred_family = orig_family; - - largc = makeargs(line, largv, 100); - if (largc == 0) - continue; /* blank line */ - - if (do_cmd(largv[0], largc, largv)) { - fprintf(stderr, "Command failed %s:%d\n", - name, cmdlineno); - ret = EXIT_FAILURE; - if (!force) - break; - } - } - if (line) - free(line); + ret = do_batch(name, force, ip_batch_cmd, &orig_family); rtnl_close(&rth); return ret; } - int main(int argc, char **argv) { char *basename; diff --git a/lib/utils.c b/lib/utils.c index c98021d6ecad..9815e328c9e0 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1695,3 +1695,43 @@ char *sprint_time64(__s64 time, char *buf) print_time64(buf, SPRINT_BSIZE-1, time); return buf; } + +int do_batch(const char *name, bool force, + int (*cmd)(int argc, char *argv[], void *data), void *data) +{ + char *line = NULL; + size_t len = 0; + int ret = EXIT_SUCCESS; + + if (name && strcmp(name, "-") != 0) { + if (freopen(name, "r", stdin) == NULL) { + fprintf(stderr, + "Cannot open file \"%s\" for reading: %s\n", + name, strerror(errno)); + return EXIT_FAILURE; + } + } + + cmdlineno = 0; + while (getcmdline(&line, &len, stdin) != -1) { + char *largv[100]; + int largc; + + largc = makeargs(line, largv, 100); + if (!largc) + continue; /* blank line */ + + if (cmd(largc, largv, data)) { + fprintf(stderr, "Command failed %s:%d\n", + name, cmdlineno); + ret = EXIT_FAILURE; + if (!force) + break; + } + } + + if (line) + free(line); + + return ret; +} diff --git a/rdma/rdma.c b/rdma/rdma.c index 9ea2d17ffe9e..8dc2d3e344be 100644 --- a/rdma/rdma.c +++ b/rdma/rdma.c @@ -41,40 +41,16 @@ static int rd_cmd(struct rd *rd, int argc, char **argv) return rd_exec_cmd(rd, cmds, "object"); } -static int rd_batch(struct rd *rd, const char *name, bool force) +static int rd_batch_cmd(int argc, char *argv[], void *data) { - char *line = NULL; - size_t len = 0; - int ret = 0; - - if (name && strcmp(name, "-") != 0) { - if (!freopen(name, "r", stdin)) { - pr_err("Cannot open file \"%s\" for reading: %s\n", - name, strerror(errno)); - return errno; - } - } + struct rd *rd = data; - cmdlineno = 0; - while (getcmdline(&line, &len, stdin) != -1) { - char *largv[512]; - int largc; - - largc = makeargs(line, largv, ARRAY_SIZE(largv)); - if (!largc) - continue; /* blank line */ - - ret = rd_cmd(rd, largc, largv); - if (ret) { - pr_err("Command failed %s:%d\n", name, cmdlineno); - if (!force) - break; - } - } - - free(line); + return rd_cmd(rd, argc, argv); +} - return ret; +static int rd_batch(struct rd *rd, const char *name, bool force) +{ + return do_batch(name, force, rd_batch_cmd, rd); } static int rd_init(struct rd *rd, char *filename) diff --git a/tc/tc.c b/tc/tc.c index 5d57054b45fb..01fe58d06202 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -231,22 +231,16 @@ static int do_cmd(int argc, char **argv) return -1; } +static int tc_batch_cmd(int argc, char *argv[], void *data) +{ + return do_cmd(argc, argv); +} + static int batch(const char *name) { - char *line = NULL; - size_t len = 0; - int ret = 0; + int ret; batch_mode = 1; - if (name && strcmp(name, "-") != 0) { - if (freopen(name, "r", stdin) == NULL) { - fprintf(stderr, - "Cannot open file \"%s\" for reading: %s\n", - name, strerror(errno)); - return -1; - } - } - tc_core_init(); if (rtnl_open(&rth, 0) < 0) { @@ -254,26 +248,8 @@ static int batch(const char *name) return -1; } - cmdlineno = 0; - while (getcmdline(&line, &len, stdin) != -1) { - char *largv[100]; - int largc; - - largc = makeargs(line, largv, 100); - if (largc == 0) - continue; /* blank line */ - - if (do_cmd(largc, largv)) { - fprintf(stderr, "Command failed %s:%d\n", - name, cmdlineno); - ret = 1; - if (!force) - break; - } - fflush(stdout); - } + ret = do_batch(name, force, tc_batch_cmd, NULL); - free(line); rtnl_close(&rth); return ret; } From patchwork Sun Nov 8 15:07:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 322127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA5ABC4742C for ; Sun, 8 Nov 2020 15:08:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AE8521D40 for ; Sun, 8 Nov 2020 15:08:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pmachata.org header.i=@pmachata.org header.b="lI8icE5b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728599AbgKHPIh (ORCPT ); Sun, 8 Nov 2020 10:08:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728500AbgKHPIe (ORCPT ); Sun, 8 Nov 2020 10:08:34 -0500 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [IPv6:2001:67c:2050::465:202]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA92FC0613CF for ; Sun, 8 Nov 2020 07:08:33 -0800 (PST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4CTcvg62BVzQlPr; Sun, 8 Nov 2020 16:08:31 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmachata.org; s=MBO0001; t=1604848110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yk9vsKqU6CoSoOgqvkxP3qcJS25ZON71cxiU9k5XwyU=; b=lI8icE5bng3TkP3bMga8GHyyvDUn19WpCe3ADrAKBBxGbbhV4d/xAmWGyJqxOg1+u9CUPa LbzvNtVMFtm8CQ5vAXJ5WkfhWTlczIK98JuPK8ZD/bi9CFAy4QVbdCd5JjnkelQSyxEmat z4pig0YbtvM75gc62g1B3+Myq/FdIYp7bq1LTm9DQCapvxengIJBcxqH/xv3Rm/xhl8LdJ Q14Tki508OEFV1+TbOstAG+totTq4w+Uq15mYbESm0BdfaKDFzgWFSuuZ+1ff6AhAd4aWv Z1di3QBQaGwMBybkpF1+TLgy9/uf3wGHEwmw5tSiuGX1/kvKf71Zv12KIWKBoQ== Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id 7JgYolDbWxzF; Sun, 8 Nov 2020 16:08:28 +0100 (CET) From: Petr Machata To: netdev@vger.kernel.org, dsahern@gmail.com, stephen@networkplumber.org Cc: john.fastabend@gmail.com, jiri@nvidia.com, idosch@nvidia.com, Jakub Kicinski , Roman Mashak , Leon Romanovsky , Petr Machata Subject: [PATCH iproute2-next v3 04/11] lib: Extract from devlink/mnlg a helper, mnlu_socket_open() Date: Sun, 8 Nov 2020 16:07:25 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.14 / 15.00 / 15.00 X-Rspamd-Queue-Id: BDDF21725 X-Rspamd-UID: f94e75 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This little dance of mnl_socket_open(), option setting, and bind, is the same regardless of tool. Extract into a new module that should hold helpers for working with libmnl, mnl_util.c. Signed-off-by: Petr Machata --- Notes: v2: - Add SPDX-License-Identifier devlink/Makefile | 2 +- devlink/mnlg.c | 19 ++++--------------- include/mnl_utils.h | 7 +++++++ lib/Makefile | 2 +- lib/mnl_utils.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 include/mnl_utils.h create mode 100644 lib/mnl_utils.c diff --git a/devlink/Makefile b/devlink/Makefile index 7da7d1fa18d5..d540feb3c012 100644 --- a/devlink/Makefile +++ b/devlink/Makefile @@ -12,7 +12,7 @@ endif all: $(TARGETS) $(LIBS) -devlink: $(DEVLINKOBJ) +devlink: $(DEVLINKOBJ) $(LIBNETLINK) $(QUIET_LINK)$(CC) $^ $(LDFLAGS) $(LDLIBS) -o $@ install: all diff --git a/devlink/mnlg.c b/devlink/mnlg.c index c7d25e8713a1..9817bbad5e7d 100644 --- a/devlink/mnlg.c +++ b/devlink/mnlg.c @@ -19,6 +19,7 @@ #include #include "libnetlink.h" +#include "mnl_utils.h" #include "utils.h" #include "mnlg.h" @@ -263,7 +264,6 @@ struct mnlg_socket *mnlg_socket_open(const char *family_name, uint8_t version) { struct mnlg_socket *nlg; struct nlmsghdr *nlh; - int one = 1; int err; nlg = malloc(sizeof(*nlg)); @@ -274,19 +274,9 @@ struct mnlg_socket *mnlg_socket_open(const char *family_name, uint8_t version) if (!nlg->buf) goto err_buf_alloc; - nlg->nl = mnl_socket_open(NETLINK_GENERIC); + nlg->nl = mnlu_socket_open(NETLINK_GENERIC); if (!nlg->nl) - goto err_mnl_socket_open; - - /* Older kernels may no support capped/extended ACK reporting */ - mnl_socket_setsockopt(nlg->nl, NETLINK_CAP_ACK, &one, sizeof(one)); - mnl_socket_setsockopt(nlg->nl, NETLINK_EXT_ACK, &one, sizeof(one)); - - err = mnl_socket_bind(nlg->nl, 0, MNL_SOCKET_AUTOPID); - if (err < 0) - goto err_mnl_socket_bind; - - nlg->portid = mnl_socket_get_portid(nlg->nl); + goto err_socket_open; nlh = __mnlg_msg_prepare(nlg, CTRL_CMD_GETFAMILY, NLM_F_REQUEST | NLM_F_ACK, GENL_ID_CTRL, 1); @@ -305,9 +295,8 @@ struct mnlg_socket *mnlg_socket_open(const char *family_name, uint8_t version) err_mnlg_socket_recv_run: err_mnlg_socket_send: -err_mnl_socket_bind: mnl_socket_close(nlg->nl); -err_mnl_socket_open: +err_socket_open: free(nlg->buf); err_buf_alloc: free(nlg); diff --git a/include/mnl_utils.h b/include/mnl_utils.h new file mode 100644 index 000000000000..10a064afdfe8 --- /dev/null +++ b/include/mnl_utils.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __MNL_UTILS_H__ +#define __MNL_UTILS_H__ 1 + +struct mnl_socket *mnlu_socket_open(int bus); + +#endif /* __MNL_UTILS_H__ */ diff --git a/lib/Makefile b/lib/Makefile index 7cba1857b7fa..13f4ee15373b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -7,7 +7,7 @@ UTILOBJ = utils.o rt_names.o ll_map.o ll_types.o ll_proto.o ll_addr.o \ inet_proto.o namespace.o json_writer.o json_print.o \ names.o color.o bpf.o exec.o fs.o cg_map.o -NLOBJ=libgenl.o libnetlink.o +NLOBJ=libgenl.o libnetlink.o mnl_utils.o all: libnetlink.a libutil.a diff --git a/lib/mnl_utils.c b/lib/mnl_utils.c new file mode 100644 index 000000000000..2426912aa511 --- /dev/null +++ b/lib/mnl_utils.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * mnl_utils.c Helpers for working with libmnl. + */ + +#include + +#include "mnl_utils.h" + +struct mnl_socket *mnlu_socket_open(int bus) +{ + struct mnl_socket *nl; + int one = 1; + + nl = mnl_socket_open(bus); + if (nl == NULL) + return NULL; + + mnl_socket_setsockopt(nl, NETLINK_CAP_ACK, &one, sizeof(one)); + mnl_socket_setsockopt(nl, NETLINK_EXT_ACK, &one, sizeof(one)); + + if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) + goto err_bind; + + return nl; + +err_bind: + mnl_socket_close(nl); + return NULL; +} From patchwork Sun Nov 8 15:07:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 322126 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 879B3C388F9 for ; Sun, 8 Nov 2020 15:08:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B736208B6 for ; Sun, 8 Nov 2020 15:08:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pmachata.org header.i=@pmachata.org header.b="REisOgUa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728626AbgKHPIk (ORCPT ); Sun, 8 Nov 2020 10:08:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728572AbgKHPIg (ORCPT ); Sun, 8 Nov 2020 10:08:36 -0500 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23DC0C0613CF for ; Sun, 8 Nov 2020 07:08:36 -0800 (PST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4CTcvk219BzQlL2; Sun, 8 Nov 2020 16:08:34 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmachata.org; s=MBO0001; t=1604848112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CejmdtCpUP4hF0QdUazjGj0eVhhM9Cy+N5Lrnfd7Z4Y=; b=REisOgUaeccp5z7ilw7aG1/HewBIO3EOi8n+V2vs1OOQ9QopEpXwO/WBkzN3ebjC2RLioA oyKlGmciaBjYOrlxhusDEoJsV41aQIWl9YFStDKMKrjtYMA0GArH0vsO1hSnJ+rVODQ4sz 8NSYHXm5qpAAvi3Se1OZEQNNDJsN9VeqcYdw1TBE7wn+UaZGgR0L8vEtSt1BWfahK4nXco 52LscBKvSaP1ViUxirLrHtXz/TurS0T/lAcR8GlCFRpykGk3s5fV2gi6AHp4xgZPB04vg1 amSrvFfVUwpM3lprJ8CfBd5gLRpB3gwALtoGWFHbzrYi9JcOohIEigZyi3NtaA== Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id x8YwP3sXExhQ; Sun, 8 Nov 2020 16:08:31 +0100 (CET) From: Petr Machata To: netdev@vger.kernel.org, dsahern@gmail.com, stephen@networkplumber.org Cc: john.fastabend@gmail.com, jiri@nvidia.com, idosch@nvidia.com, Jakub Kicinski , Roman Mashak , Leon Romanovsky , Petr Machata Subject: [PATCH iproute2-next v3 07/11] lib: Extract from iplink_vlan a helper to parse key:value arrays Date: Sun, 8 Nov 2020 16:07:28 +0100 Message-Id: <03990f6240a8bcf19c620a77f7264923cae066e2.1604847919.git.me@pmachata.org> In-Reply-To: References: MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.14 / 15.00 / 15.00 X-Rspamd-Queue-Id: 2EF8F171A X-Rspamd-UID: 82e924 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org VLAN netdevices have two similar attributes: ingress-qos-map and egress-qos-map. These attributes can be configured with a series of 802.1-priority-to-skb-priority (and vice versa) mappings. A reusable helper along those lines will be handy for configuration of various priority-to-tc, tc-to-algorithm, and other arrays in DCB. Therefore extract the logic to a function parse_mapping(), move to utils.c, and dispatch to utils.c from iplink_vlan.c. That necessitates extraction of a VLAN-specific parse_qos_mapping(). Do that, and propagate addattr_l() return value up, unlike the original. Signed-off-by: Petr Machata --- Notes: v2: - In parse_qos_mapping(), propagate return value from addattr_l() [Roman Mashak] include/utils.h | 4 ++++ ip/iplink_vlan.c | 36 +++++++++++++++--------------------- lib/utils.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 21 deletions(-) diff --git a/include/utils.h b/include/utils.h index d7653273af5f..2d1a587cb1ef 100644 --- a/include/utils.h +++ b/include/utils.h @@ -329,4 +329,8 @@ int parse_one_of(const char *msg, const char *realval, const char * const *list, size_t len, int *p_err); bool parse_on_off(const char *msg, const char *realval, int *p_err); +int parse_mapping(int *argcp, char ***argvp, + int (*mapping_cb)(__u32 key, char *value, void *data), + void *mapping_cb_data); + #endif /* __UTILS_H__ */ diff --git a/ip/iplink_vlan.c b/ip/iplink_vlan.c index 1e6817f5de3d..dadc349db16c 100644 --- a/ip/iplink_vlan.c +++ b/ip/iplink_vlan.c @@ -49,36 +49,30 @@ static int on_off(const char *msg, const char *arg) return -1; } +static int parse_qos_mapping(__u32 key, char *value, void *data) +{ + struct nlmsghdr *n = data; + struct ifla_vlan_qos_mapping m = { + .from = key, + }; + + if (get_u32(&m.to, value, 0)) + return 1; + + return addattr_l(n, 1024, IFLA_VLAN_QOS_MAPPING, &m, sizeof(m)); +} + static int vlan_parse_qos_map(int *argcp, char ***argvp, struct nlmsghdr *n, int attrtype) { - int argc = *argcp; - char **argv = *argvp; - struct ifla_vlan_qos_mapping m; struct rtattr *tail; tail = addattr_nest(n, 1024, attrtype); - while (argc > 0) { - char *colon = strchr(*argv, ':'); - - if (!colon) - break; - *colon = '\0'; - - if (get_u32(&m.from, *argv, 0)) - return 1; - if (get_u32(&m.to, colon + 1, 0)) - return 1; - argc--, argv++; - - addattr_l(n, 1024, IFLA_VLAN_QOS_MAPPING, &m, sizeof(m)); - } + if (parse_mapping(argcp, argvp, &parse_qos_mapping, n)) + return 1; addattr_nest_end(n, tail); - - *argcp = argc; - *argvp = argv; return 0; } diff --git a/lib/utils.c b/lib/utils.c index eab0839a13c7..1dfaaf564915 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1763,3 +1763,31 @@ bool parse_on_off(const char *msg, const char *realval, int *p_err) return parse_one_of(msg, realval, values_on_off, ARRAY_SIZE(values_on_off), p_err); } + +int parse_mapping(int *argcp, char ***argvp, + int (*mapping_cb)(__u32 key, char *value, void *data), + void *mapping_cb_data) +{ + int argc = *argcp; + char **argv = *argvp; + + while (argc > 0) { + char *colon = strchr(*argv, ':'); + __u32 key; + + if (!colon) + break; + *colon = '\0'; + + if (get_u32(&key, *argv, 0)) + return 1; + if (mapping_cb(key, colon + 1, mapping_cb_data)) + return 1; + + argc--, argv++; + } + + *argcp = argc; + *argvp = argv; + return 0; +} From patchwork Sun Nov 8 15:07:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 322124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB526C55ABD for ; Sun, 8 Nov 2020 15:08:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9944B206F9 for ; Sun, 8 Nov 2020 15:08:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pmachata.org header.i=@pmachata.org header.b="HaTF3zN1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728669AbgKHPIu (ORCPT ); Sun, 8 Nov 2020 10:08:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728603AbgKHPIi (ORCPT ); Sun, 8 Nov 2020 10:08:38 -0500 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050::465:201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B83C0613D2 for ; Sun, 8 Nov 2020 07:08:38 -0800 (PST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4CTcvm5cb4zQky8; Sun, 8 Nov 2020 16:08:36 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmachata.org; s=MBO0001; t=1604848114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=knKqnF1zJmuRCXbT34BozvnJMAmwYT+16StvsvU/LEQ=; b=HaTF3zN1xeUkANGSlVcGENKgdMGm9DtptMQ2yYqeS/XhPu9+tJoQ+1ZN51s7Gz397uygb9 vfWpBR/ZgPb1pKiasb/c/RMQs9shWnMVSrNdxkYbodWCXlYiLuo1nEn7KuddkHEMK/iam3 D5YyGtX6GpPemASrmdgSC32UDrVgzRSJfvbgqZLwcVOnNPgTXbMnfAkiQ5RUpQxPhmI37r eKBCN7bYDkcf051uTIHYRbyrdwxkSDxWbfNKKf+3A4UjpjGvInBZzOeeVFBHpuOkEgXZrk A+ODt00AhDU6cw9VuZDejPTJJnFFCSaZ3N9kIIs6JMJgQWYLgIpAs6S6qZ9j3w== Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id vdl13X80di1l; Sun, 8 Nov 2020 16:08:33 +0100 (CET) From: Petr Machata To: netdev@vger.kernel.org, dsahern@gmail.com, stephen@networkplumber.org Cc: john.fastabend@gmail.com, jiri@nvidia.com, idosch@nvidia.com, Jakub Kicinski , Roman Mashak , Leon Romanovsky , Petr Machata Subject: [PATCH iproute2-next v3 09/11] lib: parse_mapping: Recognize a keyword "all" Date: Sun, 8 Nov 2020 16:07:30 +0100 Message-Id: <7415644e8a733b7984d576a2d3bc2632b79145d0.1604847919.git.me@pmachata.org> In-Reply-To: References: MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.14 / 15.00 / 15.00 X-Rspamd-Queue-Id: B2C9DEF7 X-Rspamd-UID: 297709 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The DCB tool will have to provide an interface to a number of fixed-size arrays. Unlike the egress- and ingress-qos-map, it makes good sense to have an interface to set all members to the same value. For example to set strict priority on all TCs besides select few, or to reset allocated bandwidth to all zeroes, again besides several explicitly-given ones. To support this usage, extend the parse_mapping() with a boolean that determines whether this special use is supported. If "all" is given and recognized, mapping_cb is called with the key of -1. Have iplink_vlan pass false for allow_all. Signed-off-by: Petr Machata --- include/utils.h | 2 +- ip/iplink_vlan.c | 2 +- lib/utils.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/utils.h b/include/utils.h index 2d1a587cb1ef..588fceb72442 100644 --- a/include/utils.h +++ b/include/utils.h @@ -329,7 +329,7 @@ int parse_one_of(const char *msg, const char *realval, const char * const *list, size_t len, int *p_err); bool parse_on_off(const char *msg, const char *realval, int *p_err); -int parse_mapping(int *argcp, char ***argvp, +int parse_mapping(int *argcp, char ***argvp, bool allow_all, int (*mapping_cb)(__u32 key, char *value, void *data), void *mapping_cb_data); diff --git a/ip/iplink_vlan.c b/ip/iplink_vlan.c index dadc349db16c..1426f2afca23 100644 --- a/ip/iplink_vlan.c +++ b/ip/iplink_vlan.c @@ -69,7 +69,7 @@ static int vlan_parse_qos_map(int *argcp, char ***argvp, struct nlmsghdr *n, tail = addattr_nest(n, 1024, attrtype); - if (parse_mapping(argcp, argvp, &parse_qos_mapping, n)) + if (parse_mapping(argcp, argvp, false, &parse_qos_mapping, n)) return 1; addattr_nest_end(n, tail); diff --git a/lib/utils.c b/lib/utils.c index 67d64df7e3e6..a0ba5181160e 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1764,7 +1764,7 @@ bool parse_on_off(const char *msg, const char *realval, int *p_err) return parse_one_of(msg, realval, values_on_off, ARRAY_SIZE(values_on_off), p_err); } -int parse_mapping(int *argcp, char ***argvp, +int parse_mapping(int *argcp, char ***argvp, bool allow_all, int (*mapping_cb)(__u32 key, char *value, void *data), void *mapping_cb_data) { @@ -1780,7 +1780,9 @@ int parse_mapping(int *argcp, char ***argvp, break; *colon = '\0'; - if (get_u32(&key, *argv, 0)) { + if (allow_all && matches(*argv, "all") == 0) { + key = (__u32) -1; + } else if (get_u32(&key, *argv, 0)) { ret = 1; break; } From patchwork Sun Nov 8 15:07:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 322125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF7EDC4742C for ; Sun, 8 Nov 2020 15:08:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 894A0206F9 for ; Sun, 8 Nov 2020 15:08:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pmachata.org header.i=@pmachata.org header.b="vgZys5vA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728660AbgKHPIo (ORCPT ); Sun, 8 Nov 2020 10:08:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728617AbgKHPIm (ORCPT ); Sun, 8 Nov 2020 10:08:42 -0500 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050::465:102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E73C0613D2 for ; Sun, 8 Nov 2020 07:08:41 -0800 (PST) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4CTcvq60GczQlLp; Sun, 8 Nov 2020 16:08:39 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmachata.org; s=MBO0001; t=1604848118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J5AUQJLSWkW6Cvod4xw0/VAPdxFFmOcxBVzggDZtvJ4=; b=vgZys5vAGuZ8jrn4KWTXsj+dKb1PmPnfpxnY0hh7/GGh4oLReIoZ7Zbi8W68Fie9Zqh/lF EzyJqrcYZt5nfHjSL7EfMAYoN0Ljk91zFvjcSYOqum8eqseJBZ+DDW0wGQeZFsYihoiF4h +asYcq+wq3edpVfDJOLHTbHNPNfz4UWxpTMFhM82UaY7z/nxBCVV93CuRq4LLTXi03sZtz COA/dTl13aPKWuctM4oTeiIBuBzRlg67XfVwXXBYFb8Annd7lsh3Dq2GqW5tbwXdCpI2kx guBjwkXwmZqGwYQ61mS8KSfp3FS7Cbiscf191X+agmKQYllFlJcx8ErX511QYg== Received: from smtp2.mailbox.org ([80.241.60.241]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id 7U8GmwPj1LqV; Sun, 8 Nov 2020 16:08:35 +0100 (CET) From: Petr Machata To: netdev@vger.kernel.org, dsahern@gmail.com, stephen@networkplumber.org Cc: john.fastabend@gmail.com, jiri@nvidia.com, idosch@nvidia.com, Jakub Kicinski , Roman Mashak , Leon Romanovsky , Petr Machata Subject: [PATCH iproute2-next v3 11/11] dcb: Add a subtool for the DCB ETS object Date: Sun, 8 Nov 2020 16:07:32 +0100 Message-Id: <9aa69e80900fe86b2200785055ea55b18ec3c7ec.1604847919.git.me@pmachata.org> In-Reply-To: References: MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 0.10 / 15.00 / 15.00 X-Rspamd-Queue-Id: C65761709 X-Rspamd-UID: 8f63b3 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ETS, for "Enhanced Transmission Selection", is a set of configurations that permit configuration of mapping of priorities to traffic classes, traffic selection algorithm to use per traffic class, bandwidth allocation, etc. Add a dcb subtool to allow showing and tweaking of individual ETS configuration options. For example: # dcb ets show dev eni1np1 willing on ets_cap 8 cbs off tc-bw 0:0 1:0 2:0 3:0 4:100 5:0 6:0 7:0 pg-bw 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 tc-tsa 0:strict 1:strict 2:strict 3:strict 4:ets 5:strict 6:strict 7:strict prio-tc 0:1 1:3 2:5 3:0 4:0 5:0 6:0 7:0 reco-tc-bw 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 reco-tc-tsa 0:strict 1:strict 2:strict 3:strict 4:strict 5:strict 6:strict 7:strict reco-prio-tc 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 Signed-off-by: Petr Machata --- Notes: v3: - Formatting tweaks in the man page dcb/Makefile | 2 +- dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_ets.c | 430 +++++++++++++++++++++++++++++++++++++++++++++ man/man8/dcb-ets.8 | 185 +++++++++++++++++++ man/man8/dcb.8 | 11 ++ 6 files changed, 634 insertions(+), 2 deletions(-) create mode 100644 dcb/dcb_ets.c create mode 100644 man/man8/dcb-ets.8 diff --git a/dcb/Makefile b/dcb/Makefile index 9966c8f0bfa4..895817163562 100644 --- a/dcb/Makefile +++ b/dcb/Makefile @@ -5,7 +5,7 @@ TARGETS := ifeq ($(HAVE_MNL),y) -DCBOBJ = dcb.o +DCBOBJ = dcb.o dcb_ets.o TARGETS += dcb endif diff --git a/dcb/dcb.c b/dcb/dcb.c index 5c4969e4f651..738975a0e359 100644 --- a/dcb/dcb.c +++ b/dcb/dcb.c @@ -286,7 +286,7 @@ static void dcb_help(void) fprintf(stderr, "Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n" " dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n" - "where OBJECT :=\n" + "where OBJECT := ets\n" " OPTIONS := [ -V | --Version | -j | --json | -p | --pretty | -v | --verbose ]\n"); } @@ -295,6 +295,8 @@ static int dcb_cmd(struct dcb *dcb, int argc, char **argv) if (!argc || matches(*argv, "help") == 0) { dcb_help(); return 0; + } else if (matches(*argv, "ets") == 0) { + return dcb_cmd_ets(dcb, argc - 1, argv + 1); } fprintf(stderr, "Object \"%s\" is unknown\n", *argv); diff --git a/dcb/dcb.h b/dcb/dcb.h index 1d31a0f94652..9b46e09178be 100644 --- a/dcb/dcb.h +++ b/dcb/dcb.h @@ -32,4 +32,8 @@ void dcb_print_array_num(FILE *fp, const __u8 *array, size_t size); void dcb_print_array_kw(FILE *fp, const __u8 *array, size_t array_size, const char *const kw[], size_t kw_size); +/* dcb_ets.c */ + +int dcb_cmd_ets(struct dcb *dcb, int argc, char **argv); + #endif /* __DCB_H__ */ diff --git a/dcb/dcb_ets.c b/dcb/dcb_ets.c new file mode 100644 index 000000000000..cc3f30ef5c82 --- /dev/null +++ b/dcb/dcb_ets.c @@ -0,0 +1,430 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include + +#include "dcb.h" +#include "utils.h" + +static void dcb_ets_help_set(void) +{ + fprintf(stderr, + "Usage: dcb ets set dev STRING\n" + " [ willing { on | off } ]\n" + " [ { tc-tsa | reco-tc-tsa } TSA-MAP ]\n" + " [ { pg-bw | tc-bw | reco-tc-bw } BW-MAP ]\n" + " [ { prio-tc | reco-prio-tc } PRIO-MAP ]\n" + "\n" + " where TSA-MAP := [ TSA-MAP ] TSA-MAPPING\n" + " TSA-MAPPING := { all | TC }:{ strict | cbs | ets | vendor }\n" + " BW-MAP := [ BW-MAP ] BW-MAPPING\n" + " BW-MAPPING := { all | TC }:INTEGER\n" + " PRIO-MAP := [ PRIO-MAP ] PRIO-MAPPING\n" + " PRIO-MAPPING := { all | PRIO }:TC\n" + " TC := { 0 .. 7 }\n" + " PRIO := { 0 .. 7 }\n" + "\n" + ); +} + +static void dcb_ets_help_show(void) +{ + fprintf(stderr, + "Usage: dcb ets show dev STRING\n" + " [ willing | ets-cap | cbs | tc-tsa | reco-tc-tsa |\n" + " pg-bw | tc-bw | reco-tc-bw | prio-tc |\n" + " reco-prio-tc ]\n" + "\n" + ); +} + +static void dcb_ets_help(void) +{ + fprintf(stderr, + "Usage: dcb ets help\n" + "\n" + ); + dcb_ets_help_show(); + dcb_ets_help_set(); +} + +static const char *const tsa_names[] = { + [IEEE_8021QAZ_TSA_STRICT] = "strict", + [IEEE_8021QAZ_TSA_CB_SHAPER] = "cbs", + [IEEE_8021QAZ_TSA_ETS] = "ets", + [IEEE_8021QAZ_TSA_VENDOR] = "vendor", +}; + +static int dcb_ets_parse_mapping_tc_tsa(__u32 key, char *value, void *data) +{ + __u8 tsa; + int ret; + + tsa = parse_one_of("TSA", value, tsa_names, ARRAY_SIZE(tsa_names), &ret); + if (ret) + return ret; + + return dcb_parse_mapping(key, tsa, -1, data, "TC", "TSA"); +} + +static int dcb_ets_parse_mapping_tc_int(__u32 key, char *value, __u8 max_value, __u8 *array, + const char *what_key, const char *what_value) +{ + __u8 int_value; + + if (get_u8(&int_value, value, 0)) + return -EINVAL; + + return dcb_parse_mapping(key, int_value, max_value, array, what_key, what_value); +} + +static int dcb_ets_parse_mapping_tc_bw(__u32 key, char *value, void *data) +{ + return dcb_ets_parse_mapping_tc_int(key, value, 100, data, "TC", "BW"); +} + +static int dcb_ets_parse_mapping_prio_tc(unsigned int key, char *value, void *data) +{ + return dcb_ets_parse_mapping_tc_int(key, value, IEEE_8021QAZ_MAX_TCS, data, "PRIO", "TC"); +} + +static void dcb_print_array_tsa(FILE *fp, const __u8 *array, size_t size) +{ + dcb_print_array_kw(fp, array, size, tsa_names, ARRAY_SIZE(tsa_names)); +} + +static void dcb_ets_print_willing(FILE *fp, const struct ieee_ets *ets) +{ + print_on_off(PRINT_ANY, "willing", "willing %s ", ets->willing); +} + +static void dcb_ets_print_ets_cap(FILE *fp, const struct ieee_ets *ets) +{ + print_uint(PRINT_ANY, "ets_cap", "ets_cap %d ", ets->ets_cap); +} + +static void dcb_ets_print_cbs(FILE *fp, const struct ieee_ets *ets) +{ + print_on_off(PRINT_ANY, "cbs", "cbs %s ", ets->cbs); +} + +static void dcb_ets_print_tc_bw(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "tc-bw", "tc_bw", + ets->tc_tx_bw, ARRAY_SIZE(ets->tc_tx_bw), + dcb_print_array_num); +} + +static void dcb_ets_print_pg_bw(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "pg-bw", "pg_bw", + ets->tc_rx_bw, ARRAY_SIZE(ets->tc_rx_bw), + dcb_print_array_num); +} + +static void dcb_ets_print_tc_tsa(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "tc-tsa", "tc_tsa", + ets->tc_tsa, ARRAY_SIZE(ets->tc_tsa), + dcb_print_array_tsa); +} + +static void dcb_ets_print_prio_tc(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "prio-tc", "prio_tc", + ets->prio_tc, ARRAY_SIZE(ets->prio_tc), + dcb_print_array_num); +} + +static void dcb_ets_print_reco_tc_bw(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "reco-tc-bw", "reco_tc_bw", + ets->tc_reco_bw, ARRAY_SIZE(ets->tc_reco_bw), + dcb_print_array_num); +} + +static void dcb_ets_print_reco_tc_tsa(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "reco-tc-tsa", "reco_tc_tsa", + ets->tc_reco_tsa, ARRAY_SIZE(ets->tc_reco_tsa), + dcb_print_array_tsa); +} + +static void dcb_ets_print_reco_prio_tc(FILE *fp, const struct ieee_ets *ets) +{ + dcb_print_named_array(fp, "reco-prio-tc", "reco_prio_tc", + ets->reco_prio_tc, ARRAY_SIZE(ets->reco_prio_tc), + dcb_print_array_num); +} + +static void dcb_ets_print(FILE *fp, const struct ieee_ets *ets) +{ + dcb_ets_print_willing(fp, ets); + dcb_ets_print_ets_cap(fp, ets); + dcb_ets_print_cbs(fp, ets); + print_nl(); + + dcb_ets_print_tc_bw(fp, ets); + print_nl(); + + dcb_ets_print_pg_bw(fp, ets); + print_nl(); + + dcb_ets_print_tc_tsa(fp, ets); + print_nl(); + + dcb_ets_print_prio_tc(fp, ets); + print_nl(); + + dcb_ets_print_reco_tc_bw(fp, ets); + print_nl(); + + dcb_ets_print_reco_tc_tsa(fp, ets); + print_nl(); + + dcb_ets_print_reco_prio_tc(fp, ets); + print_nl(); +} + +static int dcb_ets_get(struct dcb *dcb, const char *dev, struct ieee_ets *ets) +{ + return dcb_get_attribute(dcb, dev, DCB_ATTR_IEEE_ETS, ets, sizeof(*ets)); +} + +static int dcb_ets_validate_bw(const __u8 bw[], const __u8 tsa[], const char *what) +{ + bool has_ets = false; + unsigned int total = 0; + unsigned int tc; + + for (tc = 0; tc < IEEE_8021QAZ_MAX_TCS; tc++) { + if (tsa[tc] == IEEE_8021QAZ_TSA_ETS) { + has_ets = true; + break; + } + } + + /* TC bandwidth is only intended for ETS, but 802.1Q-2018 only requires + * that the sum be 100, and individual entries 0..100. It explicitly + * notes that non-ETS TCs can have non-0 TC bandwidth during + * reconfiguration. + */ + for (tc = 0; tc < IEEE_8021QAZ_MAX_TCS; tc++) { + if (bw[tc] > 100) { + fprintf(stderr, "%d%% for TC %d of %s is not a valid bandwidth percentage, expected 0..100%%\n", + bw[tc], tc, what); + return -EINVAL; + } + total += bw[tc]; + } + + /* This is what 802.1Q-2018 requires. */ + if (total == 100) + return 0; + + /* But this requirement does not make sense for all-strict + * configurations. Anything else than 0 does not make sense: either BW + * has not been reconfigured for the all-strict allocation yet, at which + * point we expect sum of 100. Or it has already been reconfigured, at + * which point accept 0. + */ + if (!has_ets && total == 0) + return 0; + + fprintf(stderr, "Bandwidth percentages in %s sum to %d%%, expected %d%%\n", + what, total, has_ets ? 100 : 0); + return -EINVAL; +} + +static int dcb_ets_set(struct dcb *dcb, const char *dev, const struct ieee_ets *ets) +{ + /* Do not validate pg-bw, which is not standard and has unclear + * meaning. + */ + if (dcb_ets_validate_bw(ets->tc_tx_bw, ets->tc_tsa, "tc-bw") || + dcb_ets_validate_bw(ets->tc_reco_bw, ets->tc_reco_tsa, "reco-tc-bw")) + return -EINVAL; + + return dcb_set_attribute(dcb, dev, DCB_ATTR_IEEE_ETS, ets, sizeof(*ets)); +} + +static int dcb_cmd_ets_set(struct dcb *dcb, const char *dev, int argc, char **argv) +{ + struct ieee_ets ets; + int ret; + + if (!argc) { + dcb_ets_help_set(); + return 1; + } + + ret = dcb_ets_get(dcb, dev, &ets); + if (ret) + return ret; + + do { + if (matches(*argv, "help") == 0) { + dcb_ets_help_set(); + return 0; + } else if (matches(*argv, "willing") == 0) { + NEXT_ARG(); + ets.willing = parse_on_off("willing", *argv, &ret); + if (ret) + return ret; + } else if (matches(*argv, "tc-tsa") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_tc_tsa, + ets.tc_tsa); + if (ret) { + fprintf(stderr, "Invalid tc-tsa mapping %s\n", *argv); + return ret; + } + continue; + } else if (matches(*argv, "reco-tc-tsa") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_tc_tsa, + ets.tc_reco_tsa); + if (ret) { + fprintf(stderr, "Invalid reco-tc-tsa mapping %s\n", *argv); + return ret; + } + continue; + } else if (matches(*argv, "tc-bw") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_tc_bw, + ets.tc_tx_bw); + if (ret) { + fprintf(stderr, "Invalid tc-bw mapping %s\n", *argv); + return ret; + } + continue; + } else if (matches(*argv, "pg-bw") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_tc_bw, + ets.tc_rx_bw); + if (ret) { + fprintf(stderr, "Invalid pg-bw mapping %s\n", *argv); + return ret; + } + continue; + } else if (matches(*argv, "reco-tc-bw") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_tc_bw, + ets.tc_reco_bw); + if (ret) { + fprintf(stderr, "Invalid reco-tc-bw mapping %s\n", *argv); + return ret; + } + continue; + } else if (matches(*argv, "prio-tc") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_prio_tc, + ets.prio_tc); + if (ret) { + fprintf(stderr, "Invalid prio-tc mapping %s\n", *argv); + return ret; + } + continue; + } else if (matches(*argv, "reco-prio-tc") == 0) { + NEXT_ARG(); + ret = parse_mapping(&argc, &argv, true, &dcb_ets_parse_mapping_prio_tc, + ets.reco_prio_tc); + if (ret) { + fprintf(stderr, "Invalid reco-prio-tc mapping %s\n", *argv); + return ret; + } + continue; + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_ets_help_set(); + return -EINVAL; + } + + NEXT_ARG_FWD(); + } while (argc > 0); + + return dcb_ets_set(dcb, dev, &ets); +} + +static int dcb_cmd_ets_show(struct dcb *dcb, const char *dev, int argc, char **argv) +{ + struct ieee_ets ets; + int ret; + + ret = dcb_ets_get(dcb, dev, &ets); + if (ret) + return ret; + + open_json_object(NULL); + + if (!argc) { + dcb_ets_print(stdout, &ets); + goto out; + } + + do { + if (matches(*argv, "help") == 0) { + dcb_ets_help(); + return 0; + } else if (matches(*argv, "willing") == 0) { + dcb_ets_print_willing(stdout, &ets); + print_nl(); + } else if (matches(*argv, "ets-cap") == 0) { + dcb_ets_print_ets_cap(stdout, &ets); + print_nl(); + } else if (matches(*argv, "cbs") == 0) { + dcb_ets_print_cbs(stdout, &ets); + print_nl(); + } else if (matches(*argv, "tc-tsa") == 0) { + dcb_ets_print_tc_tsa(stdout, &ets); + print_nl(); + } else if (matches(*argv, "reco-tc-tsa") == 0) { + dcb_ets_print_reco_tc_tsa(stdout, &ets); + print_nl(); + } else if (matches(*argv, "tc-bw") == 0) { + dcb_ets_print_tc_bw(stdout, &ets); + print_nl(); + } else if (matches(*argv, "pg-bw") == 0) { + dcb_ets_print_pg_bw(stdout, &ets); + print_nl(); + } else if (matches(*argv, "reco-tc-bw") == 0) { + dcb_ets_print_reco_tc_bw(stdout, &ets); + print_nl(); + } else if (matches(*argv, "prio-tc") == 0) { + dcb_ets_print_prio_tc(stdout, &ets); + print_nl(); + } else if (matches(*argv, "reco-prio-tc") == 0) { + dcb_ets_print_reco_prio_tc(stdout, &ets); + print_nl(); + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_ets_help(); + return -EINVAL; + } + + NEXT_ARG_FWD(); + } while (argc > 0); + +out: + close_json_object(); + return 0; +} + +int dcb_cmd_ets(struct dcb *dcb, int argc, char **argv) +{ + if (!argc || matches(*argv, "help") == 0) { + dcb_ets_help(); + return 0; + } else if (matches(*argv, "show") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_ets_show, dcb_ets_help_show); + } else if (matches(*argv, "set") == 0) { + NEXT_ARG_FWD(); + return dcb_cmd_parse_dev(dcb, argc, argv, dcb_cmd_ets_set, dcb_ets_help_set); + } else { + fprintf(stderr, "What is \"%s\"?\n", *argv); + dcb_ets_help(); + return -EINVAL; + } +} diff --git a/man/man8/dcb-ets.8 b/man/man8/dcb-ets.8 new file mode 100644 index 000000000000..81d8c5bce7e6 --- /dev/null +++ b/man/man8/dcb-ets.8 @@ -0,0 +1,185 @@ +.TH DCB-ETS 8 "19 October 2020" "iproute2" "Linux" +.SH NAME +dcb-ets \- show / manipulate ETS (Enhanced Transmission Selection) settings of +the DCB (Data Center Bridging) subsystem +.SH SYNOPSIS +.sp +.ad l +.in +8 + +.ti -8 +.B dcb +.RI "[ " OPTIONS " ] " +.B ets +.RI "{ " COMMAND " | " help " }" +.sp + +.ti -8 +.B dcb ets show dev +.RI DEV +.RB "[ { " willing " | " ets-cap " | " cbs " | " tc-tsa " | " reco-tc-tsa +.RB " | " pg-bw " | " tc-bw " | " reco-tc-bw " | " prio-tc +.RB " | " reco-prio-tc " } ]" + +.ti -8 +.B dcb ets set dev +.RI DEV +.RB "[ " willing " { " on " | " off " } ]" +.RB "[ { " tc-tsa " | " reco-tc-tsa " } " \fITSA-MAP\fB " ]" +.RB "[ { " pg-bw " | " tc-bw " | " reco-tc-bw " } " \fIBW-MAP\fB " ]" +.RB "[ { " prio-tc " | " reco-prio-tc " } " \fIPRIO-MAP\fB " ]" + +.ti -8 +.IR TSA-MAP " := [ " TSA-MAP " ] " TSA-MAPPING + +.ti -8 +.IR TSA-MAPPING " := { " TC " | " \fBall " }" \fB: "{ " \fBstrict\fR " | " +.IR \fBcbs\fR " | " \fBets\fR " | " \fBvendor\fR " }" + +.ti -8 +.IR BW-MAP " := [ " BW-MAP " ] " BW-MAPPING + +.ti -8 +.IR BW-MAPPING " := { " TC " | " \fBall " }" \fB:\fIINTEGER\fR + +.ti -8 +.IR PRIO-MAP " := [ " PRIO-MAP " ] " PRIO-MAPPING + +.ti -8 +.IR PRIO-MAPPING " := { " PRIO " | " \fBall " }" \fB:\fITC\fR + +.ti -8 +.IR TC " := { " \fB0\fR " .. " \fB7\fR " }" + +.ti -8 +.IR PRIO " := { " \fB0\fR " .. " \fB7\fR " }" + + +.SH DESCRIPTION + +.B dcb ets +is used to configure Enhanced Transmission Selection attributes through Linux +DCB (Data Center Bridging) interface. ETS permits configuration of mapping of +priorities to traffic classes, traffic selection algorithm to use per traffic +class, bandwidth allocation, etc. + +Two DCB TLVs are related to the ETS feature: a configuration and recommendation +values. Recommendation values are named with a prefix +.B reco-, +while the configuration ones have plain names. + +.SH PARAMETERS + +For read-write parameters, the following describes only the write direction, +i.e. as used with the \fBset\fR command. For the \fBshow\fR command, the +parameter name is to be used as a simple keyword without further arguments. This +instructs the tool to show the value of a given parameter. When no parameters +are given, the tool shows the complete ETS configuration. + +.TP +.B ets-cap +A read-only property that shows the number of supported ETS traffic classes. + +.TP +.B cbs +A read-only property that is enabled if the driver and the hardware support the +CBS Transmission Selection Algorithm. + +.TP +.B willing \fR{ \fBon\fR | \fBoff\fR } +Whether local host should accept configuration from peer TLVs. + +.TP +.B prio-tc \fITC-MAP +.TQ +.B reco-prio-tc \fITC-MAP +\fITC-MAP\fR uses the array parameter syntax, see dcb(8) for details. Keys are +priorities, values are traffic classes. For each priority sets a TC where +traffic with that priority is directed to. + +.TP +.B tc-tsa \fITSA-MAP +.TQ +.B reco-tc-tsa \fITSA-MAP +\fITC-MAP\fR uses the array parameter syntax, see dcb(8) for details. Keys are +TCs, values are Transmission Selection Algorithm (TSA) keywords described below. +For each TC sets an algorithm used for deciding how traffic queued up at this TC +is scheduled for transmission. Supported TSAs are: + +.B strict +- for strict priority, where traffic in higher-numbered TCs always takes +precedence over traffic in lower-numbered TCs. +.br +.B ets +- for Enhanced Traffic Selection, where available bandwidth is distributed among +the ETS-enabled TCs according to the weights set by +.B tc-bw +and +.B reco-tc-bw\fR, +respectively. +.br +.B cbs +- for Credit Based Shaper, where traffic is scheduled in a strict manner up to +the limit set by a shaper. +.br +.B vendor +- for vendor-specific traffic selection algorithm. + +.TP +.B tc-bw \fIBW-MAP +.TQ +.B reco-tc-bw \fIBW-MAP +\fIBW-MAP\fR uses the array parameter syntax, see dcb(8) for details. Keys are +TCs, values are integers representing percent of available bandwidth given to +the traffic class in question. The value should be 0 for TCs whose TSA is not +\fBets\fR, and the sum of all values shall be 100. As an exception to the +standard wording, a configuration with no ETS TCs is permitted to sum up to 0 +instead. +.br + +.TP +.B pg-bw \fIBW-MAP +The precise meaning of \fBpg-bw\fR is not standardized, but the assumption seems +to be that the same scheduling process as on the transmit side is applicable on +receive side as well, and configures receive bandwidth allocation for \fBets\fR +ingress traffic classes (priority groups). + +.SH EXAMPLE & USAGE + +Configure ETS priomap in a one-to-one fashion: + +.P +# dcb ets set dev eth0 prio-tc 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 + +Set TSA and transmit bandwidth configuration: + +.P +# dcb ets set dev eth0 tc-tsa all:strict 0:ets 1:ets 2:ets \\ +.br + tc-bw all:0 0:33 1:33 2:34 + +Show what was set: + +.P +# dcb ets show dev eth0 prio-tc tc-tsa tc-bw +.br +prio-tc 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 +.br +tc-tsa 0:ets 1:ets 2:ets 3:strict 4:strict 5:strict 6:strict 7:strict +.br +tc-bw 0:33 1:33 2:34 3:0 4:0 5:0 6:0 7:0 + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR dcb (8) + +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Petr Machata diff --git a/man/man8/dcb.8 b/man/man8/dcb.8 index 19433bfb906d..f318435caa98 100644 --- a/man/man8/dcb.8 +++ b/man/man8/dcb.8 @@ -6,6 +6,13 @@ dcb \- show / manipulate DCB (Data Center Bridging) settings .ad l .in +8 +.ti -8 +.B dcb +.RI "[ " OPTIONS " ] " +.B ets +.RI "{ " COMMAND " | " help " }" +.sp + .ti -8 .B dcb .RB "[ " -force " ] " @@ -46,6 +53,10 @@ When combined with -j generate a pretty JSON output. .SH OBJECTS +.TP +.B ets +- Configuration of ETS (Enhanced Transmission Selection) + .SH COMMANDS A \fICOMMAND\fR specifies the action to perform on the object. The set of