[RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen

Dmytro Shytyi posted 4 patches 3 years, 4 months ago
[RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen
Posted by Dmytro Shytyi 3 years, 4 months ago
Add set MPTFO socket option for MPTCP. This option is needed for
the listen socket to accept MPTFO.

Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net>
---
 net/mptcp/Makefile   |  2 +-
 net/mptcp/fastopen.c | 37 +++++++++++++++++++++++++++++++++++++
 net/mptcp/protocol.h |  5 +++++
 net/mptcp/sockopt.c  |  3 +++
 4 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 net/mptcp/fastopen.c

diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
index 8a7f68efa35f..c42ad8609876 100644
--- a/net/mptcp/Makefile
+++ b/net/mptcp/Makefile
@@ -2,7 +2,7 @@
 obj-$(CONFIG_MPTCP) += mptcp.o
 
 mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o diag.o \
-	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o
+	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o
 
 obj-$(CONFIG_SYN_COOKIES) += syncookies.o
 obj-$(CONFIG_INET_MPTCP_DIAG) += mptcp_diag.o
diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c
new file mode 100644
index 000000000000..086cbad49979
--- /dev/null
+++ b/net/mptcp/fastopen.c
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0
+ * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI
+ */
+
+#include "protocol.h"
+
+int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t optval,
+				      unsigned int optlen)
+{
+	struct sock *sk = (struct sock *)msk;
+	struct net *net = sock_net(sk);
+	struct socket *ssock;
+	struct sock *ssk;
+	int val;
+	int ret;
+
+	ret = 0;
+
+	if (copy_from_sockptr(&val, optval, sizeof(val)))
+		return -EFAULT;
+
+	ssock = __mptcp_nmpc_socket(msk);
+	ssk = ssock->sk;
+	net = sock_net(ssk);
+	lock_sock(ssk);
+
+	if (val >= 0 && ((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) {
+		tcp_fastopen_init_key_once(net);
+		fastopen_queue_tune(ssk, val);
+	} else {
+		ret = -EINVAL;
+	}
+
+	release_sock(ssk);
+
+	return ret;
+}
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 93c535440a5c..522647804aed 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -838,6 +838,11 @@ void mptcp_event_addr_announced(const struct sock *ssk, const struct mptcp_addr_
 void mptcp_event_addr_removed(const struct mptcp_sock *msk, u8 id);
 bool mptcp_userspace_pm_active(const struct mptcp_sock *msk);
 
+// Fast Open Mechanism functions begin
+int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t optval,
+				      unsigned int optlen);
+// Fast Open Mechanism functions end
+
 static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk)
 {
 	return READ_ONCE(msk->pm.addr_signal) &
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index 423d3826ca1e..f62f0d63b8e6 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -559,6 +559,7 @@ static bool mptcp_supported_sockopt(int level, int optname)
 		case TCP_NOTSENT_LOWAT:
 		case TCP_TX_DELAY:
 		case TCP_INQ:
+		case TCP_FASTOPEN:
 			return true;
 		}
 
@@ -796,6 +797,8 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
 		return mptcp_setsockopt_sol_tcp_nodelay(msk, optval, optlen);
 	case TCP_DEFER_ACCEPT:
 		return mptcp_setsockopt_sol_tcp_defer(msk, optval, optlen);
+	case TCP_FASTOPEN:
+		return mptcp_setsockopt_sol_tcp_fastopen(msk, optval, optlen);
 	}
 
 	return -EOPNOTSUPP;
-- 
2.25.1
Re: [RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen
Posted by Paolo Abeni 3 years, 4 months ago
On Mon, 2022-09-26 at 01:25 +0200, Dmytro Shytyi wrote:
> Add set MPTFO socket option for MPTCP. This option is needed for
> the listen socket to accept MPTFO.
> 
> Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net>

> ---
>  net/mptcp/Makefile   |  2 +-
>  net/mptcp/fastopen.c | 37 +++++++++++++++++++++++++++++++++++++
>  net/mptcp/protocol.h |  5 +++++
>  net/mptcp/sockopt.c  |  3 +++
>  4 files changed, 46 insertions(+), 1 deletion(-)
>  create mode 100644 net/mptcp/fastopen.c
> 
> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
> index 8a7f68efa35f..c42ad8609876 100644
> --- a/net/mptcp/Makefile
> +++ b/net/mptcp/Makefile
> @@ -2,7 +2,7 @@
>  obj-$(CONFIG_MPTCP) += mptcp.o
>  
>  mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o diag.o \
> -	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o
> +	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o
>  
>  obj-$(CONFIG_SYN_COOKIES) += syncookies.o
>  obj-$(CONFIG_INET_MPTCP_DIAG) += mptcp_diag.o
> diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c
> new file mode 100644
> index 000000000000..086cbad49979
> --- /dev/null
> +++ b/net/mptcp/fastopen.c
> @@ -0,0 +1,37 @@
> +/* SPDX-License-Identifier: GPL-2.0
> + * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI
> + */
> +
> +#include "protocol.h"
> +
> +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t optval,
> +				      unsigned int optlen)
> +{
> +	struct sock *sk = (struct sock *)msk;
> +	struct net *net = sock_net(sk);
> +	struct socket *ssock;
> +	struct sock *ssk;
> +	int val;
> +	int ret;
> +
> +	ret = 0;
> +
> +	if (copy_from_sockptr(&val, optval, sizeof(val)))
> +		return -EFAULT;
> +
> +	ssock = __mptcp_nmpc_socket(msk);
> +	ssk = ssock->sk;
> +	net = sock_net(ssk);
> +	lock_sock(ssk);
> +
> +	if (val >= 0 && ((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) {
> +		tcp_fastopen_init_key_once(net);
> +		fastopen_queue_tune(ssk, val);

Instead you could directly call:

	return tcp_setsockopt(ssock->sk, SOL_TCP, TCP_FASTOPEN, optval, optlen);

Side note, we could add a generic helper to invoke tcp_setsockopt() on
the mpc subflow, on the give tcp socket option, and reuse such helper
for: TCP_FASTOPEN, TCP_FASTOPEN_CONNECT, TCP_DEFER_ACCEPT... but that
can/should be done later.

Cheers,

Paolo
Re: [RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen
Posted by Matthieu Baerts 3 years, 4 months ago
Hi Dmytro, Paolo,

On 26/09/2022 16:50, Paolo Abeni wrote:
> On Mon, 2022-09-26 at 01:25 +0200, Dmytro Shytyi wrote:
>> Add set MPTFO socket option for MPTCP. This option is needed for
>> the listen socket to accept MPTFO.
>>
>> Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net>
> 
>> ---
>>  net/mptcp/Makefile   |  2 +-
>>  net/mptcp/fastopen.c | 37 +++++++++++++++++++++++++++++++++++++
>>  net/mptcp/protocol.h |  5 +++++
>>  net/mptcp/sockopt.c  |  3 +++
>>  4 files changed, 46 insertions(+), 1 deletion(-)
>>  create mode 100644 net/mptcp/fastopen.c
>>
>> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
>> index 8a7f68efa35f..c42ad8609876 100644
>> --- a/net/mptcp/Makefile
>> +++ b/net/mptcp/Makefile
>> @@ -2,7 +2,7 @@
>>  obj-$(CONFIG_MPTCP) += mptcp.o
>>  
>>  mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o diag.o \
>> -	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o
>> +	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o
>>  
>>  obj-$(CONFIG_SYN_COOKIES) += syncookies.o
>>  obj-$(CONFIG_INET_MPTCP_DIAG) += mptcp_diag.o
>> diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c
>> new file mode 100644
>> index 000000000000..086cbad49979
>> --- /dev/null
>> +++ b/net/mptcp/fastopen.c
>> @@ -0,0 +1,37 @@
>> +/* SPDX-License-Identifier: GPL-2.0
>> + * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI
>> + */
>> +
>> +#include "protocol.h"
>> +
>> +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t optval,
>> +				      unsigned int optlen)

I think we should keep everything related to the sockoptions in
net/mptcp/sockopt.c, no?

>> +{
>> +	struct sock *sk = (struct sock *)msk;
>> +	struct net *net = sock_net(sk);
>> +	struct socket *ssock;
>> +	struct sock *ssk;
>> +	int val;
>> +	int ret;
>> +
>> +	ret = 0;
>> +
>> +	if (copy_from_sockptr(&val, optval, sizeof(val)))
>> +		return -EFAULT;
>> +
>> +	ssock = __mptcp_nmpc_socket(msk);

'ssock' could be NULL if the setsockopt() is called once the connection
has been established.

>> +	ssk = ssock->sk;
>> +	net = sock_net(ssk);
>> +	lock_sock(ssk);
>> +
>> +	if (val >= 0 && ((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) {
>> +		tcp_fastopen_init_key_once(net);
>> +		fastopen_queue_tune(ssk, val);
> 
> Instead you could directly call:
> 
> 	return tcp_setsockopt(ssock->sk, SOL_TCP, TCP_FASTOPEN, optval, optlen);


I agree, similar to TCP_FASTOPEN_CONNECT

> Side note, we could add a generic helper to invoke tcp_setsockopt() on
> the mpc subflow, on the give tcp socket option, and reuse such helper

Indeed. I was already looking at doing that when implementing
TCP_FASTOPEN_NO_COOKIE. I can share a patch for this other sockopt and
then you can re-use the new helper for this TCP_FASTOPEN.

> for: TCP_FASTOPEN, TCP_FASTOPEN_CONNECT, TCP_DEFER_ACCEPT... but that
> can/should be done later.

Note that for TCP_DEFER_ACCEPT, this is a special case because
apparently, the setsockopt doesn't fail even if a connection has already
been accepted.

@Dmytro: Two last things about the patch:
- you also need to support the 'read' side (getsockopt())
- if I'm not mistaken, this TCP_FASTOPEN option is only needed for the
listener side, not for the sender, no?

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Re: [RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen
Posted by Dmytro Shytyi 3 years, 4 months ago
Hello Paolo, Matthieu,


On 9/26/2022 5:01 PM, Matthieu Baerts wrote:
> Hi Dmytro, Paolo,
>
> On 26/09/2022 16:50, Paolo Abeni wrote:
>> On Mon, 2022-09-26 at 01:25 +0200, Dmytro Shytyi wrote:
>>> Add set MPTFO socket option for MPTCP. This option is needed for
>>> the listen socket to accept MPTFO.
>>>
>>> Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net>
>>> ---
>>>   net/mptcp/Makefile   |  2 +-
>>>   net/mptcp/fastopen.c | 37 +++++++++++++++++++++++++++++++++++++
>>>   net/mptcp/protocol.h |  5 +++++
>>>   net/mptcp/sockopt.c  |  3 +++
>>>   4 files changed, 46 insertions(+), 1 deletion(-)
>>>   create mode 100644 net/mptcp/fastopen.c
>>>
>>> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
>>> index 8a7f68efa35f..c42ad8609876 100644
>>> --- a/net/mptcp/Makefile
>>> +++ b/net/mptcp/Makefile
>>> @@ -2,7 +2,7 @@
>>>   obj-$(CONFIG_MPTCP) += mptcp.o
>>>   
>>>   mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o diag.o \
>>> -	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o
>>> +	   mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o
>>>   
>>>   obj-$(CONFIG_SYN_COOKIES) += syncookies.o
>>>   obj-$(CONFIG_INET_MPTCP_DIAG) += mptcp_diag.o
>>> diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c
>>> new file mode 100644
>>> index 000000000000..086cbad49979
>>> --- /dev/null
>>> +++ b/net/mptcp/fastopen.c
>>> @@ -0,0 +1,37 @@
>>> +/* SPDX-License-Identifier: GPL-2.0
>>> + * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI
>>> + */
>>> +
>>> +#include "protocol.h"
>>> +
>>> +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t optval,
>>> +				      unsigned int optlen)
> I think we should keep everything related to the sockoptions in
> net/mptcp/sockopt.c, no?

I have multiple functions that are related to fastopen in fastopen.c. 
Probably it is not a bad idea to to keep all fastopen details in one file?

>>> +{
>>> +	struct sock *sk = (struct sock *)msk;
>>> +	struct net *net = sock_net(sk);
>>> +	struct socket *ssock;
>>> +	struct sock *ssk;
>>> +	int val;
>>> +	int ret;
>>> +
>>> +	ret = 0;
>>> +
>>> +	if (copy_from_sockptr(&val, optval, sizeof(val)))
>>> +		return -EFAULT;
>>> +
>>> +	ssock = __mptcp_nmpc_socket(msk);
> 'ssock' could be NULL if the setsockopt() is called once the connection
> has been established.


Thanks, in this case need to return error.

>>> +	ssk = ssock->sk;
>>> +	net = sock_net(ssk);
>>> +	lock_sock(ssk);
>>> +
>>> +	if (val >= 0 && ((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) {
>>> +		tcp_fastopen_init_key_once(net);
>>> +		fastopen_queue_tune(ssk, val);
>> Instead you could directly call:
>>
>> 	return tcp_setsockopt(ssock->sk, SOL_TCP, TCP_FASTOPEN, optval, optlen);
>
> I agree, similar to TCP_FASTOPEN_CONNECT


Indeed this is done here, when pass TCP_FASTOPEN (tcp.c - net/ipv4/tcp.c 
- Linux source code (v5.19.11) - Bootlin 
<https://elixir.bootlin.com/linux/latest/source/net/ipv4/tcp.c#L3636>)

So we could use directly  as you both suggested.

>> Side note, we could add a generic helper to invoke tcp_setsockopt() on
>> the mpc subflow, on the give tcp socket option, and reuse such helper
> Indeed. I was already looking at doing that when implementing
> TCP_FASTOPEN_NO_COOKIE. I can share a patch for this other sockopt and
> then you can re-use the new helper for this TCP_FASTOPEN.
>
>> for: TCP_FASTOPEN, TCP_FASTOPEN_CONNECT, TCP_DEFER_ACCEPT... but that
>> can/should be done later.
> Note that for TCP_DEFER_ACCEPT, this is a special case because
> apparently, the setsockopt doesn't fail even if a connection has already
> been accepted.
>
> @Dmytro: Two last things about the patch:
> - you also need to support the 'read' side (getsockopt())
> - if I'm not mistaken, this TCP_FASTOPEN option is only needed for the
> listener side, not for the sender, no?
>
> Cheers,
> Matt
Re: [RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen
Posted by Matthieu Baerts 3 years, 4 months ago
Hi Dmytro,

On 27/09/2022 06:01, Dmytro Shytyi wrote:
> Hello Paolo, Matthieu,
> 
> 
> On 9/26/2022 5:01 PM, Matthieu Baerts wrote:
>> Hi Dmytro, Paolo,
>>
>> On 26/09/2022 16:50, Paolo Abeni wrote:
>>> On Mon, 2022-09-26 at 01:25 +0200, Dmytro Shytyi wrote:
>>>> Add set MPTFO socket option for MPTCP. This option is needed for
>>>> the listen socket to accept MPTFO.
>>>>
>>>> Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net>
>>>> ---
>>>>   net/mptcp/Makefile   |  2 +-
>>>>   net/mptcp/fastopen.c | 37 +++++++++++++++++++++++++++++++++++++
>>>>   net/mptcp/protocol.h |  5 +++++
>>>>   net/mptcp/sockopt.c  |  3 +++
>>>>   4 files changed, 46 insertions(+), 1 deletion(-)
>>>>   create mode 100644 net/mptcp/fastopen.c
>>>>
>>>> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
>>>> index 8a7f68efa35f..c42ad8609876 100644
>>>> --- a/net/mptcp/Makefile
>>>> +++ b/net/mptcp/Makefile
>>>> @@ -2,7 +2,7 @@
>>>>   obj-$(CONFIG_MPTCP) += mptcp.o
>>>>     mptcp-y := protocol.o subflow.o options.o token.o crypto.o
>>>> ctrl.o pm.o diag.o \
>>>> -       mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o
>>>> +       mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o
>>>>     obj-$(CONFIG_SYN_COOKIES) += syncookies.o
>>>>   obj-$(CONFIG_INET_MPTCP_DIAG) += mptcp_diag.o
>>>> diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c
>>>> new file mode 100644
>>>> index 000000000000..086cbad49979
>>>> --- /dev/null
>>>> +++ b/net/mptcp/fastopen.c
>>>> @@ -0,0 +1,37 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0
>>>> + * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI
>>>> + */
>>>> +
>>>> +#include "protocol.h"
>>>> +
>>>> +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk,
>>>> sockptr_t optval,
>>>> +                      unsigned int optlen)
>> I think we should keep everything related to the sockoptions in
>> net/mptcp/sockopt.c, no?
> 
> I have multiple functions that are related to fastopen in fastopen.c.
> Probably it is not a bad idea to to keep all fastopen details in one file?

We already have a file dedicated to all socket options. I don't think we
should have an exception for TFO, especially if there is nothing
specific to TFO thanks to tcp_setsockopt().

Also, you can use the new mptcp_setsockopt_first_sf_only() helper I sent
a few minutes ago on the ML. For TCP_FASTOPEN sockopt, you now need a
commit similar to "mptcp: add TCP_FASTOPEN_NO_COOKIE support" by just
adding "TCP_FASTOPEN" in three different places in sockopt.c, see:


https://lore.kernel.org/mptcp/20220927150306.1552795-1-matthieu.baerts@tessares.net/T/

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Re: [RFC PATCH mptcp-next v11 1/4] mptcp: add mptcp_setsockopt_fastopen
Posted by Dmytro Shytyi 3 years, 4 months ago
Hello,

On 9/27/2022 5:22 PM, Matthieu Baerts wrote:
> Hi Dmytro,
>
> On 27/09/2022 06:01, Dmytro Shytyi wrote:
>> Hello Paolo, Matthieu,
>>
>>
>> On 9/26/2022 5:01 PM, Matthieu Baerts wrote:
>>> Hi Dmytro, Paolo,
>>>
>>> On 26/09/2022 16:50, Paolo Abeni wrote:
>>>> On Mon, 2022-09-26 at 01:25 +0200, Dmytro Shytyi wrote:
>>>>> Add set MPTFO socket option for MPTCP. This option is needed for
>>>>> the listen socket to accept MPTFO.
>>>>>
>>>>> Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net>
>>>>> ---
>>>>>    net/mptcp/Makefile   |  2 +-
>>>>>    net/mptcp/fastopen.c | 37 +++++++++++++++++++++++++++++++++++++
>>>>>    net/mptcp/protocol.h |  5 +++++
>>>>>    net/mptcp/sockopt.c  |  3 +++
>>>>>    4 files changed, 46 insertions(+), 1 deletion(-)
>>>>>    create mode 100644 net/mptcp/fastopen.c
>>>>>
>>>>> diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
>>>>> index 8a7f68efa35f..c42ad8609876 100644
>>>>> --- a/net/mptcp/Makefile
>>>>> +++ b/net/mptcp/Makefile
>>>>> @@ -2,7 +2,7 @@
>>>>>    obj-$(CONFIG_MPTCP) += mptcp.o
>>>>>      mptcp-y := protocol.o subflow.o options.o token.o crypto.o
>>>>> ctrl.o pm.o diag.o \
>>>>> -       mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o
>>>>> +       mib.o pm_netlink.o sockopt.o pm_userspace.o sched.o fastopen.o
>>>>>      obj-$(CONFIG_SYN_COOKIES) += syncookies.o
>>>>>    obj-$(CONFIG_INET_MPTCP_DIAG) += mptcp_diag.o
>>>>> diff --git a/net/mptcp/fastopen.c b/net/mptcp/fastopen.c
>>>>> new file mode 100644
>>>>> index 000000000000..086cbad49979
>>>>> --- /dev/null
>>>>> +++ b/net/mptcp/fastopen.c
>>>>> @@ -0,0 +1,37 @@
>>>>> +/* SPDX-License-Identifier: GPL-2.0
>>>>> + * MPTCP Fast Open Mechanism. Copyright (c) 2021-2022, Dmytro SHYTYI
>>>>> + */
>>>>> +
>>>>> +#include "protocol.h"
>>>>> +
>>>>> +int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk,
>>>>> sockptr_t optval,
>>>>> +                      unsigned int optlen)
>>> I think we should keep everything related to the sockoptions in
>>> net/mptcp/sockopt.c, no?
>> I have multiple functions that are related to fastopen in fastopen.c.
>> Probably it is not a bad idea to to keep all fastopen details in one file?
> We already have a file dedicated to all socket options. I don't think we
> should have an exception for TFO, especially if there is nothing
> specific to TFO thanks to tcp_setsockopt().
Okay.
> Also, you can use the new mptcp_setsockopt_first_sf_only() helper I sent
> a few minutes ago on the ML. For TCP_FASTOPEN sockopt, you now need a
> commit similar to "mptcp: add TCP_FASTOPEN_NO_COOKIE support" by just
> adding "TCP_FASTOPEN" in three different places in sockopt.c, see:
>
>
> https://lore.kernel.org/mptcp/20220927150306.1552795-1-matthieu.baerts@tessares.net/T/

Thanks!


> Cheers,
> Matt