From: Pravin B Shelar Date: Sat, 26 Jul 2014 03:34:48 +0000 (-0700) Subject: datapath: Use currect rcu API in exact match flow lookup function. X-Git-Tag: v2.4.0~1731 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=8fe27b20acde7653adc0428bfcf7205492d47b78 datapath: Use currect rcu API in exact match flow lookup function. exact match cache lookup is always done under ovs lock. So use ovsl_dereference() API for rcu access. Signed-off-by: Pravin B Shelar Acked-by: Andy Zhou --- diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 21f67bffb..cfd5a84af 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -666,23 +666,20 @@ struct sw_flow *ovs_flow_tbl_lookup(struct flow_table *tbl, struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl, struct sw_flow_match *match) { - struct table_instance *ti = rcu_dereference_ovsl(tbl->ti); - struct mask_array *ma = rcu_dereference_ovsl(tbl->mask_array); - struct sw_flow *flow; - u32 __always_unused n_mask_hit; + struct mask_array *ma = ovsl_dereference(tbl->mask_array); int i; /* Always called under ovs-mutex. */ for (i = 0; i < ma->count; i++) { + struct table_instance *ti = ovsl_dereference(tbl->ti); + u32 __always_unused n_mask_hit; struct sw_flow_mask *mask; + struct sw_flow *flow; mask = ovsl_dereference(ma->masks[i]); - if (mask) { - flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit); - if (flow && ovs_flow_cmp_unmasked_key(flow, match)) { /* Found */ - return flow; - } - } + flow = masked_flow_lookup(ti, match->key, mask, &n_mask_hit); + if (flow && ovs_flow_cmp_unmasked_key(flow, match)) + return flow; } return NULL; }