]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: airoha: Reset BQL stopping the netdevice
authorLorenzo Bianconi <lorenzo@kernel.org>
Thu, 17 Oct 2024 14:01:41 +0000 (16:01 +0200)
committerAndrew Lunn <andrew@lunn.ch>
Sun, 20 Oct 2024 16:06:47 +0000 (11:06 -0500)
Run airoha_qdma_cleanup_tx_queue() in ndo_stop callback in order to
unmap pending skbs. Moreover, reset BQL txq state stopping the netdevice,

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
Message-ID: <20241017-airoha-en7581-reset-bql-v1-1-08c0c9888de5@kernel.org>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
drivers/net/ethernet/mediatek/airoha_eth.c

index 21d6eed8aece5cd77802c32500296a46a61e7e71..f463a505f5babed3e8e53bf62c92290fc94b3525 100644 (file)
@@ -2342,7 +2342,7 @@ static int airoha_dev_stop(struct net_device *dev)
 {
        struct airoha_gdm_port *port = netdev_priv(dev);
        struct airoha_qdma *qdma = port->qdma;
-       int err;
+       int i, err;
 
        netif_tx_disable(dev);
        err = airoha_set_gdm_ports(qdma->eth, false);
@@ -2353,6 +2353,14 @@ static int airoha_dev_stop(struct net_device *dev)
                          GLOBAL_CFG_TX_DMA_EN_MASK |
                          GLOBAL_CFG_RX_DMA_EN_MASK);
 
+       for (i = 0; i < ARRAY_SIZE(qdma->q_tx); i++) {
+               if (!qdma->q_tx[i].ndesc)
+                       continue;
+
+               airoha_qdma_cleanup_tx_queue(&qdma->q_tx[i]);
+               netdev_tx_reset_subqueue(dev, i);
+       }
+
        return 0;
 }