[ovs-dev] [PATCH] datapath: Use currect rcu API in exact match flow lookup function.

Pravin Shelar pshelar at nicira.com
Sun Jul 27 01:26:00 UTC 2014


On Sat, Jul 26, 2014 at 6:19 PM, Jarno Rajahalme <jrajahalme at nicira.com> wrote:
>
>> On Jul 26, 2014, at 5:53 PM, Pravin B Shelar <pshelar at nicira.com> wrote:
>>
>> exact match cache lookup is always done under ovs lock. So
>> use ovsl_dereference() API for rcu access.
>>
>
> This description makes it sound like exact match cache lookup would always be done under ovs lock, which just cannot be true. Do you mean that this specific function is always called under ovs lock?
>

It is typo, I meant exact match flow lookup is always done under ovs_mutex.

Thanks.

>   Jarno
>
>> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
>> ---
>> datapath/flow_table.c | 17 +++++++----------
>> 1 file changed, 7 insertions(+), 10 deletions(-)
>>
>> diff --git a/datapath/flow_table.c b/datapath/flow_table.c
>> index 21f67bf..cfd5a84 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;
>> }
>> --
>> 1.9.3
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list