static void port_run(struct ofport_dpif *);
static void port_wait(struct ofport_dpif *);
-static int set_cfm(struct ofport *, const struct cfm *,
- const uint16_t *remote_mps, size_t n_remote_mps);
+static int set_cfm(struct ofport *, const struct cfm_settings *);
struct ofproto_dpif {
struct ofproto up;
struct ofproto_dpif *ofproto = ofproto_dpif_cast(port->up.ofproto);
bundle_remove(port_);
- set_cfm(port_, NULL, NULL, 0);
+ set_cfm(port_, NULL);
if (ofproto->sflow) {
ofproto_sflow_del_port(ofproto->sflow, port->odp_port);
}
}
static int
-set_cfm(struct ofport *ofport_, const struct cfm *cfm,
- const uint16_t *remote_mps, size_t n_remote_mps)
+set_cfm(struct ofport *ofport_, const struct cfm_settings *s)
{
struct ofport_dpif *ofport = ofport_dpif_cast(ofport_);
int error;
- if (!cfm) {
+ if (!s) {
error = 0;
} else {
if (!ofport->cfm) {
ofport->cfm = cfm_create();
}
- ofport->cfm->mpid = cfm->mpid;
- ofport->cfm->interval = cfm->interval;
- ofport->cfm->name = cfm->name;
- memcpy(ofport->cfm->maid, cfm->maid, CCM_MAID_LEN);
-
- cfm_update_remote_mps(ofport->cfm, remote_mps, n_remote_mps);
-
- if (cfm_configure(ofport->cfm)) {
+ if (cfm_configure(ofport->cfm, s)) {
return 0;
}
}
static int
-get_cfm(struct ofport *ofport_, const struct cfm **cfmp)
+get_cfm_fault(const struct ofport *ofport_)
{
struct ofport_dpif *ofport = ofport_dpif_cast(ofport_);
- *cfmp = ofport->cfm;
- return 0;
+
+ return ofport->cfm ? cfm_get_fault(ofport->cfm) : -1;
}
\f
/* Bundles. */
LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
bool may_enable = lacp_slave_may_enable(bundle->lacp, port);
- bond_slave_set_lacp_may_enable(bundle->bond, port, may_enable);
+
+ if (may_enable && port->cfm) {
+ may_enable = !cfm_get_fault(port->cfm);
+ }
+ bond_slave_set_may_enable(bundle->bond, port, may_enable);
}
bond_run(bundle->bond, &bundle->ofproto->revalidate_set,
if (cfm_should_send_ccm(ofport->cfm)) {
struct ofpbuf packet;
- struct ccm *ccm;
ofpbuf_init(&packet, 0);
- ccm = eth_compose(&packet, eth_addr_ccm, ofport->up.opp.hw_addr,
- ETH_TYPE_CFM, sizeof *ccm);
- cfm_compose_ccm(ofport->cfm, ccm);
+ cfm_compose_ccm(ofport->cfm, &packet, ofport->up.opp.hw_addr);
send_packet(ofproto_dpif_cast(ofport->up.ofproto),
ofport->odp_port, &packet);
ofpbuf_uninit(&packet);
port_poll,
port_poll_wait,
port_is_lacp_current,
+ NULL, /* rule_choose_table */
rule_alloc,
rule_construct,
rule_destruct,
get_netflow_ids,
set_sflow,
set_cfm,
- get_cfm,
+ get_cfm_fault,
bundle_set,
bundle_remove,
mirror_set,