diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 88af84306471..b71a446d58f6 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -469,6 +469,7 @@ extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, | |||
469 | int nonagle); | 469 | int nonagle); |
470 | extern int tcp_may_send_now(struct sock *sk); | 470 | extern int tcp_may_send_now(struct sock *sk); |
471 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); | 471 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); |
472 | extern void tcp_retransmit_timer(struct sock *sk); | ||
472 | extern void tcp_xmit_retransmit_queue(struct sock *); | 473 | extern void tcp_xmit_retransmit_queue(struct sock *); |
473 | extern void tcp_simple_retransmit(struct sock *); | 474 | extern void tcp_simple_retransmit(struct sock *); |
474 | extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); | 475 | extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); |
@@ -521,6 +522,17 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); | |||
521 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); | 522 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); |
522 | extern void tcp_mtup_init(struct sock *sk); | 523 | extern void tcp_mtup_init(struct sock *sk); |
523 | 524 | ||
525 | static inline void tcp_bound_rto(const struct sock *sk) | ||
526 | { | ||
527 | if (inet_csk(sk)->icsk_rto > TCP_RTO_MAX) | ||
528 | inet_csk(sk)->icsk_rto = TCP_RTO_MAX; | ||
529 | } | ||
530 | |||
531 | static inline u32 __tcp_set_rto(const struct tcp_sock *tp) | ||
532 | { | ||
533 | return (tp->srtt >> 3) + tp->rttvar; | ||
534 | } | ||
535 | |||
524 | static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) | 536 | static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) |
525 | { | 537 | { |
526 | tp->pred_flags = htonl((tp->tcp_header_len << 26) | | 538 | tp->pred_flags = htonl((tp->tcp_header_len << 26) | |
@@ -1007,6 +1019,11 @@ static inline int keepalive_time_when(const struct tcp_sock *tp) | |||
1007 | return tp->keepalive_time ? : sysctl_tcp_keepalive_time; | 1019 | return tp->keepalive_time ? : sysctl_tcp_keepalive_time; |
1008 | } | 1020 | } |
1009 | 1021 | ||
1022 | static inline int keepalive_probes(const struct tcp_sock *tp) | ||
1023 | { | ||
1024 | return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes; | ||
1025 | } | ||
1026 | |||
1010 | static inline int tcp_fin_time(const struct sock *sk) | 1027 | static inline int tcp_fin_time(const struct sock *sk) |
1011 | { | 1028 | { |
1012 | int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; | 1029 | int fin_timeout = tcp_sk(sk)->linger2 ? : sysctl_tcp_fin_timeout; |
@@ -1169,7 +1186,7 @@ extern int tcp_v4_md5_do_del(struct sock *sk, | |||
1169 | #define tcp_twsk_md5_key(twsk) NULL | 1186 | #define tcp_twsk_md5_key(twsk) NULL |
1170 | #endif | 1187 | #endif |
1171 | 1188 | ||
1172 | extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(void); | 1189 | extern struct tcp_md5sig_pool **tcp_alloc_md5sig_pool(struct sock *); |
1173 | extern void tcp_free_md5sig_pool(void); | 1190 | extern void tcp_free_md5sig_pool(void); |
1174 | 1191 | ||
1175 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); | 1192 | extern struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu); |
@@ -1235,6 +1252,29 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu | |||
1235 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | 1252 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ |
1236 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) | 1253 | skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) |
1237 | 1254 | ||
1255 | /* This function calculates a "timeout" which is equivalent to the timeout of a | ||
1256 | * TCP connection after "boundary" unsucessful, exponentially backed-off | ||
1257 | * retransmissions with an initial RTO of TCP_RTO_MIN. | ||
1258 | */ | ||
1259 | static inline bool retransmits_timed_out(const struct sock *sk, | ||
1260 | unsigned int boundary) | ||
1261 | { | ||
1262 | unsigned int timeout, linear_backoff_thresh; | ||
1263 | |||
1264 | if (!inet_csk(sk)->icsk_retransmits) | ||
1265 | return false; | ||
1266 | |||
1267 | linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN); | ||
1268 | |||
1269 | if (boundary <= linear_backoff_thresh) | ||
1270 | timeout = ((2 << boundary) - 1) * TCP_RTO_MIN; | ||
1271 | else | ||
1272 | timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN + | ||
1273 | (boundary - linear_backoff_thresh) * TCP_RTO_MAX; | ||
1274 | |||
1275 | return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout; | ||
1276 | } | ||
1277 | |||
1238 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1278 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
1239 | { | 1279 | { |
1240 | return sk->sk_send_head; | 1280 | return sk->sk_send_head; |