Skip to content

Commit 3310f0e

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 af386b5 commit 3310f0e

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
@@ -2869,6 +2869,31 @@ void bond_3ad_update_lacp_rate(struct bonding *bond)
28692869
spin_unlock_bh(&bond->mode_lock);
28702870
}
28712871

2872+
/**
2873+
* bond_3ad_update_lacp_active - change the lacp active
2874+
* @bond: bonding struct
2875+
*
2876+
* Update actor_oper_port_state when lacp_active is modified.
2877+
*/
2878+
void bond_3ad_update_lacp_active(struct bonding *bond)
2879+
{
2880+
struct port *port = NULL;
2881+
struct list_head *iter;
2882+
struct slave *slave;
2883+
int lacp_active;
2884+
2885+
lacp_active = bond->params.lacp_active;
2886+
spin_lock_bh(&bond->mode_lock);
2887+
bond_for_each_slave(bond, slave, iter) {
2888+
port = &(SLAVE_AD_INFO(slave)->port);
2889+
if (lacp_active)
2890+
port->actor_oper_port_state |= LACP_STATE_LACP_ACTIVITY;
2891+
else
2892+
port->actor_oper_port_state &= ~LACP_STATE_LACP_ACTIVITY;
2893+
}
2894+
spin_unlock_bh(&bond->mode_lock);
2895+
}
2896+
28722897
size_t bond_3ad_stats_size(void)
28732898
{
28742899
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
@@ -1637,6 +1637,7 @@ static int bond_option_lacp_active_set(struct bonding *bond,
16371637
netdev_dbg(bond->dev, "Setting LACP active to %s (%llu)\n",
16381638
newval->string, newval->value);
16391639
bond->params.lacp_active = newval->value;
1640+
bond_3ad_update_lacp_active(bond);
16401641

16411642
return 0;
16421643
}

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)