[PATCH 2/3] Store bss_id returned from config_bss command

Eugene Krasnikov k.eugene.e at gmail.com
Thu Jul 18 12:58:46 EDT 2013


bss_id must be stored and used in other SMD commands.
Invalid value for bss_id is 0xFF.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c    |  1 +
 smd.c     | 19 +++++++------------
 wcn36xx.h |  8 ++++++++
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/main.c b/main.c
index a9f2209..5f95379 100644
--- a/main.c
+++ b/main.c
@@ -519,6 +519,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 
 		if (!is_zero_ether_addr(bss_conf->bssid)) {
 			wcn->is_joining = true;
+			wcn->current_vif->bss_index = 0xff;
 			wcn36xx_smd_join(wcn, bss_conf->bssid,
 					 vif->addr, WCN36XX_HW_CHANNEL(wcn));
 			wcn36xx_smd_config_bss(wcn, vif, NULL,
diff --git a/smd.c b/smd.c
index 1592711..991a70b 100644
--- a/smd.c
+++ b/smd.c
@@ -122,7 +122,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
 	sta_params->uapsd = 0;
 	sta_params->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
 	sta_params->max_ampdu_duration = 0;
-	sta_params->bssid_index = 0;
+	sta_params->bssid_index = wcn->current_vif->bss_index;
 	sta_params->p2p = 0;
 
 	memcpy(&sta_params->supported_rates, &wcn->supported_rates,
@@ -889,13 +889,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 	bss->tx_mgmt_power = 0;
 	bss->max_tx_power = WCN36XX_MAX_POWER(wcn);
 
-	if (update) {
-		sta_params->bssid_index = 0;
-		bss->action = 1;
-	} else {
-		sta_params->bssid_index = 0xff;
-		bss->action = 0;
-	}
+	bss->action = update;
 	if (!(wcn->fw_major == 1 &&
 		wcn->fw_minor == 2 &&
 		wcn->fw_version == 2 &&
@@ -945,6 +939,7 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn, void *buf, size_t len
 		    params->bss_bcast_sta_idx, params->mac,
 		    params->tx_mgmt_power, params->ucast_dpu_signature);
 
+	wcn->current_vif->bss_index = params->bss_index;
 	wcn->current_vif->sta_index =  params->bss_sta_index;
 	wcn->current_vif->dpu_desc_index = params->dpu_desc_index;
 	wcn->current_vif->ucast_dpu_signature = params->ucast_dpu_signature;
@@ -957,7 +952,7 @@ int wcn36xx_smd_delete_bss(struct wcn36xx *wcn)
 
 	INIT_HAL_MSG(msg_body, WCN36XX_HAL_DELETE_BSS_REQ);
 
-	msg_body.bss_index = 0;
+	msg_body.bss_index = wcn->current_vif->bss_index;
 
 	PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
 
@@ -1114,7 +1109,7 @@ int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, u64 tbtt)
 
 	INIT_HAL_MSG(msg_body, WCN36XX_HAL_ENTER_BMPS_REQ);
 
-	msg_body.bss_index = 0;
+	msg_body.bss_index = wcn->current_vif->bss_index;
 	msg_body.tbtt = tbtt;
 	msg_body.dtim_period = wcn->dtim_period;
 
@@ -1129,7 +1124,7 @@ int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn)
 
 	INIT_HAL_MSG(msg_body, WCN36XX_HAL_EXIT_BMPS_REQ);
 
-	msg_body.bss_index = 0;
+	msg_body.bss_index = wcn->current_vif->bss_index;
 
 	PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
 
@@ -1146,7 +1141,7 @@ int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int packet_type)
 	INIT_HAL_MSG(msg_body, WCN36XX_HAL_KEEP_ALIVE_REQ);
 
 	if (packet_type == WCN36XX_HAL_KEEP_ALIVE_NULL_PKT) {
-		msg_body.bss_index = 0;
+		msg_body.bss_index = wcn->current_vif->bss_index;
 		msg_body.packet_type = WCN36XX_HAL_KEEP_ALIVE_NULL_PKT;
 		msg_body.time_period = WCN36XX_KEEP_ALIVE_TIME_PERIOD;
 	} else if (packet_type == WCN36XX_HAL_KEEP_ALIVE_UNSOLICIT_ARP_RSP) {
diff --git a/wcn36xx.h b/wcn36xx.h
index 8aaec63..b0d7704 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -96,7 +96,15 @@ struct nv_data {
 	int	is_valid;
 	void	*table;
 };
+/**
+ * struct wcn36xx_vif - holds VIF related fields
+ *
+ * @bss_index: bss_index is initially set to 0xFF. bss_index is received from
+ * HW after first config_bss call and must be used in delete_bss and
+ * enter/exit_bmps.
+ */
 struct wcn36xx_vif {
+	u8 bss_index;
 	u8 sta_index;
 	u8 dpu_desc_index;
 	u8 ucast_dpu_signature;
-- 
1.8.2.2




More information about the wcn36xx mailing list