/*
- * Copyright (c) 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
static const uint8_t *
-cfm_ccm_addr(const struct cfm *cfm)
+cfm_ccm_addr(struct cfm *cfm)
{
bool extended;
atomic_read(&cfm->extended, &extended);
* as a fault (likely due to a configuration error). Thus we can check all
* MPs at once making this quite a bit simpler.
*
- * According to the specification we should check when (ccm_interval_ms *
- * 3.5)ms have passed. */
- return (cfm->ccm_interval_ms * 7) / 2;
+ * When cfm is not in demand mode, we check when (ccm_interval_ms * 3.5) ms
+ * have passed. When cfm is in demand mode, we check when
+ * (MAX(ccm_interval_ms, 500) * 3.5) ms have passed. This ensures that
+ * ovs-vswitchd has enough time to pull statistics from the datapath. */
+
+ return (MAX(cfm->ccm_interval_ms, cfm->demand ? 500 : cfm->ccm_interval_ms)
+ * 7) / 2;
}
static uint8_t
}
if (s->extended && s->demand) {
- interval_ms = MAX(interval_ms, 500);
if (!cfm->demand) {
cfm->demand = true;
cfm->rx_packets = cfm_rx_packets(cfm);
/* Returns true if 'cfm' should process packets from 'flow'. Sets
* fields in 'wc' that were used to make the determination. */
bool
-cfm_should_process_flow(const struct cfm *cfm, const struct flow *flow,
+cfm_should_process_flow(const struct cfm *cfm_, const struct flow *flow,
struct flow_wildcards *wc)
{
+ struct cfm *cfm = CONST_CAST(struct cfm *, cfm_);
bool check_tnl_key;
atomic_read(&cfm->check_tnl_key, &check_tnl_key);
ccm_seq = ntohl(ccm->seq);
if (ccm_interval != cfm->ccm_interval) {
- cfm_fault |= CFM_FAULT_INTERVAL;
VLOG_WARN_RL(&rl, "%s: received a CCM with an unexpected interval"
" (%"PRIu8") from RMP %"PRIu64, cfm->name,
ccm_interval, ccm_mpid);
if (extended && ccm_interval == 0
&& ccm_interval_ms_x != cfm->ccm_interval_ms) {
- cfm_fault |= CFM_FAULT_INTERVAL;
VLOG_WARN_RL(&rl, "%s: received a CCM with an unexpected extended"
" interval (%"PRIu16"ms) from RMP %"PRIu64, cfm->name,
ccm_interval_ms_x, ccm_mpid);
* 'cfm' is operationally down, or -1 if 'cfm' has no operational state
* (because it isn't in extended mode). */
int
-cfm_get_opup(const struct cfm *cfm) OVS_EXCLUDED(mutex)
+cfm_get_opup(const struct cfm *cfm_) OVS_EXCLUDED(mutex)
{
+ struct cfm *cfm = CONST_CAST(struct cfm *, cfm_);
bool extended;
int opup;
OVS_EXCLUDED(mutex)
{
ovs_mutex_lock(&mutex);
- *rmps = xmemdup(cfm->rmps_array, cfm->rmps_array_len);
+ *rmps = xmemdup(cfm->rmps_array, cfm->rmps_array_len * sizeof **rmps);
*n_rmps = cfm->rmps_array_len;
ovs_mutex_unlock(&mutex);
}
}
static void
-cfm_print_details(struct ds *ds, const struct cfm *cfm) OVS_REQUIRES(mutex)
+cfm_print_details(struct ds *ds, struct cfm *cfm) OVS_REQUIRES(mutex)
{
struct remote_mp *rmp;
bool extended;
void *aux OVS_UNUSED) OVS_EXCLUDED(mutex)
{
struct ds ds = DS_EMPTY_INITIALIZER;
- const struct cfm *cfm;
+ struct cfm *cfm;
ovs_mutex_lock(&mutex);
if (argc > 1) {