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