Lines Matching refs: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;
415 struct table_instance *ti, *ufid_ti;
427 ti = table_instance_alloc(TBL_MIN_BUCKETS);
428 if (!ti)
435 rcu_assign_pointer(table->ti, ti);
445 __table_instance_destroy(ti);
455 struct table_instance *ti;
457 ti = container_of(rcu, struct table_instance, rcu);
458 __table_instance_destroy(ti);
462 struct table_instance *ti,
466 hlist_del_rcu(&flow->flow_table.node[ti->node_ver]);
479 struct table_instance *ti,
484 for (i = 0; i < ti->n_buckets; i++) {
485 struct hlist_head *head = &ti->buckets[i];
490 flow_table.node[ti->node_ver]) {
492 table_instance_flow_free(table, ti, ufid_ti,
505 static void table_instance_destroy(struct table_instance *ti,
508 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);
517 struct table_instance *ti = rcu_dereference_raw(table->ti);
524 table_instance_destroy(ti, ufid_ti);
527 struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti,
535 ver = ti->node_ver;
536 while (*bucket < ti->n_buckets) {
538 head = &ti->buckets[*bucket];
554 static struct hlist_head *find_bucket(struct table_instance *ti, u32 hash)
556 hash = jhash_1word(hash, ti->hash_seed);
557 return &ti->buckets[hash & (ti->n_buckets - 1)];
560 static void table_instance_insert(struct table_instance *ti,
565 head = find_bucket(ti, flow->flow_table.hash);
566 hlist_add_head_rcu(&flow->flow_table.node[ti->node_ver], head);
569 static void ufid_table_instance_insert(struct table_instance *ti,
574 head = find_bucket(ti, flow->ufid_table.hash);
575 hlist_add_head_rcu(&flow->ufid_table.node[ti->node_ver], head);
605 static struct table_instance *table_instance_rehash(struct table_instance *ti,
614 flow_table_copy_flows(ti, new_ti, ufid);
631 old_ti = ovsl_dereference(flow_table->ti);
634 rcu_assign_pointer(flow_table->ti, new_ti);
700 static struct sw_flow *masked_flow_lookup(struct table_instance *ti,
712 head = find_bucket(ti, hash);
715 hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver],
730 struct table_instance *ti,
745 flow = masked_flow_lookup(ti, key, mask, n_mask_hit);
765 flow = masked_flow_lookup(ti, key, mask, n_mask_hit);
793 struct table_instance *ti = rcu_dereference(tbl->ti);
805 return flow_lookup(tbl, ti, ma, key, n_mask_hit, &cache,
826 flow = flow_lookup(tbl, ti, ma, key, n_mask_hit,
840 flow = flow_lookup(tbl, ti, ma, key, n_mask_hit, n_cache_hit,
852 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
864 flow = flow_lookup(tbl, ti, ma, key, &n_mask_hit, &n_cache_hit, &index);
877 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
886 flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit);
922 struct table_instance *ti = rcu_dereference_ovsl(tbl->ufid_ti);
928 head = find_bucket(ti, hash);
929 hlist_for_each_entry_rcu(flow, head, ufid_table.node[ti->node_ver],
951 static struct table_instance *table_instance_expand(struct table_instance *ti,
954 return table_instance_rehash(ti, ti->n_buckets * 2, ufid);
960 struct table_instance *ti = ovsl_dereference(table->ti);
964 table_instance_flow_free(table, ti, ufid_ti, flow);
1040 struct table_instance *ti;
1043 ti = ovsl_dereference(table->ti);
1044 table_instance_insert(ti, flow);
1048 if (table->count > ti->n_buckets)
1049 new_ti = table_instance_expand(ti, false);
1051 new_ti = table_instance_rehash(ti, ti->n_buckets, false);
1054 rcu_assign_pointer(table->ti, new_ti);
1055 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);
1063 struct table_instance *ti;
1066 ti = ovsl_dereference(table->ufid_ti);
1067 ufid_table_instance_insert(ti, flow);
1071 if (table->ufid_count > ti->n_buckets) {
1074 new_ti = table_instance_expand(ti, true);
1077 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);