netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC
@ 2025-05-17  0:13 Jakub Kicinski
  2025-05-17  0:13 ` [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests Jakub Kicinski
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

Add C codegen support for constructs needed by TC, namely passing
sub-message selector from a lower nest, and sub-messages with
fixed headers.

Jakub Kicinski (11):
  netlink: specs: tc: remove duplicate nests
  netlink: specs: tc: use tc-gact instead of tc-gen as struct name
  netlink: specs: tc: add C naming info
  netlink: specs: tc: drop the family name prefix from attrs
  tools: ynl-gen: support passing selector to a nest
  tools: ynl-gen: move fixed header info from RenderInfo to Struct
  tools: ynl-gen: support local attrs in _multi_parse
  tools: ynl-gen: support weird sub-message formats
  tools: ynl: enable codegen for TC
  netlink: specs: tc: add qdisc dump to TC spec
  tools: ynl: add a sample for TC

 Documentation/netlink/specs/tc.yaml | 514 +++++++++++++++-------------
 tools/net/ynl/Makefile.deps         |   2 +
 tools/net/ynl/generated/Makefile    |   2 +-
 tools/net/ynl/lib/ynl-priv.h        |   8 +-
 tools/net/ynl/samples/tc.c          |  80 +++++
 tools/net/ynl/pyynl/ynl_gen_c.py    | 171 +++++++--
 tools/net/ynl/samples/.gitignore    |   1 +
 7 files changed, 493 insertions(+), 285 deletions(-)
 create mode 100644 tools/net/ynl/samples/tc.c

-- 
2.49.0


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:34   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 02/11] netlink: specs: tc: use tc-gact instead of tc-gen as struct name Jakub Kicinski
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

tc-act-stats-attrs and tca-stats-attrs are almost identical.
The only difference is that the latter has sub-message decoding
for app, rather than declaring it as a binary attr.

tc-act-police-attrs and tc-police-attrs are identical but for
the TODO annotations.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/tc.yaml | 78 ++---------------------------
 1 file changed, 4 insertions(+), 74 deletions(-)

diff --git a/Documentation/netlink/specs/tc.yaml b/Documentation/netlink/specs/tc.yaml
index 953aa837958b..c7e6a734cd12 100644
--- a/Documentation/netlink/specs/tc.yaml
+++ b/Documentation/netlink/specs/tc.yaml
@@ -1452,7 +1452,7 @@ protonum: 0
       -
         name: stats
         type: nest
-        nested-attributes: tc-act-stats-attrs
+        nested-attributes: tca-stats-attrs
       -
         name: pad
         type: pad
@@ -1471,38 +1471,6 @@ protonum: 0
       -
         name: in-hw-count
         type: u32
-  -
-    name: tc-act-stats-attrs
-    attributes:
-      -
-        name: basic
-        type: binary
-        struct: gnet-stats-basic
-      -
-        name: rate-est
-        type: binary
-        struct: gnet-stats-rate-est
-      -
-        name: queue
-        type: binary
-        struct: gnet-stats-queue
-      -
-        name: app
-        type: binary
-      -
-        name: rate-est64
-        type: binary
-        struct: gnet-stats-rate-est64
-      -
-        name: pad
-        type: pad
-      -
-        name: basic-hw
-        type: binary
-        struct: gnet-stats-basic
-      -
-        name: pkt64
-        type: u64
   -
     name: tc-act-bpf-attrs
     attributes:
@@ -1797,44 +1765,6 @@ protonum: 0
       -
         name: key-ex
         type: binary
-  -
-    name: tc-act-police-attrs
-    attributes:
-      -
-        name: tbf
-        type: binary
-        struct: tc-police
-      -
-        name: rate
-        type: binary # TODO
-      -
-        name: peakrate
-        type: binary # TODO
-      -
-        name: avrate
-        type: u32
-      -
-        name: result
-        type: u32
-      -
-        name: tm
-        type: binary
-        struct: tcf-t
-      -
-        name: pad
-        type: pad
-      -
-        name: rate64
-        type: u64
-      -
-        name: peakrate64
-        type: u64
-      -
-        name: pktrate64
-        type: u64
-      -
-        name: pktburst64
-        type: u64
   -
     name: tc-act-simple-attrs
     attributes:
@@ -3327,10 +3257,10 @@ protonum: 0
         struct: tc-police
       -
         name: rate
-        type: binary
+        type: binary # TODO
       -
         name: peakrate
-        type: binary
+        type: binary # TODO
       -
         name: avrate
         type: u32
@@ -3817,7 +3747,7 @@ protonum: 0
         attribute-set: tc-act-pedit-attrs
       -
         value: police
-        attribute-set: tc-act-police-attrs
+        attribute-set: tc-police-attrs
       -
         value: sample
         attribute-set: tc-act-sample-attrs
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 02/11] netlink: specs: tc: use tc-gact instead of tc-gen as struct name
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
  2025-05-17  0:13 ` [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:35   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 03/11] netlink: specs: tc: add C naming info Jakub Kicinski
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

There is a define in the uAPI header called tc_gen which expands
to the "generic" TC action fields. This helps other actions include
the base fields without having to deal with nested structs.

A couple of actions (sample, gact) do not define extra fields,
so the spec used a common tc-gen struct for both of them.
Unfortunately this struct does not exist in C. Let's use gact's
(generic act's) struct for basic actions.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/tc.yaml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/netlink/specs/tc.yaml b/Documentation/netlink/specs/tc.yaml
index c7e6a734cd12..697fdd1219d5 100644
--- a/Documentation/netlink/specs/tc.yaml
+++ b/Documentation/netlink/specs/tc.yaml
@@ -1186,7 +1186,7 @@ protonum: 0
         name: firstuse
         type: u64
   -
-    name: tc-gen
+    name: tc-gact
     type: struct
     members:
       -
@@ -3457,7 +3457,7 @@ protonum: 0
       -
         name: parms
         type: binary
-        struct: tc-gen
+        struct: tc-gact
       -
         name: rate
         type: u32
@@ -3480,7 +3480,7 @@ protonum: 0
       -
         name: parms
         type: binary
-        struct: tc-gen
+        struct: tc-gact
       -
         name: prob
         type: binary
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 03/11] netlink: specs: tc: add C naming info
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
  2025-05-17  0:13 ` [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests Jakub Kicinski
  2025-05-17  0:13 ` [PATCH net-next 02/11] netlink: specs: tc: use tc-gact instead of tc-gen as struct name Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:36   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 04/11] netlink: specs: tc: drop the family name prefix from attrs Jakub Kicinski
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

Add naming info needed by C code gen.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/tc.yaml | 95 +++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/Documentation/netlink/specs/tc.yaml b/Documentation/netlink/specs/tc.yaml
index 697fdd1219d5..8d5e5cb439e4 100644
--- a/Documentation/netlink/specs/tc.yaml
+++ b/Documentation/netlink/specs/tc.yaml
@@ -2,6 +2,7 @@
 
 name: tc
 protocol: netlink-raw
+uapi-header: linux/pkt_cls.h
 protonum: 0
 
 doc:
@@ -12,6 +13,7 @@ protonum: 0
   -
     name: tcmsg
     type: struct
+    header: linux/rtnetlink.h
     members:
       -
         name: family
@@ -34,6 +36,7 @@ protonum: 0
         type: u32
   -
     name: tc-cls-flags
+    enum-name:
     type: flags
     entries:
       - skip-hw
@@ -43,6 +46,8 @@ protonum: 0
       - verbose
   -
     name: tc-flower-key-ctrl-flags
+    name-prefix: tca-flower-key-flags-
+    enum-name:
     type: flags
     entries:
       - frag
@@ -630,6 +635,7 @@ protonum: 0
   -
     name: tc-ratespec
     type: struct
+    header: linux/pkt_sched.h
     members:
       -
         name: cell-log
@@ -1378,6 +1384,7 @@ protonum: 0
 attribute-sets:
   -
     name: tc-attrs
+    name-prefix: tca-
     attributes:
       -
         name: kind
@@ -1437,6 +1444,7 @@ protonum: 0
         type: string
   -
     name: tc-act-attrs
+    name-prefix: tca-act-
     attributes:
       -
         name: kind
@@ -1473,6 +1481,8 @@ protonum: 0
         type: u32
   -
     name: tc-act-bpf-attrs
+    name-prefix: tca-act-bpf-
+    header: linux/tc_act/tc_bpf.h
     attributes:
       -
         name: tm
@@ -1504,6 +1514,8 @@ protonum: 0
         type: binary
   -
     name: tc-act-connmark-attrs
+    name-prefix: tca-connmark-
+    header: linux/tc_act/tc_connmark.h
     attributes:
       -
         name: parms
@@ -1517,6 +1529,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-csum-attrs
+    name-prefix: tca-csum-
+    header: linux/tc_act/tc_csum.h
     attributes:
       -
         name: parms
@@ -1530,6 +1544,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-ct-attrs
+    name-prefix: tca-ct-
+    header: linux/tc_act/tc_ct.h
     attributes:
       -
         name: parms
@@ -1592,6 +1608,8 @@ protonum: 0
         type: u8
   -
     name: tc-act-ctinfo-attrs
+    name-prefix: tca-ctinfo-
+    header: linux/tc_act/tc_ctinfo.h
     attributes:
       -
         name: pad
@@ -1626,6 +1644,8 @@ protonum: 0
         type: u64
   -
     name: tc-act-gate-attrs
+    name-prefix: tca-gate-
+    header: linux/tc_act/tc_gate.h
     attributes:
       -
         name: tm
@@ -1660,6 +1680,8 @@ protonum: 0
         type: s32
   -
     name: tc-act-ife-attrs
+    name-prefix: tca-ife-
+    header: linux/tc_act/tc_ife.h
     attributes:
       -
         name: parms
@@ -1685,6 +1707,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-mirred-attrs
+    name-prefix: tca-mirred-
+    header: linux/tc_act/tc_mirred.h
     attributes:
       -
         name: tm
@@ -1701,6 +1725,8 @@ protonum: 0
         type: binary
   -
     name: tc-act-mpls-attrs
+    name-prefix: tca-mpls-
+    header: linux/tc_act/tc_mpls.h
     attributes:
       -
         name: tm
@@ -1731,6 +1757,8 @@ protonum: 0
         type: u8
   -
     name: tc-act-nat-attrs
+    name-prefix: tca-nat-
+    header: linux/tc_act/tc_nat.h
     attributes:
       -
         name: parms
@@ -1744,6 +1772,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-pedit-attrs
+    name-prefix: tca-pedit-
+    header: linux/tc_act/tc_pedit.h
     attributes:
       -
         name: tm
@@ -1767,6 +1797,8 @@ protonum: 0
         type: binary
   -
     name: tc-act-simple-attrs
+    name-prefix: tca-def-
+    header: linux/tc_act/tc_defact.h
     attributes:
       -
         name: tm
@@ -1783,6 +1815,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-skbedit-attrs
+    name-prefix: tca-skbedit-
+    header: linux/tc_act/tc_skbedit.h
     attributes:
       -
         name: tm
@@ -1817,6 +1851,8 @@ protonum: 0
         type: u16
   -
     name: tc-act-skbmod-attrs
+    name-prefix: tca-skbmod-
+    header: linux/tc_act/tc_skbmod.h
     attributes:
       -
         name: tm
@@ -1839,6 +1875,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-tunnel-key-attrs
+    name-prefix: tca-tunnel-key-
+    header: linux/tc_act/tc_tunnel_key.h
     attributes:
       -
         name: tm
@@ -1889,6 +1927,8 @@ protonum: 0
         type: flag
   -
     name: tc-act-vlan-attrs
+    name-prefix: tca-vlan-
+    header: linux/tc_act/tc_vlan.h
     attributes:
       -
         name: tm
@@ -1918,6 +1958,7 @@ protonum: 0
         type: binary
   -
     name: tc-basic-attrs
+    name-prefix: tca-basic-
     attributes:
       -
         name: classid
@@ -1944,6 +1985,7 @@ protonum: 0
         type: pad
   -
     name: tc-bpf-attrs
+    name-prefix: tca-bpf-
     attributes:
       -
         name: act
@@ -1983,6 +2025,7 @@ protonum: 0
         type: u32
   -
     name: tc-cake-attrs
+    name-prefix: tca-cake-
     attributes:
       -
         name: pad
@@ -2040,6 +2083,7 @@ protonum: 0
         type: u32
   -
     name: tc-cake-stats-attrs
+    name-prefix: tca-cake-stats-
     attributes:
       -
         name: pad
@@ -2093,6 +2137,7 @@ protonum: 0
         type: s32
   -
     name: tc-cake-tin-stats-attrs
+    name-prefix: tca-cake-tin-stats-
     attributes:
       -
         name: pad
@@ -2171,6 +2216,7 @@ protonum: 0
         type: u32
   -
     name: tc-cbs-attrs
