diff mbox series

[v5,1/7] wcn36xx: Functionally decompose wcn36xx_smd_config_sta()

Message ID 20200910150631.2178970-2-bryan.odonoghue@linaro.org
State New
Headers show
Series wcn36xx: Tidy up BSS/STA config | expand

Commit Message

Bryan O'Donoghue Sept. 10, 2020, 3:06 p.m. UTC
This commit functionally decomposes wcn36xx_smd_config_sta into a clearly
defined wcn36xx_smd_config_sta_v0 and wcn36xx_smd_config_sta_v1 path.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

---
 drivers/net/wireless/ath/wcn36xx/smd.c | 53 ++++++++++++++++----------
 1 file changed, 32 insertions(+), 21 deletions(-)

-- 
2.27.0


_______________________________________________
wcn36xx mailing list
wcn36xx@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/wcn36xx

Comments

Kalle Valo Sept. 21, 2020, 1:17 p.m. UTC | #1
Bryan O'Donoghue <bryan.odonoghue@linaro.org> wrote:

> This commit functionally decomposes wcn36xx_smd_config_sta into a clearly

> defined wcn36xx_smd_config_sta_v0 and wcn36xx_smd_config_sta_v1 path.

> 

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


7 patches applied to ath-next branch of ath.git, thanks.

fe784c28fee1 wcn36xx: Functionally decompose wcn36xx_smd_config_sta()
9e212908b547 wcn36xx: Move wcn36xx_smd_set_sta_params() inside wcn36xx_smd_config_bss()
683693102072 wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params()
7656d1798556 wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally
1cdab0f89663 wcn36xx: Add wcn36xx_smd_config_bss_v0
5a7b60ad56d7 wcn36xx: Convert to using wcn36xx_smd_config_bss_v0()
d1e11d5f2167 wcn36xx: Remove dead code in wcn36xx_smd_config_bss()

-- 
https://patchwork.kernel.org/patch/11768939/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
wcn36xx mailing list
wcn36xx@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/wcn36xx
Kalle Valo Sept. 21, 2020, 1:17 p.m. UTC | #2
Bryan O'Donoghue <bryan.odonoghue@linaro.org> wrote:

> This commit functionally decomposes wcn36xx_smd_config_sta into a clearly

> defined wcn36xx_smd_config_sta_v0 and wcn36xx_smd_config_sta_v1 path.

> 

> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


7 patches applied to ath-next branch of ath.git, thanks.

fe784c28fee1 wcn36xx: Functionally decompose wcn36xx_smd_config_sta()
9e212908b547 wcn36xx: Move wcn36xx_smd_set_sta_params() inside wcn36xx_smd_config_bss()
683693102072 wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params()
7656d1798556 wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally
1cdab0f89663 wcn36xx: Add wcn36xx_smd_config_bss_v0
5a7b60ad56d7 wcn36xx: Convert to using wcn36xx_smd_config_bss_v0()
d1e11d5f2167 wcn36xx: Remove dead code in wcn36xx_smd_config_bss()

-- 
https://patchwork.kernel.org/patch/11768939/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 71ecf3ef5ab2..475d4f60185c 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1326,54 +1326,65 @@  static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
 }
 
 static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
-		     const struct wcn36xx_hal_config_sta_req_msg *orig)
+				     struct ieee80211_vif *vif,
+				     struct ieee80211_sta *sta)
 {
 	struct wcn36xx_hal_config_sta_req_msg_v1 msg_body;
-	struct wcn36xx_hal_config_sta_params_v1 *sta = &msg_body.sta_params;
+	struct wcn36xx_hal_config_sta_params_v1 *sta_params;
 
 	INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_STA_REQ);
 	msg_body.header.len -= WCN36XX_DIFF_STA_PARAMS_V1_NOVHT;
 
-	wcn36xx_smd_convert_sta_to_v1(wcn, &orig->sta_params,
-				      &msg_body.sta_params);
+	sta_params = &msg_body.sta_params;
+
+	wcn36xx_smd_set_sta_params_v1(wcn, vif, sta, sta_params);
 
 	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
 
 	wcn36xx_dbg(WCN36XX_DBG_HAL,
 		    "hal config sta v1 action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
-		    sta->action, sta->sta_index, sta->bssid_index,
-		    sta->bssid, sta->type, sta->mac, sta->aid);
+		    sta_params->action, sta_params->sta_index, sta_params->bssid_index,
+		    sta_params->bssid, sta_params->type, sta_params->mac, sta_params->aid);
 
 	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
 }
 
-int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
-			   struct ieee80211_sta *sta)
+static int wcn36xx_smd_config_sta_v0(struct wcn36xx *wcn,
+				     struct ieee80211_vif *vif,
+				     struct ieee80211_sta *sta)
 {
 	struct wcn36xx_hal_config_sta_req_msg msg;
 	struct wcn36xx_hal_config_sta_params *sta_params;
-	int ret;
 
-	mutex_lock(&wcn->hal_mutex);
 	INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_STA_REQ);
 
 	sta_params = &msg.sta_params;
 
 	wcn36xx_smd_set_sta_params(wcn, vif, sta, sta_params);
 
-	if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24)) {
-		ret = wcn36xx_smd_config_sta_v1(wcn, &msg);
-	} else {
-		PREPARE_HAL_BUF(wcn->hal_buf, msg);
+	PREPARE_HAL_BUF(wcn->hal_buf, msg);
 
-		wcn36xx_dbg(WCN36XX_DBG_HAL,
-			    "hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
-			    sta_params->action, sta_params->sta_index,
-			    sta_params->bssid_index, sta_params->bssid,
-			    sta_params->type, sta_params->mac, sta_params->aid);
+	wcn36xx_dbg(WCN36XX_DBG_HAL,
+		    "hal config sta action %d sta_index %d bssid_index %d bssid %pM type %d mac %pM aid %d\n",
+		    sta_params->action, sta_params->sta_index,
+		    sta_params->bssid_index, sta_params->bssid,
+		    sta_params->type, sta_params->mac, sta_params->aid);
+
+	return wcn36xx_smd_send_and_wait(wcn, msg.header.len);
+}
+
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+			   struct ieee80211_sta *sta)
+{
+	int ret;
+
+	mutex_lock(&wcn->hal_mutex);
+
+	if (!wcn36xx_is_fw_version(wcn, 1, 2, 2, 24))
+		ret = wcn36xx_smd_config_sta_v1(wcn, vif, sta);
+	else
+		ret = wcn36xx_smd_config_sta_v0(wcn, vif, sta);
 
-		ret = wcn36xx_smd_send_and_wait(wcn, msg.header.len);
-	}
 	if (ret) {
 		wcn36xx_err("Sending hal_config_sta failed\n");
 		goto out;