All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Kory Maincent <kory.maincent@bootlin.com>
Cc: netdev@vger.kernel.org, Donald Hunter <donald.hunter@gmail.com>
Subject: Re: Netlink specs, help dealing with nested array
Date: Fri, 21 Jun 2024 08:19:06 -0700	[thread overview]
Message-ID: <20240621081906.0466c431@kernel.org> (raw)
In-Reply-To: <20240621161543.42617bef@kmaincent-XPS-13-7390>

On Fri, 21 Jun 2024 16:15:43 +0200 Kory Maincent wrote:
> Hello Jakub, Donald or other ynl experts,
> 
> I have an issue dealing with a nested array.
> 
> Here is my current netlink spec and ethtool patches:
> https://termbin.com/gbyx
> https://termbin.com/b325
> 
> Here is the error I got:
> https://termbin.com/c7b1
> 
> I am trying to investigate what goes wrong with ynl but I still don't know.
> If someone have an idea of what is going wrong with ynl or my specs it would be
> lovely! 

You're (correctly) formatting your data as a basic multi-attr.
Instead of:

+        name: c33-pse-pw-limit-ranges
+        name-prefix: ethtool-a-
+        type: indexed-array
+        sub-type: nest
+        nested-attributes: c33-pse-pw-limit

use:

+        name: c33-pse-pw-limit-ranges
+        name-prefix: ethtool-a-
+        type: nest
+        multi-attr: true
+        nested-attributes: c33-pse-pw-limit

The indexed array is described here:
https://docs.kernel.org/next/userspace-api/netlink/genetlink-legacy.html#indexed-array
it has an extra layer of nesting, which uses the index in the array 
as the type of the attribute.

  parent reply	other threads:[~2024-06-21 15:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 14:15 Netlink specs, help dealing with nested array Kory Maincent
2024-06-21 15:14 ` Donald Hunter
2024-06-21 15:19 ` Jakub Kicinski [this message]
2024-06-21 15:27   ` Donald Hunter
2024-06-21 15:56     ` Kory Maincent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240621081906.0466c431@kernel.org \
    --to=kuba@kernel.org \
    --cc=donald.hunter@gmail.com \
    --cc=kory.maincent@bootlin.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.