Latest commit 3051bf3 Feb 22, 2017 @torvalds Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:
 "Highlights:

   1) Support TX_RING in AF_PACKET TPACKET_V3 mode, from Sowmini
      Varadhan.

   2) Simplify classifier state on sk_buff in order to shrink it a bit.
      From Willem de Bruijn.

   3) Introduce SIPHASH and it's usage for secure sequence numbers and
      syncookies. From Jason A. Donenfeld.

   4) Reduce CPU usage for ICMP replies we are going to limit or
      suppress, from Jesper Dangaard Brouer.

   5) Introduce Shared Memory Communications socket layer, from Ursula
      Braun.

   6) Add RACK loss detection and allow it to actually trigger fast
      recovery instead of just assisting after other algorithms have
      triggered it. From Yuchung Cheng.

   7) Add xmit_more and BQL support to mvneta driver, from Simon Guinot.

   8) skb_cow_data avoidance in esp4 and esp6, from Steffen Klassert.

   9) Export MPLS packet stats via netlink, from Robert Shearman.

  10) Significantly improve inet port bind conflict handling, especially
      when an application is restarted and changes it's setting of
      reuseport. From Josef Bacik.

  11) Implement TX batching in vhost_net, from Jason Wang.

  12) Extend the dummy device so that VF (virtual function) features,
      such as configuration, can be more easily tested. From Phil
      Sutter.

  13) Avoid two atomic ops per page on x86 in bnx2x driver, from Eric
      Dumazet.

  14) Add new bpf MAP, implementing a longest prefix match trie. From
      Daniel Mack.

  15) Packet sample offloading support in mlxsw driver, from Yotam Gigi.

  16) Add new aquantia driver, from David VomLehn.

  17) Add bpf tracepoints, from Daniel Borkmann.

  18) Add support for port mirroring to b53 and bcm_sf2 drivers, from
      Florian Fainelli.

  19) Remove custom busy polling in many drivers, it is done in the core
      networking since 4.5 times. From Eric Dumazet.

  20) Support XDP adjust_head in virtio_net, from John Fastabend.

  21) Fix several major holes in neighbour entry confirmation, from
      Julian Anastasov.

  22) Add XDP support to bnxt_en driver, from Michael Chan.

  23) VXLAN offloads for enic driver, from Govindarajulu Varadarajan.

  24) Add IPVTAP driver (IP-VLAN based tap driver) from Sainath Grandhi.

  25) Support GRO in IPSEC protocols, from Steffen Klassert"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1764 commits)
  Revert "ath10k: Search SMBIOS for OEM board file extension"
  net: socket: fix recvmmsg not returning error from sock_error
  bnxt_en: use eth_hw_addr_random()
  bpf: fix unlocking of jited image when module ronx not set
  arch: add ARCH_HAS_SET_MEMORY config
  net: napi_watchdog() can use napi_schedule_irqoff()
  tcp: Revert "tcp: tcp_probe: use spin_lock_bh()"
  net/hsr: use eth_hw_addr_random()
  net: mvpp2: enable building on 64-bit platforms
  net: mvpp2: switch to build_skb() in the RX path
  net: mvpp2: simplify MVPP2_PRS_RI_* definitions
  net: mvpp2: fix indentation of MVPP2_EXT_GLOBAL_CTRL_DEFAULT
  net: mvpp2: remove unused register definitions
  net: mvpp2: simplify mvpp2_bm_bufs_add()
  net: mvpp2: drop useless fields in mvpp2_bm_pool and related code
  net: mvpp2: remove unused 'tx_skb' field of 'struct mvpp2_tx_queue'
  net: mvpp2: release reference to txq_cpu[] entry after unmapping
  net: mvpp2: handle too large value in mvpp2_rx_time_coal_set()
  net: mvpp2: handle too large value handling in mvpp2_rx_pkts_coal_set()
  net: mvpp2: remove useless arguments in mvpp2_rx_{pkts, time}_coal_set
  ...
