]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: macb: add no LSO capability (MACB_CAPS_NO_LSO)
authorThéo Lebrun <theo.lebrun@bootlin.com>
Thu, 23 Oct 2025 16:22:53 +0000 (18:22 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 28 Oct 2025 14:17:54 +0000 (15:17 +0100)
LSO is runtime-detected using the PBUF_LSO field inside register DCFG6.
Allow disabling that feature if it is broken by using bp->caps coming
from match data.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://patch.msgid.link/20251023-macb-eyeq5-v3-3-af509422c204@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c

index 93e8dd092313e81dbee690188ccc88050c41d1ad..05bfa9bd47821ed1f40eaf8bc3ff024826c24aae 100644 (file)
 #define MACB_CAPS_DMA_64B                      BIT(21)
 #define MACB_CAPS_DMA_PTP                      BIT(22)
 #define MACB_CAPS_RSC                          BIT(23)
+#define MACB_CAPS_NO_LSO                       BIT(24)
 
 /* LSO settings */
 #define MACB_LSO_UFO_ENABLE                    0x01
index be3d0c2313a16078b36dacb23c3c1e831a9f6c46..8b688a6cb2f941a07819a12b55f2c6bc28f49a9d 100644 (file)
@@ -4564,8 +4564,11 @@ static int macb_init(struct platform_device *pdev)
        /* Set features */
        dev->hw_features = NETIF_F_SG;
 
-       /* Check LSO capability */
-       if (GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6)))
+       /* Check LSO capability; runtime detection can be overridden by a cap
+        * flag if the hardware is known to be buggy
+        */
+       if (!(bp->caps & MACB_CAPS_NO_LSO) &&
+           GEM_BFEXT(PBUF_LSO, gem_readl(bp, DCFG6)))
                dev->hw_features |= MACB_NETIF_LSO;
 
        /* Checksum offload is only available on gem with packet buffer */