Macb Driver
This page provides an overview of the MACB driver, which is included in the Zynq, ZynqMP, and Versal Linux distributions, as well as in the mainline.
This page offers a comprehensive collection of links, files, paths, and documentation pertaining to the Linux kernel source tree.
Table of Contents
Features
- 1 Table of Contents
- 2 Features
- 3 Missing Features, Known Issues and Limitations
- 4 Build Flow
- 4.1 Kernel Configuration
- 4.2 Device-tree
- 4.2.1 Device-tree quick guide
- 4.2.1.1 Ethernet DT
- 4.2.1.2 PHY DT
- 4.2.1.3 Xilinx converter and PHY DT
- 4.2.1.4 RGMII Tuning in DT
- 4.2.1.5 TSU clock in DT
- 4.2.1.6 Fixed link DT
- 4.2.1.7 Common MDIO DT
- 4.2.1.8 PS SGMII DTs (ZynqMP only)
- 4.2.2 PHY reset via GPIO
- 4.2.1 Device-tree quick guide
- 5 Performance
- 5.1 Zynq
- 5.2 ZynqMP
- 5.3 Versal
- 5.4 Versal2 - MMI 10G
- 6 Test Procedure
- 6.1 Diagnostic and Protocol Tests
- 6.1.1 Ping
- 6.1.2 Web server
- 6.1.3 Telnet
- 6.1.4 FTP and TFTP
- 6.1.5 Packet generator
- 6.2 Performance Tests
- 6.3 Stress Tests
- 6.3.1 Iperf dual-test mode
- 6.3.2 Ping flood test
- 6.4 Flow Control using ethtool
- 6.5 PTP
- 6.6 Time-Sensitive Networking (TSN)
- 6.6.1 Credit-Based Shaper (IEEE 802.1Qav)
- 6.6.1.1 Kernel Configuration
- 6.6.1.2 Root filesystem requirements
- 6.6.1.3 Demo Overview
- 6.6.1 Credit-Based Shaper (IEEE 802.1Qav)
- 6.7 Time-Aware Shaper (IEEE 802.1Qbv)
- 6.7.1 Kernel Configuration
- 6.7.2 Demo Overview
- 6.1 Diagnostic and Protocol Tests
- 7 Mainline Status
- 8 PHY details
- 9 Change Log
- 9.1 2026.1
- 9.1.1 New Features
- 9.1.2 Refactoring / Maintenance
- 9.2 Older Releases
- 9.1 2026.1
- 10 Related Links
HW IP Features
Speed support for 10/100/1000 Mbps
MAC loopback and PHY loopback
Partial store and forward option
Packet buffer option
Flow control - TX/RX pause
Checksum offload support, CRC checking, FCS stripping
Promiscuous mode, Broadcast mode
Collision detection and enforcement - this is an IP feature, no SW support required
MDIO support for PHY layer management
Multicasting support
VLAN tagged frames
Half duplex support
Programmable IPG
External FIFO interface
Wake on LAN
IEEE1588 support for ZynqMP, Versal and Versal Gen 2
HW timestamping - please refer to the respective TRM for detailed list of packets supported. PTP one-step Sync is supported only with L2 packets.
Jumbo frame size support for ZynqMP, Versal and Versal Gen 2
64 bit addressing for ZynqMP, Versal and Versal Gen 2
Priority queue support for ZynqMP, Versal and Versal Gen 2
Screeing support ZynqMP, Versal and Versal Gen 2
PS 1000BASE-x SGMII support (hardwired to 1Gbps) is present in ZynqMP
MMI 10GbE
1000/2500Mbps Ethernet MAC (1000BASE-X PCS)
High speed 5G/10G MAC (10GBASE-R PCS)
Features Supported in Driver
(Functional HW IP and stack related features)
Speed support for 10/100/1000 Mbps with clock framework
MMI 10GbE supporting 1000/10G speeds with SFP.
Packet buffer option
Checksum offload support, CRC checking, FCS stripping
MDIO support for PHY layer management
Multicasting support
Programmable IPG
IEEE1588 support for ZynqMP, Versal and Versal Gen 2
Jumbo frame size support for ZynqMP, Versal and Versal Gen 2
64 bit addressing for ZynqMP, Versal and Versal Gen 2
Priority queue support for ZynqMP, Versal and Versal Gen 2
PS SGMII support is present in ZynqMP and supported in the driver
This driver can be used with PL SGMII/1000BaseX driver on Zynq, ZynqMP, Versal and Versal Gen 2
This driver can be used with gmii2rgmii converter driver
Support for EthTool queries
RX NAPI support
Clock adaptation on Zynq, ZynqMP and Versal
Runtime PM and suspend/resume supported on ZynqMP and Versal
Partial store and forward
Wake on LAN support using ARP and Magic packet on ZynqMP and Versal
Dynamic SGMII configuration support on Xilinx Zynq Ultrascale+MPSoC
Missing Features, Known Issues and Limitations
Important AR links
Build Flow
Kernel Configuration
Mandatory configs
CONFIG_ETHERNET
CONFIG_NET_VENDOR_CADENCE
CONFIG_MACB
CONFIG_NETDEVICES
CONFIG_HAS_DMA
Optional kernel configs
CONFIG_MACB_USE_HWSTAMP
Use IEEE 1588 hwstamp (only supported in ZynqMP and Versal) : This config option supports use of 1588 HW TSTAMP support
in ZynqMP & Versal and depends on MACB.
This option enables IEEE 1588 Precision Time Protocol (PTP) support for MACB.
Device-tree
Compatible strings
Device family | Compatible string | What it enables |
|---|---|---|
Zynq-7000 |
| Base GEM support for Zynq-7000 devices. |
ZynqMP |
| Jumbo frames, IEEE 1588, hardware timestamping, and ZynqMP-specific features. |
Versal |
| Jumbo frames, IEEE 1588, hardware timestamping, automatic flow control, 802.1AS, and Versal-specific features. |
Versal Gen 2 |
| MMI_10GbE support with jumbo frames, IEEE 1588, hardware timestamping, automatic flow control, 802.1AS, and Versal Gen 2-specific features. |
Compatible string of format "cdnx,XXXX" is deprecated.
For more details on phy bindings please refer "Documentation/devicetree/bindings/net/cdns,macb.yaml" (macb.txt in older version)
Sample Linux dt-node for gem0/gem1
gem0: ethernet@e000b000 {
compatible = "cdns,gem";
reg = <0xe000b000 0x1000>;
status = "okay";
interrupt-parent = <&gic>;
interrupts = <0 22 4>;
clocks = <&clkc 30>, <&clkc 30>, <&clkc 13>;
clock-names = "pclk", "hclk", "tx_clk";
#address-cells = <1>;
#size-cells = <0>;
phy-handle = <ðernet_phy>;
phy-mode = "rgmii-id";
ethernet_phy: ethernet-phy@7{
reg = <7>;
};
};Sample Linux dt-node for MMI_10GbE
mmi_10gbe: ethernet@ed920000 {
compatible = "amd,versal2-10gbe", "cdns,gem";
reg = <0 0xed920000 0 0x1000>;
interrupts = <0 164 4>, <0 164 4>, <0 164 4>, <0 164 4>;
clock-names = "pclk", "hclk", "tx_clk", "tsu_clk";
clocks = <&clk150>, <&clk150>, <&clk150>, <&clk250>;
status = "okay";
phy-mode = "10gbase-r";
fixed-link {
speed = <10000>;
full-duplex;
};
};Currently MMI_10GbE supports only 1G and 10G speeds with fixed link
Device-tree quick guide
Use this section as a checklist when creating or reviewing MACB/GEM device-tree nodes. Start with the MAC node and compatible string, then select the link model, PHY/MDIO arrangement, clocks, and any board-specific reset or tuning requirements.
Configuration area | Use when | Key properties / references |
|---|---|---|
Ethernet controller node | Defining the GEM/MAC instance. |
|
PHY node | External PHY is connected through MDIO. | Use |
Fixed link | MAC-to-MAC, SFP/no-MDIO, or MMI_10GbE fixed-speed designs. | Use |
Common MDIO | Multiple MACs share one MDIO controller. | Keep PHY nodes under the MDIO producer and point each MAC to the correct |
RGMII tuning | Board requires TX/RX delay insertion for RGMII. | Select the correct |
PHY reset | PHY requires reset sequencing through GPIO or MDIO bus reset. | Use the generic PHY/MDIO reset bindings and match reset polarity/timing to the PHY data sheet. |
Ethernet DT
Generic Ethernet controller binding: ethernet-controller.yaml
Use this binding to validate common MAC properties such as
phy-mode,phy-handle,fixed-link, MAC address properties, and queue-related properties.
PHY DT
PHY binding reference: ethernet-phy.yaml
For normal PHYs, prefer the mandatory
regproperty to describe the PHY address. Linux identifies Ethernet PHYs using PHY identifier registers and the MDIO address.Add a PHY compatible string only when the PHY reports an incorrect identifier or needs a specific initialisation sequence. If used, follow the documented
ethernet-phy-id....pattern in the binding.When selecting PHY-specific settings, explicitly describe the interface type, any fixed/limited speed, and the PHY address.
Xilinx converter and PHY DT
PHY/Converter devices that may be used with this MAC:
Device | When to use | Binding |
|---|---|---|
Xilinx GMII2RGMII converter | Use when a GMII MAC interface is converted to RGMII. | |
Xilinx PCS PMA PHY | Use for PL SGMII / 1000BASE-X PCS/PMA based designs. |
RGMII Tuning in DT
Rule of thumb: choose the phy-mode value that matches where the RGMII delay is inserted on your board.
| Delay behaviour | Use when |
|---|---|---|
| PHY inserts both TX and RX internal delays. | Most RGMII boards that need both delays. |
| PHY inserts TX delay only. | RX delay is already handled by board routing or another component. |
| PHY inserts RX delay only. | TX delay is already handled by board routing or another component. |
Some PHYs also expose delay values through device-tree properties. Refer to the specific PHY binding and tune the values according to board timing requirements.
GEM does not provide device-tree controlled RGMII TX/RX delay tuning. For most RGMII boards, configure the required delay in the PHY using one of the rgmii-* modes above.
TSU clock in DT
Clock adaptation is enabled by default for all supported device families.
Use the device-tree clock bindings and the relevant platform wiki pages to define the reference clocks.
ZynqMP and Versal also support
tsu_clkadaptation in addition to the other reference clocks.
Fixed link DT
Use fixed link for MAC-to-MAC connections, SFP/no-MDIO designs, or other designs where link parameters are not discovered through a PHY.
Define the
fixed-linknode using the generic Ethernet controller binding: ethernet-controller.yaml fixed-link reference.Specify the intended speed and duplex explicitly, for example
speed = <1000>orspeed = <10000>withfull-duplex.
Common MDIO DT
Use this pattern when multiple GEM instances share one MDIO bus. Keep the MDIO bus and PHY nodes under the GEM instance that owns the MDC/MDIO pins, then reference the required PHY from each MAC using phy-handle.
gem0 {
......
phy-handle = <&phya>;
mdio {
phya {
reg = <0xa>;
};
phyb {
reg = <0xb>;
};
};
};
gem1 {
.....
phy-handle = <&phyb>;
};Item | Meaning |
|---|---|
| MDIO producer. Its MDC/MDIO lines are connected to both PHYs. |
| PHY used by |
| PHY used by |
For versions upto 2022.1, gem0 needs to come up before gem1 and stay up (because the MDIO interface is expected to be up first; otherwise, the dependent MAC-PHY link (gem1-phyb) will come up on next ifconfig up/down).
As a result of this gem0's runtime PM will not be effective if gem1 is still active in this configuration.
For versions starting 2022.2, probe order and PM suspend/resume order is automatically handled in the driver based on MDIO producer and consumer.
PS SGMII DTs (ZynqMP only)
Use PS SGMII only on ZynqMP. Choose one of the following models based on whether Linux can access the SGMII PHY over MDIO.
Model | Use when | Device-tree approach | Driver behaviour |
|---|---|---|---|
SGMII PHY over MDIO | The SGMII PHY is accessible through MDIO. | Set | Linux phylib performs PHY autonegotiation. The GEM PCS also negotiates and reports link status through |
SGMII fixed link | No MDIO access is available, or SFPs are used. | Set | PCS autonegotiation is disabled. |
gem0 {
......
phy-mode = <sgmii>;
phy-handle = <&phya>;
phya {
reg = <0xa>;
};
};For releases before 2022.1, refer to the Important AR links section for PS SGMII fixed-link guidance.
PHY reset via GPIO
For boards that require PHY reset through GPIO, use the generic PHY reset properties documented in ethernet-phy.yaml.
The same framework supports multiple PHYs with independent GPIO resets.
If reset must happen before PHY detection, use the MDIO bus reset provision documented in mdio.yaml.
Always verify reset polarity, assert duration, and post-deassert delay in the PHY data sheet before encoding these values in the device tree.
→ For boards which require a PHY reset via GPIO, please see the generic framework provisions here: https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/net/ethernet-phy.yaml#L141
This can be used for multiple PHYs with independent GPIO resets as well.
→ If reset is required before PHY detection, please see the MDIO bus provision here: https://github.com/Xilinx/linux-xlnx/blob/master/Documentation/devicetree/bindings/net/mdio.yaml#L30
→ When using PHY reset via GPIO, please check manufacturer specific datasheet for the reset polarity, reset assert duration and post de-assert delay for PHY to be functional. These values can then be passed to PHY and MDIO framework via Devicetree documentation above.
Complete device-tree node example
The following example shows a complete GEM device-tree node for a typical RGMII design with an external PHY on the local MDIO bus. Update the base address, interrupts, clocks, PHY address, reset GPIO, and delay values to match the target board.
/* Example: ZynqMP GEM connected to an external RGMII PHY */
&gem0 {
compatible = "xlnx,zynqmp-gem", "cdns,gem";
status = "okay";
reg = <0x0 0xff0b0000 0x0 0x1000>;
interrupt-parent = <&gic>;
interrupts = <0 57 4>;
clocks = <&zynqmp_clk 31>, <&zynqmp_clk 31>, <&zynqmp_clk 45>, <&zynqmp_clk 44>;
clock-names = "pclk", "hclk", "tx_clk", "tsu_clk";
phy-mode = "rgmii-id";
phy-handle = <&gem0_phy>;
#address-cells = <1>;
#size-cells = <0>;
mdio {
#address-cells = <1>;
#size-cells = <0>;
gem0_phy: ethernet-phy@7 {
reg = <7>;
reset-gpios = <&gpio 12 0>;
reset-assert-us = <10000>;
reset-deassert-us = <30000>;
};
};
};Field to customise | What to check |
|---|---|
| Use the device-family specific string from the compatible strings table above. |
| Match the GEM instance base address and interrupt number from the SoC/device-tree include file. |
| Keep the order aligned with the MACB binding. Add |
| Select |
| Use |
| Include only when the board requires PHY reset through GPIO. Verify polarity and timing from the PHY data sheet. |
Performance
By connecting Xilinx boards to Linux PCs and server machines (Ubuntu/Red Hat Enterprise), these benchmark performance figures were acquired.
Netperf is the tool used (see tool details below).
Netperf/netserver settings allow you to choose the protocol, MTU size, and CPU load note option.
Zynq
Board: ZC706 | CPU: 666 MHz (A9) | Link: 1 Gbps, full duplex
Linux | MTU | TCP TX | TCP TX CPU | TCP RX | TCP RX CPU | UDP TX | UDP TX CPU | UDP RX | UDP RX CPU |
|---|---|---|---|---|---|---|---|---|---|
6.6 | 1500 | 728.76 Mbps | 97.29% | 548.70 Mbps | 95.96% | 565.6 Mbps | 65.00% | 444.8 Mbps | 99.55% |
5.4+ | 1500 | 654.79 Mbps | 93.11% | 737.63 Mbps | 81.43% | 486.8 Mbps | 63.56% | 303 Mbps | 96.23% |
5.10 | 1500 | 675.79 Mbps | 90.68% | 759.22 Mbps | 86.45% | 455.0 Mbps |