Lines Matching defs: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,
262 * @bat_priv: the bat priv with all the soft interface information
269 int batadv_tt_global_hash_count(struct batadv_priv *bat_priv,
275 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
288 * @bat_priv: the bat priv with all the soft interface information
292 static void batadv_tt_local_size_mod(struct batadv_priv *bat_priv,
297 vlan = batadv_softif_vlan_get(bat_priv, vid);
309 * @bat_priv: the bat priv with all the soft interface information
312 static void batadv_tt_local_size_inc(struct batadv_priv *bat_priv,
315 batadv_tt_local_size_mod(bat_priv, vid, 1);
321 * @bat_priv: the bat priv with all the soft interface information
324 static void batadv_tt_local_size_dec(struct batadv_priv *bat_priv,
327 batadv_tt_local_size_mod(bat_priv, vid, -1);
414 * @bat_priv: the bat priv with all the soft interface information
418 static void batadv_tt_local_event(struct batadv_priv *bat_priv,
441 spin_lock_bh(&bat_priv->tt.changes_list_lock);
442 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
476 list_add_tail(&tt_change_node->list, &bat_priv->tt.changes_list);
479 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
482 atomic_dec(&bat_priv->tt.local_changes);
484 atomic_inc(&bat_priv->tt.local_changes);
512 * @bat_priv: the bat priv with all the soft interface information
516 static int batadv_tt_local_table_transmit_size(struct batadv_priv *bat_priv)
524 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
539 static int batadv_tt_local_init(struct batadv_priv *bat_priv)
541 if (bat_priv->tt.local_hash)
544 bat_priv->tt.local_hash = batadv_hash_new(1024);
546 if (!bat_priv->tt.local_hash)
549 batadv_hash_set_lock_class(bat_priv->tt.local_hash,
555 static void batadv_tt_global_free(struct batadv_priv *bat_priv,
562 batadv_dbg(BATADV_DBG_TT, bat_priv,
567 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash,
597 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
618 tt_local = batadv_tt_local_hash_find(bat_priv, addr, vid);
621 tt_global = batadv_tt_global_hash_find(bat_priv, addr, vid);
626 batadv_dbg(BATADV_DBG_TT, bat_priv,
639 batadv_dbg(BATADV_DBG_TT, bat_priv,
654 table_size = batadv_tt_local_table_transmit_size(bat_priv);
656 packet_size_max = atomic_read(&bat_priv->packet_size_max);
669 vlan = batadv_softif_vlan_get(bat_priv, vid);
679 batadv_dbg(BATADV_DBG_TT, bat_priv,
682 (u8)atomic_read(&bat_priv->tt.vn));
706 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt,
717 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
728 batadv_send_roam_adv(bat_priv, tt_global->common.addr,
734 batadv_tt_global_free(bat_priv, tt_global,
759 match_mark = (mark & bat_priv->isolation_mark_mask);
760 if (bat_priv->isolation_mark_mask &&
761 match_mark == bat_priv->isolation_mark)
770 batadv_tt_local_event(bat_priv, tt_local, BATADV_NO_FLAGS);
858 * @bat_priv: the bat priv with all the soft interface information
874 batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
888 spin_lock_bh(&bat_priv->softif_vlan_list_lock);
889 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) {
915 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn);
919 hlist_for_each_entry(vlan, &bat_priv->softif_vlan_list, list) {
935 spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
942 * @bat_priv: the bat priv with all the soft interface information
944 static void batadv_tt_tvlv_container_update(struct batadv_priv *bat_priv)
954 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes);
960 if (tt_diff_len > bat_priv->soft_iface->mtu)
963 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv, &tt_data,
973 spin_lock_bh(&bat_priv->tt.changes_list_lock);
974 atomic_set(&bat_priv->tt.local_changes, 0);
976 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
987 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
990 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
991 kfree(bat_priv->tt.last_changeset);
992 bat_priv->tt.last_changeset_len = 0;
993 bat_priv->tt.last_changeset = NULL;
1000 bat_priv->tt.last_changeset = kzalloc(tt_diff_len, GFP_ATOMIC);
1001 if (bat_priv->tt.last_changeset) {
1002 memcpy(bat_priv->tt.last_changeset,
1004 bat_priv->tt.last_changeset_len = tt_diff_len;
1007 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
1010 batadv_tvlv_container_register(bat_priv, BATADV_TVLV_TT, 1, tt_data,
1020 * @bat_priv: The bat priv with all the soft interface information
1028 struct batadv_priv *bat_priv,
1040 vlan = batadv_softif_vlan_get(bat_priv, common->vid);
1079 * @bat_priv: The bat priv with all the soft interface information
1089 struct batadv_priv *bat_priv,
1103 if (batadv_tt_local_dump_entry(msg, portid, cb, bat_priv,
1127 struct batadv_priv *bat_priv;
1146 bat_priv = netdev_priv(soft_iface);
1148 primary_if = batadv_primary_if_get_selected(bat_priv);
1154 hash = bat_priv->tt.local_hash;
1157 if (batadv_tt_local_dump_bucket(msg, portid, cb, bat_priv,
1177 batadv_tt_local_set_pending(struct batadv_priv *bat_priv,
1181 batadv_tt_local_event(bat_priv, tt_local_entry, flags);
1189 batadv_dbg(BATADV_DBG_TT, bat_priv,
1197 * @bat_priv: the bat priv with all the soft interface information
1205 u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
1214 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
1232 batadv_tt_local_set_pending(bat_priv, tt_local_entry, flags,
1239 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
1241 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash,
1262 * @bat_priv: the bat priv with all the soft interface information
1267 static void batadv_tt_local_purge_list(struct batadv_priv *bat_priv,
1290 batadv_tt_local_set_pending(bat_priv, tt_local_entry,
1297 * @bat_priv: the bat priv with all the soft interface information
1301 static void batadv_tt_local_purge(struct batadv_priv *bat_priv,
1304 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1314 batadv_tt_local_purge_list(bat_priv, head, timeout);
1319 static void batadv_tt_local_table_free(struct batadv_priv *bat_priv)
1329 if (!bat_priv->tt.local_hash)
1332 hash = bat_priv->tt.local_hash;
1353 bat_priv->tt.local_hash = NULL;
1356 static int batadv_tt_global_init(struct batadv_priv *bat_priv)
1358 if (bat_priv->tt.global_hash)
1361 bat_priv->tt.global_hash = batadv_hash_new(1024);
1363 if (!bat_priv->tt.global_hash)
1366 batadv_hash_set_lock_class(bat_priv->tt.global_hash,
1372 static void batadv_tt_changes_list_free(struct batadv_priv *bat_priv)
1376 spin_lock_bh(&bat_priv->tt.changes_list_lock);
1378 list_for_each_entry_safe(entry, safe, &bat_priv->tt.changes_list,
1384 atomic_set(&bat_priv->tt.local_changes, 0);
1385 spin_unlock_bh(&bat_priv->tt.changes_list_lock);
1532 * @bat_priv: the bat priv with all the soft interface information
1549 static bool batadv_tt_global_add(struct batadv_priv *bat_priv,
1562 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid))
1565 tt_global_entry = batadv_tt_global_hash_find(bat_priv, tt_addr, vid);
1566 tt_local_entry = batadv_tt_local_hash_find(bat_priv, tt_addr, vid);
1604 hash_added = batadv_hash_add(bat_priv->tt.global_hash,
1672 batadv_dbg(BATADV_DBG_TT, bat_priv,
1686 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, vid,
1705 * @bat_priv: the bat priv with all the soft interface information
1712 batadv_transtable_best_orig(struct batadv_priv *bat_priv,
1716 struct batadv_algo_ops *bao = bat_priv->algo_ops;
1812 * @bat_priv: The bat priv with all the soft interface information
1822 struct batadv_priv *bat_priv,
1832 best_entry = batadv_transtable_best_orig(bat_priv, global);
1857 * @bat_priv: The bat priv with all the soft interface information
1866 struct batadv_priv *bat_priv,
1877 if (batadv_tt_global_dump_entry(msg, portid, seq, bat_priv,
1902 struct batadv_priv *bat_priv;
1923 bat_priv = netdev_priv(soft_iface);
1925 primary_if = batadv_primary_if_get_selected(bat_priv);
1931 hash = bat_priv->tt.global_hash;
1937 cb->nlh->nlmsg_seq, bat_priv,
2001 * @bat_priv: the bat priv with all the soft interface information
2010 batadv_tt_global_del_orig_node(struct batadv_priv *bat_priv,
2025 batadv_dbg(BATADV_DBG_TT, bat_priv,
2042 batadv_tt_global_del_roaming(struct batadv_priv *bat_priv,
2073 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
2080 * @bat_priv: the bat priv with all the soft interface information
2088 static void batadv_tt_global_del(struct batadv_priv *bat_priv,
2096 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
2101 batadv_tt_global_del_orig_node(bat_priv, tt_global_entry,
2105 batadv_tt_global_free(bat_priv, tt_global_entry,
2124 local_entry = batadv_tt_local_hash_find(bat_priv,
2130 batadv_tt_global_free(bat_priv, tt_global_entry, message);
2133 batadv_tt_global_del_roaming(bat_priv, tt_global_entry,
2145 * @bat_priv: the bat priv with all the soft interface information
2151 void batadv_tt_global_del_orig(struct batadv_priv *bat_priv,
2159 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2183 batadv_tt_global_del_orig_node(bat_priv, tt_global,
2188 batadv_dbg(BATADV_DBG_TT, bat_priv,
2223 static void batadv_tt_global_purge(struct batadv_priv *bat_priv)
2225 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2248 batadv_dbg(BATADV_DBG_TT, bat_priv,
2262 static void batadv_tt_global_table_free(struct batadv_priv *bat_priv)
2272 if (!bat_priv->tt.global_hash)
2275 hash = bat_priv->tt.global_hash;
2295 bat_priv->tt.global_hash = NULL;
2316 * @bat_priv: the bat priv with all the soft interface information
2328 struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
2338 if (src && batadv_vlan_ap_isola_get(bat_priv, vid)) {
2339 tt_local_entry = batadv_tt_local_hash_find(bat_priv, src, vid);
2345 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
2357 best_entry = batadv_transtable_best_orig(bat_priv, tt_global_entry);
2375 * @bat_priv: the bat priv with all the soft interface information
2396 static u32 batadv_tt_global_crc(struct batadv_priv *bat_priv,
2400 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2469 * @bat_priv: the bat priv with all the soft interface information
2477 static u32 batadv_tt_local_crc(struct batadv_priv *bat_priv,
2480 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
2550 static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
2555 spin_lock_bh(&bat_priv->tt.req_list_lock);
2557 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
2562 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2565 static void batadv_tt_save_orig_buffer(struct batadv_priv *bat_priv,
2586 static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
2591 spin_lock_bh(&bat_priv->tt.req_list_lock);
2592 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
2599 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2604 * @bat_priv: the bat priv with all the soft interface information
2611 batadv_tt_req_node_new(struct batadv_priv *bat_priv,
2616 spin_lock_bh(&bat_priv->tt.req_list_lock);
2617 hlist_for_each_entry(tt_req_node_tmp, &bat_priv->tt.req_list, list) {
2633 hlist_add_head(&tt_req_node->list, &bat_priv->tt.req_list);
2635 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2700 * @bat_priv: the bat priv with all the soft interface information
2710 static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
2783 if (batadv_bla_is_backbone_gw_orig(orig_node->bat_priv,
2817 * @bat_priv: the bat priv with all the soft interface information
2819 static void batadv_tt_local_update_crc(struct batadv_priv *bat_priv)
2825 hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) {
2826 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid);
2833 * @bat_priv: the bat priv with all the soft interface information
2836 static void batadv_tt_global_update_crc(struct batadv_priv *bat_priv,
2848 if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig,
2852 crc = batadv_tt_global_crc(bat_priv, orig_node, vlan->vid);
2860 * @bat_priv: the bat priv with all the soft interface information
2870 static bool batadv_send_tt_request(struct batadv_priv *bat_priv,
2883 primary_if = batadv_primary_if_get_selected(bat_priv);
2890 tt_req_node = batadv_tt_req_node_new(bat_priv, dst_orig_node);
2918 batadv_dbg(BATADV_DBG_TT, bat_priv, "Sending TT_REQUEST to %pM [%c]\n",
2921 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_TX);
2922 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
2931 spin_lock_bh(&bat_priv->tt.req_list_lock);
2936 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2948 * @bat_priv: the bat priv with all the soft interface information
2955 static bool batadv_send_other_tt_response(struct batadv_priv *bat_priv,
2969 batadv_dbg(BATADV_DBG_TT, bat_priv,
2975 req_dst_orig_node = batadv_orig_hash_find(bat_priv, req_dst);
2979 res_dst_orig_node = batadv_orig_hash_find(bat_priv, req_src);
3031 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash,
3039 if (tt_len > atomic_read(&bat_priv->packet_size_max)) {
3040 net_ratelimited_function(batadv_info, bat_priv->soft_iface,
3052 batadv_dbg(BATADV_DBG_TT, bat_priv,
3057 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
3059 batadv_tvlv_unicast_send(bat_priv, req_dst_orig_node->orig,
3079 * @bat_priv: the bat priv with all the soft interface information
3085 static bool batadv_send_my_tt_response(struct batadv_priv *bat_priv,
3098 batadv_dbg(BATADV_DBG_TT, bat_priv,
3103 spin_lock_bh(&bat_priv->tt.commit_lock);
3105 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
3108 orig_node = batadv_orig_hash_find(bat_priv, req_src);
3112 primary_if = batadv_primary_if_get_selected(bat_priv);
3120 !bat_priv->tt.last_changeset)
3129 spin_lock_bh(&bat_priv->tt.last_changeset_lock);
3131 tt_len = bat_priv->tt.last_changeset_len;
3132 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,
3140 memcpy(tt_change, bat_priv->tt.last_changeset,
3141 bat_priv->tt.last_changeset_len);
3142 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3144 req_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
3150 tvlv_len = batadv_tt_prepare_tvlv_local_data(bat_priv,
3158 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash,
3169 batadv_dbg(BATADV_DBG_TT, bat_priv,
3173 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_TX);
3175 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3182 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3184 spin_unlock_bh(&bat_priv->tt.commit_lock);
3194 * @bat_priv: the bat priv with all the soft interface information
3201 static bool batadv_send_tt_response(struct batadv_priv *bat_priv,
3205 if (batadv_is_my_mac(bat_priv, req_dst))
3206 return batadv_send_my_tt_response(bat_priv, tt_data, req_src);
3207 return batadv_send_other_tt_response(bat_priv, tt_data, req_src,
3211 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv,
3222 batadv_tt_global_del(bat_priv, orig_node,
3228 if (!batadv_tt_global_add(bat_priv, orig_node,
3244 static void batadv_tt_fill_gtable(struct batadv_priv *bat_priv,
3251 orig_node = batadv_orig_hash_find(bat_priv, resp_src);
3256 batadv_tt_global_del_orig(bat_priv, orig_node, -1,
3259 _batadv_tt_update_changes(bat_priv, orig_node, tt_change, num_entries,
3274 static void batadv_tt_update_changes(struct batadv_priv *bat_priv,
3279 _batadv_tt_update_changes(bat_priv, orig_node, tt_change,
3282 batadv_tt_save_orig_buffer(bat_priv, orig_node, tt_change,
3289 * @bat_priv: the bat priv with all the soft interface information
3295 bool batadv_is_my_client(struct batadv_priv *bat_priv, const u8 *addr,
3301 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
3318 * @bat_priv: the bat priv with all the soft interface information
3323 static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
3334 batadv_dbg(BATADV_DBG_TT, bat_priv,
3339 orig_node = batadv_orig_hash_find(bat_priv, resp_src);
3352 batadv_tt_fill_gtable(bat_priv, tt_change, tt_data->ttvn,
3355 batadv_tt_update_changes(bat_priv, orig_node, num_entries,
3360 batadv_tt_global_update_crc(bat_priv, orig_node);
3365 spin_lock_bh(&bat_priv->tt.req_list_lock);
3366 hlist_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
3373 spin_unlock_bh(&bat_priv->tt.req_list_lock);
3378 static void batadv_tt_roam_list_free(struct batadv_priv *bat_priv)
3382 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3384 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) {
3389 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3392 static void batadv_tt_roam_purge(struct batadv_priv *bat_priv)
3396 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3397 list_for_each_entry_safe(node, safe, &bat_priv->tt.roam_list, list) {
3405 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3410 * @bat_priv: the bat priv with all the soft interface information
3419 static bool batadv_tt_check_roam_count(struct batadv_priv *bat_priv, u8 *client)
3424 spin_lock_bh(&bat_priv->tt.roam_list_lock);
3428 list_for_each_entry(tt_roam_node, &bat_priv->tt.roam_list, list) {
3454 list_add(&tt_roam_node->list, &bat_priv->tt.roam_list);
3459 spin_unlock_bh(&bat_priv->tt.roam_list_lock);
3465 * @bat_priv: the bat priv with all the soft interface information
3475 static void batadv_send_roam_adv(struct batadv_priv *bat_priv, u8 *client,
3482 primary_if = batadv_primary_if_get_selected(bat_priv);
3489 if (!batadv_tt_check_roam_count(bat_priv, client))
3492 batadv_dbg(BATADV_DBG_TT, bat_priv,
3496 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_TX);
3501 batadv_tvlv_unicast_send(bat_priv, primary_if->net_dev->dev_addr,
3513 struct batadv_priv *bat_priv;
3517 bat_priv = container_of(priv_tt, struct batadv_priv, tt);
3519 batadv_tt_local_purge(bat_priv, BATADV_TT_LOCAL_TIMEOUT);
3520 batadv_tt_global_purge(bat_priv);
3521 batadv_tt_req_purge(bat_priv);
3522 batadv_tt_roam_purge(bat_priv);
3524 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
3530 * @bat_priv: the bat priv with all the soft interface information
3532 void batadv_tt_free(struct batadv_priv *bat_priv)
3534 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_ROAM, 1);
3536 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1);
3537 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1);
3539 cancel_delayed_work_sync(&bat_priv->tt.work);
3541 batadv_tt_local_table_free(bat_priv);
3542 batadv_tt_global_table_free(bat_priv);
3543 batadv_tt_req_list_free(bat_priv);
3544 batadv_tt_changes_list_free(bat_priv);
3545 batadv_tt_roam_list_free(bat_priv);
3547 kfree(bat_priv->tt.last_changeset);
3553 * @bat_priv: the bat priv with all the soft interface information
3558 static void batadv_tt_local_set_flags(struct batadv_priv *bat_priv, u16 flags,
3561 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3588 batadv_tt_local_size_inc(bat_priv,
3596 static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv)
3598 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3619 batadv_dbg(BATADV_DBG_TT, bat_priv,
3624 batadv_tt_local_size_dec(bat_priv, tt_common->vid);
3639 * @bat_priv: the bat priv with all the soft interface information
3643 static void batadv_tt_local_commit_changes_nolock(struct batadv_priv *bat_priv)
3645 lockdep_assert_held(&bat_priv->tt.commit_lock);
3647 if (atomic_read(&bat_priv->tt.local_changes) < 1) {
3648 if (!batadv_atomic_dec_not_zero(&bat_priv->tt.ogm_append_cnt))
3649 batadv_tt_tvlv_container_update(bat_priv);
3653 batadv_tt_local_set_flags(bat_priv, BATADV_TT_CLIENT_NEW, false, true);
3655 batadv_tt_local_purge_pending_clients(bat_priv);
3656 batadv_tt_local_update_crc(bat_priv);
3659 atomic_inc(&bat_priv->tt.vn);
3660 batadv_dbg(BATADV_DBG_TT, bat_priv,
3662 (u8)atomic_read(&bat_priv->tt.vn));
3665 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX);
3666 batadv_tt_tvlv_container_update(bat_priv);
3672 * @bat_priv: the bat priv with all the soft interface information
3674 void batadv_tt_local_commit_changes(struct batadv_priv *bat_priv)
3676 spin_lock_bh(&bat_priv->tt.commit_lock);
3677 batadv_tt_local_commit_changes_nolock(bat_priv);
3678 spin_unlock_bh(&bat_priv->tt.commit_lock);
3683 * @bat_priv: the bat priv with all the soft interface information
3690 bool batadv_is_ap_isolated(struct batadv_priv *bat_priv, u8 *src, u8 *dst,
3698 vlan = batadv_softif_vlan_get(bat_priv, vid);
3705 tt_local_entry = batadv_tt_local_hash_find(bat_priv, dst, vid);
3709 tt_global_entry = batadv_tt_global_hash_find(bat_priv, src, vid);
3727 * @bat_priv: the bat priv with all the soft interface information
3735 static void batadv_tt_update_orig(struct batadv_priv *bat_priv,
3766 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,
3773 batadv_tt_global_update_crc(bat_priv, orig_node);
3797 batadv_dbg(BATADV_DBG_TT, bat_priv,
3801 batadv_send_tt_request(bat_priv, orig_node, ttvn,
3811 * @bat_priv: the bat priv with all the soft interface information
3819 bool batadv_tt_global_client_is_roaming(struct batadv_priv *bat_priv,
3825 tt_global_entry = batadv_tt_global_hash_find(bat_priv, addr, vid);
3837 * @bat_priv: the bat priv with all the soft interface information
3845 bool batadv_tt_local_client_is_roaming(struct batadv_priv *bat_priv,
3851 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
3863 * @bat_priv: the bat priv with all the soft interface information
3870 bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv,
3881 if (!batadv_tt_global_add(bat_priv, orig_node, addr, vid,
3886 batadv_dbg(BATADV_DBG_TT, bat_priv,
3903 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
3904 int packet_size_max = atomic_read(&bat_priv->packet_size_max);
3908 spin_lock_bh(&bat_priv->tt.commit_lock);
3911 table_size = batadv_tt_local_table_transmit_size(bat_priv);
3915 batadv_tt_local_purge(bat_priv, timeout);
3916 batadv_tt_local_purge_pending_clients(bat_priv);
3929 batadv_tt_local_commit_changes_nolock(bat_priv);
3931 spin_unlock_bh(&bat_priv->tt.commit_lock);
3936 * @bat_priv: the bat priv with all the soft interface information
3942 static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
3969 batadv_tt_update_orig(bat_priv, orig, tt_vlan, num_vlan, tt_change,
3976 * @bat_priv: the bat priv with all the soft interface information
3985 static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
4012 batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX);
4017 ret = batadv_send_tt_response(bat_priv, tt_data, src, dst);
4024 batadv_dbg(BATADV_DBG_TT, bat_priv,
4032 batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
4034 if (batadv_is_my_mac(bat_priv, dst)) {
4035 batadv_handle_tt_response(bat_priv, tt_data,
4045 batadv_dbg(BATADV_DBG_TT, bat_priv,
4058 * @bat_priv: the bat priv with all the soft interface information
4067 static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
4079 if (!batadv_is_my_mac(bat_priv, dst))
4085 orig_node = batadv_orig_hash_find(bat_priv, src);
4089 batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
4092 batadv_dbg(BATADV_DBG_TT, bat_priv,
4096 batadv_tt_global_add(bat_priv, orig_node, roaming_adv->client,
4107 * @bat_priv: the bat priv with all the soft interface information
4111 int batadv_tt_init(struct batadv_priv *bat_priv)
4118 ret = batadv_tt_local_init(bat_priv);
4122 ret = batadv_tt_global_init(bat_priv);
4124 batadv_tt_local_table_free(bat_priv);
4128 batadv_tvlv_handler_register(bat_priv, batadv_tt_tvlv_ogm_handler_v1,
4132 batadv_tvlv_handler_register(bat_priv, NULL,
4136 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge);
4137 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
4145 * @bat_priv: the bat priv with all the soft interface information
4152 bool batadv_tt_global_is_isolated(struct batadv_priv *bat_priv,
4158 tt = batadv_tt_global_hash_find(bat_priv, addr, vid);