Skip to content

Commit 6a8af8a

Browse files
committed
update and add new patches
1 parent be3ea09 commit 6a8af8a

3 files changed

Lines changed: 76 additions & 15 deletions

File tree

patch/cp/9.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@
8181
+REAL_FUNCTION_ALIGNMENT = $(CONFIG_FUNCTION_ALIGNMENT)
8282
+endif
8383
+KBUILD_CFLAGS += -falign-functions=$(REAL_FUNCTION_ALIGNMENT)
84-
+ifeq ($(shell expr $(CONFIG_FUNCTION_ALIGNMENT) \> 8), 1)
84+
+ifeq ($(shell expr $(CONFIG_FUNCTION_ALIGNMENT) \>= 8), 1)
8585
+KBUILD_CFLAGS += $(call cc-option, -fmin-function-alignment=8)
8686
+endif
87-
+ifeq ($(shell expr $(CONFIG_FUNCTION_ALIGNMENT) \> 23), 1)
87+
+ifeq ($(shell expr $(CONFIG_FUNCTION_ALIGNMENT) \>= 24), 1)
8888
+KBUILD_CFLAGS += $(call cc-option, -flimit-function-alignment)
8989
+endif
9090
endif

patch/cp/b3.patch

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
enum bbr_pacing_gain_phase {
5353
BBR_BW_PROBE_UP = 0, /* push up inflight to probe for bw/vol */
5454
@@ -235,26 +235,30 @@
55-
BBR_BW_PROBE_REFILL = 3, /* v2: refill the pipe again to 100% */
55+
BBR_BW_PROBE_REFILL = 3, /* refill the pipe again to 100% */
5656
};
5757

5858
+/* Avoid over pacing when app-limited in STARTUP, but still try to probe for more bandwidth.
@@ -185,7 +185,7 @@
185185

186186
/* Use fast path if app-limited, no loss/ECN, and target cwnd was reached? */
187187
static const bool bbr_fast_path = true;
188-
@@ -466,10 +470,17 @@
188+
@@ -469,10 +473,17 @@
189189
struct bbr *bbr = inet_csk_ca(sk);
190190
unsigned long rate = bbr_bw_to_pacing_rate(sk, bw, gain);
191191

@@ -204,34 +204,54 @@
204204
}
205205

206206
/* Return the number of segments BBR would like in a TSO/GSO skb, given a
207-
@@ -590,6 +601,26 @@
207+
@@ -576,6 +587,7 @@
208+
struct bbr *bbr = inet_csk_ca(sk);
209+
u32 bdp;
210+
u64 w;
211+
+ u32 minrtt = bbr->min_rtt_us;
212+
213+
/* If we've never had a valid RTT sample, cap cwnd at the initial
214+
* default. This should only happen when the connection is not using TCP
215+
@@ -583,16 +595,36 @@
216+
* ACKed so far. In this case, an RTO can cut cwnd to 1, in which
217+
* case we need to slow-start up toward something safe: initial cwnd.
218+
*/
219+
- if (unlikely(bbr->min_rtt_us == ~0U)) /* no valid RTT samples yet? */
220+
+ if (unlikely(minrtt == ~0U)) /* no valid RTT samples yet? */
221+
return bbr->init_cwnd; /* be safe: cap at initial cwnd */
222+
223+
- w = (u64)bw * bbr->min_rtt_us;
224+
+ w = (u64)bw * minrtt;
225+
226+
/* Apply a gain to the given value, remove the BW_SCALE shift, and
227+
* round the value up to avoid a negative feedback loop.
208228
*/
209229
bdp = (((w * gain) >> BBR_SCALE) + BW_UNIT - 1) / BW_UNIT;
210230

211-
+ if(bbr->min_rtt_us >= 180 * USEC_PER_MSEC) {
231+
+ if(minrtt >= 180 * USEC_PER_MSEC) {
212232
+ bdp += 8;
213233
+ bdp += bw >= 44738 ? 6 : 3;
214-
+ } else if(bbr->min_rtt_us >= 140 * USEC_PER_MSEC) {
234+
+ } else if(minrtt >= 140 * USEC_PER_MSEC) {
215235
+ bdp += 6;
216236
+ bdp += bw >= 44738 ? 5 : 2;
217-
+ } else if(bbr->min_rtt_us >= 90 * USEC_PER_MSEC) {
237+
+ } else if(minrtt >= 90 * USEC_PER_MSEC) {
218238
+ bdp += 5;
219239
+ bdp += bw >= 44738 ? 4 : 1;
220-
+ } else if(bbr->min_rtt_us >= 31 * USEC_PER_MSEC) {
240+
+ } else if(minrtt >= 31 * USEC_PER_MSEC) {
221241
+ bdp += 4;
222242
+ bdp += bw >= 44738 ? 3 : 1;
223-
+ } else if(bbr->min_rtt_us >= 16 * USEC_PER_MSEC) {
243+
+ } else if(minrtt >= 16 * USEC_PER_MSEC) {
224244
+ bdp += 2;
225245
+ bdp += bw >= 44738 ? 2 : 0;
226-
+ } else if(bbr->min_rtt_us >= 6 * USEC_PER_MSEC) {
246+
+ } else if(minrtt >= 6 * USEC_PER_MSEC) {
227247
+ bdp += 1;
228248
+ bdp += bw >= 44738 ? 1 : 0;
229249
+ }
230250
+
231251
return bdp;
232252
}
233253

