Lines Matching refs:bat_priv
59 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
65 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
157 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_hash_find() argument
163 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr, in batadv_tt_local_hash_find()
182 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_global_hash_find() argument
188 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr, in batadv_tt_global_hash_find()
227 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, in batadv_tt_global_hash_count() argument
233 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_hash_count()
250 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv, in batadv_tt_local_size_mod() argument
255 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_size_mod()
270 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv, in batadv_tt_local_size_inc() argument
273 batadv_tt_local_size_mod(bat_priv, vid, 1); in batadv_tt_local_size_inc()
282 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, in batadv_tt_local_size_dec() argument
285 batadv_tt_local_size_mod(bat_priv, vid, -1); in batadv_tt_local_size_dec()
365 static void batadv_tt_local_event(struct batadv_priv *bat_priv, in batadv_tt_local_event() argument
388 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
389 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_local_event()
423 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list); in batadv_tt_local_event()
426 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
429 atomic_dec(&bat_priv->tt.local_changes); in batadv_tt_local_event()
431 atomic_inc(&bat_priv->tt.local_changes); in batadv_tt_local_event()
463 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) in batadv_tt_local_table_transmit_size() argument
471 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_table_transmit_size()
486 static int batadv_tt_local_init(struct batadv_priv *bat_priv) in batadv_tt_local_init() argument
488 if (bat_priv->tt.local_hash) in batadv_tt_local_init()
491 bat_priv->tt.local_hash = batadv_hash_new(1024); in batadv_tt_local_init()
493 if (!bat_priv->tt.local_hash) in batadv_tt_local_init()
496 batadv_hash_set_lock_class(bat_priv->tt.local_hash, in batadv_tt_local_init()
502 static void batadv_tt_global_free(struct batadv_priv *bat_priv, in batadv_tt_global_free() argument
506 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_free()
511 batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, in batadv_tt_global_free()
532 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_add() local
548 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
551 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
556 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
569 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
584 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_add()
586 packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_add()
599 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_add()
607 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
610 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_add()
632 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt, in batadv_tt_local_add()
644 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
655 batadv_send_roam_adv(bat_priv, tt_global->common.addr, in batadv_tt_local_add()
661 batadv_tt_global_free(bat_priv, tt_global, in batadv_tt_local_add()
687 match_mark = (mark & bat_priv->isolation_mark_mask); in batadv_tt_local_add()
688 if (bat_priv->isolation_mark_mask && in batadv_tt_local_add()
689 match_mark == bat_priv->isolation_mark) in batadv_tt_local_add()
698 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
804 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, in batadv_tt_prepare_tvlv_local_data() argument
818 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
840 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn); in batadv_tt_prepare_tvlv_local_data()
844 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
864 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) in batadv_tt_tvlv_container_update() argument
874 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes); in batadv_tt_tvlv_container_update()
880 if (tt_diff_len > bat_priv->soft_iface->mtu) in batadv_tt_tvlv_container_update()
883 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data, in batadv_tt_tvlv_container_update()
893 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
894 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_tvlv_container_update()
896 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_tvlv_container_update()
907 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
910 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
911 kfree(bat_priv->tt.last_changeset); in batadv_tt_tvlv_container_update()
912 bat_priv->tt.last_changeset_len = 0; in batadv_tt_tvlv_container_update()
913 bat_priv->tt.last_changeset = NULL; in batadv_tt_tvlv_container_update()
920 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC); in batadv_tt_tvlv_container_update()
921 if (bat_priv->tt.last_changeset) { in batadv_tt_tvlv_container_update()
922 memcpy(bat_priv->tt.last_changeset, in batadv_tt_tvlv_container_update()
924 bat_priv->tt.last_changeset_len = tt_diff_len; in batadv_tt_tvlv_container_update()
927 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
930 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data, in batadv_tt_tvlv_container_update()
938 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_local_seq_print_text() local
939 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_seq_print_text()
959 net_dev->name, (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_seq_print_text()
980 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_seq_print_text()
1017 batadv_tt_local_set_pending(struct batadv_priv *bat_priv, in batadv_tt_local_set_pending() argument
1021 batadv_tt_local_event(bat_priv, tt_local_entry, flags); in batadv_tt_local_set_pending()
1029 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_set_pending()
1045 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_remove() argument
1054 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_remove()
1072 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, in batadv_tt_local_remove()
1079 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); in batadv_tt_local_remove()
1081 tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, in batadv_tt_local_remove()
1092 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_remove()
1113 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, in batadv_tt_local_purge_list() argument
1136 batadv_tt_local_set_pending(bat_priv, tt_local_entry, in batadv_tt_local_purge_list()
1147 static void batadv_tt_local_purge(struct batadv_priv *bat_priv, in batadv_tt_local_purge() argument
1150 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge()
1160 batadv_tt_local_purge_list(bat_priv, head, timeout); in batadv_tt_local_purge()
1165 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) in batadv_tt_local_table_free() argument
1176 if (!bat_priv->tt.local_hash) in batadv_tt_local_table_free()
1179 hash = bat_priv->tt.local_hash; in batadv_tt_local_table_free()
1194 vlan = batadv_softif_vlan_get(bat_priv, in batadv_tt_local_table_free()
1208 bat_priv->tt.local_hash = NULL; in batadv_tt_local_table_free()
1211 static int batadv_tt_global_init(struct batadv_priv *bat_priv) in batadv_tt_global_init() argument
1213 if (bat_priv->tt.global_hash) in batadv_tt_global_init()
1216 bat_priv->tt.global_hash = batadv_hash_new(1024); in batadv_tt_global_init()
1218 if (!bat_priv->tt.global_hash) in batadv_tt_global_init()
1221 batadv_hash_set_lock_class(bat_priv->tt.global_hash, in batadv_tt_global_init()
1227 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) in batadv_tt_changes_list_free() argument
1231 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1233 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_changes_list_free()
1239 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_changes_list_free()
1240 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1346 static bool batadv_tt_global_add(struct batadv_priv *bat_priv, in batadv_tt_global_add() argument
1359 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) in batadv_tt_global_add()
1362 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1363 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1397 hash_added = batadv_hash_add(bat_priv->tt.global_hash, in batadv_tt_global_add()
1463 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_add()
1477 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid, in batadv_tt_global_add()
1505 batadv_transtable_best_orig(struct batadv_priv *bat_priv, in batadv_transtable_best_orig() argument
1509 struct batadv_algo_ops *bao = bat_priv->bat_algo_ops; in batadv_transtable_best_orig()
1551 batadv_tt_global_print_entry(struct batadv_priv *bat_priv, in batadv_tt_global_print_entry() argument
1565 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_tt_global_print_entry()
1628 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_global_seq_print_text() local
1629 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_seq_print_text()
1656 batadv_tt_global_print_entry(bat_priv, tt_global, seq); in batadv_tt_global_seq_print_text()
1719 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig_node() argument
1734 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig_node()
1751 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_del_roaming() argument
1782 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del_roaming()
1796 static void batadv_tt_global_del(struct batadv_priv *bat_priv, in batadv_tt_global_del() argument
1804 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_del()
1809 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del()
1813 batadv_tt_global_free(bat_priv, tt_global_entry, in batadv_tt_global_del()
1832 local_entry = batadv_tt_local_hash_find(bat_priv, in batadv_tt_global_del()
1838 batadv_tt_global_free(bat_priv, tt_global_entry, message); in batadv_tt_global_del()
1841 batadv_tt_global_del_roaming(bat_priv, tt_global_entry, in batadv_tt_global_del()
1860 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig() argument
1868 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_del_orig()
1892 batadv_tt_global_del_orig_node(bat_priv, tt_global, in batadv_tt_global_del_orig()
1897 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig()
1932 static void batadv_tt_global_purge(struct batadv_priv *bat_priv) in batadv_tt_global_purge() argument
1934 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_purge()
1957 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_purge()
1971 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) in batadv_tt_global_table_free() argument
1981 if (!bat_priv->tt.global_hash) in batadv_tt_global_table_free()
1984 hash = bat_priv->tt.global_hash; in batadv_tt_global_table_free()
2004 bat_priv->tt.global_hash = NULL; in batadv_tt_global_table_free()
2039 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, in batadv_transtable_search() argument
2049 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { in batadv_transtable_search()
2050 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); in batadv_transtable_search()
2056 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_transtable_search()
2068 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_transtable_search()
2109 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv, in batadv_tt_global_crc() argument
2113 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_crc()
2186 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv, in batadv_tt_local_crc() argument
2189 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_crc()
2233 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) in batadv_tt_req_list_free() argument
2238 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2240 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_list_free()
2245 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2248 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, in batadv_tt_save_orig_buffer() argument
2269 static void batadv_tt_req_purge(struct batadv_priv *bat_priv) in batadv_tt_req_purge() argument
2274 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2275 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_purge()
2282 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2294 batadv_tt_req_node_new(struct batadv_priv *bat_priv, in batadv_tt_req_node_new() argument
2299 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2300 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) { in batadv_tt_req_node_new()
2314 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list); in batadv_tt_req_node_new()
2316 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2364 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, in batadv_tt_tvlv_generate() argument
2430 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, in batadv_tt_global_check_crc()
2454 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) in batadv_tt_local_update_crc() argument
2460 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_update_crc()
2461 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid); in batadv_tt_local_update_crc()
2471 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, in batadv_tt_global_update_crc() argument
2483 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, in batadv_tt_global_update_crc()
2487 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); in batadv_tt_global_update_crc()
2503 static int batadv_send_tt_request(struct batadv_priv *bat_priv, in batadv_send_tt_request() argument
2516 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_tt_request()
2523 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node); in batadv_send_tt_request()
2551 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n", in batadv_send_tt_request()
2554 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX); in batadv_send_tt_request()
2555 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_tt_request()
2564 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2567 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2584 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, in batadv_send_other_tt_response() argument
2598 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
2604 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst); in batadv_send_other_tt_response()
2608 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_other_tt_response()
2660 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash, in batadv_send_other_tt_response()
2668 if (tt_len > atomic_read(&bat_priv->packet_size_max)) { in batadv_send_other_tt_response()
2669 net_ratelimited_function(batadv_info, bat_priv->soft_iface, in batadv_send_other_tt_response()
2681 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
2686 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_other_tt_response()
2688 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig, in batadv_send_other_tt_response()
2716 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, in batadv_send_my_tt_response() argument
2729 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
2734 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
2736 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
2739 orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_my_tt_response()
2743 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_my_tt_response()
2751 !bat_priv->tt.last_changeset) in batadv_send_my_tt_response()
2760 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2762 tt_len = bat_priv->tt.last_changeset_len; in batadv_send_my_tt_response()
2763 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
2771 memcpy(tt_change, bat_priv->tt.last_changeset, in batadv_send_my_tt_response()
2772 bat_priv->tt.last_changeset_len); in batadv_send_my_tt_response()
2773 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2775 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
2781 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
2789 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash, in batadv_send_my_tt_response()
2800 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
2804 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_my_tt_response()
2806 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_my_tt_response()
2813 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
2815 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
2834 static bool batadv_send_tt_response(struct batadv_priv *bat_priv, in batadv_send_tt_response() argument
2838 if (batadv_is_my_mac(bat_priv, req_dst)) in batadv_send_tt_response()
2839 return batadv_send_my_tt_response(bat_priv, tt_data, req_src); in batadv_send_tt_response()
2840 return batadv_send_other_tt_response(bat_priv, tt_data, req_src, in batadv_send_tt_response()
2844 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, in _batadv_tt_update_changes() argument
2855 batadv_tt_global_del(bat_priv, orig_node, in _batadv_tt_update_changes()
2861 if (!batadv_tt_global_add(bat_priv, orig_node, in _batadv_tt_update_changes()
2877 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, in batadv_tt_fill_gtable() argument
2884 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_tt_fill_gtable()
2889 batadv_tt_global_del_orig(bat_priv, orig_node, -1, in batadv_tt_fill_gtable()
2892 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, in batadv_tt_fill_gtable()
2908 static void batadv_tt_update_changes(struct batadv_priv *bat_priv, in batadv_tt_update_changes() argument
2913 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
2916 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
2929 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr, in batadv_is_my_client() argument
2935 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_is_my_client()
2958 static void batadv_handle_tt_response(struct batadv_priv *bat_priv, in batadv_handle_tt_response() argument
2969 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_handle_tt_response()
2974 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_handle_tt_response()
2987 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn, in batadv_handle_tt_response()
2990 batadv_tt_update_changes(bat_priv, orig_node, num_entries, in batadv_handle_tt_response()
2995 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_handle_tt_response()
3000 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3001 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_handle_tt_response()
3008 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3014 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) in batadv_tt_roam_list_free() argument
3018 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3020 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_list_free()
3025 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3028 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) in batadv_tt_roam_purge() argument
3032 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3033 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_purge()
3041 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3050 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client) in batadv_tt_check_roam_count() argument
3055 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3059 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) { in batadv_tt_check_roam_count()
3084 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); in batadv_tt_check_roam_count()
3089 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3105 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client, in batadv_send_roam_adv() argument
3112 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_roam_adv()
3119 if (!batadv_tt_check_roam_count(bat_priv, client)) in batadv_send_roam_adv()
3122 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_roam_adv()
3126 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); in batadv_send_roam_adv()
3131 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_roam_adv()
3144 struct batadv_priv *bat_priv; in batadv_tt_purge() local
3148 bat_priv = container_of(priv_tt, struct batadv_priv, tt); in batadv_tt_purge()
3150 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT); in batadv_tt_purge()
3151 batadv_tt_global_purge(bat_priv); in batadv_tt_purge()
3152 batadv_tt_req_purge(bat_priv); in batadv_tt_purge()
3153 batadv_tt_roam_purge(bat_priv); in batadv_tt_purge()
3155 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_purge()
3159 void batadv_tt_free(struct batadv_priv *bat_priv) in batadv_tt_free() argument
3161 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3162 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3164 cancel_delayed_work_sync(&bat_priv->tt.work); in batadv_tt_free()
3166 batadv_tt_local_table_free(bat_priv); in batadv_tt_free()
3167 batadv_tt_global_table_free(bat_priv); in batadv_tt_free()
3168 batadv_tt_req_list_free(bat_priv); in batadv_tt_free()
3169 batadv_tt_changes_list_free(bat_priv); in batadv_tt_free()
3170 batadv_tt_roam_list_free(bat_priv); in batadv_tt_free()
3172 kfree(bat_priv->tt.last_changeset); in batadv_tt_free()
3183 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags, in batadv_tt_local_set_flags() argument
3186 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_set_flags()
3215 batadv_tt_local_size_inc(bat_priv, in batadv_tt_local_set_flags()
3223 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) in batadv_tt_local_purge_pending_clients() argument
3225 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge_pending_clients()
3247 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_purge_pending_clients()
3252 batadv_tt_local_size_dec(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3259 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3278 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes_nolock() argument
3280 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes_nolock()
3283 batadv_mcast_mla_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3285 if (atomic_read(&bat_priv->tt.local_changes) < 1) { in batadv_tt_local_commit_changes_nolock()
3286 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt)) in batadv_tt_local_commit_changes_nolock()
3287 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3291 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true); in batadv_tt_local_commit_changes_nolock()
3293 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_commit_changes_nolock()
3294 batadv_tt_local_update_crc(bat_priv); in batadv_tt_local_commit_changes_nolock()
3297 atomic_inc(&bat_priv->tt.vn); in batadv_tt_local_commit_changes_nolock()
3298 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_commit_changes_nolock()
3300 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_commit_changes_nolock()
3303 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX); in batadv_tt_local_commit_changes_nolock()
3304 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3312 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes() argument
3314 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3315 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_commit_changes()
3316 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3319 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, in batadv_is_ap_isolated() argument
3327 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_is_ap_isolated()
3331 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); in batadv_is_ap_isolated()
3335 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); in batadv_is_ap_isolated()
3366 static void batadv_tt_update_orig(struct batadv_priv *bat_priv, in batadv_tt_update_orig() argument
3397 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes, in batadv_tt_update_orig()
3404 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_tt_update_orig()
3428 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_update_orig()
3432 batadv_send_tt_request(bat_priv, orig_node, ttvn, in batadv_tt_update_orig()
3450 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_client_is_roaming() argument
3456 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_client_is_roaming()
3476 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_local_client_is_roaming() argument
3482 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_client_is_roaming()
3492 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, in batadv_tt_add_temporary_global_entry() argument
3499 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, in batadv_tt_add_temporary_global_entry()
3504 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_add_temporary_global_entry()
3522 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_resize_to_mtu() local
3523 int packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_resize_to_mtu()
3527 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3530 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_resize_to_mtu()
3534 batadv_tt_local_purge(bat_priv, timeout); in batadv_tt_local_resize_to_mtu()
3535 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_resize_to_mtu()
3548 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_resize_to_mtu()
3550 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3561 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_ogm_handler_v1() argument
3588 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change, in batadv_tt_tvlv_ogm_handler_v1()
3604 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_unicast_handler_v1() argument
3631 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); in batadv_tt_tvlv_unicast_handler_v1()
3636 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst); in batadv_tt_tvlv_unicast_handler_v1()
3643 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
3651 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); in batadv_tt_tvlv_unicast_handler_v1()
3653 if (batadv_is_my_mac(bat_priv, dst)) { in batadv_tt_tvlv_unicast_handler_v1()
3654 batadv_handle_tt_response(bat_priv, tt_data, in batadv_tt_tvlv_unicast_handler_v1()
3664 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
3685 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_roam_tvlv_unicast_handler_v1() argument
3697 if (!batadv_is_my_mac(bat_priv, dst)) in batadv_roam_tvlv_unicast_handler_v1()
3703 orig_node = batadv_orig_hash_find(bat_priv, src); in batadv_roam_tvlv_unicast_handler_v1()
3707 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); in batadv_roam_tvlv_unicast_handler_v1()
3710 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_roam_tvlv_unicast_handler_v1()
3714 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client, in batadv_roam_tvlv_unicast_handler_v1()
3730 int batadv_tt_init(struct batadv_priv *bat_priv) in batadv_tt_init() argument
3737 ret = batadv_tt_local_init(bat_priv); in batadv_tt_init()
3741 ret = batadv_tt_global_init(bat_priv); in batadv_tt_init()
3745 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, in batadv_tt_init()
3749 batadv_tvlv_handler_register(bat_priv, NULL, in batadv_tt_init()
3753 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); in batadv_tt_init()
3754 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_init()
3769 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, in batadv_tt_global_is_isolated() argument
3775 tt = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_is_isolated()