mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
	Serge Semin <fancer.lancer@gmail.com>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Biao Huang <biao.huang@mediatek.com>,
	Yang Yingliang <yangyingliang@huawei.com>,
	<devicetree@vger.kernel.org>, <netdev@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH net-next 15/16] dt-bindings: net: dwmac: Simplify MTL queue props dependencies
Date: Tue, 14 Mar 2023 01:51:02 +0300	[thread overview]
Message-ID: <20230313225103.30512-16-Sergey.Semin@baikalelectronics.ru> (raw)
In-Reply-To: <20230313225103.30512-1-Sergey.Semin@baikalelectronics.ru>

Currently the Tx/Rx queues properties interdependencies are described by
means of the pattern: "if: required: X, then: properties: Y: false, Z:
false, etc". Due to very unfortunate MTL Tx/Rx queue DT-node design the
resultant sub-nodes schemas look very bulky and thus hard to read. The
situation can be improved by using the "allOf:/oneOf: required: X,
required: Y, etc" pattern instead thus getting shorter and a bit easier to
comprehend constructions.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>

---

Note the solution can be shortened out a bit further by replacing the
single-entry allOf statements with just the "not: required: etc" pattern.
But in order to do that the DT-schema validation tool must be fixed like
this:

--- a/meta-schemas/nodes.yaml	2021-02-08 14:20:56.732447780 +0300
+++ b/meta-schemas/nodes.yaml	2021-02-08 14:21:00.736492245 +0300
@@ -22,6 +22,7 @@
     - unevaluatedProperties
     - deprecated
     - required
+    - not
     - allOf
     - anyOf
     - oneOf

Thus all the patterns like
allOf:
  - not:
      required:
        - X
could be replaced with just
not:
  required:
    - X
---
 .../devicetree/bindings/net/snps,dwmac.yaml   | 175 +++++++-----------
 1 file changed, 63 insertions(+), 112 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index a863b5860566..9df301cf674e 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -127,19 +127,6 @@ properties:
         $ref: /schemas/types.yaml#/definitions/flag
         description: Weighted Strict priority
 
-    allOf:
-      - if:
-          required:
-            - snps,rx-sched-sp
-        then:
-          properties:
-            snps,rx-sched-wsp: false
-      - if:
-          required:
-            - snps,rx-sched-wsp
-        then:
-          properties:
-            snps,rx-sched-sp: false
     patternProperties:
       "^queue([0-9]|1[0-1])$":
         description: Each subnode represents a queue.
@@ -185,67 +172,46 @@ properties:
             minimum: 0
             maximum: 0xFF
 
+        additionalProperties: false
+
+        # Choose only one of the bridging algorithm and the packets routing
         allOf:
-          - if:
+          - not:
               required:
                 - snps,dcb-algorithm
-            then:
-              properties:
-                snps,avb-algorithm: false
-          - if:
-              required:
                 - snps,avb-algorithm
-            then:
-              properties:
-                snps,dcb-algorithm: false
-          - if:
-              required:
-                - snps,route-avcp
-            then:
-              properties:
-                snps,route-ptp: false
-                snps,route-dcbcp: false
-                snps,route-up: false
-                snps,route-multi-broad: false
-          - if:
-              required:
-                - snps,route-ptp
-            then:
-              properties:
-                snps,route-avcp: false
-                snps,route-dcbcp: false
-                snps,route-up: false
-                snps,route-multi-broad: false
-          - if:
-              required:
-                - snps,route-dcbcp
-            then:
-              properties:
-                snps,route-avcp: false
-                snps,route-ptp: false
-                snps,route-up: false
-                snps,route-multi-broad: false
-          - if:
-              required:
-                - snps,route-up
-            then:
-              properties:
-                snps,route-avcp: false
-                snps,route-ptp: false
-                snps,route-dcbcp: false
-                snps,route-multi-broad: false
-          - if:
-              required:
-                - snps,route-multi-broad
-            then:
-              properties:
-                snps,route-avcp: false
-                snps,route-ptp: false
-                snps,route-dcbcp: false
-                snps,route-up: false
-        additionalProperties: false
+          - oneOf:
+              - required:
+                  - snps,route-avcp
+              - required:
+                  - snps,route-ptp
+              - required:
+                  - snps,route-dcbcp
+              - required:
+                  - snps,route-up
+              - required:
+                  - snps,route-multi-broad
+              - not:
+                  anyOf:
+                    - required:
+                        - snps,route-avcp
+                    - required:
+                        - snps,route-ptp
+                    - required:
+                        - snps,route-dcbcp
+                    - required:
+                        - snps,route-up
+                    - required:
+                        - snps,route-multi-broad
+
     additionalProperties: false
 
+    allOf:
+      - not:
+          required:
+            - snps,rx-sched-sp
+            - snps,rx-sched-wsp
+
   snps,mtl-tx-config:
     $ref: /schemas/types.yaml#/definitions/phandle
     description:
@@ -279,39 +245,6 @@ properties:
         $ref: /schemas/types.yaml#/definitions/flag
         description: Strict priority
 
-    allOf:
-      - if:
-          required:
-            - snps,tx-sched-wrr
-        then:
-          properties:
-            snps,tx-sched-wfq: false
-            snps,tx-sched-dwrr: false
-            snps,tx-sched-sp: false
-      - if:
-          required:
-            - snps,tx-sched-wfq
-        then:
-          properties:
-            snps,tx-sched-wrr: false
-            snps,tx-sched-dwrr: false
-            snps,tx-sched-sp: false
-      - if:
-          required:
-            - snps,tx-sched-dwrr
-        then:
-          properties:
-            snps,tx-sched-wrr: false
-            snps,tx-sched-wfq: false
-            snps,tx-sched-sp: false
-      - if:
-          required:
-            - snps,tx-sched-sp
-        then:
-          properties:
-            snps,tx-sched-wrr: false
-            snps,tx-sched-wfq: false
-            snps,tx-sched-dwrr: false
     patternProperties:
       "^queue([0-9]|1[0-5])$":
         description: Each subnode represents a queue.
