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 <b...@nicira.com> --- ofproto/ofproto.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 160d6b0..8b50b75f 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1327,6 +1327,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) { @@ -1409,7 +1415,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; @@ -1417,7 +1423,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; } @@ -1510,7 +1516,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; -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev