Lines Matching refs:bat_priv
36 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client,
42 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
136 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const uint8_t *addr, in batadv_tt_local_hash_find() argument
142 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr, in batadv_tt_local_hash_find()
161 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const uint8_t *addr, in batadv_tt_global_hash_find() argument
167 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr, in batadv_tt_global_hash_find()
206 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, in batadv_tt_global_hash_count() argument
212 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_hash_count()
243 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv, in batadv_tt_local_size_mod() argument
248 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_size_mod()
263 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv, in batadv_tt_local_size_inc() argument
266 batadv_tt_local_size_mod(bat_priv, vid, 1); in batadv_tt_local_size_inc()
275 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, in batadv_tt_local_size_dec() argument
278 batadv_tt_local_size_mod(bat_priv, vid, -1); in batadv_tt_local_size_dec()
346 static void batadv_tt_local_event(struct batadv_priv *bat_priv, in batadv_tt_local_event() argument
369 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
370 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_local_event()
404 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list); in batadv_tt_local_event()
407 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
410 atomic_dec(&bat_priv->tt.local_changes); in batadv_tt_local_event()
412 atomic_inc(&bat_priv->tt.local_changes); in batadv_tt_local_event()
444 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) in batadv_tt_local_table_transmit_size() argument
451 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_table_transmit_size()
466 static int batadv_tt_local_init(struct batadv_priv *bat_priv) in batadv_tt_local_init() argument
468 if (bat_priv->tt.local_hash) in batadv_tt_local_init()
471 bat_priv->tt.local_hash = batadv_hash_new(1024); in batadv_tt_local_init()
473 if (!bat_priv->tt.local_hash) in batadv_tt_local_init()
476 batadv_hash_set_lock_class(bat_priv->tt.local_hash, in batadv_tt_local_init()
482 static void batadv_tt_global_free(struct batadv_priv *bat_priv, in batadv_tt_global_free() argument
486 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_free()
491 batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, in batadv_tt_global_free()
512 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_add() local
527 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
530 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
535 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
548 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
563 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_add()
565 packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_add()
578 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_add()
580 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
583 (uint8_t)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_add()
605 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt, in batadv_tt_local_add()
617 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
628 batadv_send_roam_adv(bat_priv, tt_global->common.addr, in batadv_tt_local_add()
634 batadv_tt_global_free(bat_priv, tt_global, in batadv_tt_local_add()
660 match_mark = (mark & bat_priv->isolation_mark_mask); in batadv_tt_local_add()
661 if (bat_priv->isolation_mark_mask && in batadv_tt_local_add()
662 match_mark == bat_priv->isolation_mark) in batadv_tt_local_add()
671 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
774 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, in batadv_tt_prepare_tvlv_local_data() argument
786 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
808 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn); in batadv_tt_prepare_tvlv_local_data()
812 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
832 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) in batadv_tt_tvlv_container_update() argument
841 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes); in batadv_tt_tvlv_container_update()
847 if (tt_diff_len > bat_priv->soft_iface->mtu) in batadv_tt_tvlv_container_update()
850 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data, in batadv_tt_tvlv_container_update()
860 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
861 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_tvlv_container_update()
863 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_tvlv_container_update()
874 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
877 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
878 kfree(bat_priv->tt.last_changeset); in batadv_tt_tvlv_container_update()
879 bat_priv->tt.last_changeset_len = 0; in batadv_tt_tvlv_container_update()
880 bat_priv->tt.last_changeset = NULL; in batadv_tt_tvlv_container_update()
887 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC); in batadv_tt_tvlv_container_update()
888 if (bat_priv->tt.last_changeset) { in batadv_tt_tvlv_container_update()
889 memcpy(bat_priv->tt.last_changeset, in batadv_tt_tvlv_container_update()
891 bat_priv->tt.last_changeset_len = tt_diff_len; in batadv_tt_tvlv_container_update()
894 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
897 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data, in batadv_tt_tvlv_container_update()
905 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_local_seq_print_text() local
906 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_seq_print_text()
926 net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_seq_print_text()
947 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_seq_print_text()
984 batadv_tt_local_set_pending(struct batadv_priv *bat_priv, in batadv_tt_local_set_pending() argument
988 batadv_tt_local_event(bat_priv, tt_local_entry, flags); in batadv_tt_local_set_pending()
996 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_set_pending()
1012 uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, in batadv_tt_local_remove() argument
1021 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_remove()
1039 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, in batadv_tt_local_remove()
1046 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); in batadv_tt_local_remove()
1048 tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, in batadv_tt_local_remove()
1059 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_remove()
1077 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, in batadv_tt_local_purge_list() argument
1100 batadv_tt_local_set_pending(bat_priv, tt_local_entry, in batadv_tt_local_purge_list()
1111 static void batadv_tt_local_purge(struct batadv_priv *bat_priv, in batadv_tt_local_purge() argument
1114 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge()
1124 batadv_tt_local_purge_list(bat_priv, head, timeout); in batadv_tt_local_purge()
1129 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) in batadv_tt_local_table_free() argument
1140 if (!bat_priv->tt.local_hash) in batadv_tt_local_table_free()
1143 hash = bat_priv->tt.local_hash; in batadv_tt_local_table_free()
1158 vlan = batadv_softif_vlan_get(bat_priv, in batadv_tt_local_table_free()
1170 bat_priv->tt.local_hash = NULL; in batadv_tt_local_table_free()
1173 static int batadv_tt_global_init(struct batadv_priv *bat_priv) in batadv_tt_global_init() argument
1175 if (bat_priv->tt.global_hash) in batadv_tt_global_init()
1178 bat_priv->tt.global_hash = batadv_hash_new(1024); in batadv_tt_global_init()
1180 if (!bat_priv->tt.global_hash) in batadv_tt_global_init()
1183 batadv_hash_set_lock_class(bat_priv->tt.global_hash, in batadv_tt_global_init()
1189 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) in batadv_tt_changes_list_free() argument
1193 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1195 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_changes_list_free()
1201 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_changes_list_free()
1202 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1308 static bool batadv_tt_global_add(struct batadv_priv *bat_priv, in batadv_tt_global_add() argument
1322 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) in batadv_tt_global_add()
1325 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1326 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1360 hash_added = batadv_hash_add(bat_priv->tt.global_hash, in batadv_tt_global_add()
1420 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_add()
1434 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid, in batadv_tt_global_add()
1462 batadv_transtable_best_orig(struct batadv_priv *bat_priv, in batadv_transtable_best_orig() argument
1466 struct batadv_algo_ops *bao = bat_priv->bat_algo_ops; in batadv_transtable_best_orig()
1508 batadv_tt_global_print_entry(struct batadv_priv *bat_priv, in batadv_tt_global_print_entry() argument
1522 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_tt_global_print_entry()
1585 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_global_seq_print_text() local
1586 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_seq_print_text()
1613 batadv_tt_global_print_entry(bat_priv, tt_global, seq); in batadv_tt_global_seq_print_text()
1668 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig_node() argument
1683 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig_node()
1700 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_del_roaming() argument
1731 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del_roaming()
1745 static void batadv_tt_global_del(struct batadv_priv *bat_priv, in batadv_tt_global_del() argument
1753 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_del()
1758 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del()
1762 batadv_tt_global_free(bat_priv, tt_global_entry, in batadv_tt_global_del()
1781 local_entry = batadv_tt_local_hash_find(bat_priv, in batadv_tt_global_del()
1787 batadv_tt_global_free(bat_priv, tt_global_entry, message); in batadv_tt_global_del()
1790 batadv_tt_global_del_roaming(bat_priv, tt_global_entry, in batadv_tt_global_del()
1810 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig() argument
1818 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_del_orig()
1842 batadv_tt_global_del_orig_node(bat_priv, tt_global, in batadv_tt_global_del_orig()
1847 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig()
1882 static void batadv_tt_global_purge(struct batadv_priv *bat_priv) in batadv_tt_global_purge() argument
1884 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_purge()
1907 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_purge()
1921 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) in batadv_tt_global_table_free() argument
1931 if (!bat_priv->tt.global_hash) in batadv_tt_global_table_free()
1934 hash = bat_priv->tt.global_hash; in batadv_tt_global_table_free()
1954 bat_priv->tt.global_hash = NULL; in batadv_tt_global_table_free()
1989 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, in batadv_transtable_search() argument
1999 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { in batadv_transtable_search()
2000 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); in batadv_transtable_search()
2006 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_transtable_search()
2018 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_transtable_search()
2059 static uint32_t batadv_tt_global_crc(struct batadv_priv *bat_priv, in batadv_tt_global_crc() argument
2063 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_crc()
2136 static uint32_t batadv_tt_local_crc(struct batadv_priv *bat_priv, in batadv_tt_local_crc() argument
2139 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_crc()
2183 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) in batadv_tt_req_list_free() argument
2187 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2189 list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_list_free()
2194 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2197 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, in batadv_tt_save_orig_buffer() argument
2218 static void batadv_tt_req_purge(struct batadv_priv *bat_priv) in batadv_tt_req_purge() argument
2222 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2223 list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_purge()
2230 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2237 batadv_new_tt_req_node(struct batadv_priv *bat_priv, in batadv_new_tt_req_node() argument
2242 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_new_tt_req_node()
2243 list_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) { in batadv_new_tt_req_node()
2257 list_add(&tt_req_node->list, &bat_priv->tt.req_list); in batadv_new_tt_req_node()
2259 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_new_tt_req_node()
2307 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, in batadv_tt_tvlv_generate() argument
2373 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, in batadv_tt_global_check_crc()
2397 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) in batadv_tt_local_update_crc() argument
2403 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_update_crc()
2404 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid); in batadv_tt_local_update_crc()
2414 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, in batadv_tt_global_update_crc() argument
2426 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, in batadv_tt_global_update_crc()
2430 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); in batadv_tt_global_update_crc()
2446 static int batadv_send_tt_request(struct batadv_priv *bat_priv, in batadv_send_tt_request() argument
2459 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_tt_request()
2466 tt_req_node = batadv_new_tt_req_node(bat_priv, dst_orig_node); in batadv_send_tt_request()
2494 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n", in batadv_send_tt_request()
2497 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX); in batadv_send_tt_request()
2498 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_tt_request()
2507 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2509 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2526 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, in batadv_send_other_tt_response() argument
2540 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
2546 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst); in batadv_send_other_tt_response()
2550 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_other_tt_response()
2602 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash, in batadv_send_other_tt_response()
2610 if (tt_len > atomic_read(&bat_priv->packet_size_max)) { in batadv_send_other_tt_response()
2611 net_ratelimited_function(batadv_info, bat_priv->soft_iface, in batadv_send_other_tt_response()
2623 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
2628 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_other_tt_response()
2630 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig, in batadv_send_other_tt_response()
2658 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, in batadv_send_my_tt_response() argument
2671 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
2676 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
2678 my_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
2681 orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_my_tt_response()
2685 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_my_tt_response()
2693 !bat_priv->tt.last_changeset) in batadv_send_my_tt_response()
2702 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2704 tt_len = bat_priv->tt.last_changeset_len; in batadv_send_my_tt_response()
2705 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
2713 memcpy(tt_change, bat_priv->tt.last_changeset, in batadv_send_my_tt_response()
2714 bat_priv->tt.last_changeset_len); in batadv_send_my_tt_response()
2715 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2717 req_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
2723 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
2731 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash, in batadv_send_my_tt_response()
2742 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
2746 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_my_tt_response()
2748 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_my_tt_response()
2755 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2757 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
2776 static bool batadv_send_tt_response(struct batadv_priv *bat_priv, in batadv_send_tt_response() argument
2780 if (batadv_is_my_mac(bat_priv, req_dst)) in batadv_send_tt_response()
2781 return batadv_send_my_tt_response(bat_priv, tt_data, req_src); in batadv_send_tt_response()
2783 return batadv_send_other_tt_response(bat_priv, tt_data, in batadv_send_tt_response()
2787 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, in _batadv_tt_update_changes() argument
2798 batadv_tt_global_del(bat_priv, orig_node, in _batadv_tt_update_changes()
2804 if (!batadv_tt_global_add(bat_priv, orig_node, in _batadv_tt_update_changes()
2820 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, in batadv_tt_fill_gtable() argument
2827 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_tt_fill_gtable()
2832 batadv_tt_global_del_orig(bat_priv, orig_node, -1, in batadv_tt_fill_gtable()
2835 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, in batadv_tt_fill_gtable()
2851 static void batadv_tt_update_changes(struct batadv_priv *bat_priv, in batadv_tt_update_changes() argument
2856 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
2859 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
2872 bool batadv_is_my_client(struct batadv_priv *bat_priv, const uint8_t *addr, in batadv_is_my_client() argument
2878 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_is_my_client()
2901 static void batadv_handle_tt_response(struct batadv_priv *bat_priv, in batadv_handle_tt_response() argument
2911 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_handle_tt_response()
2916 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_handle_tt_response()
2929 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn, in batadv_handle_tt_response()
2932 batadv_tt_update_changes(bat_priv, orig_node, num_entries, in batadv_handle_tt_response()
2937 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_handle_tt_response()
2942 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
2943 list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_handle_tt_response()
2950 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
2956 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) in batadv_tt_roam_list_free() argument
2960 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
2962 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_list_free()
2967 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
2970 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) in batadv_tt_roam_purge() argument
2974 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
2975 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_purge()
2983 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
2992 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, in batadv_tt_check_roam_count() argument
2998 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3002 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) { in batadv_tt_check_roam_count()
3027 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); in batadv_tt_check_roam_count()
3032 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3048 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client, in batadv_send_roam_adv() argument
3055 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_roam_adv()
3062 if (!batadv_tt_check_roam_count(bat_priv, client)) in batadv_send_roam_adv()
3065 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_roam_adv()
3069 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); in batadv_send_roam_adv()
3074 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_roam_adv()
3087 struct batadv_priv *bat_priv; in batadv_tt_purge() local
3091 bat_priv = container_of(priv_tt, struct batadv_priv, tt); in batadv_tt_purge()
3093 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT); in batadv_tt_purge()
3094 batadv_tt_global_purge(bat_priv); in batadv_tt_purge()
3095 batadv_tt_req_purge(bat_priv); in batadv_tt_purge()
3096 batadv_tt_roam_purge(bat_priv); in batadv_tt_purge()
3098 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_purge()
3102 void batadv_tt_free(struct batadv_priv *bat_priv) in batadv_tt_free() argument
3104 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3105 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3107 cancel_delayed_work_sync(&bat_priv->tt.work); in batadv_tt_free()
3109 batadv_tt_local_table_free(bat_priv); in batadv_tt_free()
3110 batadv_tt_global_table_free(bat_priv); in batadv_tt_free()
3111 batadv_tt_req_list_free(bat_priv); in batadv_tt_free()
3112 batadv_tt_changes_list_free(bat_priv); in batadv_tt_free()
3113 batadv_tt_roam_list_free(bat_priv); in batadv_tt_free()
3115 kfree(bat_priv->tt.last_changeset); in batadv_tt_free()
3126 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, in batadv_tt_local_set_flags() argument
3129 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_set_flags()
3158 batadv_tt_local_size_inc(bat_priv, in batadv_tt_local_set_flags()
3166 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) in batadv_tt_local_purge_pending_clients() argument
3168 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge_pending_clients()
3190 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_purge_pending_clients()
3195 batadv_tt_local_size_dec(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3202 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3219 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes_nolock() argument
3222 batadv_mcast_mla_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3224 if (atomic_read(&bat_priv->tt.local_changes) < 1) { in batadv_tt_local_commit_changes_nolock()
3225 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt)) in batadv_tt_local_commit_changes_nolock()
3226 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3230 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true); in batadv_tt_local_commit_changes_nolock()
3232 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_commit_changes_nolock()
3233 batadv_tt_local_update_crc(bat_priv); in batadv_tt_local_commit_changes_nolock()
3236 atomic_inc(&bat_priv->tt.vn); in batadv_tt_local_commit_changes_nolock()
3237 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_commit_changes_nolock()
3239 (uint8_t)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_commit_changes_nolock()
3242 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX); in batadv_tt_local_commit_changes_nolock()
3243 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3251 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes() argument
3253 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3254 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_commit_changes()
3255 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3258 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, uint8_t *src, in batadv_is_ap_isolated() argument
3266 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_is_ap_isolated()
3270 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); in batadv_is_ap_isolated()
3274 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); in batadv_is_ap_isolated()
3305 static void batadv_tt_update_orig(struct batadv_priv *bat_priv, in batadv_tt_update_orig() argument
3336 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes, in batadv_tt_update_orig()
3343 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_tt_update_orig()
3367 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_update_orig()
3371 batadv_send_tt_request(bat_priv, orig_node, ttvn, in batadv_tt_update_orig()
3389 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_client_is_roaming() argument
3395 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_client_is_roaming()
3415 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_local_client_is_roaming() argument
3421 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_client_is_roaming()
3431 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, in batadv_tt_add_temporary_global_entry() argument
3438 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, in batadv_tt_add_temporary_global_entry()
3443 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_add_temporary_global_entry()
3461 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_resize_to_mtu() local
3462 int packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_resize_to_mtu()
3466 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3469 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_resize_to_mtu()
3473 batadv_tt_local_purge(bat_priv, timeout); in batadv_tt_local_resize_to_mtu()
3474 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_resize_to_mtu()
3487 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_resize_to_mtu()
3489 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3500 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_ogm_handler_v1() argument
3527 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change, in batadv_tt_tvlv_ogm_handler_v1()
3543 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_unicast_handler_v1() argument
3570 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); in batadv_tt_tvlv_unicast_handler_v1()
3575 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst); in batadv_tt_tvlv_unicast_handler_v1()
3582 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
3590 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); in batadv_tt_tvlv_unicast_handler_v1()
3592 if (batadv_is_my_mac(bat_priv, dst)) { in batadv_tt_tvlv_unicast_handler_v1()
3593 batadv_handle_tt_response(bat_priv, tt_data, in batadv_tt_tvlv_unicast_handler_v1()
3603 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
3624 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_roam_tvlv_unicast_handler_v1() argument
3636 if (!batadv_is_my_mac(bat_priv, dst)) in batadv_roam_tvlv_unicast_handler_v1()
3642 orig_node = batadv_orig_hash_find(bat_priv, src); in batadv_roam_tvlv_unicast_handler_v1()
3646 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); in batadv_roam_tvlv_unicast_handler_v1()
3649 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_roam_tvlv_unicast_handler_v1()
3653 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client, in batadv_roam_tvlv_unicast_handler_v1()
3669 int batadv_tt_init(struct batadv_priv *bat_priv) in batadv_tt_init() argument
3676 ret = batadv_tt_local_init(bat_priv); in batadv_tt_init()
3680 ret = batadv_tt_global_init(bat_priv); in batadv_tt_init()
3684 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, in batadv_tt_init()
3688 batadv_tvlv_handler_register(bat_priv, NULL, in batadv_tt_init()
3692 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); in batadv_tt_init()
3693 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_init()
3708 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, in batadv_tt_global_is_isolated() argument
3714 tt = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_is_isolated()