struct timer fault_timer; /* Check for faults when expired. */
};
+static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
+
static int
ccm_interval_to_ms(uint8_t interval)
{
cfm->fault = false;
HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
- if (rmp->recv_time < timer_enabled_at(&cfmi->fault_timer, interval)
- || timer_expired_at(&cfmi->fault_timer, rmp->recv_time)) {
- rmp->fault = true;
- }
+ rmp->fault = !rmp->recv;
+ rmp->recv = false;
if (rmp->fault) {
cfm->fault = true;
+ VLOG_DBG("No CCM from RMP %"PRIu16" in the last %lldms",
+ rmp->mpid, interval);
}
}
+ if (!cfm->fault) {
+ VLOG_DBG("All RMPs received CCMs in the last %lldms", interval);
+ }
+
timer_set_duration(&cfmi->fault_timer, interval);
}
}
uint8_t ccm_interval;
struct remote_mp *rmp;
struct eth_header *eth;
-
- struct cfm_internal *cfmi = cfm_to_internal(cfm);
- static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
+ struct cfm_internal *cfmi = cfm_to_internal(cfm);
eth = p->l2;
ccm = ofpbuf_at(p, (uint8_t *)p->l3 - (uint8_t *)p->data, CCM_LEN);
rmp = lookup_remote_mp(&cfm->remote_mps, ccm_mpid);
if (rmp) {
- rmp->recv_time = time_msec();
+ rmp->recv = true;
if (ccm_interval != cfmi->ccm_interval) {
VLOG_WARN_RL(&rl, "received a CCM with an invalid interval"
HMAP_FOR_EACH (rmp, node, &cfm->remote_mps) {
ds_put_format(ds, "Remote MPID %"PRIu16": %s\n", rmp->mpid,
rmp->fault ? "fault" : "");
- ds_put_format(ds, "\ttime since CCM rx: %lldms\n",
- time_msec() - rmp->recv_time);
+ ds_put_format(ds, "\trecv since check: %s",
+ rmp->recv ? "true" : "false");
}
}
poll_timer_wait_until(timer->t);
}
}
-
-/* Returns the time at which 'timer' was set with 'duration'. Infinite timers
- * were enabled at time LLONG_MAX. Manually expired timers were enabled at
- * LLONG_MIN. */
-long long int
-timer_enabled_at(const struct timer *timer, long long int duration)
-{
- switch (timer->t) {
- case LLONG_MAX: return LLONG_MAX;
- case LLONG_MIN: return LLONG_MIN;
- default: return timer->t - duration;
- }
-}