Macb Driver

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

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

Linux does not support loopback Flow control support is absent in the driver. While the IP can receive RX pause frames, it does not offer support for TX pause frames. External FIFO interface is not supported by the driver - this implementation is DMA based. The driver currently lacks interrupt support for PHY events, relying instead on a polling method for handling these events. No IEEE 1588 support for Zynq-7000 as the timestamp implementation in IP is not accurate enough. The timestamp generated during a PTP event is stored in a non-latching register, which means it gets overwritten each time a PTP event packet arrives. As a result, there is no reliable method to associate a specific timestamp with its corresponding packet. An application that employs synchronization, follow-up, PDelay requests, and PDelay responses within a sync cycle of one second may function without errors. However, its reliability is questionable. The synchronization process is likely to fail at the slightest deviation, such as when multiple PTP event packets are transmitted in the same direction consecutively, or when a short sync interval occurs in a high-traffic system. In such scenarios, the software may struggle to process the timestamp register before it gets overwritten. WOL is not compatible with warm restart designs due to the requirement of an RX BD scratch area that must remain accessible even during suspend mode. This functionality relies on OCM, which is secure in this design, thus presenting a limitation for this feature. A warning "unable to generate target frequency" is displayed during macb boot during multiple conditions. Please note the following scenarios and the validity of the warning: Clock source is from internal PLL with GEM in RGMII mode: warning is valid; please check your HW design and Devicetree clock entries Clock source is external and user defined: warning can be ignored as this clock is not controlled by CCF; but to avoid the warning, please ensure that the Devicetree clock entry for tx_clk points to a fixed clock node with the frequency that you are supplying Clock source is from an internal GT (applicable on ZU+ in SGMII mode only): warning can be ignored as the GT clock is already fixed at 125MHz; CCF has no provision to acquire this information or control this clock and hence this warning is displayed MMI_10GbE Currently, only fixed links with SFP are supported at 1G and 10G speeds. Users must update the speed in the device tree (dt), as dynamic speed selection is not supported. Direct access to MDIO from this IP is restricted. Users must utilise the GEM0 MDIO register to access the common MDIO lines. If using si570 clock generator as the reference for certain Ethernet designs (for ex., on ZCU102 with GEM + Soft PCS PMA), please check the generated frequency on board before and after loading the open source Linux driver for this component. Reprogramming this clock has led to loss of Ethernet functionality in such designs. Workarounds is to remove the si570 DT node from the devicetree.

Important AR links

WOL does not work on warm restart designs due to some limitations (2018.1/2/3) - AR-71028 PTP time adjustment encounters failure for a significant negative delta in versions 2018.1 and 2018.2, as documented in AR-71332. Zynq UltraScale+ MPSoC - SGMII with PCS/PMA core and external PHY - AR-71833 MACB MDIO bus support - Please find the patches for 2017.1, 2017.2, 2017.3, 2017.4, 2018.1, 2018.2 and 2018.3 at the AR - AR-69132 ZynqMP PS SGMII GT initialization and related - AR-68866 ZynqMP PS SGMII fixed link - AR-69769 (apllicable till 2021.2 release) TI PHY design on ZynqMP evaluation board has incorrect straps and can be remedied with a SW workaround (already implemented in drivers) - AR-70686 PL PCS PMA initialization in fsbl for Zynq and ZynqMP - refer to xapp1026 and xapp130 For custom Versal designs using AIE on 2020.1, make sure the low DDR region is accessible to LPD slaves (including GEM) using a workaround. There is a performance drop of approximately 100 Mbps between version 2020.1 (utilising the 5.4 Linux kernel) and version 2019.2 (utilising the 4.19 Linux kernel). This issue has been observed on both GEM and Axi Ethernet on Zynq. Currently, it is suspected that this drop is due to changes in the networking framework, and there is no workaround available at this time. Further updates will be documented in AR-75195. Macb + PL PCS PMA ifconfig down/up may fail without proper reset and clock reinitialization. Please refer to AR-72806. Timestamping issue in gPTP master mode (applicable only for 2022.2/2023.1) - AR-000035307 For full list of ARs, search XKB

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

Device family

Compatible string

What it enables

Zynq-7000

"xlnx,zynq-gem"

Base GEM support for Zynq-7000 devices.

ZynqMP

"xlnx,zynqmp-gem"

Jumbo frames, IEEE 1588, hardware timestamping, and ZynqMP-specific features.

Versal

"xlnx,versal-gem"

Jumbo frames, IEEE 1588, hardware timestamping, automatic flow control, 802.1AS, and Versal-specific features.