234-
@@ -712,18 +743,27 @@
254+
@@ -715,18 +747,27 @@
235255
/* Update cwnd and enable fast path if cwnd reaches target_cwnd. */
236256
bbr->try_fast_path = 0;
237257
if (bbr_full_bw_reached(sk)) { /* only cut cwnd if we filled the pipe */
@@ -261,7 +281,7 @@
261281
done:
262282
tcp_snd_cwnd_set(tp, min(cwnd, tp->snd_cwnd_clamp)); /* global cap */
263283
if (bbr->mode == BBR_PROBE_RTT) /* drain queue, refresh min_rtt */
264-
@@ -942,10 +982,11 @@
284+
@@ -945,10 +986,11 @@
265285
static void bbr_update_gains(struct sock *sk)
266286
{
267287
struct bbr *bbr = inet_csk_ca(sk);
@@ -270,11 +290,11 @@
270290
switch (bbr->mode) {
271291
case BBR_STARTUP:
272292
- bbr->pacing_gain = bbr_param(sk, startup_pacing_gain);
273-
+ bbr->pacing_gain = READ_ONCE(tp->app_limited) ? bbr_param(sk, limited_pacing_gain) : bbr_param(sk, startup_pacing_gain);
293+
+ bbr->pacing_gain = tp->app_limited ? bbr_param(sk, limited_pacing_gain) : bbr_param(sk, startup_pacing_gain);
274294
bbr->cwnd_gain = bbr_param(sk, startup_cwnd_gain);
275295
break;
276296
case BBR_DRAIN:
277-
@@ -1078,8 +1119,8 @@
297+
@@ -1081,8 +1123,8 @@
278298
/* See if we should use ECN sender logic for this connection. */
279299
if (!bbr->ecn_eligible && bbr_can_use_ecn(sk) &&
280300
!!bbr_param(sk, ecn_factor) &&

patch/cp/tcp_p.patch

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--- a/net/ipv4/tcp_ipv4.c 2026-06-19 06:43:47.621409544 +0000
2+
+++ b/net/ipv4/tcp_ipv4.c 2026-06-19 07:10:32.148444865 +0000
3+
@@ -3501,7 +3501,7 @@
4+
5+
net->ipv4.tcp_death_row.hashinfo = hinfo;
6+
net->ipv4.tcp_death_row.sysctl_max_tw_buckets = ehash_entries / 2;
7+
- net->ipv4.sysctl_max_syn_backlog = max(128U, ehash_entries / 128);
8+
+ net->ipv4.sysctl_max_syn_backlog = max(224U, ehash_entries / 128);
9+
}
10+
11+
static int __net_init tcp_sk_init(struct net *net)
12+
@@ -3527,9 +3527,9 @@
13+
net->ipv4.sysctl_tcp_reordering = TCP_FASTRETRANS_THRESH;
14+
net->ipv4.sysctl_tcp_retries1 = TCP_RETR1;
15+
net->ipv4.sysctl_tcp_retries2 = TCP_RETR2;
16+
- net->ipv4.sysctl_tcp_orphan_retries = 0;
17+
+ net->ipv4.sysctl_tcp_orphan_retries = 1;
18+
net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT;
19+
- net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;
20+
+ net->ipv4.sysctl_tcp_notsent_lowat = 144 * 1024;
21+
net->ipv4.sysctl_tcp_tw_reuse = 2;
22+
net->ipv4.sysctl_tcp_tw_reuse_delay = 1 * MSEC_PER_SEC;
23+
net->ipv4.sysctl_tcp_no_ssthresh_metrics_save = 1;
24+
@@ -3544,7 +3544,7 @@
25+
net->ipv4.sysctl_tcp_recovery = TCP_RACK_LOSS_DETECTION;
26+
net->ipv4.sysctl_tcp_slow_start_after_idle = 1; /* By default, RFC2861 behavior. */
27+
net->ipv4.sysctl_tcp_retrans_collapse = 1;
28+
- net->ipv4.sysctl_tcp_max_reordering = 300;
29+
+ net->ipv4.sysctl_tcp_max_reordering = 400;
30+
net->ipv4.sysctl_tcp_dsack = 1;
31+
net->ipv4.sysctl_tcp_app_win = 31;
32+
net->ipv4.sysctl_tcp_adv_win_scale = 1;
33+
@@ -3604,7 +3604,7 @@
34+
35+
net->ipv4.sysctl_tcp_syn_linear_timeouts = 4;
36+
net->ipv4.sysctl_tcp_shrink_window = 0;
37+
- net->ipv4.sysctl_tcp_collapse_max_bytes = 0;
38+
+ net->ipv4.sysctl_tcp_collapse_max_bytes = 7549747;
39+
40+
net->ipv4.sysctl_tcp_pingpong_thresh = 1;
41+
net->ipv4.sysctl_tcp_rto_min_us = jiffies_to_usecs(TCP_RTO_MIN);

0 commit comments

Comments
 (0)