diff mbox series

[v2,1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset()

Message ID fdde0eb8c6dea0e81b5f5ae528085f1ccf53fef3.1616696376.git.ryder.lee@mediatek.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() | expand

Commit Message

Ryder Lee March 25, 2021, 6:28 p.m. UTC
Cleanup ext_phy and mcu tx queue so that mt7615_mac_reset_work() can
recover mt7615 normally.

Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
change since v2 - cleanup mphy_ext->q_tx
---
 drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Felix Fietkau March 25, 2021, 10:41 p.m. UTC | #1
On 2021-03-25 19:28, Ryder Lee wrote:
> Cleanup ext_phy and mcu tx queue so that mt7615_mac_reset_work() can
> recover mt7615 normally.
> 
> Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
> change since v2 - cleanup mphy_ext->q_tx
I like v1 better, since ext-phy tx queues are the same as primary phy tx
queues. Or am I missing something?

- Felix
Ryder Lee March 25, 2021, 11:51 p.m. UTC | #2
> On 2021-03-25 19:28, Ryder Lee wrote:
> > Cleanup ext_phy and mcu tx queue so that mt7615_mac_reset_work() can
> > recover mt7615 normally.
> > 
> > Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> > ---
> > change since v2 - cleanup mphy_ext->q_tx
> I like v1 better, since ext-phy tx queues are the same as primary phy tx
> queues. Or am I missing something?
> 
> - Felix
right. i didn't notice mt7615 ext-phy shares the same tx queues with
primary phy. please drop this one.
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index bb3f93d90f4e..4e41c12d08eb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -2013,20 +2013,26 @@  mt7615_update_beacons(struct mt7615_dev *dev)
 
 void mt7615_dma_reset(struct mt7615_dev *dev)
 {
+	struct mt76_phy *mphy_ext = dev->mt76.phy2;
 	int i;
 
 	mt76_clear(dev, MT_WPDMA_GLO_CFG,
 		   MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_TX_DMA_EN |
 		   MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE);
+
 	usleep_range(1000, 2000);
 
-	mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], true);
-	for (i = 0; i < __MT_TXQ_MAX; i++)
+	for (i = 0; i < __MT_TXQ_MAX; i++) {
 		mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[i], true);
+		if (mphy_ext)
+			mt76_queue_tx_cleanup(dev, mphy_ext->q_tx[i], true);
+	}
 
-	mt76_for_each_q_rx(&dev->mt76, i) {
+	for (i = 0; i < __MT_MCUQ_MAX; i++)
+		mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[i], true);
+
+	mt76_for_each_q_rx(&dev->mt76, i)
 		mt76_queue_rx_reset(dev, i);
-	}
 
 	mt76_set(dev, MT_WPDMA_GLO_CFG,
 		 MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_TX_DMA_EN |