The cfm_get_opup() function's result doesn't make sense when CFM is not configured in extended mode. This patch makes it report -1 in this case. Future patches will rely on this behavior.
Signed-off-by: Ethan Jackson <et...@nicira.com> --- lib/cfm.c | 8 ++++++-- lib/cfm.h | 2 +- ofproto/ofproto-dpif.c | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/cfm.c b/lib/cfm.c index 134d8b7..a497dfa 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -686,10 +686,14 @@ cfm_get_health(const struct cfm *cfm) * if it has received a CCM with the operationally down bit set from any of its * remote maintenance points. Returns true if 'cfm' is operationally up. False * otherwise. */ -bool +int cfm_get_opup(const struct cfm *cfm) { - return cfm->remote_opup; + if (cfm->extended) { + return cfm->remote_opup; + } else { + return -1; + } } /* Populates 'rmps' with an array of remote maintenance points reachable by diff --git a/lib/cfm.h b/lib/cfm.h index 628d539..de4c299 100644 --- a/lib/cfm.h +++ b/lib/cfm.h @@ -71,7 +71,7 @@ bool cfm_should_process_flow(const struct cfm *cfm, const struct flow *); void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet); int cfm_get_fault(const struct cfm *); int cfm_get_health(const struct cfm *); -bool cfm_get_opup(const struct cfm *); +int cfm_get_opup(const struct cfm *); void cfm_get_remote_mpids(const struct cfm *, const uint64_t **rmps, size_t *n_rmps); const char *cfm_fault_reason_to_str(int fault); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 95195a3..5851dcd 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2464,9 +2464,14 @@ port_run(struct ofport_dpif *ofport) port_run_fast(ofport); if (ofport->cfm) { + int cfm_opup = cfm_get_opup(ofport->cfm); + cfm_run(ofport->cfm); - enable = enable && !cfm_get_fault(ofport->cfm) - && cfm_get_opup(ofport->cfm); + enable = enable && !cfm_get_fault(ofport->cfm); + + if (cfm_opup >= 0) { + enable = enable && cfm_opup; + } } if (ofport->bundle) { -- 1.7.11.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev