iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.33k stars 3.85k forks source link

The latest bpf_map_type list #2460

Open hi-glenn opened 5 years ago

hi-glenn commented 5 years ago

I want to use af_xdp feature with gobpf.

The is the latest bpf_map_type list. Would you have a plan to supplement this list in bcc ?

enum bpf_map_type { BPF_MAP_TYPE_UNSPEC, BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_STACK_TRACE, BPF_MAP_TYPE_CGROUP_ARRAY, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH, BPF_MAP_TYPE_LPM_TRIE, BPF_MAP_TYPE_ARRAY_OF_MAPS, BPF_MAP_TYPE_HASH_OF_MAPS, BPF_MAP_TYPE_DEVMAP, BPF_MAP_TYPE_SOCKMAP, BPF_MAP_TYPE_CPUMAP, BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKHASH, BPF_MAP_TYPE_CGROUP_STORAGE, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK, BPF_MAP_TYPE_SK_STORAGE, };

The following is that the bcc currently is supporting bpf_map_type list.

  1. BPF_TABLE
  2. BPF_HASH
  3. BPF_ARRAY
  4. BPF_HISTOGRAM
  5. BPF_STACK_TRACE
  6. BPF_PERF_ARRAY
  7. BPF_PERCPU_ARRAY
  8. BPF_LPM_TRIE
  9. BPF_PROG_ARRAY
  10. BPF_DEVMAP
  11. BPF_CPUMAP
yonghong-song commented 5 years ago

We can add support for missing maps based on demand. Which ones do you need specifically? Maybe you can help add them? There are examples about how to add it

commit 6ce918bd7030241f0598ee6b1107940bf8480085
Author: Sebastiano Miano <mianosebastiano@gmail.com>
Date:   Thu Sep 20 06:48:52 2018 +0200

    Add C++ api support for devmap (#1979)

    Adds the support for the DEVMAP in the C++ APIs, which was missing in #1810
hi-glenn commented 5 years ago

The following three maps are badly needed . Especially the BPF_MAP_TYPE_XSKMAP . I want to use the feature of AF_XDP.

BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKMAP, BPF_MAP_TYPE_SOCKHASH,

I‘m not very familiar with C++ language and eBPF. Be Fear of introducing errors into the project. So I can‘t add them myself.

Thank you very much.

hi-glenn commented 5 years ago

We can add support for missing maps based on demand. Which ones do you need specifically? Maybe you can help add them? There are examples about how to add it

commit 6ce918bd7030241f0598ee6b1107940bf8480085
Author: Sebastiano Miano <mianosebastiano@gmail.com>
Date:   Thu Sep 20 06:48:52 2018 +0200

    Add C++ api support for devmap (#1979)

    Adds the support for the DEVMAP in the C++ APIs, which was missing in #1810

@yonghong-song Could you please help adding support for BPF_MAP_TYPE_XSKMAP map ?