linux/include/uapi
Alexei Starovoitov 27b29f6305 bpf: add bpf_redirect() helper
Existing bpf_clone_redirect() helper clones skb before redirecting
it to RX or TX of destination netdev.
Introduce bpf_redirect() helper that does that without cloning.

Benchmarked with two hosts using 10G ixgbe NICs.
One host is doing line rate pktgen.
Another host is configured as:
$ tc qdisc add dev $dev ingress
$ tc filter add dev $dev root pref 10 u32 match u32 0 0 flowid 1:2 \
   action bpf run object-file tcbpf1_kern.o section clone_redirect_xmit drop
so it receives the packet on $dev and immediately xmits it on $dev + 1
The section 'clone_redirect_xmit' in tcbpf1_kern.o file has the program
that does bpf_clone_redirect() and performance is 2.0 Mpps

$ tc filter add dev $dev root pref 10 u32 match u32 0 0 flowid 1:2 \
   action bpf run object-file tcbpf1_kern.o section redirect_xmit drop
which is using bpf_redirect() - 2.4 Mpps

and using cls_bpf with integrated actions as:
$ tc filter add dev $dev root pref 10 \
  bpf run object-file tcbpf1_kern.o section redirect_xmit integ_act classid 1
performance is 2.5 Mpps

To summarize:
u32+act_bpf using clone_redirect - 2.0 Mpps
u32+act_bpf using redirect - 2.4 Mpps
cls_bpf using redirect - 2.5 Mpps

For comparison linux bridge in this setup is doing 2.1 Mpps
and ixgbe rx + drop in ip_rcv - 7.8 Mpps

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17 21:09:07 -07:00
..
asm-generic errno.h: Improve ENOSYS's comment 2015-04-17 09:03:58 -04:00
drm uapi/drm/i915_drm.h: fix userspace compilation. 2015-09-02 16:26:58 +03:00
linux bpf: add bpf_redirect() helper 2015-09-17 21:09:07 -07:00
misc cxl: Add alternate MMIO error handling 2015-08-18 19:34:43 +10:00
mtd mtd: lpddr: add driver for LPDDR2-NVM PCM memories 2014-05-20 17:45:17 -07:00
rdma IB/hfi1: Add PSM2 user space header to header_install 2015-09-03 15:29:52 -04:00
scsi cxlflash: Virtual LUN support 2015-08-26 18:05:39 -07:00
sound ASoC: Disable topology support for v4.2 2015-08-19 18:31:54 +02:00
video
xen xen/privcmd: Further s/MFN/GFN/ clean-up 2015-09-08 18:03:54 +01:00
Kbuild cxl: Add userspace header file 2014-10-08 20:15:57 +11:00