[PATCH 1/8] wcn36xx: move encrypt_type to wcn36xx_vif struct

Eugene Krasnikov k.eugene.e at gmail.com
Mon Sep 9 09:35:15 EDT 2013


This where information about encryption must be stored.

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

diff --git a/main.c b/main.c
index 651863f..e585ef1 100644
--- a/main.c
+++ b/main.c
@@ -319,6 +319,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 			   struct ieee80211_key_conf *key_conf)
 {
 	struct wcn36xx *wcn = hw->priv;
+	struct wcn36xx_vif *vif_priv = (struct wcn36xx_vif *)vif->drv_priv;
 	struct wcn36xx_sta *sta_priv = NULL;
 	int ret = 0;
 	u8 key[WLAN_MAX_KEY_LEN];
@@ -334,16 +335,16 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	switch (key_conf->cipher) {
 	case WLAN_CIPHER_SUITE_WEP40:
-		wcn->encrypt_type = WCN36XX_HAL_ED_WEP40;
+		vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
 		break;
 	case WLAN_CIPHER_SUITE_WEP104:
-		wcn->encrypt_type = WCN36XX_HAL_ED_WEP40;
+		vif_priv->encrypt_type = WCN36XX_HAL_ED_WEP40;
 		break;
 	case WLAN_CIPHER_SUITE_CCMP:
-		wcn->encrypt_type = WCN36XX_HAL_ED_CCMP;
+		vif_priv->encrypt_type = WCN36XX_HAL_ED_CCMP;
 		break;
 	case WLAN_CIPHER_SUITE_TKIP:
-		wcn->encrypt_type = WCN36XX_HAL_ED_TKIP;
+		vif_priv->encrypt_type = WCN36XX_HAL_ED_TKIP;
 		break;
 	default:
 		wcn36xx_err("Unsupported key type 0x%x\n",
@@ -354,7 +355,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	switch (cmd) {
 	case SET_KEY:
-		if (WCN36XX_HAL_ED_TKIP == wcn->encrypt_type) {
+		if (WCN36XX_HAL_ED_TKIP == vif_priv->encrypt_type) {
 			/*
 			 * Supplicant is sending key in the wrong order:
 			 * Temporal Key (16 b) - TX MIC (8 b) - RX MIC (8 b)
@@ -380,14 +381,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 						       true);
 
 			wcn36xx_smd_set_stakey(wcn,
-				wcn->encrypt_type,
+				vif_priv->encrypt_type,
 				key_conf->keyidx,
 				key_conf->keylen,
 				key,
 				get_sta_index(vif, sta_priv));
 		} else {
 			wcn36xx_smd_set_bsskey(wcn,
-				wcn->encrypt_type,
+				vif_priv->encrypt_type,
 				key_conf->keyidx,
 				key_conf->keylen,
 				key);
@@ -395,7 +396,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 			    (WLAN_CIPHER_SUITE_WEP104 == key_conf->cipher)) {
 				sta_priv->is_data_encrypted = true;
 				wcn36xx_smd_set_stakey(wcn,
-					wcn->encrypt_type,
+					vif_priv->encrypt_type,
 					key_conf->keyidx,
 					key_conf->keylen,
 					key,
@@ -406,14 +407,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	case DISABLE_KEY:
 		if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
 			wcn36xx_smd_remove_bsskey(wcn,
-				wcn->encrypt_type,
+				vif_priv->encrypt_type,
 				key_conf->keyidx);
 		} else {
 			sta_priv->is_data_encrypted = false;
 			/* do not remove key if disassociated */
 			if (sta_priv->aid)
 				wcn36xx_smd_remove_stakey(wcn,
-					wcn->encrypt_type,
+					vif_priv->encrypt_type,
 					key_conf->keyidx,
 					get_sta_index(vif, sta_priv));
 		}
diff --git a/smd.c b/smd.c
index bcf35d5..8e0bf22 100644
--- a/smd.c
+++ b/smd.c
@@ -139,7 +139,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
 	else
 		memcpy(&sta_params->bssid, vif->addr, ETH_ALEN);
 
-	sta_params->encrypt_type = wcn->encrypt_type;
+	sta_params->encrypt_type = priv_vif->encrypt_type;
 	sta_params->short_preamble_supported =
 		!(WCN36XX_FLAGS(wcn) &
 		  IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE);
diff --git a/wcn36xx.h b/wcn36xx.h
index fedfab2..53dee3e 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -117,6 +117,7 @@ struct wcn36xx_vif {
 	struct list_head list;
 	struct wcn36xx_sta *sta;
 	u8 dtim_period;
+	enum ani_ed_type encrypt_type;
 	u8 bss_index;
 	u8 ucast_dpu_signature;
 	/* Returned from WCN36XX_HAL_ADD_STA_SELF_RSP */
@@ -164,7 +165,6 @@ struct wcn36xx {
 	struct list_head	vif_list;
 	struct wcn36xx_vif	*current_vif;
 	struct wcn36xx_sta	*sta;
-	enum ani_ed_type	encrypt_type;
 
 	u8			fw_revision;
 	u8			fw_version;
-- 
1.8.2.2




More information about the wcn36xx mailing list