Versal Gen 2

"amd,versal2-10gbe"

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 = <&ethernet_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

Configuration area

Use when

Key properties / references

Ethernet controller node

Defining the GEM/MAC instance.

compatible, reg, interrupts, clocks, clock-names, phy-mode, phy-handle or fixed-link.

PHY node

External PHY is connected through MDIO.

Use reg for PHY address. Add a PHY compatible string only when required by the PHY binding.

Fixed link

MAC-to-MAC, SFP/no-MDIO, or MMI_10GbE fixed-speed designs.

Use fixed-link with explicit speed and duplex settings.

Common MDIO

Multiple MACs share one MDIO controller.

Keep PHY nodes under the MDIO producer and point each MAC to the correct phy-handle.

RGMII tuning

Board requires TX/RX delay insertion for RGMII.

Select the correct phy-mode: rgmii-id, rgmii-txid, or rgmii-rxid. GEM does not tune delays internally.

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 reg property 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

Device

When to use

Binding

Xilinx GMII2RGMII converter

Use when a GMII MAC interface is converted to RGMII.

xlnx,gmii-to-rgmii.yaml

Xilinx PCS PMA PHY

Use for PL SGMII / 1000BASE-X PCS/PMA based designs.

xilinx-phy.txt

RGMII Tuning in DT

Rule of thumb: choose the phy-mode value that matches where the RGMII delay is inserted on your board.

phy-mode

Delay behaviour

Use when

phy-mode

Delay behaviour

Use when

rgmii-id

PHY inserts both TX and RX internal delays.

Most RGMII boards that need both delays.

rgmii-txid

PHY inserts TX delay only.

RX delay is already handled by board routing or another component.

rgmii-rxid

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_clk adaptation 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-link node using the generic Ethernet controller binding: ethernet-controller.yaml fixed-link reference.

  • Specify the intended speed and duplex explicitly, for example speed = <1000> or speed = <10000> with full-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

Item

Meaning

gem0

MDIO producer. Its MDC/MDIO lines are connected to both PHYs.

phya

PHY used by gem0.

phyb

PHY used by gem1, but managed through the MDIO bus owned by gem0.

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

Model

Use when

Device-tree approach

Driver behaviour

SGMII PHY over MDIO

The SGMII PHY is accessible through MDIO.

Set phy-mode = "sgmii" and use phy-handle to reference the PHY node.

Linux phylib performs PHY autonegotiation. The GEM PCS also negotiates and reports link status through PCS_status.

SGMII fixed link

No MDIO access is available, or SFPs are used.

Set phy-mode = "sgmii" and use a fixed-link node instead of a PHY node.

PCS autonegotiation is disabled. PCS_status reports link up; read twice because of sticky bits. Supported from 2022.1 onwards.

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

Field to customise

What to check

compatible

Use the device-family specific string from the compatible strings table above.

reg and interrupts

Match the GEM instance base address and interrupt number from the SoC/device-tree include file.

clocks and clock-names

Keep the order aligned with the MACB binding. Add tsu_clk when IEEE 1588/PTP timestamp support is required and available.

phy-mode

Select rgmii-id, rgmii-txid, rgmii-rxid, sgmii, 1000base-x, or another supported mode based on the board connection.

phy-handle / fixed-link

Use phy-handle for an MDIO-managed PHY. Use fixed-link when there is no discoverable PHY.

reset-gpios and reset delays

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

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

62.95%

690.1 Mbps

82.99%

Linux 5.4 and later: Performance is about 10% lower than 2019.2 at 1500 MTU. The regression is linked to CONFIG_OPTIMIZE_INLINING being forcibly enabled in the kernel. This affects Zynq GEM and Xilinx AXI Ethernet drivers and is under discussion with mainline maintainers.

ZynqMP

Board: ZCU102 | CPU: 1100 MHz (A53) | Link: 1 Gbps, full duplex | DDR: 533 MHz | CCU: No

Linux

MTU

TCP TX

TCP TX CPU

TCP RX

TCP RX CPU

UDP TX

UDP TX CPU

UDP RX

UDP RX CPU

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

941.42 Mbps

5.0%

941.41 Mbps

54.94%

961.5 Mbps

20.3%

923.7 Mbps

22.07%

6.6

8192

988.04 Mbps

2.34%

989.06 Mbps

7.94%

992 Mbps

5.80%

992 Mbps

5.54%

Versal

Board: VCK190 | CPU: 1350 MHz (A72) | Link: 1 Gbps, full duplex | DDR: not specified | CCU: No

Linux

MTU

TCP TX

TCP TX CPU

TCP RX

