All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets
@ 2023-10-06 11:44 Jiri Pirko
  2023-10-06 11:44 ` [patch net-next v3 1/2] " Jiri Pirko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jiri Pirko @ 2023-10-06 11:44 UTC (permalink / raw)
  To: netdev; +Cc: kuba, pabeni, davem, edumazet, donald.hunter

From: Jiri Pirko <jiri@nvidia.com>

Remove the requirement from schema files to specify the "type" for
attribute subsets and adjust existing schema files.

Jiri Pirko (2):
  tools: ynl-gen: lift type requirement for attribute subsets
  netlink: specs: remove redundant type keys from attributes in subsets

 Documentation/netlink/genetlink-c.yaml      | 14 +++++++++++++-
 Documentation/netlink/genetlink-legacy.yaml | 14 +++++++++++++-
 Documentation/netlink/genetlink.yaml        | 14 +++++++++++++-
 Documentation/netlink/netlink-raw.yaml      | 14 +++++++++++++-
 Documentation/netlink/specs/devlink.yaml    | 10 ----------
 Documentation/netlink/specs/dpll.yaml       |  8 --------
 Documentation/netlink/specs/ethtool.yaml    |  3 ---
 7 files changed, 52 insertions(+), 25 deletions(-)

-- 
2.41.0


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

* [patch net-next v3 1/2] tools: ynl-gen: lift type requirement for attribute subsets
  2023-10-06 11:44 [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets Jiri Pirko
@ 2023-10-06 11:44 ` Jiri Pirko
  2023-10-06 15:00   ` Jakub Kicinski
  2023-10-06 11:44 ` [patch net-next v3 2/2] netlink: specs: remove redundant type keys from attributes in subsets Jiri Pirko
  2023-10-10  2:50 ` [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets patchwork-bot+netdevbpf
  2 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2023-10-06 11:44 UTC (permalink / raw)
  To: netdev; +Cc: kuba, pabeni, davem, edumazet, donald.hunter

From: Jiri Pirko <jiri@nvidia.com>

In case an attribute is used in a subset, the type has to be currently
specified. As the attribute is already defined in the original set, this
is a redundant information in yaml file, moreover, may lead to
inconsistencies.

Example:
attribute-sets:
    ...
    name: pin
    enum-name: dpll_a_pin
    attributes:
      ...
      -
        name: parent-id
        type: u32
      ...
  -
    name: pin-parent-device
    subset-of: pin
    attributes:
      -
        name: parent-id
        type: u32             <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Remove the requirement from schema files to specify the "type" for
attribute subsets.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
v2->v3:
- handled in schema instead of py file
---
 Documentation/netlink/genetlink-c.yaml      | 14 +++++++++++++-
 Documentation/netlink/genetlink-legacy.yaml | 14 +++++++++++++-
 Documentation/netlink/genetlink.yaml        | 14 +++++++++++++-
 Documentation/netlink/netlink-raw.yaml      | 14 +++++++++++++-
 4 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/Documentation/netlink/genetlink-c.yaml b/Documentation/netlink/genetlink-c.yaml
index 9806c44f604c..32736b2d8ae8 100644
--- a/Documentation/netlink/genetlink-c.yaml
+++ b/Documentation/netlink/genetlink-c.yaml
@@ -142,7 +142,7 @@ properties:
           type: array
           items:
             type: object
-            required: [ name, type ]
+            required: [ name ]
             additionalProperties: False
             properties:
               name:
@@ -215,6 +215,18 @@ properties:
           not:
             required: [ name-prefix ]
 
+      # type property is only required if not in subset definition
+      if:
+        properties:
+          subset-of:
+            not:
+              type: string
+      then:
+        properties:
+          attributes:
+            items:
+              required: [ type ]
+
   operations:
     description: Operations supported by the protocol.
     type: object
diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
index 12a0a045605d..25fe1379b180 100644
--- a/Documentation/netlink/genetlink-legacy.yaml
+++ b/Documentation/netlink/genetlink-legacy.yaml
@@ -180,7 +180,7 @@ properties:
           type: array
           items:
             type: object
-            required: [ name, type ]
+            required: [ name ]
             additionalProperties: False
             properties:
               name:
@@ -254,6 +254,18 @@ properties:
           not:
             required: [ name-prefix ]
 
+      # type property is only required if not in subset definition
+      if:
+        properties:
+          subset-of:
+            not:
+              type: string
+      then:
+        properties:
+          attributes:
+            items:
+              required: [ type ]
+
   operations:
     description: Operations supported by the protocol.
     type: object
diff --git a/Documentation/netlink/genetlink.yaml b/Documentation/netlink/genetlink.yaml
index 3d338c48bf21..6ea1c947ce51 100644
--- a/Documentation/netlink/genetlink.yaml
+++ b/Documentation/netlink/genetlink.yaml
@@ -115,7 +115,7 @@ properties:
           type: array
           items:
             type: object
-            required: [ name, type ]
+            required: [ name ]
             additionalProperties: False
             properties:
               name:
@@ -184,6 +184,18 @@ properties:
           not:
             required: [ name-prefix ]
 
+      # type property is only required if not in subset definition
+      if:
+        properties:
+          subset-of:
+            not:
+              type: string
+      then:
+        properties:
+          attributes:
+            items:
+              required: [ type ]
+
   operations:
     description: Operations supported by the protocol.
     type: object
diff --git a/Documentation/netlink/netlink-raw.yaml b/Documentation/netlink/netlink-raw.yaml
index 896797876414..d976851b80f8 100644
--- a/Documentation/netlink/netlink-raw.yaml
+++ b/Documentation/netlink/netlink-raw.yaml
@@ -187,7 +187,7 @@ properties:
           type: array
           items:
             type: object
-            required: [ name, type ]
+            required: [ name ]
             additionalProperties: False
             properties:
               name:
@@ -261,6 +261,18 @@ properties:
           not:
             required: [ name-prefix ]
 
+      # type property is only required if not in subset definition
+      if:
+        properties:
+          subset-of:
+            not:
+              type: string
+      then:
+        properties:
+          attributes:
+            items:
+              required: [ type ]
+
   operations:
     description: Operations supported by the protocol.
     type: object
-- 
2.41.0


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

* [patch net-next v3 2/2] netlink: specs: remove redundant type keys from attributes in subsets
  2023-10-06 11:44 [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets Jiri Pirko
  2023-10-06 11:44 ` [patch net-next v3 1/2] " Jiri Pirko
