Article View: linux.kernel.netdev
Article #12794Re: [PATCH net] net: ibm: emac: fix MR0 write in emac_rx_enable()
From: Andrew Lunn
Date: Sun, 08 Nov 2026 15:59
Date: Sun, 08 Nov 2026 15:59
43 lines
10406 bytes
10406 bytes
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
Technical Details
Message-ID:
<d8c2c58e-ebdb-4b43-a372-64edcecb7bf3@lunn.ch>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358796-linux-kernel-netdev=dewy.ruReferences:
<20261105231417.119930-1-rosenp@gmail.com> <59326527-5002-483a-b418-fef18eeab5d4@lunn.ch> <CAKxU2N_wqu_HmX59B-M4htLq2HbBpdcd_f2cChn1QayANPUTFw@mail.gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358796-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: ibm: emac: fix MR0 write in emac_rx_enable() Date: Sun, 8 Nov 2026 16:59:20 +0100 Organization: Usenet Network Message-ID: <d8c2c58e-ebdb-4b43-a372-64edcecb7bf3@lunn.ch> References: <20261105231417.119930-1-rosenp@gmail.com> <59326527-5002-483a-b418-fef18eeab5d4@lunn.ch> <CAKxU2N_wqu_HmX59B-M4htLq2HbBpdcd_f2cChn1QayANPUTFw@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="154907"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:duiF8b9lcH1yHCfuSXqgvQrrM5c= sha256:fHfjvECvyN2AxQCHA3odwuZKTPfScxeJVgs/UIzRqz8= sha1:wTE9ckZW4FniPqvUwXIARCDzae4= sha256:7uMg6AFABgsMeDDm187vPNO9BxvyS7Y1UxodaGO4pWU= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 50BF3114024; Sun, 8 Nov 2026 19:00:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IYzZbeBnABzH; Sun, 8 Nov 2026 19:00:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358796-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 3F426DD121; Sun, 8 Nov 2026 19:00:27 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id F351C627C1; Sun, 8 Nov 2026 15:59:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794153597; b=2qVh3N9b7w9vClg+bDuhvuS6Hk64Vz+3caIfHEnZABCDdb+8qm8KVZ8AvCTY2/uXn82k pdtxssIviJp1P03xhJl9IU7PdrPVyLGN6wIcdipjoiwHKb/weSbNEKww2v663d63BhHrP Z0NypA+DcSDlJp36e6if+3Bsk2X2CFbVKHC0Bbg8dEvmLmrbjCLRQefq8clzxw9B5ZTU+ DZ1PzBHqn+1xa4Sv3TFen1a77/PrzHbQ2uUnrnpQrJNUbJPwSvgx0yPHvd22wWPXFfFGy 80aR148qGnixh3TShiryMcSL2Az6FJE3aob0YhQ0ER40Sm+yAxHAZ5AqmbloRDKPqsw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794153597; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=gmmnE20VOV7unbjlnQvICJNfs/oFQnztiZcF+e1SVDY=; b=M461SiIm7fw1VkfTM0Kcc4UC5H4dKIBdvmpFPw7PPR+l8HmGCJu/lVNy9G4kPbD3yslq CK0rCH9bWgwwGBmfu3aH4vUzvijQUs7rD1FS2lSsvTCyI4SAf7nFfXugcgaGsAukd5HKY nlzqVlIz1vibAbe2YwvLSVBJWMmN+k4v+JGPYYPYSRb2icHint8e1aUmG4KuD730EWpDn d4kpK1zXQgHvxZIljANzXHeDOOEXBc4bqSLrUFcXm6dgIZI4e6koCIfeTrJktmfW6TJF/ gJgYyHC/8sKtay6/PpvXEF5/QiwYL63uPrq5YCTSncTVcs0u6WMhDIdr1jJilIcW2Eg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=Wqo5XS+U; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DEA2606A339; Sun, 8 Nov 2026 15:59:57 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=Wqo5XS+U X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794153591; b=IJAkGV67g90PnJ+a7FvgBFQvl86pUarD0uVW4x70bZDWa0n6f6/qPscAPNc3MAefUuZH k2CjPOxps9LlrVylA5pS7N2oTVDzrqWX3ykQb8jP96ahsNIMJlHgCdgyk2u0W6Sqkb50i JPhkAKUQ5bWjuFHoHwB4QDw8FCfkulGX6IEFNeRoTQ+8b6yavzpZvZgTJyqh3dnKJ3EZq UZ+4tOh3P7o46/BaYFKO7xKuxIrEjMxrS08QYzeKBGJHMGfjhdlNwpcMQSdM/AFxDhwbW rErVRuHRHsQOhh3WMaPSk0SO1ZTnJLAr5PYjonjk5//0P1uT5gVwC0C79w6oho5c+hg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794153591; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=gmmnE20VOV7unbjlnQvICJNfs/oFQnztiZcF+e1SVDY=; b=UxyRaIWSoLCdMu5zaaqVd3cSIHchh1NWsGuXr15J9e/FB/aemRvHLbrUj/yL5uJoJzJJ zk3OPHA0rfki5XzqBlaXNAACpGFEh8qQ0rjq3PupHHD55YnLN+lzTAN94YpveDxXPjDI5 12OLGJK8PmtmIPuPHth5TWv/ckgK6KMiQ8s3Ddxaey9U+vYHqc1pNzyW5BWiogFPYrdcG YO2azDJvB3RsJkuePvo5qZVeRoaV79JjwUvgjRs1sd8zX7EY/d0TM1i8hHxagqA8yhk89 2Gld/zOZO1kbIZzRCY8wvQYAyGix/hRtrstuRNOovRZGcxsbd7Bn96LZz6qo98ejS8Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=Wqo5XS+U; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDD96606A330; Sun, 8 Nov 2026 15:59:49 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EDD96606A330 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=gmmnE20VOV7unbjlnQvICJNfs/oFQnztiZcF+e1SVDY=; b=Wq o5XS+UjmPeP7zY2/Y63pr6F8evgpBjKhvDki/5HMxXppu+4xmqiDBCmNUOdMXJSiLSofmDrAe6xe6 uv7xVAaLlvD7phdNyXk4E3hRvbuF39/rA0WjMCbfLGMMDGICCTV1unKzEf+Z7K2CY7v4L5q+C8ckB 8O0pFO78WNSTu6c=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xQ5Ie-00F6mM-Mf; Sun, 08 Nov 2026 16:59:20 +0100 X-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> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <CAKxU2N_wqu_HmX59B-M4htLq2HbBpdcd_f2cChn1QayANPUTFw@mail.gmail.com>