+    name-prefix: tca-cbs-
     attributes:
       -
         name: parms
@@ -2178,6 +2224,7 @@ protonum: 0
         struct: tc-cbs-qopt
   -
     name: tc-cgroup-attrs
+    name-prefix: tca-cgroup-
     attributes:
       -
         name: act
@@ -2193,6 +2240,7 @@ protonum: 0
         type: binary
   -
     name: tc-choke-attrs
+    name-prefix: tca-choke-
     attributes:
       -
         name: parms
@@ -2209,6 +2257,7 @@ protonum: 0
         type: u32
   -
     name: tc-codel-attrs
+    name-prefix: tca-codel-
     attributes:
       -
         name: target
@@ -2227,12 +2276,15 @@ protonum: 0
         type: u32
   -
     name: tc-drr-attrs
+    name-prefix: tca-drr-
     attributes:
       -
         name: quantum
         type: u32
   -
     name: tc-ematch-attrs
+    name-prefix: tca-ematch-
+    attr-max-name: tca-ematch-tree-max
     attributes:
       -
         name: tree-hdr
@@ -2243,6 +2295,7 @@ protonum: 0
         type: binary
   -
     name: tc-flow-attrs
+    name-prefix: tca-flow-
     attributes:
       -
         name: keys
@@ -2283,6 +2336,7 @@ protonum: 0
         type: u32
   -
     name: tc-flower-attrs
+    name-prefix: tca-flower-
     attributes:
       -
         name: classid
@@ -2709,6 +2763,7 @@ protonum: 0
         enum-as-flags: true
   -
     name: tc-flower-key-enc-opts-attrs
+    name-prefix: tca-flower-key-enc-opts-
     attributes:
       -
         name: geneve
@@ -2728,6 +2783,7 @@ protonum: 0
         nested-attributes: tc-flower-key-enc-opt-gtp-attrs
   -
     name: tc-flower-key-enc-opt-geneve-attrs
+    name-prefix: tca-flower-key-enc-opt-geneve-
     attributes:
       -
         name: class
@@ -2740,12 +2796,14 @@ protonum: 0
         type: binary
   -
     name: tc-flower-key-enc-opt-vxlan-attrs
+    name-prefix: tca-flower-key-enc-opt-vxlan-
     attributes:
       -
         name: gbp
         type: u32
   -
     name: tc-flower-key-enc-opt-erspan-attrs
+    name-prefix: tca-flower-key-enc-opt-erspan-
     attributes:
       -
         name: ver
@@ -2761,6 +2819,7 @@ protonum: 0
         type: u8
   -
     name: tc-flower-key-enc-opt-gtp-attrs
+    name-prefix: tca-flower-key-enc-opt-gtp-
     attributes:
       -
         name: pdu-type
@@ -2770,6 +2829,8 @@ protonum: 0
         type: u8
   -
     name: tc-flower-key-mpls-opt-attrs
+    name-prefix: tca-flower-key-mpls-opt-
+    attr-max-name: tca-flower-key-mpls-opt-lse-max
     attributes:
       -
         name: lse-depth
@@ -2788,6 +2849,7 @@ protonum: 0
         type: u32
   -
     name: tc-flower-key-cfm-attrs
+    name-prefix: tca-flower-key-cfm-
     attributes:
       -
         name: md-level
@@ -2797,6 +2859,7 @@ protonum: 0
         type: u8
   -
     name: tc-fw-attrs
+    name-prefix: tca-fw-
     attributes:
       -
         name: classid
@@ -2818,6 +2881,7 @@ protonum: 0
         type: u32
   -
     name: tc-gred-attrs
+    name-prefix: tca-gred-
     attributes:
       -
         name: parms
@@ -2843,6 +2907,7 @@ protonum: 0
         nested-attributes: tca-gred-vq-list-attrs
   -
     name: tca-gred-vq-list-attrs
+    name-prefix: tca-gred-vq-
     attributes:
       -
         name: entry
@@ -2851,6 +2916,7 @@ protonum: 0
         multi-attr: true
   -
     name: tca-gred-vq-entry-attrs
+    name-prefix: tca-gred-vq-
     attributes:
       -
         name: pad
@@ -2902,6 +2968,7 @@ protonum: 0
         type: binary
   -
     name: tc-hhf-attrs
+    name-prefix: tca-hhf-
     attributes:
       -
         name: backlog-limit
@@ -2926,6 +2993,7 @@ protonum: 0
         type: u32
   -
     name: tc-htb-attrs
+    name-prefix: tca-htb-
     attributes:
       -
         name: parms
@@ -2958,6 +3026,7 @@ protonum: 0
         type: flag
   -
     name: tc-matchall-attrs
+    name-prefix: tca-matchall-
     attributes:
       -
         name: classid
@@ -2979,6 +3048,7 @@ protonum: 0
         type: pad
   -
     name: tc-etf-attrs
+    name-prefix: tca-etf-
     attributes:
       -
         name: parms
@@ -2986,6 +3056,7 @@ protonum: 0
         struct: tc-etf-qopt
   -
     name: tc-ets-attrs
+    name-prefix: tca-ets-
     attributes:
       -
         name: nbands
@@ -3011,6 +3082,7 @@ protonum: 0
         multi-attr: true
   -
     name: tc-fq-attrs
+    name-prefix: tca-fq-
     attributes:
       -
         name: plimit
@@ -3082,6 +3154,7 @@ protonum: 0
         doc: Weights for each band
   -
     name: tc-fq-codel-attrs
+    name-prefix: tca-fq-codel-
     attributes:
       -
         name: target
@@ -3118,6 +3191,7 @@ protonum: 0
         type: u8
   -
     name: tc-fq-pie-attrs
+    name-prefix: tca-fq-pie-
     attributes:
       -
         name: limit
@@ -3157,6 +3231,7 @@ protonum: 0
         type: u32
   -
     name: tc-netem-attrs
+    name-prefix: tca-netem-
     attributes:
       -
         name: corr
@@ -3210,6 +3285,7 @@ protonum: 0
         type: u64
   -
     name: tc-netem-loss-attrs
+    name-prefix: netem-loss-
     attributes:
       -
         name: gi
@@ -3223,6 +3299,7 @@ protonum: 0
         struct: tc-netem-gemodel
   -
     name: tc-pie-attrs
+    name-prefix: tca-pie-
     attributes:
       -
         name: target
@@ -3250,6 +3327,7 @@ protonum: 0
         type: u32
   -
     name: tc-police-attrs
+    name-prefix: tca-police-
     attributes:
       -
         name: tbf
@@ -3288,6 +3366,7 @@ protonum: 0
         type: u64
   -
     name: tc-qfq-attrs
+    name-prefix: tca-qfq-
     attributes:
       -
         name: weight
@@ -3297,6 +3376,7 @@ protonum: 0
         type: u32
   -
     name: tc-red-attrs
+    name-prefix: tca-red-
     attributes:
       -
         name: parms
@@ -3319,6 +3399,7 @@ protonum: 0
         type: u32
   -
     name: tc-route-attrs
+    name-prefix: tca-route4-
     attributes:
       -
         name: classid
@@ -3343,6 +3424,7 @@ protonum: 0
         nested-attributes: tc-act-attrs
   -
     name: tc-taprio-attrs
+    name-prefix: tca-taprio-attr-
     attributes:
       -
         name: priomap
@@ -3386,6 +3468,7 @@ protonum: 0
         nested-attributes: tc-taprio-tc-entry-attrs
   -
     name: tc-taprio-sched-entry-list
+    name-prefix: tca-taprio-sched-
     attributes:
       -
         name: entry
@@ -3394,6 +3477,7 @@ protonum: 0
         multi-attr: true
   -
     name: tc-taprio-sched-entry
+    name-prefix: tca-taprio-sched-entry-
     attributes:
       -
         name: index
@@ -3409,6 +3493,7 @@ protonum: 0
         type: u32
   -
     name: tc-taprio-tc-entry-attrs
+    name-prefix: tca-taprio-tc-entry-
     attributes:
       -
         name: index
@@ -3421,6 +3506,7 @@ protonum: 0
         type: u32
   -
     name: tc-tbf-attrs
+    name-prefix: tca-tbf-
     attributes:
       -
         name: parms
@@ -3449,6 +3535,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-sample-attrs
+    name-prefix: tca-sample-
+    header: linux/tc_act/tc_sample.h
     attributes:
       -
         name: tm
@@ -3472,6 +3560,8 @@ protonum: 0
         type: pad
   -
     name: tc-act-gact-attrs
+    name-prefix: tca-gact-
+    header: linux/tc_act/tc_gact.h
     attributes:
       -
         name: tm
@@ -3490,6 +3580,7 @@ protonum: 0
         type: pad
   -
     name: tca-stab-attrs
+    name-prefix: tca-stab-
     attributes:
       -
         name: base
@@ -3500,6 +3591,8 @@ protonum: 0
         type: binary
   -
     name: tca-stats-attrs
+    name-prefix: tca-stats-
+    header: linux/gen_stats.h
     attributes:
       -
         name: basic
@@ -3534,6 +3627,7 @@ protonum: 0
         type: u64
   -
     name: tc-u32-attrs
+    name-prefix: tca-u32-
     attributes:
       -
         name: classid
@@ -3805,6 +3899,7 @@ protonum: 0
 
 operations:
   enum-model: directional
+  name-prefix: rtm-
   list:
     -
       name: newqdisc
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 04/11] netlink: specs: tc: drop the family name prefix from attrs
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (2 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 03/11] netlink: specs: tc: add C naming info Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:37   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 05/11] tools: ynl-gen: support passing selector to a nest Jakub Kicinski
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

All attribute sets and messages are prefixed with tc-.
The C codegen also adds the family name to all structs.
We end up with names like struct tc_tc_act_attrs.
Remove the tc- prefixes to shorten the names.
This should not impact Python as the attr set names
are never exposed to user, they are only used to refer
to things internally, in the encoder / decoder.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/tc.yaml | 334 ++++++++++++++--------------
 1 file changed, 167 insertions(+), 167 deletions(-)

diff --git a/Documentation/netlink/specs/tc.yaml b/Documentation/netlink/specs/tc.yaml
index 8d5e5cb439e4..6e8db7adde3c 100644
--- a/Documentation/netlink/specs/tc.yaml
+++ b/Documentation/netlink/specs/tc.yaml
@@ -35,7 +35,7 @@ protonum: 0
         name: info
         type: u32
   -
-    name: tc-cls-flags
+    name: cls-flags
     enum-name:
     type: flags
     entries:
@@ -45,7 +45,7 @@ protonum: 0
       - not-in-nw
       - verbose
   -
-    name: tc-flower-key-ctrl-flags
+    name: flower-key-ctrl-flags
     name-prefix: tca-flower-key-flags-
     enum-name:
     type: flags
@@ -1383,7 +1383,7 @@ protonum: 0
         type: s32
 attribute-sets:
   -
-    name: tc-attrs
+    name: attrs
     name-prefix: tca-
     attributes:
       -
@@ -1392,7 +1392,7 @@ protonum: 0
       -
         name: options
         type: sub-message
-        sub-message: tc-options-msg
+        sub-message: options-msg
         selector: kind
       -
         name: stats
@@ -1443,7 +1443,7 @@ protonum: 0
         name: ext-warn-msg
         type: string
   -
-    name: tc-act-attrs
+    name: act-attrs
     name-prefix: tca-act-
     attributes:
       -
@@ -1452,7 +1452,7 @@ protonum: 0
       -
         name: options
         type: sub-message
-        sub-message: tc-act-options-msg
+        sub-message: act-options-msg
         selector: kind
       -
         name: index
@@ -1480,7 +1480,7 @@ protonum: 0
         name: in-hw-count
         type: u32
   -
-    name: tc-act-bpf-attrs
+    name: act-bpf-attrs
     name-prefix: tca-act-bpf-
     header: linux/tc_act/tc_bpf.h
     attributes:
@@ -1513,7 +1513,7 @@ protonum: 0
         name: id
         type: binary
   -
-    name: tc-act-connmark-attrs
+    name: act-connmark-attrs
     name-prefix: tca-connmark-
     header: linux/tc_act/tc_connmark.h
     attributes:
@@ -1528,7 +1528,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-csum-attrs
+    name: act-csum-attrs
     name-prefix: tca-csum-
     header: linux/tc_act/tc_csum.h
     attributes:
@@ -1543,7 +1543,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-ct-attrs
+    name: act-ct-attrs
     name-prefix: tca-ct-
     header: linux/tc_act/tc_ct.h
     attributes:
@@ -1607,7 +1607,7 @@ protonum: 0
         name: helper-proto
         type: u8
   -
-    name: tc-act-ctinfo-attrs
+    name: act-ctinfo-attrs
     name-prefix: tca-ctinfo-
     header: linux/tc_act/tc_ctinfo.h
     attributes:
