devlink: fix requiring either handle

devlink sb occupancy show requires device or port handle.
It passes both device and port handle bits as required to
dl_argv_parse() so since commit 1896b100af ("devlink: catch
missing strings in dl_args_required") devlink will now
complain that only one is present:

$ devlink sb occupancy show pci/0000:06:00.0/0
BUG: unknown argument required but not found

Drop the bit for the handle which was not found from required.

Reported-by: Shalom Toledo <shalomt@mellanox.com>
Fixes: 1896b100af ("devlink: catch missing strings in dl_args_required")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Tested-by: Shalom Toledo <shalomt@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Jakub Kicinski 2019-11-20 09:56:06 -08:00 committed by David Ahern
parent 536dcd2016
commit 668bd8d356
1 changed files with 1 additions and 0 deletions

View File

@ -1179,6 +1179,7 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
&opts->port_index, &handle_bit); &opts->port_index, &handle_bit);
if (err) if (err)
return err; return err;
o_required &= ~(DL_OPT_HANDLE | DL_OPT_HANDLEP) | handle_bit;
o_found |= handle_bit; o_found |= handle_bit;
} else if (o_required & DL_OPT_HANDLE) { } else if (o_required & DL_OPT_HANDLE) {
err = dl_argv_handle(dl, &opts->bus_name, &opts->dev_name); err = dl_argv_handle(dl, &opts->bus_name, &opts->dev_name);