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,
164 * @bat_priv: the bat priv with all the soft interface information
172 batadv_tt_local_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
178 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr,
189 * @bat_priv: the bat priv with all the soft interface information
197 batadv_tt_global_hash_find(struct batadv_priv *bat_priv, const u8 *addr,
203 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr,
291 * @bat_priv: the bat priv with all the soft interface information
298 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
304 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
317 * @bat_priv: the bat priv with all the soft interface information
321 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv,
326 vlan = batadv_softif_vlan_get(bat_priv, vid);
338 * @bat_priv: the bat priv with all the soft interface information
341 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv,
344 batadv_tt_local_size_mod(bat_priv, vid, 1);
350 * @bat_priv: the bat priv with all the soft interface information
353 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv,
356 batadv_tt_local_size_mod(bat_priv, vid, -1);
456 * @bat_priv: the bat priv with all the soft interface information
460 static void batadv_tt_local_event(struct batadv_priv *bat_priv,
483 spin_lock_bh(&bat_priv->tt.changes_list_lock);
484 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
518 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list);
521 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
524 atomic_dec(&bat_priv->tt.local_changes);
526 atomic_inc(&bat_priv->tt.local_changes);
554 * @bat_priv: the bat priv with all the soft interface information
558 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv)
566 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
581 static int batadv_tt_local_init(struct batadv_priv *bat_priv)
583 if (bat_priv->tt.local_hash)
586 bat_priv->tt.local_hash = batadv_hash_new(1024);
588 if (!bat_priv->tt.local_hash)
591 batadv_hash_set_lock_class(bat_priv->tt.local_hash,
597 static void batadv_tt_global_free(struct batadv_priv *bat_priv,
604 batadv_dbg(BATADV_DBG_TT, bat_priv,
609 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash,
639 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
660 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid);
663 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid);
668 batadv_dbg(BATADV_DBG_TT, bat_priv,
681 batadv_dbg(BATADV_DBG_TT, bat_priv,
696 table_size = batadv_tt_local_table_transmit_size(bat_priv);
698 packet_size_max = atomic_read(&bat_priv->packet_size_max);
711 vlan = batadv_softif_vlan_get(bat_priv, vid);
721 batadv_dbg(BATADV_DBG_TT, bat_priv,
724 (u8)atomic_read(&bat_priv->tt.vn));
748 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt,
759 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
770 batadv_send_roam_adv(bat_priv, tt_global->common.addr,
776 batadv_tt_global_free(bat_priv, tt_global,
801 match_mark = (mark & bat_priv->isolation_mark_mask);
802 if (bat_priv->isolation_mark_mask &&
803 match_mark == bat_priv->isolation_mark)
812 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
904 * @bat_priv: the bat priv with all the soft interface information
920 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
934 spin_lock_bh(&bat_priv->softif_vlan_list_lock);
935 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) {
961 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn);
965 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) {
981 spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
988 * @bat_priv: the bat priv with all the soft interface information
990 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)
1000 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes);
1006 if (tt_diff_len > bat_priv->soft_iface->mtu)
1009 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data,
1019 spin_lock_bh(&bat_priv->tt.changes_list_lock);
1020 atomic_set(&bat_priv->tt.local_changes, 0);
1022 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
1033 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
1036 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
1037 kfree(bat_priv->tt.last_changeset);
1038 bat_priv->tt.last_changeset_len = 0;
1039 bat_priv->tt.last_changeset = NULL;
1046 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC);
1047 if (bat_priv->tt.last_changeset) {
1048 memcpy(bat_priv->tt.last_changeset,
1050 bat_priv->tt.last_changeset_len = tt_diff_len;
1053 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
1056 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data,
1073 struct batadv_priv *bat_priv = netdev_priv(net_dev);
1074 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1092 net_dev->name, (u8)atomic_read(&bat_priv->tt.vn));
1144 * @bat_priv: The bat priv with all the soft interface information
1152 struct batadv_priv *bat_priv,
1164 vlan = batadv_softif_vlan_get(bat_priv, common->vid);
1203 * @bat_priv: The bat priv with all the soft interface information
1213 struct batadv_priv *bat_priv,
1227 if (batadv_tt_local_dump_entry(msg, portid, cb, bat_priv,
1251 struct batadv_priv *bat_priv;
1270 bat_priv = netdev_priv(soft_iface);
1272 primary_if = batadv_primary_if_get_selected(bat_priv);
1278 hash = bat_priv->tt.local_hash;
1281 if (batadv_tt_local_dump_bucket(msg, portid, cb, bat_priv,
1303 batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
1307 batadv_tt_local_event(bat_priv, tt_local_entry, flags);
1315 batadv_dbg(BATADV_DBG_TT, bat_priv,
1323 * @bat_priv: the bat priv with all the soft interface information
1331 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
1340 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
1358 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags,
1365 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
1367 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash,
1389 * @bat_priv: the bat priv with all the soft interface information
1394 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv,
1417 batadv_tt_local_set_pending(bat_priv, tt_local_entry,
1424 * @bat_priv: the bat priv with all the soft interface information
1428 static void batadv_tt_local_purge(struct batadv_priv *bat_priv,
1431 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1441 batadv_tt_local_purge_list(bat_priv, head, timeout);
1446 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
1456 if (!bat_priv->tt.local_hash)
1459 hash = bat_priv->tt.local_hash;
1480 bat_priv->tt.local_hash = NULL;
1483 static int batadv_tt_global_init(struct batadv_priv *bat_priv)
1485 if (bat_priv->tt.global_hash)
1488 bat_priv->tt.global_hash = batadv_hash_new(1024);
1490 if (!bat_priv->tt.global_hash)
1493 batadv_hash_set_lock_class(bat_priv->tt.global_hash,
1499 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv)
1503 spin_lock_bh(&bat_priv->tt.changes_list_lock);
1505 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
1511 atomic_set(&bat_priv->tt.local_changes, 0);
1512 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
1660 * @bat_priv: the bat priv with all the soft interface information
1677 static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
1690 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid))
1693 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid);
1694 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid);
1732 hash_added = batadv_hash_add(bat_priv->tt.global_hash,
1800 batadv_dbg(BATADV_DBG_TT, bat_priv,
1814 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid,
1835 * @bat_priv: the bat priv with all the soft interface information
1842 batadv_transtable_best_orig(struct batadv_priv *bat_priv,
1846 struct batadv_algo_ops *bao = bat_priv->algo_ops;
1882 * @bat_priv: the bat priv with all the soft interface information
1889 batadv_tt_global_print_entry(struct batadv_priv *bat_priv,
1903 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry);
1973 struct batadv_priv *bat_priv = netdev_priv(net_dev);
1974 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2000 batadv_tt_global_print_entry(bat_priv, tt_global, seq);
2077 * @bat_priv: The bat priv with all the soft interface information
2087 struct batadv_priv *bat_priv,
2097 best_entry = batadv_transtable_best_orig(bat_priv, global);
2122 * @bat_priv: The bat priv with all the soft interface information
2131 struct batadv_priv *bat_priv,
2142 if (batadv_tt_global_dump_entry(msg, portid, seq, bat_priv,
2167 struct batadv_priv *bat_priv;
2188 bat_priv = netdev_priv(soft_iface);
2190 primary_if = batadv_primary_if_get_selected(bat_priv);
2196 hash = bat_priv->tt.global_hash;
2202 cb->nlh->nlmsg_seq, bat_priv,
2268 * @bat_priv: the bat priv with all the soft interface information
2277 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv,
2292 batadv_dbg(BATADV_DBG_TT, bat_priv,
2309 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
2340 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
2347 * @bat_priv: the bat priv with all the soft interface information
2355 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
2363 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
2368 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
2372 batadv_tt_global_free(bat_priv, tt_global_entry,
2391 local_entry = batadv_tt_local_hash_find(bat_priv,
2397 batadv_tt_global_free(bat_priv, tt_global_entry, message);
2400 batadv_tt_global_del_roaming(bat_priv, tt_global_entry,
2414 * @bat_priv: the bat priv with all the soft interface information
2420 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
2428 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2452 batadv_tt_global_del_orig_node(bat_priv, tt_global,
2457 batadv_dbg(BATADV_DBG_TT, bat_priv,
2492 static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
2494 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2517 batadv_dbg(BATADV_DBG_TT, bat_priv,
2531 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
2541 if (!bat_priv->tt.global_hash)
2544 hash = bat_priv->tt.global_hash;
2564 bat_priv->tt.global_hash = NULL;
2585 * @bat_priv: the bat priv with all the soft interface information
2597 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
2607 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) {
2608 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid);
2614 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
2626 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry);
2646 * @bat_priv: the bat priv with all the soft interface information
2667 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv,
2671 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2740 * @bat_priv: the bat priv with all the soft interface information
2748 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
2751 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
2821 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
2826 spin_lock_bh(&bat_priv->tt.req_list_lock);
2828 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
2833 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2836 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv,
2857 static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
2862 spin_lock_bh(&bat_priv->tt.req_list_lock);
2863 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
2870 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2875 * @bat_priv: the bat priv with all the soft interface information
2882 batadv_tt_req_node_new(struct batadv_priv *bat_priv,
2887 spin_lock_bh(&bat_priv->tt.req_list_lock);
2888 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) {
2904 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list);
2906 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2971 * @bat_priv: the bat priv with all the soft interface information
2981 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
3054 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv,
3088 * @bat_priv: the bat priv with all the soft interface information
3090 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv)
3096 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
3097 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid);
3104 * @bat_priv: the bat priv with all the soft interface information
3107 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv,
3119 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig,
3123 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid);
3131 * @bat_priv: the bat priv with all the soft interface information
3141 static bool batadv_send_tt_request(struct batadv_priv *bat_priv,
3154 primary_if = batadv_primary_if_get_selected(bat_priv);
3161 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node);
3189 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n",
3192 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX);
3193 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3203 spin_lock_bh(&bat_priv->tt.req_list_lock);
3208 spin_unlock_bh(&bat_priv->tt.req_list_lock);
3221 * @bat_priv: the bat priv with all the soft interface information
3228 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv,
3242 batadv_dbg(BATADV_DBG_TT, bat_priv,
3248 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst);
3252 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src);
3304 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash,
3312 if (tt_len > atomic_read(&bat_priv->packet_size_max)) {
3313 net_ratelimited_function(batadv_info, bat_priv->soft_iface,
3325 batadv_dbg(BATADV_DBG_TT, bat_priv,
3330 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
3332 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig,
3354 * @bat_priv: the bat priv with all the soft interface information
3360 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
3373 batadv_dbg(BATADV_DBG_TT, bat_priv,
3378 spin_lock_bh(&bat_priv->tt.commit_lock);
3380 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
3383 orig_node = batadv_orig_hash_find(bat_priv, req_src);
3387 primary_if = batadv_primary_if_get_selected(bat_priv);
3395 !bat_priv->tt.last_changeset)
3404 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
3406 tt_len = bat_priv->tt.last_changeset_len;
3407 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,
3415 memcpy(tt_change, bat_priv->tt.last_changeset,
3416 bat_priv->tt.last_changeset_len);
3417 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3419 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
3425 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,
3433 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash,
3444 batadv_dbg(BATADV_DBG_TT, bat_priv,
3448 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
3450 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3457 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3459 spin_unlock_bh(&bat_priv->tt.commit_lock);
3471 * @bat_priv: the bat priv with all the soft interface information
3478 static bool batadv_send_tt_response(struct batadv_priv *bat_priv,
3482 if (batadv_is_my_mac(bat_priv, req_dst))
3483 return batadv_send_my_tt_response(bat_priv, tt_data, req_src);
3484 return batadv_send_other_tt_response(bat_priv, tt_data, req_src,
3488 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv,
3499 batadv_tt_global_del(bat_priv, orig_node,
3505 if (!batadv_tt_global_add(bat_priv, orig_node,
3521 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv,
3528 orig_node = batadv_orig_hash_find(bat_priv, resp_src);
3533 batadv_tt_global_del_orig(bat_priv, orig_node, -1,
3536 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries,
3552 static void batadv_tt_update_changes(struct batadv_priv *bat_priv,
3557 _batadv_tt_update_changes(bat_priv, orig_node, tt_change,
3560 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change,
3567 * @bat_priv: the bat priv with all the soft interface information
3573 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
3579 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
3597 * @bat_priv: the bat priv with all the soft interface information
3602 static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
3613 batadv_dbg(BATADV_DBG_TT, bat_priv,
3618 orig_node = batadv_orig_hash_find(bat_priv, resp_src);
3631 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn,
3634 batadv_tt_update_changes(bat_priv, orig_node, num_entries,
3639 batadv_tt_global_update_crc(bat_priv, orig_node);
3644 spin_lock_bh(&bat_priv->tt.req_list_lock);
3645 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
3652 spin_unlock_bh(&bat_priv->tt.req_list_lock);
3658 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv)
3662 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3664 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) {
3669 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3672 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv)
3676 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3677 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) {
3685 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3690 * @bat_priv: the bat priv with all the soft interface information
3699 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
3704 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3708 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) {
3734 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list);
3739 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3745 * @bat_priv: the bat priv with all the soft interface information
3755 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
3762 primary_if = batadv_primary_if_get_selected(bat_priv);
3769 if (!batadv_tt_check_roam_count(bat_priv, client))
3772 batadv_dbg(BATADV_DBG_TT, bat_priv,
3776 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX);
3781 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3794 struct batadv_priv *bat_priv;
3798 bat_priv = container_of(priv_tt, struct batadv_priv, tt);
3800 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT);
3801 batadv_tt_global_purge(bat_priv);
3802 batadv_tt_req_purge(bat_priv);
3803 batadv_tt_roam_purge(bat_priv);
3805 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
3811 * @bat_priv: the bat priv with all the soft interface information
3813 void batadv_tt_free(struct batadv_priv *bat_priv)
3815 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_ROAM, 1);
3817 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1);
3818 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1);
3820 cancel_delayed_work_sync(&bat_priv->tt.work);
3822 batadv_tt_local_table_free(bat_priv);
3823 batadv_tt_global_table_free(bat_priv);
3824 batadv_tt_req_list_free(bat_priv);
3825 batadv_tt_changes_list_free(bat_priv);
3826 batadv_tt_roam_list_free(bat_priv);
3828 kfree(bat_priv->tt.last_changeset);
3834 * @bat_priv: the bat priv with all the soft interface information
3839 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags,
3842 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3869 batadv_tt_local_size_inc(bat_priv,
3877 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
3879 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3900 batadv_dbg(BATADV_DBG_TT, bat_priv,
3905 batadv_tt_local_size_dec(bat_priv, tt_common->vid);
3920 * @bat_priv: the bat priv with all the soft interface information
3924 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv)
3926 lockdep_assert_held(&bat_priv->tt.commit_lock);
3928 if (atomic_read(&bat_priv->tt.local_changes) < 1) {
3929 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt))
3930 batadv_tt_tvlv_container_update(bat_priv);
3934 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true);
3936 batadv_tt_local_purge_pending_clients(bat_priv);
3937 batadv_tt_local_update_crc(bat_priv);
3940 atomic_inc(&bat_priv->tt.vn);
3941 batadv_dbg(BATADV_DBG_TT, bat_priv,
3943 (u8)atomic_read(&bat_priv->tt.vn));
3946 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX);
3947 batadv_tt_tvlv_container_update(bat_priv);
3953 * @bat_priv: the bat priv with all the soft interface information
3955 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv)
3957 spin_lock_bh(&bat_priv->tt.commit_lock);
3958 batadv_tt_local_commit_changes_nolock(bat_priv);
3959 spin_unlock_bh(&bat_priv->tt.commit_lock);
3964 * @bat_priv: the bat priv with all the soft interface information
3971 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
3979 vlan = batadv_softif_vlan_get(bat_priv, vid);
3986 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid);
3990 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid);
4008 * @bat_priv: the bat priv with all the soft interface information
4016 static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
4047 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,
4054 batadv_tt_global_update_crc(bat_priv, orig_node);
4078 batadv_dbg(BATADV_DBG_TT, bat_priv,
4082 batadv_send_tt_request(bat_priv, orig_node, ttvn,
4092 * @bat_priv: the bat priv with all the soft interface information
4100 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
4106 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
4118 * @bat_priv: the bat priv with all the soft interface information
4126 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
4132 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
4144 * @bat_priv: the bat priv with all the soft interface information
4151 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
4162 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid,
4167 batadv_dbg(BATADV_DBG_TT, bat_priv,
4184 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
4185 int packet_size_max = atomic_read(&bat_priv->packet_size_max);
4189 spin_lock_bh(&bat_priv->tt.commit_lock);
4192 table_size = batadv_tt_local_table_transmit_size(bat_priv);
4196 batadv_tt_local_purge(bat_priv, timeout);
4197 batadv_tt_local_purge_pending_clients(bat_priv);
4210 batadv_tt_local_commit_changes_nolock(bat_priv);
4212 spin_unlock_bh(&bat_priv->tt.commit_lock);
4217 * @bat_priv: the bat priv with all the soft interface information
4223 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
4250 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change,
4257 * @bat_priv: the bat priv with all the soft interface information
4266 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
4293 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX);
4298 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst);
4305 batadv_dbg(BATADV_DBG_TT, bat_priv,
4313 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
4315 if (batadv_is_my_mac(bat_priv, dst)) {
4316 batadv_handle_tt_response(bat_priv, tt_data,
4326 batadv_dbg(BATADV_DBG_TT, bat_priv,
4339 * @bat_priv: the bat priv with all the soft interface information
4348 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
4360 if (!batadv_is_my_mac(bat_priv, dst))
4366 orig_node = batadv_orig_hash_find(bat_priv, src);
4370 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
4373 batadv_dbg(BATADV_DBG_TT, bat_priv,
4377 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client,
4389 * @bat_priv: the bat priv with all the soft interface information
4393 int batadv_tt_init(struct batadv_priv *bat_priv)
4400 ret = batadv_tt_local_init(bat_priv);
4404 ret = batadv_tt_global_init(bat_priv);
4406 batadv_tt_local_table_free(bat_priv);
4410 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1,
4414 batadv_tvlv_handler_register(bat_priv, NULL,
4418 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge);
4419 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
4427 * @bat_priv: the bat priv with all the soft interface information
4434 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
4440 tt = batadv_tt_global_hash_find(bat_priv, addr, vid);