Blame view

net/ipv4/tcp_scalable.c 1.42 KB
09c434b8a   Thomas Gleixner   treewide: Add SPD...
1
  // SPDX-License-Identifier: GPL-2.0-only
0e57976b6   John Heffner   [TCP]: Add Scalab...
2
3
  /* Tom Kelly's Scalable TCP
   *
a52b8bd33   Joe Perches   tcp_scalable: Upd...
4
   * See http://www.deneholme.net/tom/scalable/
0e57976b6   John Heffner   [TCP]: Add Scalab...
5
6
7
   *
   * John Heffner <jheffner@sc.edu>
   */
0e57976b6   John Heffner   [TCP]: Add Scalab...
8
9
10
11
  #include <linux/module.h>
  #include <net/tcp.h>
  
  /* These factors derived from the recommended values in the aer:
2bdcc73c8   Randy Dunlap   net: ipv4: delete...
12
   * .01 and 7/8.
0e57976b6   John Heffner   [TCP]: Add Scalab...
13
   */
5415e3c37   Pengcheng Yang   tcp: fix stretch ...
14
  #define TCP_SCALABLE_AI_CNT	100U
0e57976b6   John Heffner   [TCP]: Add Scalab...
15
  #define TCP_SCALABLE_MD_SCALE	3
249015515   Eric Dumazet   tcp: remove in_fl...
16
  static void tcp_scalable_cong_avoid(struct sock *sk, u32 ack, u32 acked)
0e57976b6   John Heffner   [TCP]: Add Scalab...
17
  {
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
18
  	struct tcp_sock *tp = tcp_sk(sk);
f4805eded   Stephen Hemminger   [TCP]: fix conges...
19

249015515   Eric Dumazet   tcp: remove in_fl...
20
  	if (!tcp_is_cwnd_limited(sk))
0e57976b6   John Heffner   [TCP]: Add Scalab...
21
  		return;
5415e3c37   Pengcheng Yang   tcp: fix stretch ...
22
23
24
25
26
27
28
  	if (tcp_in_slow_start(tp)) {
  		acked = tcp_slow_start(tp, acked);
  		if (!acked)
  			return;
  	}
  	tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT),
  			  acked);
0e57976b6   John Heffner   [TCP]: Add Scalab...
29
  }
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
30
  static u32 tcp_scalable_ssthresh(struct sock *sk)
0e57976b6   John Heffner   [TCP]: Add Scalab...
31
  {
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
32
  	const struct tcp_sock *tp = tcp_sk(sk);
688d1945b   stephen hemminger   tcp: whitespace f...
33

0e57976b6   John Heffner   [TCP]: Add Scalab...
34
35
  	return max(tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE), 2U);
  }
a252bebe2   Stephen Hemminger   tcp: mark tcp_con...
36
  static struct tcp_congestion_ops tcp_scalable __read_mostly = {
0e57976b6   John Heffner   [TCP]: Add Scalab...
37
  	.ssthresh	= tcp_scalable_ssthresh,
f1722a1be   Yuchung Cheng   tcp: consolidate ...
38
  	.undo_cwnd	= tcp_reno_undo_cwnd,
0e57976b6   John Heffner   [TCP]: Add Scalab...
39
  	.cong_avoid	= tcp_scalable_cong_avoid,
0e57976b6   John Heffner   [TCP]: Add Scalab...
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  
  	.owner		= THIS_MODULE,
  	.name		= "scalable",
  };
  
  static int __init tcp_scalable_register(void)
  {
  	return tcp_register_congestion_control(&tcp_scalable);
  }
  
  static void __exit tcp_scalable_unregister(void)
  {
  	tcp_unregister_congestion_control(&tcp_scalable);
  }
  
  module_init(tcp_scalable_register);
  module_exit(tcp_scalable_unregister);
  
  MODULE_AUTHOR("John Heffner");
  MODULE_LICENSE("GPL");
  MODULE_DESCRIPTION("Scalable TCP");