]> git.hungrycats.org Git - linux/commitdiff
net: stmmac: selftests: Don't test flow control for small rx fifos
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Wed, 26 Aug 2026 14:04:58 +0000 (16:04 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 Aug 2026 17:53:28 +0000 (10:53 -0700)
On dwmac1000, dwmac4 and dwxgmac, we only emit pause frames if there's
at least 4096 bytes in each queue's fifo.

The phylink mac capabilities are still MAC_ASYM_PAUSE | MAC_SYM_PAUSE as
otherwise we won't be able to negotiate 'rx on' pause. ASYM only will
prevent negotiating 'rx off tx on', while SYM only doesn't really
matche the reality (not symmetric if we can only do RX pause).

Fixes: 091810dbded9 ("net: stmmac: Introduce selftests support")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20260826140500.616466-7-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c

index ae236a264e74b8d30479e27174bbcefebfed4182..6372ec7c3f317053adcb1ca0ae8246081469380c 100644 (file)
@@ -739,12 +739,24 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
        u32 rx_cnt = priv->plat->rx_queues_to_use;
        struct mac_device_info *mac = priv->hw;
        struct stmmac_test_priv *tpriv;
+       unsigned int rx_fifo_size;
        unsigned int pkt_count;
        int i, ret = 0;
 
        if (!(mac->link.caps & MAC_SYM_PAUSE))
                return -EOPNOTSUPP;
 
+       rx_fifo_size = priv->plat->rx_fifo_size;
+       if (!rx_fifo_size)
+               rx_fifo_size = priv->dma_cap.rx_fifo_size;
+
+       /* No pause frame is emitted if we don't have at least 4096 bytes per
+        * queue, except on dwmac100.
+        */
+       if (priv->plat->core_type != DWMAC_CORE_MAC100 &&
+           rx_fifo_size / priv->plat->rx_queues_to_use < 4096)
+               return -EOPNOTSUPP;
+
        tpriv = kzalloc_obj(*tpriv);
        if (!tpriv)
                return -ENOMEM;
@@ -758,9 +770,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
        dev_add_pack(&tpriv->pt);
 
        /* Compute minimum number of packets to make FIFO full */
-       pkt_count = priv->plat->rx_fifo_size;
-       if (!pkt_count)
-               pkt_count = priv->dma_cap.rx_fifo_size;
+       pkt_count = rx_fifo_size;
        pkt_count /= 1400;
        pkt_count *= 2;