Blame view

net/ipv4/tcp_scalable.c 1.41 KB
0e57976b6   John Heffner   [TCP]: Add Scalab...
1
2
  /* Tom Kelly's Scalable TCP
   *
a52b8bd33   Joe Perches   tcp_scalable: Upd...
3
   * See http://www.deneholme.net/tom/scalable/
0e57976b6   John Heffner   [TCP]: Add Scalab...
4
5
6
   *
   * John Heffner <jheffner@sc.edu>
   */
0e57976b6   John Heffner   [TCP]: Add Scalab...
7
8
9
10
11
12
13
14
15
  #include <linux/module.h>
  #include <net/tcp.h>
  
  /* These factors derived from the recommended values in the aer:
   * .01 and and 7/8. We use 50 instead of 100 to account for
   * delayed ack.
   */
  #define TCP_SCALABLE_AI_CNT	50U
  #define TCP_SCALABLE_MD_SCALE	3
c3a05c605   Ilpo Järvinen   [TCP]: Cong.ctrl ...
16
  static void tcp_scalable_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
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
20
  
  	if (!tcp_is_cwnd_limited(sk, in_flight))
0e57976b6   John Heffner   [TCP]: Add Scalab...
21
  		return;
7faffa1c7   Stephen Hemminger   [TCP]: add tcp_sl...
22
23
  	if (tp->snd_cwnd <= tp->snd_ssthresh)
  		tcp_slow_start(tp);
758ce5c8d   Ilpo Järvinen   tcp: add helper f...
24
25
  	else
  		tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT));
0e57976b6   John Heffner   [TCP]: Add Scalab...
26
  }
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
27
  static u32 tcp_scalable_ssthresh(struct sock *sk)
0e57976b6   John Heffner   [TCP]: Add Scalab...
28
  {
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
29
  	const struct tcp_sock *tp = tcp_sk(sk);
0e57976b6   John Heffner   [TCP]: Add Scalab...
30
31
  	return max(tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE), 2U);
  }
a252bebe2   Stephen Hemminger   tcp: mark tcp_con...
32
  static struct tcp_congestion_ops tcp_scalable __read_mostly = {
0e57976b6   John Heffner   [TCP]: Add Scalab...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  	.ssthresh	= tcp_scalable_ssthresh,
  	.cong_avoid	= tcp_scalable_cong_avoid,
  	.min_cwnd	= tcp_reno_min_cwnd,
  
  	.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");