Add MxL Ethernet driver & devicetree binding
Subsystems (4)
v3 cover Add MxL Ethernet driver & devicetree binding
Hello netdev maintainers,
This patch series adds support for the MaxLinear LGM SoC's Ethernet controller, including:
Patch 1: Introduces the devicetree binding documentation for the MaxLinear LGM Network Processor.
Patch 2: Adds build infrastructure and the main driver for the MaxLinear LGM SoC Ethernet controller.
The driver supports multi-port operation and is integrated with standard Linux network device driver framework. The devicetree binding documents the required properties for the hardware description.
Changelog:
v2 -> v3:
- Renamed compatible string and YAML filename to maxlinear.
- Changed child nodes to ethernet-ports with port@N.
- Added reg and mdio properties.
- Added schema references for port and mdio.
- Updated required properties and example.
- Add resource management and better error handling
- Improved device tree integration for multiple ports
v1 -> v2:
- Moved devicetree bindings to the first patch in the series.
- Verified bindings with 'make dt_binding_check DT_SCHEMA_FILES=mxl,lgm-eth.yaml'.
- Reformatted commit messages to follow Linux kernel submission guidelines.
- Removed redundant code and addressed all reviewer comments.
links:
v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/
Jack Ping CHNG (2):
dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
net: maxlinear: Add support for MxL LGM SoC
.../bindings/net/maxlinear,lgm-eth.yaml | 119 +++++++++++ .../device_drivers/ethernet/index.rst | 1 + .../device_drivers/ethernet/maxlinear/mxl.rst | 49 +++++ MAINTAINERS | 8 + drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/maxlinear/Kconfig | 15 ++ drivers/net/ethernet/maxlinear/Makefile | 6 + drivers/net/ethernet/maxlinear/mxl_eth.c | 202 ++++++++++++++++++ 9 files changed, 402 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml create mode 100644 Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst create mode 100644 drivers/net/ethernet/maxlinear/Kconfig create mode 100644 drivers/net/ethernet/maxlinear/Makefile create mode 100644 drivers/net/ethernet/maxlinear/mxl_eth.c
Signature · 1 line
2.34.1
PATCH v3 1/2 dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
Add devicetree binding documentation for the MaxLinear LGM SoC Ethernet controller.
--- .../bindings/net/maxlinear,lgm-eth.yaml | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +119 -0
@@ -0,0 +1,119 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/maxlinear,lgm-eth.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MaxLinear LGM Ethernet Controller + +maintainers: + - Jack Ping Chng <[email protected]> + +description: + Binding for MaxLinear LGM Ethernet controller + +properties: + compatible: + enum: + - maxlinear,lgm-eth + + reg: + maxItems: 2 + + reg-names: + items: + - const: port + - const: ctrl + + clocks: + maxItems: 1 + + clock-names: + items: + - const: ethif + + resets: + maxItems: 1 + + ethernet-ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^port@[0-3]$": + type: object + $ref: ethernet-controller.yaml# + additionalProperties: false + + properties: + reg: + description: port id + maxItems: 1 + + phy-handle: + maxItems: 1 + + required: + - reg + - phy-handle + + mdio: + $ref: mdio.yaml# + unevaluatedProperties: false + +additionalProperties: false + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - resets + - mdio + +examples: + - | + ethernet@e7140000 { + compatible = "maxlinear,lgm-eth"; + reg = <0xe7140000 0x1200>,<0xe7150000 0x4000>; + reg-names = "port", "ctrl"; + clocks = <&cgu0 32>; + clock-names = "ethif"; + resets = <&rcu0 0x70 8>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + phy-handle = <ð_phy0>; + }; + + port@1 { + reg = <1>; + phy-handle = <ð_phy1>; + }; + }; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + eth_phy0: ethernet-phy@0 { + reg = <0>; + }; + + eth_phy1: ethernet-phy@1 { + reg = <1>; + }; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 1/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml line 13
Quoted 7 lines · Jack Ping CHNG
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +7
-0+title: MaxLinear LGM Ethernet Controller + +maintainers: + - Jack Ping Chng <[email protected]> + +description: + Binding for MaxLinear LGM Ethernet controller
Drop "Binding for" and write proper description of hardware, not what binding is for.
What is LGM? What is LGM SoC? Why there is nowhere anything about that LGM SoC?
Quoted 48 lines
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +48
-0+ +properties: + compatible: + enum: + - maxlinear,lgm-eth + + reg: + maxItems: 2 + + reg-names: + items: + - const: port + - const: ctrl + + clocks: + maxItems: 1 + + clock-names: + items: + - const: ethif + + resets: + maxItems: 1 + + ethernet-ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^port@[0-3]$": + type: object + $ref: ethernet-controller.yaml# + additionalProperties: false + + properties: + reg: + description: port id + maxItems: 1 + + phy-handle: + maxItems: 1
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml line 71
Quoted 10 lines
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +10
-0+ + required: + - reg + - phy-handle + + mdio: + $ref: mdio.yaml# + unevaluatedProperties: false + +additionalProperties: false
Why did you move this? Previous position was correct, after required:.
Quoted 5 lines
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +5
-0+ +required: + - compatible + - reg + - reg-names
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml line 86
Quoted 10 lines
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +10
-0+ - clocks + - clock-names + - resets + - mdio + +examples: + - | + ethernet@e7140000 { + compatible = "maxlinear,lgm-eth"; + reg = <0xe7140000 0x1200>,<0xe7150000 0x4000>;
Missing space after ,
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml line 90
Quoted 4 lines
Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml new file +4
-0+ reg-names = "port", "ctrl"; + clocks = <&cgu0 32>; + clock-names = "ethif"; + resets = <&rcu0 0x70 8>;
Best regards,
Krzysztof
PATCH v3 2/2 net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGAdd mxl_eth driver to introduce the initial implementation of ethernet support for Maxlinear LGM SoC.
LGM SoC has a multi port MAC controller to interface with the PHY. It also has a master MDIO interface to control the external MDIO configured devices.
--- .../device_drivers/ethernet/index.rst | 1 + .../device_drivers/ethernet/maxlinear/mxl.rst | 49 +++++ MAINTAINERS | 8 + drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/maxlinear/Kconfig | 15 ++ drivers/net/ethernet/maxlinear/Makefile | 6 + drivers/net/ethernet/maxlinear/mxl_eth.c | 202 ++++++++++++++++++ 8 files changed, 283 insertions(+) create mode 100644 Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst create mode 100644 drivers/net/ethernet/maxlinear/Kconfig create mode 100644 drivers/net/ethernet/maxlinear/Makefile create mode 100644 drivers/net/ethernet/maxlinear/mxl_eth.c
Documentation/networking/device_drivers/ethernet/index.rst +1 -0
@@ -44,6 +44,7 @@ Contents: marvell/octeontx2 marvell/octeon_ep marvell/octeon_ep_vf + maxlinear/mxl mellanox/mlx5/index meta/fbnic microsoft/netvsc
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +49 -0
49 lines not on this page · raw message
MAINTAINERS +8 -0
@@ -15102,6 +15102,14 @@ W: https://linuxtv.org T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-maxiradio* +MAXLINEAR ETHERNET DRIVER +M: Jack Ping Chng <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/net/maxlinear,lgm-eth.yaml +F: Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst +F: drivers/net/ethernet/maxlinear/ + MAXLINEAR ETHERNET PHY DRIVER M: Xu Liang <[email protected]> L: [email protected]
drivers/net/ethernet/Kconfig +1 -0
@@ -121,6 +121,7 @@ config LANTIQ_XRX200 source "drivers/net/ethernet/adi/Kconfig" source "drivers/net/ethernet/litex/Kconfig" source "drivers/net/ethernet/marvell/Kconfig" +source "drivers/net/ethernet/maxlinear/Kconfig" source "drivers/net/ethernet/mediatek/Kconfig" source "drivers/net/ethernet/mellanox/Kconfig" source "drivers/net/ethernet/meta/Kconfig"
drivers/net/ethernet/Makefile +1 -0
@@ -58,6 +58,7 @@ obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o obj-$(CONFIG_LANTIQ_XRX200) += lantiq_xrx200.o obj-$(CONFIG_NET_VENDOR_LITEX) += litex/ obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/ +obj-$(CONFIG_NET_VENDOR_MAXLINEAR) += maxlinear/ obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/ obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/ obj-$(CONFIG_NET_VENDOR_META) += meta/
drivers/net/ethernet/maxlinear/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +config NET_VENDOR_MAXLINEAR + bool "MaxLinear devices" + help + If you have a MaxLinear SoC with ethernet, say Y. + +if NET_VENDOR_MAXLINEAR + +config MXL_NPU + tristate "MaxLinear NPU Ethernet driver" + help + This driver supports the MaxLinear NPU Ethernet. + +endif #NET_VENDOR_MAXLINEAR +
drivers/net/ethernet/maxlinear/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Makefile for the MaxLinear network device drivers. +# + +obj-$(CONFIG_MXL_NPU) += mxl_eth.o
drivers/net/ethernet/maxlinear/mxl_eth.c new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst line 17
Quoted 6 lines
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +6
-0+This document describes the Linux driver for the MaxLinear Network Processor +(NP), a high-performance controller supporting multiple MACs and +advanced packet processing capabilities. + +The MaxLinear Network processor integrates programmable hardware accelerators +for tasks such as Layer 2, 3, 4 forwarding, flow steering, and traffic shaping.
By L2 and L3, do you mean this device can bridge and route frames between ports? So it is actually a switch?
Andrew
RE: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Hi Andrew,
Quoted 9 lines · On Fri, 29 Aug 2025 22:24:06 +0200 Andrew Lunn <[email protected]> wrote:
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst line 17
Quoted 6 lines
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +6
-0+This document describes the Linux driver for the MaxLinear Network Processor +(NP), a high-performance controller supporting multiple MACs and +advanced packet processing capabilities. + +The MaxLinear Network processor integrates programmable hardware accelerators +for tasks such as Layer 2, 3, 4 forwarding, flow steering, and traffic shaping.By L2 and L3, do you mean this device can bridge and route frames between ports? So it is actually a switch?
Yes, the SoC does support packet acceleration.
However, this patch series primarily focuses on the host interface to deliver packets to the CPU, where bridging and routing are handled within the network stack.
Best regards,
Jack
Re: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Quoted 15 lines · Jack Ping Chng
Hi Andrew,
Quoted 9 lines · On Fri, 29 Aug 2025 22:24:06 +0200 Andrew Lunn <[email protected]> wrote:
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst line 17
Quoted 6 lines
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +6
-0+This document describes the Linux driver for the MaxLinear Network Processor +(NP), a high-performance controller supporting multiple MACs and +advanced packet processing capabilities. + +The MaxLinear Network processor integrates programmable hardware accelerators +for tasks such as Layer 2, 3, 4 forwarding, flow steering, and traffic shaping.By L2 and L3, do you mean this device can bridge and route frames between ports? So it is actually a switch?
Quoted 3 lines
Yes, the SoC does support packet acceleration.
However, this patch series primarily focuses on the host interface to deliver packets to the CPU, where bridging and routing are handled within the network stack.
Linux has two ways to support a switch. Pure switchdev, or switchdev + DSA. Which to use depends on the architecture of the device. I would like to check now, before you get too far, what the hardware architecture is.
Are there any public available block diagrams of this device?
How does the host direct a frame out a specific port of the switch? How does the host know which port a frame came in on?
Andrew
RE: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Quoted 16 lines · On Mon, 1 Sep 2025 15:11:08 +0200 Andrew Lunn <[email protected]> wrote:
Quoted 15 lines · Jack Ping Chng
Hi Andrew,
Quoted 9 lines · On Fri, 29 Aug 2025 22:24:06 +0200 Andrew Lunn <[email protected]> wrote:
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst line 17
Quoted 6 lines
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +6
-0+This document describes the Linux driver for the MaxLinear Network Processor +(NP), a high-performance controller supporting multiple MACs and +advanced packet processing capabilities. + +The MaxLinear Network processor integrates programmable hardware accelerators +for tasks such as Layer 2, 3, 4 forwarding, flow steering, and traffic shaping.By L2 and L3, do you mean this device can bridge and route frames between ports? So it is actually a switch?
Quoted 8 lines
Quoted 3 lines
Yes, the SoC does support packet acceleration.
However, this patch series primarily focuses on the host interface to deliver packets to the CPU, where bridging and routing are handled within the network stack.Linux has two ways to support a switch. Pure switchdev, or switchdev + DSA. Which to use depends on the architecture of the device. I would like to check now, before you get too far, what the hardware architecture is.
Hi Andrew,
Thank you for your valuable feedback.
The switch core hardware block is part of the MaxLinear Lightning Mountain (LGM) SoC, which integrates Ethernet XGMACs for connectivity with external PHY devices via PCS.
At initialization, we configure the switch core ports to enable only Layer 2 frame forwarding between the CPU (Host Interface) port and the Ethernet ports.
L2/FDB learning and forwarding will not be enabled for any port. The CPU port facilitates packet transfers between the Ethernet ports and the CPU within the SoC using DMA. All forwarding and routing logic is handled in the Linux network stack.
LGM SoC also has a separate HW offload engine for packet routing and bridging per flow. This is not within the scope of this patch series.
Quoted 1 line
Are there any public available block diagrams of this device?
We will update the documentation accordingly in the upcoming version. Please find the packet flow at a high level below:
Rx:
PHY -> Switch Core XGMAC -> Host Interface Port -> DMA Rx -> CPU Tx:
CPU -> DMA Tx -> Host Interface Port -> Switch Core XGMAC -> PHY
Quoted 1 line
How does the host direct a frame out a specific port of the switch?
In the TX direction, there is a predefined mapping between the Ethernet interface and the corresponding destination switch port.
The Ethernet driver communicates this mapping to the DMA driver, which then embeds it into the DMA descriptor as sideband information. This ensures that the data is forwarded correctly through the switch fabric
Quoted 1 line
How does the host know which port a frame came in on?
On the RX side, the source switch port is mapped to a specific DMA Rx channel. The DMA Rx descriptor also carries the ingress port as sideband information.
Either of these methods can be used to determine the source switch port.
Best regards,
Jack
Re: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Quoted 10 lines
Hi Andrew,
Thank you for your valuable feedback.
The switch core hardware block is part of the MaxLinear Lightning Mountain (LGM) SoC, which integrates Ethernet XGMACs for connectivity with external PHY devices via PCS.
At initialization, we configure the switch core ports to enable only Layer 2 frame forwarding between the CPU (Host Interface) port and the Ethernet ports.
So there is a dedicated port for the CPU. That is one valuable piece of information for this decision.
Quoted 17 lines
L2/FDB learning and forwarding will not be enabled for any port. The CPU port facilitates packet transfers between the Ethernet ports and the CPU within the SoC using DMA. All forwarding and routing logic is handled in the Linux network stack.
LGM SoC also has a separate HW offload engine for packet routing and bridging per flow. This is not within the scope of this patch series.
Quoted 1 line
Are there any public available block diagrams of this device?
We will update the documentation accordingly in the upcoming version. Please find the packet flow at a high level below:
Rx:
PHY -> Switch Core XGMAC -> Host Interface Port -> DMA Rx -> CPU Tx:
CPU -> DMA Tx -> Host Interface Port -> Switch Core XGMAC -> PHY
Quoted 6 lines
Quoted 1 line
How does the host direct a frame out a specific port of the switch?
In the TX direction, there is a predefined mapping between the Ethernet interface and the corresponding destination switch port.
The Ethernet driver communicates this mapping to the DMA driver, which then embeds it into the DMA descriptor as sideband information.
So, there are not DMA channels per port. The CPU has a collection of DMA channels, it can pick any, and just needs to set a field in the DMA descriptor to indicate the egress port.
Quoted 8 lines
This ensures that the data is forwarded correctly through the switch fabric
Quoted 1 line
How does the host know which port a frame came in on?
On the RX side, the source switch port is mapped to a specific DMA Rx channel. The DMA Rx descriptor also carries the ingress port as sideband information.
Either of these methods can be used to determine the source switch port.
So here you do have a fixed mapping of port to DMA channel, but you don't actually need it.
So this sounds a bit like the Qualcomm IPQESS device.
https://lists.infradead.org/pipermail/linux-arm-kernel/2022-May/743213.html
This never got merged, but it was going the direction of a DSA driver. However, you could also do a pure switchdev driver.
The advantage of a DSA driver would be a lot of infrastructure you can just use, where as a pure switchdev driver will require you to reinvent a few wheels. So a DSA driver would be smaller, simpler, less bugs.
Andrew
RE: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Quoted 60 lines · On Tue, 2 Sep 2025 14:30:19 +0200 Andrew Lunn <[email protected]> wrote:
Quoted 6 lines
The switch core hardware block is part of the MaxLinear Lightning Mountain (LGM) SoC, which integrates Ethernet XGMACs for connectivity with external PHY devices via PCS.
At initialization, we configure the switch core ports to enable only Layer 2 frame forwarding between the CPU (Host Interface) port and the Ethernet ports.So there is a dedicated port for the CPU. That is one valuable piece of information for this decision.
Quoted 17 lines
L2/FDB learning and forwarding will not be enabled for any port. The CPU port facilitates packet transfers between the Ethernet ports and the CPU within the SoC using DMA. All forwarding and routing logic is handled in the Linux network stack.
LGM SoC also has a separate HW offload engine for packet routing and bridging per flow. This is not within the scope of this patch series.
Quoted 1 line
Are there any public available block diagrams of this device?
We will update the documentation accordingly in the upcoming version. Please find the packet flow at a high level below:
Rx:
PHY -> Switch Core XGMAC -> Host Interface Port -> DMA Rx -> CPU Tx:
CPU -> DMA Tx -> Host Interface Port -> Switch Core XGMAC -> PHYQuoted 6 lines
Quoted 1 line
How does the host direct a frame out a specific port of the switch?
In the TX direction, there is a predefined mapping between the Ethernet interface and the corresponding destination switch port.
The Ethernet driver communicates this mapping to the DMA driver, which then embeds it into the DMA descriptor as sideband information.So, there are not DMA channels per port. The CPU has a collection of DMA channels, it can pick any, and just needs to set a field in the DMA descriptor to indicate the egress port.
Quoted 8 lines
This ensures that the data is forwarded correctly through the switch fabric
Quoted 1 line
How does the host know which port a frame came in on?
On the RX side, the source switch port is mapped to a specific DMA Rx channel. The DMA Rx descriptor also carries the ingress port as sideband information.
Either of these methods can be used to determine the source switch port.So here you do have a fixed mapping of port to DMA channel, but you don't actually need it.
So this sounds a bit like the Qualcomm IPQESS device.
https://lists.infradead.org/pipermail%252
Flinux-arm-kernel%2F2022- May%2F743213.html&data=05%7C02%7Cjchng%40maxlinear.com%7C85f1f75bab584d678edb08ddea1c8 213%7Cdac2800513e041b882807663835f2b1d%7C0%7C0%7C638924130370008536%7CUnknown%7CTW FpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUI joyfQ%3D%3D%7C0%7C%7C%7C&sdata=98FRlgiORUVgvaJX1Q%2Bmrwwfq%2Bib6p5CxRPksa%2FhFGg%3 D&reserved=0
Quoted 7 lines
This never got merged, but it was going the direction of a DSA driver. However, you could also do a pure switchdev driver.
The advantage of a DSA driver would be a lot of infrastructure you can just use, where as a pure switchdev driver will require you to reinvent a few wheels. So a DSA driver would be smaller, simpler, less bugs.
Hi Andrew,
Thank you for your feedback.
To clarify, this driver does not implement any switch functionality. Its purpose is limited to controlling individual MACs, without support for bridging, VLANs, or other switch-related features.
All packet forwarding and routing will be handled entirely by the Linux networking stack.
Also, we have separate Tx/Rx channels mapped to the interfaces we are registering. We also have a separate packet processor engine for bridging and routing based on the sessions.
Best regards,
Jack
Re: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
Quoted 1 line
To clarify, this driver does not implement any switch functionality.
So you have all this nice hardware to accelerate L2, L3, etc, but you are not going to use it? Linux will always ignore it and do it all in software?
Somehow, i don't think this is true. At some point, you will want to make use of that hardware. And Linux has very specific ways to do that. You need to be looking forward to the time you start to use this hardware, because if you get it wrong now, you will end up throwing this driver away and starting again. I've seen it happen.
Quoted 7 lines
Its purpose is limited to controlling individual MACs, without support for bridging, VLANs, or other switch-related features.
All packet forwarding and routing will be handled entirely by the Linux networking stack.
Also, we have separate Tx/Rx channels mapped to the interfaces we are registering. We also have a separate packet processor engine for bridging and routing based on the sessions.
So this sounds like a pure switchdev driver, although DSA could still be used. So, look forward, spend some time looking at other drivers which implement the swichdev API, look at the mediatek drivers which do acceleration of NAT, and make sure your architecture is correct.
Andrew
Re: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGdrivers/net/ethernet/maxlinear/mxl_eth.c line 87
Quoted 6 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +5
-0+#define MXL_NUM_PORT 4 +if (of_property_read_u32 (np,"reg" , &priv->port_id) <0 ) { +dev_err (&pdev->dev,"failed to get port id\n" ); +return -EINVAL ; + }
So the value of the port_id/reg does not matter? In device tree i could use 42, 1024, 65535, 24?
Andrew
Re: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGQuoted 4 lines · Jack Ping CHNG
drivers/net/ethernet/maxlinear/mxl_eth.c new file +4
-0+ +static int mxl_eth_probe (struct platform_device *pdev) +{ +struct mxl_eth_drvdata *drvdata;
drivers/net/ethernet/maxlinear/mxl_eth.c line 121
Quoted 10 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +10
-0+struct device_node *eth_np, *np; +struct reset_control *rst; +int ret, i =0 ; + + drvdata =devm_kzalloc (&pdev->dev,sizeof (*drvdata),GFP_KERNEL ); +if (!drvdata) +return -ENOMEM ; + + drvdata->port_base = +devm_platform_ioremap_resource_byname (pdev,"port" );
Very odd wrapping. That's one line or wrap according to Linux coding style.
drivers/net/ethernet/maxlinear/mxl_eth.c line 126
Quoted 5 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +5
-0+if (IS_ERR (drvdata->port_base)) +return PTR_ERR (drvdata->port_base); + + drvdata->ctrl_base = +devm_platform_ioremap_resource_byname (pdev,"ctrl" );
Fix wrapping
Quoted 15 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +15
-0+if (IS_ERR (drvdata->ctrl_base)) +return PTR_ERR (drvdata->ctrl_base); + + drvdata->clks =devm_clk_get_enabled (&pdev->dev,"ethif" ); +if (IS_ERR (drvdata->clks)) +return dev_err_probe (&pdev->dev,PTR_ERR (drvdata->clks), +"failed to get/enable clock\n" ); + + rst =devm_reset_control_get (&pdev->dev,NULL ); +if (IS_ERR (rst)) +return dev_err_probe (&pdev->dev,PTR_ERR (rst), +"failed to get reset control\n" ); + +reset_control_assert (rst); +udelay (1 );
drivers/net/ethernet/maxlinear/mxl_eth.c line 151
Quoted 10 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +10
-0+reset_control_deassert (rst); + +platform_set_drvdata (pdev, drvdata); + + eth_np =of_get_child_by_name (pdev->dev.of_node,"ethernet-ports" ); +if (!eth_np) +return dev_err_probe (&pdev->dev, -ENODEV , +"no ethernet-ports node found!\n" ); + +for_each_available_child_of_node (eth_np, np) {
No, I asked you to use scoped loop.
drivers/net/ethernet/maxlinear/mxl_eth.c line 154
Quoted 3 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +3
-0+ ret =mxl_eth_create_ndev (pdev, np, &drvdata->ndevs[i++]); +if (ret) { +of_node_put (np);
Best regards,
Krzysztof
Simon Horman
reviewerRe: [PATCH net-next v3 2/2] net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGQuoted 7 lines · Jack Ping CHNG
Add
mxl_ethdriver to introduce the initial implementation of ethernet support for Maxlinear LGM SoC.
LGM SoC has a multi port MAC controller to interface with the PHY. It also has a master MDIO interface to control the external MDIO configured devices.Signed-off-by Jack Ping CHNG <[email protected]>
...
Quoted 1 line
drivers/net/ethernet/maxlinear/mxl_eth.c +0
-0
...
Quoted 1 line
+static int
mxl_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
Hi Jack,
I think it would better for the return type of mxl_eth_start_xmit to be netdev_tx_t to match the signature of the .ndo_start_xmit member of const struct net_device_ops.
Flagged by Clang 20.1.8 with KCFLAGS=-Wincompatible-function-pointer-types-strict
drivers/net/ethernet/maxlinear/mxl_eth.c:56:20: error: incompatible function pointer types initializing 'netdev_tx_t (*)(struct sk_buff *, struct net_device *)' (aka 'enum netdev_tx (*)(struct sk_buff *, struct net_device *)') with an expression of type 'int (struct sk_buff *, struct net_device *)' [-Werror,-Wincompatible-function-pointer-types-strict]
56 | .ndo_start_xmit = mxl_eth_start_xmit,
| ^~~~~~~~~~~~~~~~~~
Quoted 10 lines
drivers/net/ethernet/maxlinear/mxl_eth.c +10
-0+{ +dev_kfree_skb (skb); +return NETDEV_TX_OK ; +} + +static const struct net_device_ops mxl_eth_netdev_ops = { + .ndo_open = mxl_eth_open, + .ndo_stop = mxl_eth_stop, + .ndo_start_xmit = mxl_eth_start_xmit, +};
...