Openvswitch could use the fields of Network Serivce Header(NSH) as key to steer traffic to the Virtual Network Functions(VNF). The key will contain fields for NSH base header, service path header and context header for MD type 1. For MD type 2, will reuse the field definition tun_opts.
Signed-off-by: Johnson Li <johnson...@intel.com> diff --git a/datapath/flow.c b/datapath/flow.c index c97c9c9..fd09cec 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -489,6 +489,9 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key) skb_reset_mac_len(skb); __skb_push(skb, skb->data - skb_mac_header(skb)); + /* Network Service Header */ + memset(&key->nsh, 0, sizeof(key->nsh)); + /* Network layer. */ if (key->eth.type == htons(ETH_P_IP)) { struct iphdr *nh; diff --git a/datapath/flow.h b/datapath/flow.h index c0b628a..6ac96c3 100644 --- a/datapath/flow.h +++ b/datapath/flow.h @@ -54,10 +54,25 @@ struct ovs_tunnel_info { (offsetof(struct sw_flow_key, recirc_id) + \ FIELD_SIZEOF(struct sw_flow_key, recirc_id)) +/* Network Service Header. + */ +struct ovs_nsh_key { + u8 flags; + u8 md_type; /* NSH metadata type */ + u8 next_proto; /* NSH next protocol */ + u8 nsi; /* NSH index */ + u32 nsp; /* NSH path id */ + u32 nshc1; /* NSH context C1-C4 */ + u32 nshc2; + u32 nshc3; + u32 nshc4; +} __packed __aligned(4); /* Minimize padding. */ + struct sw_flow_key { u8 tun_opts[255]; u8 tun_opts_len; struct ip_tunnel_key tun_key; /* Encapsulating tunnel key. */ + struct ovs_nsh_key nsh; /* Network service header */ struct { u32 priority; /* Packet QoS priority. */ u32 skb_mark; /* SKB mark. */ diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 1defb11..eafaca2 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -284,7 +284,7 @@ size_t ovs_key_attr_size(void) /* Whenever adding new OVS_KEY_ FIELDS, we should consider * updating this function. */ - BUILD_BUG_ON(OVS_KEY_ATTR_TUNNEL_INFO != 26); + BUILD_BUG_ON(OVS_KEY_ATTR_TUNNEL_INFO != 27); return nla_total_size(4) /* OVS_KEY_ATTR_PRIORITY */ + nla_total_size(0) /* OVS_KEY_ATTR_TUNNEL */ -- 1.8.4.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev