Skip to contentSkip to conversation

two small cleanups

PATCH In review Geliang Tang 4 participants 7 messages Dec 9, 2022 – Dec 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover two small cleanups

Two small cleanups.

Geliang Tang (2):
mptcp: use net instead of sock_net
mptcp: use local variable ssk in write_options

 net/mptcp/options.c    | 3 +--
 net/mptcp/pm_netlink.c | 5 ++---
 net/mptcp/protocol.c   | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/2 mptcp: use net instead of sock_net

Use the local variable 'net' instead of sock_net() in the functions where the variable 'struct net *net' has been defined.

---
 net/mptcp/pm_netlink.c | 5 ++---
 net/mptcp/protocol.c   | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)
net/mptcp/pm_netlink.c +2 -3
index d20f1d969900..f2a43e13bacd 100644
@@ -1140,7 +1140,7 @@ void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ss
 			if (!tcp_rtx_and_write_queues_empty(ssk)) {
 				subflow->stale = 1;
 				__mptcp_retransmit_pending_data(sk);
-				MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_SUBFLOWSTALE);
+				MPTCP_INC_STATS(net, MPTCP_MIB_SUBFLOWSTALE);
 			}
 			unlock_sock_fast(ssk, slow);
 
@@ -1900,8 +1900,7 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	if (token)
-		return mptcp_userspace_pm_set_flags(sock_net(skb->sk),
-						    token, &addr, &remote, bkup);
+		return mptcp_userspace_pm_set_flags(net, token, &addr, &remote, bkup);
 
 	spin_lock_bh(&pernet->lock);
 	entry = __lookup_addr(pernet, &addr.addr, lookup_by_id);
net/mptcp/protocol.c +2 -2
index 6d03bdcda33e..88c019c56369 100644
@@ -2739,8 +2739,8 @@ static int mptcp_init_sock(struct sock *sk)
 	mptcp_ca_reset(sk);
 
 	sk_sockets_allocated_inc(sk);
-	sk->sk_rcvbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1]);
-	sk->sk_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1]);
+	sk->sk_rcvbuf = READ_ONCE(net->ipv4.sysctl_tcp_rmem[1]);
+	sk->sk_sndbuf = READ_ONCE(net->ipv4.sysctl_tcp_wmem[1]);
 
 	return 0;
 }
Signature · 1 line
2.35.3
#2 lore raw

PATCH 2/2 mptcp: use local variable ssk in write_options

In reply to Geliang Tang

The local variable 'ssk' has been defined at the beginning of the function mptcp_write_options(), use it instead of getting 'ssk' again.

---
 net/mptcp/options.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/mptcp/options.c +1 -2
index 5ded85e2c374..b30cea2fbf3f 100644
@@ -1594,8 +1594,7 @@ void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
 				      TCPOLEN_MPTCP_PRIO,
 				      opts->backup, TCPOPT_NOP);
 
-		MPTCP_INC_STATS(sock_net((const struct sock *)tp),
-				MPTCP_MIB_MPPRIOTX);
+		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPPRIOTX);
 	}
 
 mp_capable_done:
Signature · 1 line
2.35.3
#3 lore raw

Re: mptcp: use local variable ssk in write_options: 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 (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5379541095415808
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5379541095415808/summary/summary.txt

- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6505441002258432
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6505441002258432/summary/summary.txt

- KVM Validation: debug (except selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/4675853653639168
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4675853653639168/summary/summary.txt

- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/5801753560481792
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5801753560481792/summary/summary.txt

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

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)

Reviewed-by on the v1 series
#5 lore raw
In reply to Geliang Tang
Quoted 11 lines · Geliang Tang

Two small cleanups.

Geliang Tang (2):
mptcp: use net instead of sock_net
mptcp: use local variable ssk in write_options

net/mptcp/options.c    | 3 +--
net/mptcp/pm_netlink.c | 5 ++---
net/mptcp/protocol.c   | 4 ++--
3 files changed, 5 insertions(+), 7 deletions(-)

Hi Geliang -

Appreciate the cleanup, changes are good to merge:

--
Mat Martineau
Intel

#4 lore raw

Re: mptcp: use local variable ssk in write_options: Tests Results

In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: Script error! ❓:
- :
- Task: https://cirrus-ci.com/task/5564318373117952
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5564318373117952/summary/summary.txt

- KVM Validation: Script error! ❓:
- :
- Task: https://cirrus-ci.com/task/5669871489384448
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5669871489384448/summary/summary.txt

- KVM Validation: Script error! ❓:
- :
- Task: https://cirrus-ci.com/task/4543971582541824
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4543971582541824/summary/summary.txt

- KVM Validation: Script error! ❓:
- :
- Task: https://cirrus-ci.com/task/6690218279960576
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6690218279960576/summary/summary.txt

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

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)

#6 lore raw
In reply to Geliang Tang

Hi Geliang, Mat,

Quoted 5 lines · Geliang Tang

Two small cleanups.

Geliang Tang (2):
mptcp: use net instead of sock_net
mptcp: use local variable ssk in write_options

Thank you for the patches and the reviews!

Now in our tree (feat. for net-next) with Mat's RvB tag:

New patches for t/upstream:
- 3f76289942fd: mptcp: use net instead of sock_net
- cd700ab87ddb: mptcp: use local variable ssk in write_options
- Results: 3f302724c1a3..652f1687a656 (export)

Tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20221214T173738

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net