[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250505172750.2c0a8f2b@kernel.org>
Date: Mon, 5 May 2025 17:27:50 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org,
donald.hunter@...il.com, jacob.e.keller@...el.com, sdf@...ichev.me
Subject: Re: [PATCH net-next 2/3] tools: ynl-gen: split presence metadata
On Mon, 5 May 2025 14:06:29 -0700 David Wei wrote:
> > @@ -282,6 +281,7 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S
> > # Every layer below last is a nest, so we know it uses bit presence
> > # last layer is "self" and may be a complex type
> > if i == len(ref) - 1 and self.presence_type() != 'present':
> > + presence = f"{var}->{'.'.join(ref[:i] + [''])}_{self.presence_type()}.{ref[i]}"
>
> Can this go a few lines higher and replace:
>
> presence = f"{var}->{'.'.join(ref[:i] + [''])}_present.{ref[i]}"
>
> Since self.presence_type() would always return the correct string,
> including "_present"?
Hm, I don't think so. This is some of the gnarliest code the codegen
has, but it tries to generate something like:
req->_present.options = 1;
req->options._present.cgroup = 1;
req->options.cgroup._count.act = n_act;
We have a nested member called "act". It's two nesting layers deep
inside the requests. We need to mark the "act" as present, but also
all parent nests as present. The nests always have presence type
of "present" (that's why its hardcoded at the start of the loop).
Last layer is the "real" presence type of the attribute, so we use
self.presence_type().
Powered by blists - more mailing lists