Skip to content

Commit 6d82aa2

Browse files
edumazetdavem330
authored andcommitted
tcp: add tcp_comp_sack_delay_ns sysctl
This per netns sysctl allows for TCP SACK compression fine-tuning. Its default value is 1,000,000, or 1 ms to meet TSO autosizing period. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 200d95f commit 6d82aa2

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

Documentation/networking/ip-sysctl.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,13 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max
525525
tcp_sack - BOOLEAN
526526
Enable select acknowledgments (SACKS).
527527

528+
tcp_comp_sack_delay_ns - LONG INTEGER
529+
TCP tries to reduce number of SACK sent, using a timer
530+
based on 5% of SRTT, capped by this sysctl, in nano seconds.
531+
The default is 1ms, based on TSO autosizing period.
532+
533+
Default : 1,000,000 ns (1 ms)
534+
528535
tcp_slow_start_after_idle - BOOLEAN
529536
If set, provide RFC2861 behavior and time out the congestion
530537
window after an idle period. An idle period is defined at

include/net/netns/ipv4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ struct netns_ipv4 {
160160
int sysctl_tcp_pacing_ca_ratio;
161161
int sysctl_tcp_wmem[3];
162162
int sysctl_tcp_rmem[3];
163+
unsigned long sysctl_tcp_comp_sack_delay_ns;
163164
struct inet_timewait_death_row tcp_death_row;
164165
int sysctl_max_syn_backlog;
165166
int sysctl_tcp_fastopen;

net/ipv4/sysctl_net_ipv4.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,13 @@ static struct ctl_table ipv4_net_table[] = {
11511151
.proc_handler= proc_dointvec_minmax,
11521152
.extra1= &one,
11531153
},
1154+
{
1155+
.procname= "tcp_comp_sack_delay_ns",
1156+
.data= &init_net.ipv4.sysctl_tcp_comp_sack_delay_ns,
1157+
.maxlen= sizeof(unsigned long),
1158+
.mode= 0644,
1159+
.proc_handler= proc_doulongvec_minmax,
1160+
},
11541161
{
11551162
.procname= "udp_rmem_min",
11561163
.data= &init_net.ipv4.sysctl_udp_rmem_min,

net/ipv4/tcp_input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5113,13 +5113,13 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
51135113
if (hrtimer_is_queued(&tp->compressed_ack_timer))
51145114
return;
51155115

5116-
/* compress ack timer : 5 % of rtt, but no more than 1 ms */
5116+
/* compress ack timer : 5 % of rtt, but no more than tcp_comp_sack_delay_ns */
51175117

51185118
rtt = tp->rcv_rtt_est.rtt_us;
51195119
if (tp->srtt_us && tp->srtt_us < rtt)
51205120
rtt = tp->srtt_us;
51215121

5122-
delay = min_t(unsigned long, NSEC_PER_MSEC,
5122+
delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns,
51235123
rtt * (NSEC_PER_USEC >> 3)/20);
51245124
sock_hold(sk);
51255125
hrtimer_start(&tp->compressed_ack_timer, ns_to_ktime(delay),

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,6 +2572,7 @@ static int __net_init tcp_sk_init(struct net *net)
25722572
init_net.ipv4.sysctl_tcp_wmem,
25732573
sizeof(init_net.ipv4.sysctl_tcp_wmem));
25742574
}
2575+
net->ipv4.sysctl_tcp_comp_sack_delay_ns = NSEC_PER_MSEC;
25752576
net->ipv4.sysctl_tcp_fastopen = TFO_CLIENT_ENABLE;
25762577
spin_lock_init(&net->ipv4.tcp_fastopen_ctx_lock);
25772578
net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 60 * 60;

0 commit comments

Comments
 (0)