Skip to content

Commit

Permalink
[Kernel Patch] Update BBRv3 Clang Patch (#63)
Browse files Browse the repository at this point in the history
patch: update bbrv3 clang patch
  • Loading branch information
Locietta authored May 18, 2024
1 parent 33d892f commit 11ae192
Showing 1 changed file with 13 additions and 30 deletions.
43 changes: 13 additions & 30 deletions 0003-bbrv3-fix-clang-build.patch
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
From ecf3ee230d503de7560c077fa7d6b2051eb6de50 Mon Sep 17 00:00:00 2001
From 06074b7af41c33b3b13a6d65859319fa81ba50d6 Mon Sep 17 00:00:00 2001
From: Locietta <locietta@qq.com>
Date: Fri, 12 Apr 2024 15:05:00 +0800
Subject: [PATCH v2] bbrv3: fix clang build
Date: Sat, 18 May 2024 10:33:58 +0800
Subject: [PATCH v3] bbrv3: fix clang build

* warns on `&&` with `bbr_param(sk, ecn_factor)` which expands to constant
* warns on functions without prototype
error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
The diagnosis is triggered by `&&` with `bbr_param(sk, ecn_factor)` which expands to constant.

Signed-off-by: Locietta <locietta@gmail.com>
---
net/ipv4/tcp_bbr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
net/ipv4/tcp_bbr.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
index c60d51bf7..c8053ffdb 100644
index cd6bef71b..6c8362eaa 100644
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
@@ -1077,7 +1077,7 @@ static int bbr_update_ecn_alpha(struct sock *sk)

/* See if we should use ECN sender logic for this connection. */
if (!bbr->ecn_eligible && bbr_can_use_ecn(sk) &&
- bbr_param(sk, ecn_factor) &&
+ !!bbr_param(sk, ecn_factor) &&
+ !!(bbr_param(sk, ecn_factor)) &&
(bbr->min_rtt_us <= bbr_ecn_max_rtt_us ||
!bbr_ecn_max_rtt_us))
bbr->ecn_eligible = 1;
Expand All @@ -28,37 +29,19 @@ index c60d51bf7..c8053ffdb 100644

if (rs->delivered_ce > 0 && rs->delivered > 0 &&
- bbr->ecn_eligible && bbr_param(sk, ecn_thresh)) {
+ bbr->ecn_eligible && !!bbr_param(sk, ecn_thresh)) {
+ bbr->ecn_eligible && !!(bbr_param(sk, ecn_thresh))) {
ecn_thresh = (u64)rs->delivered * bbr_param(sk, ecn_thresh) >>
BBR_SCALE;
if (rs->delivered_ce > ecn_thresh) {
@@ -1312,7 +1312,7 @@ static void bbr_bound_cwnd_for_inflight_model(struct sock *sk)
}

/* How should we multiplicatively cut bw or inflight limits based on ECN? */
-u32 bbr_ecn_cut(struct sock *sk)
+static u32 bbr_ecn_cut(struct sock *sk)
{
struct bbr *bbr = inet_csk_ca(sk);

@@ -1382,7 +1382,7 @@ static void bbr_adapt_lower_bounds(struct sock *sk,
return;

/* ECN response. */
- if (bbr->ecn_in_round && bbr_param(sk, ecn_factor)) {
+ if (bbr->ecn_in_round && !!bbr_param(sk, ecn_factor)) {
+ if (bbr->ecn_in_round && !!(bbr_param(sk, ecn_factor))) {
bbr_init_lower_bounds(sk, false);
bbr_ecn_lower_bounds(sk, &ecn_inflight_lo);
}
@@ -2033,7 +2033,7 @@ static bool bbr_run_fast_path(struct sock *sk, bool *update_model,
return false;
}

-__bpf_kfunc void bbr_main(struct sock *sk, const struct rate_sample *rs)
+__bpf_kfunc static void bbr_main(struct sock *sk, const struct rate_sample *rs)
{
struct tcp_sock *tp = tcp_sk(sk);
struct bbr *bbr = inet_csk_ca(sk);
--
2.44.0
2.45.1

0 comments on commit 11ae192

Please sign in to comment.