diff options
author | Ethan Jackson <ethan@nicira.com> | 2012-06-07 14:21:36 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2012-06-07 17:29:46 -0700 |
commit | 29985e75480f5133a16b8921cbce6e5a4002f5f1 (patch) | |
tree | 630008e90009c0523e24505e0ba63761916d24ce /lib/lacp.c | |
parent | 38f7147c3e7310ab3ea87420e120e2b1f2268975 (diff) |
lacp: Print may_enable flag in appctl output.
I would have found this helpful when debugging a problem recently.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/lacp.c')
-rw-r--r-- | lib/lacp.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -362,6 +362,14 @@ lacp_slave_carrier_changed(const struct lacp *lacp, const void *slave_) } } +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. */ @@ -369,11 +377,7 @@ bool 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; } @@ -788,6 +792,8 @@ lacp_print_details(struct ds *ds, struct lacp *lacp) 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)); |