ofproto: New helper any_pending_ops().
[sliver-openvswitch.git] / ofproto / ofproto.c
index 1621687..985ed67 100644 (file)
@@ -1329,6 +1329,12 @@ ofproto_type_wait(const char *datapath_type)
     }
 }
 
+static bool
+any_pending_ops(const struct ofproto *p)
+{
+    return !list_is_empty(&p->pending);
+}
+
 int
 ofproto_run(struct ofproto *p)
 {
@@ -1411,7 +1417,7 @@ ofproto_run(struct ofproto *p)
     case S_EVICT:
         connmgr_run(p->connmgr, NULL);
         ofproto_evict(p);
-        if (list_is_empty(&p->pending) && hmap_is_empty(&p->deletions)) {
+        if (!any_pending_ops(p)) {
             p->state = S_OPENFLOW;
         }
         break;
@@ -1419,7 +1425,7 @@ ofproto_run(struct ofproto *p)
     case S_FLUSH:
         connmgr_run(p->connmgr, NULL);
         ofproto_flush__(p);
-        if (list_is_empty(&p->pending) && hmap_is_empty(&p->deletions)) {
+        if (!any_pending_ops(p)) {
             connmgr_flushed(p->connmgr);
             p->state = S_OPENFLOW;
         }
@@ -1512,7 +1518,7 @@ ofproto_wait(struct ofproto *p)
     case S_EVICT:
     case S_FLUSH:
         connmgr_wait(p->connmgr, false);
-        if (list_is_empty(&p->pending) && hmap_is_empty(&p->deletions)) {
+        if (!any_pending_ops(p)) {
             poll_immediate_wake();
         }
         break;