[PATCH] wcn36xx: Don't run scan_init multiple times
Bryan O'Donoghue
bryan.odonoghue at linaro.org
Thu Nov 19 21:14:02 EST 2020
Run scan_init only once. There's no need to run this command multiple times
if it has already been run once.
The software scan algorithm can end up repeatedly calling scan_init on each
loop resulting in between four and eight milliseconds of lost time on each
callout.
Subtract the overhead now.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
---
drivers/net/wireless/ath/wcn36xx/smd.c | 6 ++++++
drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index acf533fae46a..ec082cf3ab09 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -706,6 +706,10 @@ int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode,
int ret;
mutex_lock(&wcn->hal_mutex);
+ if (wcn->scan_init) {
+ ret = 0;
+ goto out;
+ }
INIT_HAL_MSG(msg_body, WCN36XX_HAL_INIT_SCAN_REQ);
msg_body.mode = mode;
@@ -731,6 +735,7 @@ int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode,
wcn36xx_err("hal_init_scan response failed err=%d\n", ret);
goto out;
}
+ wcn->scan_init = true;
out:
mutex_unlock(&wcn->hal_mutex);
return ret;
@@ -761,6 +766,7 @@ int wcn36xx_smd_start_scan(struct wcn36xx *wcn, u8 scan_channel)
wcn36xx_err("hal_start_scan response failed err=%d\n", ret);
goto out;
}
+ wcn->scan_init = false;
out:
mutex_unlock(&wcn->hal_mutex);
return ret;
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 71fa9992b118..156df6d184c8 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -235,6 +235,7 @@ struct wcn36xx {
struct ieee80211_vif *sw_scan_vif;
struct mutex scan_lock;
bool scan_aborted;
+ bool scan_init;
/* DXE channels */
struct wcn36xx_dxe_ch dxe_tx_l_ch; /* TX low */
--
2.28.0
More information about the wcn36xx
mailing list