Blame view

net/ipv4/tcp_scalable.c 1.37 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
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;
071d5080e   Yuchung Cheng   tcp: add tcp_in_s...
22
  	if (tcp_in_slow_start(tp))
9f9843a75   Yuchung Cheng   tcp: properly han...
23
  		tcp_slow_start(tp, acked);
758ce5c8d   Ilpo Järvinen   tcp: add helper f...
24
  	else
e73ebb088   Neal Cardwell   tcp: stretch ACK ...
25
26
  		tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT),
  				  1);
0e57976b6   John Heffner   [TCP]: Add Scalab...
27
  }
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
28
  static u32 tcp_scalable_ssthresh(struct sock *sk)
0e57976b6   John Heffner   [TCP]: Add Scalab...
29
  {
6687e988d   Arnaldo Carvalho de Melo   [ICSK]: Move TCP ...
30
  	const struct tcp_sock *tp = tcp_sk(sk);
688d1945b   stephen hemminger   tcp: whitespace f...
31

0e57976b6   John Heffner   [TCP]: Add Scalab...
32
33
  	return max(tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE), 2U);
  }
a252bebe2   Stephen Hemminger   tcp: mark tcp_con...
34
  static struct tcp_congestion_ops tcp_scalable __read_mostly = {
0e57976b6   John Heffner   [TCP]: Add Scalab...
35
36
  	.ssthresh	= tcp_scalable_ssthresh,
  	.cong_avoid	= tcp_scalable_cong_avoid,
0e57976b6   John Heffner   [TCP]: Add Scalab...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  
  	.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");