On Thu, May 28, 2015 at 3:26 PM, Ben Pfaff <b...@nicira.com> wrote: > On Mon, Mar 30, 2015 at 03:46:28PM -0700, Alex Wang wrote: > > This commit adds functions that check if the 'struct flow_wildcards' > > member is fully masked (exact-match) or fully unmasked (don't care > > the entire field at all). Also, this commit adds a function to > > shape a less-masked flow field by a more-masked flow field. > > > > Signed-off-by: Alex Wang <al...@nicira.com> > > I don't understand the meaning of "shape", in the comment on > flow_apply_field(). > > I mean the function will change a more wildcarded field/flow to a more specific one.
Also, will adopt the suggestions. > I have some suggestions as an incremental diff: > > diff --git a/lib/flow.c b/lib/flow.c > index e91b107..1e5fc20 100644 > --- a/lib/flow.c > +++ b/lib/flow.c > @@ -912,9 +912,9 @@ flow_apply_field(void *dst_field, void *dst_wc, const > void *src_field, > uint8_t *dw = dst_wc; > size_t i; > > - for (i = 0; i < size ; i++) { > - df[i] = sf[i] | df[i]; > - dw[i] = sw[i] | dw[i]; > + for (i = 0; i < size; i++) { > + df[i] |= sf[i]; > + dw[i] |= sw[i]; > } > } > > @@ -925,11 +925,7 @@ flow_apply_field(void *dst_field, void *dst_wc, const > void *src_field, > bool > flow_wildcard_is_fully_masked(void *field, size_t len) > { > - char cmp[len]; > - > - memset(cmp, 0xff, len); > - > - return !memcmp(field, cmp, len); > + return is_all_ones(field, len); > } > > /* Returns true if the 'field' of 'len' byte long is > @@ -937,11 +933,7 @@ flow_wildcard_is_fully_masked(void *field, size_t len) > bool > flow_wildcard_is_fully_unmasked(void *field, size_t len) > { > - char cmp[len]; > - > - memset(cmp, 0, len); > - > - return !memcmp(field, cmp, len); > + return is_all_zeros(field, len); > } > > /* Initializes 'wc' as a set of wildcards that matches every packet. */ > > > Acked-by: Ben Pfaff <b...@nicira.com> > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev