[ovs-dev] [PATCH 2/5] flow: Add flow_mask_unwildcard_all()

Jarno Rajahalme jrajahalme at nicira.com
Thu Apr 3 19:24:23 UTC 2014


On Apr 3, 2014, at 11:52 AM, Ben Pfaff <blp at nicira.com> wrote:

> On Thu, Mar 27, 2014 at 09:44:26AM -0700, Pravin wrote:
>> This function will be used by later commit.
>> 
>> Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
> 
> The code seems fine, but I really don't like this term "unwildcard"
> we've invented, so I'm trying to reduce the use of it.  How about just
> "match" instead of "unwildcard"?
> 
> I suggest adding a function-level comment, like:
> 
> /* Sets all of the bits in 'mask' to 1-bits, except for metadata
> * fields and fields in 'flow' whose prerequisites are not met. */
> 

The new function would fit better in lib/flow.c.

  Jarno


> Acked-by: Ben Pfaff <blp at nicira.com>
> 
> Thanks,
> 
> Ben.
> 
>> +void
>> +flow_mask_unwildcard_all(const struct flow *flow, struct flow *mask)
>> +{
>> +    enum mf_field_id id;
>> +    /* No mask key, unwildcard everything except fields whose
>> +     * prerequisities are not met. */
>> +    memset(mask, 0x0, sizeof *mask);
>> +
>> +    for (id = 0; id < MFF_N_IDS; ++id) {
>> +        /* Skip registers and metadata. */
>> +        if (!(id >= MFF_REG0 && id < MFF_REG0 + FLOW_N_REGS)
>> +            && id != MFF_METADATA) {
>> +            const struct mf_field *mf = mf_from_id(id);
>> +            if (mf_are_prereqs_ok(mf, flow)) {
>> +                mf_mask_field(mf, mask);
>> +            }
>> +        }
>> +    }
>> +}
>> +
>> /* Sets 'flow' member field described by 'mf' to 'value'.  The caller is
>>  * responsible for ensuring that 'flow' meets 'mf''s prerequisites.*/
>> void
>> diff --git a/lib/meta-flow.h b/lib/meta-flow.h
>> index 91dfecd..8b3cd5e 100644
>> --- a/lib/meta-flow.h
>> +++ b/lib/meta-flow.h
>> @@ -413,4 +413,5 @@ void mf_format(const struct mf_field *,
>>                struct ds *);
>> void mf_format_subvalue(const union mf_subvalue *subvalue, struct ds *s);
>> 
>> +void flow_mask_unwildcard_all(const struct flow *flow, struct flow *mask);
>> #endif /* meta-flow.h */
>> -- 
>> 1.7.9.5
>> 
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20140403/cad1f1a1/attachment-0005.html>


More information about the dev mailing list