Lines Matching refs:pernet
162 select_local_address(const struct pm_nl_pernet *pernet, in select_local_address() argument
172 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in select_local_address()
199 select_signal_address(struct pm_nl_pernet *pernet, unsigned int pos) in select_signal_address() argument
210 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in select_signal_address()
224 struct pm_nl_pernet *pernet; in mptcp_pm_get_add_addr_signal_max() local
226 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); in mptcp_pm_get_add_addr_signal_max()
227 return READ_ONCE(pernet->add_addr_signal_max); in mptcp_pm_get_add_addr_signal_max()
233 struct pm_nl_pernet *pernet; in mptcp_pm_get_add_addr_accept_max() local
235 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); in mptcp_pm_get_add_addr_accept_max()
236 return READ_ONCE(pernet->add_addr_accept_max); in mptcp_pm_get_add_addr_accept_max()
242 struct pm_nl_pernet *pernet; in mptcp_pm_get_subflows_max() local
244 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); in mptcp_pm_get_subflows_max()
245 return READ_ONCE(pernet->subflows_max); in mptcp_pm_get_subflows_max()
251 struct pm_nl_pernet *pernet; in mptcp_pm_get_local_addr_max() local
253 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); in mptcp_pm_get_local_addr_max()
254 return READ_ONCE(pernet->local_addr_max); in mptcp_pm_get_local_addr_max()
463 __lookup_addr(struct pm_nl_pernet *pernet, struct mptcp_addr_info *info) in __lookup_addr() argument
467 list_for_each_entry(entry, &pernet->local_addr_list, list) { in __lookup_addr()
480 struct pm_nl_pernet *pernet; in mptcp_pm_create_subflow_or_signal_addr() local
483 pernet = net_generic(sock_net(sk), pm_nl_pernet_id); in mptcp_pm_create_subflow_or_signal_addr()
496 local = select_signal_address(pernet, in mptcp_pm_create_subflow_or_signal_addr()
517 local = select_local_address(pernet, msk); in mptcp_pm_create_subflow_or_signal_addr()
558 struct pm_nl_pernet *pernet; in fill_local_addresses_vec() local
562 pernet = net_generic(sock_net(sk), pm_nl_pernet_id); in fill_local_addresses_vec()
567 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in fill_local_addresses_vec()
824 static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, in mptcp_pm_nl_append_new_local_addr() argument
831 spin_lock_bh(&pernet->lock); in mptcp_pm_nl_append_new_local_addr()
835 if (pernet->next_id == MAX_ADDR_ID) in mptcp_pm_nl_append_new_local_addr()
836 pernet->next_id = 1; in mptcp_pm_nl_append_new_local_addr()
837 if (pernet->addrs >= MPTCP_PM_ADDR_MAX) in mptcp_pm_nl_append_new_local_addr()
839 if (test_bit(entry->addr.id, pernet->id_bitmap)) in mptcp_pm_nl_append_new_local_addr()
845 list_for_each_entry(cur, &pernet->local_addr_list, list) { in mptcp_pm_nl_append_new_local_addr()
854 entry->addr.id = find_next_zero_bit(pernet->id_bitmap, in mptcp_pm_nl_append_new_local_addr()
856 pernet->next_id); in mptcp_pm_nl_append_new_local_addr()
858 pernet->next_id != 1) { in mptcp_pm_nl_append_new_local_addr()
859 pernet->next_id = 1; in mptcp_pm_nl_append_new_local_addr()
867 __set_bit(entry->addr.id, pernet->id_bitmap); in mptcp_pm_nl_append_new_local_addr()
868 if (entry->addr.id > pernet->next_id) in mptcp_pm_nl_append_new_local_addr()
869 pernet->next_id = entry->addr.id; in mptcp_pm_nl_append_new_local_addr()
872 addr_max = pernet->add_addr_signal_max; in mptcp_pm_nl_append_new_local_addr()
873 WRITE_ONCE(pernet->add_addr_signal_max, addr_max + 1); in mptcp_pm_nl_append_new_local_addr()
876 addr_max = pernet->local_addr_max; in mptcp_pm_nl_append_new_local_addr()
877 WRITE_ONCE(pernet->local_addr_max, addr_max + 1); in mptcp_pm_nl_append_new_local_addr()
880 pernet->addrs++; in mptcp_pm_nl_append_new_local_addr()
881 list_add_tail_rcu(&entry->list, &pernet->local_addr_list); in mptcp_pm_nl_append_new_local_addr()
885 spin_unlock_bh(&pernet->lock); in mptcp_pm_nl_append_new_local_addr()
963 struct pm_nl_pernet *pernet; in mptcp_pm_nl_get_local_id() local
980 pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); in mptcp_pm_nl_get_local_id()
983 list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { in mptcp_pm_nl_get_local_id()
1004 ret = mptcp_pm_nl_append_new_local_addr(pernet, entry); in mptcp_pm_nl_get_local_id()
1208 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_add_addr() local
1231 ret = mptcp_pm_nl_append_new_local_addr(pernet, entry); in mptcp_nl_cmd_add_addr()
1246 __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) in __lookup_addr_by_id() argument
1250 list_for_each_entry(entry, &pernet->local_addr_list, list) { in __lookup_addr_by_id()
1392 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_del_addr() local
1409 spin_lock_bh(&pernet->lock); in mptcp_nl_cmd_del_addr()
1410 entry = __lookup_addr_by_id(pernet, addr.addr.id); in mptcp_nl_cmd_del_addr()
1413 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_del_addr()
1417 addr_max = pernet->add_addr_signal_max; in mptcp_nl_cmd_del_addr()
1418 WRITE_ONCE(pernet->add_addr_signal_max, addr_max - 1); in mptcp_nl_cmd_del_addr()
1421 addr_max = pernet->local_addr_max; in mptcp_nl_cmd_del_addr()
1422 WRITE_ONCE(pernet->local_addr_max, addr_max - 1); in mptcp_nl_cmd_del_addr()
1425 pernet->addrs--; in mptcp_nl_cmd_del_addr()
1427 __clear_bit(entry->addr.id, pernet->id_bitmap); in mptcp_nl_cmd_del_addr()
1428 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_del_addr()
1498 static void __reset_counters(struct pm_nl_pernet *pernet) in __reset_counters() argument
1500 WRITE_ONCE(pernet->add_addr_signal_max, 0); in __reset_counters()
1501 WRITE_ONCE(pernet->add_addr_accept_max, 0); in __reset_counters()
1502 WRITE_ONCE(pernet->local_addr_max, 0); in __reset_counters()
1503 pernet->addrs = 0; in __reset_counters()
1508 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_flush_addrs() local
1511 spin_lock_bh(&pernet->lock); in mptcp_nl_cmd_flush_addrs()
1512 list_splice_init(&pernet->local_addr_list, &free_list); in mptcp_nl_cmd_flush_addrs()
1513 __reset_counters(pernet); in mptcp_nl_cmd_flush_addrs()
1514 pernet->next_id = 1; in mptcp_nl_cmd_flush_addrs()
1515 bitmap_zero(pernet->id_bitmap, MAX_ADDR_ID + 1); in mptcp_nl_cmd_flush_addrs()
1516 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_flush_addrs()
1565 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_get_addr() local
1587 spin_lock_bh(&pernet->lock); in mptcp_nl_cmd_get_addr()
1588 entry = __lookup_addr_by_id(pernet, addr.addr.id); in mptcp_nl_cmd_get_addr()
1601 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_get_addr()
1605 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_get_addr()
1617 struct pm_nl_pernet *pernet; in mptcp_nl_cmd_dump_addrs() local
1622 pernet = net_generic(net, pm_nl_pernet_id); in mptcp_nl_cmd_dump_addrs()
1624 spin_lock_bh(&pernet->lock); in mptcp_nl_cmd_dump_addrs()
1626 if (test_bit(i, pernet->id_bitmap)) { in mptcp_nl_cmd_dump_addrs()
1627 entry = __lookup_addr_by_id(pernet, i); in mptcp_nl_cmd_dump_addrs()
1649 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_dump_addrs()
1673 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_set_limits() local
1677 spin_lock_bh(&pernet->lock); in mptcp_nl_cmd_set_limits()
1678 rcv_addrs = pernet->add_addr_accept_max; in mptcp_nl_cmd_set_limits()
1683 subflows = pernet->subflows_max; in mptcp_nl_cmd_set_limits()
1688 WRITE_ONCE(pernet->add_addr_accept_max, rcv_addrs); in mptcp_nl_cmd_set_limits()
1689 WRITE_ONCE(pernet->subflows_max, subflows); in mptcp_nl_cmd_set_limits()
1692 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_set_limits()
1699 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_get_limits() local
1713 READ_ONCE(pernet->add_addr_accept_max))) in mptcp_nl_cmd_get_limits()
1717 READ_ONCE(pernet->subflows_max))) in mptcp_nl_cmd_get_limits()
1760 struct pm_nl_pernet *pernet = genl_info_pm_nl(info); in mptcp_nl_cmd_set_flags() local
1773 spin_lock_bh(&pernet->lock); in mptcp_nl_cmd_set_flags()
1774 entry = __lookup_addr(pernet, &addr.addr); in mptcp_nl_cmd_set_flags()
1776 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_set_flags()
1785 spin_unlock_bh(&pernet->lock); in mptcp_nl_cmd_set_flags()
2110 struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id); in pm_nl_init_net() local
2112 INIT_LIST_HEAD_RCU(&pernet->local_addr_list); in pm_nl_init_net()
2113 pernet->next_id = 1; in pm_nl_init_net()
2114 pernet->stale_loss_cnt = 4; in pm_nl_init_net()
2115 spin_lock_init(&pernet->lock); in pm_nl_init_net()
2129 struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id); in pm_nl_exit_net() local
2135 __flush_addrs(&pernet->local_addr_list); in pm_nl_exit_net()