Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[firefly-linux-kernel-4.4.55.git] / include / net / tcp.h
index 0118ea999f67a882f6e4e389aa9f2b685e571955..42c29bfbcee34d8d6ada5d18533850d82973f352 100644 (file)
@@ -273,6 +273,14 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
        return seq3 - seq2 >= seq1 - seq2;
 }
 
+static inline bool tcp_out_of_memory(struct sock *sk)
+{
+       if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
+           sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
+               return true;
+       return false;
+}
+
 static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
 {
        struct percpu_counter *ocp = sk->sk_prot->orphan_count;
@@ -283,13 +291,11 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
                if (orphans << shift > sysctl_tcp_max_orphans)
                        return true;
        }
-
-       if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
-           sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
-               return true;
        return false;
 }
 
+extern bool tcp_check_oom(struct sock *sk, int shift);
+
 /* syncookies: remember time of last synqueue overflow */
 static inline void tcp_synq_overflow(struct sock *sk)
 {
@@ -311,6 +317,8 @@ extern struct proto tcp_prot;
 #define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
 #define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
 
+extern void tcp_init_mem(struct net *net);
+
 extern void tcp_v4_err(struct sk_buff *skb, u32);
 
 extern void tcp_shutdown (struct sock *sk, int how);