This is the driver for the MAC 10/100/1000 on-chip Ethernet controllers (Synopsys IP blocks); it has been released starting from the STLinux-2.3 distribution.
This network device driver is for all ST embedded MACs (710x/7200/71x1 platform based).

For the driver performances visit the following link

Driver introduction

Receive process

When one or more packets are received, an interrupt happens. The interrupts are not queued so the driver has to scan all the descriptors in the ring during the receive process.
This is based on NAPI so the interrupt handler only signals there is work to be done, and exits.
Then the poll method will be scheduled at some future point.
The incoming packets are stored, by the DMA, in a list of pre-allocated socket buffers in order to avoid, for big packet, the memcpy operation (zero-copy mechanism).

Transmit process

The xmit method is invoked when the kernel needs to transmit a packet; it sets the descriptors in the ring and informs the DMA engine that there is a packet ready to be transmitted.
Once the controller has finished transmitting the packet, an interrupt is triggered; So the driver will be able to releases the socket buffers.
By default, the driver sets the NETIF_F_SG bit in the features field of the net_device structure enabling the scatter/gather feature.

Kernel Configuration

The kernel configuration option is STMMAC_ETH:

Device Drivers ---> Network device support ---> Ethernet (1000 Mbit) ---> STMicroelectronics 10/100/1000 Ethernet driver (STMMAC_ETH)

STMMAC parameters

Below the list of the stmmac parameters adopted starting from the Kernel 2.6.23.17_stm-118:

  • debug: message level (0: no output, 16: all).
  • phyaddr: provide the physical address to the PHY device
  • dma_rxsize: DMA rx ring size.
  • dma_txsize: DMA tx ring size.
  • buf_sz: DMA buffer size.
  • tc: control the HW FIFO threshold.
  • tx_coe: Enable/Disable Tx Checksum Offload engine.
  • watchdog: transmit timeout (in milliseconds).
  • flow_ctrl: Flow control ability [on/off]
  • pause: Flow Control Pause Time.
  • minrx: copy only tiny frames (zero-copy).
  • tmrate: timer period.
  • rx_coalesce: : mitigate the number of rx interrupts.
  • tx_coalesce: mitigate the number of tx interrupts.
  • tmrate: timer period.

Command line options

Driver parameters can be also passed in command line by using: stmmaceth=phyaddr:<phy address> ...

Pay attention to modify the default values of these parameters. For example, passing a wrong phyaddr the drive open method could fail.

STMMAC as dynamic module

  • Compile the driver as kernel module (CONFIG_STMMAC_ETH=m).
  • On the target, insert both the physical and the stmmac modules as shown in the example below:
    target# insmod ste10Xp.ko
    STe100p: Registered new driver
    STe101p: Registered new driver
    target# insmod stmmac.ko
    STMMAC driver:
            platform registration... <6>done!
            MAC 10/100
            no valid MAC address; please, set using ifconfig or nwhwconfig!
    STMMAC MII Bus: probed
  • Configure the network interface:
    target# ifconfig eth0 hw ether 00:80:E1:12:26:16
    target# ifconfig eth0 192.168.1.2 up
    stmmac_timer: rtc0 Timer ON (freq 256Hz)
    PHY: 0:0e - Link is Up - 100/Full

Notes

  • MAC address must be provided by using the NWHWCONF support.
  • Parameters for old driver versions:
    stmmaceth=msglvl:<debug_msg_level>, phyaddr:<phy_address>, watchdog:<watchdog_value>,minrx:<rx_copybreak>, txsize:<dma_tx_size_param>, rxsize:<dma_rx_size_param>,flow_ctrl:<flow_ctrl>, pause:<pause>,tc:<threshold_ctrl>, txmit:<tx_aggregation>,rxmit:<rx_irq_mitigation>,
    where:
    • debug_msg_level: message level (0: no output, 16: all).
    • phy_address: physical Address number.
    • watchdog: transmit timeout (in milliseconds).
    • rx_copybreak: copy only tiny-frames (rx zero-copy).
    • dma_tx_size_param: DMA tx ring size.
    • dma_rx_size_param: DMA rx ring size.
    • flow_ctrl: Flow control ability [on/off]
    • pause: Flow Control Pause Time.
    • threshold_ctrl: DMAC Threshold ctrl.
    • tx_aggregation: mitigate the number of tx interrupts.
    • rx_aggregation: mitigate the number of rx interrupts (timer opt.).