All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Vosburgh <jv@jvosburgh.net>
To: Louis Scalbert <louis.scalbert@6wind.com>
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	fbl@redhat.com, andy@greyhouse.net, shemminger@vyatta.com,
	maheshb@google.com, jonas.gorski@gmail.com, horms@kernel.org
Subject: Re: [PATCH net v8 4/6] bonding: 3ad: fix carrier when no usable slaves
Date: Mon, 08 Jun 2026 14:37:22 -0700	[thread overview]
Message-ID: <1041444.1780954642@famine> (raw)
In-Reply-To: <20260603150331.1919611-5-louis.scalbert@6wind.com>

Louis Scalbert <louis.scalbert@6wind.com> wrote:

>Apply the "lacp_strict" configuration from the previous commit.
>
>"lacp_strict" mode "on" asserts that the bonding master carrier is up
>only when at least 'min_links' slaves are in the Collecting_Distributing
>state.
>
>Fixes: 655f8919d549 ("bonding: add min links parameter to 802.3ad")
>Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
>---
> drivers/net/bonding/bond_3ad.c     | 26 +++++++++++++++++++++++---
> drivers/net/bonding/bond_options.c |  1 +
> 2 files changed, 24 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index f0aa7d2f2171..98abb2fdd7a6 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -745,6 +745,21 @@ static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
> 	}
> }
> 
>+static int __agg_usable_ports(struct aggregator *agg)
>+{
>+	struct port *port;
>+	int valid = 0;
>+
>+	for (port = agg->lag_ports; port;
>+	     port = port->next_port_in_aggregator) {
>+		if (port->actor_oper_port_state & LACP_STATE_COLLECTING &&
>+		    port->actor_oper_port_state & LACP_STATE_DISTRIBUTING)
>+			valid++;
>+	}
>+
>+	return valid;
>+}
>+
> static int __agg_active_ports(struct aggregator *agg)
> {
> 	struct port *port;
>@@ -1179,10 +1194,10 @@ static void ad_mux_machine(struct port *port, bool *update_slave_arr)
> 		switch (port->sm_mux_state) {
> 		case AD_MUX_DETACHED:
> 			port->actor_oper_port_state &= ~LACP_STATE_SYNCHRONIZATION;
>-			ad_disable_collecting_distributing(port,
>-							   update_slave_arr);
> 			port->actor_oper_port_state &= ~LACP_STATE_COLLECTING;
> 			port->actor_oper_port_state &= ~LACP_STATE_DISTRIBUTING;
>+			ad_disable_collecting_distributing(port,
>+							   update_slave_arr);

	Is there a functional reason to move this?  I don't see anything
obvious in ad_disable_collecting_distributing() that depends on the
actor_oper_port_state.  Since you want this to be backported via stable,
fewer actual changes reduce the chances of an issue applying the patch
to an older version.

	-J


> 			port->ntt = true;
> 			break;
> 		case AD_MUX_WAITING:
>@@ -2105,6 +2120,7 @@ static void ad_disable_distributing(struct port *port, bool *update_slave_arr)
> 			  port->actor_port_number,
> 			  aggregator->aggregator_identifier);
> 		__disable_distributing_port(port);
>+		bond_3ad_set_carrier(port->slave->bond);
> 		/* Slave array needs an update */
> 		*update_slave_arr = true;
> 	}
>@@ -2128,6 +2144,7 @@ static void ad_enable_collecting_distributing(struct port *port,
> 			  port->actor_port_number,
> 			  aggregator->aggregator_identifier);
> 		__enable_port(port);
>+		bond_3ad_set_carrier(port->slave->bond);
> 		/* Slave array needs update */
> 		*update_slave_arr = true;
> 		/* Should notify peers if possible */
>@@ -2151,6 +2168,7 @@ static void ad_disable_collecting_distributing(struct port *port,
> 			  port->actor_port_number,
> 			  aggregator->aggregator_identifier);
> 		__disable_port(port);
>+		bond_3ad_set_carrier(port->slave->bond);
> 		/* Slave array needs an update */
> 		*update_slave_arr = true;
> 	}
>@@ -2830,7 +2848,9 @@ int bond_3ad_set_carrier(struct bonding *bond)
> 	active = __get_active_agg(&(SLAVE_AD_INFO(first_slave)->aggregator));
> 	if (active) {
> 		/* are enough slaves available to consider link up? */
>-		if (__agg_active_ports(active) < bond->params.min_links) {
>+		if ((bond->params.lacp_strict ? __agg_usable_ports(active)
>+					: __agg_active_ports(active)) <
>+		    bond->params.min_links) {
> 			if (netif_carrier_ok(bond->dev)) {
> 				netif_carrier_off(bond->dev);
> 				goto out;
>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>index d358b831df77..94b7b0851f16 100644
>--- a/drivers/net/bonding/bond_options.c
>+++ b/drivers/net/bonding/bond_options.c
>@@ -1706,6 +1706,7 @@ static int bond_option_lacp_strict_set(struct bonding *bond,
> 	netdev_dbg(bond->dev, "Setting LACP fallback to %s (%llu)\n",
> 		   newval->string, newval->value);
> 	bond->params.lacp_strict = newval->value;
>+	bond_3ad_set_carrier(bond);
> 
> 	return 0;
> }
>-- 
>2.39.2
>

---
	-Jay Vosburgh, jv@jvosburgh.net

  reply	other threads:[~2026-06-08 21:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 15:03 [PATCH net v8 0/6] bonding: 3ad: fix carrier state with no usable slaves Louis Scalbert
2026-06-03 15:03 ` [PATCH net v8 1/6] tools: missed broadcast_neigh if_link uapi header Louis Scalbert
2026-06-08 21:16   ` Jay Vosburgh
2026-06-08 21:20     ` Jay Vosburgh
2026-06-03 15:03 ` [PATCH net v8 2/6] netlink: specs: rt-link: missed broadcast-neigh Louis Scalbert
2026-06-03 15:03 ` [PATCH net v8 3/6] bonding: 3ad: add lacp_strict configuration knob Louis Scalbert
2026-06-03 15:03 ` [PATCH net v8 4/6] bonding: 3ad: fix carrier when no usable slaves Louis Scalbert
2026-06-08 21:37   ` Jay Vosburgh [this message]
2026-06-09  7:56     ` Louis Scalbert
2026-06-09  8:54       ` Paolo Abeni
2026-06-03 15:03 ` [PATCH net v8 5/6] bonding: 3ad: fix mux port state on oper down Louis Scalbert
2026-06-03 15:03 ` [PATCH net v8 6/6] selftests: bonding: add test for lacp_strict mode Louis Scalbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1041444.1780954642@famine \
    --to=jv@jvosburgh.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=andy@greyhouse.net \
    --cc=edumazet@google.com \
    --cc=fbl@redhat.com \
    --cc=horms@kernel.org \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=louis.scalbert@6wind.com \
    --cc=maheshb@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.