[ovs-dev] [PATCH 05/18] connmgr: Paramatise ofservice_create() over allowed OpenFlow versions

Simon Horman horms at verge.net.au
Thu Oct 18 05:58:05 UTC 2012


This is in preparation for allowing configuration of the
allowed OpenFlow versions.

Signed-off-by: Simon Horman <horms at verge.net.au>
---
 ofproto/connmgr.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index d63a166..17d9fb5 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -137,7 +137,9 @@ struct ofservice {
 
 static void ofservice_reconfigure(struct ofservice *,
                                   const struct ofproto_controller *);
-static int ofservice_create(struct connmgr *, const char *target, uint8_t dscp);
+static int ofservice_create(struct connmgr *mgr, const char *target,
+                            struct ofputil_version_bitmap *allowed_versions,
+                            uint8_t dscp);
 static void ofservice_destroy(struct connmgr *, struct ofservice *);
 static struct ofservice *ofservice_lookup(struct connmgr *,
                                           const char *target);
@@ -511,9 +513,13 @@ connmgr_set_controllers(struct connmgr *mgr,
             }
         } else if (!pvconn_verify_name(c->target)) {
             if (!ofservice_lookup(mgr, c->target)) {
+                struct ofputil_version_bitmap ovb =
+                    OFPUTIL_VERSION_BITMAP_INITIALIZER;
                 VLOG_INFO("%s: added service controller \"%s\"",
                           mgr->name, c->target);
-                ofservice_create(mgr, c->target, c->dscp);
+                ofputil_version_bitmap_set1(&ovb, OFP10_VERSION);
+                ofservice_create(mgr, c->target, &ovb, c->dscp);
+                ofputil_version_bitmap_free_data(&ovb);
             }
         } else {
             VLOG_WARN_RL(&rl, "%s: unsupported controller \"%s\"",
@@ -1622,16 +1628,15 @@ connmgr_flushed(struct connmgr *mgr)
  * ofservice_reconfigure() must be called to fully configure the new
  * ofservice. */
 static int
-ofservice_create(struct connmgr *mgr, const char *target, uint8_t dscp)
+ofservice_create(struct connmgr *mgr, const char *target,
+                 struct ofputil_version_bitmap *allowed_versions,
+                 uint8_t dscp)
 {
-    struct ofputil_version_bitmap ovb = OFPUTIL_VERSION_BITMAP_INITIALIZER;
     struct ofservice *ofservice;
     struct pvconn *pvconn;
     int error;
 
-    ofputil_version_bitmap_set1(&ovb, OFP10_VERSION);
-    error = pvconn_open(target, &ovb, &pvconn, dscp);
-    ofputil_version_bitmap_free_data(&ovb);
+    error = pvconn_open(target, allowed_versions, &pvconn, dscp);
     if (error) {
         return error;
     }
-- 
1.7.10.4




More information about the dev mailing list