Skip to content

Commit b64d035

Browse files
liuhangbinPaolo Abeni
authored andcommitted
bonding: update LACP activity flag after setting lacp_active
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>
1 parent c42be53 commit b64d035

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

drivers/net/bonding/bond_3ad.c

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

2886+
/**
2887+
* bond_3ad_update_lacp_active - change the lacp active
2888+
* @bond: bonding struct
2889+
*
2890+
* Update actor_oper_port_state when lacp_active is modified.
2891+
*/
2892+
void bond_3ad_update_lacp_active(struct bonding *bond)
2893+
{
2894+
struct port *port = NULL;
2895+
struct list_head *iter;
2896+
struct slave *slave;
2897+
int lacp_active;
2898+
2899+
lacp_active = bond->params.lacp_active;
2900+
spin_lock_bh(&bond->mode_lock);
2901+
bond_for_each_slave(bond, slave, iter) {
2902+
port = &(SLAVE_AD_INFO(slave)->port);
2903+
if (lacp_active)
2904+
port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY;
2905+
else
2906+
port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY;
2907+
}
2908+
spin_unlock_bh(&bond->mode_lock);
2909+
}
2910+
28862911
size_t bond_3ad_stats_size(void)
28872912
{
28882913
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
@@ -1660,6 +1660,7 @@ static int bond_option_lacp_active_set(struct bonding *bond,
16601660
netdev_dbg(bond->dev, "Setting LACP active to %s (%llu)\n",
16611661
newval->string, newval->value);
16621662
bond->params.lacp_active = newval->value;
1663+
bond_3ad_update_lacp_active(bond);
16631664

16641665
return 0;
16651666
}

include/net/bond_3ad.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ int bond_3ad_lacpdu_recv(const struct sk_buff *skb, struct bonding *bond,
307307
struct slave *slave);
308308
int bond_3ad_set_carrier(struct bonding *bond);
309309
void bond_3ad_update_lacp_rate(struct bonding *bond);
310+
void bond_3ad_update_lacp_active(struct bonding *bond);
310311
void bond_3ad_update_ad_actor_settings(struct bonding *bond);
311312
int bond_3ad_stats_fill(struct sk_buff *skb, struct bond_3ad_stats *stats);
312313
size_t bond_3ad_stats_size(void);

0 commit comments

Comments
 (0)