Skip to content

Commit 61cf4b3

Browse files
Geliang Tangintel-lab-lkp
Geliang Tang
authored andcommitted
mptcp: pm: add struct_group in mptcp_pm_data
This patch adds a "struct_group(reset, ...)" in struct mptcp_pm_data to simplify the reset, and make sure we don't miss any. Suggested-by: Matthieu Baerts <[email protected]> Signed-off-by: Geliang Tang <[email protected]>
1 parent 69e53e9 commit 61cf4b3

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

net/mptcp/pm.c

+1-12
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
978978
u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk));
979979
struct mptcp_pm_data *pm = &msk->pm;
980980

981-
pm->add_addr_signaled = 0;
982-
pm->add_addr_accepted = 0;
983-
pm->local_addr_used = 0;
984-
pm->subflows = 0;
981+
memset(&pm->reset, 0, sizeof(pm->reset));
985982
pm->rm_list_tx.nr = 0;
986983
pm->rm_list_rx.nr = 0;
987984
WRITE_ONCE(pm->pm_type, pm_type);
@@ -1002,15 +999,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)
1002999
WRITE_ONCE(pm->accept_subflow, subflows_allowed);
10031000

10041001
bitmap_fill(pm->id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
1005-
} else {
1006-
WRITE_ONCE(pm->work_pending, 0);
1007-
WRITE_ONCE(pm->accept_addr, 0);
1008-
WRITE_ONCE(pm->accept_subflow, 0);
10091002
}
1010-
1011-
WRITE_ONCE(pm->addr_signal, 0);
1012-
WRITE_ONCE(pm->remote_deny_join_id0, false);
1013-
pm->status = 0;
10141003
}
10151004

10161005
void mptcp_pm_data_init(struct mptcp_sock *msk)

net/mptcp/protocol.h

+5
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ struct mptcp_pm_data {
223223

224224
spinlock_t lock; /*protects the whole PM data */
225225

226+
struct_group(reset,
227+
226228
u8 addr_signal;
227229
bool server_side;
228230
bool work_pending;
@@ -235,6 +237,9 @@ struct mptcp_pm_data {
235237
u8 pm_type;
236238
u8 subflows;
237239
u8 status;
240+
241+
);
242+
238243
DECLARE_BITMAP(id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1);
239244
struct mptcp_rm_list rm_list_tx;
240245
struct mptcp_rm_list rm_list_rx;

0 commit comments

Comments
 (0)