}
}
+static bool
+slave_may_enable__(struct slave *slave)
+{
+ /* The slave may be enabled if it's attached to an aggregator and its
+ * partner is synchronized.*/
+ return slave->attached && (slave->partner.state & LACP_STATE_SYNC);
+}
+
/* This function should be called before enabling 'slave_' to send or receive
* traffic. If it returns false, 'slave_' should not enabled. As a
* convenience, returns true if 'lacp' is NULL. */
lacp_slave_may_enable(const struct lacp *lacp, const void *slave_)
{
if (lacp) {
- struct slave *slave = slave_lookup(lacp, slave_);
-
- /* The slave may be enabled if it's attached to an aggregator and its
- * partner is synchronized.*/
- return slave->attached && (slave->partner.state & LACP_STATE_SYNC);
+ return slave_may_enable__(slave_lookup(lacp, slave_));
} else {
return true;
}
slave->attached ? "attached" : "detached");
ds_put_format(ds, "\tport_id: %u\n", slave->port_id);
ds_put_format(ds, "\tport_priority: %u\n", slave->port_priority);
+ ds_put_format(ds, "\tmay_enable: %s\n", (slave_may_enable__(slave)
+ ? "true" : "false"));
ds_put_format(ds, "\n\tactor sys_id: " ETH_ADDR_FMT "\n",
ETH_ADDR_ARGS(actor.sys_id));
slave: p1: expired attached
port_id: 1
port_priority: 65535
+ may_enable: false
actor sys_id: aa:55:aa:55:00:00
actor sys_priority: 65535
slave: p1: expired attached
port_id: 11
port_priority: 111
+ may_enable: false
actor sys_id: 11:22:33:44:55:66
actor sys_priority: 54321
slave: p2: expired attached
port_id: 22
port_priority: 222
+ may_enable: false
actor sys_id: 11:22:33:44:55:66
actor sys_priority: 54321