Re: [PATCH RFC v2 6/6] tools: ynl: ethtool.py: Output timestamping statistics from tsinfo-get operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 13 Mar, 2024 17:47:07 -0700 Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> Ah, we're missing the enum definition and linking :S
>
> I mean:
>
> diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml
> index 197208f419dc..e1626c94d93b 100644
> --- a/Documentation/netlink/specs/ethtool.yaml
> +++ b/Documentation/netlink/specs/ethtool.yaml
> @@ -16,6 +16,10 @@ doc: Partial family for Ethtool Netlink.
>      name: stringset
>      type: enum
>      entries: []
> +  -
> +    name: header-flags
> +    type: flags
> +    entries: [ compact-bitset, omit-reply, stats ]

I am running into some strange issues with this even after regenerating
ynl generated/ by running make under tools/net/ynl/.

  Traceback (most recent call last):
    File "/root/linux-ethtool-ts/./tools/net/ynl/ethtool.py", line 437, in <module>
      main()
    File "/root/linux-ethtool-ts/./tools/net/ynl/ethtool.py", line 333, in main
      tsinfo = dumpit(ynl, args, 'tsinfo-get', req)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/./tools/net/ynl/ethtool.py", line 91, in dumpit
      reply = ynl.dump(op_name, { 'header': {} } | extra)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 873, in dump
      return self._op(method, vals, [], dump=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 824, in _op
      msg += self._add_attr(op.attr_set.name, name, value, search_attrs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 459, in _add_attr
      attr_payload += self._add_attr(attr['nested-attributes'],
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/root/linux-ethtool-ts/tools/net/ynl/lib/ynl.py", line 481, in _add_attr
      attr_payload = format.pack(int(value))
                                ^^^^^^^^^^
  TypeError: int() argument must be a string, a bytes-like object or a real number, not 'dict'

What's your expectation for how the request structure would look like? I
have tried the following.

  if args.show_time_stamping:
      req = {
        'header': {
          'flags': 'stats',
        },
      }

  if args.show_time_stamping:
      req = {
        'header': {
          'flags': {
             'stats': True,
          },
        },
      }

I tried looking through the lib/ynl.py code, but I did not understand
how the 'flags' type was specifically handled.

>  
>  attribute-sets:
>    -
> @@ -30,6 +34,7 @@ doc: Partial family for Ethtool Netlink.
>        -
>          name: flags
>          type: u32
> +        enum: header-flags
>  
>    -
>      name: bitset-bit
>
> See if that works and feel free to post it with my suggested-by

--
Thanks,

Rahul Rameshbabu




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux