* Re: [MPTCP] [RFC 1/3] mptcp: Slightly refactor mptcp_established_options_xxx()
@ 2019-05-23 9:00 Paolo Abeni
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2019-05-23 9:00 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1708 bytes --]
Hi,
Thank you for doing this and sharing the code early, very appreciated!
On Wed, 2019-05-22 at 14:38 -0700, Peter Krystad wrote:
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 1cd915890ce5..68a2311b56d4 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -797,20 +797,20 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
> unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
> unsigned int opt_size;
>
> - if (mptcp_established_options(sk, &opt_size, &opts->mptcp)) {
> - if (remaining >= opt_size) {
> - opts->options |= OPTION_MPTCP;
> - size += opt_size;
> - }
> - } else {
> - unsigned int dss_size;
> + if ((sk, skb, &opt_size,
> + remaining, &opts->mptcp)) {
> + opts->options |= OPTION_MPTCP;
> + size += opt_size;
> + remaining -= opt_size;
> + }
> +
> + if (mptcp_established_options_dss(sk, skb, &opt_size,
> + remaining, &opts->mptcp)) {
> + opts->options |= OPTION_MPTCP;
> + size += opt_size;
> + remaining -= opt_size;
> + }
>
> - if (mptcp_established_options_dss(sk, skb, &dss_size,
> - remaining,
> - &opts->mptcp)) {
> - opts->options |= OPTION_MPTCP;
> - size += dss_size;
> - }
> }
> }
>
[Not strictly related to MP_JOIN] I think it could be possibly cleaner
to expose to the TCP code a single mptcp_established_option() hook and
handle there all the relevant cases ('plain', _dss() _addr() added by
the next patch).
The mptcp code should not change much, and possibly it would remove a
bunch of duplicate checks (about subflow->mp_capable).
Cheers,
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [MPTCP] [RFC 1/3] mptcp: Slightly refactor mptcp_established_options_xxx()
@ 2019-05-28 18:39 Peter Krystad
0 siblings, 0 replies; 3+ messages in thread
From: Peter Krystad @ 2019-05-28 18:39 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]
On Thu, 2019-05-23 at 11:00 +0200, Paolo Abeni wrote:
> Hi,
>
> Thank you for doing this and sharing the code early, very appreciated!
>
> On Wed, 2019-05-22 at 14:38 -0700, Peter Krystad wrote:
> > diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> > index 1cd915890ce5..68a2311b56d4 100644
> > --- a/net/ipv4/tcp_output.c
> > +++ b/net/ipv4/tcp_output.c
> > @@ -797,20 +797,20 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
> > unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
> > unsigned int opt_size;
> >
> > - if (mptcp_established_options(sk, &opt_size, &opts->mptcp)) {
> > - if (remaining >= opt_size) {
> > - opts->options |= OPTION_MPTCP;
> > - size += opt_size;
> > - }
> > - } else {
> > - unsigned int dss_size;
> > + if ((sk, skb, &opt_size,
> > + remaining, &opts->mptcp)) {
> > + opts->options |= OPTION_MPTCP;
> > + size += opt_size;
> > + remaining -= opt_size;
> > + }
> > +
> > + if (mptcp_established_options_dss(sk, skb, &opt_size,
> > + remaining, &opts->mptcp)) {
> > + opts->options |= OPTION_MPTCP;
> > + size += opt_size;
> > + remaining -= opt_size;
> > + }
> >
> > - if (mptcp_established_options_dss(sk, skb, &dss_size,
> > - remaining,
> > - &opts->mptcp)) {
> > - opts->options |= OPTION_MPTCP;
> > - size += dss_size;
> > - }
> > }
> > }
> >
>
> [Not strictly related to MP_JOIN] I think it could be possibly cleaner
> to expose to the TCP code a single mptcp_established_option() hook and
> handle there all the relevant cases ('plain', _dss() _addr() added by
> the next patch).
>
> The mptcp code should not change much, and possibly it would remove a
> bunch of duplicate checks (about subflow->mp_capable).
I agree a single hook is cleaner, this ended up like this to make the
individual commits stand alone better as features were added. I will revise
this.
Peter.
> Cheers,
>
> Paolo
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [MPTCP] [RFC 1/3] mptcp: Slightly refactor mptcp_established_options_xxx()
@ 2019-05-22 21:38 Peter Krystad
0 siblings, 0 replies; 3+ messages in thread
From: Peter Krystad @ 2019-05-22 21:38 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 3632 bytes --]
Make mptcp_established_options_xxx() take the same
parameter list and remove the restriction that MP_CAPABLE
and DSS options may not be sent in the same header.
Split and squash to "Handle MP_CAPABLE options" and
"Write MPTCP DSS headers".
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
include/net/mptcp.h | 7 +++++--
net/ipv4/tcp_output.c | 26 +++++++++++++-------------
net/mptcp/options.c | 6 ++++--
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index ed67b140af33..0f66dab1c444 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -69,8 +69,9 @@ bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
struct mptcp_out_options* opts);
bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
struct mptcp_out_options *opts);
-bool mptcp_established_options(struct sock *sk, unsigned int *size,
- struct mptcp_out_options *opts);
+bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
+ unsigned int *size, unsigned int remaining,
+ struct mptcp_out_options *opts);
void mptcp_attach_dss(struct sock *sk, struct sk_buff *skb,
struct tcp_options_received *opt_rx);
@@ -126,7 +127,9 @@ static inline bool mptcp_synack_options(const struct request_sock *req,
}
static inline bool mptcp_established_options(struct sock *sk,
+ struct sk_buff *skb,
unsigned int *size,
+ unsigned int remaining,
struct mptcp_out_options *opts)
{
return false;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 1cd915890ce5..68a2311b56d4 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -797,20 +797,20 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
unsigned int remaining = MAX_TCP_OPTION_SPACE - size;
unsigned int opt_size;
- if (mptcp_established_options(sk, &opt_size, &opts->mptcp)) {
- if (remaining >= opt_size) {
- opts->options |= OPTION_MPTCP;
- size += opt_size;
- }
- } else {
- unsigned int dss_size;
+ if (mptcp_established_options(sk, skb, &opt_size,
+ remaining, &opts->mptcp)) {
+ opts->options |= OPTION_MPTCP;
+ size += opt_size;
+ remaining -= opt_size;
+ }
+
+ if (mptcp_established_options_dss(sk, skb, &opt_size,
+ remaining, &opts->mptcp)) {
+ opts->options |= OPTION_MPTCP;
+ size += opt_size;
+ remaining -= opt_size;
+ }
- if (mptcp_established_options_dss(sk, skb, &dss_size,
- remaining,
- &opts->mptcp)) {
- opts->options |= OPTION_MPTCP;
- size += dss_size;
- }
}
}
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index c71e40f6f06a..47d7507a2f2a 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -240,13 +240,15 @@ void mptcp_rcv_synsent(struct sock *sk)
}
}
-bool mptcp_established_options(struct sock *sk, unsigned int *size,
+bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
+ unsigned int *size, unsigned int remaining,
struct mptcp_out_options *opts)
{
struct subflow_context *subflow = subflow_ctx(sk);
pr_debug("subflow=%p", subflow);
- if (subflow->mp_capable && !subflow->fourth_ack) {
+ if (subflow->mp_capable && !subflow->fourth_ack &&
+ remaining >= TCPOLEN_MPTCP_MPC_ACK) {
opts->suboptions = OPTION_MPTCP_MPC_ACK;
opts->sndr_key = subflow->local_key;
opts->rcvr_key = subflow->remote_key;
--
2.17.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-28 18:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 9:00 [MPTCP] [RFC 1/3] mptcp: Slightly refactor mptcp_established_options_xxx() Paolo Abeni
-- strict thread matches above, loose matches on Subject: below --
2019-05-28 18:39 Peter Krystad
2019-05-22 21:38 Peter Krystad
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.