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()
229 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv, in batadv_tt_local_size_mod() argument
234 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_size_mod()
249 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv, in batadv_tt_local_size_inc() argument
252 batadv_tt_local_size_mod(bat_priv, vid, 1); in batadv_tt_local_size_inc()
261 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, in batadv_tt_local_size_dec() argument
264 batadv_tt_local_size_mod(bat_priv, vid, -1); in batadv_tt_local_size_dec()
344 static void batadv_tt_local_event(struct batadv_priv *bat_priv, in batadv_tt_local_event() argument
367 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
368 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_local_event()
402 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list); in batadv_tt_local_event()
405 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
408 atomic_dec(&bat_priv->tt.local_changes); in batadv_tt_local_event()
410 atomic_inc(&bat_priv->tt.local_changes); in batadv_tt_local_event()
442 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) in batadv_tt_local_table_transmit_size() argument
449 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_table_transmit_size()
464 static int batadv_tt_local_init(struct batadv_priv *bat_priv) in batadv_tt_local_init() argument
466 if (bat_priv->tt.local_hash) in batadv_tt_local_init()
469 bat_priv->tt.local_hash = batadv_hash_new(1024); in batadv_tt_local_init()
471 if (!bat_priv->tt.local_hash) in batadv_tt_local_init()
474 batadv_hash_set_lock_class(bat_priv->tt.local_hash, in batadv_tt_local_init()
480 static void batadv_tt_global_free(struct batadv_priv *bat_priv, in batadv_tt_global_free() argument
484 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_free()
489 batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, in batadv_tt_global_free()
510 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_add() local
525 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
528 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
533 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
546 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
561 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_add()
563 packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_add()
576 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_add()
581 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
584 (uint8_t)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_add()
606 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt, in batadv_tt_local_add()
618 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
629 batadv_send_roam_adv(bat_priv, tt_global->common.addr, in batadv_tt_local_add()
635 batadv_tt_global_free(bat_priv, tt_global, in batadv_tt_local_add()
661 match_mark = (mark & bat_priv->isolation_mark_mask); in batadv_tt_local_add()
662 if (bat_priv->isolation_mark_mask && in batadv_tt_local_add()
663 match_mark == bat_priv->isolation_mark) in batadv_tt_local_add()
672 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
775 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, in batadv_tt_prepare_tvlv_local_data() argument
787 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
809 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn); in batadv_tt_prepare_tvlv_local_data()
813 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
833 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) in batadv_tt_tvlv_container_update() argument
842 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes); in batadv_tt_tvlv_container_update()
848 if (tt_diff_len > bat_priv->soft_iface->mtu) in batadv_tt_tvlv_container_update()
851 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data, in batadv_tt_tvlv_container_update()
861 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
862 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_tvlv_container_update()
864 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_tvlv_container_update()
875 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
878 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
879 kfree(bat_priv->tt.last_changeset); in batadv_tt_tvlv_container_update()
880 bat_priv->tt.last_changeset_len = 0; in batadv_tt_tvlv_container_update()
881 bat_priv->tt.last_changeset = NULL; in batadv_tt_tvlv_container_update()
888 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC); in batadv_tt_tvlv_container_update()
889 if (bat_priv->tt.last_changeset) { in batadv_tt_tvlv_container_update()
890 memcpy(bat_priv->tt.last_changeset, in batadv_tt_tvlv_container_update()
892 bat_priv->tt.last_changeset_len = tt_diff_len; in batadv_tt_tvlv_container_update()
895 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
898 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data, in batadv_tt_tvlv_container_update()
906 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_local_seq_print_text() local
907 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_seq_print_text()
927 net_dev->name, (uint8_t)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_seq_print_text()
948 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_seq_print_text()
985 batadv_tt_local_set_pending(struct batadv_priv *bat_priv, in batadv_tt_local_set_pending() argument
989 batadv_tt_local_event(bat_priv, tt_local_entry, flags); in batadv_tt_local_set_pending()
997 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_set_pending()
1013 uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, in batadv_tt_local_remove() argument
1022 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_remove()
1040 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, in batadv_tt_local_remove()
1047 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); in batadv_tt_local_remove()
1049 tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, in batadv_tt_local_remove()
1060 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_remove()
1081 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, in batadv_tt_local_purge_list() argument
1104 batadv_tt_local_set_pending(bat_priv, tt_local_entry, in batadv_tt_local_purge_list()
1115 static void batadv_tt_local_purge(struct batadv_priv *bat_priv, in batadv_tt_local_purge() argument
1118 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge()
1128 batadv_tt_local_purge_list(bat_priv, head, timeout); in batadv_tt_local_purge()
1133 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) in batadv_tt_local_table_free() argument
1144 if (!bat_priv->tt.local_hash) in batadv_tt_local_table_free()
1147 hash = bat_priv->tt.local_hash; in batadv_tt_local_table_free()
1162 vlan = batadv_softif_vlan_get(bat_priv, in batadv_tt_local_table_free()
1176 bat_priv->tt.local_hash = NULL; in batadv_tt_local_table_free()
1179 static int batadv_tt_global_init(struct batadv_priv *bat_priv) in batadv_tt_global_init() argument
1181 if (bat_priv->tt.global_hash) in batadv_tt_global_init()
1184 bat_priv->tt.global_hash = batadv_hash_new(1024); in batadv_tt_global_init()
1186 if (!bat_priv->tt.global_hash) in batadv_tt_global_init()
1189 batadv_hash_set_lock_class(bat_priv->tt.global_hash, in batadv_tt_global_init()
1195 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) in batadv_tt_changes_list_free() argument
1199 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1201 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_changes_list_free()
1207 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_changes_list_free()
1208 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1314 static bool batadv_tt_global_add(struct batadv_priv *bat_priv, in batadv_tt_global_add() argument
1328 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) in batadv_tt_global_add()
1331 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1332 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1366 hash_added = batadv_hash_add(bat_priv->tt.global_hash, in batadv_tt_global_add()
1426 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_add()
1440 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid, in batadv_tt_global_add()
1468 batadv_transtable_best_orig(struct batadv_priv *bat_priv, in batadv_transtable_best_orig() argument
1472 struct batadv_algo_ops *bao = bat_priv->bat_algo_ops; in batadv_transtable_best_orig()
1514 batadv_tt_global_print_entry(struct batadv_priv *bat_priv, in batadv_tt_global_print_entry() argument
1528 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_tt_global_print_entry()
1591 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_global_seq_print_text() local
1592 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_seq_print_text()
1619 batadv_tt_global_print_entry(bat_priv, tt_global, seq); in batadv_tt_global_seq_print_text()
1674 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig_node() argument
1689 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig_node()
1706 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_del_roaming() argument
1737 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del_roaming()
1751 static void batadv_tt_global_del(struct batadv_priv *bat_priv, in batadv_tt_global_del() argument
1759 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_del()
1764 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del()
1768 batadv_tt_global_free(bat_priv, tt_global_entry, in batadv_tt_global_del()
1787 local_entry = batadv_tt_local_hash_find(bat_priv, in batadv_tt_global_del()
1793 batadv_tt_global_free(bat_priv, tt_global_entry, message); in batadv_tt_global_del()
1796 batadv_tt_global_del_roaming(bat_priv, tt_global_entry, in batadv_tt_global_del()
1815 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig() argument
1823 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_del_orig()
1847 batadv_tt_global_del_orig_node(bat_priv, tt_global, in batadv_tt_global_del_orig()
1852 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig()
1887 static void batadv_tt_global_purge(struct batadv_priv *bat_priv) in batadv_tt_global_purge() argument
1889 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_purge()
1912 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_purge()
1926 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) in batadv_tt_global_table_free() argument
1936 if (!bat_priv->tt.global_hash) in batadv_tt_global_table_free()
1939 hash = bat_priv->tt.global_hash; in batadv_tt_global_table_free()
1959 bat_priv->tt.global_hash = NULL; in batadv_tt_global_table_free()
1994 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, in batadv_transtable_search() argument
2004 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { in batadv_transtable_search()
2005 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); in batadv_transtable_search()
2011 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_transtable_search()
2023 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_transtable_search()
2064 static uint32_t batadv_tt_global_crc(struct batadv_priv *bat_priv, in batadv_tt_global_crc() argument
2068 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_crc()
2141 static uint32_t batadv_tt_local_crc(struct batadv_priv *bat_priv, in batadv_tt_local_crc() argument
2144 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_crc()
2188 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) in batadv_tt_req_list_free() argument
2192 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2194 list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_list_free()
2199 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2202 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, in batadv_tt_save_orig_buffer() argument
2223 static void batadv_tt_req_purge(struct batadv_priv *bat_priv) in batadv_tt_req_purge() argument
2227 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2228 list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_purge()
2235 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2242 batadv_new_tt_req_node(struct batadv_priv *bat_priv, in batadv_new_tt_req_node() argument
2247 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_new_tt_req_node()
2248 list_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) { in batadv_new_tt_req_node()
2262 list_add(&tt_req_node->list, &bat_priv->tt.req_list); in batadv_new_tt_req_node()
2264 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_new_tt_req_node()
2312 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, in batadv_tt_tvlv_generate() argument
2378 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, in batadv_tt_global_check_crc()
2402 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) in batadv_tt_local_update_crc() argument
2408 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_update_crc()
2409 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid); in batadv_tt_local_update_crc()
2419 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, in batadv_tt_global_update_crc() argument
2431 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, in batadv_tt_global_update_crc()
2435 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); in batadv_tt_global_update_crc()
2451 static int batadv_send_tt_request(struct batadv_priv *bat_priv, in batadv_send_tt_request() argument
2464 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_tt_request()
2471 tt_req_node = batadv_new_tt_req_node(bat_priv, dst_orig_node); in batadv_send_tt_request()
2499 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n", in batadv_send_tt_request()
2502 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX); in batadv_send_tt_request()
2503 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_tt_request()
2512 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2514 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2531 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, in batadv_send_other_tt_response() argument
2545 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
2551 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst); in batadv_send_other_tt_response()
2555 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_other_tt_response()
2607 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash, in batadv_send_other_tt_response()
2615 if (tt_len > atomic_read(&bat_priv->packet_size_max)) { in batadv_send_other_tt_response()
2616 net_ratelimited_function(batadv_info, bat_priv->soft_iface, in batadv_send_other_tt_response()
2628 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
2633 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_other_tt_response()
2635 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig, in batadv_send_other_tt_response()
2663 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, in batadv_send_my_tt_response() argument
2676 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
2681 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
2683 my_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
2686 orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_my_tt_response()
2690 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_my_tt_response()
2698 !bat_priv->tt.last_changeset) in batadv_send_my_tt_response()
2707 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2709 tt_len = bat_priv->tt.last_changeset_len; in batadv_send_my_tt_response()
2710 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
2718 memcpy(tt_change, bat_priv->tt.last_changeset, in batadv_send_my_tt_response()
2719 bat_priv->tt.last_changeset_len); in batadv_send_my_tt_response()
2720 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2722 req_ttvn = (uint8_t)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
2728 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
2736 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash, in batadv_send_my_tt_response()
2747 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
2751 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_my_tt_response()
2753 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_my_tt_response()
2760 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2762 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
2781 static bool batadv_send_tt_response(struct batadv_priv *bat_priv, in batadv_send_tt_response() argument
2785 if (batadv_is_my_mac(bat_priv, req_dst)) in batadv_send_tt_response()
2786 return batadv_send_my_tt_response(bat_priv, tt_data, req_src); in batadv_send_tt_response()
2787 return batadv_send_other_tt_response(bat_priv, tt_data, req_src, in batadv_send_tt_response()
2791 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, in _batadv_tt_update_changes() argument
2802 batadv_tt_global_del(bat_priv, orig_node, in _batadv_tt_update_changes()
2808 if (!batadv_tt_global_add(bat_priv, orig_node, in _batadv_tt_update_changes()
2824 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, in batadv_tt_fill_gtable() argument
2831 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_tt_fill_gtable()
2836 batadv_tt_global_del_orig(bat_priv, orig_node, -1, in batadv_tt_fill_gtable()
2839 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, in batadv_tt_fill_gtable()
2855 static void batadv_tt_update_changes(struct batadv_priv *bat_priv, in batadv_tt_update_changes() argument
2860 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
2863 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
2876 bool batadv_is_my_client(struct batadv_priv *bat_priv, const uint8_t *addr, in batadv_is_my_client() argument
2882 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_is_my_client()
2905 static void batadv_handle_tt_response(struct batadv_priv *bat_priv, in batadv_handle_tt_response() argument
2915 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_handle_tt_response()
2920 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_handle_tt_response()
2933 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn, in batadv_handle_tt_response()
2936 batadv_tt_update_changes(bat_priv, orig_node, num_entries, in batadv_handle_tt_response()
2941 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_handle_tt_response()
2946 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
2947 list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_handle_tt_response()
2954 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
2960 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) in batadv_tt_roam_list_free() argument
2964 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
2966 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_list_free()
2971 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
2974 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) in batadv_tt_roam_purge() argument
2978 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
2979 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_purge()
2987 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
2996 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, in batadv_tt_check_roam_count() argument
3002 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3006 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) { in batadv_tt_check_roam_count()
3031 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); in batadv_tt_check_roam_count()
3036 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3052 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, uint8_t *client, in batadv_send_roam_adv() argument
3059 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_roam_adv()
3066 if (!batadv_tt_check_roam_count(bat_priv, client)) in batadv_send_roam_adv()
3069 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_roam_adv()
3073 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); in batadv_send_roam_adv()
3078 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_roam_adv()
3091 struct batadv_priv *bat_priv; in batadv_tt_purge() local
3095 bat_priv = container_of(priv_tt, struct batadv_priv, tt); in batadv_tt_purge()
3097 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT); in batadv_tt_purge()
3098 batadv_tt_global_purge(bat_priv); in batadv_tt_purge()
3099 batadv_tt_req_purge(bat_priv); in batadv_tt_purge()
3100 batadv_tt_roam_purge(bat_priv); in batadv_tt_purge()
3102 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_purge()
3106 void batadv_tt_free(struct batadv_priv *bat_priv) in batadv_tt_free() argument
3108 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3109 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3111 cancel_delayed_work_sync(&bat_priv->tt.work); in batadv_tt_free()
3113 batadv_tt_local_table_free(bat_priv); in batadv_tt_free()
3114 batadv_tt_global_table_free(bat_priv); in batadv_tt_free()
3115 batadv_tt_req_list_free(bat_priv); in batadv_tt_free()
3116 batadv_tt_changes_list_free(bat_priv); in batadv_tt_free()
3117 batadv_tt_roam_list_free(bat_priv); in batadv_tt_free()
3119 kfree(bat_priv->tt.last_changeset); in batadv_tt_free()
3130 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, in batadv_tt_local_set_flags() argument
3133 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_set_flags()
3162 batadv_tt_local_size_inc(bat_priv, in batadv_tt_local_set_flags()
3170 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) in batadv_tt_local_purge_pending_clients() argument
3172 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge_pending_clients()
3194 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_purge_pending_clients()
3199 batadv_tt_local_size_dec(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3206 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3225 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes_nolock() argument
3228 batadv_mcast_mla_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3230 if (atomic_read(&bat_priv->tt.local_changes) < 1) { in batadv_tt_local_commit_changes_nolock()
3231 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt)) in batadv_tt_local_commit_changes_nolock()
3232 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3236 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true); in batadv_tt_local_commit_changes_nolock()
3238 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_commit_changes_nolock()
3239 batadv_tt_local_update_crc(bat_priv); in batadv_tt_local_commit_changes_nolock()
3242 atomic_inc(&bat_priv->tt.vn); in batadv_tt_local_commit_changes_nolock()
3243 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_commit_changes_nolock()
3245 (uint8_t)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_commit_changes_nolock()
3248 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX); in batadv_tt_local_commit_changes_nolock()
3249 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3257 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes() argument
3259 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3260 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_commit_changes()
3261 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3264 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, uint8_t *src, in batadv_is_ap_isolated() argument
3272 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_is_ap_isolated()
3276 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); in batadv_is_ap_isolated()
3280 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); in batadv_is_ap_isolated()
3311 static void batadv_tt_update_orig(struct batadv_priv *bat_priv, in batadv_tt_update_orig() argument
3342 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes, in batadv_tt_update_orig()
3349 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_tt_update_orig()
3373 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_update_orig()
3377 batadv_send_tt_request(bat_priv, orig_node, ttvn, in batadv_tt_update_orig()
3395 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_client_is_roaming() argument
3401 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_client_is_roaming()
3421 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_local_client_is_roaming() argument
3427 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_client_is_roaming()
3437 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, in batadv_tt_add_temporary_global_entry() argument
3444 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, in batadv_tt_add_temporary_global_entry()
3449 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_add_temporary_global_entry()
3467 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_resize_to_mtu() local
3468 int packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_resize_to_mtu()
3472 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3475 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_resize_to_mtu()
3479 batadv_tt_local_purge(bat_priv, timeout); in batadv_tt_local_resize_to_mtu()
3480 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_resize_to_mtu()
3493 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_resize_to_mtu()
3495 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3506 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_ogm_handler_v1() argument
3533 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change, in batadv_tt_tvlv_ogm_handler_v1()
3549 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_unicast_handler_v1() argument
3576 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); in batadv_tt_tvlv_unicast_handler_v1()
3581 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst); in batadv_tt_tvlv_unicast_handler_v1()
3588 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
3596 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); in batadv_tt_tvlv_unicast_handler_v1()
3598 if (batadv_is_my_mac(bat_priv, dst)) { in batadv_tt_tvlv_unicast_handler_v1()
3599 batadv_handle_tt_response(bat_priv, tt_data, in batadv_tt_tvlv_unicast_handler_v1()
3609 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
3630 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_roam_tvlv_unicast_handler_v1() argument
3642 if (!batadv_is_my_mac(bat_priv, dst)) in batadv_roam_tvlv_unicast_handler_v1()
3648 orig_node = batadv_orig_hash_find(bat_priv, src); in batadv_roam_tvlv_unicast_handler_v1()
3652 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); in batadv_roam_tvlv_unicast_handler_v1()
3655 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_roam_tvlv_unicast_handler_v1()
3659 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client, in batadv_roam_tvlv_unicast_handler_v1()
3675 int batadv_tt_init(struct batadv_priv *bat_priv) in batadv_tt_init() argument
3682 ret = batadv_tt_local_init(bat_priv); in batadv_tt_init()
3686 ret = batadv_tt_global_init(bat_priv); in batadv_tt_init()
3690 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, in batadv_tt_init()
3694 batadv_tvlv_handler_register(bat_priv, NULL, in batadv_tt_init()
3698 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); in batadv_tt_init()
3699 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_init()
3714 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, in batadv_tt_global_is_isolated() argument
3720 tt = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_is_isolated()