* [PATCH net-next] tools: ynl: use display hints for formatting of scalar attrs
@ 2024-06-26 20:12 Jakub Kicinski
2024-06-27 9:22 ` Donald Hunter
2024-06-27 21:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2024-06-26 20:12 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, donald.hunter, jiri
Use display hints for formatting scalar attrs. This is specifically
useful for formatting IPv4 addresses carried typically as u32.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: donald.hunter@gmail.com
CC: jiri@resnulli.us
---
tools/net/ynl/lib/ynl.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 35e666928119..d42c1d605969 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -743,6 +743,8 @@ genl_family_name_to_id = None
decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order)
if 'enum' in attr_spec:
decoded = self._decode_enum(decoded, attr_spec)
+ elif attr_spec.display_hint:
+ decoded = self._formatted_string(decoded, attr_spec.display_hint)
elif attr_spec["type"] == 'indexed-array':
decoded = self._decode_array_attr(attr, attr_spec)
elif attr_spec["type"] == 'bitfield32':
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tools: ynl: use display hints for formatting of scalar attrs
2024-06-26 20:12 [PATCH net-next] tools: ynl: use display hints for formatting of scalar attrs Jakub Kicinski
@ 2024-06-27 9:22 ` Donald Hunter
2024-06-27 21:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Donald Hunter @ 2024-06-27 9:22 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, jiri
Jakub Kicinski <kuba@kernel.org> writes:
> Use display hints for formatting scalar attrs. This is specifically
> useful for formatting IPv4 addresses carried typically as u32.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
I don't know how scalars got missed out :shrug:
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Thanks!
> ---
> CC: donald.hunter@gmail.com
> CC: jiri@resnulli.us
> ---
> tools/net/ynl/lib/ynl.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index 35e666928119..d42c1d605969 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -743,6 +743,8 @@ genl_family_name_to_id = None
> decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order)
> if 'enum' in attr_spec:
> decoded = self._decode_enum(decoded, attr_spec)
> + elif attr_spec.display_hint:
> + decoded = self._formatted_string(decoded, attr_spec.display_hint)
> elif attr_spec["type"] == 'indexed-array':
> decoded = self._decode_array_attr(attr, attr_spec)
> elif attr_spec["type"] == 'bitfield32':
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tools: ynl: use display hints for formatting of scalar attrs
2024-06-26 20:12 [PATCH net-next] tools: ynl: use display hints for formatting of scalar attrs Jakub Kicinski
2024-06-27 9:22 ` Donald Hunter
@ 2024-06-27 21:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-27 21:30 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, donald.hunter, jiri
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 26 Jun 2024 13:12:34 -0700 you wrote:
> Use display hints for formatting scalar attrs. This is specifically
> useful for formatting IPv4 addresses carried typically as u32.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: donald.hunter@gmail.com
> CC: jiri@resnulli.us
>
> [...]
Here is the summary with links:
- [net-next] tools: ynl: use display hints for formatting of scalar attrs
https://git.kernel.org/netdev/net-next/c/2a901623f005
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-27 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-26 20:12 [PATCH net-next] tools: ynl: use display hints for formatting of scalar attrs Jakub Kicinski
2024-06-27 9:22 ` Donald Hunter
2024-06-27 21:30 ` patchwork-bot+netdevbpf
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).