TCP RX CPU

UDP TX

UDP TX CPU

UDP RX

UDP RX CPU

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

936.45 Mbps

9.67%

941.31 Mbps

50.67%

957 Mbps

42.9%

961.4 Mbps

50.34%

6.6

8192

982.42 Mbps

3.13%

989.06 Mbps

8.37%

991.9 Mbps

17.21%

991.9 Mbps

12.58%

Versal2 - MMI 10G

Board: VEK385 | CPU: 1866.647949 MHz (A78) | Link: 10 Gbps, full duplex | DDR: not specified | CCU: No

Linux

MTU

TCP TX

TCP TX CPU

TCP RX

TCP RX CPU

UDP TX

UDP TX CPU

UDP RX

UDP RX CPU

Linux

MTU

TCP TX

TCP TX CPU

TCP RX

TCP RX CPU

UDP TX

UDP TX CPU

UDP RX

UDP RX CPU

6.12

1500

9.36 Gbps

1.8%

9.37 Gbps

4.43%

4.11 Gbps

18.77%

5.84 Gbps

11.02%

6.12

9900

9.82 Gbps

2.88%

9.42 Gbps

3.02%

9.91 Gbps

6.5%

9.93 Gbps

5.45%

Test Procedure

Tip: Identify the Ethernet interface in Linux

Some hardware boards and designs, such as Versal Adaptive SoC platforms, may expose more than one Ethernet interface. A single device may also include both 1G and 10G interfaces that use the same MACB driver.

Use ethtool to identify the IP and driver capabilities:

ethtool <interface_name>

Check the driver name and, in particular, the reported Speed.

Diagnostic and Protocol Tests

Ping

Use ping to test whether a host is reachable over an IP network and to measure the round-trip time for packets sent from the source host to the destination host.

ping <remote_ip_address>

Web server

Connect the Zynq board to a Linux x86 host machine. Ensure that the web server is running on the Zynq board. From the host machine, open a web browser and enter the static IP address assigned to the Zynq board. The web page should load successfully.

Telnet

Ensure that the Telnet server is running on the board, then connect from the host machine:

telnet <server_ip_address>

FTP and TFTP

Open an FTP client on the host and connect to the Zynq board:

x86> ftp 192.168.1.10

Transfer a sufficiently large file, preferably several MB, using the mput command:

x86> mput <file_name>

The file transfer should complete without errors.

Packet generator

For details about running the Linux packet generator and its available options, refer to the kernel documentation: pktgen.txt.

Performance Tests

Netperf

# Start netserver on the server side netserver # Run these commands on the client taskset 2 ./netperf -H <server_ip> -t TCP_STREAM taskset 2 ./netperf -H <server_ip> -t UDP_STREAM # For more information, see: http://www.netperf.org/netperf/

Iperf

# Run these commands on the server ./iperf -s -u ./iperf -s # Run these commands on the client ./iperf -c <server_ip> -u -b <bandwidth> ./iperf -c <server_ip> # For more information, see: http://en.wikipedia.org/wiki/Iperf

Stress Tests

Iperf dual-test mode

Use the -d option to run iperf in dual-test mode. In this mode, the server connects back to the client on the port specified by -L, or on the client connection port by default. Both directions are tested simultaneously.

./iperf -c <server_ip> -d

Ping flood test

Use the -f option to send packets as quickly as possible. The command prints a period (.) for each packet sent and a backspace for each packet received.

ping -f localhost

Flow Control using ethtool

Flow control (IEEE 802.3x pause frames) is configured via the standard ethtool pause interface,
enabled by TX pause and RX pause.
Pause frames let a receiver throttle its link partner when RX buffers fill, preventing packet drops:
-- RX pause - the GEM honors incoming pause frames and stops transmitting.
-- TX pause - the GEM auto-generates pause frames toward the link partner based on RX SRAM watermark thresholds (GEM_RXWMARK).

# Enable both RX and TX pause, with pause autonegotiation ethtool -A <iface> rx on tx on autoneg on # Disable flow control entirely ethtool -A <iface> rx off tx off autoneg off # Force RX pause only (honor incoming pause frames, do not generate them) ethtool -A <iface> rx on tx off # Force TX pause only (generate pause frames, ignore incoming ones) ethtool -A <iface> rx off tx on # Display current pause frame (flow control) settings and negotiated capabilities ethtool -a <iface>

TX pause frame generation requires the MACB_CAPS_GEM_HAS_RXWMARK capability. When enabled, the hardware monitors the RX SRAM fill level and automatically generates pause frames based on configurable watermark thresholds defined in the RX_Watermark (GEM_RXWMARK) register.

