Lines Matching refs:pm
21 u8 add_addr = READ_ONCE(msk->pm.addr_signal); in mptcp_pm_announce_addr()
25 lockdep_assert_held(&msk->pm.lock); in mptcp_pm_announce_addr()
35 msk->pm.remote = *addr; in mptcp_pm_announce_addr()
38 msk->pm.local = *addr; in mptcp_pm_announce_addr()
41 WRITE_ONCE(msk->pm.addr_signal, add_addr); in mptcp_pm_announce_addr()
47 u8 rm_addr = READ_ONCE(msk->pm.addr_signal); in mptcp_pm_remove_addr()
57 msk->pm.rm_list_tx = *rm_list; in mptcp_pm_remove_addr()
59 WRITE_ONCE(msk->pm.addr_signal, rm_addr); in mptcp_pm_remove_addr()
68 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_new_connection() local
72 WRITE_ONCE(pm->server_side, server_side); in mptcp_pm_new_connection()
78 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_allow_new_subflow() local
84 spin_lock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
85 pm->subflows++; in mptcp_pm_allow_new_subflow()
86 spin_unlock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
94 pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, in mptcp_pm_allow_new_subflow()
95 subflows_max, READ_ONCE(pm->accept_subflow)); in mptcp_pm_allow_new_subflow()
98 if (!READ_ONCE(pm->accept_subflow)) in mptcp_pm_allow_new_subflow()
101 spin_lock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
102 if (READ_ONCE(pm->accept_subflow)) { in mptcp_pm_allow_new_subflow()
103 ret = pm->subflows < subflows_max; in mptcp_pm_allow_new_subflow()
104 if (ret && ++pm->subflows == subflows_max) in mptcp_pm_allow_new_subflow()
105 WRITE_ONCE(pm->accept_subflow, false); in mptcp_pm_allow_new_subflow()
107 spin_unlock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
118 pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status, in mptcp_pm_schedule_work()
120 if (msk->pm.status & BIT(new_status)) in mptcp_pm_schedule_work()
123 msk->pm.status |= BIT(new_status); in mptcp_pm_schedule_work()
130 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_fully_established() local
135 spin_lock_bh(&pm->lock); in mptcp_pm_fully_established()
141 if (READ_ONCE(pm->work_pending) && in mptcp_pm_fully_established()
142 !(msk->pm.status & BIT(MPTCP_PM_ALREADY_ESTABLISHED))) in mptcp_pm_fully_established()
145 if ((msk->pm.status & BIT(MPTCP_PM_ALREADY_ESTABLISHED)) == 0) in mptcp_pm_fully_established()
148 msk->pm.status |= BIT(MPTCP_PM_ALREADY_ESTABLISHED); in mptcp_pm_fully_established()
149 spin_unlock_bh(&pm->lock); in mptcp_pm_fully_established()
162 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_subflow_established() local
166 if (!READ_ONCE(pm->work_pending)) in mptcp_pm_subflow_established()
169 spin_lock_bh(&pm->lock); in mptcp_pm_subflow_established()
171 if (READ_ONCE(pm->work_pending)) in mptcp_pm_subflow_established()
174 spin_unlock_bh(&pm->lock); in mptcp_pm_subflow_established()
180 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_subflow_check_next() local
186 spin_lock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
187 pm->subflows--; in mptcp_pm_subflow_check_next()
188 spin_unlock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
193 if (!READ_ONCE(pm->work_pending) && !update_subflows) in mptcp_pm_subflow_check_next()
196 spin_lock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
206 spin_unlock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
214 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_add_addr_received() local
217 READ_ONCE(pm->accept_addr)); in mptcp_pm_add_addr_received()
221 spin_lock_bh(&pm->lock); in mptcp_pm_add_addr_received()
232 (addr->id > 0 && !READ_ONCE(pm->accept_addr))) { in mptcp_pm_add_addr_received()
236 pm->remote = *addr; in mptcp_pm_add_addr_received()
241 spin_unlock_bh(&pm->lock); in mptcp_pm_add_addr_received()
247 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_add_addr_echoed() local
251 spin_lock_bh(&pm->lock); in mptcp_pm_add_addr_echoed()
253 if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) in mptcp_pm_add_addr_echoed()
256 spin_unlock_bh(&pm->lock); in mptcp_pm_add_addr_echoed()
270 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_rm_addr_received() local
278 spin_lock_bh(&pm->lock); in mptcp_pm_rm_addr_received()
280 pm->rm_list_rx = *rm_list; in mptcp_pm_rm_addr_received()
283 spin_unlock_bh(&pm->lock); in mptcp_pm_rm_addr_received()
334 spin_lock_bh(&msk->pm.lock); in mptcp_pm_add_addr_signal()
350 port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); in mptcp_pm_add_addr_signal()
352 family = *echo ? msk->pm.remote.family : msk->pm.local.family; in mptcp_pm_add_addr_signal()
357 *addr = msk->pm.remote; in mptcp_pm_add_addr_signal()
358 add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); in mptcp_pm_add_addr_signal()
360 *addr = msk->pm.local; in mptcp_pm_add_addr_signal()
361 add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL); in mptcp_pm_add_addr_signal()
363 WRITE_ONCE(msk->pm.addr_signal, add_addr); in mptcp_pm_add_addr_signal()
367 spin_unlock_bh(&msk->pm.lock); in mptcp_pm_add_addr_signal()
377 spin_lock_bh(&msk->pm.lock); in mptcp_pm_rm_addr_signal()
383 rm_addr = msk->pm.addr_signal & ~BIT(MPTCP_RM_ADDR_SIGNAL); in mptcp_pm_rm_addr_signal()
384 len = mptcp_rm_addr_len(&msk->pm.rm_list_tx); in mptcp_pm_rm_addr_signal()
386 WRITE_ONCE(msk->pm.addr_signal, rm_addr); in mptcp_pm_rm_addr_signal()
392 *rm_list = msk->pm.rm_list_tx; in mptcp_pm_rm_addr_signal()
393 WRITE_ONCE(msk->pm.addr_signal, rm_addr); in mptcp_pm_rm_addr_signal()
397 spin_unlock_bh(&msk->pm.lock); in mptcp_pm_rm_addr_signal()
501 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_data_reset() local
503 pm->add_addr_signaled = 0; in mptcp_pm_data_reset()
504 pm->add_addr_accepted = 0; in mptcp_pm_data_reset()
505 pm->local_addr_used = 0; in mptcp_pm_data_reset()
506 pm->subflows = 0; in mptcp_pm_data_reset()
507 pm->rm_list_tx.nr = 0; in mptcp_pm_data_reset()
508 pm->rm_list_rx.nr = 0; in mptcp_pm_data_reset()
509 WRITE_ONCE(pm->pm_type, pm_type); in mptcp_pm_data_reset()
517 WRITE_ONCE(pm->work_pending, in mptcp_pm_data_reset()
521 WRITE_ONCE(pm->accept_addr, in mptcp_pm_data_reset()
524 WRITE_ONCE(pm->accept_subflow, subflows_allowed); in mptcp_pm_data_reset()
526 WRITE_ONCE(pm->work_pending, 0); in mptcp_pm_data_reset()
527 WRITE_ONCE(pm->accept_addr, 0); in mptcp_pm_data_reset()
528 WRITE_ONCE(pm->accept_subflow, 0); in mptcp_pm_data_reset()
531 WRITE_ONCE(pm->addr_signal, 0); in mptcp_pm_data_reset()
532 WRITE_ONCE(pm->remote_deny_join_id0, false); in mptcp_pm_data_reset()
533 pm->status = 0; in mptcp_pm_data_reset()
534 bitmap_fill(msk->pm.id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); in mptcp_pm_data_reset()
539 spin_lock_init(&msk->pm.lock); in mptcp_pm_data_init()
540 INIT_LIST_HEAD(&msk->pm.anno_list); in mptcp_pm_data_init()
541 INIT_LIST_HEAD(&msk->pm.userspace_pm_local_addr_list); in mptcp_pm_data_init()