• John Fastabend's avatar
    bpf: sockmap, refactor sockmap routines to work with hashmap · e5cd3abc
    John Fastabend authored
    This patch only refactors the existing sockmap code. This will allow
    much of the psock initialization code path and bpf helper codes to
    work for both sockmap bpf map types that are backed by an array, the
    currently supported type, and the new hash backed bpf map type
    sockhash.
    
    Most the fallout comes from three changes,
    
      - Pushing bpf programs into an independent structure so we
        can use it from the htab struct in the next patch.
      - Generalizing helpers to use void *key instead of the hardcoded
        u32.
      - Instead of passing map/key through the metadata we now do
        the lookup inline. This avoids storing the key in the metadata
        which will be useful when keys can be longer than 4 bytes. We
        rename the sk pointers to sk_redir at this point as well to
        avoid any confusion between the current sk pointer and the
        redirect pointer sk_redir.
    Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
    Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    e5cd3abc
sockmap.c 44.9 KB