diff options
| -rw-r--r-- | drivers/net/bonding/bond_3ad.c | 31 | ||||
| -rw-r--r-- | drivers/net/bonding/bond_3ad.h | 1 | ||||
| -rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 1 |
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 | */ | ||
| 2485 | void 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); | |||
| 282 | void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, | 282 | void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, |
| 283 | struct slave *slave); | 283 | struct slave *slave); |
| 284 | int bond_3ad_set_carrier(struct bonding *bond); | 284 | int bond_3ad_set_carrier(struct bonding *bond); |
| 285 | void 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); |
