]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/net/sock.h
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux.git] / include / net / sock.h
index 718e62fbe869db3ee7e8994bd1bfd559ab9c61c7..8dff68b4c3168a75c762e31e8fe91abb519554e2 100644 (file)
@@ -66,7 +66,6 @@
 #include <net/checksum.h>
 #include <net/tcp_states.h>
 #include <linux/net_tstamp.h>
-#include <net/smc.h>
 #include <net/l3mdev.h>
 
 /*
@@ -723,6 +722,11 @@ static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_h
        hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
 }
 
+static inline void __sk_nulls_add_node_tail_rcu(struct sock *sk, struct hlist_nulls_head *list)
+{
+       hlist_nulls_add_tail_rcu(&sk->sk_nulls_node, list);
+}
+
 static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
 {
        sock_hold(sk);
@@ -860,17 +864,17 @@ static inline gfp_t sk_gfp_mask(const struct sock *sk, gfp_t gfp_mask)
 
 static inline void sk_acceptq_removed(struct sock *sk)
 {
-       sk->sk_ack_backlog--;
+       WRITE_ONCE(sk->sk_ack_backlog, sk->sk_ack_backlog - 1);
 }
 
 static inline void sk_acceptq_added(struct sock *sk)
 {
-       sk->sk_ack_backlog++;
+       WRITE_ONCE(sk->sk_ack_backlog, sk->sk_ack_backlog + 1);
 }
 
 static inline bool sk_acceptq_is_full(const struct sock *sk)
 {
-       return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
+       return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog);
 }
 
 /*
@@ -900,11 +904,11 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
        skb_dst_force(skb);
 
        if (!sk->sk_backlog.tail)
-               sk->sk_backlog.head = skb;
+               WRITE_ONCE(sk->sk_backlog.head, skb);
        else
                sk->sk_backlog.tail->next = skb;
 
-       sk->sk_backlog.tail = skb;
+       WRITE_ONCE(sk->sk_backlog.tail, skb);
        skb->next = NULL;
 }
 
@@ -1489,7 +1493,7 @@ static inline void sock_release_ownership(struct sock *sk)
                sk->sk_lock.owned = 0;
 
                /* The sk_lock has mutex_unlock() semantics: */
-               mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_);
+               mutex_release(&sk->sk_lock.dep_map, _RET_IP_);
        }
 }
 
@@ -1940,8 +1944,8 @@ struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
 
 static inline void sk_dst_confirm(struct sock *sk)
 {
-       if (!sk->sk_dst_pending_confirm)
-               sk->sk_dst_pending_confirm = 1;
+       if (!READ_ONCE(sk->sk_dst_pending_confirm))
+               WRITE_ONCE(sk->sk_dst_pending_confirm, 1);
 }
 
 static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
@@ -1951,10 +1955,10 @@ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
                unsigned long now = jiffies;
 
                /* avoid dirtying neighbour */
-               if (n->confirmed != now)
-                       n->confirmed = now;
-               if (sk && sk->sk_dst_pending_confirm)
-                       sk->sk_dst_pending_confirm = 0;
+               if (READ_ONCE(n->confirmed) != now)
+                       WRITE_ONCE(n->confirmed, now);
+               if (sk && READ_ONCE(sk->sk_dst_pending_confirm))
+                       WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
        }
 }
 
@@ -2306,7 +2310,7 @@ struct sock_skb_cb {
  * using skb->cb[] would keep using it directly and utilize its
  * alignement guarantee.
  */
-#define SOCK_SKB_CB_OFFSET ((FIELD_SIZEOF(struct sk_buff, cb) - \
+#define SOCK_SKB_CB_OFFSET ((sizeof_field(struct sk_buff, cb) - \
                            sizeof(struct sock_skb_cb)))
 
 #define SOCK_SKB_CB(__skb) ((struct sock_skb_cb *)((__skb)->cb + \
@@ -2528,7 +2532,7 @@ static inline bool sk_listener(const struct sock *sk)
        return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV);
 }
 
-void sock_enable_timestamp(struct sock *sk, int flag);
+void sock_enable_timestamp(struct sock *sk, enum sock_flags flag);
 int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
                       int type);
 
@@ -2584,9 +2588,9 @@ static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto)
  */
 static inline void sk_pacing_shift_update(struct sock *sk, int val)
 {
-       if (!sk || !sk_fullsock(sk) || sk->sk_pacing_shift == val)
+       if (!sk || !sk_fullsock(sk) || READ_ONCE(sk->sk_pacing_shift) == val)
                return;
-       sk->sk_pacing_shift = val;
+       WRITE_ONCE(sk->sk_pacing_shift, val);
 }
 
 /* if a socket is bound to a device, check that the given device