From: Ben Pfaff Date: Wed, 11 Sep 2013 04:44:53 +0000 (-0700) Subject: ofproto: New helper any_pending_ops(). X-Git-Tag: sliver-openvswitch-2.0.90-1~14^2~12 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=06b79a9a0d00293bce922ed7ba14d2159fe923e9;p=sliver-openvswitch.git ofproto: New helper any_pending_ops(). This function is trivial now but in an upcoming commit it will need to become slightly more complicated, which makes writing it as a function worthwhile. Until then, this commit simplifies the logic, which was redundant since the 'deletions' hmap always points into the 'pending' list anyway. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 1621687d6..985ed67cd 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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;