aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sock.h91
1 files changed, 4 insertions, 87 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 2aa73c0ec6c2..af2b0544586e 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -938,28 +938,7 @@ static inline void sock_put(struct sock *sk)
938 sk_free(sk); 938 sk_free(sk);
939} 939}
940 940
941static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb) 941extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb);
942{
943 int rc = NET_RX_SUCCESS;
944
945 if (sk_filter(sk, skb, 0))
946 goto discard_and_relse;
947
948 skb->dev = NULL;
949
950 bh_lock_sock(sk);
951 if (!sock_owned_by_user(sk))
952 rc = sk->sk_backlog_rcv(sk, skb);
953 else
954 sk_add_backlog(sk, skb);
955 bh_unlock_sock(sk);
956out:
957 sock_put(sk);
958 return rc;
959discard_and_relse:
960 kfree_skb(skb);
961 goto out;
962}
963 942
964/* Detach socket from process context. 943/* Detach socket from process context.
965 * Announce socket dead, detach it from wait queue and inode. 944 * Announce socket dead, detach it from wait queue and inode.
@@ -1044,33 +1023,9 @@ sk_dst_reset(struct sock *sk)
1044 write_unlock(&sk->sk_dst_lock); 1023 write_unlock(&sk->sk_dst_lock);
1045} 1024}
1046 1025
1047static inline struct dst_entry * 1026extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1048__sk_dst_check(struct sock *sk, u32 cookie)
1049{
1050 struct dst_entry *dst = sk->sk_dst_cache;
1051
1052 if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
1053 sk->sk_dst_cache = NULL;
1054 dst_release(dst);
1055 return NULL;
1056 }
1057
1058 return dst;
1059}
1060
1061static inline struct dst_entry *
1062sk_dst_check(struct sock *sk, u32 cookie)
1063{
1064 struct dst_entry *dst = sk_dst_get(sk);
1065 1027
1066 if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) { 1028extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1067 sk_dst_reset(sk);
1068 dst_release(dst);
1069 return NULL;
1070 }
1071
1072 return dst;
1073}
1074 1029
1075static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1030static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
1076{ 1031{
@@ -1140,45 +1095,7 @@ extern void sk_reset_timer(struct sock *sk, struct timer_list* timer,
1140 1095
1141extern void sk_stop_timer(struct sock *sk, struct timer_list* timer); 1096extern void sk_stop_timer(struct sock *sk, struct timer_list* timer);
1142 1097
1143static inline int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) 1098extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
1144{
1145 int err = 0;
1146 int skb_len;
1147
1148 /* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
1149 number of warnings when compiling with -W --ANK
1150 */
1151 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
1152 (unsigned)sk->sk_rcvbuf) {
1153 err = -ENOMEM;
1154 goto out;
1155 }
1156
1157 /* It would be deadlock, if sock_queue_rcv_skb is used
1158 with socket lock! We assume that users of this
1159 function are lock free.
1160 */
1161 err = sk_filter(sk, skb, 1);
1162 if (err)
1163 goto out;
1164
1165 skb->dev = NULL;
1166 skb_set_owner_r(skb, sk);
1167
1168 /* Cache the SKB length before we tack it onto the receive
1169 * queue. Once it is added it no longer belongs to us and
1170 * may be freed by other threads of control pulling packets
1171 * from the queue.
1172 */
1173 skb_len = skb->len;
1174
1175 skb_queue_tail(&sk->sk_receive_queue, skb);
1176
1177 if (!sock_flag(sk, SOCK_DEAD))
1178 sk->sk_data_ready(sk, skb_len);
1179out:
1180 return err;
1181}
1182 1099
1183static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) 1100static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
1184{ 1101{