rtw88: pci: release tx skbs DMAed when stop
authorYan-Hsuan Chuang <yhchuang@realtek.com>
Mon, 16 Sep 2019 07:03:35 +0000 (15:03 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 21 Sep 2019 05:47:27 +0000 (08:47 +0300)
Interrupt is disabled to stop PCI, which means the skbs
queued for each TX ring will not be released via DMA
interrupt. To avoid those skbs remained being left in
the skb queue until PCI has been removed, driver needs
to release skbs by itself.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtw88/pci.c

index bc3a36402e5699864d78bc67c357a27b8c97e9fb..d90928be663b910c3d5cb88f54a7e5f2fe4d6d17 100644 (file)
@@ -500,6 +500,17 @@ static void rtw_pci_dma_reset(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci)
        rtwpci->rx_tag = 0;
 }
 
+static void rtw_pci_dma_release(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci)
+{
+       struct rtw_pci_tx_ring *tx_ring;
+       u8 queue;
+
+       for (queue = 0; queue < RTK_MAX_TX_QUEUE_NUM; queue++) {
+               tx_ring = &rtwpci->tx_rings[queue];
+               rtw_pci_free_tx_ring_skbs(rtwdev, tx_ring);
+       }
+}
+
 static int rtw_pci_start(struct rtw_dev *rtwdev)
 {
        struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
@@ -521,6 +532,7 @@ static void rtw_pci_stop(struct rtw_dev *rtwdev)
 
        spin_lock_irqsave(&rtwpci->irq_lock, flags);
        rtw_pci_disable_interrupt(rtwdev, rtwpci);
+       rtw_pci_dma_release(rtwdev, rtwpci);
        spin_unlock_irqrestore(&rtwpci->irq_lock, flags);
 }