One small matter of opinion below,

  Jarno

Acked-by: Jarno Rajahalme <jrajaha...@nicira.com>

On Sep 30, 2014, at 5:47 PM, Ben Pfaff <b...@nicira.com> wrote:

> This will make it easier to support 64-bit OXM experimenter fields.
> 
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> Acked-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>
> ---
> v1->v2: Use ->s6_addr for IPv6 raw bytes in nxm_put_ipv6().
> ---
> lib/nx-match.c |  313 +++++++++++++++++++++-----------------------------------
> 1 file changed, 117 insertions(+), 196 deletions(-)
> 
> diff --git a/lib/nx-match.c b/lib/nx-match.c
> index 238bfdb..da99f13 100644
> --- a/lib/nx-match.c
> +++ b/lib/nx-match.c

(snip)

> -        nxm_put_16w(b, nxm_make_wild_header(header), value, mask);
> -        break;
> +nxm_put(struct ofpbuf *b, enum mf_field_id field, enum ofp_version version,
> +        const void *value, const void *mask, size_t n_bytes)
> +{
> +    if (!is_all_zeros(mask, n_bytes)) {
> +        bool masked = !is_all_ones(mask, n_bytes);
> +        nx_put_header(b, field, version, masked);
> +        ofpbuf_put(b, value, n_bytes);
> +        if (masked) {
> +            ofpbuf_put(b, mask, n_bytes);
> +        }
>     }
> }
> 

I would be inclined to define mxm_put_unmasked() like this and use it in 
appropriate places below, instead of calling nxm_put() with all-ones mask:

static void
nxm_put_unmasked(struct ofpbuf *b, enum mf_field_id field, enum ofp_version 
version,
        const void *value, size_t n_bytes)
{
    nx_put_header(b, field, version, false);
    ofpbuf_put(b, value, n_bytes);
}


> static void
> -nxm_put_32(struct ofpbuf *b, uint32_t header, ovs_be32 value)
> +nxm_put_8m(struct ofpbuf *b, enum mf_field_id field, enum ofp_version 
> version,
> +           uint8_t value, uint8_t mask)
> {
> -    nxm_put_header(b, header);
> -    ofpbuf_put(b, &value, sizeof value);
> +    nxm_put(b, field, version, &value, &mask, sizeof value);
> }

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to