@@ -1643,7 +1643,7 @@ protonum: 0
         name: stats-cpmark-set
         type: u64
   -
-    name: tc-act-gate-attrs
+    name: act-gate-attrs
     name-prefix: tca-gate-
     header: linux/tc_act/tc_gate.h
     attributes:
@@ -1679,7 +1679,7 @@ protonum: 0
         name: clockid
         type: s32
   -
-    name: tc-act-ife-attrs
+    name: act-ife-attrs
     name-prefix: tca-ife-
     header: linux/tc_act/tc_ife.h
     attributes:
@@ -1706,7 +1706,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-mirred-attrs
+    name: act-mirred-attrs
     name-prefix: tca-mirred-
     header: linux/tc_act/tc_mirred.h
     attributes:
@@ -1724,7 +1724,7 @@ protonum: 0
         name: blockid
         type: binary
   -
-    name: tc-act-mpls-attrs
+    name: act-mpls-attrs
     name-prefix: tca-mpls-
     header: linux/tc_act/tc_mpls.h
     attributes:
@@ -1756,7 +1756,7 @@ protonum: 0
         name: bos
         type: u8
   -
-    name: tc-act-nat-attrs
+    name: act-nat-attrs
     name-prefix: tca-nat-
     header: linux/tc_act/tc_nat.h
     attributes:
@@ -1771,7 +1771,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-pedit-attrs
+    name: act-pedit-attrs
     name-prefix: tca-pedit-
     header: linux/tc_act/tc_pedit.h
     attributes:
@@ -1796,7 +1796,7 @@ protonum: 0
         name: key-ex
         type: binary
   -
-    name: tc-act-simple-attrs
+    name: act-simple-attrs
     name-prefix: tca-def-
     header: linux/tc_act/tc_defact.h
     attributes:
@@ -1814,7 +1814,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-skbedit-attrs
+    name: act-skbedit-attrs
     name-prefix: tca-skbedit-
     header: linux/tc_act/tc_skbedit.h
     attributes:
@@ -1850,7 +1850,7 @@ protonum: 0
         name: queue-mapping-max
         type: u16
   -
-    name: tc-act-skbmod-attrs
+    name: act-skbmod-attrs
     name-prefix: tca-skbmod-
     header: linux/tc_act/tc_skbmod.h
     attributes:
@@ -1874,7 +1874,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-tunnel-key-attrs
+    name: act-tunnel-key-attrs
     name-prefix: tca-tunnel-key-
     header: linux/tc_act/tc_tunnel_key.h
     attributes:
@@ -1926,7 +1926,7 @@ protonum: 0
         name: no-frag
         type: flag
   -
-    name: tc-act-vlan-attrs
+    name: act-vlan-attrs
     name-prefix: tca-vlan-
     header: linux/tc_act/tc_vlan.h
     attributes:
@@ -1957,7 +1957,7 @@ protonum: 0
         name: push-eth-src
         type: binary
   -
-    name: tc-basic-attrs
+    name: basic-attrs
     name-prefix: tca-basic-
     attributes:
       -
@@ -1966,16 +1966,16 @@ protonum: 0
       -
         name: ematches
         type: nest
-        nested-attributes: tc-ematch-attrs
+        nested-attributes: ematch-attrs
       -
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: pcnt
         type: binary
@@ -1984,18 +1984,18 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-bpf-attrs
+    name: bpf-attrs
     name-prefix: tca-bpf-
     attributes:
       -
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: classid
         type: u32
@@ -2024,7 +2024,7 @@ protonum: 0
         name: id
         type: u32
   -
-    name: tc-cake-attrs
+    name: cake-attrs
     name-prefix: tca-cake-
     attributes:
       -
@@ -2082,7 +2082,7 @@ protonum: 0
         name: fwmark
         type: u32
   -
-    name: tc-cake-stats-attrs
+    name: cake-stats-attrs
     name-prefix: tca-cake-stats-
     attributes:
       -
@@ -2116,7 +2116,7 @@ protonum: 0
         name: tin-stats
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-cake-tin-stats-attrs
+        nested-attributes: cake-tin-stats-attrs
       -
         name: deficit
         type: s32
@@ -2136,7 +2136,7 @@ protonum: 0
         name: blue-timer-us
         type: s32
   -
-    name: tc-cake-tin-stats-attrs
+    name: cake-tin-stats-attrs
     name-prefix: tca-cake-tin-stats-
     attributes:
       -
@@ -2215,7 +2215,7 @@ protonum: 0
         name: flow-quantum
         type: u32
   -
-    name: tc-cbs-attrs
+    name: cbs-attrs
     name-prefix: tca-cbs-
     attributes:
       -
@@ -2223,23 +2223,23 @@ protonum: 0
         type: binary
         struct: tc-cbs-qopt
   -
-    name: tc-cgroup-attrs
+    name: cgroup-attrs
     name-prefix: tca-cgroup-
     attributes:
       -
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: ematches
         type: binary
   -
-    name: tc-choke-attrs
+    name: choke-attrs
     name-prefix: tca-choke-
     attributes:
       -
@@ -2256,7 +2256,7 @@ protonum: 0
         name: max-p
         type: u32
   -
-    name: tc-codel-attrs
+    name: codel-attrs
     name-prefix: tca-codel-
     attributes:
       -
@@ -2275,14 +2275,14 @@ protonum: 0
         name: ce-threshold
         type: u32
   -
-    name: tc-drr-attrs
+    name: drr-attrs
     name-prefix: tca-drr-
     attributes:
       -
         name: quantum
         type: u32
   -
-    name: tc-ematch-attrs
+    name: ematch-attrs
     name-prefix: tca-ematch-
     attr-max-name: tca-ematch-tree-max
     attributes:
@@ -2294,7 +2294,7 @@ protonum: 0
         name: tree-list
         type: binary
   -
-    name: tc-flow-attrs
+    name: flow-attrs
     name-prefix: tca-flow-
     attributes:
       -
@@ -2327,7 +2327,7 @@ protonum: 0
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: ematches
         type: binary
@@ -2335,7 +2335,7 @@ protonum: 0
         name: perturb
         type: u32
   -
-    name: tc-flower-attrs
+    name: flower-attrs
     name-prefix: tca-flower-
     attributes:
       -
@@ -2348,7 +2348,7 @@ protonum: 0
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: key-eth-dst
         type: binary
@@ -2427,7 +2427,7 @@ protonum: 0
       -
         name: flags
         type: u32
-        enum: tc-cls-flags
+        enum: cls-flags
         enum-as-flags: true
       -
         name: key-vlan-id
@@ -2532,13 +2532,13 @@ protonum: 0
         name: key-flags
         type: u32
         byte-order: big-endian
-        enum: tc-flower-key-ctrl-flags
+        enum: flower-key-ctrl-flags
         enum-as-flags: true
       -
         name: key-flags-mask
         type: u32
         byte-order: big-endian
-        enum: tc-flower-key-ctrl-flags
+        enum: flower-key-ctrl-flags
         enum-as-flags: true
       -
         name: key-icmpv4-code
@@ -2661,11 +2661,11 @@ protonum: 0
       -
         name: key-enc-opts
         type: nest
-        nested-attributes: tc-flower-key-enc-opts-attrs
+        nested-attributes: flower-key-enc-opts-attrs
       -
         name: key-enc-opts-mask
         type: nest
-        nested-attributes: tc-flower-key-enc-opts-attrs
+        nested-attributes: flower-key-enc-opts-attrs
       -
         name: in-hw-count
         type: u32
@@ -2712,7 +2712,7 @@ protonum: 0
       -
         name: key-mpls-opts
         type: nest
-        nested-attributes: tc-flower-key-mpls-opt-attrs
+        nested-attributes: flower-key-mpls-opt-attrs
       -
         name: key-hash
         type: u32
@@ -2740,7 +2740,7 @@ protonum: 0
       -
         name: key-cfm
         type: nest
-        nested-attributes: tc-flower-key-cfm-attrs
+        nested-attributes: flower-key-cfm-attrs
       -
         name: key-spi
         type: u32
@@ -2753,36 +2753,36 @@ protonum: 0
         name: key-enc-flags
         type: u32
         byte-order: big-endian
-        enum: tc-flower-key-ctrl-flags
+        enum: flower-key-ctrl-flags
         enum-as-flags: true
       -
         name: key-enc-flags-mask
         type: u32
         byte-order: big-endian
-        enum: tc-flower-key-ctrl-flags
+        enum: flower-key-ctrl-flags
         enum-as-flags: true
   -
-    name: tc-flower-key-enc-opts-attrs
+    name: flower-key-enc-opts-attrs
     name-prefix: tca-flower-key-enc-opts-
     attributes:
       -
         name: geneve
         type: nest
-        nested-attributes: tc-flower-key-enc-opt-geneve-attrs
+        nested-attributes: flower-key-enc-opt-geneve-attrs
       -
         name: vxlan
         type: nest
-        nested-attributes: tc-flower-key-enc-opt-vxlan-attrs
+        nested-attributes: flower-key-enc-opt-vxlan-attrs
       -
         name: erspan
         type: nest
-        nested-attributes: tc-flower-key-enc-opt-erspan-attrs
+        nested-attributes: flower-key-enc-opt-erspan-attrs
       -
         name: gtp
         type: nest
-        nested-attributes: tc-flower-key-enc-opt-gtp-attrs
+        nested-attributes: flower-key-enc-opt-gtp-attrs
   -
-    name: tc-flower-key-enc-opt-geneve-attrs
+    name: flower-key-enc-opt-geneve-attrs
     name-prefix: tca-flower-key-enc-opt-geneve-
     attributes:
       -
@@ -2795,14 +2795,14 @@ protonum: 0
         name: data
         type: binary
   -
-    name: tc-flower-key-enc-opt-vxlan-attrs
+    name: flower-key-enc-opt-vxlan-attrs
     name-prefix: tca-flower-key-enc-opt-vxlan-
     attributes:
       -
         name: gbp
         type: u32
   -
-    name: tc-flower-key-enc-opt-erspan-attrs
+    name: flower-key-enc-opt-erspan-attrs
     name-prefix: tca-flower-key-enc-opt-erspan-
     attributes:
       -
@@ -2818,7 +2818,7 @@ protonum: 0
         name: hwid
         type: u8
   -
-    name: tc-flower-key-enc-opt-gtp-attrs
+    name: flower-key-enc-opt-gtp-attrs
     name-prefix: tca-flower-key-enc-opt-gtp-
     attributes:
       -
@@ -2828,7 +2828,7 @@ protonum: 0
         name: qfi
         type: u8
   -
-    name: tc-flower-key-mpls-opt-attrs
+    name: flower-key-mpls-opt-attrs
     name-prefix: tca-flower-key-mpls-opt-
     attr-max-name: tca-flower-key-mpls-opt-lse-max
     attributes:
@@ -2848,7 +2848,7 @@ protonum: 0
         name: lse-label
         type: u32
   -
-    name: tc-flower-key-cfm-attrs
+    name: flower-key-cfm-attrs
     name-prefix: tca-flower-key-cfm-
     attributes:
       -
@@ -2858,7 +2858,7 @@ protonum: 0
         name: opcode
         type: u8
   -
-    name: tc-fw-attrs
+    name: fw-attrs
     name-prefix: tca-fw-
     attributes:
       -
@@ -2867,7 +2867,7 @@ protonum: 0
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: indev
         type: string
@@ -2875,12 +2875,12 @@ protonum: 0
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: mask
         type: u32
   -
-    name: tc-gred-attrs
+    name: gred-attrs
     name-prefix: tca-gred-
     attributes:
       -
@@ -2955,7 +2955,7 @@ protonum: 0
         name: flags
         type: u32
   -
-    name: tc-hfsc-attrs
+    name: hfsc-attrs
     attributes:
       -
         name: rsc
@@ -2967,7 +2967,7 @@ protonum: 0
         name: usc
         type: binary
   -
-    name: tc-hhf-attrs
+    name: hhf-attrs
     name-prefix: tca-hhf-
     attributes:
       -
@@ -2992,7 +2992,7 @@ protonum: 0
         name: non-hh-weight
         type: u32
   -
-    name: tc-htb-attrs
+    name: htb-attrs
     name-prefix: tca-htb-
     attributes:
       -
@@ -3025,7 +3025,7 @@ protonum: 0
         name: offload
         type: flag
   -
-    name: tc-matchall-attrs
+    name: matchall-attrs
     name-prefix: tca-matchall-
     attributes:
       -
@@ -3035,7 +3035,7 @@ protonum: 0
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: flags
         type: u32
@@ -3047,7 +3047,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-etf-attrs
+    name: etf-attrs
     name-prefix: tca-etf-
     attributes:
       -
@@ -3055,7 +3055,7 @@ protonum: 0
         type: binary
         struct: tc-etf-qopt
   -
-    name: tc-ets-attrs
+    name: ets-attrs
     name-prefix: tca-ets-
     attributes:
       -