@ 2023-10-06 11:44 ` Jiri Pirko
  2023-10-10  2:50 ` [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: Jiri Pirko @ 2023-10-06 11:44 UTC (permalink / raw)
  To: netdev; +Cc: kuba, pabeni, davem, edumazet, donald.hunter

From: Jiri Pirko <jiri@nvidia.com>

No longer needed to define type for subset attributes. Remove those.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
---
v1->v2:
- new patch
---
 Documentation/netlink/specs/devlink.yaml | 10 ----------
 Documentation/netlink/specs/dpll.yaml    |  8 --------
 Documentation/netlink/specs/ethtool.yaml |  3 ---
 3 files changed, 21 deletions(-)

diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
index d1ebcd927149..86a12c5bcff1 100644
--- a/Documentation/netlink/specs/devlink.yaml
+++ b/Documentation/netlink/specs/devlink.yaml
@@ -199,54 +199,44 @@ attribute-sets:
     attributes:
       -
         name: reload-stats
-        type: nest
       -
         name: remote-reload-stats
-        type: nest
   -
     name: dl-reload-stats
     subset-of: devlink
     attributes:
       -
         name: reload-action-info
-        type: nest
   -
     name: dl-reload-act-info
     subset-of: devlink
     attributes:
       -
         name: reload-action
-        type: u8
       -
         name: reload-action-stats
-        type: nest
   -
     name: dl-reload-act-stats
     subset-of: devlink
     attributes:
       -
         name: reload-stats-entry
-        type: nest
   -
     name: dl-reload-stats-entry
     subset-of: devlink
     attributes:
       -
         name: reload-stats-limit
-        type: u8
       -
         name: reload-stats-value
-        type: u32
   -
     name: dl-info-version
     subset-of: devlink
     attributes:
       -
         name: info-version-name
-        type: string
       -
         name: info-version-value
-        type: string
 
 operations:
   enum-model: directional
diff --git a/Documentation/netlink/specs/dpll.yaml b/Documentation/netlink/specs/dpll.yaml
index 8b86b28b47a6..1c1b53136c7b 100644
--- a/Documentation/netlink/specs/dpll.yaml
+++ b/Documentation/netlink/specs/dpll.yaml
@@ -278,36 +278,28 @@ attribute-sets:
     attributes:
       -
         name: parent-id
-        type: u32
       -
         name: direction
-        type: u32
       -
         name: prio
-        type: u32
       -
         name: state
-        type: u32
   -
     name: pin-parent-pin
     subset-of: pin
     attributes:
       -
         name: parent-id
-        type: u32
       -
         name: state
-        type: u32
   -
     name: frequency-range
     subset-of: pin
     attributes:
       -
         name: frequency-min
-        type: u64
       -
         name: frequency-max
-        type: u64
 
 operations:
   enum-name: dpll_cmd
diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml
index 837b565577ca..5c7a65b009b4 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -818,13 +818,10 @@ attribute-sets:
     attributes:
       -
         name: hist-bkt-low
-        type: u32
       -
         name: hist-bkt-hi
-        type: u32
       -
         name: hist-val
-        type: u64
   -
     name: stats
     attributes:
-- 
2.41.0


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

* Re: [patch net-next v3 1/2] tools: ynl-gen: lift type requirement for attribute subsets
  2023-10-06 11:44 ` [patch net-next v3 1/2] " Jiri Pirko
@ 2023-10-06 15:00   ` Jakub Kicinski
  2023-10-06 16:55     ` Jiri Pirko
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2023-10-06 15:00 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, pabeni, davem, edumazet, donald.hunter

On Fri,  6 Oct 2023 13:44:35 +0200 Jiri Pirko wrote:
> +      # type property is only required if not in subset definition
> +      if:
> +        properties:
> +          subset-of:
> +            not:
> +              type: string
> +      then:
> +        properties:
> +          attributes:
> +            items:
> +              required: [ type ]

Nice!

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

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

* Re: [patch net-next v3 1/2] tools: ynl-gen: lift type requirement for attribute subsets
  2023-10-06 15:00   ` Jakub Kicinski
@ 2023-10-06 16:55     ` Jiri Pirko
  2023-10-06 19:33       ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2023-10-06 16:55 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, pabeni, davem, edumazet, donald.hunter

Fri, Oct 06, 2023 at 05:00:39PM CEST, kuba@kernel.org wrote:
>On Fri,  6 Oct 2023 13:44:35 +0200 Jiri Pirko wrote:
>> +      # type property is only required if not in subset definition
>> +      if:
>> +        properties:
>> +          subset-of:
>> +            not:
>> +              type: string
>> +      then:
>> +        properties:
>> +          attributes:
>> +            items:
>> +              required: [ type ]
>
>Nice!

Took me like 3 hours debugging this. These json schemas are from
different world than I am...


>
>Reviewed-by: Jakub Kicinski <kuba@kernel.org>

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

* Re: [patch net-next v3 1/2] tools: ynl-gen: lift type requirement for attribute subsets
  2023-10-06 16:55     ` Jiri Pirko
@ 2023-10-06 19:33       ` Jakub Kicinski
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2023-10-06 19:33 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, pabeni, davem, edumazet, donald.hunter

On Fri, 6 Oct 2023 18:55:37 +0200 Jiri Pirko wrote:
> Took me like 3 hours debugging this. These json schemas are from
> different world than I am...

That makes two of us. One of the most confusing languages I've worked
with.. The effort is very much appreciated! :)

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

* Re: [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets
  2023-10-06 11:44 [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets Jiri Pirko
  2023-10-06 11:44 ` [patch net-next v3 1/2] " Jiri Pirko
  2023-10-06 11:44 ` [patch net-next v3 2/2] netlink: specs: remove redundant type keys from attributes in subsets Jiri Pirko
@ 2023-10-10  2:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-10  2:50 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, kuba, pabeni, davem, edumazet, donald.hunter

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  6 Oct 2023 13:44:34 +0200 you wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Remove the requirement from schema files to specify the "type" for
> attribute subsets and adjust existing schema files.
> 
> Jiri Pirko (2):
>   tools: ynl-gen: lift type requirement for attribute subsets
>   netlink: specs: remove redundant type keys from attributes in subsets
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/2] tools: ynl-gen: lift type requirement for attribute subsets
    https://git.kernel.org/netdev/net-next/c/e18f3dc2beaa
  - [net-next,v3,2/2] netlink: specs: remove redundant type keys from attributes in subsets
    https://git.kernel.org/netdev/net-next/c/7049fd5df78c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-10-10  2:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 11:44 [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets Jiri Pirko
2023-10-06 11:44 ` [patch net-next v3 1/2] " Jiri Pirko
2023-10-06 15:00   ` Jakub Kicinski
2023-10-06 16:55     ` Jiri Pirko
2023-10-06 19:33       ` Jakub Kicinski
2023-10-06 11:44 ` [patch net-next v3 2/2] netlink: specs: remove redundant type keys from attributes in subsets Jiri Pirko
2023-10-10  2:50 ` [patch net-next v3 0/2] tools: ynl-gen: lift type requirement for attribute subsets patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.