MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH mptcp-next v3 0/4] mptcp: add support for TCP_FASTOPEN_CONNECT, sender side only
@ 2022-09-23 12:19 Benjamin Hesmans
  2022-09-23 12:19 ` [PATCH mptcp-next v3 1/4] mptcp: add TCP_FASTOPEN_CONNECT socket option Benjamin Hesmans
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Benjamin Hesmans @ 2022-09-23 12:19 UTC (permalink / raw)
  To: mptcp; +Cc: Benjamin Hesmans

The series only considers the sender side.

Compared to the previous RFC patches, these ones focus on
the sender side only. It corresponds to the 4 first patches from the RFC
series.

The sending part is less complex and even if it looks like we are
converging for the receive part, there are still discussions on-going
there.

Again, thank you Dmytro for the previous work done. As already discussed
on the ML and meeting, this approach was slightly different from what
Dmytro originally proposed. Here tcp_sendmsg_fastopen() is exported and
re-used and TCP_FASTOPEN_CONNECT is supported.

MSG_FASTOPEN will be handled by Dmytro's patches.

Individual changelogs have been added per patch.

We would like to credit Sébastien Barré, Gregory Detal, Olivier
Bonaventure and Christoph Paasch for the original idea of supporting TFO
in MPTCP, see https://datatracker.ietf.org/doc/draft-barre-mptcp-tfo/

It would be very nice to have these patches accepted in the future
kernel 6.1 which will be the next LTS picked by many vendors: the
modifications are quite small, well isolated and re-using what is done
in TCP for years.

v3:
- Add Dmytro SoB as kindly asked at the last meeting, the code is still
  the same.

v2:
- Drop support for MSG_FASTOPEN because we were not sure that it was the
  correct way to do it.
- latest patch of the series: apply comment from Paolo concerning
  mptcp_poll()

Benjamin Hesmans (3):
  mptcp: add TCP_FASTOPEN_CONNECT socket option
  tcp: export tcp_sendmsg_fastopen
  mptcp: poll allow write call before actual connect

Dmytro Shytyi (1):
  mptcp: handle defer connect in mptcp_sendmsg

 include/net/tcp.h    |  2 ++
 net/ipv4/tcp.c       |  5 ++---
 net/mptcp/protocol.c | 26 ++++++++++++++++++++++++++
 net/mptcp/sockopt.c  | 19 ++++++++++++++++++-
 4 files changed, 48 insertions(+), 4 deletions(-)

-- 
2.25.1


-- 


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



^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH mptcp-next v2 4/4] mptcp: poll allow write call before actual connect
@ 2022-09-22 13:56 Benjamin Hesmans
  2022-09-22 14:42 ` mptcp: poll allow write call before actual connect: Tests Results MPTCP CI
  2022-09-22 16:05 ` MPTCP CI
  0 siblings, 2 replies; 11+ messages in thread
From: Benjamin Hesmans @ 2022-09-22 13:56 UTC (permalink / raw)
  To: mptcp; +Cc: Benjamin Hesmans

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>
---

Notes:
    v2:
    - Using __mptcp_nmpc_socket() without lock on msk socket was unsafe.  Instead
      copy the defer_connect from mptcp_stream_connect() and check this flags
      instead. (Paolo's review)

 net/mptcp/protocol.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index f5f20910cd83..0eeb8115c9d0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3616,6 +3616,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 
 do_connect:
 	err = ssock->ops->connect(ssock, uaddr, addr_len, flags);
+	inet_sk(sock->sk)->defer_connect = inet_sk(ssock->sk)->defer_connect;
 	sock->state = ssock->state;
 
 	/* on successful connect, the msk state will be moved to established by
@@ -3754,6 +3755,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 (state == TCP_SYN_SENT && inet_sk(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/>



^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH mptcp-next v1 5/5] mptcp: poll allow write call before actual connect
@ 2022-09-21 15:25 Benjamin Hesmans
  2022-09-21 16:52 ` mptcp: poll allow write call before actual connect: Tests Results MPTCP CI
  0 siblings, 1 reply; 11+ messages in thread
From: Benjamin Hesmans @ 2022-09-21 15:25 UTC (permalink / raw)
  To: mptcp; +Cc: Benjamin Hesmans

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/>



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-09-23 17:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 12:19 [PATCH mptcp-next v3 0/4] mptcp: add support for TCP_FASTOPEN_CONNECT, sender side only Benjamin Hesmans
2022-09-23 12:19 ` [PATCH mptcp-next v3 1/4] mptcp: add TCP_FASTOPEN_CONNECT socket option Benjamin Hesmans
2022-09-23 12:19 ` [PATCH mptcp-next v3 2/4] tcp: export tcp_sendmsg_fastopen Benjamin Hesmans
2022-09-23 12:19 ` [PATCH mptcp-next v3 3/4] mptcp: handle defer connect in mptcp_sendmsg Benjamin Hesmans
2022-09-23 12:19 ` [PATCH mptcp-next v3 4/4] mptcp: poll allow write call before actual connect Benjamin Hesmans
2022-09-23 15:21   ` mptcp: poll allow write call before actual connect: Tests Results MPTCP CI
2022-09-23 13:41 ` [PATCH mptcp-next v3 0/4] mptcp: add support for TCP_FASTOPEN_CONNECT, sender side only Paolo Abeni
2022-09-23 17:48 ` Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2022-09-22 13:56 [PATCH mptcp-next v2 4/4] mptcp: poll allow write call before actual connect Benjamin Hesmans
2022-09-22 14:42 ` mptcp: poll allow write call before actual connect: Tests Results MPTCP CI
2022-09-22 16:05 ` MPTCP CI
2022-09-21 15:25 [PATCH mptcp-next v1 5/5] mptcp: poll allow write call before actual connect Benjamin Hesmans
2022-09-21 16:52 ` mptcp: poll allow write call before actual connect: Tests Results MPTCP CI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox