public inbox for netdev@vger.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, jandrew+netdev@lunn.ch,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	fbl@redhat.com, andy@greyhouse.net, shemminger@vyatta.com
Subject: Re: [PATCH net 1/2] bonding: 3ad: fix carrier when no valid slaves
Date: Wed, 18 Mar 2026 18:14:26 -0700	[thread overview]
Message-ID: <1943614.1773882866@famine> (raw)
In-Reply-To: <20260316131838.3257889-2-louis.scalbert@6wind.com>

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

>When an 802.3ad (LACP) bonding interface has no slaves in the
>collecting/distributing state, the bonding master may still report
>carrier as up. In this situation, no slave is actually able to transmit
>or receive traffic.
>
>As a result, upper-layer daemons consider the interface operational
>while traffic is effectively blackholed.
>
>Fix this by asserting carrier only when at least 'min_links' slaves are
>in the collecting/distributing state (or collecting only if the
>coupled_control default behavior is disabled).
>
>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 | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index af7f74cfdc08..7d7661972c5e 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -745,6 +745,22 @@ static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
> 	}
> }
> 
>+static int __agg_valid_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->slave->bond->params.coupled_control ||
>+		     port->actor_oper_port_state & LACP_STATE_DISTRIBUTING))
>+			valid++;
>+	}
>+
>+	return valid;
>+}

	Did you consider instead rolling the COLLECTING / DISTRIBUTING
test into __agg_active_ports?  It appears at first glance that the users
of __agg_active_ports would do the right thing with the "able to
communicate" logic.

	As an example, logically the aggregator selection logic should
count "usable" ports, not simply ports that are enabled and may or may
not be usable.

	-J

>+
> static int __agg_active_ports(struct aggregator *agg)
> {
> 	struct port *port;
>@@ -2120,6 +2136,7 @@ static void ad_enable_collecting_distributing(struct port *port,
> 			  port->actor_port_number,
> 			  port->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 */
>@@ -2141,6 +2158,7 @@ static void ad_disable_collecting_distributing(struct port *port,
> 			  port->actor_port_number,
> 			  port->aggregator->aggregator_identifier);
> 		__disable_port(port);
>+		bond_3ad_set_carrier(port->slave->bond);
> 		/* Slave array needs an update */
> 		*update_slave_arr = true;
> 	}
>@@ -2819,8 +2837,8 @@ 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) {
>+		/* are enough slaves in collecting (and distributing) state to consider link up? */
>+		if (__agg_valid_ports(active) < bond->params.min_links) {
> 			if (netif_carrier_ok(bond->dev)) {
> 				netif_carrier_off(bond->dev);
> 				goto out;
>-- 
>2.39.2
>

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

  reply	other threads:[~2026-03-19  1:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 13:18 [PATCH net 0/2] bonding: 3ad: fix carrier state with no valid slaves Louis Scalbert
2026-03-16 13:18 ` [PATCH net 1/2] bonding: 3ad: fix carrier when " Louis Scalbert
2026-03-19  1:14   ` Jay Vosburgh [this message]
2026-03-20 14:06     ` Louis Scalbert
2026-03-16 13:18 ` [PATCH net 2/2] bonding: 3ad: fix mux port state on oper down Louis Scalbert
2026-03-19  1:40   ` Jay Vosburgh
2026-03-20 10:01     ` 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=1943614.1773882866@famine \
    --to=jv@jvosburgh.net \
    --cc=andy@greyhouse.net \
    --cc=edumazet@google.com \
    --cc=fbl@redhat.com \
    --cc=jandrew+netdev@lunn.ch \
    --cc=kuba@kernel.org \
    --cc=louis.scalbert@6wind.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox