Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[deliverable/linux.git] / include / net / sock.h
index f21f0708ec59ab6fa186657aaa15380590b061f2..43c6abcf06abc0a5bf0d56bb9235e6800a1fc111 100644 (file)
@@ -429,7 +429,9 @@ struct sock {
        void                    *sk_security;
 #endif
        __u32                   sk_mark;
+#ifdef CONFIG_CGROUP_NET_CLASSID
        u32                     sk_classid;
+#endif
        struct cg_proto         *sk_cgrp;
        void                    (*sk_state_change)(struct sock *sk);
        void                    (*sk_data_ready)(struct sock *sk);
@@ -1685,6 +1687,20 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
 kuid_t sock_i_uid(struct sock *sk);
 unsigned long sock_i_ino(struct sock *sk);
 
+static inline void sk_set_txhash(struct sock *sk)
+{
+       sk->sk_txhash = prandom_u32();
+
+       if (unlikely(!sk->sk_txhash))
+               sk->sk_txhash = 1;
+}
+
+static inline void sk_rethink_txhash(struct sock *sk)
+{
+       if (sk->sk_txhash)
+               sk_set_txhash(sk);
+}
+
 static inline struct dst_entry *
 __sk_dst_get(struct sock *sk)
 {
@@ -1709,6 +1725,8 @@ static inline void dst_negative_advice(struct sock *sk)
 {
        struct dst_entry *ndst, *dst = __sk_dst_get(sk);
 
+       sk_rethink_txhash(sk);
+
        if (dst && dst->ops->negative_advice) {
                ndst = dst->ops->negative_advice(dst);
 
This page took 0.026327 seconds and 5 git commands to generate.