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

Simon Horman horms at verge.net.au
Thu Oct 18 05:58:16 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 b6cb4a8..912003d 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -976,27 +976,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. */
@@ -1014,14 +1014,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. */
@@ -1029,9 +1029,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. */
@@ -1745,9 +1745,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 9bd1a35..f7f529d 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 8185827..fe0d28a 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -1794,7 +1794,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