I don't think this actually fixes a bug, as netdev-linux calls this
function. However, it seems stylistically more correct.
---
 lib/dpif-linux.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 9a90801..a793cda 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -146,6 +146,9 @@ struct dpif_linux {
 
 static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5);
 
+/* Guard for dpif_linux_run() and dpif_linux_wait(). */
+static bool has_run = false;
+
 /* Generic Netlink family numbers for ODP. */
 static int odp_datapath_family;
 static int odp_vport_family;
@@ -308,6 +311,24 @@ dpif_linux_destroy(struct dpif *dpif_)
     return dpif_linux_dp_transact(&dp, NULL, NULL);
 }
 
+static void
+dpif_linux_run(struct dpif *dpif OVS_UNUSED)
+{
+    /* We only need to run once for all dpif_linux instances.  Hence the
+     * 'has_run' guard. */
+    if (!has_run) {
+        has_run = true;
+        rtnetlink_link_notifier_run();
+    }
+}
+
+static void
+dpif_linux_wait(struct dpif *dpif OVS_UNUSED)
+{
+    has_run = false;
+    rtnetlink_link_notifier_wait();
+}
+
 static int
 dpif_linux_get_stats(const struct dpif *dpif_, struct odp_stats *stats)
 {
@@ -1048,8 +1069,8 @@ const struct dpif_class dpif_linux_class = {
     dpif_linux_open,
     dpif_linux_close,
     dpif_linux_destroy,
-    NULL,                       /* run */
-    NULL,                       /* wait */
+    dpif_linux_run,
+    dpif_linux_wait,
     dpif_linux_get_stats,
     dpif_linux_get_drop_frags,
     dpif_linux_set_drop_frags,
-- 
1.7.6

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to