X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fcfm.c;h=1b326252902c21b98f644fc247f317ec9b9d23db;hb=5767a79a40599e5e6e70662833b27ffdbdab7e37;hp=6a173a70915c1b1c1bd9a2e083ecf3ace1d42e61;hpb=88bf179aa3f3fa89822edcd9b882e0f06d39bf08;p=sliver-openvswitch.git diff --git a/lib/cfm.c b/lib/cfm.c index 6a173a709..1b3262529 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -137,6 +137,11 @@ struct cfm { /* True when the variables returned by cfm_get_*() are changed * since last check. */ bool status_changed; + + /* When 'cfm->demand' is set, at least one ccm is required to be received + * every 100 * cfm_interval. If ccm is not received within this interval, + * even if data packets are received, the cfm fault will be set. */ + struct timer demand_rx_ccm_t; }; /* Remote MPs represent foreign network entities that are configured to have @@ -459,7 +464,8 @@ cfm_run(struct cfm *cfm) OVS_EXCLUDED(mutex) if (cfm->demand) { uint64_t rx_packets = cfm_rx_packets(cfm); demand_override = hmap_count(&cfm->remote_mps) == 1 - && rx_packets > cfm->rx_packets; + && rx_packets > cfm->rx_packets + && !timer_expired(&cfm->demand_rx_ccm_t); cfm->rx_packets = rx_packets; } @@ -836,6 +842,10 @@ cfm_process_heartbeat(struct cfm *cfm, const struct ofpbuf *p) rmp->mpid = ccm_mpid; if (!cfm_fault) { rmp->num_health_ccm++; + if (cfm->demand) { + timer_set_duration(&cfm->demand_rx_ccm_t, + 100 * cfm->ccm_interval_ms); + } } rmp->recv = true; cfm->recv_fault |= cfm_fault;