mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Benjamin Hesmans <benjamin.hesmans@tessares.net>
To: mptcp@lists.linux.dev
Cc: Benjamin Hesmans <benjamin.hesmans@tessares.net>
Subject: [PATCH mptcp-next v1 5/5] mptcp: poll allow write call before actual connect
Date: Wed, 21 Sep 2022 17:25:39 +0200	[thread overview]
Message-ID: <20220921152539.1851441-6-benjamin.hesmans@tessares.net> (raw)
In-Reply-To: <20220921152539.1851441-1-benjamin.hesmans@tessares.net>

If fastopen is used, poll must allow a first write that will trigger
the SYN+data

Similar to what is done in tcp_poll().

Signed-off-by: Benjamin Hesmans <benjamin.hesmans@tessares.net>
---
 net/mptcp/protocol.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index aa6e13949b23..308a09b3c0b6 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3733,10 +3733,12 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 {
 	struct sock *sk = sock->sk;
 	struct mptcp_sock *msk;
+	struct socket *ssock;
 	__poll_t mask = 0;
 	int state;
 
 	msk = mptcp_sk(sk);
+	ssock = __mptcp_nmpc_socket(msk);
 	sock_poll_wait(file, sock, wait);
 
 	state = inet_sk_state_load(sk);
@@ -3751,6 +3753,9 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 	if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) {
 		mask |= mptcp_check_readable(msk);
 		mask |= mptcp_check_writeable(msk);
+	} else if (ssock && state == TCP_SYN_SENT && inet_sk(ssock->sk)->defer_connect) {
+		/* cf tcp_poll() note about TFO */
+		mask |= EPOLLOUT | EPOLLWRNORM;
 	}
 	if (sk->sk_shutdown == SHUTDOWN_MASK || state == TCP_CLOSE)
 		mask |= EPOLLHUP;
-- 
2.25.1


-- 


Disclaimer: https://www.tessares.net/mail-disclaimer/ 
<https://www.tessares.net/mail-disclaimer/>



  parent reply	other threads:[~2022-09-21 15:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 15:25 [PATCH mptcp-next v1 0/5] mptcp: add support for TFO, sender side only Benjamin Hesmans
2022-09-21 15:25 ` [PATCH mptcp-next v1 1/5] mptcp: add TCP_FASTOPEN_CONNECT socket option Benjamin Hesmans
2022-09-21 15:25 ` [PATCH mptcp-next v1 2/5] tcp: export tcp_sendmsg_fastopen Benjamin Hesmans
2022-09-21 15:25 ` [PATCH mptcp-next v1 3/5] mptcp: handle defer connect in mptcp_sendmsg Benjamin Hesmans
2022-09-21 17:41   ` Paolo Abeni
2022-09-21 15:25 ` [PATCH mptcp-next v1 4/5] mptcp: add MSG_FASTOPEN support Benjamin Hesmans
2022-09-21 15:25 ` Benjamin Hesmans [this message]
2022-09-21 16:52   ` mptcp: poll allow write call before actual connect: Tests Results MPTCP CI
2022-09-21 17:43   ` [PATCH mptcp-next v1 5/5] mptcp: poll allow write call before actual connect Paolo Abeni

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=20220921152539.1851441-6-benjamin.hesmans@tessares.net \
    --to=benjamin.hesmans@tessares.net \
    --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).