From: Ido Schimmel <idosch@nvidia.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
pabeni@redhat.com, edumazet@kernel.org, jv@jvosburgh.net,
andrew+netdev@lunn.ch, petrm@nvidia.com,
sridhar.samudrala@intel.com, jiri@resnulli.us, horms@kernel.org,
shuah@kernel.org, linux-kselftest@vger.kernel.org,
razor@blackwall.org
Subject: Re: [PATCH net-next 5/6] bonding: 3ad: Advertise Collecting only after collection is enabled
Date: Thu, 19 Nov 2026 13:36:55 +0200 [thread overview]
Message-ID: <20261119113655.GA1797240@shredder> (raw)
In-Reply-To: <179507998243.3136.12068101065568780220@kernel.org>
tl;dr - I believe the patch is fine as-is.
On Thu, Nov 19, 2026 at 09:19:42AM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found more severe
> issue(s) in other patches of this series. This mail is only an FYI, in case
> you want to address the nit picks below when you respin.
>
> Low priority / nit picks for your consideration:
>
> - [Low] In __update_lacpdu_from_port() (drivers/net/bonding/bond_3ad.c),
> the patch clears LACP_STATE_COLLECTING in lacpdu->actor_state when…
> - [Low] While the Rx notification is pending, procfs ("details actor lacp
> pdu: port state"), sysfs ad_actor_oper_port_state and netlink…
> - [Low] __update_lacpdu_from_port() masks only LACP_STATE_COLLECTING
> while the Rx notification is pending.
>
> --
>
> bonding: 3ad: Advertise Collecting only after collection is enabled
>
> When coupled control is disabled, this commit clears the Collecting bit in
> transmitted LACPDUs while the port's Rx state change notification is still
> pending. Once the notification is delivered, ad_tx_machine() sets ntt so
> that a new LACPDU advertising Collecting goes out.
>
> > diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
> > index d2a55f4d89791..61f6de803b667 100644
> > --- a/drivers/net/bonding/bond_3ad.c
> > +++ b/drivers/net/bonding/bond_3ad.c
>
> [ ... ]
>
> > @@ -903,6 +916,9 @@ static inline void __update_lacpdu_from_port(struct port *port)
> > lacpdu->actor_port_priority = htons(port->actor_port_priority);
> > lacpdu->actor_port = htons(port->actor_port_number);
> > lacpdu->actor_state = port->actor_oper_port_state;
> > + /* Collection is only enabled once the Rx state change is notified */
> > + if (__port_rx_notify_pending(port))
> > + lacpdu->actor_state &= ~LACP_STATE_COLLECTING;
>
> [Severity: Low]
> This masks only Collecting. Can the transmitted actor_state have
> Distributing set while Collecting is cleared?
>
> Suppose rtnl_trylock() fails in bond_3ad_state_machine_handler() at the end
> of the run that entered AD_MUX_COLLECTING. Then should_notify_rx stays set.
> On the next tick, ad_mux_machine() can move to AD_MUX_DISTRIBUTING based
> only on the partner's state:
>
> case AD_MUX_COLLECTING:
> if (!__port_move_to_attached_state(port)) {
> if ((port->sm_vars & AD_PORT_SELECTED) &&
> (port->partner_oper.port_state & LACP_STATE_SYNCHRONIZATION) &&
> (port->partner_oper.port_state & LACP_STATE_COLLECTING)) {
> port->sm_mux_state = AD_MUX_DISTRIBUTING;
>
> Entering that state then does:
>
> case AD_MUX_DISTRIBUTING:
> port->actor_oper_port_state |= LACP_STATE_DISTRIBUTING;
> port->actor_oper_port_state |= LACP_STATE_SYNCHRONIZATION;
> ad_enable_collecting_distributing(port,
> update_slave_arr);
>
> As far as I can tell, the __enable_port() path does not clear
> should_notify_rx, because the slave's Rx state is already enabled.
>
> Any LACPDU sent before RTNL is obtained, such as the periodic one, would
> then carry Distributing=1 and Collecting=0. The 802.1AX mux machine never
> produces that combination.
>
> Would it make sense to also mask LACP_STATE_DISTRIBUTING while the
> notification is pending?
Looking at 802.1AX, I can't find where it says that transmitting
"Distributing=1 and Collecting=0" is invalid and it also shouldn't
matter for our partner because the partner never looks at our
Distributing bit. It's only looking at our Synchronization and
Collecting bits and the latter is correctly turned off until collection
is enabled in both software and hardware, which is what matters here.
And I don't think that it makes sense to mask LACP_STATE_DISTRIBUTING in
our LACPDUs when in practice the port is already transmitting (from the
software data path, not the hardware data path).
If anything, it makes more sense to keep the mux machine at
AD_MUX_COLLECTING when the Rx notification is still pending, but I don't
understand what it buys us and I would rather follow up on this than
send the entire series again.
>
> [Severity: Low]
> Only the transmitted copy is masked here. While the notification is
> pending, procfs, sysfs and netlink still report port->actor_oper_port_state
> with Collecting set. For example, bond_info_show_slave() in bond_procfs.c
> does:
>
> seq_puts(seq, "details actor lacp pdu:\n");
> ...
> seq_printf(seq, " port state: %d\n",
> port->actor_oper_port_state);
>
> The sysfs ad_actor_oper_port_state file and the netlink
> IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE attribute are named after
> actor_oper_port_state, so they report what their names say. The procfs
> block, however, is labelled as the actor LACP PDU, and for a short time it
> now shows a different value from the one on the wire.
This could happen even before the patch. LACPDUs are sent at a rate of
at most three per second. First the actor state changes and only later
it's visible on the wire.
>
> Is this difference intended? If so, should the procfs label be adjusted or
> the difference documented?
No, it shouldn't be adjusted. It always reported the actor state rather
than what was encoded in the State byte of the last LACPDU.
>
> Later in this series, "selftests: bonding: Test that Collecting is
> advertised after notification" adds test coverage for the transmitted
> LACPDU. Its collecting_advertise() captures LACPDUs and checks that
> Collecting is only advertised after the 0x1f notification. That test also
> suggests the notification is meant to carry the unmasked state.
>
> > slave_dbg(port->slave->bond->dev, port->slave->dev,
> > "update lacpdu: actor port state %x\n",
> > port->actor_oper_port_state);
>
> [Severity: Low]
> Should this debug message print lacpdu->actor_state now?
>
> While the Rx notification is pending, the message prints
> port->actor_oper_port_state with Collecting set (for example 0x1f). The
> LACPDU on the wire carries 0x0f. Before this patch the two values were
> always the same.
>
> Printing lacpdu->actor_state, or both values, would keep the message in
> line with what is sent.
The message prints the port's state, as it did before this patch. The
difference is transient and only happens when coupled control is
disabled, so I don't think it's worth changing.
next prev parent reply other threads:[~2026-11-19 11:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 8:34 [PATCH net-next 0/6] bonding: 3ad: Support independent control with LAG offload Ido Schimmel
2026-11-18 8:34 ` [PATCH net-next 1/6] net: Add Rx enabled state to LAG lower state information Ido Schimmel
2026-11-18 8:34 ` [PATCH net-next 2/6] bonding: 3ad: Notify Rx state changes Ido Schimmel
2026-11-18 20:00 ` Jay Vosburgh
2026-11-19 9:03 ` Ido Schimmel
2026-11-18 8:34 ` [PATCH net-next 3/6] mlxsw: Enable LAG collector independently of distributor Ido Schimmel
2026-11-19 9:19 ` netdev-bot+sashiko
2026-11-19 10:28 ` Ido Schimmel
2026-11-18 8:34 ` [PATCH net-next 4/6] selftests: bonding: Test notifications in COLLECTING state Ido Schimmel
2026-11-18 8:34 ` [PATCH net-next 5/6] bonding: 3ad: Advertise Collecting only after collection is enabled Ido Schimmel
2026-11-19 9:19 ` netdev-bot+sashiko
2026-11-19 11:36 ` Ido Schimmel [this message]
2026-11-18 8:34 ` [PATCH net-next 6/6] selftests: bonding: Test that Collecting is advertised after notification Ido Schimmel
2026-11-19 9:19 ` netdev-bot+sashiko
2026-11-19 10:01 ` Ido Schimmel
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=20261119113655.GA1797240@shredder \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=razor@blackwall.org \
--cc=shuah@kernel.org \
--cc=sridhar.samudrala@intel.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