Lines Matching refs:tt

97  * batadv_choose_tt() - return the index of the tt entry in the hash table
106 const struct batadv_tt_common_entry *tt;
109 tt = data;
110 hash = jhash(&tt->addr, ETH_ALEN, hash);
111 hash = jhash(&tt->vid, sizeof(tt->vid), hash);
130 struct batadv_tt_common_entry to_search, *tt, *tt_tmp = NULL;
143 hlist_for_each_entry_rcu(tt, head, hash_entry) {
144 if (!batadv_compare_eth(tt, addr))
147 if (tt->vid != vid)
150 if (!kref_get_unless_zero(&tt->refcount))
153 tt_tmp = tt;
177 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.local_hash, addr,
202 tt_common_entry = batadv_tt_hash_find(bat_priv->tt.global_hash, addr,
329 atomic_add(v, &vlan->tt.num_entries);
374 if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
424 * batadv_tt_orig_list_entry_release() - release tt orig entry from lists and
426 * @ref: kref pointer of the tt orig entry
440 * batadv_tt_orig_list_entry_put() - decrement the tt orig entry refcounter and
442 * @orig_entry: tt orig entry to be free'd
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);
529 * batadv_tt_len() - compute length in bytes of given number of tt changes
530 * @changes_num: number of tt changes
567 tt_local_entries += atomic_read(&vlan->tt.num_entries);
571 /* header size of tvlv encapsulated tt response payload */
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,
604 "Deleting global tt entry %pM (vid: %d): %s\n",
608 tt_removed_node = batadv_hash_remove(bat_priv->tt.global_hash,
700 "Local translation table size (%i) exceeds maximum packet size (%i); Ignoring new local tt entry: %pM\n",
721 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",
723 (u8)atomic_read(&bat_priv->tt.vn));
747 hash_added = batadv_hash_add(bat_priv->tt.local_hash, batadv_compare_tt,
765 /* These node are probably going to update their tt table */
856 num_entries += atomic_read(&vlan->tt.num_entries);
882 tt_vlan->crc = htonl(vlan->tt.crc);
931 vlan_entries = atomic_read(&vlan->tt.num_entries);
956 (*tt_data)->ttvn = atomic_read(&bat_priv->tt.vn);
961 vlan_entries = atomic_read(&vlan->tt.num_entries);
966 tt_vlan->crc = htonl(vlan->tt.crc);
982 * container after local tt changes have been committed
995 tt_diff_entries_num = atomic_read(&bat_priv->tt.local_changes);
999 * and wait for the tt table request which will be fragmented
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);
1062 * @common: tt local & tt global common data
1085 crc = vlan->tt.crc;
1195 hash = bat_priv->tt.local_hash;
1231 "Local tt entry (%pM, vid: %d) pending to be removed: %s\n",
1282 tt_removed_node = batadv_hash_remove(bat_priv->tt.local_hash,
1302 * batadv_tt_local_purge_list() - purge inactive tt local entries
1304 * @head: pointer to the list containing the local tt entries
1305 * @timeout: parameter deciding whether a given tt local entry is considered
1337 * batadv_tt_local_purge() - purge inactive tt local entries
1339 * @timeout: parameter deciding whether a given tt local entry is considered
1345 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
1370 if (!bat_priv->tt.local_hash)
1373 hash = bat_priv->tt.local_hash;
1394 bat_priv->tt.local_hash = NULL;
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,
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);
1578 * @ttvn: the tt version number ever announcing this non-mesh client
1645 hash_added = batadv_hash_add(bat_priv->tt.global_hash,
1714 "Creating new global tt entry: %pM (vid: %d, via %pM)\n",
1728 "global tt received",
1745 * batadv_transtable_best_orig() - Get best originator list entry from tt entry
1792 * @common: tt local & tt global common data
1815 crc = vlan->tt.crc;
1854 * @common: tt local & tt global common data
1899 * @head: Pointer to the list containing the global tt entries
1972 hash = bat_priv->tt.global_hash;
2041 * batadv_tt_global_del_orig_node() - remove orig_node from a global tt entry
2048 * global tt entry.
2067 "Deleting %pM from global tt entry %pM (vid: %d): %s\n",
2200 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2230 "Deleting global tt entry %pM (vid: %d): %s\n",
2266 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2290 "Deleting global tt entry %pM (vid: %d): %s\n",
2313 if (!bat_priv->tt.global_hash)
2316 hash = bat_priv->tt.global_hash;
2336 bat_priv->tt.global_hash = NULL;
2441 struct batadv_hashtable *hash = bat_priv->tt.global_hash;
2521 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
2567 * @ref: kref pointer of the tt req_node entry
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);
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);
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);
2681 * batadv_tt_local_valid() - verify local tt entry and get flags
2682 * @entry_ptr: to be checked local tt entry
2707 * batadv_tt_global_valid() - verify global tt entry and get flags
2708 * @entry_ptr: to be checked global tt entry
2739 * batadv_tt_tvlv_generate() - fill the tvlv buff with the tt entries from the
2740 * specified tt hash
2742 * @hash: hash table containing the tt entries
2743 * @tt_len: expected tvlv tt data buffer length in number of bytes
2745 * @valid_cb: function to filter tt change entries and to return TT flags
2748 * Fills the tvlv buff with the tt entries from the specified hash. If valid_cb
2834 crc = vlan->tt.crc;
2867 vlan->tt.crc = batadv_tt_local_crc(bat_priv, vlan->vid);
2894 vlan->tt.crc = crc;
2972 spin_lock_bh(&bat_priv->tt.req_list_lock);
2977 spin_unlock_bh(&bat_priv->tt.req_list_lock);
2987 * batadv_send_other_tt_response() - send reply to tt request concerning another
2990 * @tt_data: tt data containing the tt request information
2991 * @req_src: mac address of tt request sender
2992 * @req_dst: mac address of tt request recipient
2994 * Return: true if tt request reply was sent, false otherwise.
3072 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.global_hash,
3118 * batadv_send_my_tt_response() - send reply to tt request concerning this
3121 * @tt_data: tt data containing the tt request information
3122 * @req_src: mac address of tt request sender
3124 * Return: true if tt request reply was sent, false otherwise.
3144 spin_lock_bh(&bat_priv->tt.commit_lock);
3146 my_ttvn = (u8)atomic_read(&bat_priv->tt.vn);
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;
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);
3199 batadv_tt_tvlv_generate(bat_priv, bat_priv->tt.local_hash,
3223 spin_unlock_bh(&bat_priv->tt.last_changeset_lock);
3225 spin_unlock_bh(&bat_priv->tt.commit_lock);
3234 * batadv_send_tt_response() - send reply to tt request
3236 * @tt_data: tt data containing the tt request information
3237 * @req_src: mac address of tt request sender
3238 * @req_dst: mac address of tt request recipient
3240 * Return: true if tt request reply was sent, false otherwise.
3266 "tt removed by changes",
3358 * batadv_handle_tt_response() - process incoming tt reply
3360 * @tt_data: tt data containing the tt request information
3361 * @resp_src: mac address of tt reply sender
3362 * @num_entries: number of tt change entries appended to the tt data
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);
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);
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);
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);
3558 bat_priv = container_of(priv_tt, struct batadv_priv, tt);
3565 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
3580 cancel_delayed_work_sync(&bat_priv->tt.work);
3588 kfree(bat_priv->tt.last_changeset);
3602 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3636 /* Purge out all the tt local entries marked with BATADV_TT_CLIENT_PENDING */
3639 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
3661 "Deleting local tt entry (%pM, vid: %d): pending\n",
3678 * batadv_tt_local_commit_changes_nolock() - commit all pending local tt changes
3682 * Caller must hold tt->commit_lock.
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))
3700 atomic_inc(&bat_priv->tt.vn);
3703 (u8)atomic_read(&bat_priv->tt.vn));
3706 atomic_set(&bat_priv->tt.ogm_append_cnt, BATADV_TT_OGM_APPEND_MAX);
3711 * batadv_tt_local_commit_changes() - commit all pending local tt changes which
3717 spin_lock_bh(&bat_priv->tt.commit_lock);
3719 spin_unlock_bh(&bat_priv->tt.commit_lock);
3766 * batadv_tt_update_orig() - update global translation table with new tt
3773 * @tt_num_changes: number of tt changes inside the tt buffer
3798 * In this case send a tt request
3832 * in sync anymore -> request fresh tt data
3909 * Return: true when temporary tt entry could be added, false otherwise
3916 /* ignore loop detect macs, they are not supposed to be in the tt local
3949 spin_lock_bh(&bat_priv->tt.commit_lock);
3962 "Forced to purge local tt entries to fit new maximum fragment MTU (%i)\n",
3972 spin_unlock_bh(&bat_priv->tt.commit_lock);
3976 * batadv_tt_tvlv_ogm_handler_v1() - process incoming tt tvlv container
4015 * batadv_tt_tvlv_unicast_handler_v1() - process incoming (unicast) tt tvlv
4018 * @src: mac address of tt tvlv sender
4019 * @dst: mac address of tt tvlv recipient
4020 * @tvlv_value: tvlv buffer containing the tt data
4023 * Return: NET_RX_DROP if the tt tvlv is to be re-routed, NET_RX_SUCCESS
4097 * batadv_roam_tvlv_unicast_handler_v1() - process incoming tt roam tvlv
4100 * @src: mac address of tt tvlv sender
4101 * @dst: mac address of tt tvlv recipient
4102 * @tvlv_value: tvlv buffer containing the tt data
4105 * Return: NET_RX_DROP if the tt roam tvlv is to be re-routed, NET_RX_SUCCESS
4177 INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge);
4178 queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work,
4196 struct batadv_tt_global_entry *tt;
4199 tt = batadv_tt_global_hash_find(bat_priv, addr, vid);
4200 if (!tt)
4203 ret = tt->common.flags & BATADV_TT_CLIENT_ISOLA;
4205 batadv_tt_global_entry_put(tt);
4211 * batadv_tt_cache_init() - Initialize tt memory object cache
4280 * batadv_tt_cache_destroy() - Destroy tt memory object cache