netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	 Jacob Keller <jacob.e.keller@intel.com>,
	Jiri Pirko <jiri@resnulli.us>,
	 Stanislav Fomichev <sdf@google.com>,
	donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1 3/4] tools/net/ynl: Extend array-nest for multi level nesting
Date: Sun, 3 Mar 2024 10:50:09 +0000	[thread overview]
Message-ID: <CAD4GDZwHXNM++G3xDgD_xFk1mHgxr+Bw35uJuDFG+iOchynPqw@mail.gmail.com> (raw)
In-Reply-To: <20240302200536.511a5078@kernel.org>

On Sun, 3 Mar 2024 at 04:05, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri,  1 Mar 2024 17:14:30 +0000 Donald Hunter wrote:
> > The nlctrl family uses 2 levels of array nesting for policy attributes.
> > Add a 'nest-depth' property to genetlink-legacy and extend ynl to use
> > it.
>
> Hm, I'm 90% sure we don't need this... because nlctrl is basically what
> the legacy level was written for, initially. The spec itself wasn't
> sent, because the C codegen for it was quite painful. And the Python
> CLI was an afterthought.
>
> Could you describe what nesting you're trying to cover here?
> Isn't it a type-value?

I added it for getpolicy which is indexed by policy_idx and attr_idx.

./tools/net/ynl/cli.py \
    --spec Documentation/netlink/specs/nlctrl.yaml \
    --dump getpolicy --json '{"family-name": "nlctrl"}'
[{'family-id': 16, 'op-policy': [{3: {'do': 0, 'dump': 0}}]},
 {'family-id': 16, 'op-policy': [{0: {'dump': 1}}]},
 {'family-id': 16,
  'policy': [{0: [{1: {'max-value-u': 65535,
                       'min-value-u': 0,
                       'type': 'u16'}}]}]},
 {'family-id': 16,
  'policy': [{0: [{2: {'max-length': 15, 'type': 'nul-string'}}]}]},
 {'family-id': 16,
  'policy': [{1: [{1: {'max-value-u': 65535,
                       'min-value-u': 0,
                       'type': 'u16'}}]}]},
 {'family-id': 16,
  'policy': [{1: [{2: {'max-length': 15, 'type': 'nul-string'}}]}]},
 {'family-id': 16,
  'policy': [{1: [{10: {'max-value-u': 4294967295,
                        'min-value-u': 0,
                        'type': 'u32'}}]}]}]

> BTW we'll also need to deal with the C codegen situation somehow.
> Try making it work, if it's not a simple matter of fixing up the
> names to match the header - we can grep nlctrl out in the Makefile.

Yeah, I forgot to check codegen but saw the failures on patchwork. I
have fixed the names but still have a couple more things to fix.

BTW, this patchset was a step towards experimenting with removing the
hard-coded msg decoding in the Python library. Not so much for
genetlink families, more for the extack decoding so that I could add
policy attr decoding. Thinking about it some more, that might be
better done with a "core" spec that contains just extack-attrs and
policy-attrs because they don't belong to any single family - they're
kinda infrastructure for all families.

  reply	other threads:[~2024-03-03 10:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 17:14 [PATCH net-next v1 0/4] tools/net/ynl: Add support for nlctrl netlink family Donald Hunter
2024-03-01 17:14 ` [PATCH net-next v1 1/4] tools/net/ynl: Fix extack decoding for netlink-raw Donald Hunter
2024-03-01 17:14 ` [PATCH net-next v1 2/4] tools/net/ynl: Report netlink errors without stacktrace Donald Hunter
2024-03-01 17:14 ` [PATCH net-next v1 3/4] tools/net/ynl: Extend array-nest for multi level nesting Donald Hunter
2024-03-03  4:05   ` Jakub Kicinski
2024-03-03 10:50     ` Donald Hunter [this message]
2024-03-04 15:22       ` Jakub Kicinski
2024-03-04 16:21         ` Donald Hunter
2024-03-04 16:32           ` Jakub Kicinski
2024-03-01 17:14 ` [PATCH net-next v1 4/4] doc/netlink/specs: Add spec for nlctrl netlink family Donald Hunter

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=CAD4GDZwHXNM++G3xDgD_xFk1mHgxr+Bw35uJuDFG+iOchynPqw@mail.gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.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).