linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wcn36xx: Don't run scan_init multiple times
@ 2020-11-20  2:14 Bryan O'Donoghue
  2020-11-20  2:14 ` [PATCH] wcn36xx: Send NULL data packet when exiting BMPS Bryan O'Donoghue
  2020-11-20  8:12 ` [PATCH] wcn36xx: Don't run scan_init multiple times Loic Poulain
  0 siblings, 2 replies; 7+ messages in thread
From: Bryan O'Donoghue @ 2020-11-20  2:14 UTC (permalink / raw)
  To: kvalo, wcn36xx, linux-wireless
  Cc: bryan.odonoghue, shawn.guo, loic.poulain, benl

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@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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-02 18:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-20  2:14 [PATCH] wcn36xx: Don't run scan_init multiple times Bryan O'Donoghue
2020-11-20  2:14 ` [PATCH] wcn36xx: Send NULL data packet when exiting BMPS Bryan O'Donoghue
2020-11-20  8:15   ` Loic Poulain
2020-11-20 11:58     ` Bryan O'Donoghue
2020-12-02 18:33   ` Kalle Valo
2020-11-20  8:12 ` [PATCH] wcn36xx: Don't run scan_init multiple times Loic Poulain
2020-11-20 11:45   ` Bryan O'Donoghue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).