[ovs-dev] [PATCH 5/5] Use VLAN_VID_SHIFT, even though it is 0, for consistency.

Justin Pettit jpettit at nicira.com
Fri Feb 12 22:03:57 PST 2010


On Feb 12, 2010, at 9:15 PM, Jesse Gross wrote:

> On Fri, Feb 12, 2010 at 9:36 PM, Justin Pettit <jpettit at nicira.com> wrote:
> Yowza.  That is kind of ugly.  I'm not sure that the first two would even correct had the shift not been zero, though.  I think all the masks are bitwise-correct, so you normally don't shift them.
> 
> 
> I'm pretty sure that this is correct.  In this case the masks are bitwise correct but the values are not.  We're just comparing them, so it doesn't really matter which one we shift.  We're doing exactly the same thing for the PCP bits, which is probably easier to think about since the shift isn't zero there.

Ah, right.  This is probably the real reason people don't work during paternity leave.  ;-)

> I was looking at the function dp_netdev_modify_vlan_tci() in dpif-netdev.c.  Doesn't it seem like we should be applying the mask to the passed in value, too?  So, this:
> 
> We could do that but we validate the actions when the flows are added so they should already be in the correct range.

Yeah.  I still think it would be good to make the function actually correct in case it ever gets used elsewhere.  I'll send it out later, but I realize it's super low priority.

--Justin






More information about the dev mailing list