[ovs-dev] [PATCH 2/4] ofproto: Add enum ofp_table_config

Ben Pfaff blp at nicira.com
Wed Nov 13 05:58:09 UTC 2013


On Tue, Nov 12, 2013 at 05:52:37PM -0800, Jarno Rajahalme wrote:
> 
> 
> > On Nov 12, 2013, at 8:47 AM, Ben Pfaff <blp at nicira.com> wrote:
> > 
> >> On Tue, Nov 12, 2013 at 04:45:51PM +0900, Simon Horman wrote:
> ...
> >> +enum ofp_table_config {
> >> +    OFPTC_TABLE_MISS_CONTROLLER = 0,    /* Send to controller. */
> >> +    OFPTC_TABLE_MISS_CONTINUE = 1 << 0, /* Continue to the next table in the
> >> +                                           pipeline (OpenFlow 1.0 behavior). */
> >> +    OFPTC_TABLE_MISS_DROP = 1 << 1,     /* Drop the packet. */
> >> +    OFPTC_TABLE_MISS_MASK = 3
> >> +};
> > 
> > I know that at least some version of the standard writes it that way but
> > the constants don't make any sense in that form.  0 << 0, 1 << 0, 2 <<
> > 0, 3 << 0 are a lot more sensible.  
> 
> Why shift zero bits?

Only to imply more strongly, at a glance, that these are bitwise fields
within a larger word.  I'm not sure any other bitwise fields were ever
defined in that word, but that was the intent, at least.



More information about the dev mailing list