summaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-12-27 02:42:22 -0200
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-03 13:11:19 -0800
commit25995ff577675b58dbd848b7758e7bad87411947 (patch)
tree4d47595b01f8645552fa8af7b2be2019f133fefb /include/net/sock.h
parentce1d4d3e88b3a69d23c3feb436a0b36b6ca0642b (diff)
downloadop-kernel-dev-25995ff577675b58dbd848b7758e7bad87411947.zip
op-kernel-dev-25995ff577675b58dbd848b7758e7bad87411947.tar.gz
[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/net/sock.h')
-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 91d2895..6961700 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk)
sk_free(sk);
}
+static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb)
+{
+ int rc = NET_RX_SUCCESS;
+
+ if (sk_filter(sk, skb, 0))
+ goto discard_and_relse;
+
+ skb->dev = NULL;
+
+ bh_lock_sock(sk);
+ if (!sock_owned_by_user(sk))
+ rc = sk->sk_backlog_rcv(sk, skb);
+ else
+ sk_add_backlog(sk, skb);
+ bh_unlock_sock(sk);
+out:
+ sock_put(sk);
+ return rc;
+discard_and_relse:
+ kfree_skb(skb);
+ goto out;
+}
+
/* Detach socket from process context.
* Announce socket dead, detach it from wait queue and inode.
* Note that parent inode held reference count on this struct sock,
OpenPOWER on IntegriCloud