On Wed, Aug 10, 2011 at 05:21:42PM -0700, Ethan Jackson wrote:
> nxm_read_field() simplifies reading of NXM fields with an ofs_nbits
> parameter.  This patch updates nxm_execute_reg_move() to use the
> new function.  A user outside of the nx-match module will be added
> in future patches.

The return value semantics of nxm_read_field() are surprising in that
it just masks off the bits not being read.  If I had not read the code
for the function, I would have guessed that it also shifted the bits
so that the least-significant bit being read was the least-significant
bit in the return value.  If the existing behavior is actually the
most convenient, it'd be good for the function's comment to mention
it.

Instead of nxm_read_field__() and nxm_read_field(), I'd be inclined to
keep nxm_read_field()'s existing name and name the new function
nxm_read_subfield() or nxm_read_field_bits().  It sounds more
descriptive to me.

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

Reply via email to