Forum Discussion

torstein18's avatar
torstein18
Icon for New Contributor rankNew Contributor
6 days ago
Solved

XDP on agilex3

Hi I'm wondering if anybody have been able to implement XDP transmit on an agilex3 soc. As far as I understand the smmc driver should support the full XDP zero copy stack. But when I try to run an e...
  • Archer_Altera's avatar
    6 days ago

    Hi Torstein18,

    Stmmac does not implement a full zero‑copy TX path, even on recent kernels. The “few packets then stops” behavior you see is a classic symptom of that gap.

    mas-bandwidth/af_xdp/001 is a pure AF_XDP userspace TX loop.

    On stmmac, what typically happens:

    1. First packets go out (driver does a fallback copy or partial DMA)
    2. TX completion path never frees UMEM frames correctly
    3. TX ring fills up
    4. Kernel stops accepting new descriptors
    5. sendto() succeeds briefly, then silently stalls

    This is not a userspace bug in your example.

    For AF_XDP ZC TX, the driver must implement:

    ndo_xsk_wakeup

    ZC‑capable TX rings

    Correct UMEM lifetime handling

    What does work reliably is XDP_TX / XDP_REDIRECT from an XDP program, not AF_XDP userspace TX ZC.

    You may consider implementing below flow.

    FPGA → shared memory → XDP program → XDP_TX

    Key points:

    • FPGA writes packet buffers into shared memory (ensure cache coherency/IO-MMU mapping is correct).
    • CPU does NOT copy payload
    • XDP program simply sets headers and returns XDP_TX
    • No AF_XDP socket involved

    Hope this is helpful.

    Archer_Altera