[ovs-dev] [PATCH 03/10] openflow1.2: add OFP12_ACTION_SET_FIELD_ALIGN = 8

Isaku Yamahata yamahata at valinux.co.jp
Wed Jun 27 05:56:31 UTC 2012


On Tue, Jun 26, 2012 at 09:34:06PM -0700, Ben Pfaff wrote:
> On Wed, Jun 27, 2012 at 01:26:58PM +0900, Isaku Yamahata wrote:
> > Signed-off-by: Isaku Yamahata <yamahata at valinux.co.jp>
> > ---
> >  include/openflow/openflow-1.2.h |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/openflow/openflow-1.2.h b/include/openflow/openflow-1.2.h
> > index bd86bf9..32f5c01 100644
> > --- a/include/openflow/openflow-1.2.h
> > +++ b/include/openflow/openflow-1.2.h
> > @@ -262,6 +262,8 @@ struct ofp12_action_set_field {
> >  };
> >  OFP_ASSERT(sizeof(struct ofp12_action_set_field) == 8);
> >  
> > +#define OFP12_ACTION_SET_FIELD_ALIGN	8
> 
> What is this new constant for?

>From the spec, struct ofp_action_set_field is padded
to be aligned 64 bit.
The constant is used when the action is parsed.

The spec doesn't define the constant. So I'll drop this patch and
hard code the value in the parser with a comment.

/* Action structure for OFPAT_SET_FIELD. */
struct ofp_action_set_field {
uint16_t type; /* OFPAT_SET_FIELD. */
uint16_t len; /* Length is padded to 64 bits. */
/* Followed by:
 * -Exactlyoxm_lenbytescontainingasingleOXMTLV,then
 * -Exactly((oxm_len+4)+7)/8*8- (oxm_len +4)(between0and7)
 * bytesofall-zerobytes
 */
uint8_t field[4]; /* OXM TLV - Make compiler happy */
};

thanks,
-- 
yamahata



More information about the dev mailing list