Alexei Starovoitov 4e10df9a60 bpf: introduce bpf_skb_vlan_push/pop() helpers
Allow eBPF programs attached to TC qdiscs call skb_vlan_push/pop via
helper functions. These functions may change skb->data/hlen which are
cached by some JITs to improve performance of ld_abs/ld_ind instructions.
Therefore JITs need to recognize bpf_skb_vlan_push/pop() calls,
re-compute header len and re-cache skb->data/hlen back into cpu registers.
Note, skb->data/hlen are not directly accessible from the programs,
so any changes to skb->data done either by these helpers or by other
TC actions are safe.

eBPF JIT supported by three architectures:
- arm64 JIT is using bpf_load_pointer() without caching, so it's ok as-is.
- x64 JIT re-caches skb->data/hlen unconditionally after vlan_push/pop calls
  (experiments showed that conditional re-caching is slower).
- s390 JIT falls back to interpreter for now when bpf_skb_vlan_push() is present
  in the program (re-caching is tbd).

These helpers allow more scalable handling of vlan from the programs.
Instead of creating thousands of vlan netdevs on top of eth0 and attaching
TC+ingress+bpf to all of them, the program can be attached to eth0 directly
and manipulate vlans as necessary.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-20 20:52:31 -07:00
..
2015-05-23 10:49:55 +01:00
2015-04-21 16:16:02 -04:00
2015-06-23 13:35:47 +09:00
2015-07-01 16:26:08 +02:00
2015-06-01 10:45:51 +09:00
2015-05-13 15:43:00 -04:00
2015-05-25 13:25:35 -04:00
2015-06-19 17:15:24 +02:00
2015-05-05 13:40:44 -06:00
2015-06-01 10:25:37 -04:00
2015-04-23 15:16:14 -04:00
2015-06-05 10:58:34 -06:00
2015-05-24 12:49:16 -07:00
2015-06-11 23:37:37 +02:00
2015-06-03 14:17:38 +02:00