@@ -3067,7 +3067,7 @@ protonum: 0
       -
         name: quanta
         type: nest
-        nested-attributes: tc-ets-attrs
+        nested-attributes: ets-attrs
       -
         name: quanta-band
         type: u32
@@ -3075,13 +3075,13 @@ protonum: 0
       -
         name: priomap
         type: nest
-        nested-attributes: tc-ets-attrs
+        nested-attributes: ets-attrs
       -
         name: priomap-band
         type: u8
         multi-attr: true
   -
-    name: tc-fq-attrs
+    name: fq-attrs
     name-prefix: tca-fq-
     attributes:
       -
@@ -3153,7 +3153,7 @@ protonum: 0
         sub-type: s32
         doc: Weights for each band
   -
-    name: tc-fq-codel-attrs
+    name: fq-codel-attrs
     name-prefix: tca-fq-codel-
     attributes:
       -
@@ -3190,7 +3190,7 @@ protonum: 0
         name: ce-threshold-mask
         type: u8
   -
-    name: tc-fq-pie-attrs
+    name: fq-pie-attrs
     name-prefix: tca-fq-pie-
     attributes:
       -
@@ -3230,7 +3230,7 @@ protonum: 0
         name: dq-rate-estimator
         type: u32
   -
-    name: tc-netem-attrs
+    name: netem-attrs
     name-prefix: tca-netem-
     attributes:
       -
@@ -3252,7 +3252,7 @@ protonum: 0
       -
         name: loss
         type: nest
-        nested-attributes: tc-netem-loss-attrs
+        nested-attributes: netem-loss-attrs
       -
         name: rate
         type: binary
@@ -3284,7 +3284,7 @@ protonum: 0
         name: prng-seed
         type: u64
   -
-    name: tc-netem-loss-attrs
+    name: netem-loss-attrs
     name-prefix: netem-loss-
     attributes:
       -
@@ -3298,7 +3298,7 @@ protonum: 0
         doc: Gilbert Elliot models
         struct: tc-netem-gemodel
   -
-    name: tc-pie-attrs
+    name: pie-attrs
     name-prefix: tca-pie-
     attributes:
       -
@@ -3326,7 +3326,7 @@ protonum: 0
         name: dq-rate-estimator
         type: u32
   -
-    name: tc-police-attrs
+    name: police-attrs
     name-prefix: tca-police-
     attributes:
       -
@@ -3365,7 +3365,7 @@ protonum: 0
         name: pktburst64
         type: u64
   -
-    name: tc-qfq-attrs
+    name: qfq-attrs
     name-prefix: tca-qfq-
     attributes:
       -
@@ -3375,7 +3375,7 @@ protonum: 0
         name: lmax
         type: u32
   -
-    name: tc-red-attrs
+    name: red-attrs
     name-prefix: tca-red-
     attributes:
       -
@@ -3398,7 +3398,7 @@ protonum: 0
         name: mark-block
         type: u32
   -
-    name: tc-route-attrs
+    name: route-attrs
     name-prefix: tca-route4-
     attributes:
       -
@@ -3416,14 +3416,14 @@ protonum: 0
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
   -
-    name: tc-taprio-attrs
+    name: taprio-attrs
     name-prefix: tca-taprio-attr-
     attributes:
       -
@@ -3433,14 +3433,14 @@ protonum: 0
       -
         name: sched-entry-list
         type: nest
-        nested-attributes: tc-taprio-sched-entry-list
+        nested-attributes: taprio-sched-entry-list
       -
         name: sched-base-time
         type: s64
       -
         name: sched-single-entry
         type: nest
-        nested-attributes: tc-taprio-sched-entry
+        nested-attributes: taprio-sched-entry
       -
         name: sched-clockid
         type: s32
@@ -3465,18 +3465,18 @@ protonum: 0
       -
         name: tc-entry
         type: nest
-        nested-attributes: tc-taprio-tc-entry-attrs
+        nested-attributes: taprio-tc-entry-attrs
   -
-    name: tc-taprio-sched-entry-list
+    name: taprio-sched-entry-list
     name-prefix: tca-taprio-sched-
     attributes:
       -
         name: entry
         type: nest
-        nested-attributes: tc-taprio-sched-entry
+        nested-attributes: taprio-sched-entry
         multi-attr: true
   -
-    name: tc-taprio-sched-entry
+    name: taprio-sched-entry
     name-prefix: tca-taprio-sched-entry-
     attributes:
       -
@@ -3492,7 +3492,7 @@ protonum: 0
         name: interval
         type: u32
   -
-    name: tc-taprio-tc-entry-attrs
+    name: taprio-tc-entry-attrs
     name-prefix: tca-taprio-tc-entry-
     attributes:
       -
@@ -3505,7 +3505,7 @@ protonum: 0
         name: fp
         type: u32
   -
-    name: tc-tbf-attrs
+    name: tbf-attrs
     name-prefix: tca-tbf-
     attributes:
       -
@@ -3534,7 +3534,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-sample-attrs
+    name: act-sample-attrs
     name-prefix: tca-sample-
     header: linux/tc_act/tc_sample.h
     attributes:
@@ -3559,7 +3559,7 @@ protonum: 0
         name: pad
         type: pad
   -
-    name: tc-act-gact-attrs
+    name: act-gact-attrs
     name-prefix: tca-gact-
     header: linux/tc_act/tc_gact.h
     attributes:
@@ -3626,7 +3626,7 @@ protonum: 0
         name: pkt64
         type: u64
   -
-    name: tc-u32-attrs
+    name: u32-attrs
     name-prefix: tca-u32-
     attributes:
       -
@@ -3648,12 +3648,12 @@ protonum: 0
       -
         name: police
         type: nest
-        nested-attributes: tc-police-attrs
+        nested-attributes: police-attrs
       -
         name: act
         type: indexed-array
         sub-type: nest
-        nested-attributes: tc-act-attrs
+        nested-attributes: act-attrs
       -
         name: indev
         type: string
@@ -3674,78 +3674,78 @@ protonum: 0
 
 sub-messages:
   -
-    name: tc-options-msg
+    name: options-msg
     formats:
       -
         value: basic
-        attribute-set: tc-basic-attrs
+        attribute-set: basic-attrs
       -
         value: bpf
-        attribute-set: tc-bpf-attrs
+        attribute-set: bpf-attrs
       -
         value: bfifo
         fixed-header: tc-fifo-qopt
       -
         value: cake
-        attribute-set: tc-cake-attrs
+        attribute-set: cake-attrs
       -
         value: cbs
-        attribute-set: tc-cbs-attrs
+        attribute-set: cbs-attrs
       -
         value: cgroup
-        attribute-set: tc-cgroup-attrs
+        attribute-set: cgroup-attrs
       -
         value: choke
-        attribute-set: tc-choke-attrs
+        attribute-set: choke-attrs
       -
         value: clsact # no content
       -
         value: codel
-        attribute-set: tc-codel-attrs
+        attribute-set: codel-attrs
       -
         value: drr
-        attribute-set: tc-drr-attrs
+        attribute-set: drr-attrs
       -
         value: etf
-        attribute-set: tc-etf-attrs
+        attribute-set: etf-attrs
       -
         value: ets
-        attribute-set: tc-ets-attrs
+        attribute-set: ets-attrs
       -
         value: flow
-        attribute-set: tc-flow-attrs
+        attribute-set: flow-attrs
       -
         value: flower
-        attribute-set: tc-flower-attrs
+        attribute-set: flower-attrs
       -
         value: fq
-        attribute-set: tc-fq-attrs
+        attribute-set: fq-attrs
       -
         value: fq_codel
-        attribute-set: tc-fq-codel-attrs
+        attribute-set: fq-codel-attrs
       -
         value: fq_pie
-        attribute-set: tc-fq-pie-attrs
+        attribute-set: fq-pie-attrs
       -
         value: fw
-        attribute-set: tc-fw-attrs
+        attribute-set: fw-attrs
       -
         value: gred
-        attribute-set: tc-gred-attrs
+        attribute-set: gred-attrs
       -
         value: hfsc
         fixed-header: tc-hfsc-qopt
       -
         value: hhf
-        attribute-set: tc-hhf-attrs
+        attribute-set: hhf-attrs
       -
         value: htb
-        attribute-set: tc-htb-attrs
+        attribute-set: htb-attrs
       -
         value: ingress # no content
       -
         value: matchall
-        attribute-set: tc-matchall-attrs
+        attribute-set: matchall-attrs
       -
         value: mq # no content
       -
@@ -3757,7 +3757,7 @@ protonum: 0
       -
         value: netem
         fixed-header: tc-netem-qopt
-        attribute-set: tc-netem-attrs
+        attribute-set: netem-attrs
       -
         value: pfifo
         fixed-header: tc-fifo-qopt
@@ -3769,7 +3769,7 @@ protonum: 0
         fixed-header: tc-fifo-qopt
       -
         value: pie
-        attribute-set: tc-pie-attrs
+        attribute-set: pie-attrs
       -
         value: plug
         fixed-header: tc-plug-qopt
@@ -3778,13 +3778,13 @@ protonum: 0
         fixed-header: tc-prio-qopt
       -
         value: qfq
-        attribute-set: tc-qfq-attrs
+        attribute-set: qfq-attrs
       -
         value: red
-        attribute-set: tc-red-attrs
+        attribute-set: red-attrs
       -
         value: route
-        attribute-set: tc-route-attrs
+        attribute-set: route-attrs
       -
         value: sfb
         fixed-header: tc-sfb-qopt
@@ -3793,79 +3793,79 @@ protonum: 0
         fixed-header: tc-sfq-qopt-v1
       -
         value: taprio
-        attribute-set: tc-taprio-attrs
+        attribute-set: taprio-attrs
       -
         value: tbf
-        attribute-set: tc-tbf-attrs
+        attribute-set: tbf-attrs
       -
         value: u32
-        attribute-set: tc-u32-attrs
+        attribute-set: u32-attrs
   -
-    name: tc-act-options-msg
+    name: act-options-msg
     formats:
       -
         value: bpf
-        attribute-set: tc-act-bpf-attrs
+        attribute-set: act-bpf-attrs
       -
         value: connmark
-        attribute-set: tc-act-connmark-attrs
+        attribute-set: act-connmark-attrs
       -
         value: csum
-        attribute-set: tc-act-csum-attrs
+        attribute-set: act-csum-attrs
       -
         value: ct
-        attribute-set: tc-act-ct-attrs
+        attribute-set: act-ct-attrs
       -
         value: ctinfo
-        attribute-set: tc-act-ctinfo-attrs
+        attribute-set: act-ctinfo-attrs
       -
         value: gact
-        attribute-set: tc-act-gact-attrs
+        attribute-set: act-gact-attrs
       -
         value: gate
-        attribute-set: tc-act-gate-attrs
+        attribute-set: act-gate-attrs
       -
         value: ife
-        attribute-set: tc-act-ife-attrs
+        attribute-set: act-ife-attrs
       -
         value: mirred
-        attribute-set: tc-act-mirred-attrs
+        attribute-set: act-mirred-attrs
       -
         value: mpls
-        attribute-set: tc-act-mpls-attrs
+        attribute-set: act-mpls-attrs
       -
         value: nat
-        attribute-set: tc-act-nat-attrs
+        attribute-set: act-nat-attrs
       -
         value: pedit
-        attribute-set: tc-act-pedit-attrs
+        attribute-set: act-pedit-attrs
       -
         value: police
-        attribute-set: tc-police-attrs
+        attribute-set: police-attrs
       -
         value: sample
-        attribute-set: tc-act-sample-attrs
+        attribute-set: act-sample-attrs
       -
         value: simple
-        attribute-set: tc-act-simple-attrs
+        attribute-set: act-simple-attrs
       -
         value: skbedit
-        attribute-set: tc-act-skbedit-attrs
+        attribute-set: act-skbedit-attrs
       -
         value: skbmod
-        attribute-set: tc-act-skbmod-attrs
+        attribute-set: act-skbmod-attrs
       -
         value: tunnel_key
-        attribute-set: tc-act-tunnel-key-attrs
+        attribute-set: act-tunnel-key-attrs
       -
         value: vlan
-        attribute-set: tc-act-vlan-attrs
+        attribute-set: act-vlan-attrs
   -
     name: tca-stats-app-msg
     formats:
       -
         value: cake
-        attribute-set: tc-cake-stats-attrs
+        attribute-set: cake-stats-attrs
       -
         value: choke
         fixed-header: tc-choke-xstats
