DCB socket buffer is allocated in dcb_init(), but never freed(). Free it
in dcb_fini().
Signed-off-by: Petr Machata
---
dcb/dcb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dcb/dcb.c b/dcb/dcb.c
index f5c62790e27e..0e3c87484f2a 100644
--- a/dcb/dcb.c
+++ b/dcb/dcb.c
@@ -38,6 +38,7
() as a thin wrapper for
IEEE-nested access, and dcb_get_attribute_bare() for access to attributes
that are not nested.
Rewrite dcb_get_attribute() in terms of the new dcb_get_attribute_va().
Signed-off-by: Petr Machata
---
dcb/dcb.c | 79 ---
dcb
Some DSCP values can be translated to symbolic names. That may not be
always desirable. Introduce a command-line option similar to other
tools, -n or --no-nice-names, to suppress this translation.
Signed-off-by: Petr Machata
---
dcb/dcb.c | 9 +++--
dcb/dcb.h | 1 +
man/man8/dcb.8
o the kernel and
ixgbe driver")
Signed-off-by: Petr Machata
---
net/dcb/dcbnl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 084e159a12ba..7d49b6fd6cef 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1765,6 +1765,8 @@ static int dcb_d
"dcb ets show dev X help" currently shows full "ets" help instead of just
help for the show command. Fix it.
Signed-off-by: Petr Machata
---
dcb/dcb_ets.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dcb/dcb_ets.c b/dcb/dcb_ets.c
index 173588
6:6 7:0
buffer-size 0:1 1:0 2:0 3:7 4:0 5:0 6:1 7:0
total-size 221072
Signed-off-by: Petr Machata
---
dcb/Makefile | 2 +-
dcb/dcb.c | 4 +-
dcb/dcb.h | 4 +
dcb/dcb_buffer.c | 235 ++
man
None, one, or many parameters can be given on the command line, but
the current synopsis allows only none or one. Fix it.
Signed-off-by: Petr Machata
---
dcb/dcb_ets.c | 6 +++---
man/man8/dcb-ets.8 | 13 ++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/dcb
Patches #6 and #7 add support for command line arguments -s and -i. These
enable, respectively, display of statistical counters, and ISO/IEC mode of
rate units.
Patches #8-#10 add the subtools themselves and their man pages.
Petr Machata (10):
dcb: Remove unsupported command line arguments from g
0:25Gbit 1:25Gbit 2:25Gbit 3:25Gbit 4:25Gbit 5:25Gbit 6:100Gbit
7:25Gbit
Signed-off-by: Petr Machata
---
dcb/Makefile | 2 +-
dcb/dcb.c | 4 +-
dcb/dcb.h | 4 +
dcb/dcb_maxrate.c | 182 +
man/man8/dcb-maxrate
Signed-off-by: Petr Machata
---
man/man8/dcb-ets.8 | 1 -
1 file changed, 1 deletion(-)
diff --git a/man/man8/dcb-ets.8 b/man/man8/dcb-ets.8
index 1ef0948fb062..9c64b33e30ff 100644
--- a/man/man8/dcb-ets.8
+++ b/man/man8/dcb-ets.8
@@ -61,7 +61,6 @@ the DCB (Data Center Bridging) subsystem
.ti
The DCB buffer object has a settable array of 32-bit quantities, and the
maxrate object of 64-bit ones. Adjust dcb_parse_mapping() and related
helpers to support 64-bit values in mappings, and add appropriate helpers.
Signed-off-by: Petr Machata
---
dcb/dcb.c | 22 ++
dcb
getopt_long() currently includes "c" and "n" in the short option string.
These probably slipped in as a cut'n'paste, and are not actually accepted.
Remove them.
Signed-off-by: Petr Machata
---
dcb/dcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff
Allow switching "dcb" into the ISO/IEC mode of units by passing -i.
Signed-off-by: Petr Machata
---
dcb/dcb.c | 10 +++---
dcb/dcb.h | 1 +
man/man8/dcb.8 | 5 +
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dcb/dcb.c b/dcb/dcb.c
index 93
Allow selective display of statistical counters by passing -s.
Signed-off-by: Petr Machata
---
dcb/dcb.c | 9 +++--
dcb/dcb.h | 1 +
man/man8/dcb.8 | 5 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dcb/dcb.c b/dcb/dcb.c
index 7c0beee43686..9332a8b2e3d4
-bypass on delay 0
pg-pfc 0:off 1:on 2:off 3:off 4:off 5:off 6:off 7:on
requests 0:0 1:217 2:0 3:0 4:0 5:0 6:0 7:28
indications 0:0 1:179 2:0 3:0 4:0 5:0 6:0 7:18
Signed-off-by: Petr Machata
---
dcb/Makefile | 2 +-
dcb/dcb.c | 27 -
dcb/dcb.h | 6 +
dcb
The function get_size() serves for parsing of sizes using a handly notation
that supports units and their prefixes, such as 10Kbit. This will be useful
for the DCB buffer size parsing. Move the function from TC to the general
library, so that it can be reused.
Signed-off-by: Petr Machata
sprint_size() function.
Petr Machata (7):
Move the use_iec declaration to the tools
lib: Move print_rate() from tc here; modernize
lib: Move sprint_size() from tc here, add print_size()
lib: sprint_size(): Uncrustify the code a bit
lib: print_color_rate(): Fix formatting small rates in IEC
number, without human-readable frills.
- q_cake, which relies on the existence of sprint_size() in its macro-based
formatting helpers. There might be ways to convert this particular case,
but given q_tbf simply cannot be converted, leave it as is.
Signed-off-by: Petr Machata
---
inclu
just uses print_rate().
Signed-off-by: Petr Machata
---
Notes:
v2:
- Adapt q_mqprio.c patch, the file changed since v1.
include/json_print.h | 10 ++
lib/json_print.c | 32
tc/m_police.c| 9 -
tc/q_cake.c | 28
string, formatting 1Kbit in IEC mode as "1000ibit".
Fix by omitting the letter if there is no prefix.
Signed-off-by: Petr Machata
---
lib/json_print.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/json_print.c b/lib/json_print.c
index d28e957c9603..b0861
The functions get_rate() and get_rate64() are useful for parsing rate-like
values. The DCB tool will find these useful in the maxrate subtool.
Move them over to lib so that they can be easily reused.
Signed-off-by: Petr Machata
---
include/utils.h | 2 ++
lib/utils.c | 79
Ideally this and the rate printing would both be converted to a common
helper, but unfortunately the two format differently and this would break
tests and scripts out there. So just make the code look less like a wad of
hay.
Signed-off-by: Petr Machata
---
Notes:
v2:
- This patch is new
"tc", but is nonetheless declared in util.h.
Instead, move the declaration to tool-specific headers ip/ip_common.h and
tc/tc_common.h.
Signed-off-by: Petr Machata
---
include/utils.h | 1 -
ip/ip_common.h | 2 ++
tc/tc_common.h | 1 +
3 files changed, 3 insertions(+), 1 deletion
David Ahern writes:
> diff --git a/lib/Makefile b/lib/Makefile
> index e37585c6..603ea83e 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -13,7 +13,10 @@ UTILOBJ += bpf_libbpf.o
> endif
> endif
>
> -NLOBJ=libgenl.o libnetlink.o mnl_utils.o
> +NLOBJ=libgenl.o libnetlink.o
> +ifeq ($(HA
Stephen Hemminger writes:
>> +int print_color_rate(bool use_iec, enum output_type t, enum color_attr
>> color,
>> + const char *key, const char *fmt, unsigned long long rate);
>> +
>> +static inline int print_rate(bool use_iec, enum output_type t,
>> + c
Stephen Hemminger writes:
> On Mon, 30 Nov 2020 23:59:39 +0100
> Petr Machata wrote:
>
>> +char *sprint_size(__u32 sz, char *buf)
>> +{
>> +size_t len = SPRINT_BSIZE - 1;
>> +double tmp = sz;
>> +
>> +if (sz >= 1024*1024 &&am
irectly.
>
> Fixes: 2d9a8dc439ee ("tc: p_ip6: Support pedit of IPv6 dsfield")
> Cc: pe...@mellanox.com
> Signed-off-by: Stephen Hemminger
Reviewed-by: Petr Machata
number, without human-readable frills.
- q_cake, which relies on the existence of sprint_size() in its macro-based
formatting helpers. There might be ways to convert this particular case,
but given q_tbf simply cannot be converted, leave it as is.
Signed-off-by: Petr Machata
---
inclu
string, formatting 1Kbit in IEC mode as "1000ibit".
Fix by omitting the letter if there is no prefix.
Signed-off-by: Petr Machata
---
lib/json_print.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/json_print.c b/lib/json_print.c
index c1df637642fd..625a9
The functions get_rate() and get_rate64() are useful for parsing rate-like
values. The DCB tool will find these useful in the maxrate subtool.
Move them over to lib so that they can be easily reused.
Signed-off-by: Petr Machata
---
include/utils.h | 2 ++
lib/utils.c | 79
just uses print_rate().
Signed-off-by: Petr Machata
---
include/json_print.h | 10 ++
lib/json_print.c | 32
tc/m_police.c| 9 -
tc/q_cake.c | 28
tc/q_cbq.c | 14 --
tc/q_fq.c
"tc", but is nonetheless declared in util.h.
Instead, move the declaration to tool-specific headers ip/ip_common.h and
tc/tc_common.h.
Signed-off-by: Petr Machata
---
include/utils.h | 1 -
ip/ip_common.h | 2 ++
tc/tc_common.h | 1 +
3 files changed, 3 insertions(+), 1 deletion
objects that will make use of them.
Petr Machata (6):
Move the use_iec declaration to the tools
lib: Move print_rate() from tc here; modernize
lib: Move sprint_size() from tc here, add print_size()
lib: Move get_rate(), get_rate64() from tc here
lib: Move get_size() from tc here
lib
The function get_size() serves for parsing of sizes using a handly notation
that supports units and their prefixes, such as 10Kbit. This will be useful
for the DCB buffer size parsing. Move the function from TC to the general
library, so that it can be reused.
Signed-off-by: Petr Machata
Instead of rolling a custom on-off printer, use the one added to utils.c.
Signed-off-by: Petr Machata
---
bridge/link.c | 56 ++-
1 file changed, 24 insertions(+), 32 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index fa6eda849b32
Instead of rolling a custom on-off printer, use the one added to utils.c.
Note that _print_onoff() has an extra parameter for a JSON-specific flag
name. However that argument is not used, and never was. Therefore when
moving over to print_on_off(), drop this argument.
Signed-off-by: Petr Machata
Invoke parse_on_off() instead of rolling a custom function.
Signed-off-by: Petr Machata
---
ip/iplink.c | 47 +--
1 file changed, 17 insertions(+), 30 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index d6b766de1fcf..f5766c39507b 100644
--- a
Convert bridge/link.c from a custom on_off parser to the new global one.
Signed-off-by: Petr Machata
---
bridge/link.c | 79 ---
1 file changed, 37 insertions(+), 42 deletions(-)
diff --git a/bridge/link.c b/bridge/link.c
index 3bc7af209b8b
Invoke parse_on_off() from bridge_slave_parse_on_off() instead of
hand-rolling one. Exit on failure, because the invarg that was ivoked here
before would.
Signed-off-by: Petr Machata
---
ip/iplink_bridge_slave.c | 12
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/ip
Instead of rolling a custom on-off printer, use the one added to utils.c.
Signed-off-by: Petr Machata
---
ip/iptuntap.c | 18 ++
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/ip/iptuntap.c b/ip/iptuntap.c
index 82e384998b1c..e9cc7c0f5f70 100644
--- a/ip
Instead of rolling a custom on-off printer, use the one added to utils.c.
Signed-off-by: Petr Machata
---
ip/ipnetconf.c | 28 +++-
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 0e946ca34b4a..bb0ebe12da93 100644
Two helpers, parse_on_off() and print_on_off(), have been recently added to
lib/utils.c. Convert a number of instances of the same effective behavior
to calls to these helpers.
Petr Machata (7):
bridge: link: Port over to parse_on_off()
bridge: link: Convert to use print_on_off()
ip: iplink
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/inclu
t; is wrong: invalid egress-qos-map
Update argc and argv even in the case of parsing error, so that the right
element is indicated.
Signed-off-by: Petr Machata
---
lib/utils.c | 15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index 1dfaaf
expand to
pre-standard CEE interfaces. Therefore the tool itself is a lean shell that
dispatches to subtools each dedicated to one of the objects.
Signed-off-by: Petr Machata
---
Notes:
v5:
- Fix handling of all:. max_key is inclusive, not exclusive. Previously,
all: didn't se
Receiving a message in libmnl is a somewhat involved operation. Devlink's
mnlg library has an implementation that is going to be handy for other
tools as well. Extract it into a new helper.
Signed-off-by: Petr Machata
---
devlink/mnlg.c
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:
v5:
- Man page fix: TC-MAP is actually calle
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
-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
Allocation of a new netlink message with the two usual headers is reusable
with other netlink netlink message types. Extract it into a helper,
mnlu_msg_prepare(). Take the second header as an argument, instead of
passing in parameters to initialize it, and copy it in.
Signed-off-by: Petr Machata
n in JSON mode. Since there are probably
very few if any consumers of this interface at this point, migrate it to
the new central print_on_off() as well.
Signed-off-by: Petr Machata
Reviewed-by: Leon Romanovsky
---
Notes:
v3:
- Rename to print_on_off(). [David Ahern]
- Move over
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
l 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 valu
parse_one_of() for parsing
specifically the strings "off" and "on".
Convert the macsec code to the new helpers.
Signed-off-by: Petr Machata
---
Notes:
v3:
- Have parse_on_off() return a boolean. [David Ahern]
include/utils.h | 4
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(), p
-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
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
parse_one_of() for parsing
specifically the strings "off" and "on".
Convert the macsec code to the new helpers.
Signed-off-by: Petr Machata
---
Notes:
v3:
- Have parse_on_off() return a boolean. [David Ahern]
include/utils.h | 4
Allocation of a new netlink message with the two usual headers is reusable
with other netlink netlink message types. Extract it into a helper,
mnlu_msg_prepare(). Take the second header as an argument, instead of
passing in parameters to initialize it, and copy it in.
Signed-off-by: Petr Machata
n in JSON mode. Since there are probably
very few if any consumers of this interface at this point, migrate it to
the new central print_on_off() as well.
Signed-off-by: Petr Machata
---
Notes:
v3:
- Rename to print_on_off(). [David Ahern]
- Move over to json_print.c and make it a var
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/inclu
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:
v4:
- Drop all the FILE* arguments that were pas
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
expand to
pre-standard CEE interfaces. Therefore the tool itself is a lean shell that
dispatches to subtools each dedicated to one of the objects.
Signed-off-by: Petr Machata
---
Notes:
v4:
- Drop all the FILE* arguments that were passed around unnecessarily
- Change dcb_parse_mapping
Receiving a message in libmnl is a somewhat involved operation. Devlink's
mnlg library has an implementation that is going to be handy for other
tools as well. Extract it into a new helper.
Signed-off-by: Petr Machata
---
devlink/mnlg.c
t; is wrong: invalid egress-qos-map
Update argc and argv even in the case of parsing error, so that the right
element is indicated.
Signed-off-by: Petr Machata
---
lib/utils.c | 15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index 1dfaaf
Receiving a message in libmnl is a somewhat involved operation. Devlink's
mnlg library has an implementation that is going to be handy for other
tools as well. Extract it into a new helper.
Signed-off-by: Petr Machata
---
devlink/mnlg.c
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/inclu
expand to
pre-standard CEE interfaces. Therefore the tool itself is a lean shell that
dispatches to subtools each dedicated to one of the objects.
Signed-off-by: Petr Machata
---
Notes:
v3:
- Fix help output and man page to show the arguments as they are, so
-p and --pretty, not -[p
Allocation of a new netlink message with the two usual headers is reusable
with other netlink netlink message types. Extract it into a helper,
mnlu_msg_prepare(). Take the second header as an argument, instead of
passing in parameters to initialize it, and copy it in.
Signed-off-by: Petr Machata
t; is wrong: invalid egress-qos-map
Update argc and argv even in the case of parsing error, so that the right
element is indicated.
Signed-off-by: Petr Machata
---
lib/utils.c | 15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index 1dfaaf
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
dc
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
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
-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 Ma
-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
parse_one_of() for parsing
specifically the strings "off" and "on".
Convert the macsec code to the new helpers.
Signed-off-by: Petr Machata
---
Notes:
v3:
- Have parse_on_off() return a boolean. [David Ahern]
include/utils.h | 4
n in JSON mode. Since there are probably
very few if any consumers of this interface at this point, migrate it to
the new central print_on_off() as well.
Signed-off-by: Petr Machata
---
Notes:
v3:
- Rename to print_on_off(). [David Ahern]
- Move over to json_print.c and make it a var
Leon Romanovsky writes:
> On Tue, Nov 03, 2020 at 10:01:32PM +0100, Petr Machata wrote:
>>
>> Leon Romanovsky writes:
>>
>> > On Tue, Nov 03, 2020 at 12:05:20AM +0100, Petr Machata wrote:
>> >>
>> >> Leon Romanovsky writes:
>> >
Leon Romanovsky writes:
> On Tue, Nov 03, 2020 at 12:05:20AM +0100, Petr Machata wrote:
>>
>> Leon Romanovsky writes:
>>
>> > On Sun, Nov 01, 2020 at 04:55:42PM -0700, David Ahern wrote:
>> >
>> >> yes, the rdma utils are using generic funct
Leon Romanovsky writes:
> On Sun, Nov 01, 2020 at 04:55:42PM -0700, David Ahern wrote:
>> On 10/31/20 3:23 PM, Petr Machata wrote:
>> >
>> > David Ahern writes:
>> >
>> >> On 10/30/20 6:29 AM, Petr Machata wrote:
>> >>> d
David Ahern writes:
> On 10/30/20 6:29 AM, Petr Machata wrote:
>> +int parse_on_off(const char *msg, const char *realval, int *p_err)
>> +{
>> +static const char * const values_on_off[] = { "off", "on" };
>> +
>> +return par
Stephen Hemminger writes:
> On Fri, 30 Oct 2020 13:29:50 +0100
> Petr Machata wrote:
>
>> +void print_on_off_bool(FILE *fp, const char *flag, bool val)
>> +{
>> +if (is_json_context())
>> +print_bool(PRINT_JSON, flag, NULL, val);
>> +
David Ahern writes:
> On 10/30/20 6:29 AM, Petr Machata wrote:
>> diff --git a/lib/utils.c b/lib/utils.c
>> index 930877ae0f0d..8deec86ecbcd 100644
>> --- a/lib/utils.c
>> +++ b/lib/utils.c
>> @@ -1763,3 +1763,11 @@ int parse_on_off(const char *msg, co
t; is wrong: invalid egress-qos-map
Update argc and argv even in the case of parsing error, so that the right
element is indicated.
Signed-off-by: Petr Machata
---
lib/utils.c | 15 ++-
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index aba7cc
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
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 1c72221ae92c..8ec1b7ab0d8d 100644
--- a/include/utils.h
+++ b/inclu
expand to
pre-standard CEE interfaces. Therefore the tool itself is a lean shell that
dispatches to subtools each dedicated to one of the objects.
Signed-off-by: Petr Machata
---
Makefile | 2 +-
dcb/Makefile | 24 +++
dcb/dcb.c | 401
parse_one_of() for parsing
specifically the strings "off" and "on".
Convert the macsec code to the new helpers.
Signed-off-by: Petr Machata
---
include/utils.h | 4
ip/ipmacsec.c | 52 +++--
lib/utils.c | 28 +
The value of a number of booleans is shown as "on" and "off" in the plain
output, and as an actual boolean in JSON mode. Add a function that does
that.
Signed-off-by: Petr Machata
---
include/utils.h | 1 +
lib/utils.c | 8
2 files changed, 9 insertions(+)
#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/mn
Allocation of a new netlink message with the two usual headers is reusable
with other netlink netlink message types. Extract it into a helper,
mnlu_msg_prepare(). Take the second header as an argument, instead of
passing in parameters to initialize it, and copy it in.
Signed-off-by: Petr Machata
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
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
---
dcb/Makefile | 2 +-
dcb/dcb.c | 4 +-
Receiving a message in libmnl is a somewhat involved operation. Devlink's
mnlg library has an implementation that is going to be handy for other
tools as well. Extract it into a new helper.
Signed-off-by: Petr Machata
---
devlink/mnlg.c
-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
On October 22, 2020 2:11:01 AM GMT+02:00, Stephen Hemminger
wrote:
>On Thu, 22 Oct 2020 01:48:58 +0200
>Petr Machata wrote:
>
>> Stephen Hemminger writes:
>>
>> > On Tue, 20 Oct 2020 22:43:37 +0200
>> > Petr Machata wrote:
>> >
>>
Stephen Hemminger writes:
> On Tue, 20 Oct 2020 22:43:37 +0200
> Petr Machata wrote:
>
>> Jakub Kicinski writes:
>>
>> > On Tue, 20 Oct 2020 02:58:23 +0200 Petr Machata wrote:
>> >> +static void dcb_ets_print_cbs(FILE *fp, const struct ieee_ets *et
Roman Mashak writes:
> Petr Machata writes:
>
>
> [...]
>
>> +static int parse_qos_mapping(__u32 key, char *value, void *data)
>> +{
>> +struct nlmsghdr *n = data;
>> +struct ifla_vlan_qos_mapping m = {
>> +.from = key,
>&g
Jakub Kicinski writes:
> On Tue, 20 Oct 2020 02:58:23 +0200 Petr Machata wrote:
>> +static void dcb_ets_print_cbs(FILE *fp, const struct ieee_ets *ets)
>> +{
>> +print_string(PRINT_ANY, "cbs", "cbs %s ", ets->cbs ? "on" : "off&q
401 - 500 of 2257 matches
Mail list logo