diff options
author | Richard Sailer <richard@weltraumpflege.org> | 2016-07-15 22:04:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-16 02:18:14 -0400 |
commit | c380d37e97e783e36a924279fbd2f6837508546a (patch) | |
tree | 18c59383dd3bee3a33b11a286154fbe571d3d6b2 /net/ipv4/tcp_timer.c | |
parent | 7dc099345268154a6d5997743da4b08ff89bdca3 (diff) |
tcp_timer.c: Add kernel-doc function descriptions
This adds kernel-doc style descriptions for 6 functions and
fixes 1 typo.
Signed-off-by: Richard Sailer <richard@weltraumpflege.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r-- | net/ipv4/tcp_timer.c | 81 |
1 files changed, 64 insertions, 17 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index debdd8b33e69..d84930b2dd95 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -24,6 +24,13 @@ | |||
24 | 24 | ||
25 | int sysctl_tcp_thin_linear_timeouts __read_mostly; | 25 | int sysctl_tcp_thin_linear_timeouts __read_mostly; |
26 | 26 | ||
27 | /** | ||
28 | * tcp_write_err() - close socket and save error info | ||
29 | * @sk: The socket the error has appeared on. | ||
30 | * | ||
31 | * Returns: Nothing (void) | ||
32 | */ | ||
33 | |||
27 | static void tcp_write_err(struct sock *sk) | 34 | static void tcp_write_err(struct sock *sk) |
28 | { | 35 | { |
29 | sk->sk_err = sk->sk_err_soft ? : ETIMEDOUT; | 36 | sk->sk_err = sk->sk_err_soft ? : ETIMEDOUT; |
@@ -33,16 +40,21 @@ static void tcp_write_err(struct sock *sk) | |||
33 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONTIMEOUT); | 40 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONTIMEOUT); |
34 | } | 41 | } |
35 | 42 | ||
36 | /* Do not allow orphaned sockets to eat all our resources. | 43 | /** |
37 | * This is direct violation of TCP specs, but it is required | 44 | * tcp_out_of_resources() - Close socket if out of resources |
38 | * to prevent DoS attacks. It is called when a retransmission timeout | 45 | * @sk: pointer to current socket |
39 | * or zero probe timeout occurs on orphaned socket. | 46 | * @do_reset: send a last packet with reset flag |
40 | * | 47 | * |
41 | * Criteria is still not confirmed experimentally and may change. | 48 | * Do not allow orphaned sockets to eat all our resources. |
42 | * We kill the socket, if: | 49 | * This is direct violation of TCP specs, but it is required |
43 | * 1. If number of orphaned sockets exceeds an administratively configured | 50 | * to prevent DoS attacks. It is called when a retransmission timeout |
44 | * limit. | 51 | * or zero probe timeout occurs on orphaned socket. |
45 | * 2. If we have strong memory pressure. | 52 | * |
53 | * Criteria is still not confirmed experimentally and may change. | ||
54 | * We kill the socket, if: | ||
55 | * 1. If number of orphaned sockets exceeds an administratively configured | ||
56 | * limit. | ||
57 | * 2. If we have strong memory pressure. | ||
46 | */ | 58 | */ |
47 | static int tcp_out_of_resources(struct sock *sk, bool do_reset) | 59 | static int tcp_out_of_resources(struct sock *sk, bool do_reset) |
48 | { | 60 | { |
@@ -74,7 +86,11 @@ static int tcp_out_of_resources(struct sock *sk, bool do_reset) | |||
74 | return 0; | 86 | return 0; |
75 | } | 87 | } |
76 | 88 | ||
77 | /* Calculate maximal number or retries on an orphaned socket. */ | 89 | /** |
90 | * tcp_orphan_retries() - Returns maximal number of retries on an orphaned socket | ||
91 | * @sk: Pointer to the current socket. | ||
92 | * @alive: bool, socket alive state | ||
93 | */ | ||
78 | static int tcp_orphan_retries(struct sock *sk, bool alive) | 94 | static int tcp_orphan_retries(struct sock *sk, bool alive) |
79 | { | 95 | { |
80 | int retries = sock_net(sk)->ipv4.sysctl_tcp_orphan_retries; /* May be zero. */ | 96 | int retries = sock_net(sk)->ipv4.sysctl_tcp_orphan_retries; /* May be zero. */ |
@@ -115,10 +131,22 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) | |||
115 | } | 131 | } |
116 | } | 132 | } |
117 | 133 | ||
118 | /* This function calculates a "timeout" which is equivalent to the timeout of a | 134 | |
119 | * TCP connection after "boundary" unsuccessful, exponentially backed-off | 135 | /** |
136 | * retransmits_timed_out() - returns true if this connection has timed out | ||
137 | * @sk: The current socket | ||
138 | * @boundary: max number of retransmissions | ||
139 | * @timeout: A custom timeout value. | ||
140 | * If set to 0 the default timeout is calculated and used. | ||
141 | * Using TCP_RTO_MIN and the number of unsuccessful retransmits. | ||
142 | * @syn_set: true if the SYN Bit was set. | ||
143 | * | ||
144 | * The default "timeout" value this function can calculate and use | ||
145 | * is equivalent to the timeout of a TCP Connection | ||
146 | * after "boundary" unsuccessful, exponentially backed-off | ||
120 | * retransmissions with an initial RTO of TCP_RTO_MIN or TCP_TIMEOUT_INIT if | 147 | * retransmissions with an initial RTO of TCP_RTO_MIN or TCP_TIMEOUT_INIT if |
121 | * syn_set flag is set. | 148 | * syn_set flag is set. |
149 | * | ||
122 | */ | 150 | */ |
123 | static bool retransmits_timed_out(struct sock *sk, | 151 | static bool retransmits_timed_out(struct sock *sk, |
124 | unsigned int boundary, | 152 | unsigned int boundary, |
@@ -257,6 +285,16 @@ out: | |||
257 | sk_mem_reclaim(sk); | 285 | sk_mem_reclaim(sk); |
258 | } | 286 | } |
259 | 287 | ||
288 | |||
289 | /** | ||
290 | * tcp_delack_timer() - The TCP delayed ACK timeout handler | ||
291 | * @data: Pointer to the current socket. (gets casted to struct sock *) | ||
292 | * | ||
293 | * This function gets (indirectly) called when the kernel timer for a TCP packet | ||
294 | * of this socket expires. Calls tcp_delack_timer_handler() to do the actual work. | ||
295 | * | ||
296 | * Returns: Nothing (void) | ||
297 | */ | ||
260 | static void tcp_delack_timer(unsigned long data) | 298 | static void tcp_delack_timer(unsigned long data) |
261 | { | 299 | { |
262 | struct sock *sk = (struct sock *)data; | 300 | struct sock *sk = (struct sock *)data; |
@@ -350,10 +388,18 @@ static void tcp_fastopen_synack_timer(struct sock *sk) | |||
350 | TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); | 388 | TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); |
351 | } | 389 | } |
352 | 390 | ||
353 | /* | ||
354 | * The TCP retransmit timer. | ||
355 | */ | ||
356 | 391 | ||
392 | /** | ||
393 | * tcp_retransmit_timer() - The TCP retransmit timeout handler | ||
394 | * @sk: Pointer to the current socket. | ||
395 | * | ||
396 | * This function gets called when the kernel timer for a TCP packet | ||
397 | * of this socket expires. | ||
398 | * | ||
399 | * It handles retransmission, timer adjustment and other necesarry measures. | ||
400 | * | ||
401 | * Returns: Nothing (void) | ||
402 | */ | ||
357 | void tcp_retransmit_timer(struct sock *sk) | 403 | void tcp_retransmit_timer(struct sock *sk) |
358 | { | 404 | { |
359 | struct tcp_sock *tp = tcp_sk(sk); | 405 | struct tcp_sock *tp = tcp_sk(sk); |
@@ -494,7 +540,8 @@ out_reset_timer: | |||
494 | out:; | 540 | out:; |
495 | } | 541 | } |
496 | 542 | ||
497 | /* Called with BH disabled */ | 543 | /* Called with bottom-half processing disabled. |
544 | Called by tcp_write_timer() */ | ||
498 | void tcp_write_timer_handler(struct sock *sk) | 545 | void tcp_write_timer_handler(struct sock *sk) |
499 | { | 546 | { |
500 | struct inet_connection_sock *icsk = inet_csk(sk); | 547 | struct inet_connection_sock *icsk = inet_csk(sk); |
@@ -539,7 +586,7 @@ static void tcp_write_timer(unsigned long data) | |||
539 | if (!sock_owned_by_user(sk)) { | 586 | if (!sock_owned_by_user(sk)) { |
540 | tcp_write_timer_handler(sk); | 587 | tcp_write_timer_handler(sk); |
541 | } else { | 588 | } else { |
542 | /* deleguate our work to tcp_release_cb() */ | 589 | /* delegate our work to tcp_release_cb() */ |
543 | if (!test_and_set_bit(TCP_WRITE_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags)) | 590 | if (!test_and_set_bit(TCP_WRITE_TIMER_DEFERRED, &tcp_sk(sk)->tsq_flags)) |
544 | sock_hold(sk); | 591 | sock_hold(sk); |
545 | } | 592 | } |