mbox series

[v2,0/4] dt-bindings: net: Add network-class.yaml schema

Message ID 20230203-dt-bindings-network-class-v2-0-499686795073@jannau.net
Headers show
Series dt-bindings: net: Add network-class.yaml schema | expand

Message

Janne Grunau Feb. 12, 2023, 12:16 p.m. UTC
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.

Signed-off-by: Janne Grunau <j@jannau.net>
---
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/20230203-dt-bindings-network-class-v1-0-452e0375200d@jannau.net

---
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,

Comments

Dinh Nguyen Feb. 16, 2023, 3:54 p.m. UTC | #1
On 2/12/23 06:16, Janne Grunau wrote:
> 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")
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
>   arch/nios2/boot/dts/10m50_devboard.dts | 2 +-
>   arch/nios2/boot/dts/3c120_devboard.dts | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/nios2/boot/dts/10m50_devboard.dts b/arch/nios2/boot/dts/10m50_devboard.dts
> index 56339bef3247..0e7e5b0dd685 100644
> --- a/arch/nios2/boot/dts/10m50_devboard.dts
> +++ b/arch/nios2/boot/dts/10m50_devboard.dts
> @@ -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>;
> diff --git a/arch/nios2/boot/dts/3c120_devboard.dts b/arch/nios2/boot/dts/3c120_devboard.dts
> index d10fb81686c7..3ee316906379 100644
> --- a/arch/nios2/boot/dts/3c120_devboard.dts
> +++ b/arch/nios2/boot/dts/3c120_devboard.dts
> @@ -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
Jakub Kicinski Feb. 20, 2023, 7:40 p.m. UTC | #2
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.
> 
> "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.
Rob Herring Feb. 20, 2023, 9:49 p.m. UTC | #3
On Mon, Feb 20, 2023 at 1:40 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> 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.
> >
> > "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
Jakub Kicinski Feb. 20, 2023, 10:02 p.m. UTC | #4
On Mon, 20 Feb 2023 15:49:44 -0600 Rob Herring wrote:
> > 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.