diff options
author | Anmol Sarma <me@anmolsarma.in> | 2017-06-03 08:10:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-05 10:53:24 -0400 |
commit | 1e0ce2a1ee0d5fb334e82e80600f1e8e77df525c (patch) | |
tree | 58227cc33cc39d0b72bcbf0abcd76ec357d114b1 | |
parent | 6dc06c08bef1c746ff8da33dab677cfbacdcad32 (diff) |
net: Update TCP congestion control documentation
Update tcp.txt to fix mandatory congestion control ops and default
CCA selection. Also, fix comment in tcp.h for undo_cwnd.
Signed-off-by: Anmol Sarma <me@anmolsarma.in>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/networking/tcp.txt | 31 | ||||
-rw-r--r-- | include/net/tcp.h | 2 |
2 files changed, 14 insertions, 19 deletions
diff --git a/Documentation/networking/tcp.txt b/Documentation/networking/tcp.txt index bdc4c0db51e1..9c7139d57e57 100644 --- a/Documentation/networking/tcp.txt +++ b/Documentation/networking/tcp.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | TCP protocol | 1 | TCP protocol |
2 | ============ | 2 | ============ |
3 | 3 | ||
4 | Last updated: 9 February 2008 | 4 | Last updated: 3 June 2017 |
5 | 5 | ||
6 | Contents | 6 | Contents |
7 | ======== | 7 | ======== |
@@ -29,18 +29,19 @@ As of 2.6.13, Linux supports pluggable congestion control algorithms. | |||
29 | A congestion control mechanism can be registered through functions in | 29 | A congestion control mechanism can be registered through functions in |
30 | tcp_cong.c. The functions used by the congestion control mechanism are | 30 | tcp_cong.c. The functions used by the congestion control mechanism are |
31 | registered via passing a tcp_congestion_ops struct to | 31 | registered via passing a tcp_congestion_ops struct to |
32 | tcp_register_congestion_control. As a minimum name, ssthresh, | 32 | tcp_register_congestion_control. As a minimum, the congestion control |
33 | cong_avoid must be valid. | 33 | mechanism must provide a valid name and must implement either ssthresh, |
34 | cong_avoid and undo_cwnd hooks or the "omnipotent" cong_control hook. | ||
34 | 35 | ||
35 | Private data for a congestion control mechanism is stored in tp->ca_priv. | 36 | Private data for a congestion control mechanism is stored in tp->ca_priv. |
36 | tcp_ca(tp) returns a pointer to this space. This is preallocated space - it | 37 | tcp_ca(tp) returns a pointer to this space. This is preallocated space - it |
37 | is important to check the size of your private data will fit this space, or | 38 | is important to check the size of your private data will fit this space, or |
38 | alternatively space could be allocated elsewhere and a pointer to it could | 39 | alternatively, space could be allocated elsewhere and a pointer to it could |
39 | be stored here. | 40 | be stored here. |
40 | 41 | ||
41 | There are three kinds of congestion control algorithms currently: The | 42 | There are three kinds of congestion control algorithms currently: The |
42 | simplest ones are derived from TCP reno (highspeed, scalable) and just | 43 | simplest ones are derived from TCP reno (highspeed, scalable) and just |
43 | provide an alternative the congestion window calculation. More complex | 44 | provide an alternative congestion window calculation. More complex |
44 | ones like BIC try to look at other events to provide better | 45 | ones like BIC try to look at other events to provide better |
45 | heuristics. There are also round trip time based algorithms like | 46 | heuristics. There are also round trip time based algorithms like |
46 | Vegas and Westwood+. | 47 | Vegas and Westwood+. |
@@ -49,21 +50,15 @@ Good TCP congestion control is a complex problem because the algorithm | |||
49 | needs to maintain fairness and performance. Please review current | 50 | needs to maintain fairness and performance. Please review current |
50 | research and RFC's before developing new modules. | 51 | research and RFC's before developing new modules. |
51 | 52 | ||
52 | The method that is used to determine which congestion control mechanism is | 53 | The default congestion control mechanism is chosen based on the |
53 | determined by the setting of the sysctl net.ipv4.tcp_congestion_control. | 54 | DEFAULT_TCP_CONG Kconfig parameter. If you really want a particular default |
54 | The default congestion control will be the last one registered (LIFO); | 55 | value then you can set it using sysctl net.ipv4.tcp_congestion_control. The |
55 | so if you built everything as modules, the default will be reno. If you | 56 | module will be autoloaded if needed and you will get the expected protocol. If |
56 | build with the defaults from Kconfig, then CUBIC will be builtin (not a | 57 | you ask for an unknown congestion method, then the sysctl attempt will fail. |
57 | module) and it will end up the default. | ||
58 | 58 | ||
59 | If you really want a particular default value then you will need | 59 | If you remove a TCP congestion control module, then you will get the next |
60 | to set it with the sysctl. If you use a sysctl, the module will be autoloaded | ||
61 | if needed and you will get the expected protocol. If you ask for an | ||
62 | unknown congestion method, then the sysctl attempt will fail. | ||
63 | |||
64 | If you remove a tcp congestion control module, then you will get the next | ||
65 | available one. Since reno cannot be built as a module, and cannot be | 60 | available one. Since reno cannot be built as a module, and cannot be |
66 | deleted, it will always be available. | 61 | removed, it will always be available. |
67 | 62 | ||
68 | How the new TCP output machine [nyi] works. | 63 | How the new TCP output machine [nyi] works. |
69 | =========================================== | 64 | =========================================== |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 38a7427ae902..be6223c586fa 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -924,7 +924,7 @@ struct tcp_congestion_ops { | |||
924 | void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev); | 924 | void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev); |
925 | /* call when ack arrives (optional) */ | 925 | /* call when ack arrives (optional) */ |
926 | void (*in_ack_event)(struct sock *sk, u32 flags); | 926 | void (*in_ack_event)(struct sock *sk, u32 flags); |
927 | /* new value of cwnd after loss (optional) */ | 927 | /* new value of cwnd after loss (required) */ |
928 | u32 (*undo_cwnd)(struct sock *sk); | 928 | u32 (*undo_cwnd)(struct sock *sk); |
929 | /* hook for packet ack accounting (optional) */ | 929 | /* hook for packet ack accounting (optional) */ |
930 | void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); | 930 | void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample); |