summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2011-04-01 13:22:44 -0700
committerEthan Jackson <ethan@nicira.com>2011-04-01 13:36:38 -0700
commit9aa952b2dd7c091c63dbfc7becb3b3dcc9f7bfce (patch)
treeb0bcec7195b4005b9f8856068ee455aa67b3a3ee /lib
parent43675e260ccc26f8278fd751436af125a18bee38 (diff)
downloadopenvswitch-9aa952b2dd7c091c63dbfc7becb3b3dcc9f7bfce.tar.gz
cfm: cfm_configure() only update when necessary.
Calling cfm_configure often could cause timers to be reset resulting in unexpected behavior. This commit only updates when cfm configuration actually changed. Bug #5244.
Diffstat (limited to 'lib')
-rw-r--r--lib/cfm.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/cfm.c b/lib/cfm.c
index f6cfb2e67..f9b348863 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -230,19 +230,24 @@ cfm_wait(struct cfm *cfm)
bool
cfm_configure(struct cfm *cfm)
{
- struct cfm_internal *cfmi;
+ struct cfm_internal *cfmi = cfm_to_internal(cfm);
+ uint8_t interval;
if (!cfm_is_valid_mpid(cfm->mpid) || !cfm->interval) {
return false;
}
- cfmi = cfm_to_internal(cfm);
- cfmi->ccm_interval = ms_to_ccm_interval(cfm->interval);
- cfmi->ccm_interval_ms = ccm_interval_to_ms(cfmi->ccm_interval);
+ interval = ms_to_ccm_interval(cfm->interval);
+
+ if (interval != cfmi->ccm_interval) {
+ cfmi->ccm_interval = interval;
+ cfmi->ccm_interval_ms = ccm_interval_to_ms(interval);
+
+ /* Force a resend and check in case anything changed. */
+ timer_set_expired(&cfmi->tx_timer);
+ timer_set_expired(&cfmi->fault_timer);
+ }
- /* Force a resend and check in case anything changed. */
- timer_set_expired(&cfmi->tx_timer);
- timer_set_expired(&cfmi->fault_timer);
return true;
}