Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Yongzhao Chen <yongzhao.derek@gmail.com>
Cc: netdev@vger.kernel.org, Christian Marangi <ansuelsmth@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	John Crispin <john@phrozen.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 2/3] net: dsa: qca8k: do not clear MASTER_EN after a failed page select
Date: Mon, 5 Oct 2026 19:06:14 +0200	[thread overview]
Message-ID: <6c5a59a0-a75e-4d0b-8231-9a126ed9fa9a@lunn.ch> (raw)
In-Reply-To: <20261003172405.342-3-yongzhao.derek@gmail.com>

On Sat, Oct 03, 2026 at 07:24:03PM +0200, Yongzhao Chen wrote:
> qca8k_mdio_write() and qca8k_mdio_read() take the common exit path when
> selecting the page of QCA8K_MDIO_MASTER_CTRL fails. That path clears
> MASTER_CTRL[31:16] with a raw write to phy 0x10, reg 0x1f, which only
> addresses MASTER_CTRL while page 0 is selected. After a failed page
> select that did not reach the switch, the previous page remains selected.
> The write can then clear the upper half of an unrelated register at
> page * 0x200 + 0x3c.
> 
> No MDIO master transaction has been started at that point, so there is
> nothing to clean up. Unlock and return the error directly.
> 
> qca8k_set_page() also keeps the old cached page when the page write
> fails. If the write did reach the switch, a later access to the cached
> page skips the page select and reaches the wrong register. Invalidate
> the cache on failure so that the next access selects the page again.
> 
> The Sashiko review of v1 identified the stray cleanup write. A userspace
> model of the driver's functions reproduces both problems by injecting
> page-select failures with and without a hardware page change; these cases
> pass after this change.
> 
> The cleanup write comes from commit 759bafb8a322 ("net: dsa: qca8k: add
> support for internal phy and internal mdio"), and the stale page cache
> from commit ba5707ec58cf ("net: dsa: qca8k: handle qca8k_set_page
> errors").
> 
> Signed-off-by: Yongzhao Chen <yongzhao.derek@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

  reply	other threads:[~2026-10-05 17:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03 17:24 [PATCH net-next v3 0/3] net: dsa: qca8k: fix MDIO error handling Yongzhao Chen
2026-10-03 17:24 ` [PATCH net-next v3 1/3] net: dsa: qca8k: propagate MDIO errors Yongzhao Chen
2026-10-05 17:00   ` Andrew Lunn
2026-10-03 17:24 ` [PATCH net-next v3 2/3] net: dsa: qca8k: do not clear MASTER_EN after a failed page select Yongzhao Chen
2026-10-05 17:06   ` Andrew Lunn [this message]
2026-10-03 17:24 ` [PATCH net-next v3 3/3] net: dsa: qca8k: fail mgmt Ethernet MDIO access on busy wait errors Yongzhao Chen
2026-10-05 17:07   ` Andrew Lunn
2026-10-07  1:00 ` [PATCH net-next v3 0/3] net: dsa: qca8k: fix MDIO error handling patchwork-bot+netdevbpf

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=6c5a59a0-a75e-4d0b-8231-9a126ed9fa9a@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=yongzhao.derek@gmail.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