[ovs-dev] [PATCH 5/6] Generic encap and decap support for NSH

Yang, Yi Y yi.y.yang at intel.com
Sun Jul 23 00:42:40 UTC 2017


Jiri, thank you for your comments.

I have used "#ifndef __KERNEL__" for OVS_KEY_ATTR_NSH in local version, will send it as v2 after generic encap & decap patch series are merged.

OVS_ENCAP_NSH_MAX_MD_LEN is also for MD type 2, so I used a maximum value, is a size-variable " struct ovs_action_encap_nsh " as needed possible?

For netlink attributes, Jan suggested we could use only one attribute OVS_KEY_ATTR_NSH to put the whole nsh keys.

About action names, I think encap_* & decap_* will be better, this can make people map to corresponding generic encap & decap, in addition, encap has different semantics from push, encap just adds an empty header, set_field actions must fill in fields in header. You know encap & decap are names used in OpenFlow spec draft, they aren't named as push & pop, this is my explanation for you :-)

-----Original Message-----
From: Jiri Benc [mailto:jbenc at redhat.com] 
Sent: Friday, July 21, 2017 8:08 PM
To: Yang, Yi Y <yi.y.yang at intel.com>
Cc: dev at openvswitch.org
Subject: Re: [ovs-dev] [PATCH 5/6] Generic encap and decap support for NSH

My comments apply more to the yet to be submitted kernel part. Until then, I agree with Joe that all of this should be inside #ifndef __KERNEL__. But these are comments I'd have at netdev thus you may as well change that for v2 (or explain that I'm wrong).

On Wed,  5 Jul 2017 11:45:42 +0800, Yi Yang wrote:
> +#define OVS_ENCAP_NSH_MAX_MD_LEN 256

This makes the size set in stone forever. I believe it is not what you want.

Netlink is based on attributes for the purpose of future extensibility and that's exactly what's needed here. The 'metadata' field should be in its own attribute (or, rather, attributes).

> +/*
> + * struct ovs_action_encap_nsh - %OVS_ACTION_ATTR_ENCAP_NSH
> + * @flags: NSH header flags.
> + * @mdtype: NSH metadata type.
> + * @mdlen: Length of NSH metadata in bytes.
> + * @np: NSH next_protocol: Inner packet type.
> + * @path_hdr: NSH service path id and service index.
> + * @metadata: NSH metadata for MD type 1 or 2  */ struct 
> +ovs_action_encap_nsh {

Please call this push_nsh to be consistent with other similar uses (MPLS, Ethernet).

> +    uint8_t flags;
> +    uint8_t mdtype;
> +    uint8_t mdlen;
> +    uint8_t np;
> +    __be32 path_hdr;
> +    uint8_t metadata[OVS_ENCAP_NSH_MAX_MD_LEN];
> +};
> +
>  /**
>   * enum ovs_nat_attr - Attributes for %OVS_CT_ATTR_NAT.
>   *
> @@ -870,6 +889,8 @@ enum ovs_nat_attr {
>   * @OVS_ACTION_ATTR_PUSH_ETH: Push a new outermost Ethernet header onto the
>   * packet.
>   * @OVS_ACTION_ATTR_POP_ETH: Pop the outermost Ethernet header off the packet.
> + * @OVS_ACTION_ATTR_ENCAP_NSH: encap NSH action to push NSH header.
> + * @OVS_ACTION_ATTR_DECAP_NSH: decap NSH action to remove NSH header.
>   *
>   * Only a single header can be set with a single %OVS_ACTION_ATTR_SET.  Not all
>   * fields within a header are modifiable, e.g. the IPv4 protocol and 
> fragment @@ -905,6 +926,8 @@ enum ovs_action_attr {
>  	OVS_ACTION_ATTR_TRUNC,        /* u32 struct ovs_action_trunc. */
>  	OVS_ACTION_ATTR_PUSH_ETH,     /* struct ovs_action_push_eth. */
>  	OVS_ACTION_ATTR_POP_ETH,      /* No argument. */
> +	OVS_ACTION_ATTR_ENCAP_NSH,    /* struct ovs_action_encap_nsh. */
> +	OVS_ACTION_ATTR_DECAP_NSH,    /* No argument. */

Likewise, this should be PUSH and POP, not ENCAP and DECAP.

Thanks,

 Jiri


More information about the dev mailing list