aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-12-26 23:42:22 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-03 16:11:19 -0500
commit25995ff577675b58dbd848b7758e7bad87411947 (patch)
tree4d47595b01f8645552fa8af7b2be2019f133fefb /include
parentce1d4d3e88b3a69d23c3feb436a0b36b6ca0642b (diff)
[SOCK]: Introduce sk_receive_skb
Its common enough to to justify that, TCP still can't use it as it has the prequeueing stuff, still to be made generic in the not so distant future :-) Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/sock.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 91d28957dc10..6961700ff3a0 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk)
926 sk_free(sk); 926 sk_free(sk);
927} 927}
928 928
929static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
930{
931 int rc = NET_RX_SUCCESS;
932
933 if (sk_filter(sk, skb, 0))
934 goto discard_and_relse;
935
936 skb->dev = NULL;
937
938 bh_lock_sock(sk);
939 if (!sock_owned_by_user(sk))
940 rc = sk->sk_backlog_rcv(sk, skb);
941 else
942 sk_add_backlog(sk, skb);
943 bh_unlock_sock(sk);
944out:
945 sock_put(sk);
946 return rc;
947discard_and_relse:
948 kfree_skb(skb);
949 goto out;
950}
951
929/* Detach socket from process context. 952/* Detach socket from process context.
930 * Announce socket dead, detach it from wait queue and inode. 953 * Announce socket dead, detach it from wait queue and inode.
931 * Note that parent inode held reference count on this struct sock, 954 * Note that parent inode held reference count on this struct sock,