xref: /linux/tools/testing/selftests/bpf/progs/bpf_dctcp_release.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2021 Facebook */
3 
4 #include "bpf_tracing_net.h"
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_tracing.h>
7 
8 char _license[] SEC("license") = "GPL";
9 const char cubic[] = "cubic";
10 
11 SEC("struct_ops")
12 void BPF_PROG(dctcp_nouse_release, struct sock *sk)
13 {
14 	bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
15 		       (void *)cubic, sizeof(cubic));
16 }
17 
18 SEC(".struct_ops")
19 struct tcp_congestion_ops dctcp_rel = {
20 	.release	= (void *)dctcp_nouse_release,
21 	.name		= "bpf_dctcp_rel",
22 };
23