[net-next,1/2] net: stmmac: dwmac-sun8i: Fix the RX_TH threshold encoding

Message ID 20261110-sun8i-emac-jumbo-v1-1-84bf00e9ffa3@gmail.com (mailing list archive)
State New
Headers
Series iommu/sun50i: Don't report TLB prefetch walks as page faults |

Commit Message

Arun Iyengar via B4 Relay Nov. 10, 2026, 6:03 a.m. UTC
From: Arun Iyengar <aiyengar1990@gmail.com>

The EMAC RX_CTL1 RX_TH field (bits 5:4) encodes 00 = 64 bytes and
01 = 32 bytes (H616 user manual v1.0, 6.5.10; 10 = 96 and 11 = 128 bytes
as in the driver). The driver has the first two swapped.

The values are only used in RX threshold mode, which dwmac-sun8i never
selects while RX checksum offload is on, so no current configuration is
affected.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

sashiko-bot@kernel.org Nov. 11, 2026, 6:03 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net: stmmac: dwmac-sun8i: missing Fixes tag and inaccurate
  commit msg
--

commit bc43819b000accd77627647d6f7f32c68d0bcbe3
Author: Arun Iyengar <aiyengar1990@gmail.com>

> net: stmmac: dwmac-sun8i: Fix the RX_TH threshold encoding
>
> The EMAC RX_CTL1 RX_TH field (bits 5:4) encodes 00 = 64 bytes and
> 01 = 32 bytes (H616 user manual v1.0, 6.5.10; 10 = 96 and 11 = 128 bytes
> as in the driver). The driver has the first two swapped.
>
> The values are only used in RX threshold mode, which dwmac-sun8i never
> selects while RX checksum offload is on, so no current configuration is
> affected.
>
> Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>

[Severity: Low]
Since this fixes the swapped EMAC_RX_TH_32 and EMAC_RX_TH_64 definitions from
the initial driver commit, should it include:

  Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")

Also, is the explanation about RX checksum offload accurate?
stmmac_dma_operation_mode() and stmmac_bump_dma_threshold() only select RX
threshold mode when priv->plat->force_thresh_dma_mode is set and use
SF_DMA_MODE otherwise, independent of priv->plat->rx_coe.
  

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 47954537b29e..0c82662fbe6e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -198,8 +198,9 @@  static const struct emac_variant emac_variant_h616_emac1 = {
 /* Used in RX_CTL1*/
 #define EMAC_RX_MD              BIT(1)
 #define EMAC_RX_TH_MASK		GENMASK(5, 4)
-#define EMAC_RX_TH_32		0
-#define EMAC_RX_TH_64		(0x1 << 4)
+/* RX_CTL1 RX_TH encoding (H616 UM 6.5.10): 00 = 64, 01 = 32 bytes */
+#define EMAC_RX_TH_32		(0x1 << 4)
+#define EMAC_RX_TH_64		0
 #define EMAC_RX_TH_96		(0x2 << 4)
 #define EMAC_RX_TH_128		(0x3 << 4)
 #define EMAC_RX_DMA_EN  BIT(30)