diff options
author | Alex Wang <alexw@nicira.com> | 2014-06-09 18:35:35 -0700 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2014-06-13 17:47:32 -0700 |
commit | 685acfd9ff6679a0c6b4f3a53db6b633cf40472d (patch) | |
tree | 18e96dc36d6323cc0da0896f25354974d6abad37 /ofproto | |
parent | d8043da7182aa0700e8e85a7c53929f3be054ef9 (diff) | |
download | openvswitch-685acfd9ff6679a0c6b4f3a53db6b633cf40472d.tar.gz |
cfm: Extracts the cfm status in one function.
This commit adds a new function, cfm_get_status(), for extracting
all cfm status at once. This helps avoid the sequence of lock
acquire/release in current implementation of status query.
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif.c | 8 | ||||
-rw-r--r-- | ofproto/ofproto-provider.h | 2 | ||||
-rw-r--r-- | ofproto/ofproto.c | 2 | ||||
-rw-r--r-- | ofproto/ofproto.h | 25 |
4 files changed, 5 insertions, 32 deletions
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index e6d88bc8b..9aa125545 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1811,18 +1811,14 @@ out: static int get_cfm_status(const struct ofport *ofport_, - struct ofproto_cfm_status *status) + struct cfm_status *status) { struct ofport_dpif *ofport = ofport_dpif_cast(ofport_); int ret = 0; if (ofport->cfm) { if (cfm_check_status_change(ofport->cfm)) { - status->faults = cfm_get_fault(ofport->cfm); - status->flap_count = cfm_get_flap_count(ofport->cfm); - status->remote_opstate = cfm_get_opup(ofport->cfm); - status->health = cfm_get_health(ofport->cfm); - cfm_get_remote_mpids(ofport->cfm, &status->rmps, &status->n_rmps); + cfm_get_status(ofport->cfm, status); } else { ret = NO_STATUS_CHANGE; } diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index c8d70e615..6e8cd9b8f 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -1360,7 +1360,7 @@ struct ofproto_class { * returned in 'status->rmps'. '*status' is indeterminate if the return * value is non-zero. */ int (*get_cfm_status)(const struct ofport *ofport, - struct ofproto_cfm_status *status); + struct cfm_status *status); /* Configures BFD on 'ofport'. * diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index a05a44402..fb9313b90 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3692,7 +3692,7 @@ ofproto_get_netflow_ids(const struct ofproto *ofproto, * '*status' is indeterminate if the return value is non-zero. */ int ofproto_port_get_cfm_status(const struct ofproto *ofproto, ofp_port_t ofp_port, - struct ofproto_cfm_status *status) + struct cfm_status *status) { struct ofport *ofport = ofproto_get_port(ofproto, ofp_port); return (ofport && ofproto->ofproto_class->get_cfm_status diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h index de078b7ba..5f5e6c8ed 100644 --- a/ofproto/ofproto.h +++ b/ofproto/ofproto.h @@ -399,32 +399,9 @@ void ofproto_get_netflow_ids(const struct ofproto *, void ofproto_get_ofproto_controller_info(const struct ofproto *, struct shash *); void ofproto_free_ofproto_controller_info(struct shash *); -/* CFM status query. */ -struct ofproto_cfm_status { - /* 0 if not faulted, otherwise a combination of one or more reasons. */ - enum cfm_fault_reason faults; - - /* 0 if the remote CFM endpoint is operationally down, - * 1 if the remote CFM endpoint is operationally up, - * -1 if we don't know because the remote CFM endpoint is not in extended - * mode. */ - int remote_opstate; - - uint64_t flap_count; - - /* Ordinarily a "health status" in the range 0...100 inclusive, with 0 - * being worst and 100 being best, or -1 if the health status is not - * well-defined. */ - int health; - - /* MPIDs of remote maintenance points whose CCMs have been received. */ - uint64_t *rmps; - size_t n_rmps; -}; - int ofproto_port_get_cfm_status(const struct ofproto *, ofp_port_t ofp_port, - struct ofproto_cfm_status *); + struct cfm_status *); /* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.) * |