* [PATCH iproute2] dcb: fix broken "show default-prio"
@ 2022-02-25 17:12 Vladimir Oltean
2022-02-25 17:51 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Oltean @ 2022-02-25 17:12 UTC (permalink / raw)
To: netdev; +Cc: David Ahern, Stephen Hemminger, Petr Machata
Although "dcb app show dev eth0 default-prio" is documented as a valid
command in the help text, it doesn't work because the parser for the
"show" command doesn't parse "default-prio". Fix this by establishing
the linkage between the sub-command parsing code and
dcb_app_print_default_prio() - which was previously only called from
dcb_app_print().
Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
dcb/dcb_app.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
index 6bd64bbed0cc..c135e73acb76 100644
--- a/dcb/dcb_app.c
+++ b/dcb/dcb_app.c
@@ -646,6 +646,8 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
if (matches(*argv, "help") == 0) {
dcb_app_help_show_flush();
goto out;
+ } else if (matches(*argv, "default-prio") == 0) {
+ dcb_app_print_default_prio(&tab);
} else if (matches(*argv, "ethtype-prio") == 0) {
dcb_app_print_ethtype_prio(&tab);
} else if (matches(*argv, "dscp-prio") == 0) {
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2] dcb: fix broken "show default-prio"
2022-02-25 17:12 [PATCH iproute2] dcb: fix broken "show default-prio" Vladimir Oltean
@ 2022-02-25 17:51 ` Stephen Hemminger
2022-02-25 21:30 ` Petr Machata
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2022-02-25 17:51 UTC (permalink / raw)
To: Vladimir Oltean; +Cc: netdev, David Ahern, Petr Machata
On Fri, 25 Feb 2022 19:12:58 +0200
Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> Although "dcb app show dev eth0 default-prio" is documented as a valid
> command in the help text, it doesn't work because the parser for the
> "show" command doesn't parse "default-prio". Fix this by establishing
> the linkage between the sub-command parsing code and
> dcb_app_print_default_prio() - which was previously only called from
> dcb_app_print().
>
> Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> dcb/dcb_app.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
> index 6bd64bbed0cc..c135e73acb76 100644
> --- a/dcb/dcb_app.c
> +++ b/dcb/dcb_app.c
> @@ -646,6 +646,8 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
> if (matches(*argv, "help") == 0) {
> dcb_app_help_show_flush();
> goto out;
> + } else if (matches(*argv, "default-prio") == 0) {
> + dcb_app_print_default_prio(&tab);
> } else if (matches(*argv, "ethtype-prio") == 0) {
> dcb_app_print_ethtype_prio(&tab);
> } else if (matches(*argv, "dscp-prio") == 0) {
This is an example of why matches() sucks.
If we add this patch, then the result of command where *argv == "d"
will change.
All those argument handling should be using strcmp() instead.
Should have required that before merging dcb. David and I should
have caught that, too late now.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2] dcb: fix broken "show default-prio"
2022-02-25 17:51 ` Stephen Hemminger
@ 2022-02-25 21:30 ` Petr Machata
2022-02-25 21:36 ` Vladimir Oltean
0 siblings, 1 reply; 4+ messages in thread
From: Petr Machata @ 2022-02-25 21:30 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Vladimir Oltean, netdev, David Ahern, Petr Machata
Stephen Hemminger <stephen@networkplumber.org> writes:
> On Fri, 25 Feb 2022 19:12:58 +0200
> Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
>
>> diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
>> index 6bd64bbed0cc..c135e73acb76 100644
>> --- a/dcb/dcb_app.c
>> +++ b/dcb/dcb_app.c
>> @@ -646,6 +646,8 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
>> if (matches(*argv, "help") == 0) {
>> dcb_app_help_show_flush();
>> goto out;
>> + } else if (matches(*argv, "default-prio") == 0) {
>> + dcb_app_print_default_prio(&tab);
>> } else if (matches(*argv, "ethtype-prio") == 0) {
>> dcb_app_print_ethtype_prio(&tab);
>> } else if (matches(*argv, "dscp-prio") == 0) {
A fix along these lines got merged recently:
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=924f6b4a5d2b
> This is an example of why matches() sucks.
> If we add this patch, then the result of command where *argv == "d"
> will change.
To further drive this point, I made the exact same mistake in v1 of my
patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2] dcb: fix broken "show default-prio"
2022-02-25 21:30 ` Petr Machata
@ 2022-02-25 21:36 ` Vladimir Oltean
0 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2022-02-25 21:36 UTC (permalink / raw)
To: Petr Machata; +Cc: Stephen Hemminger, netdev, David Ahern
On Fri, Feb 25, 2022 at 10:30:38PM +0100, Petr Machata wrote:
>
> Stephen Hemminger <stephen@networkplumber.org> writes:
>
> > On Fri, 25 Feb 2022 19:12:58 +0200
> > Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> >> diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c
> >> index 6bd64bbed0cc..c135e73acb76 100644
> >> --- a/dcb/dcb_app.c
> >> +++ b/dcb/dcb_app.c
> >> @@ -646,6 +646,8 @@ static int dcb_cmd_app_show(struct dcb *dcb, const char *dev, int argc, char **a
> >> if (matches(*argv, "help") == 0) {
> >> dcb_app_help_show_flush();
> >> goto out;
> >> + } else if (matches(*argv, "default-prio") == 0) {
> >> + dcb_app_print_default_prio(&tab);
> >> } else if (matches(*argv, "ethtype-prio") == 0) {
> >> dcb_app_print_ethtype_prio(&tab);
> >> } else if (matches(*argv, "dscp-prio") == 0) {
>
> A fix along these lines got merged recently:
>
> https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=924f6b4a5d2b
Ah, ok, I was on iproute2-next, this makes sense. Sorry.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-25 21:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 17:12 [PATCH iproute2] dcb: fix broken "show default-prio" Vladimir Oltean
2022-02-25 17:51 ` Stephen Hemminger
2022-02-25 21:30 ` Petr Machata
2022-02-25 21:36 ` Vladimir Oltean
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.