[PATCH 1/2] Configure bss when encryption is set

Eugene Krasnikov k.eugene.e at gmail.com
Tue Jun 25 11:10:52 EDT 2013


Before setting keys update HW with encryption type.

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

diff --git a/main.c b/main.c
index 00d6931..828b56c 100644
--- a/main.c
+++ b/main.c
@@ -355,7 +355,6 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 {
 	struct wcn36xx *wcn = hw->priv;
 	int ret = 0;
-	enum ani_ed_type enc_type;
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac80211 set key");
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "Key: cmd=0x%x algo:0x%x, "
 		    "id:%d, len:%d flags 0x%x",
@@ -367,10 +366,10 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	switch (key_conf->cipher) {
 	case WLAN_CIPHER_SUITE_CCMP:
-		enc_type = WCN36XX_HAL_ED_CCMP;
+		wcn->encrypt_type = WCN36XX_HAL_ED_CCMP;
 		break;
 	case WLAN_CIPHER_SUITE_TKIP:
-		enc_type = WCN36XX_HAL_ED_TKIP;
+		wcn->encrypt_type = WCN36XX_HAL_ED_TKIP;
 		break;
 	default:
 		wcn36xx_error("Unsupported key type 0x%x",
@@ -379,19 +378,25 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		goto out;
 		break;
 	}
-
+	if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) {
+		wcn36xx_smd_config_bss(wcn,
+				       NL80211_IFTYPE_STATION,
+				       sta->addr,
+				       true,
+				       wcn->beacon_interval);
+	}
 	switch (cmd) {
 	case SET_KEY:
 		if (WCN36XX_STA_KEY == wcn->en_state) {
 			wcn36xx_smd_set_stakey(wcn,
-				enc_type,
+				wcn->encrypt_type,
 				key_conf->keyidx,
 				key_conf->keylen,
 				key_conf->key);
 			wcn->en_state = WCN36XX_BSS_KEY;
 		} else {
 			wcn36xx_smd_set_bsskey(wcn,
-				enc_type,
+				wcn->encrypt_type,
 				key_conf->keyidx,
 				key_conf->keylen,
 				key_conf->key);
@@ -400,14 +405,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	case DISABLE_KEY:
 		if (WCN36XX_BSS_KEY == wcn->en_state) {
 			wcn36xx_smd_remove_bsskey(wcn,
-				enc_type,
+				wcn->encrypt_type,
 				key_conf->keyidx);
 			wcn->en_state = WCN36XX_STA_KEY;
 		} else {
 			/* do not remove key if disassociated */
 			if (wcn->aid)
 				wcn36xx_smd_remove_stakey(wcn,
-							  enc_type,
+							  wcn->encrypt_type,
 							  key_conf->keyidx);
 		}
 		break;
@@ -869,6 +874,7 @@ static int __init wcn36xx_init(void)
 	wcn->aid = 0;
 	wcn->current_vif = NULL;
 	wcn->is_joining = false;
+	wcn->encrypt_type = WCN36XX_HAL_ED_NONE;
 	wcn->hw->wiphy->n_addresses = ARRAY_SIZE(wcn->addresses);
 	wcn->hw->wiphy->addresses = wcn->addresses;
 
diff --git a/smd.c b/smd.c
index 2bb272a..1f64a67 100644
--- a/smd.c
+++ b/smd.c
@@ -763,7 +763,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
 	       sizeof(wcn->supported_rates));
 
 	sta->rmf = 0;
-	sta->encrypt_type = 0;
+	sta->encrypt_type = wcn->encrypt_type;
 	sta->action = 0;
 	sta->uapsd = 0;
 	sta->max_sp_len = 0;
diff --git a/wcn36xx.h b/wcn36xx.h
index a81ef84..c0bf667 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -116,7 +116,7 @@ struct wcn36xx {
 	u16			aid;
 	struct wcn36xx_vif	*current_vif;
 	u16			beacon_interval;
-
+	enum ani_ed_type	encrypt_type;
 	u8			fw_revision;
 	u8			fw_version;
 	u8			fw_minor;
-- 
1.7.11.3




More information about the wcn36xx mailing list