[ovs-dev] [CudaMailTagged] [RFC PATCH 03/14] Add NSH keys as match fields for user space flow table

Johnson Li johnson.li at intel.com
Tue Jun 7 18:09:45 UTC 2016


Add NSH keys (Metadata type I only) as part of match fields for
the user space flow table.

Signed-off-by: Johnson Li <johnson.li at intel.com>

diff --git a/include/openvswitch/flow.h b/include/openvswitch/flow.h
index 03d406b..5f3cd39 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) + 240
                   && 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 */
-- 
1.8.4.2




More information about the dev mailing list