]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
bonding: make 802.3ad use latest lacp_rate
authorPeter Pan(潘卫平) <panweiping3@gmail.com>
Wed, 8 Jun 2011 21:19:01 +0000 (21:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Jun 2011 22:02:18 +0000 (15:02 -0700)
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>
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_3ad.h
drivers/net/bonding/bond_sysfs.c

index c7537abca4f2e78e9da4b62874700503efc5f9ea..4512bc459d3362416c2e45f8df1083ae05a023ab 100644 (file)
@@ -2473,3 +2473,34 @@ void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
        bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
        read_unlock(&bond->lock);
 }
+
+/*
+ * When modify lacp_rate parameter via sysfs,
+ * update actor_oper_port_state of each port.
+ *
+ * Hold slave->state_machine_lock,
+ * so we can modify port->actor_oper_port_state,
+ * no matter bond is up or down.
+ */
+void bond_3ad_update_lacp_rate(struct bonding *bond)
+{
+       int i;
+       struct slave *slave;
+       struct port *port = NULL;
+       int lacp_fast;
+
+       read_lock(&bond->lock);
+       lacp_fast = bond->params.lacp_fast;
+
+       bond_for_each_slave(bond, slave, i) {
+               port = &(SLAVE_AD_INFO(slave).port);
+               __get_state_machine_lock(port);
+               if (lacp_fast)
+                       port->actor_oper_port_state |= AD_STATE_LACP_TIMEOUT;
+               else
+                       port->actor_oper_port_state &= ~AD_STATE_LACP_TIMEOUT;
+               __release_state_machine_lock(port);
+       }
+
+       read_unlock(&bond->lock);
+}
index 0ee3f1632c465e6eef58c644c1ea7cef163a485a..e466faf3d6fd5208c5f4be05a575112cf70e2de1 100644 (file)
@@ -282,5 +282,6 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
 void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
                          struct slave *slave);
 int bond_3ad_set_carrier(struct bonding *bond);
+void bond_3ad_update_lacp_rate(struct bonding *bond);
 #endif //__BOND_3AD_H__
 
index 88fcb25e554a1f92205246771040149e3fce6967..03d1196b844da619bea8f9f218e8da8580fbff73 100644 (file)
@@ -804,6 +804,7 @@ static ssize_t bonding_store_lacp(struct device *d,
 
        if ((new_value == 1) || (new_value == 0)) {
                bond->params.lacp_fast = new_value;
+               bond_3ad_update_lacp_rate(bond);
                pr_info("%s: Setting LACP rate to %s (%d).\n",
                        bond->dev->name, bond_lacp_tbl[new_value].modename,
                        new_value);