From: Andrew Lunn <andrew@lunn.ch>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jeff Garzik <jeff@garzik.org>,
David Gibson <david@gibson.dropbear.id.au>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: ibm: emac: fix MR0 write in emac_rx_enable()
Date: Sun, 8 Nov 2026 16:59:20 +0100 [thread overview]
Message-ID: <d8c2c58e-ebdb-4b43-a372-64edcecb7bf3@lunn.ch> (raw)
In-Reply-To: <CAKxU2N_wqu_HmX59B-M4htLq2HbBpdcd_f2cChn1QayANPUTFw@mail.gmail.com>
On Sat, Nov 07, 2026 at 04:07:04PM -0800, Rosen Penev wrote:
> On Sat, Nov 7, 2026 at 9:35 AM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > On Thu, Nov 05, 2026 at 03:14:17PM -0800, Rosen Penev wrote:
> > > When an asynchronous RX disable is still in progress, emac_rx_enable()
> > > waits for MR0[RXI] with
> > >
> > > while (!(r = in_be32(&p->mr0) & EMAC_MR0_RXI) && n)
> > >
> > > which assigns only the RXI bit to r, as & binds tighter than =. The
> > > following write of r | EMAC_MR0_RXE then clears every other MR0 bit,
> > > including TXE, and TX stays stopped until the watchdog resets the EMAC.
> > >
> > > This path is taken when RX is restarted after an RX descriptor error.
> > >
> > > Tested on a Cisco Meraki MX60.
> > >
> > > Fixes: 1d3bb996481e ("Device tree aware EMAC driver")
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > > drivers/net/ethernet/ibm/emac/core.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
> > > index 640618c0a09e..b676b286e339 100644
> > > --- a/drivers/net/ethernet/ibm/emac/core.c
> > > +++ b/drivers/net/ethernet/ibm/emac/core.c
> > > @@ -249,7 +249,7 @@ static void emac_rx_enable(struct emac_instance *dev)
> > > if (unlikely(!(r & EMAC_MR0_RXI))) {
> > > /* Wait if previous async disable is still in progress */
> > > int n = dev->stop_timeout;
> > > - while (!(r = in_be32(&p->mr0) & EMAC_MR0_RXI) && n) {
> > > + while (!((r = in_be32(&p->mr0)) & EMAC_MR0_RXI) && n) {
> > > udelay(1);
> > > --n;
> >
> > This sort of code should really make use of iopoll.h
> I agree. Is it appropriate for net?
Yes, that is fine.
Andrew
prev parent reply other threads:[~2026-11-08 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 23:14 Rosen Penev
2026-11-05 23:17 ` netdev-bot+sinfo
2026-11-07 17:35 ` Andrew Lunn
2026-11-08 0:07 ` Rosen Penev
2026-11-08 15:59 ` Andrew Lunn [this message]
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=d8c2c58e-ebdb-4b43-a372-64edcecb7bf3@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=david@gibson.dropbear.id.au \
--cc=edumazet@kernel.org \
--cc=jeff@garzik.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@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
all inboxes | Powered by JetHome®