On Sep 20, 2013, at 1:04 AM, pritesh <pritesh.koth...@cisco.com> wrote:

> Support for setting nsi using an action namely set_nsi. It works similar to
> set_tunnel in vxlan/gre tunnel and can be used to set the outgoing nsh
> service index (nsi).
> 

Again, a new action is not necessary, "load", "move", and "set_field" can be
used instead.

> Signed-off-by: pritesh <pritesh.koth...@cisco.com>
> 
> diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
> index 748ceee..3872d57 100644
> --- a/include/openflow/nicira-ext.h
> +++ b/include/openflow/nicira-ext.h
> @@ -313,6 +313,7 @@ enum nx_action_subtype {
>     NXAST_STACK_POP,            /* struct nx_action_stack */
>     NXAST_SAMPLE,               /* struct nx_action_sample */
>     NXAST_SET_NSP,              /* struct nx_action_set_nsp */
> +    NXAST_SET_NSI,              /* struct nx_action_set_nsi */
> };
> 
> /* Header for Nicira-defined actions. */
> @@ -1799,6 +1800,20 @@ OFP_ASSERT(sizeof(struct nx_action_output_reg) == 24);
> #define NXM_NX_NSP     NXM_HEADER  (0x0001, 34, 4)
> #define NXM_NX_NSP_W   NXM_HEADER_W(0x0001, 34, 4)
> 
> +/* NSH Service Index.
> + *
> + * For a packet received via a VXLAN tunnel, it includes a (8-bit)
> + * network service header service index (nsi).
> + *
> + * Prereqs: None.
> + *
> + * Format: 8-bit integer.
> + *
> + * Masking: Arbitrary masks. */
> +#define NXM_NX_NSI     NXM_HEADER  (0x0001, 35, 1)
> +#define NXM_NX_NSI_W   NXM_HEADER_W(0x0001, 35, 1)

Should document in the commit message that also a new NXM type is added.
This enables matching and setting the new field.

> +
> +
> /* ## --------------------- ## */
> /* ## Requests and replies. ## */
> /* ## --------------------- ## */
> @@ -2325,4 +2340,17 @@ struct nx_action_set_nsp {
> };
> OFP_ASSERT(sizeof(struct nx_action_set_nsp) == 16);
> 
> +/* Action structure for NXAST_SET_NSI.
> + *
> + * Sets the encapsulating NSH service index to a 8-bit value. */
> +struct nx_action_set_nsi {
> +    ovs_be16 type;                  /* OFPAT_VENDOR. */
> +    ovs_be16 len;                   /* Length is 16. */
> +    ovs_be32 vendor;                /* NX_VENDOR_ID. */
> +    ovs_be16 subtype;               /* NXAST_SET_NSI. */
> +    uint8_t nsi;                    /* NSH service index. */
> +    uint8_t pad[5];
> +};
> +OFP_ASSERT(sizeof(struct nx_action_set_nsi) == 16);
> +
> #endif /* openflow/nicira-ext.h */
> diff --git a/lib/meta-flow.c b/lib/meta-flow.c
> index 8e11de0..3c52f1f 100644
> --- a/lib/meta-flow.c
> +++ b/lib/meta-flow.c
> @@ -718,7 +718,7 @@ static const struct mf_field mf_fields[MFF_N_IDS] = {
>         MFS_HEXADECIMAL,
>         MFP_NONE,
>         false,

Make this "true" to mark the field as writeable. 

> -        0, NULL,
> +        NXM_NX_NSI, "NXM_NX_NSI",
>         0, NULL,
>         OFPUTIL_P_OF10_NXM_ANY,
>         OFPUTIL_P_OF10_NXM_ANY,

These need to be:

        OFPUTIL_P_NXM_OXM_ANY,
        OFPUTIL_P_NXM_OXM_ANY,

to signify that any protocol version that can encode NXM  or OXM can use this 
field.


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

Reply via email to