]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/net/tcp.h
Merge tag 'regulator-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[karo-tx-linux.git] / include / net / tcp.h
index f80e74c5ad18b22c274ecd7e75b6a23ffe7268b4..8ea19977ea530bffb57bebed734b977c95b603c5 100644 (file)
@@ -240,9 +240,6 @@ extern int sysctl_tcp_timestamps;
 extern int sysctl_tcp_window_scaling;
 extern int sysctl_tcp_sack;
 extern int sysctl_tcp_fin_timeout;
-extern int sysctl_tcp_keepalive_time;
-extern int sysctl_tcp_keepalive_probes;
-extern int sysctl_tcp_keepalive_intvl;
 extern int sysctl_tcp_syn_retries;
 extern int sysctl_tcp_synack_retries;
 extern int sysctl_tcp_retries1;
@@ -292,8 +289,9 @@ extern int tcp_memory_pressure;
 /* optimized version of sk_under_memory_pressure() for TCP sockets */
 static inline bool tcp_under_memory_pressure(const struct sock *sk)
 {
-       if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
-               return !!sk->sk_cgrp->memory_pressure;
+       if (mem_cgroup_sockets_enabled && sk->sk_memcg &&
+           mem_cgroup_under_socket_pressure(sk->sk_memcg))
+               return true;
 
        return tcp_memory_pressure;
 }
@@ -1170,6 +1168,8 @@ void tcp_set_state(struct sock *sk, int state);
 
 void tcp_done(struct sock *sk);
 
+int tcp_abort(struct sock *sk, int err);
+
 static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
 {
        rx_opt->dsack = 0;
@@ -1223,17 +1223,23 @@ void tcp_enter_memory_pressure(struct sock *sk);
 
 static inline int keepalive_intvl_when(const struct tcp_sock *tp)
 {
-       return tp->keepalive_intvl ? : sysctl_tcp_keepalive_intvl;
+       struct net *net = sock_net((struct sock *)tp);
+
+       return tp->keepalive_intvl ? : net->ipv4.sysctl_tcp_keepalive_intvl;
 }
 
 static inline int keepalive_time_when(const struct tcp_sock *tp)
 {
-       return tp->keepalive_time ? : sysctl_tcp_keepalive_time;
+       struct net *net = sock_net((struct sock *)tp);
+
+       return tp->keepalive_time ? : net->ipv4.sysctl_tcp_keepalive_time;
 }
 
 static inline int keepalive_probes(const struct tcp_sock *tp)
 {
-       return tp->keepalive_probes ? : sysctl_tcp_keepalive_probes;
+       struct net *net = sock_net((struct sock *)tp);
+
+       return tp->keepalive_probes ? : net->ipv4.sysctl_tcp_keepalive_probes;
 }
 
 static inline u32 keepalive_time_elapsed(const struct tcp_sock *tp)
@@ -1618,6 +1624,18 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
                tcp_sk(sk)->highest_sack = new;
 }
 
+/* This helper checks if socket has IP_TRANSPARENT set */
+static inline bool inet_sk_transparent(const struct sock *sk)
+{
+       switch (sk->sk_state) {
+       case TCP_TIME_WAIT:
+               return inet_twsk(sk)->tw_transparent;
+       case TCP_NEW_SYN_RECV:
+               return inet_rsk(inet_reqsk(sk))->no_srccheck;
+       }
+       return inet_sk(sk)->transparent;
+}
+
 /* Determines whether this is a thin stream (which may suffer from
  * increased latency). Used to trigger latency-reducing mechanisms.
  */