Skip to contentSkip to conversation

dt-bindings: net: Add network-class.yaml schema

PATCH Applied Janne Grunau 5 participants 11 messages Feb 12, 2023 – Feb 20, 2023

Subsystems (6)

v2 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover dt-bindings: net: Add network-class.yaml schema

The Devicetree Specification, Release v0.3 specifies in section 4.3.1 a "Network Class Binding". This covers MAC address and maximal frame size properties. "local-mac-address" and "mac-address" with a fixed "address-size" of 48 bits are already in the ethernet-controller.yaml schema so move those over.

Keep "address-size" fixed to 48 bits as it's unclear if network protocols using 64-bit mac addresses like ZigBee, 6LoWPAN and others are relevant for this binding. This allows mac address array size validation for ethernet and wireless lan devices.

"max-frame-size" in the Devicetree Specification is written to cover the whole layer 2 ethernet frame but actual use for this property is the payload size. Keep the description from ethernet-controller.yaml which specifies the property as MTU.

---
Changes in v2:
- Added "max-frame-size" with the description from ethernet-controller.yaml
- Restrict "address-size" to 48-bits
- Fix the mac-address array size to 6 bytes
- Drop duplicate default value from "max-frame-size" description
- Fix 2 nios2 dts files which incorrectly use the ethernet frame size of 1518
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Janne Grunau (4):
dt-bindings: net: Add network-class schema for mac-address properties
dt-bindings: wireless: bcm4329-fmac: Use network-class.yaml schema
dt-bindings: wireless: silabs,wfx: Use network-class.yaml
nios2: dts: Fix tse_mac "max-frame-size" property

 .../bindings/net/ethernet-controller.yaml          | 25 +-----------
 .../devicetree/bindings/net/network-class.yaml     | 44 ++++++++++++++++++++++
 .../bindings/net/wireless/brcm,bcm4329-fmac.yaml   |  5 ++-
 .../bindings/net/wireless/silabs,wfx.yaml          |  5 +--
 arch/nios2/boot/dts/10m50_devboard.dts             |  2 +-
 arch/nios2/boot/dts/3c120_devboard.dts             |  2 +-
 6 files changed, 52 insertions(+), 31 deletions(-)

---
base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
change-id: 20230203-dt-bindings-network-class-8367edd679d2

Best regards,

Signature · 1 line
Janne Grunau <[email protected]>
#1 lore raw

PATCH v2 1/4 dt-bindings: net: Add network-class schema for mac-address properties

The ethernet-controller schema specifies "mac-address" and "local-mac-address" but other network devices such as wireless network adapters use mac addresses as well.
The Devicetree Specification, Release v0.3 specifies in section 4.3.1 a generic "Network Class Binding" with "address-bits", "mac-address", "local-mac-address" and "max-frame-size". This schema specifies the "address-bits" property and moves the remaining properties over from the ethernet-controller.yaml schema.

The "max-frame-size" property is used to describe the maximal payload size despite its name. Keep the description from ethernet-controller specifying this property as MTU. The contradictory description in the Devicetree Specification is ignored.

---
Changed in v2:
- restrict address-size to 48 bits for strict mac address size validation
- move max-frame-size as well

---
 .../bindings/net/ethernet-controller.yaml          | 25 +-----------
 .../devicetree/bindings/net/network-class.yaml     | 44 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/net/ethernet-controller.yaml +1 -24
index 00be387984ac..1ad66af55d77 100644
@@ -17,30 +17,6 @@ properties:
     $ref: /schemas/types.yaml#/definitions/string
     description: Human readable label on a port of a box.
 
-  local-mac-address:
-    description:
-      Specifies the MAC address that was assigned to the network device.
-    $ref: /schemas/types.yaml#/definitions/uint8-array
-    minItems: 6
-    maxItems: 6
-
-  mac-address:
-    description:
-      Specifies the MAC address that was last used by the boot
-      program; should be used in cases where the MAC address assigned
-      to the device by the boot program is different from the
-      local-mac-address property.
-    $ref: /schemas/types.yaml#/definitions/uint8-array
-    minItems: 6
-    maxItems: 6
-
-  max-frame-size:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description:
-      Maximum transfer unit (IEEE defined MTU), rather than the
-      maximum frame size (there\'s contradiction in the Devicetree
-      Specification).
-
   max-speed:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
@@ -226,6 +202,7 @@ dependencies:
   pcs-handle-names: [pcs-handle]
 
 allOf:
+  - $ref: /schemas/net/network-class.yaml#
   - if:
       properties:
         phy-mode:
