[PATCH mptcp-next] mptcp: add do_check_data_fin to replace copied

Geliang Tang posted 1 patch 1 year, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/95f0f96d90264cc6411b024753fe8430f6998e4f.1661258990.git.geliang.tang@suse.com
Maintainers: Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>, Matthieu Baerts <matthieu.baerts@tessares.net>, Eric Dumazet <edumazet@google.com>, "David S. Miller" <davem@davemloft.net>, Mat Martineau <mathew.j.martineau@linux.intel.com>
net/mptcp/protocol.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
[PATCH mptcp-next] mptcp: add do_check_data_fin to replace copied
Posted by Geliang Tang 1 year, 7 months ago
This patch adds a new bool variable 'do_check_data_fin' to replace the
original int variable 'copied' in __mptcp_push_pending(), check it to
determine whether to call __mptcp_check_send_data_fin().

Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 Do a small cleanup as Mat suggested in [1].

[1]
https://patchwork.kernel.org/project/mptcp/patch/ef3d52ff98c97b3c3e5b1efd84a1d4bf3448df5d.1656578856.git.geliang.tang@suse.com/
---
 net/mptcp/protocol.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 74699bd47edf..fb574d135002 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1473,8 +1473,9 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 	struct mptcp_sendmsg_info info = {
 				.flags = flags,
 	};
+	bool do_check_data_fin = false;
 	struct mptcp_data_frag *dfrag;
-	int len, copied = 0;
+	int len;
 
 	while ((dfrag = mptcp_send_head(sk))) {
 		info.sent = dfrag->already_sent;
@@ -1510,7 +1511,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 			}
 
 			info.sent += ret;
-			copied += ret;
+			do_check_data_fin = true;
 			len -= ret;
 
 			mptcp_update_post_push(msk, dfrag, ret);
@@ -1526,7 +1527,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
 	/* ensure the rtx timer is running */
 	if (!mptcp_timer_pending(sk))
 		mptcp_reset_timer(sk);
-	if (copied)
+	if (do_check_data_fin)
 		__mptcp_check_send_data_fin(sk);
 }
 
-- 
2.35.3


Re: [PATCH mptcp-next] mptcp: add do_check_data_fin to replace copied
Posted by Matthieu Baerts 1 year, 7 months ago
Hi Geliang,

On 23/08/2022 14:52, Geliang Tang wrote:
> This patch adds a new bool variable 'do_check_data_fin' to replace the
> original int variable 'copied' in __mptcp_push_pending(), check it to
> determine whether to call __mptcp_check_send_data_fin().

Thank you for this clean-up! (and good to see you around again!)
Sorry for the delay, I had a few days off but it is now in our tree
(feat. for net-next):

New patches for t/upstream:
- 695cc660c6c6: mptcp: add do_check_data_fin to replace copied
- Results: 276e5dcffc80..0838c359eb16 (export)

Tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220829T154355

> @@ -1510,7 +1511,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
>  			}
>  
>  			info.sent += ret;
> -			copied += ret;
> +			do_check_data_fin = true;

Note that I just moved this new line one line above to do the two
operations with 'ret' together.

>  			len -= ret;
>  
>  			mptcp_update_post_push(msk, dfrag, ret);

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