[PATCH 7/9] wcn36xx: move AID to sta_priv struct

Eugene Krasnikov k.eugene.e at gmail.com
Fri Sep 6 04:09:19 EDT 2013


This is where AID should be stored.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c    | 23 ++++++++++++++++-------
 smd.c     |  4 +++-
 wcn36xx.h |  2 +-
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/main.c b/main.c
index aaa4176..a4f564a 100644
--- a/main.c
+++ b/main.c
@@ -411,7 +411,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		} else {
 			sta_priv->is_data_encrypted = false;
 			/* do not remove key if disassociated */
-			if (wcn->aid)
+			if (sta_priv->aid)
 				wcn36xx_smd_remove_stakey(wcn,
 					wcn->encrypt_type,
 					key_conf->keyidx,
@@ -557,8 +557,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 				     vif->addr,
 				     bss_conf->aid);
 
-			wcn->aid = bss_conf->aid;
-
 			rcu_read_lock();
 			sta = ieee80211_find_sta(vif, bss_conf->bssid);
 			if (!sta) {
@@ -578,6 +576,12 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 			wcn36xx_smd_config_bss(wcn, vif, sta,
 					       bss_conf->bssid,
 					       true);
+			sta_priv->aid = bss_conf->aid;
+			/*
+			 * config_sta must be called from  because this is the
+			 * place where AID is available.
+			 */
+			wcn36xx_smd_config_sta(wcn, vif, sta);
 			rcu_read_unlock();
 		} else {
 			wcn36xx_dbg(WCN36XX_DBG_MAC,
@@ -585,7 +589,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 				    bss_conf->bssid,
 				    vif->addr,
 				    bss_conf->aid);
-			wcn->aid = 0;
 			wcn36xx_smd_set_link_st(wcn,
 						bss_conf->bssid,
 						vif->addr,
@@ -692,14 +695,20 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 {
 	struct wcn36xx *wcn = hw->priv;
 	struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
+	struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
 		    vif, sta->addr);
 
 	wcn->sta = (struct wcn36xx_sta *)sta->drv_priv;
 	vif_priv->sta = (struct wcn36xx_sta *)sta->drv_priv;
-	wcn->aid = sta->aid;
-	wcn36xx_smd_config_sta(wcn, vif, sta);
-
+	/*
+	 * For STA mode HW will be configured on BSS_CHANGED_ASSOC because
+	 * at this stage AID is not available yet.
+	 */
+	if (NL80211_IFTYPE_STATION != vif->type) {
+		sta_priv->aid = sta->aid;
+		wcn36xx_smd_config_sta(wcn, vif, sta);
+	}
 	return 0;
 }
 
diff --git a/smd.c b/smd.c
index 7fdc001..1251b3d 100644
--- a/smd.c
+++ b/smd.c
@@ -116,6 +116,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
 		struct wcn36xx_hal_config_sta_params *sta_params)
 {
 	struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
+	struct wcn36xx_sta *priv_sta = NULL;
 	if (vif->type == NL80211_IFTYPE_ADHOC ||
 	    vif->type == NL80211_IFTYPE_AP ||
 	    vif->type == NL80211_IFTYPE_MESH_POINT) {
@@ -126,7 +127,6 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
 		sta_params->sta_index = 1;
 	}
 
-	sta_params->aid = wcn->aid;
 	sta_params->listen_interval = WCN36XX_LISTEN_INTERVAL(wcn);
 
 	/*
@@ -157,12 +157,14 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
 		sizeof(wcn->supported_rates));
 
 	if (sta) {
+		priv_sta = (struct wcn36xx_sta *)sta->drv_priv;
 		if (NL80211_IFTYPE_STATION == vif->type)
 			memcpy(&sta_params->bssid, sta->addr, ETH_ALEN);
 		else
 			memcpy(&sta_params->mac, sta->addr, ETH_ALEN);
 		sta_params->wmm_enabled = sta->wme;
 		sta_params->max_sp_len = sta->max_sp;
+		sta_params->aid = priv_sta->aid;
 		wcn36xx_smd_set_sta_ht_params(sta, sta_params);
 	}
 }
diff --git a/wcn36xx.h b/wcn36xx.h
index 242edb6..f32613d 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -146,6 +146,7 @@ struct wcn36xx_vif {
  * |______________|_____________|_______________|
  */
 struct wcn36xx_sta {
+	u16 aid;
 	u16 tid;
 	u8 sta_index;
 	u8 dpu_desc_index;
@@ -159,7 +160,6 @@ struct wcn36xx {
 	struct device		*dev;
 	struct mac_address	addresses;
 	struct wcn36xx_hal_mac_ssid ssid;
-	u16			aid;
 	struct list_head	vif_list;
 	struct wcn36xx_vif	*current_vif;
 	struct wcn36xx_sta	*sta;
-- 
1.8.2.2




More information about the wcn36xx mailing list