Lines Matching refs:bat_priv
66 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
72 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
172 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_hash_find() argument
178 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr, in batadv_tt_local_hash_find()
197 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_global_hash_find() argument
203 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr, in batadv_tt_global_hash_find()
298 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, in batadv_tt_global_hash_count() argument
304 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_hash_count()
321 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv, in batadv_tt_local_size_mod() argument
326 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_size_mod()
341 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv, in batadv_tt_local_size_inc() argument
344 batadv_tt_local_size_mod(bat_priv, vid, 1); in batadv_tt_local_size_inc()
353 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, in batadv_tt_local_size_dec() argument
356 batadv_tt_local_size_mod(bat_priv, vid, -1); in batadv_tt_local_size_dec()
460 static void batadv_tt_local_event(struct batadv_priv *bat_priv, in batadv_tt_local_event() argument
483 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
484 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_local_event()
518 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list); in batadv_tt_local_event()
521 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
524 atomic_dec(&bat_priv->tt.local_changes); in batadv_tt_local_event()
526 atomic_inc(&bat_priv->tt.local_changes); in batadv_tt_local_event()
558 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) in batadv_tt_local_table_transmit_size() argument
566 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_table_transmit_size()
581 static int batadv_tt_local_init(struct batadv_priv *bat_priv) in batadv_tt_local_init() argument
583 if (bat_priv->tt.local_hash) in batadv_tt_local_init()
586 bat_priv->tt.local_hash = batadv_hash_new(1024); in batadv_tt_local_init()
588 if (!bat_priv->tt.local_hash) in batadv_tt_local_init()
591 batadv_hash_set_lock_class(bat_priv->tt.local_hash, in batadv_tt_local_init()
597 static void batadv_tt_global_free(struct batadv_priv *bat_priv, in batadv_tt_global_free() argument
604 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_free()
609 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash, in batadv_tt_global_free()
639 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_add() local
660 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
663 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
668 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
681 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
696 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_add()
698 packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_add()
711 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_add()
721 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
724 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_add()
748 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt, in batadv_tt_local_add()
759 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
770 batadv_send_roam_adv(bat_priv, tt_global->common.addr, in batadv_tt_local_add()
776 batadv_tt_global_free(bat_priv, tt_global, in batadv_tt_local_add()
802 match_mark = (mark & bat_priv->isolation_mark_mask); in batadv_tt_local_add()
803 if (bat_priv->isolation_mark_mask && in batadv_tt_local_add()
804 match_mark == bat_priv->isolation_mark) in batadv_tt_local_add()
813 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
921 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, in batadv_tt_prepare_tvlv_local_data() argument
935 spin_lock_bh(&bat_priv->softif_vlan_list_lock); in batadv_tt_prepare_tvlv_local_data()
936 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
962 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn); in batadv_tt_prepare_tvlv_local_data()
966 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
982 spin_unlock_bh(&bat_priv->softif_vlan_list_lock); in batadv_tt_prepare_tvlv_local_data()
991 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) in batadv_tt_tvlv_container_update() argument
1001 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes); in batadv_tt_tvlv_container_update()
1007 if (tt_diff_len > bat_priv->soft_iface->mtu) in batadv_tt_tvlv_container_update()
1010 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data, in batadv_tt_tvlv_container_update()
1020 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
1021 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_tvlv_container_update()
1023 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_tvlv_container_update()
1034 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
1037 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
1038 kfree(bat_priv->tt.last_changeset); in batadv_tt_tvlv_container_update()
1039 bat_priv->tt.last_changeset_len = 0; in batadv_tt_tvlv_container_update()
1040 bat_priv->tt.last_changeset = NULL; in batadv_tt_tvlv_container_update()
1047 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC); in batadv_tt_tvlv_container_update()
1048 if (bat_priv->tt.last_changeset) { in batadv_tt_tvlv_container_update()
1049 memcpy(bat_priv->tt.last_changeset, in batadv_tt_tvlv_container_update()
1051 bat_priv->tt.last_changeset_len = tt_diff_len; in batadv_tt_tvlv_container_update()
1054 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
1057 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data, in batadv_tt_tvlv_container_update()
1074 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_local_seq_print_text() local
1075 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_seq_print_text()
1093 net_dev->name, (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_seq_print_text()
1153 struct batadv_priv *bat_priv, in batadv_tt_local_dump_entry() argument
1165 vlan = batadv_softif_vlan_get(bat_priv, common->vid); in batadv_tt_local_dump_entry()
1214 struct batadv_priv *bat_priv, in batadv_tt_local_dump_bucket() argument
1228 if (batadv_tt_local_dump_entry(msg, portid, cb, bat_priv, in batadv_tt_local_dump_bucket()
1252 struct batadv_priv *bat_priv; in batadv_tt_local_dump() local
1271 bat_priv = netdev_priv(soft_iface); in batadv_tt_local_dump()
1273 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_tt_local_dump()
1279 hash = bat_priv->tt.local_hash; in batadv_tt_local_dump()
1282 if (batadv_tt_local_dump_bucket(msg, portid, cb, bat_priv, in batadv_tt_local_dump()
1304 batadv_tt_local_set_pending(struct batadv_priv *bat_priv, in batadv_tt_local_set_pending() argument
1308 batadv_tt_local_event(bat_priv, tt_local_entry, flags); in batadv_tt_local_set_pending()
1316 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_set_pending()
1332 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_remove() argument
1341 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_remove()
1359 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, in batadv_tt_local_remove()
1366 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); in batadv_tt_local_remove()
1368 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash, in batadv_tt_local_remove()
1395 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, in batadv_tt_local_purge_list() argument
1418 batadv_tt_local_set_pending(bat_priv, tt_local_entry, in batadv_tt_local_purge_list()
1429 static void batadv_tt_local_purge(struct batadv_priv *bat_priv, in batadv_tt_local_purge() argument
1432 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge()
1442 batadv_tt_local_purge_list(bat_priv, head, timeout); in batadv_tt_local_purge()
1447 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) in batadv_tt_local_table_free() argument
1457 if (!bat_priv->tt.local_hash) in batadv_tt_local_table_free()
1460 hash = bat_priv->tt.local_hash; in batadv_tt_local_table_free()
1481 bat_priv->tt.local_hash = NULL; in batadv_tt_local_table_free()
1484 static int batadv_tt_global_init(struct batadv_priv *bat_priv) in batadv_tt_global_init() argument
1486 if (bat_priv->tt.global_hash) in batadv_tt_global_init()
1489 bat_priv->tt.global_hash = batadv_hash_new(1024); in batadv_tt_global_init()
1491 if (!bat_priv->tt.global_hash) in batadv_tt_global_init()
1494 batadv_hash_set_lock_class(bat_priv->tt.global_hash, in batadv_tt_global_init()
1500 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) in batadv_tt_changes_list_free() argument
1504 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1506 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_changes_list_free()
1512 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_changes_list_free()
1513 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1678 static bool batadv_tt_global_add(struct batadv_priv *bat_priv, in batadv_tt_global_add() argument
1691 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) in batadv_tt_global_add()
1694 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1695 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1733 hash_added = batadv_hash_add(bat_priv->tt.global_hash, in batadv_tt_global_add()
1801 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_add()
1815 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid, in batadv_tt_global_add()
1843 batadv_transtable_best_orig(struct batadv_priv *bat_priv, in batadv_transtable_best_orig() argument
1847 struct batadv_algo_ops *bao = bat_priv->algo_ops; in batadv_transtable_best_orig()
1890 batadv_tt_global_print_entry(struct batadv_priv *bat_priv, in batadv_tt_global_print_entry() argument
1904 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_tt_global_print_entry()
1974 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_global_seq_print_text() local
1975 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_seq_print_text()
2001 batadv_tt_global_print_entry(bat_priv, tt_global, seq); in batadv_tt_global_seq_print_text()
2088 struct batadv_priv *bat_priv, in batadv_tt_global_dump_entry() argument
2098 best_entry = batadv_transtable_best_orig(bat_priv, global); in batadv_tt_global_dump_entry()
2132 struct batadv_priv *bat_priv, in batadv_tt_global_dump_bucket() argument
2143 if (batadv_tt_global_dump_entry(msg, portid, seq, bat_priv, in batadv_tt_global_dump_bucket()
2168 struct batadv_priv *bat_priv; in batadv_tt_global_dump() local
2189 bat_priv = netdev_priv(soft_iface); in batadv_tt_global_dump()
2191 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_tt_global_dump()
2197 hash = bat_priv->tt.global_hash; in batadv_tt_global_dump()
2203 cb->nlh->nlmsg_seq, bat_priv, in batadv_tt_global_dump()
2278 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig_node() argument
2293 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig_node()
2310 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_del_roaming() argument
2341 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del_roaming()
2356 static void batadv_tt_global_del(struct batadv_priv *bat_priv, in batadv_tt_global_del() argument
2364 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_del()
2369 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del()
2373 batadv_tt_global_free(bat_priv, tt_global_entry, in batadv_tt_global_del()
2392 local_entry = batadv_tt_local_hash_find(bat_priv, in batadv_tt_global_del()
2398 batadv_tt_global_free(bat_priv, tt_global_entry, message); in batadv_tt_global_del()
2401 batadv_tt_global_del_roaming(bat_priv, tt_global_entry, in batadv_tt_global_del()
2421 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig() argument
2429 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_del_orig()
2453 batadv_tt_global_del_orig_node(bat_priv, tt_global, in batadv_tt_global_del_orig()
2458 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig()
2493 static void batadv_tt_global_purge(struct batadv_priv *bat_priv) in batadv_tt_global_purge() argument
2495 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_purge()
2518 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_purge()
2532 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) in batadv_tt_global_table_free() argument
2542 if (!bat_priv->tt.global_hash) in batadv_tt_global_table_free()
2545 hash = bat_priv->tt.global_hash; in batadv_tt_global_table_free()
2565 bat_priv->tt.global_hash = NULL; in batadv_tt_global_table_free()
2598 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, in batadv_transtable_search() argument
2608 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { in batadv_transtable_search()
2609 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); in batadv_transtable_search()
2615 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_transtable_search()
2627 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_transtable_search()
2668 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv, in batadv_tt_global_crc() argument
2672 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_crc()
2749 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv, in batadv_tt_local_crc() argument
2752 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_crc()
2822 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) in batadv_tt_req_list_free() argument
2827 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2829 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_list_free()
2834 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2837 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, in batadv_tt_save_orig_buffer() argument
2858 static void batadv_tt_req_purge(struct batadv_priv *bat_priv) in batadv_tt_req_purge() argument
2863 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2864 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_purge()
2871 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2883 batadv_tt_req_node_new(struct batadv_priv *bat_priv, in batadv_tt_req_node_new() argument
2888 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2889 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) { in batadv_tt_req_node_new()
2905 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list); in batadv_tt_req_node_new()
2907 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2982 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, in batadv_tt_tvlv_generate() argument
3055 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, in batadv_tt_global_check_crc()
3091 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) in batadv_tt_local_update_crc() argument
3097 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_update_crc()
3098 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid); in batadv_tt_local_update_crc()
3108 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, in batadv_tt_global_update_crc() argument
3120 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, in batadv_tt_global_update_crc()
3124 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); in batadv_tt_global_update_crc()
3142 static bool batadv_send_tt_request(struct batadv_priv *bat_priv, in batadv_send_tt_request() argument
3155 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_tt_request()
3162 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node); in batadv_send_tt_request()
3190 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n", in batadv_send_tt_request()
3193 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX); in batadv_send_tt_request()
3194 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_tt_request()
3204 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
3209 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
3229 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, in batadv_send_other_tt_response() argument
3243 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
3249 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst); in batadv_send_other_tt_response()
3253 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_other_tt_response()
3305 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash, in batadv_send_other_tt_response()
3313 if (tt_len > atomic_read(&bat_priv->packet_size_max)) { in batadv_send_other_tt_response()
3314 net_ratelimited_function(batadv_info, bat_priv->soft_iface, in batadv_send_other_tt_response()
3326 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
3331 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_other_tt_response()
3333 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig, in batadv_send_other_tt_response()
3361 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, in batadv_send_my_tt_response() argument
3374 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
3379 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
3381 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
3384 orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_my_tt_response()
3388 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_my_tt_response()
3396 !bat_priv->tt.last_changeset) in batadv_send_my_tt_response()
3405 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3407 tt_len = bat_priv->tt.last_changeset_len; in batadv_send_my_tt_response()
3408 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
3416 memcpy(tt_change, bat_priv->tt.last_changeset, in batadv_send_my_tt_response()
3417 bat_priv->tt.last_changeset_len); in batadv_send_my_tt_response()
3418 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3420 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
3426 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
3434 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash, in batadv_send_my_tt_response()
3445 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
3449 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_my_tt_response()
3451 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_my_tt_response()
3458 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3460 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
3479 static bool batadv_send_tt_response(struct batadv_priv *bat_priv, in batadv_send_tt_response() argument
3483 if (batadv_is_my_mac(bat_priv, req_dst)) in batadv_send_tt_response()
3484 return batadv_send_my_tt_response(bat_priv, tt_data, req_src); in batadv_send_tt_response()
3485 return batadv_send_other_tt_response(bat_priv, tt_data, req_src, in batadv_send_tt_response()
3489 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, in _batadv_tt_update_changes() argument
3500 batadv_tt_global_del(bat_priv, orig_node, in _batadv_tt_update_changes()
3506 if (!batadv_tt_global_add(bat_priv, orig_node, in _batadv_tt_update_changes()
3522 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, in batadv_tt_fill_gtable() argument
3529 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_tt_fill_gtable()
3534 batadv_tt_global_del_orig(bat_priv, orig_node, -1, in batadv_tt_fill_gtable()
3537 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, in batadv_tt_fill_gtable()
3553 static void batadv_tt_update_changes(struct batadv_priv *bat_priv, in batadv_tt_update_changes() argument
3558 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
3561 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
3574 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr, in batadv_is_my_client() argument
3580 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_is_my_client()
3603 static void batadv_handle_tt_response(struct batadv_priv *bat_priv, in batadv_handle_tt_response() argument
3614 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_handle_tt_response()
3619 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_handle_tt_response()
3632 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn, in batadv_handle_tt_response()
3635 batadv_tt_update_changes(bat_priv, orig_node, num_entries, in batadv_handle_tt_response()
3640 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_handle_tt_response()
3645 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3646 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_handle_tt_response()
3653 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3659 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) in batadv_tt_roam_list_free() argument
3663 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3665 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_list_free()
3670 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3673 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) in batadv_tt_roam_purge() argument
3677 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3678 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_purge()
3686 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3700 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client) in batadv_tt_check_roam_count() argument
3705 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3709 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) { in batadv_tt_check_roam_count()
3735 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); in batadv_tt_check_roam_count()
3740 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3756 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client, in batadv_send_roam_adv() argument
3763 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_roam_adv()
3770 if (!batadv_tt_check_roam_count(bat_priv, client)) in batadv_send_roam_adv()
3773 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_roam_adv()
3777 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); in batadv_send_roam_adv()
3782 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_roam_adv()
3795 struct batadv_priv *bat_priv; in batadv_tt_purge() local
3799 bat_priv = container_of(priv_tt, struct batadv_priv, tt); in batadv_tt_purge()
3801 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT); in batadv_tt_purge()
3802 batadv_tt_global_purge(bat_priv); in batadv_tt_purge()
3803 batadv_tt_req_purge(bat_priv); in batadv_tt_purge()
3804 batadv_tt_roam_purge(bat_priv); in batadv_tt_purge()
3806 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_purge()
3814 void batadv_tt_free(struct batadv_priv *bat_priv) in batadv_tt_free() argument
3816 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_ROAM, 1); in batadv_tt_free()
3818 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3819 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3821 cancel_delayed_work_sync(&bat_priv->tt.work); in batadv_tt_free()
3823 batadv_tt_local_table_free(bat_priv); in batadv_tt_free()
3824 batadv_tt_global_table_free(bat_priv); in batadv_tt_free()
3825 batadv_tt_req_list_free(bat_priv); in batadv_tt_free()
3826 batadv_tt_changes_list_free(bat_priv); in batadv_tt_free()
3827 batadv_tt_roam_list_free(bat_priv); in batadv_tt_free()
3829 kfree(bat_priv->tt.last_changeset); in batadv_tt_free()
3840 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags, in batadv_tt_local_set_flags() argument
3843 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_set_flags()
3870 batadv_tt_local_size_inc(bat_priv, in batadv_tt_local_set_flags()
3878 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) in batadv_tt_local_purge_pending_clients() argument
3880 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge_pending_clients()
3901 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_purge_pending_clients()
3906 batadv_tt_local_size_dec(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3925 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes_nolock() argument
3927 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes_nolock()
3929 if (atomic_read(&bat_priv->tt.local_changes) < 1) { in batadv_tt_local_commit_changes_nolock()
3930 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt)) in batadv_tt_local_commit_changes_nolock()
3931 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3935 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true); in batadv_tt_local_commit_changes_nolock()
3937 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_commit_changes_nolock()
3938 batadv_tt_local_update_crc(bat_priv); in batadv_tt_local_commit_changes_nolock()
3941 atomic_inc(&bat_priv->tt.vn); in batadv_tt_local_commit_changes_nolock()
3942 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_commit_changes_nolock()
3944 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_commit_changes_nolock()
3947 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX); in batadv_tt_local_commit_changes_nolock()
3948 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3956 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes() argument
3958 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3959 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_commit_changes()
3960 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3972 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, in batadv_is_ap_isolated() argument
3980 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_is_ap_isolated()
3987 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); in batadv_is_ap_isolated()
3991 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); in batadv_is_ap_isolated()
4017 static void batadv_tt_update_orig(struct batadv_priv *bat_priv, in batadv_tt_update_orig() argument
4048 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes, in batadv_tt_update_orig()
4055 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_tt_update_orig()
4079 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_update_orig()
4083 batadv_send_tt_request(bat_priv, orig_node, ttvn, in batadv_tt_update_orig()
4101 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_client_is_roaming() argument
4107 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_client_is_roaming()
4127 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_local_client_is_roaming() argument
4133 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_client_is_roaming()
4152 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, in batadv_tt_add_temporary_global_entry() argument
4163 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, in batadv_tt_add_temporary_global_entry()
4168 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_add_temporary_global_entry()
4185 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_resize_to_mtu() local
4186 int packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_resize_to_mtu()
4190 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
4193 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_resize_to_mtu()
4197 batadv_tt_local_purge(bat_priv, timeout); in batadv_tt_local_resize_to_mtu()
4198 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_resize_to_mtu()
4211 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_resize_to_mtu()
4213 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
4224 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_ogm_handler_v1() argument
4251 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change, in batadv_tt_tvlv_ogm_handler_v1()
4267 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_unicast_handler_v1() argument
4294 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); in batadv_tt_tvlv_unicast_handler_v1()
4299 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst); in batadv_tt_tvlv_unicast_handler_v1()
4306 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
4314 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); in batadv_tt_tvlv_unicast_handler_v1()
4316 if (batadv_is_my_mac(bat_priv, dst)) { in batadv_tt_tvlv_unicast_handler_v1()
4317 batadv_handle_tt_response(bat_priv, tt_data, in batadv_tt_tvlv_unicast_handler_v1()
4327 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
4349 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_roam_tvlv_unicast_handler_v1() argument
4361 if (!batadv_is_my_mac(bat_priv, dst)) in batadv_roam_tvlv_unicast_handler_v1()
4367 orig_node = batadv_orig_hash_find(bat_priv, src); in batadv_roam_tvlv_unicast_handler_v1()
4371 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); in batadv_roam_tvlv_unicast_handler_v1()
4374 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_roam_tvlv_unicast_handler_v1()
4378 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client, in batadv_roam_tvlv_unicast_handler_v1()
4394 int batadv_tt_init(struct batadv_priv *bat_priv) in batadv_tt_init() argument
4401 ret = batadv_tt_local_init(bat_priv); in batadv_tt_init()
4405 ret = batadv_tt_global_init(bat_priv); in batadv_tt_init()
4407 batadv_tt_local_table_free(bat_priv); in batadv_tt_init()
4411 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, in batadv_tt_init()
4415 batadv_tvlv_handler_register(bat_priv, NULL, in batadv_tt_init()
4419 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); in batadv_tt_init()
4420 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_init()
4435 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, in batadv_tt_global_is_isolated() argument
4441 tt = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_is_isolated()