On Wed, Jul 13, 2016 at 01:27:19AM +0800, Johnson Li wrote:
> Signed-off-by: Johnson Li <johnson...@intel.com>
> 
> diff --git a/include/openvswitch/match.h b/include/openvswitch/match.h
> index c955753..4c79da3 100644
> --- a/include/openvswitch/match.h
> +++ b/include/openvswitch/match.h
> @@ -40,6 +40,18 @@ struct match {
>  /* Initializer for a "struct match" that matches every packet. */
>  #define MATCH_CATCHALL_INITIALIZER { .flow = { .dl_type = 0 } }
>  
> +#define MATCH_SET_FIELD_MASKED(match, field, value, msk)      \
> +    do {                                                      \
> +        (match)->wc.masks.field = (msk);                      \
> +        (match)->flow.field = (value) & (msk);                \
> +    } while (0)
> +
> +#define MATCH_SET_FIELD_UINT8(match, field, value)            \
> +    MATCH_SET_FIELD_MASKED(match, field, value, UINT8_MAX)
> +
> +#define MATCH_SET_FIELD_BE32(match, field, value)             \
> +    MATCH_SET_FIELD_MASKED(match, field, value, OVS_BE32_MAX)
> +
>  void match_init(struct match *,
>                  const struct flow *, const struct flow_wildcards *);
>  void match_wc_init(struct match *match, const struct flow *flow);

This patch seems more generic than the changelog indicates.

And if this approach is acceptable it seems that as a follow-up
it could be used extensively in lib/match.c.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to