Permalink
..
Failed to load latest commit information.
Makefile Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/… Dec 24, 2016
README.rst samples/bpf: Switch over to libbpf Dec 20, 2016
bpf_helpers.h bpf: xdp: Add XDP example for head adjustment Dec 8, 2016
bpf_load.c samples/bpf: Reset global variables Feb 13, 2017
bpf_load.h samples/bpf: Make samples more libbpf-centric Dec 15, 2016
cgroup_helpers.c samples, bpf: Refactor test_current_task_under_cgroup - separate out … Dec 3, 2016
cgroup_helpers.h samples, bpf: Refactor test_current_task_under_cgroup - separate out … Dec 3, 2016
fds_example.c samples/bpf: Move open_raw_sock to separate header Dec 20, 2016
lathist_kern.c bpf: BPF based latency tracing Jun 23, 2015
lathist_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
libbpf.h samples/bpf: Move open_raw_sock to separate header Dec 20, 2016
lwt_len_hist.sh bpf: Add tests and samples for LWT-BPF Dec 2, 2016
lwt_len_hist_kern.c bpf: Add tests and samples for LWT-BPF Dec 2, 2016
lwt_len_hist_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
map_perf_test_kern.c samples/bpf: add lpm-trie benchmark Jan 23, 2017
map_perf_test_user.c samples/bpf: add lpm-trie benchmark Jan 23, 2017
offwaketime_kern.c bpf, samples: don't zero data when not needed Apr 15, 2016
offwaketime_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
parse_ldabs.c bpf: fix samples to add fake KBUILD_MODNAME Oct 29, 2016
parse_simple.c bpf: fix samples to add fake KBUILD_MODNAME Oct 29, 2016
parse_varlen.c bpf: fix samples to add fake KBUILD_MODNAME Oct 29, 2016
sampleip_kern.c bpf/samples: Fix PT_REGS_IP on s390x and use it Nov 28, 2016
sampleip_user.c samples/bpf: Remove perf_event_open() declaration Dec 20, 2016
sock_example.c samples/bpf: Move open_raw_sock to separate header Dec 20, 2016
sock_example.h samples/bpf sock_example: Avoid getting ethhdr from two includes Dec 28, 2016
sock_flags_kern.c samples/bpf: add userspace example for prohibiting sockets Dec 2, 2016
sockex1_kern.c samples: bpf: add skb->field examples and tests Mar 16, 2015
sockex1_user.c samples/bpf: Move open_raw_sock to separate header Dec 20, 2016
sockex2_kern.c samples/bpf: fix sockex2 example Nov 24, 2016
sockex2_user.c samples/bpf: Move open_raw_sock to separate header Dec 20, 2016
sockex3_kern.c bpf samples: fix compiler errors with sockex2 and sockex3 Sep 27, 2016
sockex3_user.c samples/bpf: Move open_raw_sock to separate header Dec 20, 2016
spintest_kern.c samples/bpf: Enable powerpc support Apr 6, 2016
spintest_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
tc_l2_redirect.sh bpf: Add test for bpf_redirect to ipip/ip6tnl Nov 13, 2016
tc_l2_redirect_kern.c bpf: fix samples xdp_tx_iptunnel and tc_l2_redirect with fake KBUILD_… Jan 20, 2017
tc_l2_redirect_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
tcbpf1_kern.c bpf: fix samples to add fake KBUILD_MODNAME Oct 29, 2016
tcbpf2_kern.c bpf: fix samples to add fake KBUILD_MODNAME Oct 29, 2016
test_cgrp2_array_pin.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
test_cgrp2_attach.c bpf: introduce BPF_F_ALLOW_OVERRIDE flag Feb 13, 2017
test_cgrp2_attach2.c bpf: introduce BPF_F_ALLOW_OVERRIDE flag Feb 13, 2017
test_cgrp2_sock.c bpf: introduce BPF_F_ALLOW_OVERRIDE flag Feb 13, 2017
test_cgrp2_sock.sh samples: bpf: add userspace example for modifying sk_bound_dev_if Dec 2, 2016
test_cgrp2_sock2.c bpf: introduce BPF_F_ALLOW_OVERRIDE flag Feb 13, 2017
test_cgrp2_sock2.sh samples/bpf: add userspace example for prohibiting sockets Dec 2, 2016
test_cgrp2_tc.sh cgroup: bpf: Add an example to do cgroup checking in BPF Jul 1, 2016
test_cgrp2_tc_kern.c bpf: fix samples to add fake KBUILD_MODNAME Oct 29, 2016
test_cls_bpf.sh samples/bpf: add 'pointer to packet' tests May 6, 2016
test_current_task_under_cgroup_kern.c samples/bpf: Add test_current_task_under_cgroup test Aug 13, 2016
test_current_task_under_cgroup_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
test_ipip.sh samples/bpf: add comprehensive ipip, ipip6, ip6ip6 test Sep 17, 2016
test_lru_dist.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
test_lwt_bpf.c bpf: Add tests and samples for LWT-BPF Dec 2, 2016
test_lwt_bpf.sh bpf: Add tests and samples for LWT-BPF Dec 2, 2016
test_overhead_kprobe_kern.c samples/bpf: add tracepoint vs kprobe performance tests Apr 8, 2016
test_overhead_tp_kern.c samples/bpf: add tracepoint vs kprobe performance tests Apr 8, 2016
test_overhead_user.c samples/bpf: add tracepoint vs kprobe performance tests Apr 8, 2016
test_probe_write_user_kern.c samples/bpf: Add test/example of using bpf_probe_write_user bpf helper Jul 26, 2016
test_probe_write_user_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
test_tunnel_bpf.sh samples/bpf: extend test_tunnel_bpf.sh with IPIP test Sep 17, 2016
trace_event_kern.c bpf/samples: Fix PT_REGS_IP on s390x and use it Nov 28, 2016
trace_event_user.c samples/bpf: Remove perf_event_open() declaration Dec 20, 2016
trace_output_kern.c samples/bpf: fix trace_output example Apr 28, 2016
trace_output_user.c samples/bpf trace_output_user: Remove duplicate sys/ioctl.h include Dec 28, 2016
tracex1_kern.c bpf, samples: don't zero data when not needed Apr 15, 2016
tracex1_user.c samples/bpf: Add simple non-portable kprobe filter example Apr 2, 2015
tracex2_kern.c bpf, samples: don't zero data when not needed Apr 15, 2016
tracex2_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
tracex3_kern.c samples/bpf: update tracex[23] examples to use per-cpu maps Feb 6, 2016
tracex3_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
tracex4_kern.c samples/bpf: Enable powerpc support Apr 6, 2016
tracex4_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
tracex5_kern.c samples/bpf: Add missing header Feb 13, 2017
tracex5_user.c bpf samples: update tracex5 sample to use __seccomp_filter Sep 27, 2016
tracex6_kern.c bpf: fix build warnings and add function read_trace_pipe() Aug 12, 2015
tracex6_user.c samples/bpf: Remove perf_event_open() declaration Dec 20, 2016
xdp1_kern.c bpf: make xdp sample variable names more meaningful Jul 21, 2016
xdp1_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016
xdp2_kern.c bpf: make xdp sample variable names more meaningful Jul 21, 2016
xdp_tx_iptunnel_common.h bpf: xdp: Add XDP example for head adjustment Dec 8, 2016
xdp_tx_iptunnel_kern.c bpf: fix samples xdp_tx_iptunnel and tc_l2_redirect with fake KBUILD_… Jan 20, 2017
xdp_tx_iptunnel_user.c samples/bpf: Make samples more libbpf-centric Dec 15, 2016

