diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 218235de8963..e54c76d75495 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -481,7 +481,16 @@ static inline void tcp_clear_xmit_timers(struct sock *sk) | |||
481 | } | 481 | } |
482 | 482 | ||
483 | extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); | 483 | extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); |
484 | extern unsigned int tcp_current_mss(struct sock *sk, int large); | 484 | extern unsigned int tcp_current_mss(struct sock *sk); |
485 | |||
486 | /* Bound MSS / TSO packet size with the half of the window */ | ||
487 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) | ||
488 | { | ||
489 | if (tp->max_window && pktsize > (tp->max_window >> 1)) | ||
490 | return max(tp->max_window >> 1, 68U - tp->tcp_header_len); | ||
491 | else | ||
492 | return pktsize; | ||
493 | } | ||
485 | 494 | ||
486 | /* tcp.c */ | 495 | /* tcp.c */ |
487 | extern void tcp_get_info(struct sock *, struct tcp_info *); | 496 | extern void tcp_get_info(struct sock *, struct tcp_info *); |
@@ -685,6 +694,7 @@ extern void tcp_get_allowed_congestion_control(char *buf, size_t len); | |||
685 | extern int tcp_set_allowed_congestion_control(char *allowed); | 694 | extern int tcp_set_allowed_congestion_control(char *allowed); |
686 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); | 695 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); |
687 | extern void tcp_slow_start(struct tcp_sock *tp); | 696 | extern void tcp_slow_start(struct tcp_sock *tp); |
697 | extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); | ||
688 | 698 | ||
689 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 699 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
690 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 700 | extern u32 tcp_reno_ssthresh(struct sock *sk); |
@@ -821,15 +831,15 @@ static inline void tcp_push_pending_frames(struct sock *sk) | |||
821 | { | 831 | { |
822 | struct tcp_sock *tp = tcp_sk(sk); | 832 | struct tcp_sock *tp = tcp_sk(sk); |
823 | 833 | ||
824 | __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); | 834 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); |
825 | } | 835 | } |
826 | 836 | ||
827 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 837 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) |
828 | { | 838 | { |
829 | tp->snd_wl1 = seq; | 839 | tp->snd_wl1 = seq; |
830 | } | 840 | } |
831 | 841 | ||
832 | static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 842 | static inline void tcp_update_wl(struct tcp_sock *tp, u32 seq) |
833 | { | 843 | { |
834 | tp->snd_wl1 = seq; | 844 | tp->snd_wl1 = seq; |
835 | } | 845 | } |
@@ -925,7 +935,6 @@ extern void tcp_done(struct sock *sk); | |||
925 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | 935 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) |
926 | { | 936 | { |
927 | rx_opt->dsack = 0; | 937 | rx_opt->dsack = 0; |
928 | rx_opt->eff_sacks = 0; | ||
929 | rx_opt->num_sacks = 0; | 938 | rx_opt->num_sacks = 0; |
930 | } | 939 | } |
931 | 940 | ||
@@ -997,11 +1006,21 @@ static inline int tcp_fin_time(const struct sock *sk) | |||
997 | return fin_timeout; | 1006 | return fin_timeout; |
998 | } | 1007 | } |
999 | 1008 | ||
1000 | static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int rst) | 1009 | static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, |
1010 | int paws_win) | ||
1001 | { | 1011 | { |
1002 | if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) | 1012 | if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win) |
1003 | return 0; | 1013 | return 1; |
1004 | if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) | 1014 | if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)) |
1015 | return 1; | ||
1016 | |||
1017 | return 0; | ||
1018 | } | ||
1019 | |||
1020 | static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt, | ||
1021 | int rst) | ||
1022 | { | ||
1023 | if (tcp_paws_check(rx_opt, 0)) | ||
1005 | return 0; | 1024 | return 0; |
1006 | 1025 | ||
1007 | /* RST segments are not recommended to carry timestamp, | 1026 | /* RST segments are not recommended to carry timestamp, |