Commit b734d883 authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Kalle Valo

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: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/E1sBsxn-00E8vW-9h@rmk-PC.armlinux.org.uk
parent 64ff013c
...@@ -129,6 +129,14 @@ static void wl18xx_tx_complete_packet(struct wl1271 *wl, u8 tx_stat_byte) ...@@ -129,6 +129,14 @@ static void wl18xx_tx_complete_packet(struct wl1271 *wl, u8 tx_stat_byte)
wl1271_free_tx_id(wl, id); 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) void wl18xx_tx_immediate_complete(struct wl1271 *wl)
{ {
struct wl18xx_fw_status_priv *status_priv = struct wl18xx_fw_status_priv *status_priv =
...@@ -161,9 +169,8 @@ void wl18xx_tx_immediate_complete(struct wl1271 *wl) ...@@ -161,9 +169,8 @@ void wl18xx_tx_immediate_complete(struct wl1271 *wl)
return; return;
} }
for (i = priv->last_fw_rls_idx; for (i = priv->last_fw_rls_idx; i != status_priv->fw_release_idx;
i != status_priv->fw_release_idx; i = wl18xx_next_tx_idx(i)) {
i = (i + 1) % WL18XX_FW_MAX_TX_STATUS_DESC) {
wl18xx_tx_complete_packet(wl, wl18xx_tx_complete_packet(wl,
status_priv->released_tx_desc[i]); status_priv->released_tx_desc[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment