* ynl ethtool subscribe issue
@ 2024-10-17 16:05 Kory Maincent
2024-10-17 22:05 ` Donald Hunter
0 siblings, 1 reply; 3+ messages in thread
From: Kory Maincent @ 2024-10-17 16:05 UTC (permalink / raw)
To: netdev, donald.hunter, kuba; +Cc: Maxime Chevallier
Hello,
It seems there is an issue with ynl tool and ethtool specs:
# ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --subscribe monitor
--sleep 10 &
# ethtool -K eth0 rx-gro-list on
# Traceback (most recent call last):
File "/root/ynl/lib/ynl.py", line 723, in _decode
attr_spec = attr_space.attrs_by_val[attr.type]
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 4
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/./ynl/cli.py", line 114, in <module>
main()
File "/root/./ynl/cli.py", line 109, in main
ynl.check_ntf()
File "/root/ynl/lib/ynl.py", line 930, in check_ntf
self.handle_ntf(decoded)
File "/root/ynl/lib/ynl.py", line 898, in handle_ntf
attrs = self._decode(decoded.raw_attrs, op.attr_set.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ynl/lib/ynl.py", line 732, in _decode
subdict = self._decode(NlAttrs(attr.raw), attr_spec['nested-attributes'],
search_attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ynl/lib/ynl.py", line 726, in _decode raise Exception(f"Space
'{space}' has no attribute with value '{attr.type}'") Exception: Space 'bitset'
has no attribute with value '4'
I used set_features netlink command but all of ethtool commands are not working.
I am not a ynl expert so someone may find the issue before I do.
That would be kind!
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ynl ethtool subscribe issue
2024-10-17 16:05 ynl ethtool subscribe issue Kory Maincent
@ 2024-10-17 22:05 ` Donald Hunter
2024-10-18 8:21 ` Kory Maincent
0 siblings, 1 reply; 3+ messages in thread
From: Donald Hunter @ 2024-10-17 22:05 UTC (permalink / raw)
To: Kory Maincent; +Cc: netdev, kuba, Maxime Chevallier
On Thu, 17 Oct 2024 at 17:05, Kory Maincent <kory.maincent@bootlin.com> wrote:
>
> Hello,
>
> It seems there is an issue with ynl tool and ethtool specs:
>
> # ./ynl/cli.py --spec netlink/specs/ethtool.yaml --no-schema --subscribe monitor
> --sleep 10 &
> # ethtool -K eth0 rx-gro-list on
> # Traceback (most recent call last):
> File "/root/ynl/lib/ynl.py", line 723, in _decode
> attr_spec = attr_space.attrs_by_val[attr.type]
> ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
> KeyError: 4
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/root/./ynl/cli.py", line 114, in <module>
> main()
> File "/root/./ynl/cli.py", line 109, in main
> ynl.check_ntf()
> File "/root/ynl/lib/ynl.py", line 930, in check_ntf
> self.handle_ntf(decoded)
> File "/root/ynl/lib/ynl.py", line 898, in handle_ntf
> attrs = self._decode(decoded.raw_attrs, op.attr_set.name)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/root/ynl/lib/ynl.py", line 732, in _decode
> subdict = self._decode(NlAttrs(attr.raw), attr_spec['nested-attributes'],
> search_attrs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/root/ynl/lib/ynl.py", line 726, in _decode raise Exception(f"Space
> '{space}' has no attribute with value '{attr.type}'") Exception: Space 'bitset'
> has no attribute with value '4'
The 'bitset' attribute-set is missing these attributes which are
defined in include/uapi/linux/ethtool_netlink.h
ETHTOOL_A_BITSET_VALUE, /* binary */
ETHTOOL_A_BITSET_MASK, /* binary */
This patch fixes it:
diff --git a/Documentation/netlink/specs/ethtool.yaml
b/Documentation/netlink/specs/ethtool.yaml
index 6a050d755b9c..f6c5d8214c7e 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -96,7 +96,12 @@ attribute-sets:
name: bits
type: nest
nested-attributes: bitset-bits
-
+ -
+ name: value
+ type: binary
+ -
+ name: mask
+ type: binary
-
name: string
attributes:
./tools/net/ynl/cli.py --spec Documentation/netlink/specs/ethtool.yaml
--subscribe monitor --sleep 10
[{'msg': {'active': {'nomask': True,
'size': 64,
'value': b'\xb2A\x00\x00\x00\x01\x00\x00'},
'header': {'dev-index': 2, 'dev-name': 'enp42s0'},
'hw': {'mask': b'\xff\xff\xff\xff\xff\xff\xff\xff',
'size': 64,
'value': b'\x93I\x19\x00\x00\x1b\x00\n'},
'nochange': {'nomask': True,
'size': 64,
'value': b'\x004\x00\x00\x00\x00\x00\x00'},
'wanted': {'nomask': True,
'size': 64,
'value': b'\x92I\x00\x00\x00\x01\x00\x00'}},
'name': 'features-ntf'}]
> I used set_features netlink command but all of ethtool commands are not working.
> I am not a ynl expert so someone may find the issue before I do.
> That would be kind!
I haven't tried anything else from the ethtool spec, but plan to check
it out tomorrow.
I can submit a patch for this tomorrow, unless you want to?
Cheers,
Donald.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: ynl ethtool subscribe issue
2024-10-17 22:05 ` Donald Hunter
@ 2024-10-18 8:21 ` Kory Maincent
0 siblings, 0 replies; 3+ messages in thread
From: Kory Maincent @ 2024-10-18 8:21 UTC (permalink / raw)
To: Donald Hunter; +Cc: netdev, kuba, Maxime Chevallier
On Thu, 17 Oct 2024 23:05:14 +0100
Donald Hunter <donald.hunter@gmail.com> wrote:
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > File "/root/ynl/lib/ynl.py", line 726, in _decode raise Exception(f"Space
> > '{space}' has no attribute with value '{attr.type}'") Exception: Space
> > 'bitset' has no attribute with value '4'
>
> The 'bitset' attribute-set is missing these attributes which are
> defined in include/uapi/linux/ethtool_netlink.h
>
> ETHTOOL_A_BITSET_VALUE, /* binary */
> ETHTOOL_A_BITSET_MASK, /* binary */
>
> This patch fixes it:
>
> diff --git a/Documentation/netlink/specs/ethtool.yaml
> b/Documentation/netlink/specs/ethtool.yaml
> index 6a050d755b9c..f6c5d8214c7e 100644
> --- a/Documentation/netlink/specs/ethtool.yaml
> +++ b/Documentation/netlink/specs/ethtool.yaml
> @@ -96,7 +96,12 @@ attribute-sets:
> name: bits
> type: nest
> nested-attributes: bitset-bits
> -
> + -
> + name: value
> + type: binary
> + -
> + name: mask
> + type: binary
> -
> name: string
> attributes:
>
> ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/ethtool.yaml
> --subscribe monitor --sleep 10
> [{'msg': {'active': {'nomask': True,
> 'size': 64,
> 'value': b'\xb2A\x00\x00\x00\x01\x00\x00'},
> 'header': {'dev-index': 2, 'dev-name': 'enp42s0'},
> 'hw': {'mask': b'\xff\xff\xff\xff\xff\xff\xff\xff',
> 'size': 64,
> 'value': b'\x93I\x19\x00\x00\x1b\x00\n'},
> 'nochange': {'nomask': True,
> 'size': 64,
> 'value': b'\x004\x00\x00\x00\x00\x00\x00'},
> 'wanted': {'nomask': True,
> 'size': 64,
> 'value': b'\x92I\x00\x00\x00\x01\x00\x00'}},
> 'name': 'features-ntf'}]
Ooh nice, thanks!!
>
> > I used set_features netlink command but all of ethtool commands are not
> > working. I am not a ynl expert so someone may find the issue before I do.
> > That would be kind!
>
> I haven't tried anything else from the ethtool spec, but plan to check
> it out tomorrow.
>
> I can submit a patch for this tomorrow, unless you want to?
No, go ahead.
Regards
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-18 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 16:05 ynl ethtool subscribe issue Kory Maincent
2024-10-17 22:05 ` Donald Hunter
2024-10-18 8:21 ` Kory Maincent
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox