[PATCH 6/6] Move is_joining to wcn_sta struct

Olof Johansson dev at skyshaper.net
Tue Jul 9 05:20:04 EDT 2013


Moves this parameter to the sta struct where it belongs.
---
 main.c    | 22 +++++++++++++++++-----
 txrx.c    |  5 +++--
 wcn36xx.h |  4 ++--
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/main.c b/main.c
index 91985a8..9df0635 100644
--- a/main.c
+++ b/main.c
@@ -509,18 +509,30 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 	}
 
 	if (changed & BSS_CHANGED_BSSID) {
+		struct ieee80211_sta *sta;
 		wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM",
 			    bss_conf->bssid);
 
 		if (!is_zero_ether_addr(bss_conf->bssid)) {
-			wcn->is_joining = true;
+
+			rcu_read_lock();
+			sta = ieee80211_find_sta(vif, bss_conf->bssid);
+			if(sta)
+				((struct wcn_sta*)(sta->drv_priv))->is_joining = true;
+			rcu_read_unlock();
+
 			wcn36xx_smd_join(wcn, bss_conf->bssid,
 					 vif->addr, WCN36XX_HW_CHANNEL(wcn));
 			wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
 					       bss_conf->bssid, false,
 					       wcn->beacon_interval);
 		} else {
-			wcn->is_joining = false;
+			rcu_read_lock();
+			sta = ieee80211_find_sta(vif, bss_conf->bssid);
+			if(sta)
+				((struct wcn_sta*)(sta->drv_priv))->is_joining = false;
+			rcu_read_unlock();
+
 			wcn36xx_smd_delete_bss(wcn);
 		}
 	}
@@ -536,7 +548,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 	}
 
 	if (changed & BSS_CHANGED_ASSOC) {
-		wcn->is_joining = false;
 		if (bss_conf->assoc) {
 			struct ieee80211_sta *sta;
 
@@ -550,8 +561,10 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 
 			rcu_read_lock();
 			sta = ieee80211_find_sta(vif, bss_conf->bssid);
-			if(sta)
+			if(sta) {
+				((struct wcn_sta*)(sta->drv_priv))->is_joining = false;
 				wcn36xx_update_allowed_rates(wcn, sta);
+			}
 			rcu_read_unlock();
 
 			wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
@@ -927,7 +940,6 @@ static int __init wcn36xx_init(void)
 
 	wcn->aid = 0;
 	wcn->current_vif = NULL;
-	wcn->is_joining = false;
 
 	mutex_init(&wcn->pm_mutex);
 	mutex_init(&wcn->smd_mutex);
diff --git a/txrx.c b/txrx.c
index c2a95cb..a968fb3 100644
--- a/txrx.c
+++ b/txrx.c
@@ -107,6 +107,7 @@ static void wcn36xx_set_tx_data(struct wcn36xx_tx_bd *bd,
 
 static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
 				struct wcn36xx *wcn,
+				struct wcn_sta *sta_priv,
 				struct ieee80211_hdr *hdr,
 				bool bcast)
 {
@@ -128,7 +129,7 @@ static void wcn36xx_set_tx_mgmt(struct wcn36xx_tx_bd *bd,
 	 * In joining state trick hardware that probe is sent as
 	 * unicast even if address is broadcast.
 	 */
-	if (wcn->is_joining &&
+	if (sta_priv && sta_priv->is_joining &&
 	    ieee80211_is_probe_req(hdr->frame_control))
 		bcast = false;
 
@@ -209,7 +210,7 @@ int wcn36xx_start_tx(struct wcn36xx *wcn,
 		wcn36xx_set_tx_data(bd, wcn, sta_priv, hdr, bcast);
 	} else {
 		/* MGMT and CTRL frames are handeld here*/
-		wcn36xx_set_tx_mgmt(bd, wcn, hdr, bcast);
+		wcn36xx_set_tx_mgmt(bd, wcn, sta_priv, hdr, bcast);
 	}
 
 	buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
diff --git a/wcn36xx.h b/wcn36xx.h
index 3c70e7a..a16642a 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -106,7 +106,9 @@ struct wcn36xx_vif {
 struct wcn_sta {
 	u8 sta_id;
 	bool is_data_encrypted;
+	bool is_joining;
 };
+
 struct wcn36xx_dxe_ch;
 struct wcn36xx {
 	struct ieee80211_hw	*hw;
@@ -158,8 +160,6 @@ struct wcn36xx {
 	struct work_struct	rx_ready_work;
 	struct completion	smd_compl;
 
-	bool			is_joining;
-
 	/* DXE channels */
 	struct wcn36xx_dxe_ch	dxe_tx_l_ch;	/* TX low */
 	struct wcn36xx_dxe_ch	dxe_tx_h_ch;	/* TX high */
-- 
1.8.3.1




More information about the wcn36xx mailing list