aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-10-27 13:19:18 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-08 17:26:35 +0100
commitfd2b2dab6f5b82ed8fb76118f095fcd56b626e3f (patch)
treee96ae2b48dee77a463f81c8eb95cd7bb184cd8b7
parent68342755b9b2b49cc84e7191f04a16db29c481f0 (diff)
downloadaa-fd2b2dab6f5b82ed8fb76118f095fcd56b626e3f.tar.gz
tcp: cleanup tcp_remove_empty_skb() use
[ Upstream commit 27728ba80f1eb279b209bbd5922fdeebe52d9e30 ] All tcp_remove_empty_skb() callers now use tcp_write_queue_tail() for the skb argument, we can therefore factorize code. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of: 72377ab2d671 ("mptcp: more conservative check for zero probes") Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--include/net/tcp.h2
-rw-r--r--net/ipv4/tcp.c9
-rw-r--r--net/mptcp/protocol.c4
3 files changed, 8 insertions, 7 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e93a48edf438c0..3aee02ad0116b5 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -314,7 +314,7 @@ void tcp_shutdown(struct sock *sk, int how);
int tcp_v4_early_demux(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_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size);
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2115a0e5c98f7e..6dcb77a2bde607 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -953,8 +953,10 @@ int tcp_send_mss(struct sock *sk, int *size_goal, int flags)
* importantly be able to generate EPOLLOUT for Edge Trigger epoll()
* 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) {
tcp_unlink_write_queue(skb, sk);
if (tcp_write_queue_empty(sk))
@@ -1107,7 +1109,7 @@ out:
return copied;
do_error:
- tcp_remove_empty_skb(sk, tcp_write_queue_tail(sk));
+ tcp_remove_empty_skb(sk);
if (copied)
goto out;
out_err:
@@ -1429,8 +1431,7 @@ out_nopush:
return copied + copied_syn;
do_error:
- skb = tcp_write_queue_tail(sk);
- tcp_remove_empty_skb(sk, skb);
+ tcp_remove_empty_skb(sk);
if (copied + copied_syn)
goto out;
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 82b1583f709d39..b9613e02e2de10 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1338,7 +1338,7 @@ alloc_skb:
u64 snd_una = READ_ONCE(msk->snd_una);
if (snd_una != msk->snd_nxt) {
- tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk));
+ tcp_remove_empty_skb(ssk);
return 0;
}
@@ -1354,7 +1354,7 @@ alloc_skb:
copy = min_t(size_t, copy, info->limit - info->sent);
if (!sk_wmem_schedule(ssk, copy)) {
- tcp_remove_empty_skb(ssk, tcp_write_queue_tail(ssk));
+ tcp_remove_empty_skb(ssk);
return -ENOMEM;
}