[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>
This commit is contained in:
committed by
David S. Miller
parent
ce1d4d3e88
commit
25995ff577
@@ -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,
|
||||
|
Reference in New Issue
Block a user