Netdev List
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Vladimir Oltean <olteanv@gmail.com>,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v5 3/5] net: dsa: mxl862xx: add devlink flash_update and info_get
Date: Sat, 1 Aug 2026 06:11:20 +0100	[thread overview]
Message-ID: <am1_-Hb-W25G1o0q@makrotopia.org> (raw)
In-Reply-To: <14be7694-8ec7-40b9-8845-d93896ed822c@lunn.ch>

On Thu, Jul 30, 2026 at 11:29:47PM +0200, Andrew Lunn wrote:
>> The switch leaves MCUboot on its own by booting the new image, but the
>> driver has no in-place path back, so it reinitialises with a full
>> device_reprobe() scheduled regardless of the transfer outcome -- after a
>> failure the switch is still in MCUboot and probe re-detects it. During
[...]
>
> Just for my understanding....
>
> The reprobe causes all the user point netdevs to be destroyed, and are
> then recreated?
>
> That seems like a good solution to the issue of all state information
> has been lost in the switch.

Yes, exactly. device_reprobe() runs remove(), which unregisters the
switch and with it all user netdevs, and the fresh probe registers
them anew. They come back administratively down and userspace brings
them up again. Everything is rebuilt from scratch rather than
restored, which is the point given the switch itself lost all state
too.

>> +static int mxl862xx_sb_pdi_poll_stat(struct mxl862xx_priv *priv, u16 expected,
[...]
>> +		usleep_range(10000, 11000);
>> +	} while (time_before(jiffies, timeout));
>> +
>> +	return -ETIMEDOUT;
>
> I suggest using iopoll.h. This code has the usual bug when rolling
> your own.

Agreed. Since v6 all SB PDI polling uses read_poll_timeout(), which
also does the one more read after the deadline that the open-coded
loop missed.

>> +/* Post-flash reprobe. Runs from a self-contained heap work (not a kthread and
>> + * not the devlink caller's context): kthread_create() in the caller context
>> + * fails -EINTR if the devlink command was Ctrl-C'd, and schedule_work() cannot.
>
> A English sentence should not finish with the word "cannot".

That comment, and the kthread it talked about, are gone since v7; the
reprobe is a plain delayed work item now.

>> +	/* Failures from here on must go through end_magic so MCUboot
>> +	 * reboots instead of waiting forever.
>> +	 */
>> +	ret = mxl862xx_sb_pdi_poll_stat(priv, MXL862XX_SB_PDI_READY,
>> +					MXL862XX_FW_READY_TIMEOUT_MS);
>> +	if (ret) {
[...]
>> +		return ret;
>
> What about the comment above? end_magic?

You are right, in v5 the comment and the code disagreed. It has moved
on since: it turned out that END written while the loader still sits
in its receive loop is consumed as a byte count and can underflow the
receive counter, so since v7 failures deliberately do not send END
(the loader finalises on its own 2s timeout), and v8 renamed the
label to no_end with a comment that now matches the code.

  reply	other threads:[~2026-08-01  5:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25  2:14 [PATCH net-next v5 0/5] net: dsa: mxl862xx: support firmware update Daniel Golle
2026-07-25  2:15 ` [PATCH net-next v5 1/5] net: dsa: wire flash_update devlink callback to drivers Daniel Golle
2026-07-30 21:08   ` Andrew Lunn
2026-08-01  5:07     ` Daniel Golle
2026-07-25  2:16 ` [PATCH net-next v5 2/5] net: dsa: mxl862xx: add SMDIO clause-22 register access Daniel Golle
2026-07-30 21:11   ` Andrew Lunn
2026-07-25  2:16 ` [PATCH net-next v5 3/5] net: dsa: mxl862xx: add devlink flash_update and info_get Daniel Golle
2026-07-30 21:29   ` Andrew Lunn
2026-08-01  5:11     ` Daniel Golle [this message]
2026-07-25  2:16 ` [PATCH net-next v5 4/5] net: dsa: mxl862xx: recover switch stuck in MCUboot rescue mode Daniel Golle
2026-07-30 21:34   ` Andrew Lunn
2026-07-25  2:17 ` [PATCH net-next v5 5/5] net: dsa: mxl862xx: document devlink flash and info support Daniel Golle
2026-07-30 21:36   ` Andrew Lunn

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=am1_-Hb-W25G1o0q@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=skhan@linuxfoundation.org \
    /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