Skip to contentSkip to conversation

mptcp: get sk from msk directly

PATCH Superseded Geliang Tang 3 participants 3 messages Oct 23, 2022 – Oct 25, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mptcp: get sk from msk directly

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().

---
v2:
- fix the "uninitialized use occurs" error reported by kernel test robot <[email protected]>

---
 net/mptcp/pm_userspace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/pm_userspace.c +2 -2
index 9e82250cbb70..5cb65f0928f4 100644
@@ -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) {
Signature · 1 line
2.35.3
#1 lore raw

Re: mptcp: get sk from msk directly: Tests Results

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)

#2 lore raw
In reply to Geliang Tang
Quoted 5 lines · Geliang Tang

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().

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

Quoted 35 lines

---
v2:
- fix the "uninitialized use occurs" error reported by kernel test robot <[email protected]>
---
net/mptcp/pm_userspace.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/pm_userspace.c +2 -2
index 9e82250cbb70..5cb65f0928f4 100644
@@ -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) {
Signature · 1 line
2.35.3

--
Mat Martineau
Intel