@@ -3904,7 +3904,7 @@ protonum: 0
     -
       name: newqdisc
       doc: Create new tc qdisc.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3919,7 +3919,7 @@ protonum: 0
     -
       name: delqdisc
       doc: Delete existing tc qdisc.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3927,7 +3927,7 @@ protonum: 0
     -
       name: getqdisc
       doc: Get / dump tc qdisc information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3951,7 +3951,7 @@ protonum: 0
     -
       name: newtclass
       doc: Get / dump tc traffic class information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3960,7 +3960,7 @@ protonum: 0
     -
       name: deltclass
       doc: Get / dump tc traffic class information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3968,7 +3968,7 @@ protonum: 0
     -
       name: gettclass
       doc: Get / dump tc traffic class information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3979,7 +3979,7 @@ protonum: 0
     -
       name: newtfilter
       doc: Get / dump tc filter information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3988,7 +3988,7 @@ protonum: 0
     -
       name: deltfilter
       doc: Get / dump tc filter information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -3999,7 +3999,7 @@ protonum: 0
     -
       name: gettfilter
       doc: Get / dump tc filter information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -4022,7 +4022,7 @@ protonum: 0
     -
       name: newchain
       doc: Get / dump tc chain information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -4031,7 +4031,7 @@ protonum: 0
     -
       name: delchain
       doc: Get / dump tc chain information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
@@ -4041,7 +4041,7 @@ protonum: 0
     -
       name: getchain
       doc: Get / dump tc chain information.
-      attribute-set: tc-attrs
+      attribute-set: attrs
       fixed-header: tcmsg
       do:
         request:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 05/11] tools: ynl-gen: support passing selector to a nest
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (3 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 04/11] netlink: specs: tc: drop the family name prefix from attrs Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:46   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 06/11] tools: ynl-gen: move fixed header info from RenderInfo to Struct Jakub Kicinski
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

In rtnetlink all submessages had the selector at the same level
of nesting as the submessage. We could refer to the relevant
attribute from the current struct. In TC, stats are one level
of nesting deeper than "kind". Teach the code-gen about structs
which need to be passed a selector by the caller for parsing.

Because structs are "topologically sorted" one pass of propagating
the selectors down is enough.

For generating netlink message we depend on the presence bits
so no selector passing needed there.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/pyynl/ynl_gen_c.py | 65 +++++++++++++++++++++++++++++---
 1 file changed, 60 insertions(+), 5 deletions(-)

diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 1f8cc34ab3f0..c1508d8c1e7a 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -685,7 +685,11 @@ from lib import SpecSubMessage, SpecSubMessageFormat
                             f"{self.enum_name}, {at}{var}->{self.c_name})")
 
     def _attr_get(self, ri, var):
