Lines Matching defs:ti

145 static void __table_instance_destroy(struct table_instance *ti)
147 kvfree(ti->buckets);
148 kfree(ti);
153 struct table_instance *ti = kmalloc(sizeof(*ti), GFP_KERNEL);
156 if (!ti)
159 ti->buckets = kvmalloc_array(new_size, sizeof(struct hlist_head),
161 if (!ti->buckets) {
162 kfree(ti);
167 INIT_HLIST_HEAD(&ti->buckets[i]);
169 ti->n_buckets = new_size;
170 ti->node_ver = 0;
171 get_random_bytes(&ti->hash_seed, sizeof(u32));
173 return ti;
412 struct table_instance *ti, *ufid_ti;
424 ti = table_instance_alloc(TBL_MIN_BUCKETS);
425 if (!ti)
432 rcu_assign_pointer(table->ti, ti);
442 __table_instance_destroy(ti);
452 struct table_instance *ti;
454 ti = container_of(rcu, struct table_instance, rcu);
455 __table_instance_destroy(ti);
459 struct table_instance *ti,
463 hlist_del_rcu(&flow->flow_table.node[ti->node_ver]);
476 struct table_instance *ti,
481 for (i = 0; i < ti->n_buckets; i++) {
482 struct hlist_head *head = &ti->buckets[i];
487 flow_table.node[ti->node_ver]) {
489 table_instance_flow_free(table, ti, ufid_ti,
502 static void table_instance_destroy(struct table_instance *ti,
505 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);
514 struct table_instance *ti = rcu_dereference_raw(table->ti);
521 table_instance_destroy(ti, ufid_ti);
524 struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti,
532 ver = ti->node_ver;
533 while (*bucket < ti->n_buckets) {
535 head = &ti->buckets[*bucket];
551 static struct hlist_head *find_bucket(struct table_instance *ti, u32 hash)
553 hash = jhash_1word(hash, ti->hash_seed);
554 return &ti->buckets[hash & (ti->n_buckets - 1)];
557 static void table_instance_insert(struct table_instance *ti,
562 head = find_bucket(ti, flow->flow_table.hash);
563 hlist_add_head_rcu(&flow->flow_table.node[ti->node_ver], head);
566 static void ufid_table_instance_insert(struct table_instance *ti,
571 head = find_bucket(ti, flow->ufid_table.hash);
572 hlist_add_head_rcu(&flow->ufid_table.node[ti->node_ver], head);
602 static struct table_instance *table_instance_rehash(struct table_instance *ti,
611 flow_table_copy_flows(ti, new_ti, ufid);
628 old_ti = ovsl_dereference(flow_table->ti);
631 rcu_assign_pointer(flow_table->ti, new_ti);
697 static struct sw_flow *masked_flow_lookup(struct table_instance *ti,
709 head = find_bucket(ti, hash);
712 hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver],
727 struct table_instance *ti,
742 flow = masked_flow_lookup(ti, key, mask, n_mask_hit);
762 flow = masked_flow_lookup(ti, key, mask, n_mask_hit);
790 struct table_instance *ti = rcu_dereference(tbl->ti);
802 return flow_lookup(tbl, ti, ma, key, n_mask_hit, &cache,
823 flow = flow_lookup(tbl, ti, ma, key, n_mask_hit,
837 flow = flow_lookup(tbl, ti, ma, key, n_mask_hit, n_cache_hit,
849 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
861 flow = flow_lookup(tbl, ti, ma, key, &n_mask_hit, &n_cache_hit, &index);
874 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
883 flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit);
919 struct table_instance *ti = rcu_dereference_ovsl(tbl->ufid_ti);
925 head = find_bucket(ti, hash);
926 hlist_for_each_entry_rcu(flow, head, ufid_table.node[ti->node_ver],
948 static struct table_instance *table_instance_expand(struct table_instance *ti,
951 return table_instance_rehash(ti, ti->n_buckets * 2, ufid);
957 struct table_instance *ti = ovsl_dereference(table->ti);
961 table_instance_flow_free(table, ti, ufid_ti, flow);
1037 struct table_instance *ti;
1040 ti = ovsl_dereference(table->ti);
1041 table_instance_insert(ti, flow);
1045 if (table->count > ti->n_buckets)
1046 new_ti = table_instance_expand(ti, false);
1048 new_ti = table_instance_rehash(ti, ti->n_buckets, false);
1051 rcu_assign_pointer(table->ti, new_ti);
1052 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);
1060 struct table_instance *ti;
1063 ti = ovsl_dereference(table->ufid_ti);
1064 ufid_table_instance_insert(ti, flow);
1068 if (table->ufid_count > ti->n_buckets) {
1071 new_ti = table_instance_expand(ti, true);
1074 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);