README.rst

eBPF sample programs

This directory contains a test stubs, verifier test-suite and examples for using eBPF. The examples use libbpf from tools/lib/bpf.

Build dependencies

Compiling requires having installed:
  • clang >= version 3.4.0
  • llvm >= version 3.7.1

Note that LLVM's tool 'llc' must support target 'bpf', list version and supported targets with command: llc --version

Kernel headers

There are usually dependencies to header files of the current kernel. To avoid installing devel kernel headers system wide, as a normal user, simply call:

make headers_install

This will creates a local "usr/include" directory in the git/build top level directory, that the make system automatically pickup first.

Compiling

For building the BPF samples, issue the below command from the kernel top level directory:

make samples/bpf/

Do notice the "/" slash after the directory name.

It is also possible to call make from this directory. This will just hide the the invocation of make as above with the appended "/".

Manually compiling LLVM with 'bpf' support

Since version 3.7.0, LLVM adds a proper LLVM backend target for the BPF bytecode architecture.

By default llvm will build all non-experimental backends including bpf. To generate a smaller llc binary one can use:

-DLLVM_TARGETS_TO_BUILD="BPF"

Quick sniplet for manually compiling LLVM and clang (build dependencies are cmake and gcc-c++):

$ git clone http://llvm.org/git/llvm.git
$ cd llvm/tools
$ git clone --depth 1 http://llvm.org/git/clang.git
$ cd ..; mkdir build; cd build
$ cmake .. -DLLVM_TARGETS_TO_BUILD="BPF;X86"
$ make -j $(getconf _NPROCESSORS_ONLN)

It is also possible to point make to the newly compiled 'llc' or 'clang' command via redefining LLC or CLANG on the make command line:

make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang