• Magnus Karlsson's avatar
    xsk: Optimize for aligned case · 94033cd8
    Magnus Karlsson authored
    Optimize for the aligned case by precomputing the parameter values of
    the xdp_buff_xsk and xdp_buff structures in the heads array. We can do
    this as the heads array size is equal to the number of chunks in the
    umem for the aligned case. Then every entry in this array will reflect
    a certain chunk/frame and can therefore be prepopulated with the
    correct values and we can drop the use of the free_heads stack. Note
    that it is not possible to allocate more buffers than what has been
    allocated in the aligned case since each chunk can only contain a
    single buffer.
    
    We can unfortunately not do this in the unaligned case as one chunk
    might contain multiple buffers. In this case, we keep the old scheme
    of populating a heads entry every time it is used and using
    the free_heads stack.
    
    Also move xp_release() and xp_get_handle() to xsk_buff_pool.h. They
    were for some reason in xsk.c even though they are buffer pool
    operations.
    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-7-magnus.karlsson@gmail.com
    94033cd8
xsk_buff_pool.h 6.36 KB