• Praveen Kaligineedi's avatar
    gve: Add AF_XDP zero-copy support for GQI-QPL format · fd8e4032
    Praveen Kaligineedi authored
    Adding AF_XDP zero-copy support.
    
    Note: Although these changes support AF_XDP socket in zero-copy
    mode, there is still a copy happening within the driver between
    XSK buffer pool and QPL bounce buffers in GQI-QPL format.
    In GQI-QPL queue format, the driver needs to allocate a fixed size
    memory, the size specified by vNIC device, for RX/TX and register this
    memory as a bounce buffer with the vNIC device when a queue is
    created. The number of pages in the bounce buffer is limited and the
    pages need to be made available to the vNIC by copying the RX data out
    to prevent head-of-line blocking. Therefore, we cannot pass the XSK
    buffer pool to the vNIC.
    
    The number of copies on RX path from the bounce buffer to XSK buffer is 2
    for AF_XDP copy mode (bounce buffer -> allocated page frag -> XSK buffer)
    and 1 for AF_XDP zero-copy mode (bounce buffer -> XSK buffer).
    
    This patch contains the following changes:
    1) Enable and disable XSK buffer pool
    2) Copy XDP packets from QPL bounce buffers to XSK buffer on rx
    3) Copy XDP packets from XSK buffer to QPL bounce buffers and
       ring the doorbell as part of XDP TX napi poll
    4) ndo_xsk_wakeup callback support
    Signed-off-by: default avatarPraveen Kaligineedi <pkaligineedi@google.com>
    Reviewed-by: default avatarJeroen de Borst <jeroendb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fd8e4032
gve_main.c 60.5 KB