Re: [PATCH RFC 11/20] ctlv: Prepare runtime introspection

From: Jiri Pirko

Date: Fri Oct 30 2026 - 05:59:07 EST


Mon, Oct 26, 2026 at 03:07:54PM +0100, jgg@xxxxxxxxxx wrote:

[..]

>
>This isn't even that complicated, if I ask AI to explain it in a C ish
>language:
>
>struct device_get_reply {
> struct {
> optional struct {
> uint min_challenge_length;
> uint max_challenge_length;
> uint max_total_output_length;
> struct {
> enum blob_class;
> string format;
> enum representation;
> uint max_length;
> } objects[];
> } evidence;
>
> optional struct {
> flags mr_flags; /* read, extend */
> } mr;
> } caps;
>
> struct {
> /* device-info: filled by the derived family */
> } info;
>};
>
>I think the yaml names are not helping, calling everything attrs
>everywhere is really confusing. At least the transition into a nest
>and an attr-set should be more clearly marked in the yaml..
>
>The yaml would be significantly better if it was layed out according
>to the actual semantic flow instead of artificially being twisted into
>this need to put everything into a linear list. AI invented this:
>
>device-get:
> request: {}
> reply:
> caps:
> evidence?:
> min-challenge-length: uint
> max-challenge-length: uint
> max-total-output-length: uint
> objects[]:
> blob-class: evidence-blob-class
> format: string
> representation: evidence-representation
> max-length: uint
> mr?:
> mr-flags: mr-device-caps
> info:
> $extend: device-info
>

I have it implemented like this (with small changes). Looks great!


>So.. how about could we drop the sets, use a direct description of the
>layout and do something else for the ID numbering? Maybe the numbering
>can be solved directly by only listing the names in:
>
>numbering:
> - device-get.reply
> - device-get.reply.caps
> - device-get.caps.evidence
> -[..]
>
>?

I'm still committed to implicit numbering. For "inline records" I
resolved it by having it encoded as a tree with 4 levels:

63 48 47 46 45 32 31 28 27 24 23 20 19 16 15 0
+-------------+-----+------------+------+------+------+------+------------------+
| family |kind | index | L1 | L2 | L3 | L4 | field |
+-------------+-----+------------+------+------+------+------+------------------+
|<------------------ record ------------------>|

Renamed "attr" to "field" - I agree that the original implementation had
attr everywhere. I got rid of it.
"group" is now "record". I enlarged it to 32 bits to accomodate:
1) kind is one of: named, request, reply - request and reply is used for
inline op records,
2) index for named records (pre defined)
3) L1-L4 for inline records

rfc2 will show it in more details
>
>--
>Jason