-        get_lines = [f"if ({self.nested_render_name}_parse(&parg, attr))",
+        pns = self.family.pure_nested_structs[self.nested_attrs]
+        args = ["&parg", "attr"]
+        for sel in pns.external_selectors():
+            args.append(f'{var}->{sel.name}')
+        get_lines = [f"if ({self.nested_render_name}_parse({', '.join(args)}))",
                      "return YNL_PARSE_CB_ERROR;"]
         init_lines = [f"parg.rsp_policy = &{self.nested_render_name}_nest;",
                       f"parg.data = &{var}->{self.c_name};"]
@@ -890,15 +894,24 @@ from lib import SpecSubMessage, SpecSubMessageFormat
 
     def _attr_typol(self):
         typol = f'.type = YNL_PT_NEST, .nest = &{self.nested_render_name}_nest, '
-        typol += f'.is_submsg = 1, .selector_type = {self.attr_set[self["selector"]].value} '
+        typol += '.is_submsg = 1, '
+        # Reverse-parsing of the policy (ynl_err_walk() in ynl.c) does not
+        # support external selectors. No family uses sub-messages with external
+        # selector for requests so this is fine for now.
+        if not self.selector.is_external():
+            typol += f'.selector_type = {self.attr_set[self["selector"]].value} '
         return typol
 
     def _attr_get(self, ri, var):
         sel = c_lower(self['selector'])
-        get_lines = [f'if (!{var}->{sel})',
+        if self.selector.is_external():
+            sel_var = f"_sel_{sel}"
+        else:
+            sel_var = f"{var}->{sel}"
+        get_lines = [f'if (!{sel_var})',
                      f'return ynl_submsg_failed(yarg, "%s", "%s");' %
                         (self.name, self['selector']),
-                    f"if ({self.nested_render_name}_parse(&parg, {var}->{sel}, attr))",
+                    f"if ({self.nested_render_name}_parse(&parg, {sel_var}, attr))",
                      "return YNL_PARSE_CB_ERROR;"]
         init_lines = [f"parg.rsp_policy = &{self.nested_render_name}_nest;",
                       f"parg.data = &{var}->{self.c_name};"]
@@ -914,7 +927,15 @@ from lib import SpecSubMessage, SpecSubMessageFormat
             self.attr.is_selector = True
             self._external = False
         else:
-            raise Exception("Passing selectors from external nests not supported")
+            # The selector will need to get passed down thru the structs
+            self.attr = None
+            self._external = True
+
+    def set_attr(self, attr):
+        self.attr = attr
+
+    def is_external(self):
+        return self._external
 
 
 class Struct:
@@ -976,6 +997,13 @@ from lib import SpecSubMessage, SpecSubMessageFormat
             raise Exception("Inheriting different members not supported")
         self.inherited = [c_lower(x) for x in sorted(self._inherited)]
 
+    def external_selectors(self):
+        sels = []
+        for name, attr in self.attr_list:
+            if isinstance(attr, TypeSubMessage) and attr.selector.is_external():
+                sels.append(attr.selector)
+        return sels
+
     def free_needs_iter(self):
         for _, attr in self.attr_list:
             if attr.free_needs_iter():
@@ -1222,6 +1250,7 @@ from lib import SpecSubMessage, SpecSubMessageFormat
         self._load_root_sets()
         self._load_nested_sets()
         self._load_attr_use()
+        self._load_selector_passing()
         self._load_hooks()
 
         self.kernel_policy = self.yaml.get('kernel-policy', 'split')
@@ -1436,6 +1465,30 @@ from lib import SpecSubMessage, SpecSubMessageFormat
                 if attr in rs_members['reply']:
                     spec.set_reply()
 
+    def _load_selector_passing(self):
+        def all_structs():
+            for k, v in reversed(self.pure_nested_structs.items()):
+                yield k, v
+            for k, _ in self.root_sets.items():
+                yield k, None  # we don't have a struct, but it must be terminal
+
+        for attr_set, struct in all_structs():
+            for _, spec in self.attr_sets[attr_set].items():
+                if 'nested-attributes' in spec:
+                    child_name = spec['nested-attributes']
+                elif 'sub-message' in spec:
+                    child_name = spec.sub_message
+                else:
+                    continue
+
+                child = self.pure_nested_structs.get(child_name)
+                for selector in child.external_selectors():
+                    if selector.name in self.attr_sets[attr_set]:
+                        sel_attr = self.attr_sets[attr_set][selector.name]
+                        selector.set_attr(sel_attr)
+                    else:
+                        raise Exception("Passing selector thru more than one layer not supported")
+
     def _load_global_policy(self):
         global_set = set()
         attr_set_name = None
@@ -2183,6 +2236,8 @@ _C_KW = {
 def parse_rsp_nested_prototype(ri, struct, suffix=';'):
     func_args = ['struct ynl_parse_arg *yarg',
                  'const struct nlattr *nested']
+    for sel in struct.external_selectors():
+        func_args.append('const char *_sel_' + sel.name)
     if struct.submsg:
         func_args.insert(1, 'const char *sel')
     for arg in struct.inherited:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 06/11] tools: ynl-gen: move fixed header info from RenderInfo to Struct
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (4 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 05/11] tools: ynl-gen: support passing selector to a nest Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:49   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 07/11] tools: ynl-gen: support local attrs in _multi_parse Jakub Kicinski
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

RenderInfo describes a request-response exchange. Struct describes
a parsed attribute set. For ease of parsing sub-messages with
fixed headers move fixed header info from RenderInfo to Struct.
No functional changes.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/pyynl/ynl_gen_c.py | 45 +++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index c1508d8c1e7a..bd1fadb2cf5a 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -939,7 +939,7 @@ from lib import SpecSubMessage, SpecSubMessageFormat
 
 
 class Struct:
-    def __init__(self, family, space_name, type_list=None,
+    def __init__(self, family, space_name, type_list=None, fixed_header=None,
                  inherited=None, submsg=None):
         self.family = family
         self.space_name = space_name
@@ -947,6 +947,9 @@ from lib import SpecSubMessage, SpecSubMessageFormat
         # Use list to catch comparisons with empty sets
         self._inherited = inherited if inherited is not None else []
         self.inherited = []
+        self.fixed_header = None
+        if fixed_header:
+            self.fixed_header = 'struct ' + c_lower(fixed_header)
         self.submsg = submsg
 
         self.nested = type_list is None
@@ -1345,7 +1348,9 @@ from lib import SpecSubMessage, SpecSubMessageFormat
         nested = spec['nested-attributes']
         if nested not in self.root_sets:
             if nested not in self.pure_nested_structs:
-                self.pure_nested_structs[nested] = Struct(self, nested, inherited=inherit)
+                self.pure_nested_structs[nested] = \
+                    Struct(self, nested, inherited=inherit,
+                           fixed_header=spec.get('fixed-header'))
         else:
             raise Exception(f'Using attr set as root and nested not supported - {nested}')
 
@@ -1538,13 +1543,12 @@ from lib import SpecSubMessage, SpecSubMessageFormat
         self.op_mode = op_mode
         self.op = op
 
-        self.fixed_hdr = None
+        fixed_hdr = op.fixed_header if op else None
         self.fixed_hdr_len = 'ys->family->hdr_len'
         if op and op.fixed_header:
-            self.fixed_hdr = 'struct ' + c_lower(op.fixed_header)
             if op.fixed_header != family.fixed_header:
                 if family.is_classic():
-                    self.fixed_hdr_len = f"sizeof({self.fixed_hdr})"
+                    self.fixed_hdr_len = f"sizeof(struct {c_lower(fixed_hdr)})"
                 else:
                     raise Exception(f"Per-op fixed header not supported, yet")
 
@@ -1584,12 +1588,17 @@ from lib import SpecSubMessage, SpecSubMessageFormat
                 type_list = []
                 if op_dir in op[op_mode]:
                     type_list = op[op_mode][op_dir]['attributes']
-                self.struct[op_dir] = Struct(family, self.attr_set, type_list=type_list)
+                self.struct[op_dir] = Struct(family, self.attr_set,
+                                             fixed_header=fixed_hdr,
+                                             type_list=type_list)
         if op_mode == 'event':
-            self.struct['reply'] = Struct(family, self.attr_set, type_list=op['event']['attributes'])
+            self.struct['reply'] = Struct(family, self.attr_set,
+                                          fixed_header=fixed_hdr,
+                                          type_list=op['event']['attributes'])
 
     def type_empty(self, key):
-        return len(self.struct[key].attr_list) == 0 and self.fixed_hdr is None
+        return len(self.struct[key].attr_list) == 0 and \
+            self.struct['request'].fixed_header is None
 
     def needs_nlflags(self, direction):
         return self.op_mode == 'do' and direction == 'request' and self.family.is_classic()
@@ -2057,12 +2066,12 @@ _C_KW = {
     if struct.nested:
         iter_line = "ynl_attr_for_each_nested(attr, nested)"
     else:
-        if ri.fixed_hdr:
+        if struct.fixed_header:
             local_vars += ['void *hdr;']
         iter_line = "ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len)"
         if ri.op.fixed_header != ri.family.fixed_header:
             if ri.family.is_classic():
-                iter_line = f"ynl_attr_for_each(attr, nlh, sizeof({ri.fixed_hdr}))"
+                iter_line = f"ynl_attr_for_each(attr, nlh, sizeof({struct.fixed_header}))"
             else:
                 raise Exception(f"Per-op fixed header not supported, yet")
 
@@ -2104,12 +2113,12 @@ _C_KW = {
     for arg in struct.inherited:
         ri.cw.p(f'dst->{arg} = {arg};')
 
-    if ri.fixed_hdr:
+    if struct.fixed_header:
         if ri.family.is_classic():
             ri.cw.p('hdr = ynl_nlmsg_data(nlh);')
         else:
             ri.cw.p('hdr = ynl_nlmsg_data_offset(nlh, sizeof(struct genlmsghdr));')
-        ri.cw.p(f"memcpy(&dst->_hdr, hdr, sizeof({ri.fixed_hdr}));")
+        ri.cw.p(f"memcpy(&dst->_hdr, hdr, sizeof({struct.fixed_header}));")
     for anest in sorted(all_multi):
         aspec = struct[anest]
         ri.cw.p(f"if (dst->{aspec.c_name})")
@@ -2303,7 +2312,7 @@ _C_KW = {
         ret_err = 'NULL'
         local_vars += [f'{type_name(ri, rdir(direction))} *rsp;']
 
-    if ri.fixed_hdr:
+    if ri.struct["request"].fixed_header:
         local_vars += ['size_t hdr_len;',
                        'void *hdr;']
 
@@ -2327,7 +2336,7 @@ _C_KW = {
         ri.cw.p(f"yrs.yarg.rsp_policy = &{ri.struct['reply'].render_name}_nest;")
     ri.cw.nl()
 
-    if ri.fixed_hdr:
+    if ri.struct['request'].fixed_header:
         ri.cw.p("hdr_len = sizeof(req->_hdr);")
         ri.cw.p("hdr = ynl_nlmsg_put_extra_header(nlh, hdr_len);")
         ri.cw.p("memcpy(hdr, &req->_hdr, hdr_len);")
@@ -2373,7 +2382,7 @@ _C_KW = {
                   'struct nlmsghdr *nlh;',
                   'int err;']
 
-    if ri.fixed_hdr:
+    if ri.struct['request'].fixed_header:
         local_vars += ['size_t hdr_len;',
                        'void *hdr;']
 
@@ -2394,7 +2403,7 @@ _C_KW = {
     else:
         ri.cw.p(f"nlh = ynl_gemsg_start_dump(ys, {ri.nl.get_family_id()}, {ri.op.enum_name}, 1);")
 
-    if ri.fixed_hdr:
+    if ri.struct['request'].fixed_header:
         ri.cw.p("hdr_len = sizeof(req->_hdr);")
         ri.cw.p("hdr = ynl_nlmsg_put_extra_header(nlh, hdr_len);")
         ri.cw.p("memcpy(hdr, &req->_hdr, hdr_len);")
@@ -2471,8 +2480,8 @@ _C_KW = {
     if ri.needs_nlflags(direction):
         ri.cw.p('__u16 _nlmsg_flags;')
         ri.cw.nl()
-    if ri.fixed_hdr:
-        ri.cw.p(ri.fixed_hdr + ' _hdr;')
+    if struct.fixed_header:
+        ri.cw.p(struct.fixed_header + ' _hdr;')
         ri.cw.nl()
 
     for type_filter in ['present', 'len', 'count']:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 07/11] tools: ynl-gen: support local attrs in _multi_parse
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (5 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 06/11] tools: ynl-gen: move fixed header info from RenderInfo to Struct Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-18 13:50   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats Jakub Kicinski
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

The _multi_parse() helper calls the _attr_get() method of each attr,
but it only respects what code the helper wants to emit, not what
local variables it needs. Local variables will soon be needed,
support them.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/pyynl/ynl_gen_c.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index bd1fadb2cf5a..f2a4404d0d21 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -2214,12 +2214,16 @@ _C_KW = {
     parse_rsp_nested_prototype(ri, struct, suffix='')
 
     var = 'dst'
+    local_vars = {'const struct nlattr *attr = nested;',
+                  f'{struct.ptr_name}{var} = yarg->data;',
+                  'struct ynl_parse_arg parg;'}
+
+    for _, arg in struct.member_list():
+        _, _, l_vars = arg._attr_get(ri, var)
+        local_vars |= set(l_vars) if l_vars else set()
 
     ri.cw.block_start()
-    ri.cw.write_func_lvar(['const struct nlattr *attr = nested;',
-                          f'{struct.ptr_name}{var} = yarg->data;',
-                          'struct ynl_parse_arg parg;'])
-
+    ri.cw.write_func_lvar(list(local_vars))
     ri.cw.p('parg.ys = yarg->ys;')
     ri.cw.nl()
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (6 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 07/11] tools: ynl-gen: support local attrs in _multi_parse Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-19  9:25   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 09/11] tools: ynl: enable codegen for TC Jakub Kicinski
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

TC uses all possible sub-message formats:
 - nested attrs
 - fixed headers + nested attrs
 - fixed headers
 - empty

Nested attrs are already supported for rt-link. Add support
for remaining 3. The empty and fixed headers ones are fairly
trivial, we can fake a Binary or Flags type instead of a Nest.

For fixed headers + nest we need to teach nest parsing and
nest put to handle fixed headers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/lib/ynl-priv.h     |  8 +++--
 tools/net/ynl/pyynl/ynl_gen_c.py | 51 ++++++++++++++++++++++++--------
 2 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/tools/net/ynl/lib/ynl-priv.h b/tools/net/ynl/lib/ynl-priv.h
index 416866f85820..824777d7e05e 100644
--- a/tools/net/ynl/lib/ynl-priv.h
+++ b/tools/net/ynl/lib/ynl-priv.h
@@ -213,11 +213,15 @@ static inline void *ynl_attr_data_end(const struct nlattr *attr)
 				     NLMSG_HDRLEN + fixed_hdr_sz); attr; \
 	     (attr) = ynl_attr_next(ynl_nlmsg_end_addr(nlh), attr))
 
-#define ynl_attr_for_each_nested(attr, outer)				\
+#define ynl_attr_for_each_nested_off(attr, outer, offset)		\
 	for ((attr) = ynl_attr_first(outer, outer->nla_len,		\
-				     sizeof(struct nlattr)); attr;	\
+				     sizeof(struct nlattr) + offset);	\
+	     attr;							\
 	     (attr) = ynl_attr_next(ynl_attr_data_end(outer), attr))
 
+#define ynl_attr_for_each_nested(attr, outer)				\
+	ynl_attr_for_each_nested_off(attr, outer, 0)
+
 #define ynl_attr_for_each_payload(start, len, attr)			\
 	for ((attr) = ynl_attr_first(start, len, 0); attr;		\
 	     (attr) = ynl_attr_next(start + len, attr))
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index f2a4404d0d21..5abf7dd86f42 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -1372,12 +1372,25 @@ from lib import SpecSubMessage, SpecSubMessageFormat
 
         attrs = []
         for name, fmt in submsg.formats.items():
-            attrs.append({
+            attr = {
                 "name": name,
-                "type": "nest",
                 "parent-sub-message": spec,
-                "nested-attributes": fmt['attribute-set']
-            })
+            }
+            if 'attribute-set' in fmt:
+                attr |= {
+                    "type": "nest",
+                    "nested-attributes": fmt['attribute-set'],
+                }
+                if 'fixed-header' in fmt:
+                    attr |= { "fixed-header": fmt["fixed-header"] }
+            elif 'fixed-header' in fmt:
+                attr |= {
+                    "type": "binary",
+                    "struct": fmt["fixed-header"],
+                }
+            else:
+                attr["type"] = "flag"
+            attrs.append(attr)
 
         self.attr_sets[nested] = AttrSet(self, {
             "name": nested,
@@ -1921,8 +1934,11 @@ _C_KW = {
 
     i = 0
     for name, arg in struct.member_list():
-        cw.p('[%d] = { .type = YNL_PT_SUBMSG, .name = "%s", .nest = &%s_nest, },' %
-             (i, name, arg.nested_render_name))
+        nest = ""
+        if arg.type == 'nest':
+            nest = f" .nest = &{arg.nested_render_name}_nest,"
+        cw.p('[%d] = { .type = YNL_PT_SUBMSG, .name = "%s",%s },' %
+             (i, name, nest))
         i += 1
 
     cw.block_end(line=';')
@@ -2032,6 +2048,11 @@ _C_KW = {
     if struct.submsg is None:
         local_vars.append('struct nlattr *nest;')
         init_lines.append("nest = ynl_attr_nest_start(nlh, attr_type);")
+    if struct.fixed_header:
+        local_vars.append('void *hdr;')
+        struct_sz = f'sizeof({struct.fixed_header})'
+        init_lines.append(f"hdr = ynl_nlmsg_put_extra_header(nlh, {struct_sz});")
+        init_lines.append(f"memcpy(hdr, &obj->_hdr, {struct_sz});")
 
     has_anest = False
     has_count = False
@@ -2063,11 +2084,14 @@ _C_KW = {
 
 
 def _multi_parse(ri, struct, init_lines, local_vars):
+    if struct.fixed_header:
+        local_vars += ['void *hdr;']
     if struct.nested:
-        iter_line = "ynl_attr_for_each_nested(attr, nested)"
-    else:
         if struct.fixed_header:
-            local_vars += ['void *hdr;']
+            iter_line = f"ynl_attr_for_each_nested_off(attr, nested, sizeof({struct.fixed_header}))"
+        else:
+            iter_line = "ynl_attr_for_each_nested(attr, nested)"
+    else:
         iter_line = "ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len)"
         if ri.op.fixed_header != ri.family.fixed_header:
             if ri.family.is_classic():
@@ -2114,7 +2138,9 @@ _C_KW = {
         ri.cw.p(f'dst->{arg} = {arg};')
 
     if struct.fixed_header:
-        if ri.family.is_classic():
+        if struct.nested:
+            ri.cw.p('hdr = ynl_attr_data(nested);')
+        elif ri.family.is_classic():
             ri.cw.p('hdr = ynl_nlmsg_data(nlh);')
         else:
             ri.cw.p('hdr = ynl_nlmsg_data_offset(nlh, sizeof(struct genlmsghdr));')
@@ -2234,8 +2260,9 @@ _C_KW = {
 
         ri.cw.block_start(line=f'{kw} (!strcmp(sel, "{name}"))')
         get_lines, init_lines, _ = arg._attr_get(ri, var)
-        for line in init_lines:
-            ri.cw.p(line)
+        if init_lines:
+            for line in init_lines:
+                ri.cw.p(line)
         for line in get_lines:
             ri.cw.p(line)
         if arg.presence_type() == 'present':
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 09/11] tools: ynl: enable codegen for TC
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (7 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-19  9:26   ` Donald Hunter
  2025-05-20  8:27   ` Kory Maincent
  2025-05-17  0:13 ` [PATCH net-next 10/11] netlink: specs: tc: add qdisc dump to TC spec Jakub Kicinski
  2025-05-17  0:13 ` [PATCH net-next 11/11] tools: ynl: add a sample for TC Jakub Kicinski
  10 siblings, 2 replies; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

We are ready to support most of TC. Enable C code gen.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/Makefile.deps      | 2 ++
 tools/net/ynl/generated/Makefile | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps
index e5a5cb1b2cff..4e5c4dff9188 100644
--- a/tools/net/ynl/Makefile.deps
+++ b/tools/net/ynl/Makefile.deps
@@ -38,4 +38,6 @@ CFLAGS_rt-link:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \
 CFLAGS_rt-neigh:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h)
 CFLAGS_rt-route:=$(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h)
 CFLAGS_rt-rule:=$(call get_hdr_inc,__LINUX_FIB_RULES_H,fib_rules.h)
+CFLAGS_tc:=$(call get_hdr_inc,__LINUX_PKT_SCHED_H,pkt_sched.h) \
+	$(call get_hdr_inc,__LINUX_PKT_CLS_H,pkt_cls.h)
 CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h)
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index 9208feed28c1..86e1e4a959a7 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -23,7 +23,7 @@ TOOL_RST:=../pyynl/ynl_gen_rst.py
 
 SPECS_DIR:=../../../../Documentation/netlink/specs
 SPECS_PATHS=$(wildcard $(SPECS_DIR)/*.yaml)
-GENS_UNSUP=conntrack nftables tc
+GENS_UNSUP=conntrack nftables
 GENS=$(filter-out ${GENS_UNSUP},$(patsubst $(SPECS_DIR)/%.yaml,%,${SPECS_PATHS}))
 SRCS=$(patsubst %,%-user.c,${GENS})
 HDRS=$(patsubst %,%-user.h,${GENS})
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 10/11] netlink: specs: tc: add qdisc dump to TC spec
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (8 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 09/11] tools: ynl: enable codegen for TC Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-19  9:27   ` Donald Hunter
  2025-05-17  0:13 ` [PATCH net-next 11/11] tools: ynl: add a sample for TC Jakub Kicinski
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

Hook TC qdisc dump in the TC qdisc get, it only supported doit
until now and dumping will be used by the sample code.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 Documentation/netlink/specs/tc.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/netlink/specs/tc.yaml b/Documentation/netlink/specs/tc.yaml
index 6e8db7adde3c..cb7ea7d62e56 100644
--- a/Documentation/netlink/specs/tc.yaml
+++ b/Documentation/netlink/specs/tc.yaml
@@ -3929,7 +3929,7 @@ protonum: 0
       doc: Get / dump tc qdisc information.
       attribute-set: attrs
       fixed-header: tcmsg
-      do:
+      do: &getqdisc-do
         request:
           value: 38
           attributes:
@@ -3948,6 +3948,7 @@ protonum: 0
             - chain
             - ingress-block
             - egress-block
+      dump: *getqdisc-do
     -
       name: newtclass
       doc: Get / dump tc traffic class information.
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH net-next 11/11] tools: ynl: add a sample for TC
  2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
                   ` (9 preceding siblings ...)
  2025-05-17  0:13 ` [PATCH net-next 10/11] netlink: specs: tc: add qdisc dump to TC spec Jakub Kicinski
@ 2025-05-17  0:13 ` Jakub Kicinski
  2025-05-19 10:19   ` Donald Hunter
  10 siblings, 1 reply; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-17  0:13 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, donald.hunter,
	jacob.e.keller, sdf, jstancek, Jakub Kicinski

Add a very simple TC dump sample with decoding of fq_codel attrs:

  # ./tools/net/ynl/samples/tc
        dummy0: fq_codel  limit: 10240p target: 5ms new_flow_cnt: 0

proving that selector passing (for stats) works.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/samples/tc.c       | 80 ++++++++++++++++++++++++++++++++
 tools/net/ynl/samples/.gitignore |  1 +
 2 files changed, 81 insertions(+)
 create mode 100644 tools/net/ynl/samples/tc.c

diff --git a/tools/net/ynl/samples/tc.c b/tools/net/ynl/samples/tc.c
new file mode 100644
index 000000000000..0bfff0fdd792
--- /dev/null
+++ b/tools/net/ynl/samples/tc.c
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <string.h>
+
+#include <ynl.h>
+
+#include <net/if.h>
+
+#include "tc-user.h"
+
+static void tc_qdisc_print(struct tc_getqdisc_rsp *q)
+{
+	char ifname[IF_NAMESIZE];
+	const char *name;
+
+	name = if_indextoname(q->_hdr.tcm_ifindex, ifname);
+	if (name)
+		printf("%16s: ", name);
+
+	if (q->_len.kind) {
+		printf("%s  ", q->kind);
+
+		if (q->options._present.fq_codel) {
+			struct tc_fq_codel_attrs *fq_codel;
+			struct tc_fq_codel_xstats *stats;
+
+			fq_codel = &q->options.fq_codel;
+			stats = q->stats2.app.fq_codel;
+
+			if (fq_codel->_present.limit)
+				printf("limit: %dp ", fq_codel->limit);
+			if (fq_codel->_present.target)
+				printf("target: %dms ",
+				       (fq_codel->target + 500) / 1000);
+			if (q->stats2.app._len.fq_codel)
+				printf("new_flow_cnt: %d ",
+				       stats->qdisc_stats.new_flow_count);
+		}
+	}
+
+	printf("\n");
+}
+
+int main(int argc, char **argv)
+{
+	struct tc_getqdisc_req_dump *req;
+	struct tc_getqdisc_list *rsp;
+	struct ynl_error yerr;
+	struct ynl_sock *ys;
+
+	ys = ynl_sock_create(&ynl_tc_family, &yerr);
+	if (!ys) {
+		fprintf(stderr, "YNL: %s\n", yerr.msg);
+		return 1;
+	}
+
+	req = tc_getqdisc_req_dump_alloc();
+	if (!req)
+		goto err_destroy;
+
+	rsp = tc_getqdisc_dump(ys, req);
+	tc_getqdisc_req_dump_free(req);
+	if (!rsp)
+		goto err_close;
+
+	if (ynl_dump_empty(rsp))
+		fprintf(stderr, "Error: no addresses reported\n");
+	ynl_dump_foreach(rsp, qdisc)
+		tc_qdisc_print(qdisc);
+	tc_getqdisc_list_free(rsp);
+
+	ynl_sock_destroy(ys);
+	return 0;
+
+err_close:
+	fprintf(stderr, "YNL: %s\n", ys->err.msg);
+err_destroy:
+	ynl_sock_destroy(ys);
+	return 2;
+}
diff --git a/tools/net/ynl/samples/.gitignore b/tools/net/ynl/samples/.gitignore
index b3ec3fb0929f..7f5fca7682d7 100644
--- a/tools/net/ynl/samples/.gitignore
+++ b/tools/net/ynl/samples/.gitignore
@@ -6,3 +6,4 @@ page-pool
 rt-addr
 rt-link
 rt-route
+tc
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests
  2025-05-17  0:13 ` [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests Jakub Kicinski
@ 2025-05-18 13:34   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:34 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> tc-act-stats-attrs and tca-stats-attrs are almost identical.
> The only difference is that the latter has sub-message decoding
> for app, rather than declaring it as a binary attr.
>
> tc-act-police-attrs and tc-police-attrs are identical but for
> the TODO annotations.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 02/11] netlink: specs: tc: use tc-gact instead of tc-gen as struct name
  2025-05-17  0:13 ` [PATCH net-next 02/11] netlink: specs: tc: use tc-gact instead of tc-gen as struct name Jakub Kicinski
@ 2025-05-18 13:35   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:35 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> There is a define in the uAPI header called tc_gen which expands
> to the "generic" TC action fields. This helps other actions include
> the base fields without having to deal with nested structs.
>
> A couple of actions (sample, gact) do not define extra fields,
> so the spec used a common tc-gen struct for both of them.
> Unfortunately this struct does not exist in C. Let's use gact's
> (generic act's) struct for basic actions.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 03/11] netlink: specs: tc: add C naming info
  2025-05-17  0:13 ` [PATCH net-next 03/11] netlink: specs: tc: add C naming info Jakub Kicinski
@ 2025-05-18 13:36   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:36 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> Add naming info needed by C code gen.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 04/11] netlink: specs: tc: drop the family name prefix from attrs
  2025-05-17  0:13 ` [PATCH net-next 04/11] netlink: specs: tc: drop the family name prefix from attrs Jakub Kicinski
@ 2025-05-18 13:37   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:37 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> All attribute sets and messages are prefixed with tc-.
> The C codegen also adds the family name to all structs.
> We end up with names like struct tc_tc_act_attrs.
> Remove the tc- prefixes to shorten the names.
> This should not impact Python as the attr set names
> are never exposed to user, they are only used to refer
> to things internally, in the encoder / decoder.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 05/11] tools: ynl-gen: support passing selector to a nest
  2025-05-17  0:13 ` [PATCH net-next 05/11] tools: ynl-gen: support passing selector to a nest Jakub Kicinski
@ 2025-05-18 13:46   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:46 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> In rtnetlink all submessages had the selector at the same level
> of nesting as the submessage. We could refer to the relevant
> attribute from the current struct. In TC, stats are one level
> of nesting deeper than "kind". Teach the code-gen about structs
> which need to be passed a selector by the caller for parsing.
>
> Because structs are "topologically sorted" one pass of propagating
> the selectors down is enough.
>
> For generating netlink message we depend on the presence bits
> so no selector passing needed there.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 06/11] tools: ynl-gen: move fixed header info from RenderInfo to Struct
  2025-05-17  0:13 ` [PATCH net-next 06/11] tools: ynl-gen: move fixed header info from RenderInfo to Struct Jakub Kicinski
@ 2025-05-18 13:49   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:49 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> RenderInfo describes a request-response exchange. Struct describes
> a parsed attribute set. For ease of parsing sub-messages with
> fixed headers move fixed header info from RenderInfo to Struct.
> No functional changes.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 07/11] tools: ynl-gen: support local attrs in _multi_parse
  2025-05-17  0:13 ` [PATCH net-next 07/11] tools: ynl-gen: support local attrs in _multi_parse Jakub Kicinski
@ 2025-05-18 13:50   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-18 13:50 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> The _multi_parse() helper calls the _attr_get() method of each attr,
> but it only respects what code the helper wants to emit, not what
> local variables it needs. Local variables will soon be needed,
> support them.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats
  2025-05-17  0:13 ` [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats Jakub Kicinski
@ 2025-05-19  9:25   ` Donald Hunter
  2025-05-20  3:07     ` Jakub Kicinski
  0 siblings, 1 reply; 25+ messages in thread
From: Donald Hunter @ 2025-05-19  9:25 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> TC uses all possible sub-message formats:
>  - nested attrs
>  - fixed headers + nested attrs
>  - fixed headers
>  - empty
>
> Nested attrs are already supported for rt-link. Add support
> for remaining 3. The empty and fixed headers ones are fairly
> trivial, we can fake a Binary or Flags type instead of a Nest.
>
> For fixed headers + nest we need to teach nest parsing and
> nest put to handle fixed headers.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  tools/net/ynl/lib/ynl-priv.h     |  8 +++--
>  tools/net/ynl/pyynl/ynl_gen_c.py | 51 ++++++++++++++++++++++++--------
>  2 files changed, 45 insertions(+), 14 deletions(-)
>
> diff --git a/tools/net/ynl/lib/ynl-priv.h b/tools/net/ynl/lib/ynl-priv.h
> index 416866f85820..824777d7e05e 100644
> --- a/tools/net/ynl/lib/ynl-priv.h
> +++ b/tools/net/ynl/lib/ynl-priv.h
> @@ -213,11 +213,15 @@ static inline void *ynl_attr_data_end(const struct nlattr *attr)
>  				     NLMSG_HDRLEN + fixed_hdr_sz); attr; \
>  	     (attr) = ynl_attr_next(ynl_nlmsg_end_addr(nlh), attr))
>  
> -#define ynl_attr_for_each_nested(attr, outer)				\
> +#define ynl_attr_for_each_nested_off(attr, outer, offset)		\
>  	for ((attr) = ynl_attr_first(outer, outer->nla_len,		\
> -				     sizeof(struct nlattr)); attr;	\
> +				     sizeof(struct nlattr) + offset);	\
> +	     attr;							\
>  	     (attr) = ynl_attr_next(ynl_attr_data_end(outer), attr))
>  
> +#define ynl_attr_for_each_nested(attr, outer)				\
> +	ynl_attr_for_each_nested_off(attr, outer, 0)
> +
>  #define ynl_attr_for_each_payload(start, len, attr)			\
>  	for ((attr) = ynl_attr_first(start, len, 0); attr;		\
>  	     (attr) = ynl_attr_next(start + len, attr))
> diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
> index f2a4404d0d21..5abf7dd86f42 100755
> --- a/tools/net/ynl/pyynl/ynl_gen_c.py
> +++ b/tools/net/ynl/pyynl/ynl_gen_c.py
> @@ -1372,12 +1372,25 @@ from lib import SpecSubMessage, SpecSubMessageFormat
>  
>          attrs = []
>          for name, fmt in submsg.formats.items():
> -            attrs.append({
> +            attr = {
>                  "name": name,
> -                "type": "nest",
>                  "parent-sub-message": spec,
> -                "nested-attributes": fmt['attribute-set']
> -            })
> +            }
> +            if 'attribute-set' in fmt:
> +                attr |= {
> +                    "type": "nest",
> +                    "nested-attributes": fmt['attribute-set'],
> +                }
> +                if 'fixed-header' in fmt:
> +                    attr |= { "fixed-header": fmt["fixed-header"] }
> +            elif 'fixed-header' in fmt:
> +                attr |= {
> +                    "type": "binary",
> +                    "struct": fmt["fixed-header"],
> +                }
> +            else:
> +                attr["type"] = "flag"
> +            attrs.append(attr)
>  
>          self.attr_sets[nested] = AttrSet(self, {
>              "name": nested,
> @@ -1921,8 +1934,11 @@ _C_KW = {
>  
>      i = 0
>      for name, arg in struct.member_list():
> -        cw.p('[%d] = { .type = YNL_PT_SUBMSG, .name = "%s", .nest = &%s_nest, },' %
> -             (i, name, arg.nested_render_name))
> +        nest = ""
> +        if arg.type == 'nest':
> +            nest = f" .nest = &{arg.nested_render_name}_nest,"
> +        cw.p('[%d] = { .type = YNL_PT_SUBMSG, .name = "%s",%s },' %
> +             (i, name, nest))
>          i += 1
>  
>      cw.block_end(line=';')
> @@ -2032,6 +2048,11 @@ _C_KW = {
>      if struct.submsg is None:
>          local_vars.append('struct nlattr *nest;')
>          init_lines.append("nest = ynl_attr_nest_start(nlh, attr_type);")
> +    if struct.fixed_header:
> +        local_vars.append('void *hdr;')
> +        struct_sz = f'sizeof({struct.fixed_header})'
> +        init_lines.append(f"hdr = ynl_nlmsg_put_extra_header(nlh, {struct_sz});")
> +        init_lines.append(f"memcpy(hdr, &obj->_hdr, {struct_sz});")
>  
>      has_anest = False
>      has_count = False
> @@ -2063,11 +2084,14 @@ _C_KW = {
>  
>  
>  def _multi_parse(ri, struct, init_lines, local_vars):
> +    if struct.fixed_header:
> +        local_vars += ['void *hdr;']
>      if struct.nested:
> -        iter_line = "ynl_attr_for_each_nested(attr, nested)"
> -    else:
>          if struct.fixed_header:
> -            local_vars += ['void *hdr;']
> +            iter_line = f"ynl_attr_for_each_nested_off(attr, nested, sizeof({struct.fixed_header}))"
> +        else:
> +            iter_line = "ynl_attr_for_each_nested(attr, nested)"
> +    else:
>          iter_line = "ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len)"
>          if ri.op.fixed_header != ri.family.fixed_header:
>              if ri.family.is_classic():
> @@ -2114,7 +2138,9 @@ _C_KW = {
>          ri.cw.p(f'dst->{arg} = {arg};')
>  
>      if struct.fixed_header:
> -        if ri.family.is_classic():
> +        if struct.nested:
> +            ri.cw.p('hdr = ynl_attr_data(nested);')
> +        elif ri.family.is_classic():
>              ri.cw.p('hdr = ynl_nlmsg_data(nlh);')
>          else:
>              ri.cw.p('hdr = ynl_nlmsg_data_offset(nlh, sizeof(struct genlmsghdr));')
> @@ -2234,8 +2260,9 @@ _C_KW = {
>  
>          ri.cw.block_start(line=f'{kw} (!strcmp(sel, "{name}"))')
>          get_lines, init_lines, _ = arg._attr_get(ri, var)
> -        for line in init_lines:
> -            ri.cw.p(line)
> +        if init_lines:
> +            for line in init_lines:

I have a tiny preference for this construction, to eliminate the if
statement. WDYT?

           for line in init_lines or []:

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

> +                ri.cw.p(line)
>          for line in get_lines:
>              ri.cw.p(line)
>          if arg.presence_type() == 'present':

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 09/11] tools: ynl: enable codegen for TC
  2025-05-17  0:13 ` [PATCH net-next 09/11] tools: ynl: enable codegen for TC Jakub Kicinski
@ 2025-05-19  9:26   ` Donald Hunter
  2025-05-20  8:27   ` Kory Maincent
  1 sibling, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-19  9:26 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> We are ready to support most of TC. Enable C code gen.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 10/11] netlink: specs: tc: add qdisc dump to TC spec
  2025-05-17  0:13 ` [PATCH net-next 10/11] netlink: specs: tc: add qdisc dump to TC spec Jakub Kicinski
@ 2025-05-19  9:27   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-19  9:27 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> Hook TC qdisc dump in the TC qdisc get, it only supported doit
> until now and dumping will be used by the sample code.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 11/11] tools: ynl: add a sample for TC
  2025-05-17  0:13 ` [PATCH net-next 11/11] tools: ynl: add a sample for TC Jakub Kicinski
@ 2025-05-19 10:19   ` Donald Hunter
  0 siblings, 0 replies; 25+ messages in thread
From: Donald Hunter @ 2025-05-19 10:19 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

Jakub Kicinski <kuba@kernel.org> writes:

> Add a very simple TC dump sample with decoding of fq_codel attrs:
>
>   # ./tools/net/ynl/samples/tc
>         dummy0: fq_codel  limit: 10240p target: 5ms new_flow_cnt: 0
>
> proving that selector passing (for stats) works.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats
  2025-05-19  9:25   ` Donald Hunter
@ 2025-05-20  3:07     ` Jakub Kicinski
  0 siblings, 0 replies; 25+ messages in thread
From: Jakub Kicinski @ 2025-05-20  3:07 UTC (permalink / raw)
  To: Donald Hunter
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	jacob.e.keller, sdf, jstancek

On Mon, 19 May 2025 10:25:37 +0100 Donald Hunter wrote:
> > @@ -2234,8 +2260,9 @@ _C_KW = {
> >  
> >          ri.cw.block_start(line=f'{kw} (!strcmp(sel, "{name}"))')
> >          get_lines, init_lines, _ = arg._attr_get(ri, var)
> > -        for line in init_lines:
> > -            ri.cw.p(line)
> > +        if init_lines:
> > +            for line in init_lines:  
> 
> I have a tiny preference for this construction, to eliminate the if
> statement. WDYT?
> 
>            for line in init_lines or []:

Sure thing, the if was annoying me, too

Will post v2 tomorrow morning, thanks for the reviews!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH net-next 09/11] tools: ynl: enable codegen for TC
  2025-05-17  0:13 ` [PATCH net-next 09/11] tools: ynl: enable codegen for TC Jakub Kicinski
  2025-05-19  9:26   ` Donald Hunter
@ 2025-05-20  8:27   ` Kory Maincent
  1 sibling, 0 replies; 25+ messages in thread
From: Kory Maincent @ 2025-05-20  8:27 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	donald.hunter, jacob.e.keller, sdf, jstancek

On Fri, 16 May 2025 17:13:16 -0700
Jakub Kicinski <kuba@kernel.org> wrote:

> We are ready to support most of TC. Enable C code gen.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

This patch brings spec build error:
$ make -C tools/net/ynl -j9
...
-e 	CC tc-user.o
In file included from <command-line>:
./../../../../include/uapi//linux/pkt_cls.h:250:9: error: expected specifier-qualifier-list before ‘__struct_group’
  250 |         __struct_group(tc_u32_sel_hdr, hdr, /* no attrs */,
      |         ^~~~~~~~~~~~~~
tc-user.c:560:10: error: ‘TCA_CT_HELPER_NAME’ undeclared here (not in a function); did you mean ‘TCA_ACT_BPF_NAME’?
  560 |         [TCA_CT_HELPER_NAME] = { .name = "helper-name", .type = YNL_PT_NUL_STR, },
      |          ^~~~~~~~~~~~~~~~~~
      |          TCA_ACT_BPF_NAME
tc-user.c:560:10: error: array index in initializer not of integer type
tc-user.c:560:10: note: (near initialization for ‘tc_act_ct_attrs_policy’)
tc-user.c:560:32: warning: excess elements in array initializer
  560 |         [TCA_CT_HELPER_NAME] = { .name = "helper-name", .type = YNL_PT_NUL_STR, },
      |                                ^
tc-user.c:560:32: note: (near initialization for ‘tc_act_ct_attrs_policy’)
tc-user.c:561:10: error: ‘TCA_CT_HELPER_FAMILY’ undeclared here (not in a function)
  561 |         [TCA_CT_HELPER_FAMILY] = { .name = "helper-family", .type = YNL_PT_U8, },
      |          ^~~~~~~~~~~~~~~~~~~~
tc-user.c:561:10: error: array index in initializer not of integer type
tc-user.c:561:10: note: (near initialization for ‘tc_act_ct_attrs_policy’)
tc-user.c:561:34: warning: excess elements in array initializer
  561 |         [TCA_CT_HELPER_FAMILY] = { .name = "helper-family", .type = YNL_PT_U8, },
      |                                  ^
tc-user.c:561:34: note: (near initialization for ‘tc_act_ct_attrs_policy’)
tc-user.c:562:10: error: ‘TCA_CT_HELPER_PROTO’ undeclared here (not in a function)
  562 |         [TCA_CT_HELPER_PROTO] = { .name = "helper-proto", .type = YNL_PT_U8, },
      |          ^~~~~~~~~~~~~~~~~~~
tc-user.c:562:10: error: array index in initializer not of integer type
tc-user.c:562:10: note: (near initialization for ‘tc_act_ct_attrs_policy’)
tc-user.c:562:33: warning: excess elements in array initializer
  562 |         [TCA_CT_HELPER_PROTO] = { .name = "helper-proto", .type = YNL_PT_U8, },
      |                                 ^
tc-user.c:562:33: note: (near initialization for ‘tc_act_ct_attrs_policy’)
tc-user.c:637:10: error: ‘TCA_MIRRED_BLOCKID’ undeclared here (not in a function); did you mean ‘TCA_MIRRED_PAD’?
  637 |         [TCA_MIRRED_BLOCKID] = { .name = "blockid", .type = YNL_PT_BINARY,},
      |          ^~~~~~~~~~~~~~~~~~
      |          TCA_MIRRED_PAD
tc-user.c:637:10: error: array index in initializer not of integer type
tc-user.c:637:10: note: (near initialization for ‘tc_act_mirred_attrs_policy’)
tc-user.c:637:32: warning: excess elements in array initializer
  637 |         [TCA_MIRRED_BLOCKID] = { .name = "blockid", .type = YNL_PT_BINARY,},
      |                                ^
tc-user.c:637:32: note: (near initialization for ‘tc_act_mirred_attrs_policy’)
tc-user.c:722:10: error: ‘TCA_SKBEDIT_QUEUE_MAPPING_MAX’ undeclared here (not in a function); did you mean ‘TCA_SKBEDIT_QUEUE_MAPPING’?
  722 |         [TCA_SKBEDIT_QUEUE_MAPPING_MAX] = { .name = "queue-mapping-max", .type = YNL_PT_U16, },
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |          TCA_SKBEDIT_QUEUE_MAPPING
tc-user.c:722:10: error: array index in initializer not of integer type
tc-user.c:722:10: note: (near initialization for ‘tc_act_skbedit_attrs_policy’)
tc-user.c:722:43: warning: excess elements in array initializer
  722 |         [TCA_SKBEDIT_QUEUE_MAPPING_MAX] = { .name = "queue-mapping-max", .type = YNL_PT_U16, },
      |                                           ^
tc-user.c:722:43: note: (near initialization for ‘tc_act_skbedit_attrs_policy’)
tc-user.c:758:10: error: ‘TCA_TUNNEL_KEY_NO_FRAG’ undeclared here (not in a function); did you mean ‘TCA_TUNNEL_KEY_NO_CSUM’?
  758 |         [TCA_TUNNEL_KEY_NO_FRAG] = { .name = "no-frag", .type = YNL_PT_FLAG, },
      |          ^~~~~~~~~~~~~~~~~~~~~~
      |          TCA_TUNNEL_KEY_NO_CSUM
tc-user.c:758:10: error: array index in initializer not of integer type
tc-user.c:758:10: note: (near initialization for ‘tc_act_tunnel_key_attrs_policy’)
tc-user.c:758:36: warning: excess elements in array initializer
  758 |         [TCA_TUNNEL_KEY_NO_FRAG] = { .name = "no-frag", .type = YNL_PT_FLAG, },
      |                                    ^
tc-user.c:758:36: note: (near initialization for ‘tc_act_tunnel_key_attrs_policy’)
tc-user.c:1295:10: error: ‘TCA_EXT_WARN_MSG’ undeclared here (not in a function); did you mean ‘TCA_NAT_PARMS’?
 1295 |         [TCA_EXT_WARN_MSG] = { .name = "ext-warn-msg", .type = YNL_PT_NUL_STR, },
      |          ^~~~~~~~~~~~~~~~
      |          TCA_NAT_PARMS
tc-user.c:1295:10: error: array index in initializer not of integer type
tc-user.c:1295:10: note: (near initialization for ‘tc_attrs_policy’)
tc-user.c:1295:30: warning: excess elements in array initializer
 1295 |         [TCA_EXT_WARN_MSG] = { .name = "ext-warn-msg", .type = YNL_PT_NUL_STR, },
      |                              ^
tc-user.c:1295:30: note: (near initialization for ‘tc_attrs_policy’)
tc-user.c: In function ‘tc_u32_attrs_parse’:
tc-user.c:9086:33: warning: comparison is always false due to limited range of data type [-Wtype-limits]
 9086 |                         if (len < sizeof(struct tc_u32_sel))
      |                                 ^
make[1]: *** [Makefile:52: tc-user.o] Error 1

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2025-05-20  8:27 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17  0:13 [PATCH net-next 00/11] tools: ynl-gen: add support for "inherited" selector and therefore TC Jakub Kicinski
2025-05-17  0:13 ` [PATCH net-next 01/11] netlink: specs: tc: remove duplicate nests Jakub Kicinski
2025-05-18 13:34   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 02/11] netlink: specs: tc: use tc-gact instead of tc-gen as struct name Jakub Kicinski
2025-05-18 13:35   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 03/11] netlink: specs: tc: add C naming info Jakub Kicinski
2025-05-18 13:36   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 04/11] netlink: specs: tc: drop the family name prefix from attrs Jakub Kicinski
2025-05-18 13:37   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 05/11] tools: ynl-gen: support passing selector to a nest Jakub Kicinski
2025-05-18 13:46   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 06/11] tools: ynl-gen: move fixed header info from RenderInfo to Struct Jakub Kicinski
2025-05-18 13:49   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 07/11] tools: ynl-gen: support local attrs in _multi_parse Jakub Kicinski
2025-05-18 13:50   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 08/11] tools: ynl-gen: support weird sub-message formats Jakub Kicinski
2025-05-19  9:25   ` Donald Hunter
2025-05-20  3:07     ` Jakub Kicinski
2025-05-17  0:13 ` [PATCH net-next 09/11] tools: ynl: enable codegen for TC Jakub Kicinski
2025-05-19  9:26   ` Donald Hunter
2025-05-20  8:27   ` Kory Maincent
2025-05-17  0:13 ` [PATCH net-next 10/11] netlink: specs: tc: add qdisc dump to TC spec Jakub Kicinski
2025-05-19  9:27   ` Donald Hunter
2025-05-17  0:13 ` [PATCH net-next 11/11] tools: ynl: add a sample for TC Jakub Kicinski
2025-05-19 10:19   ` Donald Hunter

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).