[PATCH mptcp-next v2] Squash to "mptcp: infinite mapping sending" - fix csum

Geliang Tang posted 1 patch 2 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/f2761a60658d4f54e0d39fbf4b4fe45e387e5b32.1643250449.git.geliang.tang@suse.com
Maintainers: Jakub Kicinski <kuba@kernel.org>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Matthieu Baerts <matthieu.baerts@tessares.net>, "David S. Miller" <davem@davemloft.net>
net/mptcp/options.c  | 6 +++++-
net/mptcp/protocol.c | 1 -
2 files changed, 5 insertions(+), 2 deletions(-)
[PATCH mptcp-next v2] Squash to "mptcp: infinite mapping sending" - fix csum
Posted by Geliang Tang 2 years, 2 months ago
Fix the checksum value of the infinite map.

mptcp_make_csum() will return a non-zero value when mpext->csum is set to
zero.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 v2:
 - add a comment for the checksum value of the infinite mapping.
---
 net/mptcp/options.c  | 6 +++++-
 net/mptcp/protocol.c | 1 -
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 0d0d2eb8c8ca..7abad31c2b84 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -1338,8 +1338,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 			put_unaligned_be32(mpext->subflow_seq, ptr);
 			ptr += 1;
 			if (opts->csum_reqd) {
+				/* data_len == 0 is reserved for the infinite mapping,
+				 * the checksum will also be set to 0.
+				 */
 				put_unaligned_be32(mpext->data_len << 16 |
-						   mptcp_make_csum(mpext), ptr);
+						   (mpext->data_len ? mptcp_make_csum(mpext) : 0),
+						   ptr);
 			} else {
 				put_unaligned_be32(mpext->data_len << 16 |
 						   TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 526a0f5ba415..3324e1c61576 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1231,7 +1231,6 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk,
 
 	mpext->infinite_map = 1;
 	mpext->data_len = 0;
-	mpext->csum = 0;
 
 	MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX);
 	mptcp_subflow_ctx(ssk)->send_infinite_map = 0;
-- 
2.31.1


Re: [PATCH mptcp-next v2] Squash to "mptcp: infinite mapping sending" - fix csum
Posted by Mat Martineau 2 years, 2 months ago
On Thu, 27 Jan 2022, Geliang Tang wrote:

> Fix the checksum value of the infinite map.
>
> mptcp_make_csum() will return a non-zero value when mpext->csum is set to
> zero.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> v2:
> - add a comment for the checksum value of the infinite mapping.

Thanks! Looks good to me

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>

> ---
> net/mptcp/options.c  | 6 +++++-
> net/mptcp/protocol.c | 1 -
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 0d0d2eb8c8ca..7abad31c2b84 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -1338,8 +1338,12 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
> 			put_unaligned_be32(mpext->subflow_seq, ptr);
> 			ptr += 1;
> 			if (opts->csum_reqd) {
> +				/* data_len == 0 is reserved for the infinite mapping,
> +				 * the checksum will also be set to 0.
> +				 */
> 				put_unaligned_be32(mpext->data_len << 16 |
> -						   mptcp_make_csum(mpext), ptr);
> +						   (mpext->data_len ? mptcp_make_csum(mpext) : 0),
> +						   ptr);
> 			} else {
> 				put_unaligned_be32(mpext->data_len << 16 |
> 						   TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 526a0f5ba415..3324e1c61576 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1231,7 +1231,6 @@ static void mptcp_update_infinite_map(struct mptcp_sock *msk,
>
> 	mpext->infinite_map = 1;
> 	mpext->data_len = 0;
> -	mpext->csum = 0;
>
> 	MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX);
> 	mptcp_subflow_ctx(ssk)->send_infinite_map = 0;
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel

Re: [PATCH mptcp-next v2] Squash to "mptcp: infinite mapping sending" - fix csum
Posted by Matthieu Baerts 2 years, 2 months ago
Hi Geliang, Mat,

On 27/01/2022 17:24, Mat Martineau wrote:
> On Thu, 27 Jan 2022, Geliang Tang wrote:
> 
>> Fix the checksum value of the infinite map.
>>
>> mptcp_make_csum() will return a non-zero value when mpext->csum is set to
>> zero.
>>
>> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
>> ---
>> v2:
>> - add a comment for the checksum value of the infinite mapping.
> 
> Thanks! Looks good to me
> 
> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Thank you for the patch and the reviews!

- 608ee7eca5cd: "squashed" in "mptcp: infinite mapping sending"
- Results: 6cf1fda75aaf..fa314fbb2be0

Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220128T171211
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net