diff options
author | Alex Wang <alexw@nicira.com> | 2013-10-16 03:32:33 +0000 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2013-10-16 18:08:05 -0700 |
commit | 526d174aaba5f3aa99e4294e89ca41cce96dbd35 (patch) | |
tree | 0b9e73bd7868232209ae9635f185dbbfd90ed2a4 /lib/cfm.c | |
parent | 88e4462e611540ce57554dcbb6794df57f7bf7b7 (diff) | |
download | openvswitch-526d174aaba5f3aa99e4294e89ca41cce96dbd35.tar.gz |
cfm: Add cfm_wake_time() function.
This commit adds a new function "cfm_wake_time()" that returns the
next wakeup time associated with the "struct cfm".
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/cfm.c')
-rw-r--r-- | lib/cfm.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -580,12 +580,27 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet, void cfm_wait(struct cfm *cfm) OVS_EXCLUDED(mutex) { + poll_timer_wait_until(cfm_wake_time(cfm)); +} + + +/* Returns the next cfm wakeup time. */ +long long int +cfm_wake_time(struct cfm *cfm) OVS_EXCLUDED(mutex) +{ + long long int retval; + + if (!cfm) { + return LLONG_MAX; + } + ovs_mutex_lock(&mutex); - timer_wait(&cfm->tx_timer); - timer_wait(&cfm->fault_timer); + retval = MIN(cfm->tx_timer.t, cfm->fault_timer.t); ovs_mutex_unlock(&mutex); + return retval; } + /* Configures 'cfm' with settings from 's'. */ bool cfm_configure(struct cfm *cfm, const struct cfm_settings *s) |