[ovs-dev] [PATCH 63/63] Local Hack: Allow Open Flow 1.2 session to be negotiated

Simon Horman horms at verge.net.au
Wed Jun 27 08:20:39 UTC 2012


* request OFP12_VERSION
* Reset ofconn to OF1.2
* Allow OF1.2 to be used as a dump protocol
---
 lib/ofp-util.c    |  1 +
 lib/vconn.c       | 14 +++++++-------
 ofproto/connmgr.c |  2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index fe3d911..7a3dcd7 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1195,6 +1195,7 @@ static const struct proto_abbrev proto_abbrevs[] = {
 #define N_PROTO_ABBREVS ARRAY_SIZE(proto_abbrevs)
 
 enum ofputil_protocol ofputil_flow_dump_protocols[] = {
+    OFPUTIL_P_OF12,
     OFPUTIL_P_NXM,
     OFPUTIL_P_OF10,
 };
diff --git a/lib/vconn.c b/lib/vconn.c
index de55dc7..07240cb 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -214,7 +214,7 @@ vconn_verify_name(const char *name)
  *
  * The vconn will automatically negotiate an OpenFlow protocol version
  * acceptable to both peers on the connection.  The version negotiated will be
- * no lower than 'min_version' and no higher than OFP10_VERSION.
+ * no lower than 'min_version' and no higher than OFP12_VERSION.
  *
  * Returns 0 if successful, otherwise a positive errno value.  If successful,
  * stores a pointer to the new connection in '*vconnp', otherwise a null
@@ -385,8 +385,8 @@ vcs_send_hello(struct vconn *vconn)
     struct ofpbuf *b;
     int retval;
 
-    /* Note that here OFP10_VERSION is the maximum version supported */
-    make_openflow(sizeof(struct ofp_header), OFP10_VERSION, OFPT_HELLO, &b);
+    /* Note that here OFP12_VERSION is the maximum version supported */
+    make_openflow(sizeof(struct ofp_header), OFP12_VERSION, OFPT_HELLO, &b);
     retval = do_send(vconn, b);
     if (!retval) {
         vconn->state = VCS_RECV_HELLO;
@@ -418,13 +418,13 @@ vcs_recv_hello(struct vconn *vconn)
                 ds_destroy(&msg);
             }
 
-            vconn->version = MIN(OFP10_VERSION, oh->version);
+            vconn->version = MIN(OFP12_VERSION, oh->version);
             if (vconn->version < vconn->min_version) {
                 VLOG_WARN_RL(&bad_ofmsg_rl,
                              "%s: version negotiation failed: we support "
                              "versions 0x%02x to 0x%02x inclusive but peer "
                              "supports no later than version 0x%02"PRIx8,
-                             vconn->name, vconn->min_version, OFP10_VERSION,
+                             vconn->name, vconn->min_version, OFP12_VERSION,
                              oh->version);
                 vconn->state = VCS_SEND_ERROR;
             } else {
@@ -432,7 +432,7 @@ vcs_recv_hello(struct vconn *vconn)
                          "(we support versions 0x%02x to 0x%02x inclusive, "
                          "peer no later than version 0x%02"PRIx8")",
                          vconn->name, vconn->version, vconn->min_version,
-                         OFP10_VERSION, oh->version);
+                         OFP12_VERSION, oh->version);
                 vconn->state = VCS_CONNECTED;
             }
             ofpbuf_delete(b);
@@ -958,7 +958,7 @@ pvconn_close(struct pvconn *pvconn)
  *
  * The new vconn will automatically negotiate an OpenFlow protocol version
  * acceptable to both peers on the connection.  The version negotiated will be
- * no lower than 'min_version' and no higher than OFP10_VERSION.
+ * no lower than 'min_version' and no higher than OFP12_VERSION.
  *
  * pvconn_accept() will not block waiting for a connection.  If no connection
  * is ready to be accepted, it returns EAGAIN immediately. */
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index bd22e77..c9ca3d5 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1015,7 +1015,7 @@ ofconn_flush(struct ofconn *ofconn)
     int i;
 
     ofconn->role = NX_ROLE_OTHER;
-    ofconn->protocol = OFPUTIL_P_OF10;
+    ofconn->protocol = OFPUTIL_P_OF12;
     ofconn->packet_in_format = NXPIF_OPENFLOW10;
 
     /* Disassociate 'ofconn' from all of the ofopgroups that it initiated that
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list