OSDN Git Service

bpf: add bpf helper bpf_skb_ecn_set_ce
authorbrakmo <brakmo@fb.com>
Fri, 1 Mar 2019 20:38:46 +0000 (12:38 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 2 Mar 2019 18:48:27 +0000 (10:48 -0800)
commitf7c917ba11a67632a8452ea99fe132f626a7a2cc
tree6fd6f53d18bace334814e47970875eeea4ded599
parentb74e21ab7d438117a10d2d331bdfc275fcab2970
bpf: add bpf helper bpf_skb_ecn_set_ce

This patch adds a new bpf helper BPF_FUNC_skb_ecn_set_ce
"int bpf_skb_ecn_set_ce(struct sk_buff *skb)". It is added to
BPF_PROG_TYPE_CGROUP_SKB typed bpf_prog which currently can
be attached to the ingress and egress path. The helper is needed
because his type of bpf_prog cannot modify the skb directly.

This helper is used to set the ECN field of ECN capable IP packets to ce
(congestion encountered) in the IPv6 or IPv4 header of the skb. It can be
used by a bpf_prog to manage egress or ingress network bandwdith limit
per cgroupv2 by inducing an ECN response in the TCP sender.
This works best when using DCTCP.

Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/bpf.h
net/core/filter.c