aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Pan(潘卫平) <panweiping3@gmail.com>2011-06-08 17:19:01 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-09 18:02:18 -0400
commitba824a8b2d77942d51ce45ed721f65764c00ab50 (patch)
tree87fd6d0d6358faf1fe41e1e5a79e4ff5b5a85397
parentb880a954b9e2585ce325aedd76e4741880cab180 (diff)
bonding: make 802.3ad use latest lacp_rate
There is bug that when you modify lacp_rate via sysfs, 802.3ad won't use the new value of lacp_rate to transmit packets. This is because port->actor_oper_port_state isn't changed. Signed-off-by: Weiping Pan <panweiping3@gmail.com> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bond_3ad.c31
-rw-r--r--drivers/net/bonding/bond_3ad.h1
-rw-r--r--drivers/net/bonding/bond_sysfs.c1
3 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index c7537abca4f2..4512bc459d33 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2473,3 +2473,34 @@ void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
2473 bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); 2473 bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
2474 read_unlock(&bond->lock); 2474 read_unlock(&bond->lock);
2475} 2475}
2476
2477/*
2478 * When modify lacp_rate parameter via sysfs,
2479 * update actor_oper_port_state of each port.
2480 *
2481 * Hold slave->state_machine_lock,
2482 * so we can modify port->actor_oper_port_state,
2483 * no matter bond is up or down.
2484 */
2485void bond_3ad_update_lacp_rate(struct bonding *bond)
2486{
2487 int i;
2488 struct slave *slave;
2489 struct port *port = NULL;
2490 int lacp_fast;
2491
2492 read_lock(&bond->lock);
2493 lacp_fast = bond->params.lacp_fast;
2494
2495 bond_for_each_slave(bond, slave, i) {
2496 port = &(SLAVE_AD_INFO(slave).port);
2497 __get_state_machine_lock(port);
2498 if (lacp_fast)
2499 port->actor_oper_port_state |= AD_STATE_LACP_TIMEOUT;
2500 else
2501 port->actor_oper_port_state &= ~AD_STATE_LACP_TIMEOUT;
2502 __release_state_machine_lock(port);
2503 }
2504
2505 read_unlock(&bond->lock);
2506}
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index 0ee3f1632c46..e466faf3d6fd 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -282,5 +282,6 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
282void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, 282void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
283 struct slave *slave); 283 struct slave *slave);
284int bond_3ad_set_carrier(struct bonding *bond); 284int bond_3ad_set_carrier(struct bonding *bond);
285void bond_3ad_update_lacp_rate(struct bonding *bond);
285#endif //__BOND_3AD_H__ 286#endif //__BOND_3AD_H__
286 287
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 88fcb25e554a..03d1196b844d 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -804,6 +804,7 @@ static ssize_t bonding_store_lacp(struct device *d,
804 804
805 if ((new_value == 1) || (new_value == 0)) { 805 if ((new_value == 1) || (new_value == 0)) {
806 bond->params.lacp_fast = new_value; 806 bond->params.lacp_fast = new_value;
807 bond_3ad_update_lacp_rate(bond);
807 pr_info("%s: Setting LACP rate to %s (%d).\n", 808 pr_info("%s: Setting LACP rate to %s (%d).\n",
808 bond->dev->name, bond_lacp_tbl[new_value].modename, 809 bond->dev->name, bond_lacp_tbl[new_value].modename,
809 new_value); 810 new_value);