Skip to contentSkip to conversation

add struct_group in mptcp_pm_data

PATCH In review Geliang Tang 3 participants 5 messages Mar 11, 2025

Subsystems (2)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

v2 cover add struct_group in mptcp_pm_data

From: Geliang Tang <[email protected]>

v2:
- A new patch to fill id_avail_bitmap for in-kernel pm only.
- Do not reset id_avail_bitmap, rm_list_tx and rm_list_rx in struct_group.

Geliang Tang (2):
mptcp: pm: only fill id_avail_bitmap for in-kernel pm
mptcp: pm: add struct_group in mptcp_pm_data

 net/mptcp/pm.c       | 16 +++-------------
 net/mptcp/protocol.h |  5 +++++
 2 files changed, 8 insertions(+), 13 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH v2 1/2 mptcp: pm: only fill id_avail_bitmap for in-kernel pm

From: Geliang Tang <[email protected]>

id_avail_bitmap of struct mptcp_pm_data is currently only used by the in-kernel PM, so this patch moves its initialization operation under the "if (pm_type == MPTCP_PM_TYPE_KERNEL)" condition.

---
 net/mptcp/pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/pm.c +2 -1
index 04a156395aad..af009661477b 100644
@@ -1000,6 +1000,8 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
 			   !!mptcp_pm_get_add_addr_accept_max(msk) &&
 			   subflows_allowed);
 		WRITE_ONCE(pm->accept_subflow, subflows_allowed);
+
+		bitmap_fill(pm->id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
 	} else {
 		WRITE_ONCE(pm->work_pending, 0);
 		WRITE_ONCE(pm->accept_addr, 0);
@@ -1009,7 +1011,6 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
 	WRITE_ONCE(pm->addr_signal, 0);
 	WRITE_ONCE(pm->remote_deny_join_id0, false);
 	pm->status = 0;
-	bitmap_fill(pm->id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
 }
 
 void mptcp_pm_data_init(struct mptcp_sock *msk)
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH v2 2/2 mptcp: pm: add struct_group in mptcp_pm_data

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

This patch adds a "struct_group(reset, ...)" in struct mptcp_pm_data to simplify the reset, and make sure we don't miss any.

---
 net/mptcp/pm.c       | 13 +------------
 net/mptcp/protocol.h |  5 +++++
 2 files changed, 6 insertions(+), 12 deletions(-)
net/mptcp/pm.c +1 -12
index af009661477b..85ee999729a1 100644
@@ -978,10 +978,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
 	u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));
 	struct mptcp_pm_data *pm = &msk->pm;
 
-	pm->add_addr_signaled = 0;
-	pm->add_addr_accepted = 0;
-	pm->local_addr_used = 0;
-	pm->subflows = 0;
+	memset(&pm->reset, 0, sizeof(pm->reset));
 	pm->rm_list_tx.nr = 0;
 	pm->rm_list_rx.nr = 0;
 	WRITE_ONCE(pm->pm_type, pm_type);
@@ -1002,15 +999,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
 		WRITE_ONCE(pm->accept_subflow, subflows_allowed);
 
 		bitmap_fill(pm->id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
-	} else {
-		WRITE_ONCE(pm->work_pending, 0);
-		WRITE_ONCE(pm->accept_addr, 0);
-		WRITE_ONCE(pm->accept_subflow, 0);
 	}
-
-	WRITE_ONCE(pm->addr_signal, 0);
-	WRITE_ONCE(pm->remote_deny_join_id0, false);
-	pm->status = 0;
 }
 
 void mptcp_pm_data_init(struct mptcp_sock *msk)
net/mptcp/protocol.h +5 -0
index 3492b256ecba..b5c945064baf 100644
@@ -223,6 +223,8 @@ struct mptcp_pm_data {
 
 	spinlock_t	lock;		/*protects the whole PM data */
 
+	struct_group(reset,
+
 	u8		addr_signal;
 	bool		server_side;
 	bool		work_pending;
@@ -235,6 +237,9 @@ struct mptcp_pm_data {
 	u8		pm_type;
 	u8		subflows;
 	u8		status;
+
+	);
+
 	DECLARE_BITMAP(id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
 	struct mptcp_rm_list rm_list_tx;
 	struct mptcp_rm_list rm_list_rx;
Signature · 1 line
2.43.0
#3 lore raw
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: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13781890400

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/6d0529e1674f
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=942573

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-normal

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 (NGI0 Core)

maintainer Reviewed-by on the v2 series
#4 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 10 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v2:
- A new patch to fill id_avail_bitmap for in-kernel pm only.
- Do not reset id_avail_bitmap, rm_list_tx and rm_list_rx in struct_group.

Geliang Tang (2):
mptcp: pm: only fill id_avail_bitmap for in-kernel pm
mptcp: pm: add struct_group in mptcp_pm_data

Thank you for these patches! They look good to me:

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.