aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 7f89e4ba18d1..14d3c0734007 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -254,7 +254,6 @@ struct cg_proto;
254 * @sk_wq: sock wait queue and async head 254 * @sk_wq: sock wait queue and async head
255 * @sk_rx_dst: receive input route used by early demux 255 * @sk_rx_dst: receive input route used by early demux
256 * @sk_dst_cache: destination cache 256 * @sk_dst_cache: destination cache
257 * @sk_dst_lock: destination cache lock
258 * @sk_policy: flow policy 257 * @sk_policy: flow policy
259 * @sk_receive_queue: incoming packets 258 * @sk_receive_queue: incoming packets
260 * @sk_wmem_alloc: transmit queue bytes committed 259 * @sk_wmem_alloc: transmit queue bytes committed
@@ -384,14 +383,16 @@ struct sock {
384 int sk_rcvbuf; 383 int sk_rcvbuf;
385 384
386 struct sk_filter __rcu *sk_filter; 385 struct sk_filter __rcu *sk_filter;
387 struct socket_wq __rcu *sk_wq; 386 union {
388 387 struct socket_wq __rcu *sk_wq;
388 struct socket_wq *sk_wq_raw;
389 };
389#ifdef CONFIG_XFRM 390#ifdef CONFIG_XFRM
390 struct xfrm_policy *sk_policy[2]; 391 struct xfrm_policy __rcu *sk_policy[2];
391#endif 392#endif
392 struct dst_entry *sk_rx_dst; 393 struct dst_entry *sk_rx_dst;
393 struct dst_entry __rcu *sk_dst_cache; 394 struct dst_entry __rcu *sk_dst_cache;
394 spinlock_t sk_dst_lock; 395 /* Note: 32bit hole on 64bit arches */
395 atomic_t sk_wmem_alloc; 396 atomic_t sk_wmem_alloc;
396 atomic_t sk_omem_alloc; 397 atomic_t sk_omem_alloc;
397 int sk_sndbuf; 398 int sk_sndbuf;
@@ -403,6 +404,7 @@ struct sock {
403 sk_userlocks : 4, 404 sk_userlocks : 4,
404 sk_protocol : 8, 405 sk_protocol : 8,
405 sk_type : 16; 406 sk_type : 16;
407#define SK_PROTOCOL_MAX U8_MAX
406 kmemcheck_bitfield_end(flags); 408 kmemcheck_bitfield_end(flags);
407 int sk_wmem_queued; 409 int sk_wmem_queued;
408 gfp_t sk_allocation; 410 gfp_t sk_allocation;
@@ -739,6 +741,8 @@ enum sock_flags {
739 SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */ 741 SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */
740}; 742};
741 743
744#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))
745
742static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 746static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
743{ 747{
744 nsk->sk_flags = osk->sk_flags; 748 nsk->sk_flags = osk->sk_flags;
@@ -813,7 +817,7 @@ void sk_stream_write_space(struct sock *sk);
813static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 817static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
814{ 818{
815 /* dont let skb dst not refcounted, we are going to leave rcu lock */ 819 /* dont let skb dst not refcounted, we are going to leave rcu lock */
816 skb_dst_force(skb); 820 skb_dst_force_safe(skb);
817 821
818 if (!sk->sk_backlog.tail) 822 if (!sk->sk_backlog.tail)
819 sk->sk_backlog.head = skb; 823 sk->sk_backlog.head = skb;
@@ -2005,10 +2009,27 @@ static inline unsigned long sock_wspace(struct sock *sk)
2005 return amt; 2009 return amt;
2006} 2010}
2007 2011
2008static inline void sk_wake_async(struct sock *sk, int how, int band) 2012/* Note:
2013 * We use sk->sk_wq_raw, from contexts knowing this
2014 * pointer is not NULL and cannot disappear/change.
2015 */
2016static inline void sk_set_bit(int nr, struct sock *sk)
2017{
2018 set_bit(nr, &sk->sk_wq_raw->flags);
2019}
2020
2021static inline void sk_clear_bit(int nr, struct sock *sk)
2022{
2023 clear_bit(nr, &sk->sk_wq_raw->flags);
2024}
2025
2026static inline void sk_wake_async(const struct sock *sk, int how, int band)
2009{ 2027{
2010 if (sock_flag(sk, SOCK_FASYNC)) 2028 if (sock_flag(sk, SOCK_FASYNC)) {
2011 sock_wake_async(sk->sk_socket, how, band); 2029 rcu_read_lock();
2030 sock_wake_async(rcu_dereference(sk->sk_wq), how, band);
2031 rcu_read_unlock();
2032 }
2012} 2033}
2013 2034
2014/* Since sk_{r,w}mem_alloc sums skb->truesize, even a small frame might 2035/* Since sk_{r,w}mem_alloc sums skb->truesize, even a small frame might