]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/net/tcp.h
Merge branch 'master' into tk71
[mv-sheeva.git] / include / net / tcp.h
index 3e4b33e36602caade361654d0561a65b3fba2224..38509f047382c35b7b5d06211f3feaa0820eacb4 100644 (file)
@@ -60,6 +60,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
  */
 #define MAX_TCP_WINDOW         32767U
 
+/* Offer an initial receive window of 10 mss. */
+#define TCP_DEFAULT_INIT_RCVWND        10
+
 /* Minimal accepted MSS. It is (60+60+8) - (20+20). */
 #define TCP_MIN_MSS            88U
 
@@ -100,12 +103,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
 #define TCP_SYNACK_RETRIES 5   /* number of times to retry passive opening a
                                 * connection: ~180sec is RFC minimum   */
 
-
-#define TCP_ORPHAN_RETRIES 7   /* number of times to retry on an orphaned
-                                * socket. 7 is ~50sec-16min.
-                                */
-
-
 #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
                                  * state, about 60 seconds     */
 #define TCP_FIN_TIMEOUT        TCP_TIMEWAIT_LEN
@@ -224,7 +221,7 @@ extern int sysctl_tcp_fack;
 extern int sysctl_tcp_reordering;
 extern int sysctl_tcp_ecn;
 extern int sysctl_tcp_dsack;
-extern int sysctl_tcp_mem[3];
+extern long sysctl_tcp_mem[3];
 extern int sysctl_tcp_wmem[3];
 extern int sysctl_tcp_rmem[3];
 extern int sysctl_tcp_app_win;
@@ -247,7 +244,7 @@ extern int sysctl_tcp_cookie_size;
 extern int sysctl_tcp_thin_linear_timeouts;
 extern int sysctl_tcp_thin_dupack;
 
-extern atomic_t tcp_memory_allocated;
+extern atomic_long_t tcp_memory_allocated;
 extern struct percpu_counter tcp_sockets_allocated;
 extern int tcp_memory_pressure;
 
@@ -280,7 +277,7 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
        }
 
        if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
-           atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])
+           atomic_long_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])
                return true;
        return false;
 }
@@ -312,7 +309,8 @@ extern void tcp_shutdown (struct sock *sk, int how);
 
 extern int tcp_v4_rcv(struct sk_buff *skb);
 
-extern int tcp_v4_remember_stamp(struct sock *sk);
+extern struct inet_peer *tcp_v4_get_peer(struct sock *sk, bool *release_it);
+extern void *tcp_v4_tw_get_peer(struct sock *sk);
 extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
 extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                       size_t size);
@@ -346,8 +344,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
        }
 }
 
-extern void tcp_enter_quickack_mode(struct sock *sk);
-
 #define        TCP_ECN_OK              1
 #define        TCP_ECN_QUEUE_CWR       2
 #define        TCP_ECN_DEMAND_CWR      4
@@ -803,6 +799,15 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
 /* Use define here intentionally to get WARN_ON location shown at the caller */
 #define tcp_verify_left_out(tp)        WARN_ON(tcp_left_out(tp) > tp->packets_out)
 
+/*
+ * Convert RFC 3390 larger initial window into an equivalent number of packets.
+ * This is based on the numbers specified in RFC 5681, 3.1.
+ */
+static inline u32 rfc3390_bytes_to_packets(const u32 smss)
+{
+       return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3);
+}
+
 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
 extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
 
@@ -1036,7 +1041,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt,
                return 1;
        if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
                return 1;
-
+       /*
+        * Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0,
+        * then following tcp messages have valid values. Ignore 0 value,
+        * or else 'negative' tsval might forbid us to accept their packets.
+        */
+       if (!rx_opt->ts_recent)
+               return 1;
        return 0;
 }
 
@@ -1150,8 +1161,6 @@ struct tcp_md5sig_pool {
        union tcp_md5sum_block  md5_blk;
 };
 
-#define TCP_MD5SIG_MAXKEYS     (~(u32)0)       /* really?! */
-
 /* - functions */
 extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
                               struct sock *sk, struct request_sock *req,