diff options
| author | John Fastabend <john.fastabend@gmail.com> | 2017-10-18 10:10:36 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-10-20 08:01:29 -0400 |
| commit | 34f79502bbcfab659b8729da68b5e387f96eb4c1 (patch) | |
| tree | 27084757c315fdf13c682c3d6c57922ed5f8447c /tools/include/uapi/linux | |
| parent | 435bf0d3f99a164df7e8c30428cef266b91d1d3b (diff) | |
bpf: avoid preempt enable/disable in sockmap using tcp_skb_cb region
SK_SKB BPF programs are run from the socket/tcp context but early in
the stack before much of the TCP metadata is needed in tcp_skb_cb. So
we can use some unused fields to place BPF metadata needed for SK_SKB
programs when implementing the redirect function.
This allows us to drop the preempt disable logic. It does however
require an API change so sk_redirect_map() has been updated to
additionally provide ctx_ptr to skb. Note, we do however continue to
disable/enable preemption around actual BPF program running to account
for map updates.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/include/uapi/linux')
| -rw-r--r-- | tools/include/uapi/linux/bpf.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 43ab5c402f98..be9a631a69f7 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
| @@ -569,9 +569,10 @@ union bpf_attr { | |||
| 569 | * @flags: reserved for future use | 569 | * @flags: reserved for future use |
| 570 | * Return: 0 on success or negative error code | 570 | * Return: 0 on success or negative error code |
| 571 | * | 571 | * |
| 572 | * int bpf_sk_redirect_map(map, key, flags) | 572 | * int bpf_sk_redirect_map(skb, map, key, flags) |
| 573 | * Redirect skb to a sock in map using key as a lookup key for the | 573 | * Redirect skb to a sock in map using key as a lookup key for the |
| 574 | * sock in map. | 574 | * sock in map. |
| 575 | * @skb: pointer to skb | ||
| 575 | * @map: pointer to sockmap | 576 | * @map: pointer to sockmap |
| 576 | * @key: key to lookup sock in map | 577 | * @key: key to lookup sock in map |
| 577 | * @flags: reserved for future use | 578 | * @flags: reserved for future use |
