[ovs-dev] [PATCH 15/18] ofp-util: Open Flow 1.1 and 1.2 flow format capabilities

Simon Horman horms at verge.net.au
Fri Oct 26 02:36:03 UTC 2012


Open Flow and 1.1 and 1.2 support some of the same
flow format capabilities as NXM.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 lib/ofp-util.c     |   30 +++++++++++++++---------------
 lib/ofp-util.h     |    3 +++
 tests/ovs-ofctl.at |    2 +-
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 3c85185..4f10553 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -977,27 +977,27 @@ ofputil_usable_protocols(const struct match *match)
     /* NXM and OF1.1+ supports bitwise matching on ethernet addresses. */
     if (!eth_mask_is_exact(wc->masks.dl_src)
         && !eth_addr_is_zero(wc->masks.dl_src)) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF11_PLUS;
     }
     if (!eth_mask_is_exact(wc->masks.dl_dst)
         && !eth_addr_is_zero(wc->masks.dl_dst)) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF11_PLUS;
     }
 
     /* NXM and OF1.1+ support matching metadata. */
     if (wc->masks.metadata != htonll(0)) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF11_PLUS;
     }
 
-    /* Only NXM supports matching ARP hardware addresses. */
+    /* NXM and OF1.2 support matching ARP hardware addresses. */
     if (!eth_addr_is_zero(wc->masks.arp_sha) ||
         !eth_addr_is_zero(wc->masks.arp_tha)) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF12;
     }
 
-    /* Only NXM supports matching IPv6 traffic. */
+    /* NXM and OF1.2 support  matching IPv6 traffic. */
     if (match->flow.dl_type == htons(ETH_TYPE_IPV6)) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF12;
     }
 
     /* Only NXM supports matching registers. */
@@ -1015,14 +1015,14 @@ ofputil_usable_protocols(const struct match *match)
         return OFPUTIL_P_NXM_ANY;
     }
 
-    /* Only NXM supports matching IPv6 flow label. */
+    /* NXM and OF1.2 support matching IPv6 flow label. */
     if (wc->masks.ipv6_label) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF12;
     }
 
-    /* Only NXM supports matching IP ECN bits. */
+    /* NXM and OF1.2 support matching IP ECN bits. */
     if (wc->masks.nw_tos & IP_ECN_MASK) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF12;
     }
 
     /* Only NXM supports matching IP TTL/hop limit. */
@@ -1030,9 +1030,9 @@ ofputil_usable_protocols(const struct match *match)
         return OFPUTIL_P_NXM_ANY;
     }
 
-    /* Only NXM supports non-CIDR IPv4 address masks. */
+    /* NXM and OF1.1+ support non-CIDR IPv4 address masks. */
     if (!ip_is_cidr(wc->masks.nw_src) || !ip_is_cidr(wc->masks.nw_dst)) {
-        return OFPUTIL_P_NXM_ANY;
+        return OFPUTIL_P_NXM_ANY_OR_OF11_PLUS;
     }
 
     /* Only NXM supports bitwise matching on transport port. */
@@ -1662,9 +1662,9 @@ ofputil_flow_mod_usable_protocols(const struct ofputil_flow_mod *fms,
             usable_protocols &= OFPUTIL_P_TID;
         }
 
-        /* Matching of the cookie is only supported through NXM. */
+        /* Matching of the cookie is only supporte through NXM and OF1.1+. */
         if (fm->cookie_mask != htonll(0)) {
-            usable_protocols &= OFPUTIL_P_NXM_ANY;
+            usable_protocols &= OFPUTIL_P_NXM_ANY_OR_OF11_PLUS;
         }
     }
     assert(usable_protocols);
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 1c3b92a..e6bf055 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -78,6 +78,9 @@ enum ofputil_protocol {
 
     /* Protocols in which a specific table may be specified in flow_mods. */
 #define OFPUTIL_P_TID (OFPUTIL_P_OF10_TID | OFPUTIL_P_NXM_TID | OFPUTIL_P_OF12)
+
+#define OFPUTIL_P_NXM_ANY_OR_OF12 (OFPUTIL_P_NXM_ANY | OFPUTIL_P_OF12)
+#define OFPUTIL_P_NXM_ANY_OR_OF11_PLUS OFPUTIL_P_NXM_ANY_OR_OF12
 };
 
 /* Protocols to use for flow dumps, from most to least preferred. */
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 1fa1a34..cb96545 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -1796,7 +1796,7 @@ AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
   [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
 ])
 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop],
-  [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
+  [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OpenFlow12) is among the allowed flow formats (OpenFlow10)
 ])
 AT_CLEANUP
 
-- 
1.7.10.4




More information about the dev mailing list