When the RX SRAM fill level exceeds the configured high watermark threshold, the hardware transmits pause frames with a non-zero pause quantum to temporarily stop incoming traffic. Once the fill level drops below the low watermark threshold, the hardware sends a pause frame with a zero pause quantum to resume traffic reception.

The RX_Watermark register (GEM_RXWMARK) is currently supported only on Versal devices. On Versal, the default configuration uses:

  • Pause Quantum: 0x7FFF

  • High Watermark: 90% of RX SRAM capacity

  • Low Watermark: 50% of RX SRAM capacity

Since the RX_Watermark register is not available on ZynqMP and Zynq platforms, the MACB_CAPS_GEM_HAS_RXWMARK capability cannot be enabled for these device families. As a result, watermark-based pause frame generation is not supported, and only the pause quantum value can be configured.

PTP

IEEE 1588 synchronisation can be tested on ZynqMP, Versal, and Versal Gen 2 platforms using the open-source linuxptp application.

The setup requires a master device with accurate clock and timestamping capabilities, typically a Network Interface Card (NIC) or another IEEE 1588-compliant device.

# Run this command on the master ptp4l -i <interface_name> -m # Run this command on the DUT as the slave ptp4l -i <interface_name> -s -m

Time-Sensitive Networking (TSN)

TSN is supported only on Versal and Telluride devices.

Credit-Based Shaper (IEEE 802.1Qav)

The Credit-Based Shaper (IEEE 802.1Qav) regulates traffic transmission by pacing a traffic class instead of allowing bursts at line rate. A shaped queue accumulates credit at a configured idle slope and is permitted to transmit only while the credit remains non-negative. This mechanism ensures that the traffic stream adheres to its reserved bandwidth while preserving capacity for other traffic. It serves as a fundamental AVB/TSN component for controlling latency and jitter.

Kernel Configuration

# Enable the TC (Traffic Control) subsystem CONFIG_NET_SCHED=y CONFIG_NET_SCH_NETEM=y CONFIG_NET_SCH_TAPRIO=y CONFIG_NET_SCH_CBS=y CONFIG_NET_SCH_MQPRIO=y CONFIG_NET_SCH_MQPRIO_LIB=y CONFIG_NET_SCH_SKBPRIO=y # Kernel configs to enable classes and filters CONFIG_NET_CLS_ACT=y CONFIG_NET_SCH_INGRESS=y CONFIG_NET_CLS_BASIC=y CONFIG_NET_CLS_ROUTE4=y CONFIG_NET_CLS_FW=y CONFIG_NET_CLS_U32=y CONFIG_NET_CLS_FLOW=y CONFIG_NET_CLS_CGROUP=y CONFIG_NET_CLS_BPF=y CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=y CONFIG_NET_ACT_SKBEDIT=y

Root filesystem requirements

IMAGE_INSTALL:append = " netsniff-ng iperf3 iproute2-tc"

Demo Overview

This demo shows Credit-Based Shaper (CBS) hardware offload on a 10GbE interface using MQPRIO and TC flower filters. Traffic for TCP ports 5002 and 5004 is classified into separate hardware traffic classes and transmit queues. CBS applies to these queues to reserve and control bandwidth based on configured idleslope values. Using simultaneous iperf3 streams, the demo verifies that the MACB enforces bandwidth allocations in hardware, demonstrating traffic prioritization, shaping, and bandwidth reservation.

  • Complete PTP synchronisation before starting the TSN demo.

  • Target HW queue. Must be one of the top two: Queue A = num_queues-1, Queue B = num_queues-2; others are rejected.

# MMI 10GbE CBS Demo (MQPRIO + CBS HW Offload Validation) export IFACE="<MMI_10GBe_interface>" # Configure 4 traffic classes with dedicated HW TX queues tc qdisc add dev $IFACE parent root handle 100: mqprio num_tc 4 map 0 1 2 3 queues 1@0 1@1 1@2 1@3 # Enable packet classification on egress path tc qdisc add dev $IFACE clsact # Map TCP port 5002 traffic to TC2/Queue2 tc filter add dev $IFACE egress protocol ip prio 2 flower ip_proto tcp dst_port 5002 action skbedit priority 2 # Map TCP port 5004 traffic to TC3/Queue3 tc filter add dev $IFACE egress protocol ip prio 3 flower ip_proto tcp dst_port 5004 action skbedit priority 3 # Apply CBS shaping on TC2 (~625 Mbps reservation, HW offload enabled) tc qdisc add dev $IFACE parent 100:3 cbs idleslope 625000 offload 1 # Apply CBS shaping on TC3 (~1.55 Gbps reservation, HW offload enabled) tc qdisc add dev $IFACE parent 100:4 cbs idleslope 1550000 offload 1 # Launch iperf3 server on NIC iperf3 -s -p 5002 & iperf3 -s -p 5004 # Generate two competing traffic streams and observe CBS enforced bandwidth allocation iperf3 -c <server_ip> -b 10G -t 30 -p 5002 & iperf3 -c <server_ip> -b 10G -t 30 -p 5004 # Verify qdisc, filter, and CBS statistics tc qdisc show dev $IFACE tc filter show dev $IFACE egress tc -s qdisc show dev $IFACE # Cleanup configuration tc qdisc del dev $IFACE root tc qdisc del dev $IFACE clsact

