• Maciej Fijalkowski's avatar
    ice: xsk: check if Rx ring was filled up to the end · d1fc4c6f
    Maciej Fijalkowski authored
    __ice_alloc_rx_bufs_zc() checks if a number of the descriptors to be
    allocated would cause the ring wrap. In that case, driver will issue two
    calls to xsk_buff_alloc_batch() - one that will fill the ring up to the
    end and the second one that will start with filling descriptors from the
    beginning of the ring.
    
    ice_fill_rx_descs() is a wrapper for taking care of what
    xsk_buff_alloc_batch() gave back to the driver. It works in a best
    effort approach, so for example when driver asks for 64 buffers,
    ice_fill_rx_descs() could assign only 32. Such case needs to be checked
    when ring is being filled up to the end, because in that situation ntu
    might not reached the end of the ring.
    
    Fix the ring wrap by checking if nb_buffs_extra has the expected value.
    If not, bump ntu and go directly to tail update.
    
    Fixes: 3876ff52 ("ice: xsk: Handle SW XDP ring wrap and bump tail more often")
    Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
    Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
    Tested-by: default avatarShwetha Nagaraju <Shwetha.nagaraju@intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    d1fc4c6f
ice_xsk.c 25.8 KB