[PATCH mptcp-next v2] mptcp: get sk from msk directly

Geliang Tang posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20221023124831.8959-1-geliang.tang@suse.com
There is a newer version of this series
Maintainers: Mat Martineau <mathew.j.martineau@linux.intel.com>, Matthieu Baerts <matthieu.baerts@tessares.net>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
net/mptcp/pm_userspace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH mptcp-next v2] mptcp: get sk from msk directly
Posted by Geliang Tang 1 month, 2 weeks ago
Use '(struct sock *)msk' to get 'sk' from 'msk' in a more direct way
instead of using '&msk->sk.icsk_inet.sk' in mptcp_nl_cmd_sf_create()
and mptcp_nl_cmd_sf_destroy().

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
v2:
- fix the "uninitialized use occurs" error reported by kernel test robot
<lkp@intel.com>
---
 net/mptcp/pm_userspace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index 9e82250cbb70..5cb65f0928f4 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -291,7 +291,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
 		goto create_err;
 	}
 
-	sk = &msk->sk.icsk_inet.sk;
+	sk = (struct sock *)msk;
 	lock_sock(sk);
 
 	err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
@@ -403,7 +403,7 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
 		goto destroy_err;
 	}
 
-	sk = &msk->sk.icsk_inet.sk;
+	sk = (struct sock *)msk;
 	lock_sock(sk);
 	ssk = mptcp_nl_find_ssk(msk, &addr_l, &addr_r);
 	if (ssk) {
-- 
2.35.3
Re: [PATCH mptcp-next v2] mptcp: get sk from msk directly
Posted by Mat Martineau 1 month, 2 weeks ago
,On Sun, 23 Oct 2022, Geliang Tang wrote:

> Use '(struct sock *)msk' to get 'sk' from 'msk' in a more direct way
> instead of using '&msk->sk.icsk_inet.sk' in mptcp_nl_cmd_sf_create()
> and mptcp_nl_cmd_sf_destroy().
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>

Hi Geliang -

This is a good cleanup, thanks. We use the struct sock * cast almost 
everywhere. Can you extend this patch to also change the similar 
statements in sockopt.c and protocol.c?

(I think the assignment in mptcp_retransmit_timer() should stay unchanged)


- Mat



> ---
> v2:
> - fix the "uninitialized use occurs" error reported by kernel test robot
> <lkp@intel.com>
> ---
> net/mptcp/pm_userspace.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index 9e82250cbb70..5cb65f0928f4 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -291,7 +291,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
> 		goto create_err;
> 	}
>
> -	sk = &msk->sk.icsk_inet.sk;
> +	sk = (struct sock *)msk;
> 	lock_sock(sk);
>
> 	err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
> @@ -403,7 +403,7 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
> 		goto destroy_err;
> 	}
>
> -	sk = &msk->sk.icsk_inet.sk;
> +	sk = (struct sock *)msk;
> 	lock_sock(sk);
> 	ssk = mptcp_nl_find_ssk(msk, &addr_l, &addr_r);
> 	if (ssk) {
> -- 
> 2.35.3
>
>
>

--
Mat Martineau
Intel
Re: mptcp: get sk from msk directly: Tests Results
Posted by MPTCP CI 1 month, 2 weeks ago
Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal:
  - Unstable: 1 failed test(s): selftest_simult_flows 🔴:
  - Task: https://cirrus-ci.com/task/5530777696862208
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/5530777696862208/summary/summary.txt

- {"code":404,"message":
  - "Can't find artifacts containing file conclusion.txt"}:
  - Task: https://cirrus-ci.com/task/6656677603704832
  - Summary: https://api.cirrus-ci.com/v1/artifact/task/6656677603704832/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/38acef14684b


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)