mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 08:34:20 +08:00
rtw89: pci: reclaim TX BD only if it really need
To reclaim TX BD, we need to read hardware reading index to determine if any DMA is complete. Since this IO spends time, do this thing only if we really need it when TX BD has no free buffer corresponding to target skb. The experimental result shows that reading counter decreases from 26,000 to 130 per second. Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220421120903.73715-4-pkshih@realtek.com
This commit is contained in:
parent
e1757e8045
commit
8372026846
@ -411,11 +411,14 @@ static void rtw89_pci_release_txwd_skb(struct rtw89_dev *rtwdev,
|
||||
struct sk_buff *skb, *tmp;
|
||||
u8 txch = tx_ring->txch;
|
||||
|
||||
if (!list_empty(&txwd->list)) {
|
||||
rtw89_pci_reclaim_txbd(rtwdev, tx_ring);
|
||||
if (!list_empty(&txwd->list)) {
|
||||
rtw89_warn(rtwdev, "queue %d txwd %d is not idle\n",
|
||||
txch, seq);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* currently, support for only one frame */
|
||||
if (skb_queue_len(&txwd->queue) != 1) {
|
||||
@ -458,7 +461,6 @@ static void rtw89_pci_release_rpp(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
|
||||
tx_ring = &rtwpci->tx_rings[txch];
|
||||
rtw89_pci_reclaim_txbd(rtwdev, tx_ring);
|
||||
wd_ring = &tx_ring->wd_ring;
|
||||
txwd = &wd_ring->pages[seq];
|
||||
|
||||
@ -915,6 +917,10 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
|
||||
if (!cnt)
|
||||
goto out_unlock;
|
||||
rtw89_pci_release_tx(rtwdev, rx_ring, cnt);
|
||||
|
||||
bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
|
||||
if (bd_cnt == 0)
|
||||
rtw89_pci_reclaim_txbd(rtwdev, tx_ring);
|
||||
}
|
||||
|
||||
bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
|
||||
|
Loading…
Reference in New Issue
Block a user