Skip to content

Commit 85f4456

Browse files
Add IPv6 dhcp.lan.max_preferred_lifetime and dhcp.lan.max_valid_lifetime LuCI options
Refresh LRNG and BBRv3 patches Refresh IPv6 fixed patches Signed-off-by: Nicholas Sun <nicholas-sun@outlook.com>
1 parent 9ffb75b commit 85f4456

64 files changed

Lines changed: 794 additions & 558 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
From 0384efbd7b715430d9321a9645565a097e450a27 Mon Sep 17 00:00:00 2001
2+
From: Yuchung Cheng <ycheng@google.com>
3+
Date: Tue, 27 Mar 2018 18:33:29 -0700
4+
Subject: [PATCH 02/21] net-tcp_rate: consolidate inflight tracking approaches
5+
in TCP
6+
7+
In order to track CE marks per rate sample (one round trip), we'll
8+
need to snap the starting tcp delivered_ce acount in the packet
9+
meta header (tcp_skb_cb). But there's not enough space.
10+
11+
Good news is that the "last_in_flight" in the header, used by
12+
NV congestion control, is almost equivalent as "delivered". In
13+
fact "delivered" is better by accounting out-of-order packets
14+
additionally. Therefore we can remove it to make room for the
15+
CE tracking.
16+
17+
This would make delayed ACK detection slightly less accurate but the
18+
impact is negligible since it's not used for any critical control.
19+
20+
Effort: net-tcp_rate
21+
Origin-9xx-SHA1: ddcd46ec85d5f1c4454258af0c54b3254c0d64a7
22+
Change-Id: I1a184aad6d101c981ac7f2f275aa9417ff856910
23+
---
24+
include/net/tcp.h | 5 ++---
25+
net/ipv4/tcp_input.c | 11 +++++------
26+
net/ipv4/tcp_output.c | 2 --
27+
3 files changed, 7 insertions(+), 11 deletions(-)
28+
29+
--- a/include/net/tcp.h
30+
+++ b/include/net/tcp.h
31+
@@ -872,9 +872,8 @@ struct tcp_skb_cb {
32+
union {
33+
struct {
34+
/* There is space for up to 24 bytes */
35+
- __u32 in_flight:30,/* Bytes in flight at transmit */
36+
- is_app_limited:1, /* cwnd not fully used? */
37+
- unused:1;
38+
+ __u32 is_app_limited:1, /* cwnd not fully used? */
39+
+ unused:31;
40+
/* pkts S/ACKed so far upon tx of skb, incl retrans: */
41+
__u32 delivered;
42+
/* start of send pipeline phase */
43+
--- a/net/ipv4/tcp_input.c
44+
+++ b/net/ipv4/tcp_input.c
45+
@@ -3255,7 +3255,6 @@ static int tcp_clean_rtx_queue(struct so
46+
long seq_rtt_us = -1L;
47+
long ca_rtt_us = -1L;
48+
u32 pkts_acked = 0;
49+
- u32 last_in_flight = 0;
50+
bool rtt_update;
51+
int flag = 0;
52+
53+
@@ -3291,7 +3290,6 @@ static int tcp_clean_rtx_queue(struct so
54+
if (!first_ackt)
55+
first_ackt = last_ackt;
56+
57+
- last_in_flight = TCP_SKB_CB(skb)->tx.in_flight;
58+
if (before(start_seq, reord))
59+
reord = start_seq;
60+
if (!after(scb->end_seq, tp->high_seq))
61+
@@ -3357,8 +3355,8 @@ static int tcp_clean_rtx_queue(struct so
62+
seq_rtt_us = tcp_stamp_us_delta(tp->tcp_mstamp, first_ackt);
63+
ca_rtt_us = tcp_stamp_us_delta(tp->tcp_mstamp, last_ackt);
64+
65+
- if (pkts_acked == 1 && last_in_flight < tp->mss_cache &&
66+
- last_in_flight && !prior_sacked && fully_acked &&
67+
+ if (pkts_acked == 1 && fully_acked && !prior_sacked &&
68+
+ (tp->snd_una - prior_snd_una) < tp->mss_cache &&
69+
sack->rate->prior_delivered + 1 == tp->delivered &&
70+
!(flag & (FLAG_CA_ALERT | FLAG_SYN_ACKED))) {
71+
/* Conservatively mark a delayed ACK. It's typically
72+
@@ -3415,9 +3413,10 @@ static int tcp_clean_rtx_queue(struct so
73+
74+
if (icsk->icsk_ca_ops->pkts_acked) {
75+
struct ack_sample sample = { .pkts_acked = pkts_acked,
76+
- .rtt_us = sack->rate->rtt_us,
77+
- .in_flight = last_in_flight };
78+
+ .rtt_us = sack->rate->rtt_us };
79+
80+
+ sample.in_flight = tp->mss_cache *
81+
+ (tp->delivered - sack->rate->prior_delivered);
82+
icsk->icsk_ca_ops->pkts_acked(sk, &sample);
83+
}
84+
85+
--- a/net/ipv4/tcp_output.c
86+
+++ b/net/ipv4/tcp_output.c
87+
@@ -1253,8 +1253,6 @@ static int __tcp_transmit_skb(struct soc
88+
tp->tcp_wstamp_ns = max(tp->tcp_wstamp_ns, tp->tcp_clock_cache);
89+
skb->skb_mstamp_ns = tp->tcp_wstamp_ns;
90+
if (clone_it) {
91+
- TCP_SKB_CB(skb)->tx.in_flight = TCP_SKB_CB(skb)->end_seq
92+
- - tp->snd_una;
93+
oskb = skb;
94+
95+
tcp_skb_tsorted_save(oskb) {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From d97bc46a9d0a65cb72a226ef79f5c815d6b2659c Mon Sep 17 00:00:00 2001
2+
From: Yuchung Cheng <ycheng@google.com>
3+
Date: Tue, 27 Mar 2018 18:01:46 -0700
4+
Subject: [PATCH 03/21] net-tcp_rate: account for CE marks in rate sample
5+
6+
This patch counts number of packets delivered have CE mark in the
7+
rate sample, using similar approach of delivery accounting.
8+
9+
Effort: net-tcp_rate
10+
Origin-9xx-SHA1: 710644db434c3da335a7c8b72207a671ccbb5cf8
11+
Change-Id: I0968fb33fe19b5c774e8c3afd2685558a6ec8710
12+
---
13+
include/net/tcp.h | 6 +++++-
14+
net/ipv4/tcp_rate.c | 6 ++++++
15+
2 files changed, 11 insertions(+), 1 deletion(-)
16+
17+
--- a/include/net/tcp.h
18+
+++ b/include/net/tcp.h
19+
@@ -871,9 +871,11 @@ struct tcp_skb_cb {
20+
__u32 ack_seq; /* Sequence number ACK'd */
21+
union {
22+
struct {
23+
+#define TCPCB_DELIVERED_CE_MASK ((1U<<20) - 1)
24+
/* There is space for up to 24 bytes */
25+
__u32 is_app_limited:1, /* cwnd not fully used? */
26+
- unused:31;
27+
+ delivered_ce:20,
28+
+ unused:11;
29+
/* pkts S/ACKed so far upon tx of skb, incl retrans: */
30+
__u32 delivered;
31+
/* start of send pipeline phase */
32+
@@ -1025,7 +1027,9 @@ struct ack_sample {
33+
struct rate_sample {
34+
u64 prior_mstamp; /* starting timestamp for interval */
35+
u32 prior_delivered; /* tp->delivered at "prior_mstamp" */
36+
+ u32 prior_delivered_ce;/* tp->delivered_ce at "prior_mstamp" */
37+
s32 delivered; /* number of packets delivered over interval */
38+
+ s32 delivered_ce; /* number of packets delivered w/ CE marks*/
39+
long interval_us; /* time for tp->delivered to incr "delivered" */
40+
u32 snd_interval_us; /* snd interval for delivered packets */
41+
u32 rcv_interval_us; /* rcv interval for delivered packets */
42+
--- a/net/ipv4/tcp_rate.c
43+
+++ b/net/ipv4/tcp_rate.c
44+
@@ -65,6 +65,7 @@ void tcp_rate_skb_sent(struct sock *sk,
45+
TCP_SKB_CB(skb)->tx.first_tx_mstamp = tp->first_tx_mstamp;
46+
TCP_SKB_CB(skb)->tx.delivered_mstamp = tp->delivered_mstamp;
47+
TCP_SKB_CB(skb)->tx.delivered = tp->delivered;
48+
+ TCP_SKB_CB(skb)->tx.delivered_ce = tp->delivered_ce;
49+
TCP_SKB_CB(skb)->tx.is_app_limited = tp->app_limited ? 1 : 0;
50+
}
51+
52+
@@ -90,6 +91,7 @@ void tcp_rate_skb_delivered(struct sock
53+
if (!rs->prior_delivered ||
54+
tcp_skb_sent_after(tx_tstamp, tp->first_tx_mstamp,
55+
scb->end_seq, rs->last_end_seq)) {
56+
+ rs->prior_delivered_ce = scb->tx.delivered_ce;
57+
rs->prior_delivered = scb->tx.delivered;
58+
rs->prior_mstamp = scb->tx.delivered_mstamp;
59+
rs->is_app_limited = scb->tx.is_app_limited;
60+
@@ -143,6 +145,10 @@ void tcp_rate_gen(struct sock *sk, u32 d
61+
}
62+
rs->delivered = tp->delivered - rs->prior_delivered;
63+
64+
+ rs->delivered_ce = tp->delivered_ce - rs->prior_delivered_ce;
65+
+ /* delivered_ce occupies less than 32 bits in the skb control block */
66+
+ rs->delivered_ce &= TCPCB_DELIVERED_CE_MASK;
67+
+
68+
/* Model sending data and receiving ACKs as separate pipeline phases
69+
* for a window. Usually the ACK phase is longer, but with ACK
70+
* compression the send phase can be longer. To be safe we use the
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
From 9fffe7e05bb0da5aef700cc246a71fc33672c81e Mon Sep 17 00:00:00 2001
2+
From: Alexander Duyck <alexanderduyck@fb.com>
3+
Date: Fri, 13 May 2022 11:33:57 -0700
4+
Subject: [PATCH 16/21] net: allow gso_max_size to exceed 65536
5+
6+
The code for gso_max_size was added originally to allow for debugging and
7+
workaround of buggy devices that couldn't support TSO with blocks 64K in
8+
size. The original reason for limiting it to 64K was because that was the
9+
existing limits of IPv4 and non-jumbogram IPv6 length fields.
10+
11+
With the addition of Big TCP we can remove this limit and allow the value
12+
to potentially go up to UINT_MAX and instead be limited by the tso_max_size
13+
value.
14+
15+
So in order to support this we need to go through and clean up the
16+
remaining users of the gso_max_size value so that the values will cap at
17+
64K for non-TCPv6 flows. In addition we can clean up the GSO_MAX_SIZE value
18+
so that 64K becomes GSO_LEGACY_MAX_SIZE and UINT_MAX will now be the upper
19+
limit for GSO_MAX_SIZE.
20+
21+
v6: (edumazet) fixed a compile error if CONFIG_IPV6=n,
22+
in a new sk_trim_gso_size() helper.
23+
netif_set_tso_max_size() caps the requested TSO size
24+
with GSO_MAX_SIZE.
25+
26+
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
27+
Signed-off-by: Eric Dumazet <edumazet@google.com>
28+
Signed-off-by: David S. Miller <davem@davemloft.net>
29+
---
30+
include/linux/netdevice.h | 4 +++-
31+
net/bpf/test_run.c | 2 +-
32+
net/core/dev.c | 2 +-
33+
net/ipv4/tcp_output.c | 2 +-
34+
10 files changed, 16 insertions(+), 10 deletions(-)
35+
36+
--- a/include/linux/netdevice.h
37+
+++ b/include/linux/netdevice.h
38+
@@ -2251,7 +2251,9 @@ struct net_device {
39+
const struct rtnl_link_ops *rtnl_link_ops;
40+
41+
/* for setting kernel sock attribute on TCP connection setup */
42+
-#define GSO_MAX_SIZE 65536
43+
+#define GSO_LEGACY_MAX_SIZE 65536u
44+
+#define GSO_MAX_SIZE UINT_MAX
45+
+
46+
unsigned int gso_max_size;
47+
#define GSO_MAX_SEGS 65535
48+
u16 gso_max_segs;
49+
--- a/net/bpf/test_run.c
50+
+++ b/net/bpf/test_run.c
51+
@@ -524,7 +524,7 @@ static int convert___skb_to_skb(struct s
52+
cb->pkt_len = skb->len;
53+
} else {
54+
if (__skb->wire_len < skb->len ||
55+
- __skb->wire_len > GSO_MAX_SIZE)
56+
+ __skb->wire_len > GSO_LEGACY_MAX_SIZE)
57+
return -EINVAL;
58+
cb->pkt_len = __skb->wire_len;
59+
}
60+
--- a/net/core/dev.c
61+
+++ b/net/core/dev.c
62+
@@ -10858,7 +10858,7 @@ struct net_device *alloc_netdev_mqs(int
63+
64+
dev_net_set(dev, &init_net);
65+
66+
- dev->gso_max_size = GSO_MAX_SIZE;
67+
+ dev->gso_max_size = GSO_LEGACY_MAX_SIZE;
68+
dev->gso_max_segs = GSO_MAX_SEGS;
69+
dev->upper_level = 1;
70+
dev->lower_level = 1;
71+
--- a/net/ipv4/tcp_output.c
72+
+++ b/net/ipv4/tcp_output.c
73+
@@ -1548,7 +1548,7 @@ int tcp_fragment(struct sock *sk, enum t
74+
* SO_SNDBUF values.
75+
* Also allow first and last skb in retransmit queue to be split.
76+
*/
77+
- limit = sk->sk_sndbuf + 2 * SKB_TRUESIZE(GSO_MAX_SIZE);
78+
+ limit = sk->sk_sndbuf + 2 * SKB_TRUESIZE(GSO_LEGACY_MAX_SIZE);
79+
if (unlikely((sk->sk_wmem_queued >> 1) > limit &&
80+
tcp_queue != TCP_FRAG_IN_WRITE_QUEUE &&
81+
skb != tcp_rtx_queue_head(sk) &&
82+
--- a/net/sctp/output.c
83+
+++ b/net/sctp/output.c
84+
@@ -134,7 +134,8 @@ void sctp_packet_config(struct sctp_pack
85+
dst_hold(tp->dst);
86+
sk_setup_caps(sk, tp->dst);
87+
}
88+
- packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size
89+
+ packet->max_size = sk_can_gso(sk) ? min(READ_ONCE(tp->dst->dev->gso_max_size),
90+
+ GSO_LEGACY_MAX_SIZE)
91+
: asoc->pathmtu;
92+
rcu_read_unlock();
93+
}

PATCH/BBRv3/kernel/010-bbr3-0017-tcp-add-sysctls-for-TCP-PLB-parameters.patch renamed to PATCH/BBRv3/kernel/009-plb-0001-tcp-add-sysctls-for-TCP-PLB-parameters.patch

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 67a575e5256a44bef46a8db3e1f0b9c18398467e Mon Sep 17 00:00:00 2001
1+
From 945918a4e7fdac837f3589e51296683857909403 Mon Sep 17 00:00:00 2001
22
From: Mubashir Adnan Qureshi <mubashirq@google.com>
33
Date: Wed, 26 Oct 2022 13:51:11 +0000
4-
Subject: [PATCH 17/21] tcp: add sysctls for TCP PLB parameters
4+
Subject: [PATCH 1/2] tcp: add sysctls for TCP PLB parameters
55

66
PLB (Protective Load Balancing) is a host based mechanism for load
77
balancing across switch links. It leverages congestion signals(e.g. ECN)
@@ -24,10 +24,10 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
2424
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
2525
---
2626
Documentation/networking/ip-sysctl.rst | 75 ++++++++++++++++++++++++++
27-
include/net/netns/ipv4.h | 6 +++
28-
net/ipv4/sysctl_net_ipv4.c | 44 +++++++++++++++
27+
include/net/netns/ipv4.h | 5 ++
28+
net/ipv4/sysctl_net_ipv4.c | 43 +++++++++++++++
2929
net/ipv4/tcp_ipv4.c | 8 +++
30-
4 files changed, 133 insertions(+)
30+
4 files changed, 131 insertions(+)
3131

3232
--- a/Documentation/networking/ip-sysctl.rst
3333
+++ b/Documentation/networking/ip-sysctl.rst
@@ -115,32 +115,30 @@ Signed-off-by: Alexandre Frade <kernel@xanmod.org>
115115

116116
--- a/include/net/netns/ipv4.h
117117
+++ b/include/net/netns/ipv4.h
118-
@@ -177,6 +177,12 @@ struct netns_ipv4 {
118+
@@ -176,6 +176,11 @@ struct netns_ipv4 {
119+
unsigned int sysctl_tcp_fastopen_blackhole_timeout;
119120
atomic_t tfo_active_disable_times;
120121
unsigned long tfo_active_disable_stamp;
121-
122122
+ u8 sysctl_tcp_plb_enabled;
123123
+ u8 sysctl_tcp_plb_idle_rehash_rounds;
124124
+ u8 sysctl_tcp_plb_rehash_rounds;
125125
+ u8 sysctl_tcp_plb_suspend_rto_sec;
126126
+ int sysctl_tcp_plb_cong_thresh;
127-
+
127+
128128
int sysctl_udp_wmem_min;
129129
int sysctl_udp_rmem_min;
130-
131130
--- a/net/ipv4/sysctl_net_ipv4.c
132131
+++ b/net/ipv4/sysctl_net_ipv4.c
133-
@@ -54,6 +54,9 @@ static int one_day_secs = 24 * 3600;
132+
@@ -53,6 +53,8 @@ static u32 u32_max_div_HZ = UINT_MAX / H
133+
static int one_day_secs = 24 * 3600;
134134
static u32 fib_multipath_hash_fields_all_mask __maybe_unused =
135135
FIB_MULTIPATH_HASH_FIELD_ALL_MASK;
136-
137136
+static int tcp_plb_max_rounds = 31;
138137
+static int tcp_plb_max_cong_thresh = 256;
139-
+
138+
140139
/* obsolete */
141140
static int sysctl_tcp_low_latency __read_mostly;
142-
143-
@@ -1362,6 +1365,47 @@ static struct ctl_table ipv4_net_table[]
141+
@@ -1362,6 +1364,47 @@ static struct ctl_table ipv4_net_table[]
144142
.extra1 = SYSCTL_ZERO,
145143
.extra2 = &two,
146144
},
@@ -190,7 +188,7 @@ Signed-off-by: Alexandre Frade <kernel@xanmod.org>
190188

191189
--- a/net/ipv4/tcp_ipv4.c
192190
+++ b/net/ipv4/tcp_ipv4.c
193-
@@ -3205,6 +3205,14 @@ static int __net_init tcp_sk_init(struct
191+
@@ -3206,6 +3206,14 @@ static int __net_init tcp_sk_init(struct
194192
net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 0;
195193
atomic_set(&net->ipv4.tfo_active_disable_times, 0);
196194

PATCH/BBRv3/kernel/010-bbr3-0018-tcp-add-PLB-functionality-for-TCP.patch renamed to PATCH/BBRv3/kernel/009-plb-0002-tcp-add-PLB-functionality-for-TCP.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 45c18820a190e8f028cbbe76ef99cbe08b913e2e Mon Sep 17 00:00:00 2001
1+
From ad14b4ef5ffb6597e6b69b986badd182c98d1497 Mon Sep 17 00:00:00 2001
22
From: Mubashir Adnan Qureshi <mubashirq@google.com>
33
Date: Wed, 26 Oct 2022 13:51:12 +0000
4-
Subject: [PATCH 18/21] tcp: add PLB functionality for TCP
4+
Subject: [PATCH 2/2] tcp: add PLB functionality for TCP
55

66
Congestion control algorithms track PLB state and cause the connection
77
to trigger a path change when either of the 2 conditions is satisfied:
@@ -34,7 +34,7 @@ Signed-off-by: Alexandre Frade <kernel@xanmod.org>
3434

3535
--- a/include/net/tcp.h
3636
+++ b/include/net/tcp.h
37-
@@ -2173,6 +2173,34 @@ extern void tcp_rack_advance(struct tcp_
37+
@@ -2120,6 +2120,34 @@ extern void tcp_rack_advance(struct tcp_
3838
extern void tcp_rack_reo_timeout(struct sock *sk);
3939
extern void tcp_rack_update_reo_wnd(struct sock *sk, struct rate_sample *rs);
4040

@@ -82,7 +82,7 @@ Signed-off-by: Alexandre Frade <kernel@xanmod.org>
8282
inet_fragment.o ping.o ip_tunnel_core.o gre_offload.o \
8383
--- a/net/ipv4/tcp_ipv4.c
8484
+++ b/net/ipv4/tcp_ipv4.c
85-
@@ -3211,7 +3211,7 @@ static int __net_init tcp_sk_init(struct
85+
@@ -3212,7 +3212,7 @@ static int __net_init tcp_sk_init(struct
8686
net->ipv4.sysctl_tcp_plb_rehash_rounds = 12;
8787
net->ipv4.sysctl_tcp_plb_suspend_rto_sec = 60;
8888
/* Default congestion threshold for PLB to mark a round is 50% */

PATCH/BBRv3/kernel/010-bbr3-0001-net-tcp_bbr-broaden-app-limited-rate-sample-detectio.patch

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From ee5316263c5ba74198729ad83aeef714a11b767b Mon Sep 17 00:00:00 2001
1+
From 247736e1b64c6acb6a0e2040f630bb9e8dd8312c Mon Sep 17 00:00:00 2001
22
From: Neal Cardwell <ncardwell@google.com>
33
Date: Tue, 11 Jun 2019 12:26:55 -0400
4-
Subject: [PATCH 01/21] net-tcp_bbr: broaden app-limited rate sample detection
4+
Subject: [PATCH 01/18] net-tcp_bbr: broaden app-limited rate sample detection
55

66
This commit is a bug fix for the Linux TCP app-limited
77
(application-limited) logic that is used for collecting rate
@@ -24,14 +24,15 @@ can't know whether inflight was fully using the old cwnd.
2424

2525
Origin-9xx-SHA1: 3fe9b53291e018407780fb8c356adb5666722cbc
2626
Change-Id: I37221506f5166877c2b110753d39bb0757985e68
27+
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
2728
---
2829
net/ipv4/tcp_input.c | 1 +
2930
net/ipv4/tcp_timer.c | 1 +
3031
2 files changed, 2 insertions(+)
3132

3233
--- a/net/ipv4/tcp_input.c
3334
+++ b/net/ipv4/tcp_input.c
34-
@@ -3811,6 +3811,7 @@ static int tcp_ack(struct sock *sk, cons
35+
@@ -3822,6 +3822,7 @@ static int tcp_ack(struct sock *sk, cons
3536

3637
prior_fack = tcp_is_sack(tp) ? tcp_highest_sack_seq(tp) : tp->snd_una;
3738
rs.prior_in_flight = tcp_packets_in_flight(tp);
@@ -41,7 +42,7 @@ Change-Id: I37221506f5166877c2b110753d39bb0757985e68
4142
* is in window.
4243
--- a/net/ipv4/tcp_timer.c
4344
+++ b/net/ipv4/tcp_timer.c
44-
@@ -611,6 +611,7 @@ void tcp_write_timer_handler(struct sock
45+
@@ -629,6 +629,7 @@ void tcp_write_timer_handler(struct sock
4546
goto out;
4647
}
4748

0 commit comments

Comments
 (0)