@@ -380,23 +313,41 @@ properties:
             minimum: 0
             maximum: 0xFF
 
+        additionalProperties: false
+
+        # Choose only one of the Queue TC algo
         allOf:
-          - if:
+          - not:
               required:
                 - snps,dcb-algorithm
-            then:
-              properties:
-                snps,avb-algorithm: false
-          - if:
-              required:
                 - snps,avb-algorithm
-            then:
-              properties:
-                snps,dcb-algorithm: false
-                snps,weight: false
-        additionalProperties: false
+
+        dependencies:
+          snps,weight: ["snps,dcb-algorithm"]
+
     additionalProperties: false
 
+    # Choose one of the TX scheduling algorithms
+    oneOf:
+      - required:
+          - snps,tx-sched-wrr
+      - required:
+          - snps,tx-sched-wfq
+      - required:
+          - snps,tx-sched-dwrr
+      - required:
+          - snps,tx-sched-sp
+      - not:
+          anyOf:
+            - required:
+                - snps,tx-sched-wrr
+            - required:
+                - snps,tx-sched-wfq
+            - required:
+                - snps,tx-sched-dwrr
+            - required:
+                - snps,tx-sched-sp
+
   snps,reset-gpio:
     deprecated: true
     maxItems: 1
-- 
2.39.2



  parent reply	other threads:[~2023-03-13 23:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 22:50 [PATCH net-next 00/16] dt-bindings: net: dwmac: Extend clocks, props desc and constraints Serge Semin
2023-03-13 22:50 ` [PATCH net-next 01/16] dt-bindings: net: dwmac: Validate PBL for all IP-cores Serge Semin
2023-03-14 14:10   ` Rob Herring
2023-03-14 15:06     ` Serge Semin
2023-03-14 17:09       ` Serge Semin
2023-03-16 20:40         ` Rob Herring
2023-03-16 20:50           ` Serge Semin
2023-03-13 22:50 ` [PATCH net-next 02/16] dt-bindings: net: dwmac: Extend number of PBL values Serge Semin
2023-03-13 22:50 ` [PATCH net-next 03/16] dt-bindings: net: dwmac: Fix the TSO property declaration Serge Semin
2023-03-13 22:50 ` [PATCH net-next 04/16] dt-bindings: net: dwmac: Detach Generic DW MAC bindings Serge Semin
2023-03-13 22:50 ` [PATCH net-next 05/16] dt-bindings: net: dwmac: Elaborate snps,clk-csr description Serge Semin
2023-03-16  8:04   ` Krzysztof Kozlowski
2023-03-13 22:50 ` [PATCH net-next 06/16] dt-bindings: net: dwmac: Elaborate stmmaceth/pclk clocks description Serge Semin
2023-03-13 22:50 ` [PATCH net-next 07/16] dt-bindings: net: dwmac: Add Tx/Rx clock sources Serge Semin
2023-03-13 22:50 ` [PATCH net-next 08/16] dt-bindings: net: dwmac: Drop prop names from snps,axi-config description Serge Semin
2023-03-16  8:05   ` Krzysztof Kozlowski
2023-03-13 22:50 ` [PATCH net-next 09/16] dt-bindings: net: dwmac: Prohibit additional props in AXI-config Serge Semin
2023-03-16  8:06   ` Krzysztof Kozlowski
2023-03-23 11:37     ` Serge Semin
2023-03-13 22:50 ` [PATCH net-next 10/16] dt-bindings: net: dwmac: Add AXI-bus properties constraints Serge Semin
2023-03-16  8:06   ` Krzysztof Kozlowski
2023-03-23 11:49     ` Serge Semin
2023-03-13 22:50 ` [PATCH net-next 11/16] dt-bindings: net: dwmac: Add MTL Rx Queue " Serge Semin
2023-03-16  8:07   ` Krzysztof Kozlowski
2023-03-13 22:50 ` [PATCH net-next 12/16] dt-bindings: net: dwmac: Add MTL Tx " Serge Semin
2023-03-16  8:08   ` Krzysztof Kozlowski
2023-03-23 11:55     ` Serge Semin
2023-03-13 22:51 ` [PATCH net-next 13/16] dt-bindings: net: dwmac: Fix MTL Tx Queue props description Serge Semin
2023-03-16  8:08   ` Krzysztof Kozlowski
2023-03-23 12:03     ` Serge Semin
2023-03-13 22:51 ` [PATCH net-next 14/16] dt-bindings: net: dwmac: Use flag definition instead of booleans Serge Semin
2023-03-16  8:09   ` Krzysztof Kozlowski
2023-03-23 12:08     ` Serge Semin
2023-03-13 22:51 ` Serge Semin [this message]
2023-03-17 20:56   ` [PATCH net-next 15/16] dt-bindings: net: dwmac: Simplify MTL queue props dependencies Rob Herring
2023-03-23 15:10     ` Serge Semin
2023-03-13 22:51 ` [PATCH net-next 16/16] dt-bindings: net: dwmac: Add MTL Tx queue CBS-algo " Serge Semin
2023-03-17 20:57   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313225103.30512-16-Sergey.Semin@baikalelectronics.ru \
    --to=sergey.semin@baikalelectronics.ru \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=Pavel.Parkhomenko@baikalelectronics.ru \
    --cc=alexandre.torgue@foss.st.com \
    --cc=ansuelsmth@gmail.com \
    --cc=biao.huang@mediatek.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=fancer.lancer@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®