diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/sysctl.h | 1 | ||||
| -rw-r--r-- | include/linux/tcp.h | 16 | ||||
| -rw-r--r-- | include/net/sock.h | 6 | ||||
| -rw-r--r-- | include/net/tcp.h | 71 |
4 files changed, 88 insertions, 6 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 22cf5e1ac987..ab2791b3189d 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -390,6 +390,7 @@ enum | |||
| 390 | NET_TCP_BIC_BETA=108, | 390 | NET_TCP_BIC_BETA=108, |
| 391 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, | 391 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, |
| 392 | NET_TCP_CONG_CONTROL=110, | 392 | NET_TCP_CONG_CONTROL=110, |
| 393 | NET_TCP_ABC=111, | ||
| 393 | }; | 394 | }; |
| 394 | 395 | ||
| 395 | enum { | 396 | enum { |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index ac4ca44c75ca..0e1da6602e05 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
| @@ -307,6 +307,21 @@ struct tcp_sock { | |||
| 307 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 307 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
| 308 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ | 308 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ |
| 309 | 309 | ||
| 310 | struct tcp_sack_block recv_sack_cache[4]; | ||
| 311 | |||
| 312 | /* from STCP, retrans queue hinting */ | ||
| 313 | struct sk_buff* lost_skb_hint; | ||
| 314 | |||
| 315 | struct sk_buff *scoreboard_skb_hint; | ||
| 316 | struct sk_buff *retransmit_skb_hint; | ||
| 317 | struct sk_buff *forward_skb_hint; | ||
| 318 | struct sk_buff *fastpath_skb_hint; | ||
| 319 | |||
| 320 | int fastpath_cnt_hint; | ||
| 321 | int lost_cnt_hint; | ||
| 322 | int retransmit_cnt_hint; | ||
| 323 | int forward_cnt_hint; | ||
| 324 | |||
| 310 | __u16 advmss; /* Advertised MSS */ | 325 | __u16 advmss; /* Advertised MSS */ |
| 311 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ | 326 | __u16 prior_ssthresh; /* ssthresh saved at recovery start */ |
| 312 | __u32 lost_out; /* Lost packets */ | 327 | __u32 lost_out; /* Lost packets */ |
| @@ -326,6 +341,7 @@ struct tcp_sock { | |||
| 326 | __u32 snd_up; /* Urgent pointer */ | 341 | __u32 snd_up; /* Urgent pointer */ |
| 327 | 342 | ||
| 328 | __u32 total_retrans; /* Total retransmits for entire connection */ | 343 | __u32 total_retrans; /* Total retransmits for entire connection */ |
| 344 | __u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */ | ||
| 329 | 345 | ||
| 330 | unsigned int keepalive_time; /* time before keep alive takes place */ | 346 | unsigned int keepalive_time; /* time before keep alive takes place */ |
| 331 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ | 347 | unsigned int keepalive_intvl; /* time interval between keep alive probes */ |
diff --git a/include/net/sock.h b/include/net/sock.h index ff13c4cc287a..982b4ecd187b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -1247,6 +1247,12 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) | |||
| 1247 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | 1247 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ |
| 1248 | skb = skb->next) | 1248 | skb = skb->next) |
| 1249 | 1249 | ||
| 1250 | /*from STCP for fast SACK Process*/ | ||
| 1251 | #define sk_stream_for_retrans_queue_from(skb, sk) \ | ||
| 1252 | for (; (skb != (sk)->sk_send_head) && \ | ||
| 1253 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
| 1254 | skb = skb->next) | ||
| 1255 | |||
| 1250 | /* | 1256 | /* |
| 1251 | * Default write policy as shown to user space via poll/select/SIGIO | 1257 | * Default write policy as shown to user space via poll/select/SIGIO |
| 1252 | */ | 1258 | */ |
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 | ||
| 185 | extern struct inet_timewait_death_row tcp_death_row; | 185 | extern struct inet_timewait_death_row tcp_death_row; |
| 186 | 186 | ||
| @@ -218,6 +218,7 @@ extern int sysctl_tcp_low_latency; | |||
| 218 | extern int sysctl_tcp_nometrics_save; | 218 | extern int sysctl_tcp_nometrics_save; |
| 219 | extern int sysctl_tcp_moderate_rcvbuf; | 219 | extern int sysctl_tcp_moderate_rcvbuf; |
| 220 | extern int sysctl_tcp_tso_win_divisor; | 220 | extern int sysctl_tcp_tso_win_divisor; |
| 221 | extern int sysctl_tcp_abc; | ||
| 221 | 222 | ||
| 222 | extern atomic_t tcp_memory_allocated; | 223 | extern atomic_t tcp_memory_allocated; |
| 223 | extern atomic_t tcp_sockets_allocated; | 224 | extern 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 | */ | ||
| 772 | static 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 | |||
| 768 | static inline void tcp_sync_left_out(struct tcp_sock *tp) | 796 | static 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 | */ | ||
| 845 | static 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 | |||
| 813 | static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, | 863 | static __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 */ | ||
| 1211 | static 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 */ |
| 1161 | enum tcp_seq_states { | 1220 | enum tcp_seq_states { |
| 1162 | TCP_SEQ_STATE_LISTENING, | 1221 | TCP_SEQ_STATE_LISTENING, |
