Commit 27728ba8 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: cleanup tcp_remove_empty_skb() use

All tcp_remove_empty_skb() callers now use tcp_write_queue_tail()
for the skb argument, we can therefore factorize code.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ded97bc
...@@ -311,7 +311,7 @@ void tcp_shutdown(struct sock *sk, int how); ...@@ -311,7 +311,7 @@ void tcp_shutdown(struct sock *sk, int how);
int tcp_v4_early_demux(struct sk_buff *skb); int tcp_v4_early_demux(struct sk_buff *skb);
int tcp_v4_rcv(struct sk_buff *skb); int tcp_v4_rcv(struct sk_buff *skb);
void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb); void tcp_remove_empty_skb(struct sock *sk);
int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); int tcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size); int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size);
......
...@@ -933,8 +933,10 @@ int tcp_send_mss(struct sock *sk, int *size_goal, int flags) ...@@ -933,8 +933,10 @@ int tcp_send_mss(struct sock *sk, int *size_goal, int flags)
* importantly be able to generate EPOLLOUT for Edge Trigger epoll() * importantly be able to generate EPOLLOUT for Edge Trigger epoll()
* users. * users.
*/ */
void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb) void tcp_remove_empty_skb(struct sock *sk)
{ {
struct sk_buff *skb = tcp_write_queue_tail(sk);
if (skb && TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { if (skb && TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) {
tcp_unlink_write_queue(skb, sk); tcp_unlink_write_queue(skb, sk);
if (tcp_write_queue_empty(sk)) if (tcp_write_queue_empty(sk))
...@@ -1087,7 +1089,7 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset, ...@@ -1087,7 +1089,7 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
return copied; return copied;
do_error: do_error:
tcp_remove_empty_skb(sk, tcp_write_queue_tail(sk)); tcp_remove_empty_skb(sk);
if (copied) if (copied)
goto out; goto out;
out_err: out_err:
...@@ -1408,8 +1410,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) ...@@ -1408,8 +1410,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
return copied + copied_syn; return copied + copied_syn;
do_error: do_error:
skb = tcp_write_queue_tail(sk); tcp_remove_empty_skb(sk);
tcp_remove_empty_skb(sk, skb);
if (copied + copied_syn) if (copied + copied_syn)
goto out; goto out;
......
...@@ -1291,7 +1291,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, ...@@ -1291,7 +1291,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
u64 snd_una = READ_ONCE(msk->snd_una); u64 snd_una = READ_ONCE(msk->snd_una);
if (snd_una != msk->snd_nxt) { if (snd_una != msk->snd_nxt) {
tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk)); tcp_remove_empty_skb(ssk);
return 0; return 0;
} }
...@@ -1307,7 +1307,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, ...@@ -1307,7 +1307,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
copy = min_t(size_t, copy, info->limit - info->sent); copy = min_t(size_t, copy, info->limit - info->sent);
if (!sk_wmem_schedule(ssk, copy)) { if (!sk_wmem_schedule(ssk, copy)) {
tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk)); tcp_remove_empty_skb(ssk);
return -ENOMEM; return -ENOMEM;
} }
......
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