Skip to content

Commit b0b8376

Browse files
liuhangbingregkh
authored andcommitted
bonding: update LACP activity flag after setting lacp_active
[ Upstream commit b64d035 ] The port's actor_oper_port_state activity flag should be updated immediately after changing the lacp_active option to reflect the current mode correctly. Fixes: 3a755cd ("bonding: add new option lacp_active") Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Link: https://patch.msgid.link/20250815062000.22220-2-liuhangbin@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d63ce84 commit b0b8376

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/net/bonding/bond_3ad.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,31 @@ void bond_3ad_update_lacp_rate(struct bonding *bond)
27252725
spin_unlock_bh(&bond->mode_lock);
27262726
}
27272727

2728+
/**
2729+
* bond_3ad_update_lacp_active - change the lacp active
2730+
* @bond: bonding struct
2731+
*
2732+
* Update actor_oper_port_state when lacp_active is modified.
2733+
*/
2734+
void bond_3ad_update_lacp_active(struct bonding *bond)
2735+
{
2736+
struct port *port = NULL;
2737+
struct list_head *iter;
2738+
struct slave *slave;
2739+
int lacp_active;
2740+
2741+
lacp_active = bond->params.lacp_active;
2742+
spin_lock_bh(&bond->mode_lock);
2743+
bond_for_each_slave(bond, slave, iter) {
2744+
port = &(SLAVE_AD_INFO(slave)->port);
2745+
if (lacp_active)
2746+
port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY;
2747+
else
2748+
port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY;
2749+
}
2750+
spin_unlock_bh(&bond->mode_lock);
2751+
}
2752+
27282753
size_t bond_3ad_stats_size(void)
27292754
{
27302755
return nla_total_size_64bit(sizeof(u64)) + /* BOND_3AD_STAT_LACPDU_RX */

drivers/net/bonding/bond_options.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,7 @@ static int bond_option_lacp_active_set(struct bonding *bond,
16341634
netdev_dbg(bond->dev, "Setting LACP active to %s (%llu)\n",
16351635
newval->string, newval->value);
16361636
bond->params.lacp_active = newval->value;
1637+
bond_3ad_update_lacp_active(bond);
16371638

16381639
return 0;
16391640
}

include/net/bond_3ad.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
303303
int bond_3ad_set_carrier(struct bonding *bond);
304304
void bond_3ad_update_lacp_active(struct bonding *bond);
305305
void bond_3ad_update_lacp_rate(struct bonding *bond);
306+
void bond_3ad_update_lacp_active(struct bonding *bond);
306307
void bond_3ad_update_ad_actor_settings(struct bonding *bond);
307308
int bond_3ad_stats_fill(struct sk_buff *skb, struct bond_3ad_stats *stats);
308309
size_t bond_3ad_stats_size(void);

0 commit comments

Comments
 (0)