Skip to content

Commit f0c7885

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 ca88ac4 commit f0c7885

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
@@ -2734,6 +2734,31 @@ void bond_3ad_update_lacp_rate(struct bonding *bond)
27342734
spin_unlock_bh(&bond->mode_lock);
27352735
}
27362736

2737+
/**
2738+
* bond_3ad_update_lacp_active - change the lacp active
2739+
* @bond: bonding struct
2740+
*
2741+
* Update actor_oper_port_state when lacp_active is modified.
2742+
*/
2743+
void bond_3ad_update_lacp_active(struct bonding *bond)
2744+
{
2745+
struct port *port = NULL;
2746+
struct list_head *iter;
2747+
struct slave *slave;
2748+
int lacp_active;
2749+
2750+
lacp_active = bond->params.lacp_active;
2751+
spin_lock_bh(&bond->mode_lock);
2752+
bond_for_each_slave(bond, slave, iter) {
2753+
port = &(SLAVE_AD_INFO(slave)->port);
2754+
if (lacp_active)
2755+
port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY;
2756+
else
2757+
port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY;
2758+
}
2759+
spin_unlock_bh(&bond->mode_lock);
2760+
}
2761+
27372762
size_t bond_3ad_stats_size(void)
27382763
{
27392764
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
@@ -1618,6 +1618,7 @@ static int bond_option_lacp_active_set(struct bonding *bond,
16181618
netdev_dbg(bond->dev, "Setting LACP active to %s (%llu)\n",
16191619
newval->string, newval->value);
16201620
bond->params.lacp_active = newval->value;
1621+
bond_3ad_update_lacp_active(bond);
16211622

16221623
return 0;
16231624
}

include/net/bond_3ad.h

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

0 commit comments

Comments
 (0)