Lines Matching full:pm

20 	u8 add_addr = READ_ONCE(msk->pm.addr_signal);  in mptcp_pm_announce_addr()
24 lockdep_assert_held(&msk->pm.lock); in mptcp_pm_announce_addr()
34 msk->pm.remote = *addr; in mptcp_pm_announce_addr()
37 msk->pm.local = *addr; in mptcp_pm_announce_addr()
40 WRITE_ONCE(msk->pm.addr_signal, add_addr); in mptcp_pm_announce_addr()
46 u8 rm_addr = READ_ONCE(msk->pm.addr_signal); in mptcp_pm_remove_addr()
56 msk->pm.rm_list_tx = *rm_list; in mptcp_pm_remove_addr()
58 WRITE_ONCE(msk->pm.addr_signal, rm_addr); in mptcp_pm_remove_addr()
67 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_new_connection() local
71 WRITE_ONCE(pm->server_side, server_side); in mptcp_pm_new_connection()
77 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_allow_new_subflow() local
83 spin_lock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
84 pm->subflows++; in mptcp_pm_allow_new_subflow()
85 spin_unlock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
93 pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, in mptcp_pm_allow_new_subflow()
94 subflows_max, READ_ONCE(pm->accept_subflow)); in mptcp_pm_allow_new_subflow()
97 if (!READ_ONCE(pm->accept_subflow)) in mptcp_pm_allow_new_subflow()
100 spin_lock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
101 if (READ_ONCE(pm->accept_subflow)) { in mptcp_pm_allow_new_subflow()
102 ret = pm->subflows < subflows_max; in mptcp_pm_allow_new_subflow()
103 if (ret && ++pm->subflows == subflows_max) in mptcp_pm_allow_new_subflow()
104 WRITE_ONCE(pm->accept_subflow, false); in mptcp_pm_allow_new_subflow()
106 spin_unlock_bh(&pm->lock); in mptcp_pm_allow_new_subflow()
117 pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status, in mptcp_pm_schedule_work()
119 if (msk->pm.status & BIT(new_status)) in mptcp_pm_schedule_work()
122 msk->pm.status |= BIT(new_status); in mptcp_pm_schedule_work()
129 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_fully_established() local
134 spin_lock_bh(&pm->lock); in mptcp_pm_fully_established()
140 if (READ_ONCE(pm->work_pending) && in mptcp_pm_fully_established()
141 !(msk->pm.status & BIT(MPTCP_PM_ALREADY_ESTABLISHED))) in mptcp_pm_fully_established()
144 if ((msk->pm.status & BIT(MPTCP_PM_ALREADY_ESTABLISHED)) == 0) in mptcp_pm_fully_established()
147 msk->pm.status |= BIT(MPTCP_PM_ALREADY_ESTABLISHED); in mptcp_pm_fully_established()
148 spin_unlock_bh(&pm->lock); in mptcp_pm_fully_established()
161 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_subflow_established() local
165 if (!READ_ONCE(pm->work_pending)) in mptcp_pm_subflow_established()
168 spin_lock_bh(&pm->lock); in mptcp_pm_subflow_established()
170 if (READ_ONCE(pm->work_pending)) in mptcp_pm_subflow_established()
173 spin_unlock_bh(&pm->lock); in mptcp_pm_subflow_established()
179 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_subflow_check_next() local
185 spin_lock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
186 pm->subflows--; in mptcp_pm_subflow_check_next()
187 spin_unlock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
192 if (!READ_ONCE(pm->work_pending) && !update_subflows) in mptcp_pm_subflow_check_next()
195 spin_lock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
199 /* Even if this subflow is not really established, tell the PM to try in mptcp_pm_subflow_check_next()
205 spin_unlock_bh(&pm->lock); in mptcp_pm_subflow_check_next()
213 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_add_addr_received() local
216 READ_ONCE(pm->accept_addr)); in mptcp_pm_add_addr_received()
220 spin_lock_bh(&pm->lock); in mptcp_pm_add_addr_received()
231 (addr->id > 0 && !READ_ONCE(pm->accept_addr))) { in mptcp_pm_add_addr_received()
235 pm->remote = *addr; in mptcp_pm_add_addr_received()
240 spin_unlock_bh(&pm->lock); in mptcp_pm_add_addr_received()
246 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_add_addr_echoed() local
250 spin_lock_bh(&pm->lock); in mptcp_pm_add_addr_echoed()
252 if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) in mptcp_pm_add_addr_echoed()
255 spin_unlock_bh(&pm->lock); in mptcp_pm_add_addr_echoed()
269 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_rm_addr_received() local
277 spin_lock_bh(&pm->lock); in mptcp_pm_rm_addr_received()
279 pm->rm_list_rx = *rm_list; in mptcp_pm_rm_addr_received()
282 spin_unlock_bh(&pm->lock); in mptcp_pm_rm_addr_received()
333 spin_lock_bh(&msk->pm.lock); in mptcp_pm_add_addr_signal()
349 port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); in mptcp_pm_add_addr_signal()
351 family = *echo ? msk->pm.remote.family : msk->pm.local.family; in mptcp_pm_add_addr_signal()
356 *addr = msk->pm.remote; in mptcp_pm_add_addr_signal()
357 add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); in mptcp_pm_add_addr_signal()
359 *addr = msk->pm.local; in mptcp_pm_add_addr_signal()
360 add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL); in mptcp_pm_add_addr_signal()
362 WRITE_ONCE(msk->pm.addr_signal, add_addr); in mptcp_pm_add_addr_signal()
366 spin_unlock_bh(&msk->pm.lock); in mptcp_pm_add_addr_signal()
376 spin_lock_bh(&msk->pm.lock); in mptcp_pm_rm_addr_signal()
382 rm_addr = msk->pm.addr_signal & ~BIT(MPTCP_RM_ADDR_SIGNAL); in mptcp_pm_rm_addr_signal()
383 len = mptcp_rm_addr_len(&msk->pm.rm_list_tx); in mptcp_pm_rm_addr_signal()
385 WRITE_ONCE(msk->pm.addr_signal, rm_addr); in mptcp_pm_rm_addr_signal()
391 *rm_list = msk->pm.rm_list_tx; in mptcp_pm_rm_addr_signal()
392 WRITE_ONCE(msk->pm.addr_signal, rm_addr); in mptcp_pm_rm_addr_signal()
396 spin_unlock_bh(&msk->pm.lock); in mptcp_pm_rm_addr_signal()
503 struct mptcp_pm_data *pm = &msk->pm; in mptcp_pm_data_reset() local
505 pm->add_addr_signaled = 0; in mptcp_pm_data_reset()
506 pm->add_addr_accepted = 0; in mptcp_pm_data_reset()
507 pm->local_addr_used = 0; in mptcp_pm_data_reset()
508 pm->subflows = 0; in mptcp_pm_data_reset()
509 pm->rm_list_tx.nr = 0; in mptcp_pm_data_reset()
510 pm->rm_list_rx.nr = 0; in mptcp_pm_data_reset()
511 WRITE_ONCE(pm->pm_type, pm_type); in mptcp_pm_data_reset()
516 /* pm->work_pending must be only be set to 'true' when in mptcp_pm_data_reset()
517 * pm->pm_type is set to MPTCP_PM_TYPE_KERNEL in mptcp_pm_data_reset()
519 WRITE_ONCE(pm->work_pending, in mptcp_pm_data_reset()
523 WRITE_ONCE(pm->accept_addr, in mptcp_pm_data_reset()
526 WRITE_ONCE(pm->accept_subflow, subflows_allowed); in mptcp_pm_data_reset()
528 WRITE_ONCE(pm->work_pending, 0); in mptcp_pm_data_reset()
529 WRITE_ONCE(pm->accept_addr, 0); in mptcp_pm_data_reset()
530 WRITE_ONCE(pm->accept_subflow, 0); in mptcp_pm_data_reset()
533 WRITE_ONCE(pm->addr_signal, 0); in mptcp_pm_data_reset()
534 WRITE_ONCE(pm->remote_deny_join_id0, false); in mptcp_pm_data_reset()
535 pm->status = 0; in mptcp_pm_data_reset()
536 bitmap_fill(msk->pm.id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); in mptcp_pm_data_reset()
541 spin_lock_init(&msk->pm.lock); in mptcp_pm_data_init()
542 INIT_LIST_HEAD(&msk->pm.anno_list); in mptcp_pm_data_init()
543 INIT_LIST_HEAD(&msk->pm.userspace_pm_local_addr_list); in mptcp_pm_data_init()