Commit b7155403 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Arnaldo Carvalho de Melo

[NET] generalise tcp_eat_skb into sk_eat_skb

It was already generic, so reflect this in the naming.

Later patches will make it be used in other network families.
parent 8bb48a17
......@@ -1040,6 +1040,20 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
sk->sk_stamp = *stamp;
}
/**
* sk_eat_skb - Release a skb if it is no longer needed
* @sk - socket to eat this skb from
* @skb - socket buffer to eat
*
* This routine must be called with interrupts disabled or with the socket
* locked so that the sk_buff queue operation is ok.
*/
static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb)
{
__skb_unlink(skb, &sk->sk_receive_queue);
__kfree_skb(skb);
}
extern atomic_t netstamp_needed;
extern void sock_enable_timestamp(struct sock *sk);
extern void sock_disable_timestamp(struct sock *sk);
......
......@@ -1296,18 +1296,6 @@ static int tcp_recv_urg(struct sock *sk, long timeo,
return -EAGAIN;
}
/*
* Release a skb if it is no longer needed. This routine
* must be called with interrupts disabled or with the
* socket locked so that the sk_buff queue operation is ok.
*/
static inline void tcp_eat_skb(struct sock *sk, struct sk_buff *skb)
{
__skb_unlink(skb, &sk->sk_receive_queue);
__kfree_skb(skb);
}
/* Clean up the receive buffer for full frames taken by the user,
* then send an ACK if necessary. COPIED is the number of bytes
* tcp_recvmsg has given to the user so far, it speeds up the
......@@ -1473,11 +1461,11 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
break;
}
if (skb->h.th->fin) {
tcp_eat_skb(sk, skb);
sk_eat_skb(sk, skb);
++seq;
break;
}
tcp_eat_skb(sk, skb);
sk_eat_skb(sk, skb);
if (!desc->count)
break;
}
......@@ -1758,14 +1746,14 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (skb->h.th->fin)
goto found_fin_ok;
if (!(flags & MSG_PEEK))
tcp_eat_skb(sk, skb);
sk_eat_skb(sk, skb);
continue;
found_fin_ok:
/* Process the FIN. */
++*seq;
if (!(flags & MSG_PEEK))
tcp_eat_skb(sk, skb);
sk_eat_skb(sk, skb);
break;
} while (len > 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment