mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: mptcp@lists.linux.dev
Cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
Subject: [PATCH mptcp-net 2/3] mptcp: Add a variant of mptcp_subflow_send_ack() for locked subflows
Date: Tue, 28 Jun 2022 12:03:55 -0700	[thread overview]
Message-ID: <20220628190356.326233-3-mathew.j.martineau@linux.intel.com> (raw)
In-Reply-To: <20220628190356.326233-1-mathew.j.martineau@linux.intel.com>

The existing mptcp_subflow_send_ack() function handles subflow locking,
but it's also sometimes necessary to force an ack from a caller that
already holds the subflow socket lock. This is required for the
following commit.

Fixes: 340fa6667a69 ("mptcp: Only send extra TCP acks in eligible socket states")
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 net/mptcp/protocol.c | 9 +++++++--
 net/mptcp/protocol.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 3efbae948707..b96a80c8e22a 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -506,13 +506,18 @@ static inline bool tcp_can_send_ack(const struct sock *ssk)
 	       (TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_TIME_WAIT | TCPF_CLOSE | TCPF_LISTEN));
 }
 
+void __mptcp_subflow_send_ack(struct sock *ssk)
+{
+	if (tcp_can_send_ack(ssk))
+		tcp_send_ack(ssk);
+}
+
 void mptcp_subflow_send_ack(struct sock *ssk)
 {
 	bool slow;
 
 	slow = lock_sock_fast(ssk);
-	if (tcp_can_send_ack(ssk))
-		tcp_send_ack(ssk);
+	__mptcp_subflow_send_ack(ssk);
 	unlock_sock_fast(ssk, slow);
 }
 
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index c14d70c036d0..033c995772dc 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -607,6 +607,7 @@ void __init mptcp_subflow_init(void);
 void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how);
 void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
 		     struct mptcp_subflow_context *subflow);
+void __mptcp_subflow_send_ack(struct sock *ssk);
 void mptcp_subflow_send_ack(struct sock *ssk);
 void mptcp_subflow_reset(struct sock *ssk);
 void mptcp_subflow_queue_clean(struct sock *ssk);
-- 
2.37.0


  parent reply	other threads:[~2022-06-28 19:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 19:03 [PATCH mptcp-net 0/3] Locking fixes for subflow flag changes Mat Martineau
2022-06-28 19:03 ` [PATCH mptcp-net 1/3] mptcp: Avoid acquiring PM lock for subflow priority changes Mat Martineau
2022-06-29 19:57   ` Paolo Abeni
2022-06-28 19:03 ` Mat Martineau [this message]
2022-06-28 19:03 ` [PATCH mptcp-net 3/3] mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags Mat Martineau
2022-06-28 20:50   ` mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags: Tests Results MPTCP CI
2022-06-29 19:59   ` [PATCH mptcp-net 3/3] mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags Paolo Abeni
2022-06-29 20:51     ` Mat Martineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220628190356.326233-3-mathew.j.martineau@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).