[ovs-dev] [PATCH 11/11] ofp-util: Allow OF1.2 to be used as a dump protocol

Simon Horman horms at verge.net.au
Thu Sep 20 04:10:50 UTC 2012


Allow OF1.2 to be used as a dump protocol and limit
the underling OpenFlow version for which a dump
protocol may be used.

Signed-off-by: Simon Horman <horms at verge.net.au>

---

v14
* No change

v13
* No change

v12
* No change

v11
* Initial post
---
 lib/ofp-util.c        |    7 ++++---
 lib/ofp-util.h        |    7 ++++++-
 utilities/ovs-ofctl.c |    9 +++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 265f943..f3a420a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -585,9 +585,10 @@ static const struct proto_abbrev proto_abbrevs[] = {
 };
 #define N_PROTO_ABBREVS ARRAY_SIZE(proto_abbrevs)
 
-enum ofputil_protocol ofputil_flow_dump_protocols[] = {
-    OFPUTIL_P_NXM,
-    OFPUTIL_P_OF10,
+struct proto_dump_ofp ofputil_flow_dump_protocols[] = {
+    { .dump = OFPUTIL_P_OF12, .ofp = OFPUTIL_P_OF12 },
+    { .dump = OFPUTIL_P_NXM,  .ofp = OFPUTIL_P_OF10 },
+    { .dump = OFPUTIL_P_OF10, .ofp = OFPUTIL_P_OF10 },
 };
 size_t ofputil_n_flow_dump_protocols = ARRAY_SIZE(ofputil_flow_dump_protocols);
 
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 2233ff3..7f46fbf 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -81,7 +81,12 @@ enum ofputil_protocol {
 };
 
 /* Protocols to use for flow dumps, from most to least preferred. */
-extern enum ofputil_protocol ofputil_flow_dump_protocols[];
+struct proto_dump_ofp {
+    enum ofputil_protocol dump;
+    enum ofputil_protocol ofp;
+};
+
+extern struct proto_dump_ofp ofputil_flow_dump_protocols[];
 extern size_t ofputil_n_flow_dump_protocols;
 
 enum ofputil_protocol
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 9127161..986800f 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -789,10 +789,11 @@ set_protocol_for_flow_dump(struct vconn *vconn,
     int i;
 
     for (i = 0; i < ofputil_n_flow_dump_protocols; i++) {
-        enum ofputil_protocol f = ofputil_flow_dump_protocols[i];
-        if (f & usable_protocols & allowed_protocols
-            && try_set_protocol(vconn, f, &cur_protocol)) {
-            return f;
+        struct proto_dump_ofp pdo = ofputil_flow_dump_protocols[i];
+        if (cur_protocol == pdo.ofp
+            && pdo.dump & usable_protocols & allowed_protocols
+            && try_set_protocol(vconn, pdo.dump, &cur_protocol)) {
+            return pdo.dump;
         }
     }
 
-- 
1.7.10.4




More information about the dev mailing list