1. 24 Mar, 2017 1 commit
  2. 23 Mar, 2017 36 commits
  3. 22 Mar, 2017 3 commits
    • David S. Miller's avatar
      Merge branch 'bpf-map-in-map' · 9bdf64d5
      David S. Miller authored
      Martin KaFai Lau says:
      
      ====================
      bpf: Add map-in-map support
      
      This patchset adds map-in-map support (map->map).
      One use case is the (vips -> webservers) in the L4 load balancer so
      that different vips can be backed by different set of webservers.
      
      Please refer to the individual commit log for details.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9bdf64d5
    • Martin KaFai Lau's avatar
      bpf: Add tests for map-in-map · fb30d4b7
      Martin KaFai Lau authored
      Test cases for array of maps and hash of maps.
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fb30d4b7
    • Martin KaFai Lau's avatar
      bpf: Add hash of maps support · bcc6b1b7
      Martin KaFai Lau authored
      This patch adds hash of maps support (hashmap->bpf_map).
      BPF_MAP_TYPE_HASH_OF_MAPS is added.
      
      A map-in-map contains a pointer to another map and lets call
      this pointer 'inner_map_ptr'.
      
      Notes on deleting inner_map_ptr from a hash map:
      
      1. For BPF_F_NO_PREALLOC map-in-map, when deleting
         an inner_map_ptr, the htab_elem itself will go through
         a rcu grace period and the inner_map_ptr resides
         in the htab_elem.
      
      2. For pre-allocated htab_elem (!BPF_F_NO_PREALLOC),
         when deleting an inner_map_ptr, the htab_elem may
         get reused immediately.  This situation is similar
         to the existing prealloc-ated use cases.
      
         However, the bpf_map_fd_put_ptr() calls bpf_map_put() which calls
         inner_map->ops->map_free(inner_map) which will go
         through a rcu grace period (i.e. all bpf_map's map_free
         currently goes through a rcu grace period).  Hence,
         the inner_map_ptr is still safe for the rcu reader side.
      
      This patch also includes BPF_MAP_TYPE_HASH_OF_MAPS to the
      check_map_prealloc() in the verifier.  preallocation is a
      must for BPF_PROG_TYPE_PERF_EVENT.  Hence, even we don't expect
      heavy updates to map-in-map, enforcing BPF_F_NO_PREALLOC for map-in-map
      is impossible without disallowing BPF_PROG_TYPE_PERF_EVENT from using
      map-in-map first.
      Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bcc6b1b7