diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-05-28 12:17:47 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@kernel.org> | 2024-06-18 13:22:10 +0300 |
commit | b734d8830f70813e17f470daa60f535a6df4d570 (patch) | |
tree | 811c7c156bfd57193676b845ac175912ed36d696 | |
parent | 64ff013ce0986952fad1678d7faf8998584fc500 (diff) | |
download | linux-b734d8830f70813e17f470daa60f535a6df4d570.tar.xz |
wifi: wl18xx: make wl18xx_tx_immediate_complete() more efficient
wl18xx_tx_immediate_complete() iterates through the completed transmit
descriptors in a circular fashion, and in doing so uses a modulus
operation that is not a power of two. This leads to inefficient code
generation, which can be easily solved by providing a helper to
increment to the next descriptor. Use this more efficient solution.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxn-00E8vW-9h@rmk-PC.armlinux.org.uk
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/tx.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/tx.c b/drivers/net/wireless/ti/wl18xx/tx.c index 55d9b0861c53..beef393853ef 100644 --- a/drivers/net/wireless/ti/wl18xx/tx.c +++ b/drivers/net/wireless/ti/wl18xx/tx.c @@ -129,6 +129,14 @@ static void wl18xx_tx_complete_packet(struct wl1271 *wl, u8 tx_stat_byte) wl1271_free_tx_id(wl, id); } +static u8 wl18xx_next_tx_idx(u8 idx) +{ + if (++idx >= WL18XX_FW_MAX_TX_STATUS_DESC) + idx = 0; + + return idx; +} + void wl18xx_tx_immediate_complete(struct wl1271 *wl) { struct wl18xx_fw_status_priv *status_priv = @@ -161,9 +169,8 @@ void wl18xx_tx_immediate_complete(struct wl1271 *wl) return; } - for (i = priv->last_fw_rls_idx; - i != status_priv->fw_release_idx; - i = (i + 1) % WL18XX_FW_MAX_TX_STATUS_DESC) { + for (i = priv->last_fw_rls_idx; i != status_priv->fw_release_idx; + i = wl18xx_next_tx_idx(i)) { wl18xx_tx_complete_packet(wl, status_priv->released_tx_desc[i]); |