Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
[firefly-linux-kernel-4.4.55.git] / include / net / sock.h
index b9586a137cadd38e8a36abcd34018cfe9b680047..06a5668f05c984526c4ce2455aff825e2aaa9836 100644 (file)
@@ -862,9 +862,9 @@ static inline void sock_rps_save_rxhash(struct sock *sk,
                                        const struct sk_buff *skb)
 {
 #ifdef CONFIG_RPS
-       if (unlikely(sk->sk_rxhash != skb->rxhash)) {
+       if (unlikely(sk->sk_rxhash != skb->hash)) {
                sock_rps_reset_flow(sk);
-               sk->sk_rxhash = skb->rxhash;
+               sk->sk_rxhash = skb->hash;
        }
 #endif
 }
@@ -1621,33 +1621,6 @@ void sk_common_release(struct sock *sk);
 /* Initialise core socket variables */
 void sock_init_data(struct socket *sock, struct sock *sk);
 
-void sk_filter_release_rcu(struct rcu_head *rcu);
-
-/**
- *     sk_filter_release - release a socket filter
- *     @fp: filter to remove
- *
- *     Remove a filter from a socket and release its resources.
- */
-
-static inline void sk_filter_release(struct sk_filter *fp)
-{
-       if (atomic_dec_and_test(&fp->refcnt))
-               call_rcu(&fp->rcu, sk_filter_release_rcu);
-}
-
-static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
-{
-       atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc);
-       sk_filter_release(fp);
-}
-
-static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
-{
-       atomic_inc(&fp->refcnt);
-       atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc);
-}
-
 /*
  * Socket reference counting postulates.
  *
@@ -2256,8 +2229,12 @@ void sock_net_set(struct sock *sk, struct net *net)
  */
 static inline void sk_change_net(struct sock *sk, struct net *net)
 {
-       put_net(sock_net(sk));
-       sock_net_set(sk, hold_net(net));
+       struct net *current_net = sock_net(sk);
+
+       if (!net_eq(current_net, net)) {
+               put_net(current_net);
+               sock_net_set(sk, hold_net(net));
+       }
 }
 
 static inline struct sock *skb_steal_sock(struct sk_buff *skb)