• Niklas Söderlund's avatar
    nfp: xsk: add AF_XDP zero-copy Rx and Tx support · 6402528b
    Niklas Söderlund authored
    This patch adds zero-copy Rx and Tx support for AF_XDP sockets. It do so
    by adding a separate NAPI poll function that is attached to a each
    channel when the XSK socket is attached with XDP_SETUP_XSK_POOL, and
    restored when the XSK socket is terminated, this is done per channel.
    
    Support for XDP_TX is implemented and the XDP buffer can safely be moved
    from the Rx to the Tx queue and correctly freed and returned to the XSK
    pool once it's transmitted.
    
    Note that when AF_XDP zero-copy is enabled, the XDP action XDP_PASS
    will allocate a new buffer and copy the zero-copy frame prior
    passing it to the kernel stack.
    
    This patch is based on previous work by Jakub Kicinski.
    Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund@corigine.com>
    Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6402528b
nfp_net_xsk.c 14.1 KB