Message ID | 20191212050820.29792-3-peter.krystad@linux.intel.com |
---|---|
State | Accepted, archived |
Delegated to: | Matthieu Baerts |
Headers | show |
Series | Optimize struct mptcp_options_received | expand |
Hi Peter, Paolo, On 12/12/2019 06:08, Peter Krystad wrote: > This field is not necessary, all version logic is performed > in mptcp_parse_options(). > > squashto: Handle MPTCP TCP options > > Signed-off-by: Peter Krystad <peter.krystad@linux.intel.com> > --- > include/linux/tcp.h | 3 +-- > net/mptcp/options.c | 7 ++++--- > net/mptcp/protocol.h | 2 ++ > 3 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/include/linux/tcp.h b/include/linux/tcp.h > index 36f5d8e53e25..e5859d671111 100644 > --- a/include/linux/tcp.h > +++ b/include/linux/tcp.h > @@ -84,8 +84,7 @@ struct mptcp_options_received { > u64 rcvr_key; > u8 mp_capable : 1, > mp_join : 1, > - dss : 1, > - version : 4; > + dss : 1; I am finishing the application of this patch but now I am wondering: do we really need to remove "version" field from there? I understand that we only set and read it in mptcp_parse_option() but we now have a hole of 4 bits :) Potentially later, we might want to keep the version we got to act differently. But this should not happen before years. Anyway I am going to finish the application of this patch and we can see tomorrow if we have to put it back but I guess we don't. Cheers, Matt
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 36f5d8e53e25..e5859d671111 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -84,8 +84,7 @@ struct mptcp_options_received { u64 rcvr_key; u8 mp_capable : 1, mp_join : 1, - dss : 1, - version : 4; + dss : 1; }; #endif diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 9e21b72b45b9..cd4c0c8de6e0 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -14,6 +14,7 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, { struct mptcp_options_received *mp_opt = &opt_rx->mptcp; u8 subtype = *ptr >> 4; + u8 version; u8 flags; switch (subtype) { @@ -28,8 +29,8 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, opsize != TCPOLEN_MPTCP_MPC_ACK) break; - mp_opt->version = *ptr++ & MPTCP_VERSION_MASK; - if (mp_opt->version != 0) + version = *ptr++ & MPTCP_VERSION_MASK; + if (version != MPTCP_SUPPORTED_VERSION) break; flags = *ptr++; @@ -146,7 +147,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) *ptr++ = htonl((TCPOPT_MPTCP << 24) | (len << 16) | (MPTCPOPT_MP_CAPABLE << 12) | - ((MPTCP_VERSION_MASK & 0) << 8) | + (MPTCP_SUPPORTED_VERSION << 8) | MPTCP_CAP_HMAC_SHA1); put_unaligned_be64(opts->sndr_key, ptr); ptr += 2; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index bd420bef44a0..c59cf8b220b0 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -7,6 +7,8 @@ #ifndef __MPTCP_PROTOCOL_H #define __MPTCP_PROTOCOL_H +#define MPTCP_SUPPORTED_VERSION 0 + /* MPTCP option bits */ #define OPTION_MPTCP_MPC_SYN BIT(0) #define OPTION_MPTCP_MPC_SYNACK BIT(1)
This field is not necessary, all version logic is performed in mptcp_parse_options(). squashto: Handle MPTCP TCP options Signed-off-by: Peter Krystad <peter.krystad@linux.intel.com> --- include/linux/tcp.h | 3 +-- net/mptcp/options.c | 7 ++++--- net/mptcp/protocol.h | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-)