From patchwork Mon Mar 13 22:51:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13173464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E526C6FD19 for ; Mon, 13 Mar 2023 23:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pY9FiqeqCyug4kkksFwtBaagtkcFHj0xrm+QF3nCFig=; b=fHdmUMvjr1Q/FF aoS8qrRAigEjGrnxG3lV2HdwtBN7rzzjKxwXJ9sz+eoqhyXjflB1Si6T0y/oMCiwpBXmTPMxWbSZ+ CKXXMZHpJjXjYY2lQdIN8luXtMXwX0jBnHU3y/x9Z1mt2PBqENaAW1YlmuMj5U3EYygbDoGgSzny6 k1Qjvgx5GmGVbTm1I+8YgXRWopXKGyxBONXnR1J6gSfJciEXp9G9f5j8kXrF64fP6VbZFfypusw3T iv5xonXwXaHqK6+VeqV3leXCq2xYa9en3goRyxKyfABLEhQgvRT93APjNPpdPkWACA+7PaLroQMXW P9UGl8vJEBRVLXAZeFxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbr8B-008Dqt-Ki; Mon, 13 Mar 2023 22:59:03 +0000 Received: from post.baikalelectronics.com ([213.79.110.86]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbr0t-008AOU-Od for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 22:51:33 +0000 Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 3F5A0E0EC1; Tue, 14 Mar 2023 01:51:31 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=GDWLCKbTjZjHBGbg9BZjPvJY7ns7quDEaw1d5obfFoI=; b=Su5mxlbVtf7o HyrJOJcxzszhKpQ6kT8G485hALnO3itaeV7HwX6WS1qCTYw/blglbHawXh2+wssm Oeve5lvR0oImztmoDy88paEtRG0KeZc0fJBGTupcoKoJmClWy0JNd/ASS5/tg+Ln rrPM41V8hbhipuR7e48Ul7M4eS3qW5Q= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 2827BE0E6A; Tue, 14 Mar 2023 01:51:31 +0300 (MSK) Received: from localhost (10.8.30.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 14 Mar 2023 01:51:30 +0300 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Rob Herring , Krzysztof Kozlowski CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Christian Marangi , Richard Cochran , Biao Huang , Yang Yingliang , , , , , Subject: [PATCH net-next 15/16] dt-bindings: net: dwmac: Simplify MTL queue props dependencies Date: Tue, 14 Mar 2023 01:51:02 +0300 Message-ID: <20230313225103.30512-16-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313225103.30512-1-Sergey.Semin@baikalelectronics.ru> References: <20230313225103.30512-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-Originating-IP: [10.8.30.10] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_155132_085311_DBC2DF2D X-CRM114-Status: GOOD ( 11.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Rob Herring --- 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