From: Alexei Starovoitov Date: Thu, 26 Aug 2021 00:40:36 +0000 (-0700) Subject: Merge branch 'bpf: tcp: Allow bpf-tcp-cc to call bpf_(get|set)sockopt' X-Git-Tag: v5.15-rc1~157^2~22^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0584e965fb2517f41b7057ffa26f3b6e15a53754;p=thirdparty%2Flinux.git Merge branch 'bpf: tcp: Allow bpf-tcp-cc to call bpf_(get|set)sockopt' Martin KaFai says: ==================== This set allows the bpf-tcp-cc to call bpf_setsockopt. One use case is to allow a bpf-tcp-cc switching to another cc during init(). For example, when the tcp flow is not ecn ready, the bpf_dctcp can switch to another cc by calling setsockopt(TCP_CONGESTION). bpf_getsockopt() is also added to have a symmetrical API, so less usage surprise. v2: - Not allow switching to kernel's tcp_cdg because it is the only kernel tcp-cc that stores a pointer to icsk_ca_priv. Please see the commit log in patch 1 for details. Test is added in patch 4 to check switching to tcp_cdg. - Refactor the logic finding the offset of a func ptr in the "struct tcp_congestion_ops" to prog_ops_moff() in patch 1. - bpf_setsockopt() has been disabled in release() since v1 (please see commit log in patch 1 for reason). bpf_getsockopt() is also disabled together in release() in v2 to avoid usage surprise because both of them are usually expected to be available together. bpf-tcp-cc can already use PTR_TO_BTF_ID to read from tcp_sock. ==================== Signed-off-by: Alexei Starovoitov --- 0584e965fb2517f41b7057ffa26f3b6e15a53754