Time-Aware Shaper (IEEE 802.1Qbv)

The Time-Aware Shaper (IEEE 802.1Qbv) governs traffic transmission by scheduling when each traffic class is allowed to send, rather than allowing all classes to compete at any time. Each queue is associated with a time-controlled gate that opens and closes based on a predefined schedule, and packets are transmitted only when the corresponding gate is open. This mechanism ensures that time-critical traffic is sent in reserved time windows while preventing interference from other traffic classes. It is a foundational TSN feature for achieving deterministic latency and minimizing jitter in scheduled traffic flows.

Kernel Configuration

# Enable the TC (Traffic Control) subsystem CONFIG_NET_SCHED=y CONFIG_NET_SCH_NETEM=y CONFIG_NET_SCH_TAPRIO=y CONFIG_NET_SCH_SKBPRIO=y # Kernel configs to enable classes and filters CONFIG_NET_CLS_ACT=y CONFIG_NET_SCH_INGRESS=y CONFIG_NET_CLS_BASIC=y CONFIG_NET_CLS_ROUTE4=y CONFIG_NET_CLS_FW=y CONFIG_NET_CLS_U32=y CONFIG_NET_CLS_FLOW=y CONFIG_NET_CLS_CGROUP=y CONFIG_NET_CLS_BPF=y CONFIG_NET_CLS_FLOWER=y CONFIG_NET_CLS_MATCHALL=y CONFIG_NET_ACT_SKBEDIT=y
Root filesystem requirements
IMAGE_INSTALL:append = " netsniff-ng iperf3 iproute2-tc"

Demo Overview

This demo configures time-aware scheduling for queues q0 and q1 using TAPRIO.
Packets are transmitted to each queue using iperf3, allowing you to observe and compare bandwidth allocation based on the configured time windows.

Complete PTP synchronisation before starting the TSN demo.

# Configure Time-Aware Scheduling (TAPRIO) export IFACE=<interface_name> # Configure TAPRIO to schedule two traffic classes (TC0, TC1) # - parent root: attach as the root qdisc # - handle 100: assign qdisc ID # - num_tc 2: define 2 traffic classes # - map 0 1: map traffic classes TC0 → queue0, TC1 → queue1 # - queues 1@0 1@1: one TX queue per traffic class # - base-time 500: schedule start time, in ns # - sched-entry S <gate-mask> <interval>: define time windows for each TC # * 0x1 -> TC0 gate open for 100000 ns # * 0x2 -> TC1 gate open for 50000 ns # - flags 2: enable full offload mode, if supported by the NIC tc qdisc replace dev $IFACE parent root handle 100 taprio \ num_tc 2 \ map 0 1 \ queues 1@0 1@1 \ base-time 500 \ sched-entry S 0x1 100000 \ sched-entry S 0x2 50000 \ flags 2 # Add a clsact qdisc to allow ingress and egress filtering tc qdisc add dev $IFACE clsact # Map high-priority TOS traffic (0xb8 = DSCP EF) to Queue 0 tc filter add dev $IFACE egress prio 1 protocol ip u32 \ match ip tos 0xb8 0xff \ action skbedit queue_mapping 0 # Map default TOS traffic (0x00) to Queue 1 tc filter add dev $IFACE egress prio 2 protocol ip u32 \ match ip tos 0x00 0xff \ action skbedit queue_mapping 1 # Display all qdisc details configured on the interface tc qdisc show dev $IFACE # Host/NIC: start the iperf3 server iperf3 -s # DUT/board: run iperf3 traffic for Queue 0 and Queue 1 iperf3 -c <server_ip> -u -b <bandwidth> -S 0xB8 -t 10 iperf3 -c <server_ip> -u -b <bandwidth> -S 0x00 -t 10 # Remove the clsact qdisc, which is the ingress and egress filter attachment point tc qdisc del dev $IFACE clsact # Remove the root qdisc, including TAPRIO or any other root qdisc tc qdisc del dev $IFACE root

