• Home
  • Raw
  • Download

Lines Matching refs:ti

175 static void __table_instance_destroy(struct table_instance *ti)  in __table_instance_destroy()  argument
177 free_buckets(ti->buckets); in __table_instance_destroy()
178 kfree(ti); in __table_instance_destroy()
183 struct table_instance *ti = kmalloc(sizeof(*ti), GFP_KERNEL); in table_instance_alloc() local
185 if (!ti) in table_instance_alloc()
188 ti->buckets = alloc_buckets(new_size); in table_instance_alloc()
190 if (!ti->buckets) { in table_instance_alloc()
191 kfree(ti); in table_instance_alloc()
194 ti->n_buckets = new_size; in table_instance_alloc()
195 ti->node_ver = 0; in table_instance_alloc()
196 ti->keep_flows = false; in table_instance_alloc()
197 get_random_bytes(&ti->hash_seed, sizeof(u32)); in table_instance_alloc()
199 return ti; in table_instance_alloc()
204 struct table_instance *ti; in ovs_flow_tbl_init() local
206 ti = table_instance_alloc(TBL_MIN_BUCKETS); in ovs_flow_tbl_init()
208 if (!ti) in ovs_flow_tbl_init()
211 rcu_assign_pointer(table->ti, ti); in ovs_flow_tbl_init()
220 struct table_instance *ti = container_of(rcu, struct table_instance, rcu); in flow_tbl_destroy_rcu_cb() local
222 __table_instance_destroy(ti); in flow_tbl_destroy_rcu_cb()
225 static void table_instance_destroy(struct table_instance *ti, bool deferred) in table_instance_destroy() argument
229 if (!ti) in table_instance_destroy()
232 if (ti->keep_flows) in table_instance_destroy()
235 for (i = 0; i < ti->n_buckets; i++) { in table_instance_destroy()
237 struct hlist_head *head = flex_array_get(ti->buckets, i); in table_instance_destroy()
239 int ver = ti->node_ver; in table_instance_destroy()
249 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb); in table_instance_destroy()
251 __table_instance_destroy(ti); in table_instance_destroy()
256 struct table_instance *ti = ovsl_dereference(table->ti); in ovs_flow_tbl_destroy() local
258 table_instance_destroy(ti, deferred); in ovs_flow_tbl_destroy()
261 struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti, in ovs_flow_tbl_dump_next() argument
269 ver = ti->node_ver; in ovs_flow_tbl_dump_next()
270 while (*bucket < ti->n_buckets) { in ovs_flow_tbl_dump_next()
272 head = flex_array_get(ti->buckets, *bucket); in ovs_flow_tbl_dump_next()
288 static struct hlist_head *find_bucket(struct table_instance *ti, u32 hash) in find_bucket() argument
290 hash = jhash_1word(hash, ti->hash_seed); in find_bucket()
291 return flex_array_get(ti->buckets, in find_bucket()
292 (hash & (ti->n_buckets - 1))); in find_bucket()
295 static void table_instance_insert(struct table_instance *ti, struct sw_flow *flow) in table_instance_insert() argument
299 head = find_bucket(ti, flow->hash); in table_instance_insert()
300 hlist_add_head_rcu(&flow->hash_node[ti->node_ver], head); in table_instance_insert()
326 static struct table_instance *table_instance_rehash(struct table_instance *ti, in table_instance_rehash() argument
335 flow_table_copy_flows(ti, new_ti); in table_instance_rehash()
345 old_ti = ovsl_dereference(flow_table->ti); in ovs_flow_tbl_flush()
350 rcu_assign_pointer(flow_table->ti, new_ti); in ovs_flow_tbl_flush()
411 static struct sw_flow *masked_flow_lookup(struct table_instance *ti, in masked_flow_lookup() argument
424 head = find_bucket(ti, hash); in masked_flow_lookup()
425 hlist_for_each_entry_rcu(flow, head, hash_node[ti->node_ver]) { in masked_flow_lookup()
438 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti); in ovs_flow_tbl_lookup_stats() local
445 flow = masked_flow_lookup(ti, key, mask); in ovs_flow_tbl_lookup_stats()
463 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti); in ovs_flow_tbl_lookup_exact() local
469 flow = masked_flow_lookup(ti, match->key, mask); in ovs_flow_tbl_lookup_exact()
487 static struct table_instance *table_instance_expand(struct table_instance *ti) in table_instance_expand() argument
489 return table_instance_rehash(ti, ti->n_buckets * 2); in table_instance_expand()
513 struct table_instance *ti = ovsl_dereference(table->ti); in ovs_flow_tbl_remove() local
516 hlist_del_rcu(&flow->hash_node[ti->node_ver]); in ovs_flow_tbl_remove()
590 struct table_instance *ti; in ovs_flow_tbl_insert() local
599 ti = ovsl_dereference(table->ti); in ovs_flow_tbl_insert()
600 table_instance_insert(ti, flow); in ovs_flow_tbl_insert()
604 if (table->count > ti->n_buckets) in ovs_flow_tbl_insert()
605 new_ti = table_instance_expand(ti); in ovs_flow_tbl_insert()
607 new_ti = table_instance_rehash(ti, ti->n_buckets); in ovs_flow_tbl_insert()
610 rcu_assign_pointer(table->ti, new_ti); in ovs_flow_tbl_insert()
611 table_instance_destroy(ti, true); in ovs_flow_tbl_insert()