• Ong Boon Leong's avatar
    net: stmmac: Add initial XDP support · 5fabb012
    Ong Boon Leong authored
    This patch adds the initial XDP support to stmmac driver. It supports
    XDP_PASS, XDP_DROP and XDP_ABORTED actions. Upcoming patches will add
    support for XDP_TX and XDP_REDIRECT.
    
    To support XDP headroom, this patch adds page_offset into RX buffer and
    change the dma_sync_single_for_device|cpu(). The DMA address used for
    RX operation are changed to take into page_offset too. As page_pool
    can handle dma_sync_single_for_device() on behalf of driver with
    PP_FLAG_DMA_SYNC_DEV flag, we skip doing that in stmmac driver.
    
    Current stmmac driver supports split header support (SPH) in RX but
    the flexibility of splitting header and payload at different position
    makes it very complex to be supported for XDP processing. In addition,
    jumbo frame is not supported in XDP to keep the initial codes simple.
    
    This patch has been tested with the sample app "xdp1" located in
    samples/bpf directory for both SKB and Native (XDP) mode. The burst
    traffic generated using pktgen_sample03_burst_single_flow.sh in
    samples/pktgen directory.
    
    Changes in v3:
     - factor in xdp header and tail adjustment done by XDP program.
       Thanks to Jakub Kicinski for pointing out the gap in v2.
    
    Changes in v2:
     - fix for "warning: variable 'len' set but not used" reported by lkp.
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5fabb012
stmmac.h 8.04 KB