aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h71
1 files changed, 65 insertions, 6 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 96cc3b434e40..0f9848011972 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -89,10 +89,10 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
89 */ 89 */
90 90
91#define TCP_SYN_RETRIES 5 /* number of times to retry active opening a 91#define TCP_SYN_RETRIES 5 /* number of times to retry active opening a
92 * connection: ~180sec is RFC minumum */ 92 * connection: ~180sec is RFC minimum */
93 93
94#define TCP_SYNACK_RETRIES 5 /* number of times to retry passive opening a 94#define TCP_SYNACK_RETRIES 5 /* number of times to retry passive opening a
95 * connection: ~180sec is RFC minumum */ 95 * connection: ~180sec is RFC minimum */
96 96
97 97
98#define TCP_ORPHAN_RETRIES 7 /* number of times to retry on an orphaned 98#define TCP_ORPHAN_RETRIES 7 /* number of times to retry on an orphaned
@@ -180,7 +180,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
180/* Flags in tp->nonagle */ 180/* Flags in tp->nonagle */
181#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ 181#define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */
182#define TCP_NAGLE_CORK 2 /* Socket is corked */ 182#define TCP_NAGLE_CORK 2 /* Socket is corked */
183#define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ 183#define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */
184 184
185extern struct inet_timewait_death_row tcp_death_row; 185extern struct inet_timewait_death_row tcp_death_row;
186 186
@@ -218,6 +218,7 @@ extern int sysctl_tcp_low_latency;
218extern int sysctl_tcp_nometrics_save; 218extern int sysctl_tcp_nometrics_save;
219extern int sysctl_tcp_moderate_rcvbuf; 219extern int sysctl_tcp_moderate_rcvbuf;
220extern int sysctl_tcp_tso_win_divisor; 220extern int sysctl_tcp_tso_win_divisor;
221extern int sysctl_tcp_abc;
221 222
222extern atomic_t tcp_memory_allocated; 223extern atomic_t tcp_memory_allocated;
223extern atomic_t tcp_sockets_allocated; 224extern atomic_t tcp_sockets_allocated;
@@ -551,13 +552,13 @@ extern u32 __tcp_select_window(struct sock *sk);
551 552
552/* TCP timestamps are only 32-bits, this causes a slight 553/* TCP timestamps are only 32-bits, this causes a slight
553 * complication on 64-bit systems since we store a snapshot 554 * complication on 64-bit systems since we store a snapshot
554 * of jiffies in the buffer control blocks below. We decidely 555 * of jiffies in the buffer control blocks below. We decidedly
555 * only use of the low 32-bits of jiffies and hide the ugly 556 * only use of the low 32-bits of jiffies and hide the ugly
556 * casts with the following macro. 557 * casts with the following macro.
557 */ 558 */
558#define tcp_time_stamp ((__u32)(jiffies)) 559#define tcp_time_stamp ((__u32)(jiffies))
559 560
560/* This is what the send packet queueing engine uses to pass 561/* This is what the send packet queuing engine uses to pass
561 * TCP per-packet control information to the transmission 562 * TCP per-packet control information to the transmission
562 * code. We also store the host-order sequence numbers in 563 * code. We also store the host-order sequence numbers in
563 * here too. This is 36 bytes on 32-bit architectures, 564 * here too. This is 36 bytes on 32-bit architectures,
@@ -597,7 +598,7 @@ struct tcp_skb_cb {
597#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 598#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
598#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 599#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
599 600
600#define TCPCB_URG 0x20 /* Urgent pointer advenced here */ 601#define TCPCB_URG 0x20 /* Urgent pointer advanced here */
601 602
602#define TCPCB_AT_TAIL (TCPCB_URG) 603#define TCPCB_AT_TAIL (TCPCB_URG)
603 604
@@ -765,6 +766,33 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
765 (tp->snd_cwnd >> 2))); 766 (tp->snd_cwnd >> 2)));
766} 767}
767 768
769/*
770 * Linear increase during slow start
771 */
772static inline void tcp_slow_start(struct tcp_sock *tp)
773{
774 if (sysctl_tcp_abc) {
775 /* RFC3465: Slow Start
776 * TCP sender SHOULD increase cwnd by the number of
777 * previously unacknowledged bytes ACKed by each incoming
778 * acknowledgment, provided the increase is not more than L
779 */
780 if (tp->bytes_acked < tp->mss_cache)
781 return;
782
783 /* We MAY increase by 2 if discovered delayed ack */
784 if (sysctl_tcp_abc > 1 && tp->bytes_acked > 2*tp->mss_cache) {
785 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
786 tp->snd_cwnd++;
787 }
788 }
789 tp->bytes_acked = 0;
790
791 if (tp->snd_cwnd < tp->snd_cwnd_clamp)
792 tp->snd_cwnd++;
793}
794
795
768static inline void tcp_sync_left_out(struct tcp_sock *tp) 796static inline void tcp_sync_left_out(struct tcp_sock *tp)
769{ 797{
770 if (tp->rx_opt.sack_ok && 798 if (tp->rx_opt.sack_ok &&
@@ -794,6 +822,7 @@ static inline void tcp_enter_cwr(struct sock *sk)
794 struct tcp_sock *tp = tcp_sk(sk); 822 struct tcp_sock *tp = tcp_sk(sk);
795 823
796 tp->prior_ssthresh = 0; 824 tp->prior_ssthresh = 0;
825 tp->bytes_acked = 0;
797 if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) { 826 if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) {
798 __tcp_enter_cwr(sk); 827 __tcp_enter_cwr(sk);
799 tcp_set_ca_state(sk, TCP_CA_CWR); 828 tcp_set_ca_state(sk, TCP_CA_CWR);
@@ -810,6 +839,27 @@ static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp)
810 return 3; 839 return 3;
811} 840}
812 841
842/* RFC2861 Check whether we are limited by application or congestion window
843 * This is the inverse of cwnd check in tcp_tso_should_defer
844 */
845static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
846{
847 const struct tcp_sock *tp = tcp_sk(sk);
848 u32 left;
849
850 if (in_flight >= tp->snd_cwnd)
851 return 1;
852
853 if (!(sk->sk_route_caps & NETIF_F_TSO))
854 return 0;
855
856 left = tp->snd_cwnd - in_flight;
857 if (sysctl_tcp_tso_win_divisor)
858 return left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd;
859 else
860 return left <= tcp_max_burst(tp);
861}
862
813static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, 863static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss,
814 const struct sk_buff *skb) 864 const struct sk_buff *skb)
815{ 865{
@@ -1157,6 +1207,15 @@ static inline void tcp_mib_init(void)
1157 TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1); 1207 TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1);
1158} 1208}
1159 1209
1210/*from STCP */
1211static inline void clear_all_retrans_hints(struct tcp_sock *tp){
1212 tp->lost_skb_hint = NULL;
1213 tp->scoreboard_skb_hint = NULL;
1214 tp->retransmit_skb_hint = NULL;
1215 tp->forward_skb_hint = NULL;
1216 tp->fastpath_skb_hint = NULL;
1217}
1218
1160/* /proc */ 1219/* /proc */
1161enum tcp_seq_states { 1220enum tcp_seq_states {
1162 TCP_SEQ_STATE_LISTENING, 1221 TCP_SEQ_STATE_LISTENING,