To observe the timing behaviour, capture packets on the interface while running the iperf3 commands in parallel using &. Analyse the capture in Wireshark or a similar tool to confirm that packets are transmitted according to the configured time windows.

Mainline Status

The macb driver is in mainline kernel 6.18 with some patches from later kernels. The patches not yet in any mainline kernel are:

Patch Description

Patch Description

Minor differences in PCS PMA handling and GMII2RGMII handling

Minor patch in probe order for netdev registration and mii init

MMI 10Gbe support must be upstreamed.

TSN CBS support

Further changes will be upstreamed

PHY details

PHYs tested with PS GEM

TI DP83867IR
TI DP83867E (SGMII)
Marvell 88E1112
Marvell 88E1510/2
Realtek RTL8211
Vitesse VSC8211
Micrel KSZ9031
VSC8531_02

Change Log

2026.1

https://github.com/Xilinx/linux-xlnx/tree/xilinx-v2026.1/drivers/net/ethernet/cadence

New Features

Rebase Linux kernel to v6.18

TSN CBS (Credit-Based Shaper) TC offload

Adds IEEE 802.1Qav Credit-Based Shaper offload on GEM hardware, restricted to
the two highest-priority queues (Queue A = num_queues-1, Queue B =
num_queues-2). Idle-slope register value is computed per hardware variant
(high-speed GEM scales linearly to the full 32-bit range; standard GEM uses a
port-rate factor of 125 for 1G GMII / 250 for 10-100M MII). Validates that
idleslope is positive and within link speed.

MQPRIO qdisc hardware offload

Adds TC_SETUP_QDISC_MQPRIO offload via macb_setup_mqprio(), mapping traffic
classes to queues (netdev_set_num_tc() / netdev_set_tc_queue()). Advertises
TC_MQPRIO_HW_OFFLOAD_TCS; queue-count/overlap validation delegated to the
mqprio core via validate_queue_counts. Adds macb_tc_query_caps().

TX pause frame support

Adds automatic TX pause-frame generation using the RX watermark register
(GEM_RXWMARK). New capability flag MACB_CAPS_GEM_HAS_RXWMARK (register
presence is not DCFG-detectable). New macb_config fields: txpause_quantum,
rx_watermark_high_percent, rx_watermark_low_percent; thresholds computed at
probe from RX SRAM depth. Versal config: quantum 0x7FFF, high 90%, low 50%.

RX pause frame support + ethtool pause controls

Wires get_pauseparam/set_pauseparam ethtool callbacks to phylink
(ethtool -A/-a). On RX pause negotiation sets GEM_PAE (NCFGR[13]) and
GEM_DCPF (NCFGR[23]); clears them otherwise. Advertises MAC_SYM_PAUSE for
symmetric pause negotiation.

Refactoring / Maintenance

Move TC capability and PM checks to macb_setup_tc()

Moves the NETIF_F_HW_TC check and runtime-PM suspend guard from
macb_setup_taprio() into the common macb_setup_tc() entry point, since they
apply to all TC offload paths.

Rename MACB_CAPS_QBV to MACB_CAPS_TC

Generalizes the QBV-only capability flag into MACB_CAPS_TC to gate all TSN
traffic-class offloads routed through macb_setup_tc().

 

Older Releases

