summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2015-04-07 16:16:11 -0700
committerDavid S. Miller <davem@davemloft.net>2015-04-08 12:12:11 -0400
commitc3cd9ee11dd72cfb8ff5d3dde47cd197e9b22cd2 (patch)
tree35d72ed31359b003b36d299aa7cf09a80e3ef484 /drivers/net/bonding
parent1b112871186e3ab8333851c0caf203b47d7561b9 (diff)
downloadblackbird-op-linux-c3cd9ee11dd72cfb8ff5d3dde47cd197e9b22cd2.tar.gz
blackbird-op-linux-c3cd9ee11dd72cfb8ff5d3dde47cd197e9b22cd2.zip
bonding: Code re-factoring for admin, oper-key operations
This patch breaks the rich assignments into it's own statements and removes some duplicate code where admin-key, & oper-key are updated. Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_3ad.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 374696de796c..245d0db5871d 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1428,8 +1428,10 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr)
else
port->aggregator->is_individual = true;
- port->aggregator->actor_admin_aggregator_key = port->actor_admin_port_key;
- port->aggregator->actor_oper_aggregator_key = port->actor_oper_port_key;
+ port->aggregator->actor_admin_aggregator_key =
+ port->actor_admin_port_key;
+ port->aggregator->actor_oper_aggregator_key =
+ port->actor_oper_port_key;
port->aggregator->partner_system =
port->partner_oper.system;
port->aggregator->partner_system_priority =
@@ -2332,8 +2334,8 @@ void bond_3ad_adapter_speed_changed(struct slave *slave)
spin_lock_bh(&slave->bond->mode_lock);
port->actor_admin_port_key &= ~AD_SPEED_KEY_MASKS;
- port->actor_oper_port_key = port->actor_admin_port_key |=
- (__get_link_speed(port) << 1);
+ port->actor_admin_port_key |= __get_link_speed(port) << 1;
+ port->actor_oper_port_key = port->actor_admin_port_key;
netdev_dbg(slave->bond->dev, "Port %d changed speed\n", port->actor_port_number);
/* there is no need to reselect a new aggregator, just signal the
* state machines to reinitialize
@@ -2365,8 +2367,8 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave)
spin_lock_bh(&slave->bond->mode_lock);
port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS;
- port->actor_oper_port_key = port->actor_admin_port_key |=
- __get_duplex(port);
+ port->actor_admin_port_key |= __get_duplex(port);
+ port->actor_oper_port_key = port->actor_admin_port_key;
netdev_dbg(slave->bond->dev, "Port %d slave %s changed duplex\n",
port->actor_port_number, slave->dev->name);
if (port->actor_oper_port_key & AD_DUPLEX_KEY_MASKS)
@@ -2407,24 +2409,19 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)
* on link up we are forcing recheck on the duplex and speed since
* some of he adaptors(ce1000.lan) report.
*/
+ port->actor_admin_port_key &= ~(AD_DUPLEX_KEY_MASKS|AD_SPEED_KEY_MASKS);
if (link == BOND_LINK_UP) {
port->is_enabled = true;
- port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS;
- port->actor_oper_port_key = port->actor_admin_port_key |=
- __get_duplex(port);
- port->actor_admin_port_key &= ~AD_SPEED_KEY_MASKS;
- port->actor_oper_port_key = port->actor_admin_port_key |=
- (__get_link_speed(port) << 1);
- if (port->actor_oper_port_key & AD_DUPLEX_KEY_MASKS)
+ port->actor_admin_port_key |=
+ (__get_link_speed(port) << 1) | __get_duplex(port);
+ if (port->actor_admin_port_key & AD_DUPLEX_KEY_MASKS)
port->sm_vars |= AD_PORT_LACP_ENABLED;
} else {
/* link has failed */
port->is_enabled = false;
- port->actor_admin_port_key &= ~AD_DUPLEX_KEY_MASKS;
- port->actor_oper_port_key = (port->actor_admin_port_key &=
- ~AD_SPEED_KEY_MASKS);
port->sm_vars &= ~AD_PORT_LACP_ENABLED;
}
+ port->actor_oper_port_key = port->actor_admin_port_key;
netdev_dbg(slave->bond->dev, "Port %d changed link status to %s\n",
port->actor_port_number,
link == BOND_LINK_UP ? "UP" : "DOWN");
OpenPOWER on IntegriCloud