diff mbox

[ovs-dev,07/23] ovn-controller: Un-inline get_chassis_by_name().

Message ID 1444450544-11845-8-git-send-email-blp@nicira.com
State Accepted
Headers show

Commit Message

Ben Pfaff Oct. 10, 2015, 4:15 a.m. UTC
I don't know of any reason to inline this.

Also rename for consistency with get_bridge().

Signed-off-by: Ben Pfaff <blp@nicira.com>
---
 ovn/controller/binding.c        |  4 ++--
 ovn/controller/chassis.c        |  4 ++--
 ovn/controller/ovn-controller.c | 14 ++++++++++++++
 ovn/controller/ovn-controller.h | 15 ++-------------
 4 files changed, 20 insertions(+), 17 deletions(-)

Comments

Justin Pettit Oct. 15, 2015, 9:04 p.m. UTC | #1
> On Oct 9, 2015, at 9:15 PM, Ben Pfaff <blp@nicira.com> wrote:
> 
> I don't know of any reason to inline this.

Well, obviously because it's on the critical path.  It has to do with registers and CPU caches and stuff--you wouldn't understand.

> Also rename for consistency with get_bridge().
> 
> Signed-off-by: Ben Pfaff <blp@nicira.com>

Acked-by: Justin Pettit <jpettit@nicira.com>

--Justin
Ben Pfaff Oct. 16, 2015, 4:28 a.m. UTC | #2
On Thu, Oct 15, 2015 at 02:04:26PM -0700, Justin Pettit wrote:
> 
> > On Oct 9, 2015, at 9:15 PM, Ben Pfaff <blp@nicira.com> wrote:
> > 
> > I don't know of any reason to inline this.
> 
> Well, obviously because it's on the critical path.  It has to do with
> registers and CPU caches and stuff--you wouldn't understand.

Dude, don't get all TLB on me.

> > Also rename for consistency with get_bridge().
> > 
> > Signed-off-by: Ben Pfaff <blp@nicira.com>
> 
> Acked-by: Justin Pettit <jpettit@nicira.com>

Thanks, applied to master.
diff mbox

Patch

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index fca2430..b2f2a19 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -84,7 +84,7 @@  binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
         return;
     }
 
-    chassis_rec = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+    chassis_rec = get_chassis(ctx->ovnsb_idl, chassis_id);
     if (!chassis_rec) {
         return;
     }
@@ -142,7 +142,7 @@  binding_cleanup(struct controller_ctx *ctx, const char *chassis_id)
         return true;
     }
     const struct sbrec_chassis *chassis_rec
-        = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+        = get_chassis(ctx->ovnsb_idl, chassis_id);
     if (!chassis_rec) {
         return true;
     }
diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
index 9d6a77a..abe2e4d 100644
--- a/ovn/controller/chassis.c
+++ b/ovn/controller/chassis.c
@@ -43,7 +43,7 @@  chassis_run(struct controller_ctx *ctx, const char *chassis_id)
     struct sbrec_encap *encap_rec;
     static bool inited = false;
 
-    chassis_rec = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+    chassis_rec = get_chassis(ctx->ovnsb_idl, chassis_id);
 
     /* xxx Need to support more than one encap.  Also need to support
      * xxx encap options. */
@@ -110,7 +110,7 @@  chassis_cleanup(struct controller_ctx *ctx, const char *chassis_id)
 
     /* Delete Chassis row. */
     const struct sbrec_chassis *chassis_rec
-        = get_chassis_by_name(ctx->ovnsb_idl, chassis_id);
+        = get_chassis(ctx->ovnsb_idl, chassis_id);
     if (!chassis_rec) {
         return true;
     }
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index f1bc524..0371c38 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -57,6 +57,20 @@  OVS_NO_RETURN static void usage(void);
 
 static char *ovs_remote;
 
+const struct sbrec_chassis *
+get_chassis(struct ovsdb_idl *ovnsb_idl, const char *chassis_id)
+{
+    const struct sbrec_chassis *chassis_rec;
+
+    SBREC_CHASSIS_FOR_EACH(chassis_rec, ovnsb_idl) {
+        if (!strcmp(chassis_rec->name, chassis_id)) {
+            break;
+        }
+    }
+
+    return chassis_rec;
+}
+
 static const struct ovsrec_bridge *
 get_bridge(struct ovsdb_idl *ovs_idl, const char *br_name)
 {
diff --git a/ovn/controller/ovn-controller.h b/ovn/controller/ovn-controller.h
index be89b5f..9766bc3 100644
--- a/ovn/controller/ovn-controller.h
+++ b/ovn/controller/ovn-controller.h
@@ -27,18 +27,7 @@  struct controller_ctx {
     struct ovsdb_idl_txn *ovs_idl_txn;
 };
 
-static inline const struct sbrec_chassis *
-get_chassis_by_name(struct ovsdb_idl *ovnsb_idl, const char *chassis_id)
-{
-    const struct sbrec_chassis *chassis_rec;
-
-    SBREC_CHASSIS_FOR_EACH(chassis_rec, ovnsb_idl) {
-        if (!strcmp(chassis_rec->name, chassis_id)) {
-            break;
-        }
-    }
-
-    return chassis_rec;
-}
+const struct sbrec_chassis *get_chassis(struct ovsdb_idl *,
+                                        const char *chassis_id);
 
 #endif /* ovn/ovn-controller.h */