Lines Matching refs:bat_priv

65 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
71 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
171 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_hash_find() argument
177 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr, in batadv_tt_local_hash_find()
196 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_global_hash_find() argument
202 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr, in batadv_tt_global_hash_find()
305 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv, in batadv_tt_global_hash_count() argument
311 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_hash_count()
328 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv, in batadv_tt_local_size_mod() argument
333 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_size_mod()
348 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv, in batadv_tt_local_size_inc() argument
351 batadv_tt_local_size_mod(bat_priv, vid, 1); in batadv_tt_local_size_inc()
360 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv, in batadv_tt_local_size_dec() argument
363 batadv_tt_local_size_mod(bat_priv, vid, -1); in batadv_tt_local_size_dec()
464 static void batadv_tt_local_event(struct batadv_priv *bat_priv, in batadv_tt_local_event() argument
487 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
488 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_local_event()
522 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list); in batadv_tt_local_event()
525 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_local_event()
528 atomic_dec(&bat_priv->tt.local_changes); in batadv_tt_local_event()
530 atomic_inc(&bat_priv->tt.local_changes); in batadv_tt_local_event()
562 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv) in batadv_tt_local_table_transmit_size() argument
570 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_table_transmit_size()
585 static int batadv_tt_local_init(struct batadv_priv *bat_priv) in batadv_tt_local_init() argument
587 if (bat_priv->tt.local_hash) in batadv_tt_local_init()
590 bat_priv->tt.local_hash = batadv_hash_new(1024); in batadv_tt_local_init()
592 if (!bat_priv->tt.local_hash) in batadv_tt_local_init()
595 batadv_hash_set_lock_class(bat_priv->tt.local_hash, in batadv_tt_local_init()
601 static void batadv_tt_global_free(struct batadv_priv *bat_priv, in batadv_tt_global_free() argument
608 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_free()
613 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash, in batadv_tt_global_free()
643 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_add() local
664 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
667 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_local_add()
672 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
685 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
700 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_add()
702 packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_add()
715 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_tt_local_add()
725 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_add()
728 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_add()
752 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt, in batadv_tt_local_add()
763 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
774 batadv_send_roam_adv(bat_priv, tt_global->common.addr, in batadv_tt_local_add()
780 batadv_tt_global_free(bat_priv, tt_global, in batadv_tt_local_add()
806 match_mark = (mark & bat_priv->isolation_mark_mask); in batadv_tt_local_add()
807 if (bat_priv->isolation_mark_mask && in batadv_tt_local_add()
808 match_mark == bat_priv->isolation_mark) in batadv_tt_local_add()
817 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS); in batadv_tt_local_add()
925 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, in batadv_tt_prepare_tvlv_local_data() argument
939 spin_lock_bh(&bat_priv->softif_vlan_list_lock); in batadv_tt_prepare_tvlv_local_data()
940 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_prepare_tvlv_local_data()
966 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn); in batadv_tt_prepare_tvlv_local_data()
970 hlist_for_each_entry(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()
1079 struct batadv_priv *bat_priv, in batadv_tt_local_dump_entry() argument
1091 vlan = batadv_softif_vlan_get(bat_priv, common->vid); in batadv_tt_local_dump_entry()
1140 struct batadv_priv *bat_priv, in batadv_tt_local_dump_bucket() argument
1154 if (batadv_tt_local_dump_entry(msg, portid, cb, bat_priv, in batadv_tt_local_dump_bucket()
1178 struct batadv_priv *bat_priv; in batadv_tt_local_dump() local
1197 bat_priv = netdev_priv(soft_iface); in batadv_tt_local_dump()
1199 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_tt_local_dump()
1205 hash = bat_priv->tt.local_hash; in batadv_tt_local_dump()
1208 if (batadv_tt_local_dump_bucket(msg, portid, cb, bat_priv, in batadv_tt_local_dump()
1230 batadv_tt_local_set_pending(struct batadv_priv *bat_priv, in batadv_tt_local_set_pending() argument
1234 batadv_tt_local_event(bat_priv, tt_local_entry, flags); in batadv_tt_local_set_pending()
1242 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_set_pending()
1258 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, in batadv_tt_local_remove() argument
1267 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_remove()
1285 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags, in batadv_tt_local_remove()
1292 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); in batadv_tt_local_remove()
1294 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash, in batadv_tt_local_remove()
1321 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv, in batadv_tt_local_purge_list() argument
1344 batadv_tt_local_set_pending(bat_priv, tt_local_entry, in batadv_tt_local_purge_list()
1355 static void batadv_tt_local_purge(struct batadv_priv *bat_priv, in batadv_tt_local_purge() argument
1358 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge()
1368 batadv_tt_local_purge_list(bat_priv, head, timeout); in batadv_tt_local_purge()
1373 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) in batadv_tt_local_table_free() argument
1383 if (!bat_priv->tt.local_hash) in batadv_tt_local_table_free()
1386 hash = bat_priv->tt.local_hash; in batadv_tt_local_table_free()
1407 bat_priv->tt.local_hash = NULL; in batadv_tt_local_table_free()
1410 static int batadv_tt_global_init(struct batadv_priv *bat_priv) in batadv_tt_global_init() argument
1412 if (bat_priv->tt.global_hash) in batadv_tt_global_init()
1415 bat_priv->tt.global_hash = batadv_hash_new(1024); in batadv_tt_global_init()
1417 if (!bat_priv->tt.global_hash) in batadv_tt_global_init()
1420 batadv_hash_set_lock_class(bat_priv->tt.global_hash, in batadv_tt_global_init()
1426 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv) in batadv_tt_changes_list_free() argument
1430 spin_lock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1432 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list, in batadv_tt_changes_list_free()
1438 atomic_set(&bat_priv->tt.local_changes, 0); in batadv_tt_changes_list_free()
1439 spin_unlock_bh(&bat_priv->tt.changes_list_lock); in batadv_tt_changes_list_free()
1604 static bool batadv_tt_global_add(struct batadv_priv *bat_priv, in batadv_tt_global_add() argument
1617 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) in batadv_tt_global_add()
1620 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1621 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid); in batadv_tt_global_add()
1659 hash_added = batadv_hash_add(bat_priv->tt.global_hash, in batadv_tt_global_add()
1727 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_add()
1741 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid, in batadv_tt_global_add()
1769 batadv_transtable_best_orig(struct batadv_priv *bat_priv, in batadv_transtable_best_orig() argument
1773 struct batadv_algo_ops *bao = bat_priv->algo_ops; in batadv_transtable_best_orig()
1881 struct batadv_priv *bat_priv, in batadv_tt_global_dump_entry() argument
1891 best_entry = batadv_transtable_best_orig(bat_priv, global); in batadv_tt_global_dump_entry()
1925 struct batadv_priv *bat_priv, in batadv_tt_global_dump_bucket() argument
1936 if (batadv_tt_global_dump_entry(msg, portid, seq, bat_priv, in batadv_tt_global_dump_bucket()
1961 struct batadv_priv *bat_priv; in batadv_tt_global_dump() local
1982 bat_priv = netdev_priv(soft_iface); in batadv_tt_global_dump()
1984 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_tt_global_dump()
1990 hash = bat_priv->tt.global_hash; in batadv_tt_global_dump()
1996 cb->nlh->nlmsg_seq, bat_priv, in batadv_tt_global_dump()
2071 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig_node() argument
2086 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig_node()
2103 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_del_roaming() argument
2134 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del_roaming()
2149 static void batadv_tt_global_del(struct batadv_priv *bat_priv, in batadv_tt_global_del() argument
2157 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_del()
2162 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry, in batadv_tt_global_del()
2166 batadv_tt_global_free(bat_priv, tt_global_entry, in batadv_tt_global_del()
2185 local_entry = batadv_tt_local_hash_find(bat_priv, in batadv_tt_global_del()
2191 batadv_tt_global_free(bat_priv, tt_global_entry, message); in batadv_tt_global_del()
2194 batadv_tt_global_del_roaming(bat_priv, tt_global_entry, in batadv_tt_global_del()
2214 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv, in batadv_tt_global_del_orig() argument
2222 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_del_orig()
2246 batadv_tt_global_del_orig_node(bat_priv, tt_global, in batadv_tt_global_del_orig()
2251 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_del_orig()
2286 static void batadv_tt_global_purge(struct batadv_priv *bat_priv) in batadv_tt_global_purge() argument
2288 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_purge()
2311 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_global_purge()
2325 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv) in batadv_tt_global_table_free() argument
2335 if (!bat_priv->tt.global_hash) in batadv_tt_global_table_free()
2338 hash = bat_priv->tt.global_hash; in batadv_tt_global_table_free()
2358 bat_priv->tt.global_hash = NULL; in batadv_tt_global_table_free()
2391 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv, in batadv_transtable_search() argument
2401 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) { in batadv_transtable_search()
2402 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid); in batadv_transtable_search()
2408 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_transtable_search()
2420 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry); in batadv_transtable_search()
2461 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv, in batadv_tt_global_crc() argument
2465 struct batadv_hashtable *hash = bat_priv->tt.global_hash; in batadv_tt_global_crc()
2542 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv, in batadv_tt_local_crc() argument
2545 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_crc()
2612 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv) in batadv_tt_req_list_free() argument
2617 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2619 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_list_free()
2624 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_list_free()
2627 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv, in batadv_tt_save_orig_buffer() argument
2648 static void batadv_tt_req_purge(struct batadv_priv *bat_priv) in batadv_tt_req_purge() argument
2653 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2654 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_tt_req_purge()
2661 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_purge()
2673 batadv_tt_req_node_new(struct batadv_priv *bat_priv, in batadv_tt_req_node_new() argument
2678 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2679 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) { in batadv_tt_req_node_new()
2695 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list); in batadv_tt_req_node_new()
2697 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_tt_req_node_new()
2772 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, in batadv_tt_tvlv_generate() argument
2845 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv, in batadv_tt_global_check_crc()
2881 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv) in batadv_tt_local_update_crc() argument
2887 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { in batadv_tt_local_update_crc()
2888 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid); in batadv_tt_local_update_crc()
2898 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv, in batadv_tt_global_update_crc() argument
2910 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, in batadv_tt_global_update_crc()
2914 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid); in batadv_tt_global_update_crc()
2932 static bool batadv_send_tt_request(struct batadv_priv *bat_priv, in batadv_send_tt_request() argument
2945 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_tt_request()
2952 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node); in batadv_send_tt_request()
2980 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n", in batadv_send_tt_request()
2983 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX); in batadv_send_tt_request()
2984 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_tt_request()
2994 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
2999 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_send_tt_request()
3019 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv, in batadv_send_other_tt_response() argument
3033 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
3039 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst); in batadv_send_other_tt_response()
3043 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_other_tt_response()
3095 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash, in batadv_send_other_tt_response()
3103 if (tt_len > atomic_read(&bat_priv->packet_size_max)) { in batadv_send_other_tt_response()
3104 net_ratelimited_function(batadv_info, bat_priv->soft_iface, in batadv_send_other_tt_response()
3116 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_other_tt_response()
3121 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_other_tt_response()
3123 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig, in batadv_send_other_tt_response()
3151 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv, in batadv_send_my_tt_response() argument
3164 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
3169 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
3171 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
3174 orig_node = batadv_orig_hash_find(bat_priv, req_src); in batadv_send_my_tt_response()
3178 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_my_tt_response()
3186 !bat_priv->tt.last_changeset) in batadv_send_my_tt_response()
3195 spin_lock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3197 tt_len = bat_priv->tt.last_changeset_len; in batadv_send_my_tt_response()
3198 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
3206 memcpy(tt_change, bat_priv->tt.last_changeset, in batadv_send_my_tt_response()
3207 bat_priv->tt.last_changeset_len); in batadv_send_my_tt_response()
3208 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3210 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn); in batadv_send_my_tt_response()
3216 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, in batadv_send_my_tt_response()
3224 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash, in batadv_send_my_tt_response()
3235 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_my_tt_response()
3239 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX); in batadv_send_my_tt_response()
3241 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_my_tt_response()
3248 spin_unlock_bh(&bat_priv->tt.last_changeset_lock); in batadv_send_my_tt_response()
3250 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_send_my_tt_response()
3269 static bool batadv_send_tt_response(struct batadv_priv *bat_priv, in batadv_send_tt_response() argument
3273 if (batadv_is_my_mac(bat_priv, req_dst)) in batadv_send_tt_response()
3274 return batadv_send_my_tt_response(bat_priv, tt_data, req_src); in batadv_send_tt_response()
3275 return batadv_send_other_tt_response(bat_priv, tt_data, req_src, in batadv_send_tt_response()
3279 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv, in _batadv_tt_update_changes() argument
3290 batadv_tt_global_del(bat_priv, orig_node, in _batadv_tt_update_changes()
3296 if (!batadv_tt_global_add(bat_priv, orig_node, in _batadv_tt_update_changes()
3312 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv, in batadv_tt_fill_gtable() argument
3319 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_tt_fill_gtable()
3324 batadv_tt_global_del_orig(bat_priv, orig_node, -1, in batadv_tt_fill_gtable()
3327 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries, in batadv_tt_fill_gtable()
3343 static void batadv_tt_update_changes(struct batadv_priv *bat_priv, in batadv_tt_update_changes() argument
3348 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
3351 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change, in batadv_tt_update_changes()
3364 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr, in batadv_is_my_client() argument
3370 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_is_my_client()
3393 static void batadv_handle_tt_response(struct batadv_priv *bat_priv, in batadv_handle_tt_response() argument
3404 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_handle_tt_response()
3409 orig_node = batadv_orig_hash_find(bat_priv, resp_src); in batadv_handle_tt_response()
3422 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn, in batadv_handle_tt_response()
3425 batadv_tt_update_changes(bat_priv, orig_node, num_entries, in batadv_handle_tt_response()
3430 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_handle_tt_response()
3435 spin_lock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3436 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) { in batadv_handle_tt_response()
3443 spin_unlock_bh(&bat_priv->tt.req_list_lock); in batadv_handle_tt_response()
3449 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv) in batadv_tt_roam_list_free() argument
3453 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3455 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_list_free()
3460 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_list_free()
3463 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv) in batadv_tt_roam_purge() argument
3467 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3468 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) { in batadv_tt_roam_purge()
3476 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_roam_purge()
3490 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client) in batadv_tt_check_roam_count() argument
3495 spin_lock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3499 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) { in batadv_tt_check_roam_count()
3525 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list); in batadv_tt_check_roam_count()
3530 spin_unlock_bh(&bat_priv->tt.roam_list_lock); in batadv_tt_check_roam_count()
3546 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client, in batadv_send_roam_adv() argument
3553 primary_if = batadv_primary_if_get_selected(bat_priv); in batadv_send_roam_adv()
3560 if (!batadv_tt_check_roam_count(bat_priv, client)) in batadv_send_roam_adv()
3563 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_send_roam_adv()
3567 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX); in batadv_send_roam_adv()
3572 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr, in batadv_send_roam_adv()
3585 struct batadv_priv *bat_priv; in batadv_tt_purge() local
3589 bat_priv = container_of(priv_tt, struct batadv_priv, tt); in batadv_tt_purge()
3591 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT); in batadv_tt_purge()
3592 batadv_tt_global_purge(bat_priv); in batadv_tt_purge()
3593 batadv_tt_req_purge(bat_priv); in batadv_tt_purge()
3594 batadv_tt_roam_purge(bat_priv); in batadv_tt_purge()
3596 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_purge()
3604 void batadv_tt_free(struct batadv_priv *bat_priv) in batadv_tt_free() argument
3606 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_ROAM, 1); in batadv_tt_free()
3608 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3609 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); in batadv_tt_free()
3611 cancel_delayed_work_sync(&bat_priv->tt.work); in batadv_tt_free()
3613 batadv_tt_local_table_free(bat_priv); in batadv_tt_free()
3614 batadv_tt_global_table_free(bat_priv); in batadv_tt_free()
3615 batadv_tt_req_list_free(bat_priv); in batadv_tt_free()
3616 batadv_tt_changes_list_free(bat_priv); in batadv_tt_free()
3617 batadv_tt_roam_list_free(bat_priv); in batadv_tt_free()
3619 kfree(bat_priv->tt.last_changeset); in batadv_tt_free()
3630 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags, in batadv_tt_local_set_flags() argument
3633 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_set_flags()
3660 batadv_tt_local_size_inc(bat_priv, in batadv_tt_local_set_flags()
3668 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) in batadv_tt_local_purge_pending_clients() argument
3670 struct batadv_hashtable *hash = bat_priv->tt.local_hash; in batadv_tt_local_purge_pending_clients()
3691 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_purge_pending_clients()
3696 batadv_tt_local_size_dec(bat_priv, tt_common->vid); in batadv_tt_local_purge_pending_clients()
3715 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes_nolock() argument
3717 lockdep_assert_held(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes_nolock()
3719 if (atomic_read(&bat_priv->tt.local_changes) < 1) { in batadv_tt_local_commit_changes_nolock()
3720 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt)) in batadv_tt_local_commit_changes_nolock()
3721 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3725 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true); in batadv_tt_local_commit_changes_nolock()
3727 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_commit_changes_nolock()
3728 batadv_tt_local_update_crc(bat_priv); in batadv_tt_local_commit_changes_nolock()
3731 atomic_inc(&bat_priv->tt.vn); in batadv_tt_local_commit_changes_nolock()
3732 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_local_commit_changes_nolock()
3734 (u8)atomic_read(&bat_priv->tt.vn)); in batadv_tt_local_commit_changes_nolock()
3737 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX); in batadv_tt_local_commit_changes_nolock()
3738 batadv_tt_tvlv_container_update(bat_priv); in batadv_tt_local_commit_changes_nolock()
3746 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv) in batadv_tt_local_commit_changes() argument
3748 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3749 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_commit_changes()
3750 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_commit_changes()
3762 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst, in batadv_is_ap_isolated() argument
3770 vlan = batadv_softif_vlan_get(bat_priv, vid); in batadv_is_ap_isolated()
3777 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid); in batadv_is_ap_isolated()
3781 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid); in batadv_is_ap_isolated()
3807 static void batadv_tt_update_orig(struct batadv_priv *bat_priv, in batadv_tt_update_orig() argument
3838 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes, in batadv_tt_update_orig()
3845 batadv_tt_global_update_crc(bat_priv, orig_node); in batadv_tt_update_orig()
3869 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_update_orig()
3873 batadv_send_tt_request(bat_priv, orig_node, ttvn, in batadv_tt_update_orig()
3891 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_global_client_is_roaming() argument
3897 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_client_is_roaming()
3917 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv, in batadv_tt_local_client_is_roaming() argument
3923 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); in batadv_tt_local_client_is_roaming()
3942 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, in batadv_tt_add_temporary_global_entry() argument
3953 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid, in batadv_tt_add_temporary_global_entry()
3958 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_add_temporary_global_entry()
3975 struct batadv_priv *bat_priv = netdev_priv(soft_iface); in batadv_tt_local_resize_to_mtu() local
3976 int packet_size_max = atomic_read(&bat_priv->packet_size_max); in batadv_tt_local_resize_to_mtu()
3980 spin_lock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
3983 table_size = batadv_tt_local_table_transmit_size(bat_priv); in batadv_tt_local_resize_to_mtu()
3987 batadv_tt_local_purge(bat_priv, timeout); in batadv_tt_local_resize_to_mtu()
3988 batadv_tt_local_purge_pending_clients(bat_priv); in batadv_tt_local_resize_to_mtu()
4001 batadv_tt_local_commit_changes_nolock(bat_priv); in batadv_tt_local_resize_to_mtu()
4003 spin_unlock_bh(&bat_priv->tt.commit_lock); in batadv_tt_local_resize_to_mtu()
4014 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_ogm_handler_v1() argument
4041 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change, in batadv_tt_tvlv_ogm_handler_v1()
4057 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_tt_tvlv_unicast_handler_v1() argument
4084 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); in batadv_tt_tvlv_unicast_handler_v1()
4089 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst); in batadv_tt_tvlv_unicast_handler_v1()
4096 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
4104 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); in batadv_tt_tvlv_unicast_handler_v1()
4106 if (batadv_is_my_mac(bat_priv, dst)) { in batadv_tt_tvlv_unicast_handler_v1()
4107 batadv_handle_tt_response(bat_priv, tt_data, in batadv_tt_tvlv_unicast_handler_v1()
4117 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_tt_tvlv_unicast_handler_v1()
4139 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv, in batadv_roam_tvlv_unicast_handler_v1() argument
4151 if (!batadv_is_my_mac(bat_priv, dst)) in batadv_roam_tvlv_unicast_handler_v1()
4157 orig_node = batadv_orig_hash_find(bat_priv, src); in batadv_roam_tvlv_unicast_handler_v1()
4161 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); in batadv_roam_tvlv_unicast_handler_v1()
4164 batadv_dbg(BATADV_DBG_TT, bat_priv, in batadv_roam_tvlv_unicast_handler_v1()
4168 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client, in batadv_roam_tvlv_unicast_handler_v1()
4184 int batadv_tt_init(struct batadv_priv *bat_priv) in batadv_tt_init() argument
4191 ret = batadv_tt_local_init(bat_priv); in batadv_tt_init()
4195 ret = batadv_tt_global_init(bat_priv); in batadv_tt_init()
4199 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1, in batadv_tt_init()
4203 batadv_tvlv_handler_register(bat_priv, NULL, in batadv_tt_init()
4207 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); in batadv_tt_init()
4208 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, in batadv_tt_init()
4223 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv, in batadv_tt_global_is_isolated() argument
4229 tt = batadv_tt_global_hash_find(bat_priv, addr, vid); in batadv_tt_global_is_isolated()