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,
163 * @bat_priv: the bat priv with all the soft interface information
171 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
177 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr,
188 * @bat_priv: the bat priv with all the soft interface information
196 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
202 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr,
290 * @bat_priv: the bat priv with all the soft interface information
297 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
303 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
316 * @bat_priv: the bat priv with all the soft interface information
320 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv,
325 vlan = batadv_softif_vlan_get(bat_priv, vid);
337 * @bat_priv: the bat priv with all the soft interface information
340 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv,
343 batadv_tt_local_size_mod(bat_priv, vid, 1);
349 * @bat_priv: the bat priv with all the soft interface information
352 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv,
355 batadv_tt_local_size_mod(bat_priv, vid, -1);
455 * @bat_priv: the bat priv with all the soft interface information
459 static void batadv_tt_local_event(struct batadv_priv *bat_priv,
482 spin_lock_bh(&bat_priv->tt.changes_list_lock);
483 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
517 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list);
520 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
523 atomic_dec(&bat_priv->tt.local_changes);
525 atomic_inc(&bat_priv->tt.local_changes);
553 * @bat_priv: the bat priv with all the soft interface information
557 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv)
565 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
580 static int batadv_tt_local_init(struct batadv_priv *bat_priv)
582 if (bat_priv->tt.local_hash)
585 bat_priv->tt.local_hash = batadv_hash_new(1024);
587 if (!bat_priv->tt.local_hash)
590 batadv_hash_set_lock_class(bat_priv->tt.local_hash,
596 static void batadv_tt_global_free(struct batadv_priv *bat_priv,
603 batadv_dbg(BATADV_DBG_TT, bat_priv,
608 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash,
638 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
659 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid);
662 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid);
667 batadv_dbg(BATADV_DBG_TT, bat_priv,
680 batadv_dbg(BATADV_DBG_TT, bat_priv,
695 table_size = batadv_tt_local_table_transmit_size(bat_priv);
697 packet_size_max = atomic_read(&bat_priv->packet_size_max);
710 vlan = batadv_softif_vlan_get(bat_priv, vid);
720 batadv_dbg(BATADV_DBG_TT, bat_priv,
723 (u8)atomic_read(&bat_priv->tt.vn));
747 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt,
758 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
769 batadv_send_roam_adv(bat_priv, tt_global->common.addr,
775 batadv_tt_global_free(bat_priv, tt_global,
800 match_mark = (mark & bat_priv->isolation_mark_mask);
801 if (bat_priv->isolation_mark_mask &&
802 match_mark == bat_priv->isolation_mark)
811 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
899 * @bat_priv: the bat priv with all the soft interface information
915 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
929 spin_lock_bh(&bat_priv->softif_vlan_list_lock);
930 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) {
956 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn);
960 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) {
976 spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
983 * @bat_priv: the bat priv with all the soft interface information
985 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)
995 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes);
1001 if (tt_diff_len > bat_priv->soft_iface->mtu)
1004 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data,
1014 spin_lock_bh(&bat_priv->tt.changes_list_lock);
1015 atomic_set(&bat_priv->tt.local_changes, 0);
1017 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
1028 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
1031 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
1032 kfree(bat_priv->tt.last_changeset);
1033 bat_priv->tt.last_changeset_len = 0;
1034 bat_priv->tt.last_changeset = NULL;
1041 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC);
1042 if (bat_priv->tt.last_changeset) {
1043 memcpy(bat_priv->tt.last_changeset,
1045 bat_priv->tt.last_changeset_len = tt_diff_len;
1048 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
1051 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data,
1061 * @bat_priv: The bat priv with all the soft interface information
1069 struct batadv_priv *bat_priv,
1081 vlan = batadv_softif_vlan_get(bat_priv, common->vid);
1120 * @bat_priv: The bat priv with all the soft interface information
1130 struct batadv_priv *bat_priv,
1144 if (batadv_tt_local_dump_entry(msg, portid, cb, bat_priv,
1168 struct batadv_priv *bat_priv;
1187 bat_priv = netdev_priv(soft_iface);
1189 primary_if = batadv_primary_if_get_selected(bat_priv);
1195 hash = bat_priv->tt.local_hash;
1198 if (batadv_tt_local_dump_bucket(msg, portid, cb, bat_priv,
1218 batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
1222 batadv_tt_local_event(bat_priv, tt_local_entry, flags);
1230 batadv_dbg(BATADV_DBG_TT, bat_priv,
1238 * @bat_priv: the bat priv with all the soft interface information
1246 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
1255 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
1273 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags,
1280 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
1282 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash,
1303 * @bat_priv: the bat priv with all the soft interface information
1308 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv,
1331 batadv_tt_local_set_pending(bat_priv, tt_local_entry,
1338 * @bat_priv: the bat priv with all the soft interface information
1342 static void batadv_tt_local_purge(struct batadv_priv *bat_priv,
1345 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1355 batadv_tt_local_purge_list(bat_priv, head, timeout);
1360 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
1370 if (!bat_priv->tt.local_hash)
1373 hash = bat_priv->tt.local_hash;
1394 bat_priv->tt.local_hash = NULL;
1397 static int batadv_tt_global_init(struct batadv_priv *bat_priv)
1399 if (bat_priv->tt.global_hash)
1402 bat_priv->tt.global_hash = batadv_hash_new(1024);
1404 if (!bat_priv->tt.global_hash)
1407 batadv_hash_set_lock_class(bat_priv->tt.global_hash,
1413 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv)
1417 spin_lock_bh(&bat_priv->tt.changes_list_lock);
1419 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
1425 atomic_set(&bat_priv->tt.local_changes, 0);
1426 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
1573 * @bat_priv: the bat priv with all the soft interface information
1590 static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
1603 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid))
1606 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid);
1607 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid);
1645 hash_added = batadv_hash_add(bat_priv->tt.global_hash,
1713 batadv_dbg(BATADV_DBG_TT, bat_priv,
1727 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid,
1746 * @bat_priv: the bat priv with all the soft interface information
1753 batadv_transtable_best_orig(struct batadv_priv *bat_priv,
1757 struct batadv_algo_ops *bao = bat_priv->algo_ops;
1853 * @bat_priv: The bat priv with all the soft interface information
1863 struct batadv_priv *bat_priv,
1873 best_entry = batadv_transtable_best_orig(bat_priv, global);
1898 * @bat_priv: The bat priv with all the soft interface information
1907 struct batadv_priv *bat_priv,
1918 if (batadv_tt_global_dump_entry(msg, portid, seq, bat_priv,
1943 struct batadv_priv *bat_priv;
1964 bat_priv = netdev_priv(soft_iface);
1966 primary_if = batadv_primary_if_get_selected(bat_priv);
1972 hash = bat_priv->tt.global_hash;
1978 cb->nlh->nlmsg_seq, bat_priv,
2042 * @bat_priv: the bat priv with all the soft interface information
2051 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv,
2066 batadv_dbg(BATADV_DBG_TT, bat_priv,
2083 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
2114 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
2121 * @bat_priv: the bat priv with all the soft interface information
2129 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
2137 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
2142 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
2146 batadv_tt_global_free(bat_priv, tt_global_entry,
2165 local_entry = batadv_tt_local_hash_find(bat_priv,
2171 batadv_tt_global_free(bat_priv, tt_global_entry, message);
2174 batadv_tt_global_del_roaming(bat_priv, tt_global_entry,
2186 * @bat_priv: the bat priv with all the soft interface information
2192 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
2200 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2224 batadv_tt_global_del_orig_node(bat_priv, tt_global,
2229 batadv_dbg(BATADV_DBG_TT, bat_priv,
2264 static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
2266 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2289 batadv_dbg(BATADV_DBG_TT, bat_priv,
2303 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
2313 if (!bat_priv->tt.global_hash)
2316 hash = bat_priv->tt.global_hash;
2336 bat_priv->tt.global_hash = NULL;
2357 * @bat_priv: the bat priv with all the soft interface information
2369 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
2379 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) {
2380 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid);
2386 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
2398 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry);
2416 * @bat_priv: the bat priv with all the soft interface information
2437 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv,
2441 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2510 * @bat_priv: the bat priv with all the soft interface information
2518 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
2521 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
2591 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
2596 spin_lock_bh(&bat_priv->tt.req_list_lock);
2598 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
2603 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2606 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv,
2627 static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
2632 spin_lock_bh(&bat_priv->tt.req_list_lock);
2633 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
2640 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2645 * @bat_priv: the bat priv with all the soft interface information
2652 batadv_tt_req_node_new(struct batadv_priv *bat_priv,
2657 spin_lock_bh(&bat_priv->tt.req_list_lock);
2658 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) {
2674 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list);
2676 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2741 * @bat_priv: the bat priv with all the soft interface information
2751 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
2824 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv,
2858 * @bat_priv: the bat priv with all the soft interface information
2860 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv)
2866 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
2867 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid);
2874 * @bat_priv: the bat priv with all the soft interface information
2877 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv,
2889 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig,
2893 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid);
2901 * @bat_priv: the bat priv with all the soft interface information
2911 static bool batadv_send_tt_request(struct batadv_priv *bat_priv,
2924 primary_if = batadv_primary_if_get_selected(bat_priv);
2931 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node);
2959 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n",
2962 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX);
2963 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
2972 spin_lock_bh(&bat_priv->tt.req_list_lock);
2977 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2989 * @bat_priv: the bat priv with all the soft interface information
2996 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv,
3010 batadv_dbg(BATADV_DBG_TT, bat_priv,
3016 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst);
3020 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src);
3072 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash,
3080 if (tt_len > atomic_read(&bat_priv->packet_size_max)) {
3081 net_ratelimited_function(batadv_info, bat_priv->soft_iface,
3093 batadv_dbg(BATADV_DBG_TT, bat_priv,
3098 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
3100 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig,
3120 * @bat_priv: the bat priv with all the soft interface information
3126 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
3139 batadv_dbg(BATADV_DBG_TT, bat_priv,
3144 spin_lock_bh(&bat_priv->tt.commit_lock);
3146 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
3149 orig_node = batadv_orig_hash_find(bat_priv, req_src);
3153 primary_if = batadv_primary_if_get_selected(bat_priv);
3161 !bat_priv->tt.last_changeset)
3170 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
3172 tt_len = bat_priv->tt.last_changeset_len;
3173 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,
3181 memcpy(tt_change, bat_priv->tt.last_changeset,
3182 bat_priv->tt.last_changeset_len);
3183 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3185 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
3191 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,
3199 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash,
3210 batadv_dbg(BATADV_DBG_TT, bat_priv,
3214 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
3216 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3223 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3225 spin_unlock_bh(&bat_priv->tt.commit_lock);
3235 * @bat_priv: the bat priv with all the soft interface information
3242 static bool batadv_send_tt_response(struct batadv_priv *bat_priv,
3246 if (batadv_is_my_mac(bat_priv, req_dst))
3247 return batadv_send_my_tt_response(bat_priv, tt_data, req_src);
3248 return batadv_send_other_tt_response(bat_priv, tt_data, req_src,
3252 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv,
3263 batadv_tt_global_del(bat_priv, orig_node,
3269 if (!batadv_tt_global_add(bat_priv, orig_node,
3285 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv,
3292 orig_node = batadv_orig_hash_find(bat_priv, resp_src);
3297 batadv_tt_global_del_orig(bat_priv, orig_node, -1,
3300 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries,
3315 static void batadv_tt_update_changes(struct batadv_priv *bat_priv,
3320 _batadv_tt_update_changes(bat_priv, orig_node, tt_change,
3323 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change,
3330 * @bat_priv: the bat priv with all the soft interface information
3336 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
3342 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
3359 * @bat_priv: the bat priv with all the soft interface information
3364 static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
3375 batadv_dbg(BATADV_DBG_TT, bat_priv,
3380 orig_node = batadv_orig_hash_find(bat_priv, resp_src);
3393 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn,
3396 batadv_tt_update_changes(bat_priv, orig_node, num_entries,
3401 batadv_tt_global_update_crc(bat_priv, orig_node);
3406 spin_lock_bh(&bat_priv->tt.req_list_lock);
3407 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
3414 spin_unlock_bh(&bat_priv->tt.req_list_lock);
3419 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv)
3423 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3425 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) {
3430 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3433 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv)
3437 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3438 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) {
3446 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3451 * @bat_priv: the bat priv with all the soft interface information
3460 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
3465 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3469 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) {
3495 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list);
3500 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3506 * @bat_priv: the bat priv with all the soft interface information
3516 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
3523 primary_if = batadv_primary_if_get_selected(bat_priv);
3530 if (!batadv_tt_check_roam_count(bat_priv, client))
3533 batadv_dbg(BATADV_DBG_TT, bat_priv,
3537 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX);
3542 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3554 struct batadv_priv *bat_priv;
3558 bat_priv = container_of(priv_tt, struct batadv_priv, tt);
3560 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT);
3561 batadv_tt_global_purge(bat_priv);
3562 batadv_tt_req_purge(bat_priv);
3563 batadv_tt_roam_purge(bat_priv);
3565 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
3571 * @bat_priv: the bat priv with all the soft interface information
3573 void batadv_tt_free(struct batadv_priv *bat_priv)
3575 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_ROAM, 1);
3577 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1);
3578 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1);
3580 cancel_delayed_work_sync(&bat_priv->tt.work);
3582 batadv_tt_local_table_free(bat_priv);
3583 batadv_tt_global_table_free(bat_priv);
3584 batadv_tt_req_list_free(bat_priv);
3585 batadv_tt_changes_list_free(bat_priv);
3586 batadv_tt_roam_list_free(bat_priv);
3588 kfree(bat_priv->tt.last_changeset);
3594 * @bat_priv: the bat priv with all the soft interface information
3599 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags,
3602 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3629 batadv_tt_local_size_inc(bat_priv,
3637 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
3639 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3660 batadv_dbg(BATADV_DBG_TT, bat_priv,
3665 batadv_tt_local_size_dec(bat_priv, tt_common->vid);
3680 * @bat_priv: the bat priv with all the soft interface information
3684 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv)
3686 lockdep_assert_held(&bat_priv->tt.commit_lock);
3688 if (atomic_read(&bat_priv->tt.local_changes) < 1) {
3689 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt))
3690 batadv_tt_tvlv_container_update(bat_priv);
3694 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true);
3696 batadv_tt_local_purge_pending_clients(bat_priv);
3697 batadv_tt_local_update_crc(bat_priv);
3700 atomic_inc(&bat_priv->tt.vn);
3701 batadv_dbg(BATADV_DBG_TT, bat_priv,
3703 (u8)atomic_read(&bat_priv->tt.vn));
3706 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX);
3707 batadv_tt_tvlv_container_update(bat_priv);
3713 * @bat_priv: the bat priv with all the soft interface information
3715 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv)
3717 spin_lock_bh(&bat_priv->tt.commit_lock);
3718 batadv_tt_local_commit_changes_nolock(bat_priv);
3719 spin_unlock_bh(&bat_priv->tt.commit_lock);
3724 * @bat_priv: the bat priv with all the soft interface information
3731 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
3739 vlan = batadv_softif_vlan_get(bat_priv, vid);
3746 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid);
3750 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid);
3768 * @bat_priv: the bat priv with all the soft interface information
3776 static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
3807 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,
3814 batadv_tt_global_update_crc(bat_priv, orig_node);
3838 batadv_dbg(BATADV_DBG_TT, bat_priv,
3842 batadv_send_tt_request(bat_priv, orig_node, ttvn,
3852 * @bat_priv: the bat priv with all the soft interface information
3860 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
3866 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
3878 * @bat_priv: the bat priv with all the soft interface information
3886 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
3892 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
3904 * @bat_priv: the bat priv with all the soft interface information
3911 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
3922 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid,
3927 batadv_dbg(BATADV_DBG_TT, bat_priv,
3944 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
3945 int packet_size_max = atomic_read(&bat_priv->packet_size_max);
3949 spin_lock_bh(&bat_priv->tt.commit_lock);
3952 table_size = batadv_tt_local_table_transmit_size(bat_priv);
3956 batadv_tt_local_purge(bat_priv, timeout);
3957 batadv_tt_local_purge_pending_clients(bat_priv);
3970 batadv_tt_local_commit_changes_nolock(bat_priv);
3972 spin_unlock_bh(&bat_priv->tt.commit_lock);
3977 * @bat_priv: the bat priv with all the soft interface information
3983 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
4010 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change,
4017 * @bat_priv: the bat priv with all the soft interface information
4026 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
4053 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX);
4058 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst);
4065 batadv_dbg(BATADV_DBG_TT, bat_priv,
4073 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
4075 if (batadv_is_my_mac(bat_priv, dst)) {
4076 batadv_handle_tt_response(bat_priv, tt_data,
4086 batadv_dbg(BATADV_DBG_TT, bat_priv,
4099 * @bat_priv: the bat priv with all the soft interface information
4108 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
4120 if (!batadv_is_my_mac(bat_priv, dst))
4126 orig_node = batadv_orig_hash_find(bat_priv, src);
4130 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
4133 batadv_dbg(BATADV_DBG_TT, bat_priv,
4137 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client,
4148 * @bat_priv: the bat priv with all the soft interface information
4152 int batadv_tt_init(struct batadv_priv *bat_priv)
4159 ret = batadv_tt_local_init(bat_priv);
4163 ret = batadv_tt_global_init(bat_priv);
4165 batadv_tt_local_table_free(bat_priv);
4169 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1,
4173 batadv_tvlv_handler_register(bat_priv, NULL,
4177 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge);
4178 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
4186 * @bat_priv: the bat priv with all the soft interface information
4193 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
4199 tt = batadv_tt_global_hash_find(bat_priv, addr, vid);