2025.2
Shutdown Operation Support A new shutdown handler has been added to ensure a clean and deterministic deactivation of the MACB controller during system shutdown or kexec transitions. Ensures proper network device teardown under rtnl_lock(). Prevents race conditions during device close/detach. Provides safer handover when booting a new kernel through kexec. 2.5GBASE-X Interface Mode Support The driver now supports the 2.5GBASE-X (2500BASE-X) PHY interface mode. Key updates include: New GEM_2PT5_G bit definition for NCR. PCSSEL + GEM_2PT5_G configuration added to MAC setup path. PCS control logic extended for 2.5GBASE-X. PCS selection updated to return phylink_usx_pcs for this mode. This enables MACB/GEM controllers to interoperate with 2.5Gbps SerDes-based PHYs. TAPRIO (IEEE 802.1Qbv) Time-Aware Scheduling Full TAPRIO hardware offload support has been added for MACB/GEM controllers, enabling Time-Sensitive Networking (TSN) capabilities. Core Features ENST (Enhanced Scheduled Traffic) register support: Per-queue timing registers: START_TIME, ON_TIME, OFF_TIME Centralized ENST_CONTROL gate-enable logic Timing conversion utilities for nanosecond → hardware units (speed-adaptive divisors for 10M/100M/1G) Hardware interval limit helpers to validate TC configurations TAPRIO Setup Implemented via tc qdisc replace using driver-level offload. Includes validation of: Gate masks and queue IDs Base time / entry intervals Cycle time consistency Hardware timing constraints TAPRIO ; Teardown tc qdisc destroy restores default state: Disables ENST Clears timing registers Resets queue configuration Infrastructure Updates New TAPRIO dispatcher (macb_setup_taprio) Integrated into TC_SETUP_QDISC_TAPRIO path Safe programming enforced by serialization and ENST disable/enable sequencing
2025.1 MMI 10GbE functionality has been integrated for Versal Gen2 platforms. 1000BASEX and 10GBASER speeds supported. 2024.2 No changes 2024.1 Summary: Upgrade to 6.6 kernel Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2024.1/drivers/net/ethernet/cadence 2023.2 Summary: Bugfixes from mainline to support pclk>160MHz and to fix PTP Timestamp failure due to packet padding Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2023.2/drivers/net/ethernet/cadence 2023.1 Summary: Fixes for macb SGMII wake source configuration Upgrade to 6.1 mainline version including minor updates around napi weight removal, macb phy PM support Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2023.1/drivers/net/ethernet/cadence 2022.2 Summary: Macb common MDIO bus enhancements in initialization and suspend/resume flows including SGMII phy handling. Fixes on ethtool WOL helper and inclusion of macb pad and fcs support for fragmented packets. PTP fixes on one step sync support and to add PTP TX timestamps for all packets in alignment with HWTSTAMP_TX_ON definition. Mainline fixes for TX restart handling under TXUBR conditions, compatible string prefix (deprecation of cdns to use xlnx) Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2022.2/drivers/net/ethernet/cadence 2022.1 Summary: Align with mainline 5.15 driver to use phylink and PCS functionality. Add support for (Internal) SGMII Dynamic Configuration support on Zynq Ultrascale+ MPSoC Minor bugfixes including fix for possible rotting packet in RX queue due to NAPI ordering. Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2022.1/drivers/net/ethernet/cadence 2021.2 No Changes 2021.1 Summary: New updates from 5.10 including phylink support. Minor bugfixes including DMA & coherent DMA mask handling, error handling for WOL ARP etc. Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2021.1/drivers/net/ethernet/cadence 2020.2 Summary: Minor bugfix for high memory DMA handling. Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2020.2/drivers/net/ethernet/cadence 2020.1 Summary: Minor bug fixes including Workaround for TSO IP errata on Versal GEM. Handle PHY reset for IPs such as PCS PMA phy. Increase halt timeout to accommodate 10Mbps. Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2020.1/drivers/net/ethernet/cadence 2019.2 Summary: Minor feature updates Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2019.2.01/drivers/net/ethernet/cadence 2019.1 Summary: Bug fixes and enhancements on top of 4.19 kernel Commits: https://github.com/Xilinx/linux-xlnx/commits/xilinx-v2019.1/drivers/net/ethernet/cadence acbe29b net: macb: Apply RXUBR workaround only to versions with errata 7caaf8e net: macb: Fix napi calls in macb_suspend/resume 235128d net: macb: Fix merge error in capabilities in config struct fee8215 net: macb: Remove repeated tasklet init 95977dd net: macb: Remove unused variables 41f029d net: macb: Remove repeated RBQP assignment 7193098 net: macb: Disable macb pad and fcs for fragmented packets 7d069bc net: macb: Sync RXUBR changes with mainline d77376c Revert "net: macb: Do not call PM sync in mdio helpers" d8dd5fe Revert "net: macb: Remove pm calls in mdio timeout function" f5520f1 macb: Sync PHY reset with mainline e5c7c2e net: macb: Add separate definition for PPM fraction 24e1145 net: macb: Fix SUBNS increment and increase resolution b10faf3 net: macb: Optimize reading HW timestamp e393646 net: macb: Add NULL check for PCLK and HCLK f22dab1 net: macb: Sync macb_config usage with mainline 9c71c6e net: macb: Change interrupt and napi enable order in open > 4.19 Mainline fixes pulled in: af3a961 net: ethernet: cadence: fix socket buffer corruption problem 65f81f2 net: macb: remove unnecessary code ea79ec6 net: macb: restart tx after tx used bit read aef9308 net: macb: fix random memory corruption on RX with 64-bit DMA 6b28540 net: macb: fix dropped RX frames due to a race db8102b net: macb: Check for SKBTX_HW_TSTAMP in macb driver 2018.3 Summary: Bug fixes and minor enhancements Commits: 9caf0ef net: macb: Fix BUG unregistering invalid mdiobus 86bbb72 net: macb: Use devicetree phy-handle if available 41bc0b5 net: macb: Fix warning about uninitialized phy_node 1e7f173 net: macb: Initialize bool to false instead of zero c5316f6 net: macb: Remove redundant ptp clock selection 0eddb82 macb: refactor the duplicate code to use a shared function 7b2d994 macb: Do not check for timeout when PHY is idle c241cc8 net: macb: Fix ptp time adjustment for large negative delta 43c7d00 net: macb: Increment rx bd head after allocating skb and buffer 835b617 net: macb: Process tx timestamp only on ptp packets d2b7486 net: macb: Do not call PM sync in mdio helpers f4eb775 net: macb: Fix phy path in macb resume 7b7c156 net: macb: Remove pm calls in mdio timeout function 2018.2 No changes 2018.1 Summary: Use mainline implementation of 64 bit addressing Use mainline implementation of PTP support Add clock management for tsu-clk Add WOL support for ZynqMP Commits: Sync with 4.14 mainline kernel 9aa7608 net: macb: Add tsu_clk property and use it e964800 net: macb: Add WOL support for ZynqMP 53ec68b net: macb: Fix GEM crash when suspend/resume plus down/up is done 2d522a5 net: macb: Remove older MACB_EXT_BD config option 617ea48 net: macb: Correct check for 64 bit addressing fa19565 net: macb: Add phy suspend and resume 95a33ee net: macb: Set rx mode in resume d7aa0c8 net: macb: Update macb RX tie-off descriptors e6fca01 net: macb: Remove unnecessary DBW read back from NWCFG 23d6b42 net: macb: Cleanup empty lines 2017.4 No changes 2017.3 Summary: Added support for partial store and forward Pulled in minor mainline fixes and phy related issues Added support for macb suspend/resume Commits: bf85fd4 net: macb: Add support for partial store and forward f646336 net: macb: Fix gpio for phy reset a29aa21 net: macb: Fix issues with FPD off e1a214d net: macb: Misc cleanup 2017.2 Summary: Pulled in a minor mainline fix for mdio bus scan error check Commits: 4356634 macb: fix mdiobus_scan() error check 2017.1 Summary: Added PM runtime support Added context loss support; Cleanup around clock and suspend, resume paths. Although this support is added in macb driver, there is a know issue at the moment that GEM does not work on resume directly. It is required to bring the interface down and up again. Fixed ptp time adjustment for large negative delta Fix PHY reset and only call GPIOD functions when valid GPIO is present Fixed spinlocks in macb_close around ptp_clock_unregister to avoid kernel panic. Fixed TSU CAPS mask Related phy driver changes: DP83867: Added a SW workaround for link instability on ZCU102 board. Commits: afeaf15 arm64: zynqmp: macb: release spinlock before calling ptp_clock_unregister 36f7baa net: macb: Correct TSU_CAPS mask 27f1c64 macb: fix PHY reset 7613445 net: macb: Only call GPIO functions if there is a valid GPIO 2288919 net: macb: Fix ptp time adjustment for large negative delta 6cbc5cd net: cadence: macb: Fix kernel-doc format ddd4804 net: macb: fix the clk enable and disable 1b0a659 net: macb: Add runtime support 4dc7d77 net: macb: Add context loss support b9a2910 net: macb: Fix the double disable of clocks 756de54 net: macb: Cleanup the clock code 2f2bb37 net: macb: Fix unused warning 911b158 net: macb: Enable clocks for the mdio accesses 25f7255 net: macb: Convert the infinite wait loop to a timeout 53ac032 net: macb: Move to runtime_put to cut clocks d415d56 net: macb: Update the phy write sequence DP83867 phy driver: 7557928 net: macb: SW workaround for link instability on DP83867 2016.4 Summary: Added support for fixed link Commits: 59e3534 net: macb: Add support for fixed link 2016.3 Summary: Added support for 64 bit addressing Added support to use gmii2rgmii converter driver Handle HRESP error with SW reset and re-initialization of necessary parameters The above changes are also in mainline Commits: b0fbcba net: macb: Handle HRESP error ff73646 net: macb: Fixed mixed declaration and code warnings 190b6af net: macb: Update TX and RX EXT BD registers only when required d470dfb net: macb: Correct CAPS masks 6121d00 net: macb: Add support for 64 bit addressing f9c43e8 net: macb: add support for mdio phy nodes

Related Links