Lines Matching refs:ti

146 static void __table_instance_destroy(struct table_instance *ti)
148 kvfree(ti->buckets);
149 kfree(ti);
154 struct table_instance *ti = kmalloc(sizeof(*ti), GFP_KERNEL);
157 if (!ti)
160 ti->buckets = kvmalloc_array(new_size, sizeof(struct hlist_head),
162 if (!ti->buckets) {
163 kfree(ti);
168 INIT_HLIST_HEAD(&ti->buckets[i]);
170 ti->n_buckets = new_size;
171 ti->node_ver = 0;
172 get_random_bytes(&ti->hash_seed, sizeof(u32));
174 return ti;
416 struct table_instance *ti, *ufid_ti;
428 ti = table_instance_alloc(TBL_MIN_BUCKETS);
429 if (!ti)
436 rcu_assign_pointer(table->ti, ti);
446 __table_instance_destroy(ti);
456 struct table_instance *ti;
458 ti = container_of(rcu, struct table_instance, rcu);
459 __table_instance_destroy(ti);
463 struct table_instance *ti,
467 hlist_del_rcu(&flow->flow_table.node[ti->node_ver]);
480 struct table_instance *ti,
485 for (i = 0; i < ti->n_buckets; i++) {
486 struct hlist_head *head = &ti->buckets[i];
491 flow_table.node[ti->node_ver]) {
493 table_instance_flow_free(table, ti, ufid_ti,
506 static void table_instance_destroy(struct table_instance *ti,
509 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);
518 struct table_instance *ti = rcu_dereference_raw(table->ti);
525 table_instance_destroy(ti, ufid_ti);
528 struct sw_flow *ovs_flow_tbl_dump_next(struct table_instance *ti,
536 ver = ti->node_ver;
537 while (*bucket < ti->n_buckets) {
539 head = &ti->buckets[*bucket];
555 static struct hlist_head *find_bucket(struct table_instance *ti, u32 hash)
557 hash = jhash_1word(hash, ti->hash_seed);
558 return &ti->buckets[hash & (ti->n_buckets - 1)];
561 static void table_instance_insert(struct table_instance *ti,
566 head = find_bucket(ti, flow->flow_table.hash);
567 hlist_add_head_rcu(&flow->flow_table.node[ti->node_ver], head);
570 static void ufid_table_instance_insert(struct table_instance *ti,
575 head = find_bucket(ti, flow->ufid_table.hash);
576 hlist_add_head_rcu(&flow->ufid_table.node[ti->node_ver], head);
606 static struct table_instance *table_instance_rehash(struct table_instance *ti,
615 flow_table_copy_flows(ti, new_ti, ufid);
632 old_ti = ovsl_dereference(flow_table->ti);
635 rcu_assign_pointer(flow_table->ti, new_ti);
701 static struct sw_flow *masked_flow_lookup(struct table_instance *ti,
713 head = find_bucket(ti, hash);
716 hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver],
731 struct table_instance *ti,
746 flow = masked_flow_lookup(ti, key, mask, n_mask_hit);
766 flow = masked_flow_lookup(ti, key, mask, n_mask_hit);
794 struct table_instance *ti = rcu_dereference(tbl->ti);
806 return flow_lookup(tbl, ti, ma, key, n_mask_hit, &cache,
827 flow = flow_lookup(tbl, ti, ma, key, n_mask_hit,
841 flow = flow_lookup(tbl, ti, ma, key, n_mask_hit, n_cache_hit,
853 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
865 flow = flow_lookup(tbl, ti, ma, key, &n_mask_hit, &n_cache_hit, &index);
878 struct table_instance *ti = rcu_dereference_ovsl(tbl->ti);
887 flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit);
923 struct table_instance *ti = rcu_dereference_ovsl(tbl->ufid_ti);
929 head = find_bucket(ti, hash);
930 hlist_for_each_entry_rcu(flow, head, ufid_table.node[ti->node_ver],
952 static struct table_instance *table_instance_expand(struct table_instance *ti,
955 return table_instance_rehash(ti, ti->n_buckets * 2, ufid);
961 struct table_instance *ti = ovsl_dereference(table->ti);
965 table_instance_flow_free(table, ti, ufid_ti, flow);
1041 struct table_instance *ti;
1044 ti = ovsl_dereference(table->ti);
1045 table_instance_insert(ti, flow);
1049 if (table->count > ti->n_buckets)
1050 new_ti = table_instance_expand(ti, false);
1052 new_ti = table_instance_rehash(ti, ti->n_buckets, false);
1055 rcu_assign_pointer(table->ti, new_ti);
1056 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);
1064 struct table_instance *ti;
1067 ti = ovsl_dereference(table->ufid_ti);
1068 ufid_table_instance_insert(ti, flow);
1072 if (table->ufid_count > ti->n_buckets) {
1075 new_ti = table_instance_expand(ti, true);
1078 call_rcu(&ti->rcu, flow_tbl_destroy_rcu_cb);