• brakmo's avatar
    bpf: add bpf helper bpf_skb_ecn_set_ce · f7c917ba
    brakmo authored
    
    
    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: default avatarLawrence Brakmo <brakmo@fb.com>
    Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Acked-by: default avatarSong Liu <songliubraving@fb.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    f7c917ba
bpf.h 118 KB