Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/probe.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <bpftune/bpftune.bpf.h>
#include "netns_tuner.h"
#include "tcp_cong_tuner.h"

/* probe hash map */
BPF_MAP_DEF(probe_hash_map, BPF_MAP_TYPE_HASH, __u64, __u64, 65536);
Expand All @@ -29,6 +30,25 @@ BPF_FENTRY(setup_net, struct net *net, struct user_namespace *user_ns)
return 0;
}

/* check BPF iterators work ad support getsockopt() */
#ifndef BPFTUNE_LEGACY
SEC("iter/tcp")
int probe_cong_iter(struct bpf_iter__tcp *ctx)
{
struct sock_common *skc = ctx->sk_common;
struct sock *sk = NULL;
char buf[CONG_MAXNAME] = {};

if (!skc)
return 0;
sk = (struct sock *)bpf_skc_to_tcp_sock(skc);
if (!sk)
return 0;
bpf_getsockopt(sk, SOL_TCP, TCP_CONGESTION, &buf, sizeof(buf));
return 0;
}
#endif

#ifdef BPFTUNE_LEGACY
SEC("raw_tracepoint/neigh_create")
#else
Expand Down
2 changes: 0 additions & 2 deletions src/tcp_cong_tuner.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

#include "tcp_cong_tuner.h"

#define CONG_MAXNAME 16

struct remote_host {
__u64 last_retransmit;
__u64 retransmits;
Expand Down
2 changes: 2 additions & 0 deletions src/tcp_cong_tuner.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ enum tcp_cong_scenarios {
TCP_CONG_HTCP,
};

#define CONG_MAXNAME 16

/* a long fat pipe is defined as having a BDP of > 10^5; it implies latency
* plus high bandwith. In such cases use htcp.
*/
Expand Down