Lines Matching refs:bat_priv
78 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
84 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
184 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_hash_find() argument
190 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr, in batadv_tt_local_hash_find()
209 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_global_hash_find() argument
215 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr, in batadv_tt_global_hash_find()
319 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, in batadv_tt_global_hash_count() argument
325 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_hash_count()
342 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv, in batadv_tt_local_size_mod() argument
347 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_size_mod()
362 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv, in batadv_tt_local_size_inc() argument
365 batadv_tt_local_size_mod(bat_priv, vid, 1); in batadv_tt_local_size_inc()
374 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, in batadv_tt_local_size_dec() argument
377 batadv_tt_local_size_mod(bat_priv, vid, -1); in batadv_tt_local_size_dec()
478 static void batadv_tt_local_event(struct batadv_priv *bat_priv, in batadv_tt_local_event() argument
501 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
502 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_local_event()
536 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list); in batadv_tt_local_event()
539 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
542 atomic_dec(&bat_priv->tt.local_changes); in batadv_tt_local_event()
544 atomic_inc(&bat_priv->tt.local_changes); in batadv_tt_local_event()
576 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) in batadv_tt_local_table_transmit_size() argument
584 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_table_transmit_size()
599 static int batadv_tt_local_init(struct batadv_priv *bat_priv) in batadv_tt_local_init() argument
601 if (bat_priv->tt.local_hash) in batadv_tt_local_init()
604 bat_priv->tt.local_hash = batadv_hash_new(1024); in batadv_tt_local_init()
606 if (!bat_priv->tt.local_hash) in batadv_tt_local_init()
609 batadv_hash_set_lock_class(bat_priv->tt.local_hash, in batadv_tt_local_init()
615 static void batadv_tt_global_free(struct batadv_priv *bat_priv, in batadv_tt_global_free() argument
619 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_free()
624 batadv_hash_remove(bat_priv->tt.global_hash, batadv_compare_tt, in batadv_tt_global_free()
645 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_add() local
666 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
669 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
674 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
687 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
702 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_add()
704 packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_add()
717 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_add()
727 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
730 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_add()
754 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt, in batadv_tt_local_add()
765 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
776 batadv_send_roam_adv(bat_priv, tt_global->common.addr, in batadv_tt_local_add()
782 batadv_tt_global_free(bat_priv, tt_global, in batadv_tt_local_add()
808 match_mark = (mark & bat_priv->isolation_mark_mask); in batadv_tt_local_add()
809 if (bat_priv->isolation_mark_mask && in batadv_tt_local_add()
810 match_mark == bat_priv->isolation_mark) in batadv_tt_local_add()
819 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
926 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, in batadv_tt_prepare_tvlv_local_data() argument
940 spin_lock_bh(&bat_priv->softif_vlan_list_lock); in batadv_tt_prepare_tvlv_local_data()
941 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
967 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn); in batadv_tt_prepare_tvlv_local_data()
971 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
986 spin_unlock_bh(&bat_priv->softif_vlan_list_lock); in batadv_tt_prepare_tvlv_local_data()
995 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv) in batadv_tt_tvlv_container_update() argument
1005 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes); in batadv_tt_tvlv_container_update()
1011 if (tt_diff_len > bat_priv->soft_iface->mtu) in batadv_tt_tvlv_container_update()
1014 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data, in batadv_tt_tvlv_container_update()
1024 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
1025 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_tvlv_container_update()
1027 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_tvlv_container_update()
1038 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_tvlv_container_update()
1041 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
1042 kfree(bat_priv->tt.last_changeset); in batadv_tt_tvlv_container_update()
1043 bat_priv->tt.last_changeset_len = 0; in batadv_tt_tvlv_container_update()
1044 bat_priv->tt.last_changeset = NULL; in batadv_tt_tvlv_container_update()
1051 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC); in batadv_tt_tvlv_container_update()
1052 if (bat_priv->tt.last_changeset) { in batadv_tt_tvlv_container_update()
1053 memcpy(bat_priv->tt.last_changeset, in batadv_tt_tvlv_container_update()
1055 bat_priv->tt.last_changeset_len = tt_diff_len; in batadv_tt_tvlv_container_update()
1058 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_tt_tvlv_container_update()
1061 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data, in batadv_tt_tvlv_container_update()
1078 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_local_seq_print_text() local
1079 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_seq_print_text()
1097 net_dev->name, (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_seq_print_text()
1156 struct batadv_priv *bat_priv, in batadv_tt_local_dump_entry() argument
1168 vlan = batadv_softif_vlan_get(bat_priv, common->vid); in batadv_tt_local_dump_entry()
1213 struct batadv_priv *bat_priv, in batadv_tt_local_dump_bucket() argument
1224 if (batadv_tt_local_dump_entry(msg, portid, seq, bat_priv, in batadv_tt_local_dump_bucket()
1248 struct batadv_priv *bat_priv; in batadv_tt_local_dump() local
1268 bat_priv = netdev_priv(soft_iface); in batadv_tt_local_dump()
1270 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_tt_local_dump()
1276 hash = bat_priv->tt.local_hash; in batadv_tt_local_dump()
1282 bat_priv, head, &idx)) in batadv_tt_local_dump()
1303 batadv_tt_local_set_pending(struct batadv_priv *bat_priv, in batadv_tt_local_set_pending() argument
1307 batadv_tt_local_event(bat_priv, tt_local_entry, flags); in batadv_tt_local_set_pending()
1315 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_set_pending()
1331 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_remove() argument
1339 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_remove()
1357 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, in batadv_tt_local_remove()
1364 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); in batadv_tt_local_remove()
1366 tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, in batadv_tt_local_remove()
1390 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, in batadv_tt_local_purge_list() argument
1413 batadv_tt_local_set_pending(bat_priv, tt_local_entry, in batadv_tt_local_purge_list()
1424 static void batadv_tt_local_purge(struct batadv_priv *bat_priv, in batadv_tt_local_purge() argument
1427 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge()
1437 batadv_tt_local_purge_list(bat_priv, head, timeout); in batadv_tt_local_purge()
1442 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) in batadv_tt_local_table_free() argument
1452 if (!bat_priv->tt.local_hash) in batadv_tt_local_table_free()
1455 hash = bat_priv->tt.local_hash; in batadv_tt_local_table_free()
1476 bat_priv->tt.local_hash = NULL; in batadv_tt_local_table_free()
1479 static int batadv_tt_global_init(struct batadv_priv *bat_priv) in batadv_tt_global_init() argument
1481 if (bat_priv->tt.global_hash) in batadv_tt_global_init()
1484 bat_priv->tt.global_hash = batadv_hash_new(1024); in batadv_tt_global_init()
1486 if (!bat_priv->tt.global_hash) in batadv_tt_global_init()
1489 batadv_hash_set_lock_class(bat_priv->tt.global_hash, in batadv_tt_global_init()
1495 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) in batadv_tt_changes_list_free() argument
1499 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1501 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_changes_list_free()
1507 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_changes_list_free()
1508 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1673 static bool batadv_tt_global_add(struct batadv_priv *bat_priv, in batadv_tt_global_add() argument
1686 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) in batadv_tt_global_add()
1689 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1690 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1728 hash_added = batadv_hash_add(bat_priv->tt.global_hash, in batadv_tt_global_add()
1796 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_add()
1810 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid, in batadv_tt_global_add()
1838 batadv_transtable_best_orig(struct batadv_priv *bat_priv, in batadv_transtable_best_orig() argument
1842 struct batadv_algo_ops *bao = bat_priv->algo_ops; in batadv_transtable_best_orig()
1885 batadv_tt_global_print_entry(struct batadv_priv *bat_priv, in batadv_tt_global_print_entry() argument
1899 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_tt_global_print_entry()
1969 struct batadv_priv *bat_priv = netdev_priv(net_dev); in batadv_tt_global_seq_print_text() local
1970 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_seq_print_text()
1996 batadv_tt_global_print_entry(bat_priv, tt_global, seq); in batadv_tt_global_seq_print_text()
2083 struct batadv_priv *bat_priv, in batadv_tt_global_dump_entry() argument
2093 best_entry = batadv_transtable_best_orig(bat_priv, global); in batadv_tt_global_dump_entry()
2127 struct batadv_priv *bat_priv, in batadv_tt_global_dump_bucket() argument
2138 if (batadv_tt_global_dump_entry(msg, portid, seq, bat_priv, in batadv_tt_global_dump_bucket()
2163 struct batadv_priv *bat_priv; in batadv_tt_global_dump() local
2184 bat_priv = netdev_priv(soft_iface); in batadv_tt_global_dump()
2186 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_tt_global_dump()
2192 hash = bat_priv->tt.global_hash; in batadv_tt_global_dump()
2198 cb->nlh->nlmsg_seq, bat_priv, in batadv_tt_global_dump()
2273 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig_node() argument
2288 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig_node()
2305 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_del_roaming() argument
2336 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del_roaming()
2351 static void batadv_tt_global_del(struct batadv_priv *bat_priv, in batadv_tt_global_del() argument
2359 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_del()
2364 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del()
2368 batadv_tt_global_free(bat_priv, tt_global_entry, in batadv_tt_global_del()
2387 local_entry = batadv_tt_local_hash_find(bat_priv, in batadv_tt_global_del()
2393 batadv_tt_global_free(bat_priv, tt_global_entry, message); in batadv_tt_global_del()
2396 batadv_tt_global_del_roaming(bat_priv, tt_global_entry, in batadv_tt_global_del()
2416 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig() argument
2424 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_del_orig()
2448 batadv_tt_global_del_orig_node(bat_priv, tt_global, in batadv_tt_global_del_orig()
2453 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig()
2488 static void batadv_tt_global_purge(struct batadv_priv *bat_priv) in batadv_tt_global_purge() argument
2490 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_purge()
2513 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_purge()
2527 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) in batadv_tt_global_table_free() argument
2537 if (!bat_priv->tt.global_hash) in batadv_tt_global_table_free()
2540 hash = bat_priv->tt.global_hash; in batadv_tt_global_table_free()
2560 bat_priv->tt.global_hash = NULL; in batadv_tt_global_table_free()
2593 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, in batadv_transtable_search() argument
2603 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { in batadv_transtable_search()
2604 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); in batadv_transtable_search()
2610 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_transtable_search()
2622 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_transtable_search()
2663 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv, in batadv_tt_global_crc() argument
2667 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_crc()
2744 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv, in batadv_tt_local_crc() argument
2747 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_crc()
2814 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) in batadv_tt_req_list_free() argument
2819 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2821 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_list_free()
2826 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2829 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, in batadv_tt_save_orig_buffer() argument
2850 static void batadv_tt_req_purge(struct batadv_priv *bat_priv) in batadv_tt_req_purge() argument
2855 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2856 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_purge()
2863 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2875 batadv_tt_req_node_new(struct batadv_priv *bat_priv, in batadv_tt_req_node_new() argument
2880 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2881 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) { in batadv_tt_req_node_new()
2897 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list); in batadv_tt_req_node_new()
2899 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2974 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, in batadv_tt_tvlv_generate() argument
3047 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, in batadv_tt_global_check_crc()
3083 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) in batadv_tt_local_update_crc() argument
3089 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_update_crc()
3090 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid); in batadv_tt_local_update_crc()
3100 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, in batadv_tt_global_update_crc() argument
3112 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, in batadv_tt_global_update_crc()
3116 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); in batadv_tt_global_update_crc()
3134 static bool batadv_send_tt_request(struct batadv_priv *bat_priv, in batadv_send_tt_request() argument
3147 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_tt_request()
3154 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node); in batadv_send_tt_request()
3182 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n", in batadv_send_tt_request()
3185 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX); in batadv_send_tt_request()
3186 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_tt_request()
3196 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
3201 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
3221 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, in batadv_send_other_tt_response() argument
3235 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
3241 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst); in batadv_send_other_tt_response()
3245 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_other_tt_response()
3297 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash, in batadv_send_other_tt_response()
3305 if (tt_len > atomic_read(&bat_priv->packet_size_max)) { in batadv_send_other_tt_response()
3306 net_ratelimited_function(batadv_info, bat_priv->soft_iface, in batadv_send_other_tt_response()
3318 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
3323 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_other_tt_response()
3325 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig, in batadv_send_other_tt_response()
3353 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, in batadv_send_my_tt_response() argument
3366 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
3371 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
3373 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
3376 orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_my_tt_response()
3380 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_my_tt_response()
3388 !bat_priv->tt.last_changeset) in batadv_send_my_tt_response()
3397 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3399 tt_len = bat_priv->tt.last_changeset_len; in batadv_send_my_tt_response()
3400 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
3408 memcpy(tt_change, bat_priv->tt.last_changeset, in batadv_send_my_tt_response()
3409 bat_priv->tt.last_changeset_len); in batadv_send_my_tt_response()
3410 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3412 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
3418 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
3426 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash, in batadv_send_my_tt_response()
3437 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
3441 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_my_tt_response()
3443 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_my_tt_response()
3450 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3452 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
3471 static bool batadv_send_tt_response(struct batadv_priv *bat_priv, in batadv_send_tt_response() argument
3475 if (batadv_is_my_mac(bat_priv, req_dst)) in batadv_send_tt_response()
3476 return batadv_send_my_tt_response(bat_priv, tt_data, req_src); in batadv_send_tt_response()
3477 return batadv_send_other_tt_response(bat_priv, tt_data, req_src, in batadv_send_tt_response()
3481 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, in _batadv_tt_update_changes() argument
3492 batadv_tt_global_del(bat_priv, orig_node, in _batadv_tt_update_changes()
3498 if (!batadv_tt_global_add(bat_priv, orig_node, in _batadv_tt_update_changes()
3514 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, in batadv_tt_fill_gtable() argument
3521 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_tt_fill_gtable()
3526 batadv_tt_global_del_orig(bat_priv, orig_node, -1, in batadv_tt_fill_gtable()
3529 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, in batadv_tt_fill_gtable()
3545 static void batadv_tt_update_changes(struct batadv_priv *bat_priv, in batadv_tt_update_changes() argument
3550 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
3553 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
3566 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr, in batadv_is_my_client() argument
3572 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_is_my_client()
3595 static void batadv_handle_tt_response(struct batadv_priv *bat_priv, in batadv_handle_tt_response() argument
3606 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_handle_tt_response()
3611 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_handle_tt_response()
3624 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn, in batadv_handle_tt_response()
3627 batadv_tt_update_changes(bat_priv, orig_node, num_entries, in batadv_handle_tt_response()
3632 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_handle_tt_response()
3637 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3638 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_handle_tt_response()
3645 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3651 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) in batadv_tt_roam_list_free() argument
3655 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3657 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_list_free()
3662 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3665 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) in batadv_tt_roam_purge() argument
3669 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3670 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_purge()
3678 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3692 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client) in batadv_tt_check_roam_count() argument
3697 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3701 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) { in batadv_tt_check_roam_count()
3727 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); in batadv_tt_check_roam_count()
3732 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3748 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client, in batadv_send_roam_adv() argument
3755 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_roam_adv()
3762 if (!batadv_tt_check_roam_count(bat_priv, client)) in batadv_send_roam_adv()
3765 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_roam_adv()
3769 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); in batadv_send_roam_adv()
3774 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_roam_adv()
3787 struct batadv_priv *bat_priv; in batadv_tt_purge() local
3791 bat_priv = container_of(priv_tt, struct batadv_priv, tt); in batadv_tt_purge()
3793 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT); in batadv_tt_purge()
3794 batadv_tt_global_purge(bat_priv); in batadv_tt_purge()
3795 batadv_tt_req_purge(bat_priv); in batadv_tt_purge()
3796 batadv_tt_roam_purge(bat_priv); in batadv_tt_purge()
3798 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_purge()
3806 void batadv_tt_free(struct batadv_priv *bat_priv) in batadv_tt_free() argument
3808 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3809 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3811 cancel_delayed_work_sync(&bat_priv->tt.work); in batadv_tt_free()
3813 batadv_tt_local_table_free(bat_priv); in batadv_tt_free()
3814 batadv_tt_global_table_free(bat_priv); in batadv_tt_free()
3815 batadv_tt_req_list_free(bat_priv); in batadv_tt_free()
3816 batadv_tt_changes_list_free(bat_priv); in batadv_tt_free()
3817 batadv_tt_roam_list_free(bat_priv); in batadv_tt_free()
3819 kfree(bat_priv->tt.last_changeset); in batadv_tt_free()
3830 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags, in batadv_tt_local_set_flags() argument
3833 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_set_flags()
3860 batadv_tt_local_size_inc(bat_priv, in batadv_tt_local_set_flags()
3868 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) in batadv_tt_local_purge_pending_clients() argument
3870 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge_pending_clients()
3891 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_purge_pending_clients()
3896 batadv_tt_local_size_dec(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3915 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes_nolock() argument
3917 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes_nolock()
3919 if (atomic_read(&bat_priv->tt.local_changes) < 1) { in batadv_tt_local_commit_changes_nolock()
3920 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt)) in batadv_tt_local_commit_changes_nolock()
3921 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3925 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true); in batadv_tt_local_commit_changes_nolock()
3927 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_commit_changes_nolock()
3928 batadv_tt_local_update_crc(bat_priv); in batadv_tt_local_commit_changes_nolock()
3931 atomic_inc(&bat_priv->tt.vn); in batadv_tt_local_commit_changes_nolock()
3932 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_commit_changes_nolock()
3934 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_commit_changes_nolock()
3937 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX); in batadv_tt_local_commit_changes_nolock()
3938 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3946 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes() argument
3948 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3949 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_commit_changes()
3950 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3962 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, in batadv_is_ap_isolated() argument
3970 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_is_ap_isolated()
3977 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); in batadv_is_ap_isolated()
3981 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); in batadv_is_ap_isolated()
4007 static void batadv_tt_update_orig(struct batadv_priv *bat_priv, in batadv_tt_update_orig() argument
4038 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes, in batadv_tt_update_orig()
4045 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_tt_update_orig()
4069 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_update_orig()
4073 batadv_send_tt_request(bat_priv, orig_node, ttvn, in batadv_tt_update_orig()
4091 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_client_is_roaming() argument
4097 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_client_is_roaming()
4117 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_local_client_is_roaming() argument
4123 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_client_is_roaming()
4142 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, in batadv_tt_add_temporary_global_entry() argument
4153 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, in batadv_tt_add_temporary_global_entry()
4158 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_add_temporary_global_entry()
4175 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_resize_to_mtu() local
4176 int packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_resize_to_mtu()
4180 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
4183 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_resize_to_mtu()
4187 batadv_tt_local_purge(bat_priv, timeout); in batadv_tt_local_resize_to_mtu()
4188 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_resize_to_mtu()
4201 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_resize_to_mtu()
4203 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
4214 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_ogm_handler_v1() argument
4241 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change, in batadv_tt_tvlv_ogm_handler_v1()
4257 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_unicast_handler_v1() argument
4284 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); in batadv_tt_tvlv_unicast_handler_v1()
4289 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst); in batadv_tt_tvlv_unicast_handler_v1()
4296 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
4304 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); in batadv_tt_tvlv_unicast_handler_v1()
4306 if (batadv_is_my_mac(bat_priv, dst)) { in batadv_tt_tvlv_unicast_handler_v1()
4307 batadv_handle_tt_response(bat_priv, tt_data, in batadv_tt_tvlv_unicast_handler_v1()
4317 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
4339 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_roam_tvlv_unicast_handler_v1() argument
4351 if (!batadv_is_my_mac(bat_priv, dst)) in batadv_roam_tvlv_unicast_handler_v1()
4357 orig_node = batadv_orig_hash_find(bat_priv, src); in batadv_roam_tvlv_unicast_handler_v1()
4361 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); in batadv_roam_tvlv_unicast_handler_v1()
4364 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_roam_tvlv_unicast_handler_v1()
4368 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client, in batadv_roam_tvlv_unicast_handler_v1()
4384 int batadv_tt_init(struct batadv_priv *bat_priv) in batadv_tt_init() argument
4391 ret = batadv_tt_local_init(bat_priv); in batadv_tt_init()
4395 ret = batadv_tt_global_init(bat_priv); in batadv_tt_init()
4399 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, in batadv_tt_init()
4403 batadv_tvlv_handler_register(bat_priv, NULL, in batadv_tt_init()
4407 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); in batadv_tt_init()
4408 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_init()
4423 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, in batadv_tt_global_is_isolated() argument
4429 tt = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_is_isolated()