diff options
Diffstat (limited to 'include/net/sock.h')
| -rw-r--r-- | include/net/sock.h | 71 |
1 files changed, 10 insertions, 61 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 2210fec65669..ab186b1d31ff 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -857,18 +857,6 @@ static inline void sock_rps_record_flow_hash(__u32 hash) | |||
| 857 | #endif | 857 | #endif |
| 858 | } | 858 | } |
| 859 | 859 | ||
| 860 | static inline void sock_rps_reset_flow_hash(__u32 hash) | ||
| 861 | { | ||
| 862 | #ifdef CONFIG_RPS | ||
| 863 | struct rps_sock_flow_table *sock_flow_table; | ||
| 864 | |||
| 865 | rcu_read_lock(); | ||
| 866 | sock_flow_table = rcu_dereference(rps_sock_flow_table); | ||
| 867 | rps_reset_sock_flow(sock_flow_table, hash); | ||
| 868 | rcu_read_unlock(); | ||
| 869 | #endif | ||
| 870 | } | ||
| 871 | |||
| 872 | static inline void sock_rps_record_flow(const struct sock *sk) | 860 | static inline void sock_rps_record_flow(const struct sock *sk) |
| 873 | { | 861 | { |
| 874 | #ifdef CONFIG_RPS | 862 | #ifdef CONFIG_RPS |
| @@ -876,28 +864,18 @@ static inline void sock_rps_record_flow(const struct sock *sk) | |||
| 876 | #endif | 864 | #endif |
| 877 | } | 865 | } |
| 878 | 866 | ||
| 879 | static inline void sock_rps_reset_flow(const struct sock *sk) | ||
| 880 | { | ||
| 881 | #ifdef CONFIG_RPS | ||
| 882 | sock_rps_reset_flow_hash(sk->sk_rxhash); | ||
| 883 | #endif | ||
| 884 | } | ||
| 885 | |||
| 886 | static inline void sock_rps_save_rxhash(struct sock *sk, | 867 | static inline void sock_rps_save_rxhash(struct sock *sk, |
| 887 | const struct sk_buff *skb) | 868 | const struct sk_buff *skb) |
| 888 | { | 869 | { |
| 889 | #ifdef CONFIG_RPS | 870 | #ifdef CONFIG_RPS |
| 890 | if (unlikely(sk->sk_rxhash != skb->hash)) { | 871 | if (unlikely(sk->sk_rxhash != skb->hash)) |
| 891 | sock_rps_reset_flow(sk); | ||
| 892 | sk->sk_rxhash = skb->hash; | 872 | sk->sk_rxhash = skb->hash; |
| 893 | } | ||
| 894 | #endif | 873 | #endif |
| 895 | } | 874 | } |
| 896 | 875 | ||
| 897 | static inline void sock_rps_reset_rxhash(struct sock *sk) | 876 | static inline void sock_rps_reset_rxhash(struct sock *sk) |
| 898 | { | 877 | { |
| 899 | #ifdef CONFIG_RPS | 878 | #ifdef CONFIG_RPS |
| 900 | sock_rps_reset_flow(sk); | ||
| 901 | sk->sk_rxhash = 0; | 879 | sk->sk_rxhash = 0; |
| 902 | #endif | 880 | #endif |
| 903 | } | 881 | } |
| @@ -1099,11 +1077,6 @@ static inline bool memcg_proto_active(struct cg_proto *cg_proto) | |||
| 1099 | return test_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); | 1077 | return test_bit(MEMCG_SOCK_ACTIVE, &cg_proto->flags); |
| 1100 | } | 1078 | } |
| 1101 | 1079 | ||
| 1102 | static inline bool memcg_proto_activated(struct cg_proto *cg_proto) | ||
| 1103 | { | ||
| 1104 | return test_bit(MEMCG_SOCK_ACTIVATED, &cg_proto->flags); | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | #ifdef SOCK_REFCNT_DEBUG | 1080 | #ifdef SOCK_REFCNT_DEBUG |
| 1108 | static inline void sk_refcnt_debug_inc(struct sock *sk) | 1081 | static inline void sk_refcnt_debug_inc(struct sock *sk) |
| 1109 | { | 1082 | { |
| @@ -1374,29 +1347,6 @@ void sk_prot_clear_portaddr_nulls(struct sock *sk, int size); | |||
| 1374 | #define SOCK_BINDADDR_LOCK 4 | 1347 | #define SOCK_BINDADDR_LOCK 4 |
| 1375 | #define SOCK_BINDPORT_LOCK 8 | 1348 | #define SOCK_BINDPORT_LOCK 8 |
| 1376 | 1349 | ||
| 1377 | /* sock_iocb: used to kick off async processing of socket ios */ | ||
| 1378 | struct sock_iocb { | ||
| 1379 | struct list_head list; | ||
| 1380 | |||
| 1381 | int flags; | ||
| 1382 | int size; | ||
| 1383 | struct socket *sock; | ||
| 1384 | struct sock *sk; | ||
| 1385 | struct scm_cookie *scm; | ||
| 1386 | struct msghdr *msg, async_msg; | ||
| 1387 | struct kiocb *kiocb; | ||
| 1388 | }; | ||
| 1389 | |||
| 1390 | static inline struct sock_iocb *kiocb_to_siocb(struct kiocb *iocb) | ||
| 1391 | { | ||
| 1392 | return (struct sock_iocb *)iocb->private; | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | static inline struct kiocb *siocb_to_kiocb(struct sock_iocb *si) | ||
| 1396 | { | ||
| 1397 | return si->kiocb; | ||
| 1398 | } | ||
| 1399 | |||
| 1400 | struct socket_alloc { | 1350 | struct socket_alloc { |
| 1401 | struct socket socket; | 1351 | struct socket socket; |
| 1402 | struct inode vfs_inode; | 1352 | struct inode vfs_inode; |
| @@ -1826,27 +1776,25 @@ static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) | |||
| 1826 | } | 1776 | } |
| 1827 | 1777 | ||
| 1828 | static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, | 1778 | static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, |
| 1829 | char __user *from, char *to, | 1779 | struct iov_iter *from, char *to, |
| 1830 | int copy, int offset) | 1780 | int copy, int offset) |
| 1831 | { | 1781 | { |
| 1832 | if (skb->ip_summed == CHECKSUM_NONE) { | 1782 | if (skb->ip_summed == CHECKSUM_NONE) { |
| 1833 | int err = 0; | 1783 | __wsum csum = 0; |
| 1834 | __wsum csum = csum_and_copy_from_user(from, to, copy, 0, &err); | 1784 | if (csum_and_copy_from_iter(to, copy, &csum, from) != copy) |
| 1835 | if (err) | 1785 | return -EFAULT; |
| 1836 | return err; | ||
| 1837 | skb->csum = csum_block_add(skb->csum, csum, offset); | 1786 | skb->csum = csum_block_add(skb->csum, csum, offset); |
| 1838 | } else if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { | 1787 | } else if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { |
| 1839 | if (!access_ok(VERIFY_READ, from, copy) || | 1788 | if (copy_from_iter_nocache(to, copy, from) != copy) |
| 1840 | __copy_from_user_nocache(to, from, copy)) | ||
| 1841 | return -EFAULT; | 1789 | return -EFAULT; |
| 1842 | } else if (copy_from_user(to, from, copy)) | 1790 | } else if (copy_from_iter(to, copy, from) != copy) |
| 1843 | return -EFAULT; | 1791 | return -EFAULT; |
| 1844 | 1792 | ||
| 1845 | return 0; | 1793 | return 0; |
| 1846 | } | 1794 | } |
| 1847 | 1795 | ||
| 1848 | static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb, | 1796 | static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb, |
| 1849 | char __user *from, int copy) | 1797 | struct iov_iter *from, int copy) |
| 1850 | { | 1798 | { |
| 1851 | int err, offset = skb->len; | 1799 | int err, offset = skb->len; |
| 1852 | 1800 | ||
| @@ -1858,7 +1806,7 @@ static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb, | |||
| 1858 | return err; | 1806 | return err; |
| 1859 | } | 1807 | } |
| 1860 | 1808 | ||
| 1861 | static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from, | 1809 | static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *from, |
| 1862 | struct sk_buff *skb, | 1810 | struct sk_buff *skb, |
| 1863 | struct page *page, | 1811 | struct page *page, |
| 1864 | int off, int copy) | 1812 | int off, int copy) |
| @@ -2262,6 +2210,7 @@ bool sk_net_capable(const struct sock *sk, int cap); | |||
| 2262 | extern __u32 sysctl_wmem_max; | 2210 | extern __u32 sysctl_wmem_max; |
| 2263 | extern __u32 sysctl_rmem_max; | 2211 | extern __u32 sysctl_rmem_max; |
| 2264 | 2212 | ||
| 2213 | extern int sysctl_tstamp_allow_data; | ||
| 2265 | extern int sysctl_optmem_max; | 2214 | extern int sysctl_optmem_max; |
| 2266 | 2215 | ||
| 2267 | extern __u32 sysctl_wmem_default; | 2216 | extern __u32 sysctl_wmem_default; |
