linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: kvalo@codeaurora.org
Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org,
	bryan.odonoghue@linaro.org, shawn.guo@linaro.org
Subject: [PATCH 21/36] wcn36xx: Functionally decompose wcn36xx_smd_config_sta()
Date: Mon,  3 Aug 2020 04:11:17 +0100	[thread overview]
Message-ID: <20200803031132.1427063-22-bryan.odonoghue@linaro.org> (raw)
In-Reply-To: <20200803031132.1427063-1-bryan.odonoghue@linaro.org>

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>
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 53 ++++++++++++++++----------
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 2d6779cfa59c..7ad75faf8c4b 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -1306,10 +1306,11 @@ 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;
 
 	if (wcn->rf_id == RF_IRIS_WCN3680) {
 		INIT_HAL_MSG_V1(msg_body, WCN36XX_HAL_CONFIG_STA_REQ);
@@ -1318,46 +1319,56 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
 		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;
-- 
2.27.0


  parent reply	other threads:[~2020-08-03  3:11 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  3:10 [PATCH 00/36] wcn36xx: Add support for WCN3680 802.11ac Bryan O'Donoghue
2020-08-03  3:10 ` [PATCH 01/36] wcn36xx: Add ability to identify WCN3680 Bryan O'Donoghue
2020-08-26 15:28   ` Kalle Valo
2020-08-03  3:10 ` [PATCH 02/36] wcn36xx: Add ieee802.11 VHT flags Bryan O'Donoghue
2020-08-03  3:10 ` [PATCH 03/36] wcn36xx: Add 802.11ac MCS rates Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 04/36] wcn36xx: Specify ieee80211_rx_status.nss Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 05/36] wcn36xx: Add 802.11ac HAL param bitfields Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 06/36] wcn36xx: Add Supported rates V1 structure Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 07/36] wcn36xx: Use existing pointers in wcn36xx_smd_config_bss_v1 Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 08/36] wcn36xx: Set feature DOT11AC for wcn3680 Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 09/36] wcn36xx: Add VHT fields to parameter data structures Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 10/36] wcn36xx: Use V1 data structure to store supported rates Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 11/36] wcn36xx: Add wcn36xx_set_default_rates_v1 Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 12/36] wcn36xx: Add VHT rates to wcn36xx_update_allowed_rates() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 13/36] wcn36xx: Add wcn36xx_smd_set_sta_default_vht_params() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 14/36] wcn36xx: Add wcn36xx_smd_set_sta_default_ht_ldpc_params() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 15/36] wcn36xx: Add wcn36xx_smd_set_sta_vht_params() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 16/36] wcn36xx: Add wcn36xx_smd_set_sta_ht_ldpc_params() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 17/36] wcn36xx: Add wcn36xx_smd_set_bss_vht_params() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 18/36] wcn36xx: Add wrapper function wcn36xx_smd_set_sta_params_v1() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 19/36] wcn36xx: Define INIT_HAL_MSG_V1() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 20/36] wcn36xx: Convert to VHT parameter structure on wcn3680 Bryan O'Donoghue
2020-08-03  3:11 ` Bryan O'Donoghue [this message]
2020-08-03  3:11 ` [PATCH 22/36] wcn36xx: Move wcn36xx_smd_set_sta_params() inside wcn36xx_smd_config_bss() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 23/36] wcn36xx: Move BSS parameter setup to wcn36xx_smd_set_bss_params() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 24/36] wcn36xx: Add wcn36xx_smd_config_bss_v0 Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 25/36] wcn36xx: Update wcn36xx_smd_config_bss_v1() to operate internally Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 26/36] wcn36xx: Convert to using wcn36xx_smd_config_bss_v0() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 27/36] wcn36xx: Remove dead code in wcn36xx_smd_config_bss() Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 28/36] wcn36xx: Latch VHT specific BSS parameters to firmware Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 29/36] wcn36xx: Add accessor macro HW_VALUE_CHANNEL for hardware channels Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 30/36] wcn36xx: Use HW_VALUE_CHANNEL macro to get channel number Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 31/36] wcn36xx: Add accessor macro HW_VALUE_PHY for PHY settings Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 32/36] wcn36xx: Encode PHY mode for 80MHz channel in hw_value Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 33/36] wcn36xx: Set PHY into correct mode for 80MHz channel width Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 34/36] wcn36xx: Extend HAL param config list Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 35/36] wcn36xx: Define wcn3680 specific firmware parameters Bryan O'Donoghue
2020-08-03  3:11 ` [PATCH 36/36] wcn36xx: Add ability to download " Bryan O'Donoghue
2020-08-26 15:27 ` [PATCH 00/36] wcn36xx: Add support for WCN3680 802.11ac Kalle Valo
2020-08-26 16:17   ` Bryan O'Donoghue
2020-08-27  8:06     ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803031132.1427063-22-bryan.odonoghue@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=wcn36xx@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).