From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3DCA3749ED for ; Sun, 28 Jun 2026 23:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782688191; cv=none; b=DXnCksue9f4mmJQaqq5hjednb19C9GHhJoVL0KOpZ4bDcvDvLVNcZA0+X9BRgrJaOrxGZiTvIBpScNrsEAnvfIVrC6+vKnEQXVDS9r8dxNhXKG06yNq+erfRafJyIhrpKc90lXACjsD4B+6VBzEAWp6RE9JGVv6eojd9pFHNg88= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782688191; c=relaxed/simple; bh=pgzcKYlJVil9kefxceGW45ZxZj82Frlmo2ozp8igyRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uKv3BkPhUE4DBDexwdk0WiUdXpxMtCmmtfikIQjJqIBWe71tumXQ+jNHx1yYN082Di3Kcceb11TaPbbXKlHnYfmWEDBk0q1Evk3yzirNLOJMQaBJf3ZFQHsZPKdeR9NexDl/njwodUCUyCC15dJRY23RxHhMZ8ul87je2btvMzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OaVqy7Mf; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OaVqy7Mf" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-37fb17e1435so551596a91.1 for ; Sun, 28 Jun 2026 16:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782688189; x=1783292989; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DsUunEzMvfoSD5miqaR3mLdOKOwRKoQGXpU7oQBkiQs=; b=OaVqy7MfqnpxQrUMAj6hEJNo8XDpkSdxX7OXIUBS/MWUYfv0wqXeCvq2mMqPJu00xO yI9eZcvu1dlZiPL8W308Ehz51PoTQcprt2/haugFlqcGcV8dwDt4xyuT7d5t+CZJxXgK o/uaqL9WL1+jzjPa/W7FrNjDUjBnnmN2AkEzmgvAFhzgu3Qe058t1H78Q0mdvu0jt++N r7EhOfn9ISFUJtHWA6PsAHhALLhobxFFppjLaMMA3/k9AKprUdXkaVF74nER+17JGuzO s9wmQK/0iHwB6K8gk2D2CzcEicG/trXs5ExMUoyeWLUb7db++QUU49BMS+1MLLouppzN zlxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782688189; x=1783292989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DsUunEzMvfoSD5miqaR3mLdOKOwRKoQGXpU7oQBkiQs=; b=h/Ek5QVCvKGVH+t+DoiAf0saZ/THVEo2TXZ9s8IxxYaUrJEXNnWyGblYCGvWYy63cC V2YRLeYxzR0pcEfwH0l5EX8ZKw6gzX0rBo3/W7zEYiJ1bV0tALyG69/bheAcole7XkO+ R6N0YbW8pkuRe6N5V5u+IXKrOEYZPHJOuY/WYae6CWs1g4skAtAc+LvFYjP1ngmkWmP7 NGKVTF+vhQN4IyuKCF21LtMcjfS/c3kW/X2PTua+qh/HRxUNi9G/0aXWiKXv2SGZOgEY DSyc4uLOSfNWKDzV6gVamjOFVyzDweTJYKtl2oYp4vhg9wTOeCbN3CcWi4lPWzaQWMU7 6pGg== X-Forwarded-Encrypted: i=1; AHgh+Rq+QFmmmYSb8FB0aZoJ29qHQW2oI0jQHew9Eo07t0JMR6s6UjqSry2yA6WzsRezr9up1KFws344ukL3oP8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0Tn0REqYbKGc4Ms0MVmgKZbEPcUzyevNAryL4jiqnMTkR9hjE eaQP1g8ron7cOf8EqkXHUHKSw4TaFw50iUNOqEODuEToWXbnHkaRF//W X-Gm-Gg: AfdE7cnYF15G3hqvwIlZvrwJCufr10PI4CySHKxFAoQkvLIgvVZQDugJ/FjedH1TQrg ukkJVby28YKxtJQkCezQmQIpI8I1DtoqhPnPLmipZDRQ4d1nkRs5NvR2XhGswt24hFSmwFQDQqU PhenysxsD/ZZr6V2iogyJANFX+N9pODAM6NUJnwz7D3nVrB76FpZaukNt02J1UrgSL6ACJqjUca 5yDLiXN+yuJ02iij0G8eKTRRpcIZKQhnMonGevRXRjnG7Oxm/BwRtbRIXm9ETmUO1EF2dpU0yvt scEr0ZBkstoqMr6Ur8EEcU/MeQHLvalwwYB/WYhXYwMBis4zo/yhNhttVlO9p3ZBLH2yXIMD6Lo ewar/O3yaavl6nKT9F6PPVMiY7wmMuckhV9t7Lcsuo2dmWZb/6eOxXF3vO+9nZW1vnIgrifQw9C tj1Bh9Tb2gnhzQDhBwbdUDeCHCHHZ7rZTpP16Knef2Z4qUtzIArM14lTXEGb8Zv4RhmJfnmQ9n2 sfvuDlvHw== X-Received: by 2002:a17:90b:5826:b0:372:b4a1:21d8 with SMTP id 98e67ed59e1d1-37dfa235fc9mr13498743a91.13.1782688189129; Sun, 28 Jun 2026 16:09:49 -0700 (PDT) Received: from ryzen.lan ([2601:644:8000:7a86::e34]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3800b9c834dsm606960a91.6.2026.06.28.16.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2026 16:09:48 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: Chris Snook , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , 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 Message-ID: <20260628230944.1244501-3-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260628230944.1244501-1-rosenp@gmail.com> References: <20260628230944.1244501-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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