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