MDIO-NETLINK(9)

NAME
mdio-netlink - Netlink interface to MDIO buses

SYNOPSIS

    #include <linux/mdio-netlink.h>

DESCRIPTION
mdio-netlink provides a direct interface to communicate with devices on MDIO buses. In order to provide a race-free way to execute multiple reads/writes as an atomic transaction, the input is a program in byte code form that is executed within a virtual machine inside mdio-netlink. This is similar in spirit to how “channel programs” work on some mainframes. The VM has no stack or heap memory, only 8 16-bit general purpose registers and an implicit program counter. It provides a small set of instructions:

READ
    Read from MDIO/XMDIO device to register.

WRITE
    Write register or immediate value to MDIO/XMDIO device.

EMIT
    Emit the contents of a register or immediate value as an output of the program.

AND Store the bitwise AND of two operands to a register.

OR  Store the bitwise OR of two operands to a register.

ADD Store the sum of two operands to a register.

JEQ Add an immediate value to the program counter if two operands are equal.

JNE Add an immediate value to the program counter if two operands are not equal.

HISTORY
This improves on the traditional MDIO interface available to userspace programs in Linux in a few important ways:

•   MDIO buses are directly addressable. Previous solutions relied on at least one Ethernet PHY on the bus being attached to a net device, which is typically not the case when the device is an Ethernet switch for example.

•   Complex operations can be performed atomically. The old ioctl(2) interface only supported a single read or write of a single register. As a result, things like read/mask/write operations and accesses to paged PHYs could not be performed safely.

SEE ALSO
mdio(8)

AUTHORS
Tobias Waldekranz <tobias@waldekranz.com>