[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231118155105.25678-12-yury.norov@gmail.com>
Date: Sat, 18 Nov 2023 07:50:42 -0800
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org, Ping-Ke Shih <pkshih@...ltek.com>,
Kalle Valo <kvalo@...nel.org>, linux-wireless@...r.kernel.org
Cc: Yury Norov <yury.norov@...il.com>, Jan Kara <jack@...e.cz>,
Mirsad Todorovac <mirsad.todorovac@....unizg.hr>,
Matthew Wilcox <willy@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Maxim Kuvyrkov <maxim.kuvyrkov@...aro.org>,
Alexey Klimov <klimov.linux@...il.com>
Subject: [PATCH 11/34] wifi: rtw88: optimize rtw_pci_tx_kick_off() by using find_bit()
rtw_pci_tx_kick_off() traverses tx_queued bitmap bit by bit. We can do it
faster by using atomic for_each_test_and_clear_bit() iterator.
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
drivers/net/wireless/realtek/rtw88/pci.c | 5 ++---
drivers/net/wireless/realtek/rtw89/pci.c | 5 +----
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
index 2bfc0e822b8d..a0d69c75a381 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -789,9 +789,8 @@ static void rtw_pci_tx_kick_off(struct rtw_dev *rtwdev)
struct rtw_pci *rtwpci = (struct rtw_pci *)rtwdev->priv;
enum rtw_tx_queue_type queue;
- for (queue = 0; queue < RTK_MAX_TX_QUEUE_NUM; queue++)
- if (test_and_clear_bit(queue, rtwpci->tx_queued))
- rtw_pci_tx_kick_off_queue(rtwdev, queue);
+ for_each_test_and_clear_bit(queue, rtwpci->tx_queued, RTK_MAX_TX_QUEUE_NUM)
+ rtw_pci_tx_kick_off_queue(rtwdev, queue);
}
static int rtw_pci_tx_write_data(struct rtw_dev *rtwdev,
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index 14ddb0d39e63..184d41b774d7 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -1077,10 +1077,7 @@ static void rtw89_pci_tx_kick_off_pending(struct rtw89_dev *rtwdev)
struct rtw89_pci_tx_ring *tx_ring;
int txch;
- for (txch = 0; txch < RTW89_TXCH_NUM; txch++) {
- if (!test_and_clear_bit(txch, rtwpci->kick_map))
- continue;
-
+ for_each_test_and_clear_bit(txch, rtwpci->kick_map, RTW89_TXCH_NUM) {
tx_ring = &rtwpci->tx_rings[txch];
__rtw89_pci_tx_kick_off(rtwdev, tx_ring);
}
--
2.39.2
Powered by blists - more mailing lists