[ovs-dev] How to define enum raw constants for two new vendor actions

Ben Pfaff blp at ovn.org
Tue Mar 15 15:25:27 UTC 2016


Please don't drop the mailing list.

OK, so you'll have to add code to support the new vendor actions, some
in build-aux/extract-ofp-msgs, some in ofp-actions.c.

If it's your vendor code then you can use any types you want.

On Tue, Mar 15, 2016 at 11:36:20AM +0530, Ajmer Singh wrote:
> Hi Ben,
> 
> With all due respect! I have read the entire comments for this data type
> but have doubt for below two comments.
> 
>  #The vendor is OF for standard OpenFlow actions, NX for Nicira
>  *           extension actions.  (Support for other vendors can be added,
> but
>  *           it can't be done just based on a vendor ID definition alone
>  *           because OpenFlow doesn't define a standard way to specify a
>  *           subtype for vendor actions, so other vendors might do it
> different
>  *           from Nicira.)
> 
> #The type, in parentheses, is the action type number (for standard
>  *           OpenFlow actions) or subtype (for vendor extension actions).
> 
> We are defining two new actions for GTP (STRIP & ENCAP). As per my
> understanding these are not standard OpenFlow actions that's why OF will
> not be the vendor, then question is who will? what should be the value of
> Vendor here. NX will definitely not.
> 
> Regarding type, I think these values don't match with standard OpenFlow
> actions structure defined in Openflow specification. then what should be
> the value in our case.
> 
> Regards,
> Ajmer
> 
> 
> On Mon, Mar 14, 2016 at 8:55 PM, Ben Pfaff <blp at ovn.org> wrote:
> 
> > On Mon, Mar 14, 2016 at 06:47:34PM +0530, Ajmer Singh wrote:
> > > Hi,
> > > I have a requirement of adding GTP headers in open Vswitch source code.
> > We
> > > need to define 2 new actions: STRIP_GTP and ENCAP_GTP. these are the
> > > extensions.
> > >
> > > As per openflow specifications 1.0 and 1.1. If we add our 2 new actions
> > > then following structure will look like as follows.
> > >
> > > enum ofp_action_type {
> > >     OFPAT_OUTPUT = 0,        /* Output to switch port. */
> > >     OFPAT_COPY_TTL_OUT = 11, /* Copy TTL "outwards" -- from
> > > next-to-outermost
> > >                                 to outermost */
> > >     OFPAT_COPY_TTL_IN = 12,  /* Copy TTL "inwards" -- from outermost to
> > >                                 next-to-outermost */
> > >     OFPAT_SET_MPLS_TTL = 15, /* MPLS TTL */
> > >     OFPAT_DEC_MPLS_TTL = 16, /* Decrement MPLS TTL */
> > >     OFPAT_PUSH_VLAN = 17,    /* Push a new VLAN tag */
> > >     OFPAT_POP_VLAN = 18,     /* Pop the outer VLAN tag */
> > >     OFPAT_PUSH_MPLS = 19,    /* Push a new MPLS tag */
> > >     OFPAT_POP_MPLS = 20,     /* Pop the outer MPLS tag */
> > >     OFPAT_SET_QUEUE = 21,    /* Set queue id when outputting to a port */
> > >     OFPAT_GROUP = 22,        /* Apply group. */
> > >     OFPAT_SET_NW_TTL = 23,   /* IP TTL. */
> > >     OFPAT_DEC_NW_TTL = 24,   /* Decrement IP TTL. */
> > >     OFPAT_SET_FIELD = 25,    /* Set a header field using OXM TLV format.
> > */
> > >     OFPAT_PUSH_PBB = 26,     /*Push a new PBB service tag (I-TAG) */
> > >     OFPAT_POP_PBB = 27,      /* Pop the outer PBB service tag (I-TAG) */
> > >     OFPAT_STRIP_GTP = 0xfffd,  /* Strip GTP to get inner payload.  */
> > >     OFPAT_ENCAP_GTP = 0xfffe,  /* Add external IP header, UDP header and
> > > GTP header */
> > >     OFPAT_EXPERIMENTER = 0xffff
> > > };
> > > but I try to support this in open Vswitch code. and I find there is one
> > raw
> > > action structure named as ofp_raw_action_type (/lib/ofp-actions.c),
> > defined
> > > as.
> > >
> > > enum ofp_raw_action_type {
> > > /* ## ----------------- ## */
> > > /* ## Standard actions. ## */
> > > /* ## ----------------- ## */
> > >
> > >     /* OF1.0(0): struct ofp10_action_output. */
> > >     OFPAT_RAW10_OUTPUT,
> > >     /* OF1.1+(0): struct ofp11_action_output. */
> > >     OFPAT_RAW11_OUTPUT,
> > > }
> > >
> > > now I need to add Raw enum constants for these 2 new actions (STRIP_GTP
> > and
> > > ENCAP_GTP) in this structure. we have same structures for these 2 new
> > > actions across all openflow versions. but facing issue in defining
> > comment
> > > line before these constants.
> > > /* OF1.0(0): struct ofp10_action_output. */
> > > here, OF->for standard open flow actions
> > > 1.0->openflow protocol version
> > > (0)->action type number in specification
> > > struct ofp10_action_output -> corresponding structure for this action.
> > >
> > > Here, I m facing issue in defining these comments since these two new
> > > actions are not standard openflow actions. these are vendor actions. then
> > > how to write the comments for these new actions.
> >
> > Did you read the large comment just above enum ofp_raw_action_type?  It
> > has lots of information.
> >



More information about the dev mailing list