diff mbox

[ovs-dev,CudaMailTagged,RFC,v2,01/13] Add NSH keys as match fields for user space flow table

Message ID 1468344371-11132-1-git-send-email-johnson.li@intel.com
State Changes Requested
Headers show

Commit Message

Johnson.Li July 12, 2016, 5:26 p.m. UTC
Add NSH keys (Metadata type I only, MD type II will reuse the
the fields definition tun_metadataN) as part of match fields
for the user space flow table.

Signed-off-by: Johnson Li <johnson.li@intel.com>
diff mbox

Patch

diff --git a/include/openvswitch/flow.h b/include/openvswitch/flow.h
index 03d406b..4fcc6f6 100644
--- a/include/openvswitch/flow.h
+++ b/include/openvswitch/flow.h
@@ -100,6 +100,9 @@  struct flow {
     ovs_be16 vlan_tci;          /* If 802.1Q, TCI | VLAN_CFI; otherwise 0. */
     ovs_be32 mpls_lse[ROUND_UP(FLOW_MAX_MPLS_LABELS, 2)]; /* MPLS label stack
                                                              (with padding). */
+    /* Network Service Header */
+    struct flow_nsh nsh;
+
     /* L3 (64-bit aligned) */
     ovs_be32 nw_src;            /* IPv4 source address. */
     ovs_be32 nw_dst;            /* IPv4 destination address. */
@@ -129,7 +132,7 @@  BUILD_ASSERT_DECL(sizeof(struct flow_tnl) % sizeof(uint64_t) == 0);
 
 /* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */
 BUILD_ASSERT_DECL(offsetof(struct flow, igmp_group_ip4) + sizeof(uint32_t)
-                  == sizeof(struct flow_tnl) + 216
+                  == sizeof(struct flow_tnl) + sizeof (struct flow_nsh) + 216
                   && FLOW_WC_SEQ == 35);
 
 /* Incremental points at which flow classification may be performed in
diff --git a/include/openvswitch/packets.h b/include/openvswitch/packets.h
index 5d97309..4c7ec31 100644
--- a/include/openvswitch/packets.h
+++ b/include/openvswitch/packets.h
@@ -61,4 +61,23 @@  union flow_in_port {
     ofp_port_t ofp_port;
 };
 
+/* Network Service Header For flow and Metadata */
+struct flow_nsh {
+    uint8_t flags;
+    uint8_t md_type;
+    uint8_t next_proto;
+    uint8_t nsi;
+    ovs_be32 nsp;
+    ovs_be32 nshc1;
+    ovs_be32 nshc2;
+    ovs_be32 nshc3;
+    ovs_be32 nshc4;
+};
+
+/* NSH flags */
+#define FLOW_NSH_F_OAM (1 << 0)
+#define FLOW_NSH_F_CTX (1 << 1)
+
+#define FLOW_NSH_F_MASK ((1 << 2) - 1)
+
 #endif /* packets.h */