From: Rosen Penev <rosenp@gmail.com>
To: netdev@vger.kernel.org
Cc: Chris Snook <chris.snook@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 2/3] net: ag71xx: remove MMIO read-back drain from register writes
Date: Sun, 28 Jun 2026 16:09:43 -0700 [thread overview]
Message-ID: <20260628230944.1244501-3-rosenp@gmail.com> (raw)
In-Reply-To: <20260628230944.1244501-1-rosenp@gmail.com>
ag71xx_wr(), ag71xx_sb() and ag71xx_cb() issue a synchronous
ioread32() after every iowrite32() under the assumption that the
write must be flushed to the device before any subsequent operation.
On the ath79 on-chip MMIO bus the uncached __raw_writel used by
iowrite32() is non-posted - the write completes before the next
instruction executes. The extra ioread32() therefore serves no
ordering purpose and costs at least one uncached bus round-trip
per call.
Remove the read-back and the associated comments, leaving the
barrier that iowrite32() already provides.
Small iperf3 improvement:
Before:
[ ID][Role] Interval Transfer Bitrate Retr
[ 5][TX-C] 0.00-10.00 sec 343 MBytes 288 Mbits/sec 32 sender
[ 5][TX-C] 0.00-10.00 sec 341 MBytes 286 Mbits/sec receiver
[ 7][RX-C] 0.00-10.00 sec 183 MBytes 153 Mbits/sec 0 sender
[ 7][RX-C] 0.00-10.00 sec 183 MBytes 153 Mbits/sec receiver
After:
[ ID][Role] Interval Transfer Bitrate Retr
[ 5][TX-C] 0.00-10.00 sec 349 MBytes 292 Mbits/sec 28 sender
[ 5][TX-C] 0.00-10.00 sec 346 MBytes 291 Mbits/sec receiver
[ 7][RX-C] 0.00-10.00 sec 180 MBytes 151 Mbits/sec 0 sender
[ 7][RX-C] 0.00-10.00 sec 180 MBytes 151 Mbits/sec receiver
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/ethernet/atheros/ag71xx.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index 1def2ad4c5ce..77f8e75e98ac 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -397,11 +397,13 @@ static bool ag71xx_is(struct ag71xx *ag, enum ag71xx_type type)
return ag->dcfg->type == type;
}
+/* ath79 on-chip MMIO bus is non-posted - iowrite32/iowrite32be completes
+ * before the next instruction executes. No read-back drain is needed.
+ */
+
static void ag71xx_wr(struct ag71xx *ag, unsigned int reg, u32 value)
{
iowrite32(value, ag->mac_base + reg);
- /* flush write */
- (void)ioread32(ag->mac_base + reg);
}
static u32 ag71xx_rr(struct ag71xx *ag, unsigned int reg)
@@ -411,22 +413,16 @@ static u32 ag71xx_rr(struct ag71xx *ag, unsigned int reg)
static void ag71xx_sb(struct ag71xx *ag, unsigned int reg, u32 mask)
{
- void __iomem *r;
+ void __iomem *r = ag->mac_base + reg;
- r = ag->mac_base + reg;
iowrite32(ioread32(r) | mask, r);
- /* flush write */
- (void)ioread32(r);
}
static void ag71xx_cb(struct ag71xx *ag, unsigned int reg, u32 mask)
{
- void __iomem *r;
+ void __iomem *r = ag->mac_base + reg;
- r = ag->mac_base + reg;
iowrite32(ioread32(r) & ~mask, r);
- /* flush write */
- (void)ioread32(r);
}
static void ag71xx_int_enable(struct ag71xx *ag, u32 ints)
--
2.54.0
next prev parent reply other threads:[~2026-06-28 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 23:09 [PATCH 0/3] net: ag71xx: NAPI weight, MMIO drain, and TX OOM fix Rosen Penev
2026-06-28 23:09 ` [PATCH 1/3] net: ag71xx: Use default NAPI weight Rosen Penev
2026-06-28 23:09 ` Rosen Penev [this message]
2026-06-28 23:09 ` [PATCH 3/3] net: ag71xx: re-enable TX interrupts on RX OOM Rosen Penev
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=20260628230944.1244501-3-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=chris.snook@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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