[ovs-dev] [RFC PATCH 02/14] Add NSH fields for Openvswitch flow key
Johnson Li
johnson.li at intel.com
Tue Jun 14 12:37:32 UTC 2016
Openvswitch could use the fields of Network Serivce Header(NSH)
as key to steer traffic to the Virtual Network Functions(VNF).
Signed-off-by: Johnson Li <johnson.li at 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..2f53bfe 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, MD Type I only for the moment.
+ */
+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. */
--
1.8.4.2
More information about the dev
mailing list