Documentation/devicetree/bindings/net/network-class.yaml new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.39.1
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: net: Add network-class schema for mac-address properties

Documentation/devicetree/bindings/net/network-class.yaml line 42

Quoted 4 lines
Documentation/devicetree/bindings/net/network-class.yaml new file +4 -0
+  max-frame-size:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Maximum transfer unit (IEEE defined MTU).

Do you have a reference you can include here to a clause in an IEEE 802 document? We need this unambiguously defined otherwise more DT blobs are going to use the wrong value.

Andrew

#3 lore raw

PATCH v2 2/4 dt-bindings: wireless: bcm4329-fmac: Use network-class.yaml schema

In reply to Janne Grunau

The network-class schema specifies local-mac-address as used in the bcm4329-fmac device nodes of Apple silicon devices (arch/arm64/boot/dts/apple).
Fixes make dtbs_check for those devices.

---
 .../devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml          | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/wireless/brcm,bcm4329-fmac.yaml +4 -1
index fec1cc9b9a08..55b0a21acb96 100644
@@ -116,11 +116,14 @@ properties:
       NVRAM. This would normally be filled in by the bootloader from platform
       configuration data.
 
+allOf:
+  - $ref: /schemas/net/network-class.yaml#
+
 required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
Signature · 1 line
2.39.1
#4 lore raw

Re: [PATCH v2 2/4] dt-bindings: wireless: bcm4329-fmac: Use network-class.yaml schema

Quoted 4 lines · Janne Grunau

The network-class schema specifies local-mac-address as used in the bcm4329-fmac device nodes of Apple silicon devices (arch/arm64/boot/dts/apple).
Fixes make dtbs_check for those devices.

Maybe a more hierarchical approach would be better? Add a wireless-controller.yaml which includes ieee80211.yaml and network-class.yaml? It would then follow the structure of Ethernet controllers, bluetooth controllers, and can controllers.

Andrew

#5 lore raw

PATCH v2 3/4 dt-bindings: wireless: silabs,wfx: Use network-class.yaml

In reply to Janne Grunau

Instead listing local-mac-address and mac-address properties, reference network-class.yaml schema. The schema brings in constraints for the property checked during make dtbs_check.

---
 Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml +0 -3
index 583db5d42226..2ce50b57c096 100644
@@ -72,15 +72,12 @@ properties:
       "Platform Data Set" in Silabs jargon). Default depends of "compatible"
       string. For "silabs,wf200", the default is 'wf200.pds'.
 
-  local-mac-address: true
-
-  mac-address: true
#6 lore raw

PATCH v2 4/4 nios2: dts: Fix tse_mac "max-frame-size" property

In reply to Janne Grunau

The given value of 1518 seems to refer to the layer 2 ethernet frame size without 802.1Q tag. Actual use of the "max-frame-size" including in the consumer of the "altr,tse-1.0" compatible is the MTU.

Fixes 95acd4c7b69c ("nios2: Device tree support")
Fixes 61c610ec61bb ("nios2: Add Max10 device tree")
---
 arch/nios2/boot/dts/10m50_devboard.dts | 2 +-
 arch/nios2/boot/dts/3c120_devboard.dts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/nios2/boot/dts/10m50_devboard.dts +1 -1
index 56339bef3247..0e7e5b0dd685 100644
@@ -97,7 +97,7 @@ rgmii_0_eth_tse_0: ethernet@400 {
 			rx-fifo-depth = <8192>;
 			tx-fifo-depth = <8192>;
 			address-bits = <48>;
-			max-frame-size = <1518>;
+			max-frame-size = <1500>;
 			local-mac-address = [00 00 00 00 00 00];
 			altr,has-supplementary-unicast;
 			altr,enable-sup-addr = <1>;
arch/nios2/boot/dts/3c120_devboard.dts +1 -1
index d10fb81686c7..3ee316906379 100644
@@ -106,7 +106,7 @@ tse_mac: ethernet@4000 {
 				interrupt-names = "rx_irq", "tx_irq";
 				rx-fifo-depth = <8192>;
 				tx-fifo-depth = <8192>;
-				max-frame-size = <1518>;
+				max-frame-size = <1500>;
 				local-mac-address = [ 00 00 00 00 00 00 ];
 				phy-mode = "rgmii-id";
 				phy-handle = <&phy0>;
Signature · 1 line
2.39.1
maintainer Applied
#7 lore raw

Re: [PATCH v2 4/4] nios2: dts: Fix tse_mac "max-frame-size" property

Quoted 31 lines · Janne Grunau

The given value of 1518 seems to refer to the layer 2 ethernet frame size without 802.1Q tag. Actual use of the "max-frame-size" including in the consumer of the "altr,tse-1.0" compatible is the MTU.

Fixes 95acd4c7b69c ("nios2: Device tree support")
Fixes 61c610ec61bb ("nios2: Add Max10 device tree")
---
  arch/nios2/boot/dts/10m50_devboard.dts | 2 +-
  arch/nios2/boot/dts/3c120_devboard.dts | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
arch/nios2/boot/dts/10m50_devboard.dts +1 -1
index 56339bef3247..0e7e5b0dd685 100644
@@ -97,7 +97,7 @@ rgmii_0_eth_tse_0: ethernet@400 {
  			rx-fifo-depth = <8192>;
  			tx-fifo-depth = <8192>;
  			address-bits = <48>;
-			max-frame-size = <1518>;
+			max-frame-size = <1500>;
  			local-mac-address = [00 00 00 00 00 00];
  			altr,has-supplementary-unicast;
  			altr,enable-sup-addr = <1>;
arch/nios2/boot/dts/3c120_devboard.dts +0 -0
index d10fb81686c7..3ee316906379 100644

arch/nios2/boot/dts/3c120_devboard.dts tse_mac: ethernet@4000 { · line 112

Quoted 8 lines
arch/nios2/boot/dts/3c120_devboard.dts +1 -1
@@ -106,7 +106,7 @@ tse_mac: ethernet@4000 {
  				interrupt-names = "rx_irq", "tx_irq";
  				rx-fifo-depth = <8192>;
  				tx-fifo-depth = <8192>;
-				max-frame-size = <1518>;
+				max-frame-size = <1500>;
  				local-mac-address = [ 00 00 00 00 00 00 ];
  				phy-mode = "rgmii-id";
  				phy-handle = <&phy0>;

Applied!

Thanks,
Dinh

maintainer
#8 lore raw
In reply to Janne Grunau
Quoted 11 lines · On Sun, 12 Feb 2023 13:16:28 +0100 Janne Grunau wrote:

The Devicetree Specification, Release v0.3 specifies in section 4.3.1 a "Network Class Binding". This covers MAC address and maximal frame size properties. "local-mac-address" and "mac-address" with a fixed "address-size" of 48 bits are already in the ethernet-controller.yaml schema so move those over.

Keep "address-size" fixed to 48 bits as it's unclear if network protocols using 64-bit mac addresses like ZigBee, 6LoWPAN and others are relevant for this binding. This allows mac address array size validation for ethernet and wireless lan devices.

Quoted 4 lines

"max-frame-size" in the Devicetree Specification is written to cover the whole layer 2 ethernet frame but actual use for this property is the payload size. Keep the description from ethernet-controller.yaml which specifies the property as MTU.

Rob, Krzysztof - is this one on your todo list? It's been hanging around in my queue, I'm worried I missed some related conversation.

#9 lore raw
Quoted 13 lines · Jakub Kicinski
Quoted 11 lines · On Sun, 12 Feb 2023 13:16:28 +0100 Janne Grunau wrote:

The Devicetree Specification, Release v0.3 specifies in section 4.3.1 a "Network Class Binding". This covers MAC address and maximal frame size properties. "local-mac-address" and "mac-address" with a fixed "address-size" of 48 bits are already in the ethernet-controller.yaml schema so move those over.

Keep "address-size" fixed to 48 bits as it's unclear if network protocols using 64-bit mac addresses like ZigBee, 6LoWPAN and others are relevant for this binding. This allows mac address array size validation for ethernet and wireless lan devices.

Quoted 7 lines
Quoted 4 lines

"max-frame-size" in the Devicetree Specification is written to cover the whole layer 2 ethernet frame but actual use for this property is the payload size. Keep the description from ethernet-controller.yaml which specifies the property as MTU.

Rob, Krzysztof - is this one on your todo list? It's been hanging around in my queue, I'm worried I missed some related conversation.

Andrew suggested changes on 1 and 2 which seem reasonable to me.

Rob

maintainer
#10 lore raw
Quoted 4 lines · On Mon, 20 Feb 2023 15:49:44 -0600 Rob Herring wrote:
Quoted 2 lines

Rob, Krzysztof - is this one on your todo list? It's been hanging around in my queue, I'm worried I missed some related conversation.

Andrew suggested changes on 1 and 2 which seem reasonable to me.

Ah, thank you! I see them in lore but not in my MUA.