diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 218235de8963..1b94b9bfe2dc 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 *); |
@@ -607,21 +616,6 @@ static inline int tcp_skb_mss(const struct sk_buff *skb) | |||
607 | return skb_shinfo(skb)->gso_size; | 616 | return skb_shinfo(skb)->gso_size; |
608 | } | 617 | } |
609 | 618 | ||
610 | static inline void tcp_dec_pcount_approx_int(__u32 *count, const int decr) | ||
611 | { | ||
612 | if (*count) { | ||
613 | *count -= decr; | ||
614 | if ((int)*count < 0) | ||
615 | *count = 0; | ||
616 | } | ||
617 | } | ||
618 | |||
619 | static inline void tcp_dec_pcount_approx(__u32 *count, | ||
620 | const struct sk_buff *skb) | ||
621 | { | ||
622 | tcp_dec_pcount_approx_int(count, tcp_skb_pcount(skb)); | ||
623 | } | ||
624 | |||
625 | /* Events passed to congestion control interface */ | 619 | /* Events passed to congestion control interface */ |
626 | enum tcp_ca_event { | 620 | enum tcp_ca_event { |
627 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ | 621 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ |
@@ -685,6 +679,7 @@ extern void tcp_get_allowed_congestion_control(char *buf, size_t len); | |||
685 | extern int tcp_set_allowed_congestion_control(char *allowed); | 679 | extern int tcp_set_allowed_congestion_control(char *allowed); |
686 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); | 680 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); |
687 | extern void tcp_slow_start(struct tcp_sock *tp); | 681 | extern void tcp_slow_start(struct tcp_sock *tp); |
682 | extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); | ||
688 | 683 | ||
689 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 684 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
690 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 685 | extern u32 tcp_reno_ssthresh(struct sock *sk); |
@@ -821,15 +816,15 @@ static inline void tcp_push_pending_frames(struct sock *sk) | |||
821 | { | 816 | { |
822 | struct tcp_sock *tp = tcp_sk(sk); | 817 | struct tcp_sock *tp = tcp_sk(sk); |
823 | 818 | ||
824 | __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle); | 819 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), tp->nonagle); |
825 | } | 820 | } |
826 | 821 | ||
827 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 822 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 seq) |
828 | { | 823 | { |
829 | tp->snd_wl1 = seq; | 824 | tp->snd_wl1 = seq; |
830 | } | 825 | } |
831 | 826 | ||
832 | static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 827 | static inline void tcp_update_wl(struct tcp_sock *tp, u32 seq) |
833 | { | 828 | { |
834 | tp->snd_wl1 = seq; | 829 | tp->snd_wl1 = seq; |
835 | } | 830 | } |
@@ -925,7 +920,6 @@ extern void tcp_done(struct sock *sk); | |||
925 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | 920 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) |
926 | { | 921 | { |
927 | rx_opt->dsack = 0; | 922 | rx_opt->dsack = 0; |
928 | rx_opt->eff_sacks = 0; | ||
929 | rx_opt->num_sacks = 0; | 923 | rx_opt->num_sacks = 0; |
930 | } | 924 | } |
931 | 925 | ||
@@ -997,11 +991,21 @@ static inline int tcp_fin_time(const struct sock *sk) | |||
997 | return fin_timeout; | 991 | return fin_timeout; |
998 | } | 992 | } |
999 | 993 | ||
1000 | static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int rst) | 994 | static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, |
995 | int paws_win) | ||
1001 | { | 996 | { |
1002 | if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) | 997 | if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win) |
1003 | return 0; | 998 | return 1; |
1004 | if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) | 999 | if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)) |
1000 | return 1; | ||
1001 | |||
1002 | return 0; | ||
1003 | } | ||
1004 | |||
1005 | static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt, | ||
1006 | int rst) | ||
1007 | { | ||
1008 | if (tcp_paws_check(rx_opt, 0)) | ||
1005 | return 0; | 1009 | return 0; |
1006 | 1010 | ||
1007 | /* RST segments are not recommended to carry timestamp, | 1011 | /* RST segments are not recommended to carry timestamp, |