Lines Matching refs:tt
98 * batadv_choose_tt() - return the index of the tt entry in the hash table
107 struct batadv_tt_common_entry *tt;
110 tt = (struct batadv_tt_common_entry *)data;
111 hash = jhash(&tt->addr, ETH_ALEN, hash);
112 hash = jhash(&tt->vid, sizeof(tt->vid), hash);
131 struct batadv_tt_common_entry to_search, *tt, *tt_tmp = NULL;
144 hlist_for_each_entry_rcu(tt, head, hash_entry) {
145 if (!batadv_compare_eth(tt, addr))
148 if (tt->vid != vid)
151 if (!kref_get_unless_zero(&tt->refcount))
154 tt_tmp = tt;
178 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr,
203 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr,
330 atomic_add(v, &vlan->tt.num_entries);
375 if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
425 * batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
427 * @ref: kref pointer of the tt orig entry
441 * batadv_tt_orig_list_entry_put() - decrement the tt orig entry refcounter and
443 * @orig_entry: tt orig entry to be free'd
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);
530 * batadv_tt_len() - compute length in bytes of given number of tt changes
531 * @changes_num: number of tt changes
568 tt_local_entries += atomic_read(&vlan->tt.num_entries);
572 /* header size of tvlv encapsulated tt response payload */
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,
605 "Deleting global tt entry %pM (vid: %d): %s\n",
609 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash,
701 "Local translation table size (%i) exceeds maximum packet size (%i); Ignoring new local tt entry: %pM\n",
722 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",
724 (u8)atomic_read(&bat_priv->tt.vn));
748 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt,
766 /* These node are probably going to update their tt table */
861 num_entries += atomic_read(&vlan->tt.num_entries);
887 tt_vlan->crc = htonl(vlan->tt.crc);
936 vlan_entries = atomic_read(&vlan->tt.num_entries);
961 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn);
966 vlan_entries = atomic_read(&vlan->tt.num_entries);
971 tt_vlan->crc = htonl(vlan->tt.crc);
987 * container after local tt changes have been committed
1000 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes);
1004 * and wait for the tt table request which will be fragmented
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);
1064 * batadv_tt_local_seq_print_text() - Print the local tt table in a seq file
1074 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1092 net_dev->name, (u8)atomic_read(&bat_priv->tt.vn));
1128 tt_local->vlan->tt.crc);
1145 * @common: tt local & tt global common data
1168 crc = vlan->tt.crc;
1278 hash = bat_priv->tt.local_hash;
1316 "Local tt entry (%pM, vid: %d) pending to be removed: %s\n",
1367 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash,
1388 * batadv_tt_local_purge_list() - purge inactive tt local entries
1390 * @head: pointer to the list containing the local tt entries
1391 * @timeout: parameter deciding whether a given tt local entry is considered
1423 * batadv_tt_local_purge() - purge inactive tt local entries
1425 * @timeout: parameter deciding whether a given tt local entry is considered
1431 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1456 if (!bat_priv->tt.local_hash)
1459 hash = bat_priv->tt.local_hash;
1480 bat_priv->tt.local_hash = NULL;
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,
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);
1665 * @ttvn: the tt version number ever announcing this non-mesh client
1732 hash_added = batadv_hash_add(bat_priv->tt.global_hash,
1801 "Creating new global tt entry: %pM (vid: %d, via %pM)\n",
1815 "global tt received",
1834 * batadv_transtable_best_orig() - Get best originator list entry from tt entry
1921 last_ttvn, vlan->tt.crc,
1953 last_ttvn, vlan->tt.crc,
1964 * batadv_tt_global_seq_print_text() - Print the global tt table in a seq file
1974 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2016 * @common: tt local & tt global common data
2039 crc = vlan->tt.crc;
2078 * @common: tt local & tt global common data
2123 * @head: Pointer to the list containing the global tt entries
2196 hash = bat_priv->tt.global_hash;
2267 * batadv_tt_global_del_orig_node() - remove orig_node from a global tt entry
2274 * global tt entry.
2293 "Deleting %pM from global tt entry %pM (vid: %d): %s\n",
2428 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2458 "Deleting global tt entry %pM (vid: %d): %s\n",
2494 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2518 "Deleting global tt entry %pM (vid: %d): %s\n",
2541 if (!bat_priv->tt.global_hash)
2544 hash = bat_priv->tt.global_hash;
2564 bat_priv->tt.global_hash = NULL;
2671 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2751 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
2797 * @ref: kref pointer of the tt req_node entry
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);
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);
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);
2911 * batadv_tt_local_valid() - verify local tt entry and get flags
2912 * @entry_ptr: to be checked local tt entry
2937 * batadv_tt_global_valid() - verify global tt entry and get flags
2938 * @entry_ptr: to be checked global tt entry
2969 * batadv_tt_tvlv_generate() - fill the tvlv buff with the tt entries from the
2970 * specified tt hash
2972 * @hash: hash table containing the tt entries
2973 * @tt_len: expected tvlv tt data buffer length in number of bytes
2975 * @valid_cb: function to filter tt change entries and to return TT flags
2978 * Fills the tvlv buff with the tt entries from the specified hash. If valid_cb
3064 crc = vlan->tt.crc;
3097 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid);
3124 vlan->tt.crc = crc;
3203 spin_lock_bh(&bat_priv->tt.req_list_lock);
3208 spin_unlock_bh(&bat_priv->tt.req_list_lock);
3219 * batadv_send_other_tt_response() - send reply to tt request concerning another
3222 * @tt_data: tt data containing the tt request information
3223 * @req_src: mac address of tt request sender
3224 * @req_dst: mac address of tt request recipient
3226 * Return: true if tt request reply was sent, false otherwise.
3304 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash,
3352 * batadv_send_my_tt_response() - send reply to tt request concerning this
3355 * @tt_data: tt data containing the tt request information
3356 * @req_src: mac address of tt request sender
3358 * Return: true if tt request reply was sent, false otherwise.
3378 spin_lock_bh(&bat_priv->tt.commit_lock);
3380 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
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;
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);
3433 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash,
3457 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3459 spin_unlock_bh(&bat_priv->tt.commit_lock);
3470 * batadv_send_tt_response() - send reply to tt request
3472 * @tt_data: tt data containing the tt request information
3473 * @req_src: mac address of tt request sender
3474 * @req_dst: mac address of tt request recipient
3476 * Return: true if tt request reply was sent, false otherwise.
3502 "tt removed by changes",
3596 * batadv_handle_tt_response() - process incoming tt reply
3598 * @tt_data: tt data containing the tt request information
3599 * @resp_src: mac address of tt reply sender
3600 * @num_entries: number of tt change entries appended to the tt data
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);
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);
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);
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);
3798 bat_priv = container_of(priv_tt, struct batadv_priv, tt);
3805 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
3820 cancel_delayed_work_sync(&bat_priv->tt.work);
3828 kfree(bat_priv->tt.last_changeset);
3842 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3876 /* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */
3879 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3901 "Deleting local tt entry (%pM, vid: %d): pending\n",
3918 * batadv_tt_local_commit_changes_nolock() - commit all pending local tt changes
3922 * Caller must hold tt->commit_lock.
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))
3940 atomic_inc(&bat_priv->tt.vn);
3943 (u8)atomic_read(&bat_priv->tt.vn));
3946 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX);
3951 * batadv_tt_local_commit_changes() - commit all pending local tt changes which
3957 spin_lock_bh(&bat_priv->tt.commit_lock);
3959 spin_unlock_bh(&bat_priv->tt.commit_lock);
4006 * batadv_tt_update_orig() - update global translation table with new tt
4013 * @tt_num_changes: number of tt changes inside the tt buffer
4038 * In this case send a tt request
4072 * in sync anymore -> request fresh tt data
4149 * Return: true when temporary tt entry could be added, false otherwise
4156 /* ignore loop detect macs, they are not supposed to be in the tt local
4189 spin_lock_bh(&bat_priv->tt.commit_lock);
4202 "Forced to purge local tt entries to fit new maximum fragment MTU (%i)\n",
4212 spin_unlock_bh(&bat_priv->tt.commit_lock);
4216 * batadv_tt_tvlv_ogm_handler_v1() - process incoming tt tvlv container
4255 * batadv_tt_tvlv_unicast_handler_v1() - process incoming (unicast) tt tvlv
4258 * @src: mac address of tt tvlv sender
4259 * @dst: mac address of tt tvlv recipient
4260 * @tvlv_value: tvlv buffer containing the tt data
4263 * Return: NET_RX_DROP if the tt tvlv is to be re-routed, NET_RX_SUCCESS
4337 * batadv_roam_tvlv_unicast_handler_v1() - process incoming tt roam tvlv
4340 * @src: mac address of tt tvlv sender
4341 * @dst: mac address of tt tvlv recipient
4342 * @tvlv_value: tvlv buffer containing the tt data
4345 * Return: NET_RX_DROP if the tt roam tvlv is to be re-routed, NET_RX_SUCCESS
4418 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge);
4419 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
4437 struct batadv_tt_global_entry *tt;
4440 tt = batadv_tt_global_hash_find(bat_priv, addr, vid);
4441 if (!tt)
4444 ret = tt->common.flags & BATADV_TT_CLIENT_ISOLA;
4446 batadv_tt_global_entry_put(tt);
4452 * batadv_tt_cache_init() - Initialize tt memory object cache
4521 * batadv_tt_cache_destroy() - Destroy tt memory object cache