Re: [PATCH net-next] bonding: make 802.3ad use update lacp_rate (v2)

From: AmÃrico Wang
Date: Mon Jun 06 2011 - 12:24:11 EST


On Sun, Jun 5, 2011 at 11:16 AM, Weiping Pan <panweiping3@xxxxxxxxx> wrote:
> There is a bug that when you modify lacp_rate via sysfs,
> 802.3ad won't use the new value of lacp_rate to transmit packets.
> That is because port->actor_oper_port_state isn't changed.
>
> Change Notes:
> v2)
> 1 Hold read_lock(&bond->lock) when iterate slaves, suggested by Jiri Pirko.
> 2 Modify actor_oper_port_state via a helper function in bond_3ad.c,
> suggested by Jay Vosburgh.
> 3 Hold slave->state_machine_lock,
> so we can modify port->actor_oper_port_state, no matter bond is up or down.
>
> Signed-off-by: Weiping Pan <panweiping3@xxxxxxxxx>
> ---
> Âdrivers/net/bonding/bond_3ad.c  |  27 +++++++++++++++++++++++++++
> Âdrivers/net/bonding/bond_3ad.h  |  Â1 +
> Âdrivers/net/bonding/bond_sysfs.c | Â Â1 +
> Â3 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> index c7537abc..5111e0d 100644
> --- a/drivers/net/bonding/bond_3ad.c
> +++ b/drivers/net/bonding/bond_3ad.c
> @@ -2473,3 +2473,30 @@ 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;
> +
> + Â Â Â read_lock(&bond->lock);
> + Â Â Â bond_for_each_slave(bond, slave, i) {
> + Â Â Â Â Â Â Â port = &(slave->ad_info.port);

Please use SLAVE_AD_INFO().

Other than this, it looks good to me,

Reviewed-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/