• Home
  • Raw
  • Download

Lines Matching full:flow

19 #include "flow.h"
81 struct sw_flow *flow; in ovs_flow_alloc() local
84 flow = kmem_cache_zalloc(flow_cache, GFP_KERNEL); in ovs_flow_alloc()
85 if (!flow) in ovs_flow_alloc()
88 flow->stats_last_writer = -1; in ovs_flow_alloc()
99 RCU_INIT_POINTER(flow->stats[0], stats); in ovs_flow_alloc()
101 cpumask_set_cpu(0, &flow->cpu_used_mask); in ovs_flow_alloc()
103 return flow; in ovs_flow_alloc()
105 kmem_cache_free(flow_cache, flow); in ovs_flow_alloc()
137 static void flow_free(struct sw_flow *flow) in flow_free() argument
141 if (ovs_identifier_is_key(&flow->id)) in flow_free()
142 kfree(flow->id.unmasked_key); in flow_free()
143 if (flow->sf_acts) in flow_free()
144 ovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts); in flow_free()
146 for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask)) in flow_free()
147 if (flow->stats[cpu]) in flow_free()
149 (struct flow_stats __force *)flow->stats[cpu]); in flow_free()
150 kmem_cache_free(flow_cache, flow); in flow_free()
155 struct sw_flow *flow = container_of(rcu, struct sw_flow, rcu); in rcu_free_flow_callback() local
157 flow_free(flow); in rcu_free_flow_callback()
160 void ovs_flow_free(struct sw_flow *flow, bool deferred) in ovs_flow_free() argument
162 if (!flow) in ovs_flow_free()
166 call_rcu(&flow->rcu, rcu_free_flow_callback); in ovs_flow_free()
168 flow_free(flow); in ovs_flow_free()
251 struct sw_flow *flow; in table_instance_destroy() local
257 hlist_for_each_entry_safe(flow, n, head, flow_table.node[ver]) { in table_instance_destroy()
258 hlist_del_rcu(&flow->flow_table.node[ver]); in table_instance_destroy()
259 if (ovs_identifier_is_ufid(&flow->id)) in table_instance_destroy()
260 hlist_del_rcu(&flow->ufid_table.node[ufid_ver]); in table_instance_destroy()
261 ovs_flow_free(flow, deferred); in table_instance_destroy()
289 struct sw_flow *flow; in ovs_flow_tbl_dump_next() local
298 hlist_for_each_entry_rcu(flow, head, flow_table.node[ver]) { in ovs_flow_tbl_dump_next()
304 return flow; in ovs_flow_tbl_dump_next()
321 struct sw_flow *flow) in table_instance_insert() argument
325 head = find_bucket(ti, flow->flow_table.hash); in table_instance_insert()
326 hlist_add_head_rcu(&flow->flow_table.node[ti->node_ver], head); in table_instance_insert()
330 struct sw_flow *flow) in ufid_table_instance_insert() argument
334 head = find_bucket(ti, flow->ufid_table.hash); in ufid_table_instance_insert()
335 hlist_add_head_rcu(&flow->ufid_table.node[ti->node_ver], head); in ufid_table_instance_insert()
349 struct sw_flow *flow; in flow_table_copy_flows() local
355 hlist_for_each_entry(flow, head, in flow_table_copy_flows()
357 ufid_table_instance_insert(new, flow); in flow_table_copy_flows()
359 hlist_for_each_entry(flow, head, in flow_table_copy_flows()
361 table_instance_insert(new, flow); in flow_table_copy_flows()
448 static bool flow_cmp_masked_key(const struct sw_flow *flow, in flow_cmp_masked_key() argument
452 return cmp_key(&flow->key, key, range->start, range->end); in flow_cmp_masked_key()
455 static bool ovs_flow_cmp_unmasked_key(const struct sw_flow *flow, in ovs_flow_cmp_unmasked_key() argument
462 BUG_ON(ovs_identifier_is_ufid(&flow->id)); in ovs_flow_cmp_unmasked_key()
463 return cmp_key(flow->id.unmasked_key, key, key_start, key_end); in ovs_flow_cmp_unmasked_key()
470 struct sw_flow *flow; in masked_flow_lookup() local
478 hlist_for_each_entry_rcu(flow, head, flow_table.node[ti->node_ver]) { in masked_flow_lookup()
479 if (flow->mask == mask && flow->flow_table.hash == hash && in masked_flow_lookup()
480 flow_cmp_masked_key(flow, &masked_key, &mask->range)) in masked_flow_lookup()
481 return flow; in masked_flow_lookup()
492 struct sw_flow *flow; in ovs_flow_tbl_lookup_stats() local
497 flow = masked_flow_lookup(ti, key, mask); in ovs_flow_tbl_lookup_stats()
498 if (flow) /* Found */ in ovs_flow_tbl_lookup_stats()
499 return flow; in ovs_flow_tbl_lookup_stats()
517 struct sw_flow *flow; in ovs_flow_tbl_lookup_exact() local
521 flow = masked_flow_lookup(ti, match->key, mask); in ovs_flow_tbl_lookup_exact()
522 if (flow && ovs_identifier_is_key(&flow->id) && in ovs_flow_tbl_lookup_exact()
523 ovs_flow_cmp_unmasked_key(flow, match)) in ovs_flow_tbl_lookup_exact()
524 return flow; in ovs_flow_tbl_lookup_exact()
534 static bool ovs_flow_cmp_ufid(const struct sw_flow *flow, in ovs_flow_cmp_ufid() argument
537 if (flow->id.ufid_len != sfid->ufid_len) in ovs_flow_cmp_ufid()
540 return !memcmp(flow->id.ufid, sfid->ufid, sfid->ufid_len); in ovs_flow_cmp_ufid()
543 bool ovs_flow_cmp(const struct sw_flow *flow, const struct sw_flow_match *match) in ovs_flow_cmp() argument
545 if (ovs_identifier_is_ufid(&flow->id)) in ovs_flow_cmp()
546 return flow_cmp_masked_key(flow, match->key, &match->range); in ovs_flow_cmp()
548 return ovs_flow_cmp_unmasked_key(flow, match); in ovs_flow_cmp()
555 struct sw_flow *flow; in ovs_flow_tbl_lookup_ufid() local
561 hlist_for_each_entry_rcu(flow, head, ufid_table.node[ti->node_ver]) { in ovs_flow_tbl_lookup_ufid()
562 if (flow->ufid_table.hash == hash && in ovs_flow_tbl_lookup_ufid()
563 ovs_flow_cmp_ufid(flow, ufid)) in ovs_flow_tbl_lookup_ufid()
564 return flow; in ovs_flow_tbl_lookup_ufid()
605 void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow) in ovs_flow_tbl_remove() argument
611 hlist_del_rcu(&flow->flow_table.node[ti->node_ver]); in ovs_flow_tbl_remove()
613 if (ovs_identifier_is_ufid(&flow->id)) { in ovs_flow_tbl_remove()
614 hlist_del_rcu(&flow->ufid_table.node[ufid_ti->node_ver]); in ovs_flow_tbl_remove()
618 /* RCU delete the mask. 'flow->mask' is not NULLed, as it should be in ovs_flow_tbl_remove()
621 flow_mask_remove(table, flow->mask); in ovs_flow_tbl_remove()
662 static int flow_mask_insert(struct flow_table *tbl, struct sw_flow *flow, in flow_mask_insert() argument
680 flow->mask = mask; in flow_mask_insert()
685 static void flow_key_insert(struct flow_table *table, struct sw_flow *flow) in flow_key_insert() argument
690 flow->flow_table.hash = flow_hash(&flow->key, &flow->mask->range); in flow_key_insert()
692 table_instance_insert(ti, flow); in flow_key_insert()
709 static void flow_ufid_insert(struct flow_table *table, struct sw_flow *flow) in flow_ufid_insert() argument
713 flow->ufid_table.hash = ufid_hash(&flow->id); in flow_ufid_insert()
715 ufid_table_instance_insert(ti, flow); in flow_ufid_insert()
731 int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow, in ovs_flow_tbl_insert() argument
736 err = flow_mask_insert(table, flow, mask); in ovs_flow_tbl_insert()
739 flow_key_insert(table, flow); in ovs_flow_tbl_insert()
740 if (ovs_identifier_is_ufid(&flow->id)) in ovs_flow_tbl_insert()
741 flow_ufid_insert(table, flow); in ovs_flow_tbl_insert()
746 /* Initializes the flow module.
772 /* Uninitializes the flow module. */