Lines Matching refs:tbl

76 #define for_each_mesh_entry(tbl, node, i) \  argument
77 for (i = 0; i <= tbl->hash_mask; i++) \
78 hlist_for_each_entry_rcu(node, &tbl->hash_buckets[i], list)
118 static void __mesh_table_free(struct mesh_table *tbl) in __mesh_table_free() argument
120 kfree(tbl->hash_buckets); in __mesh_table_free()
121 kfree(tbl->hashwlock); in __mesh_table_free()
122 kfree(tbl); in __mesh_table_free()
125 static void mesh_table_free(struct mesh_table *tbl, bool free_leafs) in mesh_table_free() argument
132 mesh_hash = tbl->hash_buckets; in mesh_table_free()
133 for (i = 0; i <= tbl->hash_mask; i++) { in mesh_table_free()
134 spin_lock_bh(&tbl->hashwlock[i]); in mesh_table_free()
136 tbl->free_node(p, free_leafs); in mesh_table_free()
137 atomic_dec(&tbl->entries); in mesh_table_free()
139 spin_unlock_bh(&tbl->hashwlock[i]); in mesh_table_free()
142 spin_lock_bh(&tbl->gates_lock); in mesh_table_free()
144 tbl->known_gates, list) { in mesh_table_free()
148 kfree(tbl->known_gates); in mesh_table_free()
149 spin_unlock_bh(&tbl->gates_lock); in mesh_table_free()
152 __mesh_table_free(tbl); in mesh_table_free()
189 struct mesh_table *tbl) in mesh_table_hash() argument
193 tbl->hash_rnd) & tbl->hash_mask; in mesh_table_hash()
335 static struct mesh_path *mpath_lookup(struct mesh_table *tbl, const u8 *dst, in mpath_lookup() argument
342 bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)]; in mpath_lookup()
392 struct mesh_table *tbl = rcu_dereference(mesh_paths); in mesh_path_lookup_by_idx() local
397 for_each_mesh_entry(tbl, node, i) { in mesh_path_lookup_by_idx()
425 struct mesh_table *tbl = rcu_dereference(mpp_paths); in mpp_path_lookup_by_idx() local
430 for_each_mesh_entry(tbl, node, i) { in mpp_path_lookup_by_idx()
446 struct mesh_table *tbl; in mesh_path_add_gate() local
451 tbl = rcu_dereference(mesh_paths); in mesh_path_add_gate()
453 hlist_for_each_entry_rcu(gate, tbl->known_gates, list) in mesh_path_add_gate()
468 spin_lock_bh(&tbl->gates_lock); in mesh_path_add_gate()
469 hlist_add_head_rcu(&new_gate->list, tbl->known_gates); in mesh_path_add_gate()
470 spin_unlock_bh(&tbl->gates_lock); in mesh_path_add_gate()
487 static void mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath) in mesh_gate_del() argument
492 hlist_for_each_entry_safe(gate, q, tbl->known_gates, list) { in mesh_gate_del()
495 spin_lock_bh(&tbl->gates_lock); in mesh_gate_del()
498 spin_unlock_bh(&tbl->gates_lock); in mesh_gate_del()
531 struct mesh_table *tbl; in mesh_path_add() local
550 tbl = resize_dereference_mesh_paths(); in mesh_path_add()
552 hash_idx = mesh_table_hash(dst, sdata, tbl); in mesh_path_add()
553 bucket = &tbl->hash_buckets[hash_idx]; in mesh_path_add()
555 spin_lock(&tbl->hashwlock[hash_idx]); in mesh_path_add()
587 if (atomic_inc_return(&tbl->entries) >= in mesh_path_add()
588 tbl->mean_chain_len * (tbl->hash_mask + 1)) in mesh_path_add()
599 spin_unlock(&tbl->hashwlock[hash_idx]); in mesh_path_add()
607 spin_unlock(&tbl->hashwlock[hash_idx]); in mesh_path_add()
614 struct mesh_table *tbl = container_of(rcu, struct mesh_table, rcu_head); in mesh_table_free_rcu() local
616 mesh_table_free(tbl, false); in mesh_table_free_rcu()
665 struct mesh_table *tbl; in mpp_path_add() local
700 tbl = resize_dereference_mpp_paths(); in mpp_path_add()
702 hash_idx = mesh_table_hash(dst, sdata, tbl); in mpp_path_add()
703 bucket = &tbl->hash_buckets[hash_idx]; in mpp_path_add()
705 spin_lock(&tbl->hashwlock[hash_idx]); in mpp_path_add()
716 if (atomic_inc_return(&tbl->entries) >= in mpp_path_add()
717 tbl->mean_chain_len * (tbl->hash_mask + 1)) in mpp_path_add()
720 spin_unlock(&tbl->hashwlock[hash_idx]); in mpp_path_add()
732 spin_unlock(&tbl->hashwlock[hash_idx]); in mpp_path_add()
752 struct mesh_table *tbl; in mesh_plink_broken() local
760 tbl = rcu_dereference(mesh_paths); in mesh_plink_broken()
761 for_each_mesh_entry(tbl, node, i) { in mesh_plink_broken()
791 static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node) in __mesh_path_del() argument
798 mesh_gate_del(tbl, mpath); in __mesh_path_del()
802 atomic_dec(&tbl->entries); in __mesh_path_del()
818 struct mesh_table *tbl; in mesh_path_flush_by_nexthop() local
825 tbl = resize_dereference_mesh_paths(); in mesh_path_flush_by_nexthop()
826 for_each_mesh_entry(tbl, node, i) { in mesh_path_flush_by_nexthop()
829 spin_lock(&tbl->hashwlock[i]); in mesh_path_flush_by_nexthop()
830 __mesh_path_del(tbl, node); in mesh_path_flush_by_nexthop()
831 spin_unlock(&tbl->hashwlock[i]); in mesh_path_flush_by_nexthop()
838 static void table_flush_by_iface(struct mesh_table *tbl, in table_flush_by_iface() argument
846 for_each_mesh_entry(tbl, node, i) { in table_flush_by_iface()
850 spin_lock_bh(&tbl->hashwlock[i]); in table_flush_by_iface()
851 __mesh_path_del(tbl, node); in table_flush_by_iface()
852 spin_unlock_bh(&tbl->hashwlock[i]); in table_flush_by_iface()
866 struct mesh_table *tbl; in mesh_path_flush_by_iface() local
870 tbl = resize_dereference_mesh_paths(); in mesh_path_flush_by_iface()
871 table_flush_by_iface(tbl, sdata); in mesh_path_flush_by_iface()
872 tbl = resize_dereference_mpp_paths(); in mesh_path_flush_by_iface()
873 table_flush_by_iface(tbl, sdata); in mesh_path_flush_by_iface()
888 struct mesh_table *tbl; in mesh_path_del() local
896 tbl = resize_dereference_mesh_paths(); in mesh_path_del()
897 hash_idx = mesh_table_hash(addr, sdata, tbl); in mesh_path_del()
898 bucket = &tbl->hash_buckets[hash_idx]; in mesh_path_del()
900 spin_lock(&tbl->hashwlock[hash_idx]); in mesh_path_del()
905 __mesh_path_del(tbl, node); in mesh_path_del()
913 spin_unlock(&tbl->hashwlock[hash_idx]); in mesh_path_del()
946 struct mesh_table *tbl; in mesh_path_send_to_gates() local
953 tbl = rcu_dereference(mesh_paths); in mesh_path_send_to_gates()
954 known_gates = tbl->known_gates; in mesh_path_send_to_gates()
1118 struct mesh_table *tbl; in mesh_path_expire() local
1124 tbl = rcu_dereference(mesh_paths); in mesh_path_expire()
1125 for_each_mesh_entry(tbl, node, i) { in mesh_path_expire()