From: Johannes Berg <johannes@sipsolutions.net>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, sdf@google.com, jacob.e.keller@intel.com,
vadfed@fb.com, jiri@resnulli.us, dsahern@kernel.org,
stephen@networkplumber.org, fw@strlen.de,
linux-doc@vger.kernel.org
Subject: Re: [RFC net-next 2/4] ynl: add the schema for the schemas
Date: Tue, 16 Aug 2022 21:30:54 +0200 [thread overview]
Message-ID: <c4a4744c0f0a86433beec5035f2150b8427eb3d5.camel@sipsolutions.net> (raw)
In-Reply-To: <20220816085316.65fda789@kernel.org>
On Tue, 2022-08-16 at 08:53 -0700, Jakub Kicinski wrote:
>
> My guess was that some of the wrapping was for ease of canceling here
> (cancel is used both on skip and on error).
>
Not sure I'd say that, but can't say I really remember why I did it this
way.
> What I think we should push
> for is multi-attr, so the same attribute happens multiple times.
>
> [msg]
> [ATTR1]
> [ATTR2] // elem 1
> [SubATTR1]
> [SubATTR2]
> [ATTR2] // elem 2
> [SubATTR1]
> [SubATTR2]
> [ATTR2] // elem 3
> [SubATTR1]
> [SubATTR2]
> [ATTR3]
> [ATTR4]
>
> Instead of wrapping into an array and then elements.
Hmm, ok, I guess that works.
>
> As Michal pointed out a number of times - the wrapping ends up limiting
> the size of the array to U16_MAX,
True.
> and I have a suspicion that most of
> wrapping is done because we tend to parse into a pointer array, which
> makes multi-attr a little tricky. But we shouldn't let one parsing
> technique in a relatively uncommon language like C dictate the format :)
:-)
To be fair, for cases where today we use nla_for_each_nested() we could
also invent an "nlmsg_for_each_attr_of_type()" macro:
#define nlmsg_for_each_attr_of_type(type, pos, nlh, hdrlen, rem) \
nlmsg_for_each_attr(pos, nlh, hdrlen, rem) \
if (pos->nla_type == type)
and then that's basically all you need?
In the policy we'd declare it as a normal nested (not array), and I
think that's it because today if you give the same attribute type twice,
the last one wins in the normal parsing anyway (IIRC)...
> I'm leaning heavily towards defining a subset of the YAML spec as
> "the way to do things in new family" which will allow only one form
> of arrays.
Fair enough.
johannes
next prev parent reply other threads:[~2022-08-16 19:31 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 2:23 [RFC net-next 0/4] ynl: YAML netlink protocol descriptions Jakub Kicinski
2022-08-11 2:23 ` [RFC net-next 1/4] ynl: add intro docs for the concept Jakub Kicinski
2022-08-11 20:17 ` Edward Cree
2022-08-12 22:23 ` Jakub Kicinski
2022-08-15 20:09 ` Johannes Berg
2022-08-16 0:32 ` Jakub Kicinski
2022-08-16 7:07 ` Johannes Berg
2022-08-11 2:23 ` [RFC net-next 2/4] ynl: add the schema for the schemas Jakub Kicinski
2022-08-15 20:03 ` Johannes Berg
2022-08-15 20:09 ` Johannes Berg
2022-08-16 0:47 ` Jakub Kicinski
2022-08-16 7:21 ` Johannes Berg
2022-08-16 15:53 ` Jakub Kicinski
2022-08-16 19:30 ` Johannes Berg [this message]
2022-09-26 16:10 ` Rob Herring
2022-09-27 21:56 ` Jakub Kicinski
2022-09-28 12:32 ` Rob Herring
2022-08-11 2:23 ` [RFC net-next 3/4] ynl: add a sample python library Jakub Kicinski
2022-08-11 5:48 ` Benjamin Poirier
2022-08-11 15:50 ` Jakub Kicinski
2022-08-11 20:09 ` Stephen Hemminger
2022-08-12 22:53 ` Jakub Kicinski
2022-08-15 20:00 ` Johannes Berg
2022-08-12 1:04 ` Stephen Hemminger
2022-08-12 15:42 ` Edward Cree
2022-08-12 23:07 ` Jakub Kicinski
2022-08-18 21:26 ` Keller, Jacob E
2022-08-11 2:23 ` [RFC net-next 4/4] ynl: add a sample user for ethtool Jakub Kicinski
2022-08-11 16:18 ` sdf
2022-08-11 19:35 ` Jakub Kicinski
2022-08-11 22:55 ` Stanislav Fomichev
2022-08-11 23:31 ` Jakub Kicinski
2022-08-12 16:26 ` Stanislav Fomichev
2022-08-12 22:48 ` Jakub Kicinski
2022-08-14 12:27 ` Ido Schimmel
2022-08-11 4:15 ` [RFC net-next 0/4] ynl: YAML netlink protocol descriptions Stephen Hemminger
2022-08-11 4:47 ` Jakub Kicinski
2022-08-11 15:01 ` Stephen Hemminger
2022-08-11 15:34 ` Jakub Kicinski
2022-08-11 16:28 ` sdf
2022-08-11 19:42 ` Jakub Kicinski
2022-08-12 17:00 ` Florian Fainelli
2022-08-12 22:26 ` Jakub Kicinski
2022-08-19 19:56 ` Jakub Kicinski
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=c4a4744c0f0a86433beec5035f2150b8427eb3d5.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
--cc=stephen@networkplumber.org \
--cc=vadfed@fb.com \
/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 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).