summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2011-03-31 13:55:23 -0700
committerEthan Jackson <ethan@nicira.com>2011-03-31 16:19:33 -0700
commit79e745c9aea483fcc67bfe42891156ba28929e08 (patch)
tree3f153009839796a041c322897359ab0f040dd64e /ofproto
parent6fabb78d45211260c388979baab5b757ec76e33e (diff)
downloadopenvswitch-79e745c9aea483fcc67bfe42891156ba28929e08.tar.gz
ofproto: Use new timer library.
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 7cdc98adf..78a5005be 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -58,6 +58,7 @@
#include "stream-ssl.h"
#include "svec.h"
#include "tag.h"
+#include "timer.h"
#include "timeval.h"
#include "unaligned.h"
#include "unixctl.h"
@@ -296,7 +297,7 @@ struct ofproto {
/* Flow table. */
struct classifier cls;
- long long int next_expiration;
+ struct timer next_expiration;
/* Facets. */
struct hmap facets;
@@ -404,7 +405,7 @@ ofproto_create(const char *datapath, const char *datapath_type,
/* Initialize flow table. */
classifier_init(&p->cls);
- p->next_expiration = time_msec() + 1000;
+ timer_set_duration(&p->next_expiration, 1000);
/* Initialize facet table. */
hmap_init(&p->facets);
@@ -779,9 +780,9 @@ ofproto_run1(struct ofproto *p)
connmgr_run(p->connmgr, handle_openflow);
- if (time_msec() >= p->next_expiration) {
+ if (timer_expired(&p->next_expiration)) {
int delay = ofproto_expire(p);
- p->next_expiration = time_msec() + delay;
+ timer_set_duration(&p->next_expiration, delay);
COVERAGE_INC(ofproto_expiration);
}
@@ -844,8 +845,8 @@ ofproto_wait(struct ofproto *p)
/* Shouldn't happen, but if it does just go around again. */
VLOG_DBG_RL(&rl, "need revalidate in ofproto_wait_cb()");
poll_immediate_wake();
- } else if (p->next_expiration != LLONG_MAX) {
- poll_timer_wait_until(p->next_expiration);
+ } else {
+ timer_wait(&p->next_expiration);
}
connmgr_wait(p->connmgr);
}