• Magnus Karlsson's avatar
    ice: Use xdp_buf instead of rx_buf for xsk zero-copy · 57f7f8b6
    Magnus Karlsson authored
    In order to use the new xsk batched buffer allocation interface, a
    pointer to an array of struct xsk_buff pointers need to be provided so
    that the function can put the result of the allocation there. In the
    ice driver, we already have a ring that stores pointers to
    xdp_buffs. This is only used for the xsk zero-copy driver and is a
    union with the structure that is used for the regular non zero-copy
    path. Unfortunately, that structure is larger than the xdp_buffs
    pointers which mean that there will be a stride (of 20 bytes) between
    each xdp_buff pointer. And feeding this into the xsk_buff_alloc_batch
    interface will not work since it assumes a regular array of xdp_buff
    pointers (each 8 bytes with 0 bytes in-between them on a 64-bit
    system).
    
    To fix this, remove the xdp_buff pointer from the rx_buf union and
    move it one step higher to the union above which only has pointers to
    arrays in it. This solves the problem and we can directly feed the SW
    ring of xdp_buff pointers straight into the allocation function in the
    next patch when that interface is used. This will improve performance.
    Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20210922075613.12186-4-magnus.karlsson@gmail.com
    57f7f8b6
ice_txrx.h 11.2 KB