* [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion
@ 2024-11-15 5:58 Saeed Mahameed
2024-11-15 12:58 ` Jiri Pirko
0 siblings, 1 reply; 5+ messages in thread
From: Saeed Mahameed @ 2024-11-15 5:58 UTC (permalink / raw)
To: Jiri Pirko; +Cc: David Ahern, netdev, Saeed Mahameed
From: Saeed Mahameed <saeedm@nvidia.com>
Port param names are found with "devlink port param show", and not
"devlink param show", fix that.
Port dev name can be a netdev, so find the actual port dev before
querying "devlink port params show | jq '... [$dev] ...'",
since "devlink port params show" doesn't return the netdev name,
but the actual port dev name.
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
bash-completion/devlink | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/bash-completion/devlink b/bash-completion/devlink
index 52dc82b3..ac5ea62c 100644
--- a/bash-completion/devlink
+++ b/bash-completion/devlink
@@ -43,6 +43,15 @@ _devlink_direct_complete()
value=$(devlink -j dev param show 2>/dev/null \
| jq ".param[\"$dev\"][].name")
;;
+ port_param_name)
+ dev=${words[4]}
+ # dev could be a port or a netdev so find the port
+ portdev=$(devlink -j port show dev $dev 2>/dev/null \
+ | jq '.port as $ports | $ports | keys[] as $keys | keys[0] ')
+
+ value=$(devlink -j port param show 2>/dev/null \
+ | jq ".param[$portdev][].name")
+ ;;
port)
value=$(devlink -j port show 2>/dev/null \
| jq '.port as $ports | $ports | keys[] as $key
@@ -401,7 +410,7 @@ _devlink_port_param()
return
;;
6)
- _devlink_direct_complete "param_name"
+ _devlink_direct_complete "port_param_name"
return
;;
esac
--
2.47.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion
2024-11-15 5:58 [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion Saeed Mahameed
@ 2024-11-15 12:58 ` Jiri Pirko
2024-11-15 18:44 ` Saeed Mahameed
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2024-11-15 12:58 UTC (permalink / raw)
To: Saeed Mahameed; +Cc: David Ahern, netdev, Saeed Mahameed
Fri, Nov 15, 2024 at 06:58:48AM CET, saeed@kernel.org wrote:
>From: Saeed Mahameed <saeedm@nvidia.com>
>
>Port param names are found with "devlink port param show", and not
>"devlink param show", fix that.
>
>Port dev name can be a netdev, so find the actual port dev before
>querying "devlink port params show | jq '... [$dev] ...'",
>since "devlink port params show" doesn't return the netdev name,
>but the actual port dev name.
>
>Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>---
> bash-completion/devlink | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
>diff --git a/bash-completion/devlink b/bash-completion/devlink
>index 52dc82b3..ac5ea62c 100644
>--- a/bash-completion/devlink
>+++ b/bash-completion/devlink
>@@ -43,6 +43,15 @@ _devlink_direct_complete()
> value=$(devlink -j dev param show 2>/dev/null \
> | jq ".param[\"$dev\"][].name")
> ;;
>+ port_param_name)
>+ dev=${words[4]}
>+ # dev could be a port or a netdev so find the port
>+ portdev=$(devlink -j port show dev $dev 2>/dev/null \
>+ | jq '.port as $ports | $ports | keys[] as $keys | keys[0] ')
>+
>+ value=$(devlink -j port param show 2>/dev/null \
As you only care about params for specific port, you should pass it as
cmdline option here. And you can pass netdev directly, devlink knows how
to handle that. If I'm not missing anything in the code, should work
right now.
>+ | jq ".param[$portdev][].name")
>+ ;;
> port)
> value=$(devlink -j port show 2>/dev/null \
> | jq '.port as $ports | $ports | keys[] as $key
>@@ -401,7 +410,7 @@ _devlink_port_param()
> return
> ;;
> 6)
>- _devlink_direct_complete "param_name"
>+ _devlink_direct_complete "port_param_name"
> return
> ;;
> esac
>--
>2.47.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion
2024-11-15 12:58 ` Jiri Pirko
@ 2024-11-15 18:44 ` Saeed Mahameed
2024-11-16 7:58 ` Jiri Pirko
0 siblings, 1 reply; 5+ messages in thread
From: Saeed Mahameed @ 2024-11-15 18:44 UTC (permalink / raw)
To: Jiri Pirko; +Cc: Saeed Mahameed, David Ahern, netdev
On 15 Nov 13:58, Jiri Pirko wrote:
>Fri, Nov 15, 2024 at 06:58:48AM CET, saeed@kernel.org wrote:
>>From: Saeed Mahameed <saeedm@nvidia.com>
>>
>>Port param names are found with "devlink port param show", and not
>>"devlink param show", fix that.
>>
>>Port dev name can be a netdev, so find the actual port dev before
>>querying "devlink port params show | jq '... [$dev] ...'",
>>since "devlink port params show" doesn't return the netdev name,
>>but the actual port dev name.
>>
>>Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>>---
>> bash-completion/devlink | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>>diff --git a/bash-completion/devlink b/bash-completion/devlink
>>index 52dc82b3..ac5ea62c 100644
>>--- a/bash-completion/devlink
>>+++ b/bash-completion/devlink
>>@@ -43,6 +43,15 @@ _devlink_direct_complete()
>> value=$(devlink -j dev param show 2>/dev/null \
>> | jq ".param[\"$dev\"][].name")
>> ;;
>>+ port_param_name)
>>+ dev=${words[4]}
>>+ # dev could be a port or a netdev so find the port
>>+ portdev=$(devlink -j port show dev $dev 2>/dev/null \
>>+ | jq '.port as $ports | $ports | keys[] as $keys | keys[0] ')
>>+
>>+ value=$(devlink -j port param show 2>/dev/null \
>
>As you only care about params for specific port, you should pass it as
>cmdline option here. And you can pass netdev directly, devlink knows how
>to handle that. If I'm not missing anything in the code, should work
>right now.
>
Nope doesn't work:
$ devlink -j port param show mlx5_1
Parameter name expected.
$ devlink -j port param show auxiliary/mlx5_core.eth.0/65535
Parameter name expected.
>
>>+ | jq ".param[$portdev][].name")
>>+ ;;
>> port)
>> value=$(devlink -j port show 2>/dev/null \
>> | jq '.port as $ports | $ports | keys[] as $key
>>@@ -401,7 +410,7 @@ _devlink_port_param()
>> return
>> ;;
>> 6)
>>- _devlink_direct_complete "param_name"
>>+ _devlink_direct_complete "port_param_name"
>> return
>> ;;
>> esac
>>--
>>2.47.0
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion
2024-11-15 18:44 ` Saeed Mahameed
@ 2024-11-16 7:58 ` Jiri Pirko
2024-11-19 16:45 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Pirko @ 2024-11-16 7:58 UTC (permalink / raw)
To: Saeed Mahameed; +Cc: Saeed Mahameed, David Ahern, netdev
Fri, Nov 15, 2024 at 07:44:01PM CET, saeedm@nvidia.com wrote:
>On 15 Nov 13:58, Jiri Pirko wrote:
>> Fri, Nov 15, 2024 at 06:58:48AM CET, saeed@kernel.org wrote:
>> > From: Saeed Mahameed <saeedm@nvidia.com>
>> >
>> > Port param names are found with "devlink port param show", and not
>> > "devlink param show", fix that.
>> >
>> > Port dev name can be a netdev, so find the actual port dev before
>> > querying "devlink port params show | jq '... [$dev] ...'",
>> > since "devlink port params show" doesn't return the netdev name,
>> > but the actual port dev name.
>> >
>> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>> > ---
>> > bash-completion/devlink | 11 ++++++++++-
>> > 1 file changed, 10 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/bash-completion/devlink b/bash-completion/devlink
>> > index 52dc82b3..ac5ea62c 100644
>> > --- a/bash-completion/devlink
>> > +++ b/bash-completion/devlink
>> > @@ -43,6 +43,15 @@ _devlink_direct_complete()
>> > value=$(devlink -j dev param show 2>/dev/null \
>> > | jq ".param[\"$dev\"][].name")
>> > ;;
>> > + port_param_name)
>> > + dev=${words[4]}
>> > + # dev could be a port or a netdev so find the port
>> > + portdev=$(devlink -j port show dev $dev 2>/dev/null \
>> > + | jq '.port as $ports | $ports | keys[] as $keys | keys[0] ')
>> > +
>> > + value=$(devlink -j port param show 2>/dev/null \
>>
>> As you only care about params for specific port, you should pass it as
>> cmdline option here. And you can pass netdev directly, devlink knows how
>> to handle that. If I'm not missing anything in the code, should work
>> right now.
>>
>
>Nope doesn't work:
>
>$ devlink -j port param show mlx5_1
>Parameter name expected.
>
>$ devlink -j port param show auxiliary/mlx5_core.eth.0/65535
>Parameter name expected.
Okay, so fix it :)
>
>>
>> > + | jq ".param[$portdev][].name")
>> > + ;;
>> > port)
>> > value=$(devlink -j port show 2>/dev/null \
>> > | jq '.port as $ports | $ports | keys[] as $key
>> > @@ -401,7 +410,7 @@ _devlink_port_param()
>> > return
>> > ;;
>> > 6)
>> > - _devlink_direct_complete "param_name"
>> > + _devlink_direct_complete "port_param_name"
>> > return
>> > ;;
>> > esac
>> > --
>> > 2.47.0
>> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion
2024-11-16 7:58 ` Jiri Pirko
@ 2024-11-19 16:45 ` Stephen Hemminger
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2024-11-19 16:45 UTC (permalink / raw)
To: Jiri Pirko; +Cc: Saeed Mahameed, Saeed Mahameed, David Ahern, netdev
On Sat, 16 Nov 2024 08:58:05 +0100
Jiri Pirko <jiri@resnulli.us> wrote:
> Fri, Nov 15, 2024 at 07:44:01PM CET, saeedm@nvidia.com wrote:
> >On 15 Nov 13:58, Jiri Pirko wrote:
> >> Fri, Nov 15, 2024 at 06:58:48AM CET, saeed@kernel.org wrote:
> >> > From: Saeed Mahameed <saeedm@nvidia.com>
> >> >
> >> > Port param names are found with "devlink port param show", and not
> >> > "devlink param show", fix that.
> >> >
> >> > Port dev name can be a netdev, so find the actual port dev before
> >> > querying "devlink port params show | jq '... [$dev] ...'",
> >> > since "devlink port params show" doesn't return the netdev name,
> >> > but the actual port dev name.
> >> >
> >> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> >> > ---
> >> > bash-completion/devlink | 11 ++++++++++-
> >> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/bash-completion/devlink b/bash-completion/devlink
> >> > index 52dc82b3..ac5ea62c 100644
> >> > --- a/bash-completion/devlink
> >> > +++ b/bash-completion/devlink
> >> > @@ -43,6 +43,15 @@ _devlink_direct_complete()
> >> > value=$(devlink -j dev param show 2>/dev/null \
> >> > | jq ".param[\"$dev\"][].name")
> >> > ;;
> >> > + port_param_name)
> >> > + dev=${words[4]}
> >> > + # dev could be a port or a netdev so find the port
> >> > + portdev=$(devlink -j port show dev $dev 2>/dev/null \
> >> > + | jq '.port as $ports | $ports | keys[] as $keys | keys[0] ')
> >> > +
> >> > + value=$(devlink -j port param show 2>/dev/null \
> >>
> >> As you only care about params for specific port, you should pass it as
> >> cmdline option here. And you can pass netdev directly, devlink knows how
> >> to handle that. If I'm not missing anything in the code, should work
> >> right now.
> >>
> >
> >Nope doesn't work:
> >
> >$ devlink -j port param show mlx5_1
> >Parameter name expected.
> >
> >$ devlink -j port param show auxiliary/mlx5_core.eth.0/65535
> >Parameter name expected.
>
> Okay, so fix it :)
Holding off on applying this until some conclusion is reached.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-19 16:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15 5:58 [PATCH iproute2-next] bash-completion: devlink: fix port param name show completion Saeed Mahameed
2024-11-15 12:58 ` Jiri Pirko
2024-11-15 18:44 ` Saeed Mahameed
2024-11-16 7:58 ` Jiri Pirko
2024-11-19 16:45 ` Stephen Hemminger
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).