aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2012-02-25 00:36:04 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-29 14:11:35 -0500
commit5eb02e44adc92a71bae3ff60acb1eea5ada14e93 (patch)
tree8c78ce0c14d948ea062f84df68b774cbfd21dc27 /drivers/net/wireless
parent1a907b749c0ae235ab46e3ba7834e6c143f5503e (diff)
mwifiex: remove unnecessary enum MWIFIEX_802_11_WEP_STATUS
Instead of defining an 'enum', we can simply use 'u8' flag for WEP status. Rename 'wep_status' to 'wep_enabled' to match with 'wpa_enabled' and 'wpa2_enabled'. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c2
-rw-r--r--drivers/net/wireless/mwifiex/fw.h5
-rw-r--r--drivers/net/wireless/mwifiex/init.c2
-rw-r--r--drivers/net/wireless/mwifiex/join.c5
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/scan.c47
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c10
7 files changed, 29 insertions, 44 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a08037e85101..503717c59358 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -146,7 +146,7 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
146 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev); 146 struct mwifiex_private *priv = mwifiex_netdev_get_priv(netdev);
147 147
148 /* Return if WEP key not configured */ 148 /* Return if WEP key not configured */
149 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED) 149 if (!priv->sec_info.wep_enabled)
150 return 0; 150 return 0;
151 151
152 if (mwifiex_set_encode(priv, NULL, 0, key_index, 0)) { 152 if (mwifiex_set_encode(priv, NULL, 0, key_index, 0)) {
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h
index 51c5417c569c..c82620094a53 100644
--- a/drivers/net/wireless/mwifiex/fw.h
+++ b/drivers/net/wireless/mwifiex/fw.h
@@ -86,11 +86,6 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
86 MWIFIEX_802_11_PRIV_FILTER_8021X_WEP 86 MWIFIEX_802_11_PRIV_FILTER_8021X_WEP
87}; 87};
88 88
89enum MWIFIEX_802_11_WEP_STATUS {
90 MWIFIEX_802_11_WEP_ENABLED,
91 MWIFIEX_802_11_WEP_DISABLED,
92};
93
94#define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF))) 89#define CAL_SNR(RSSI, NF) ((s16)((s16)(RSSI)-(s16)(NF)))
95 90
96#define PROPRIETARY_TLV_BASE_ID 0x0100 91#define PROPRIETARY_TLV_BASE_ID 0x0100
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index ca59cc0d013e..e81bf6ef1666 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -82,7 +82,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv)
82 priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR; 82 priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
83 priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR; 83 priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
84 84
85 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_DISABLED; 85 priv->sec_info.wep_enabled = 0;
86 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; 86 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;
87 priv->sec_info.encryption_mode = 0; 87 priv->sec_info.encryption_mode = 0;
88 for (i = 0; i < ARRAY_SIZE(priv->wep_key); i++) 88 for (i = 0; i < ARRAY_SIZE(priv->wep_key); i++)
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 0b0eb5efba9d..ee439fc2f4f3 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -417,7 +417,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
417 auth_tlv = (struct mwifiex_ie_types_auth_type *) pos; 417 auth_tlv = (struct mwifiex_ie_types_auth_type *) pos;
418 auth_tlv->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); 418 auth_tlv->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE);
419 auth_tlv->header.len = cpu_to_le16(sizeof(auth_tlv->auth_type)); 419 auth_tlv->header.len = cpu_to_le16(sizeof(auth_tlv->auth_type));
420 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED) 420 if (priv->sec_info.wep_enabled)
421 auth_tlv->auth_type = cpu_to_le16( 421 auth_tlv->auth_type = cpu_to_le16(
422 (u16) priv->sec_info.authentication_mode); 422 (u16) priv->sec_info.authentication_mode);
423 else 423 else
@@ -1069,8 +1069,7 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1069 priv->curr_bss_params.bss_descriptor.channel = bss_desc->channel; 1069 priv->curr_bss_params.bss_descriptor.channel = bss_desc->channel;
1070 priv->curr_bss_params.band = (u8) bss_desc->bss_band; 1070 priv->curr_bss_params.band = (u8) bss_desc->bss_band;
1071 1071
1072 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED 1072 if (priv->sec_info.wep_enabled || priv->sec_info.wpa_enabled)
1073 || priv->sec_info.wpa_enabled)
1074 tmp_cap |= WLAN_CAPABILITY_PRIVACY; 1073 tmp_cap |= WLAN_CAPABILITY_PRIVACY;
1075 1074
1076 if (IS_SUPPORT_MULTI_BANDS(priv->adapter)) { 1075 if (IS_SUPPORT_MULTI_BANDS(priv->adapter)) {
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 52810b1497ea..4c8621706278 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -217,7 +217,7 @@ struct mwifiex_802_11_security {
217 u8 wpa2_enabled; 217 u8 wpa2_enabled;
218 u8 wapi_enabled; 218 u8 wapi_enabled;
219 u8 wapi_key_on; 219 u8 wapi_key_on;
220 enum MWIFIEX_802_11_WEP_STATUS wep_status; 220 u8 wep_enabled;
221 u32 authentication_mode; 221 u32 authentication_mode;
222 u32 encryption_mode; 222 u32 encryption_mode;
223}; 223};
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 98f1ca9cd6d8..8f10038d1b45 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -196,9 +196,8 @@ static bool
196mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv, 196mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv,
197 struct mwifiex_bssdescriptor *bss_desc) 197 struct mwifiex_bssdescriptor *bss_desc)
198{ 198{
199 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED 199 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
200 && !priv->sec_info.wpa_enabled && !priv->sec_info.wpa2_enabled 200 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
201 && ((!bss_desc->bcn_wpa_ie) ||
202 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != 201 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id !=
203 WLAN_EID_WPA)) 202 WLAN_EID_WPA))
204 && ((!bss_desc->bcn_rsn_ie) || 203 && ((!bss_desc->bcn_rsn_ie) ||
@@ -219,9 +218,8 @@ static bool
219mwifiex_is_network_compatible_for_static_wep(struct mwifiex_private *priv, 218mwifiex_is_network_compatible_for_static_wep(struct mwifiex_private *priv,
220 struct mwifiex_bssdescriptor *bss_desc) 219 struct mwifiex_bssdescriptor *bss_desc)
221{ 220{
222 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED 221 if (priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
223 && !priv->sec_info.wpa_enabled && !priv->sec_info.wpa2_enabled 222 !priv->sec_info.wpa2_enabled && bss_desc->privacy) {
224 && bss_desc->privacy) {
225 return true; 223 return true;
226 } 224 }
227 return false; 225 return false;
@@ -235,10 +233,9 @@ static bool
235mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv, 233mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv,
236 struct mwifiex_bssdescriptor *bss_desc) 234 struct mwifiex_bssdescriptor *bss_desc)
237{ 235{
238 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED 236 if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled &&
239 && priv->sec_info.wpa_enabled && !priv->sec_info.wpa2_enabled 237 !priv->sec_info.wpa2_enabled && ((bss_desc->bcn_wpa_ie) &&
240 && ((bss_desc->bcn_wpa_ie) && ((*(bss_desc->bcn_wpa_ie)).vend_hdr. 238 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id == WLAN_EID_WPA))
241 element_id == WLAN_EID_WPA))
242 /* 239 /*
243 * Privacy bit may NOT be set in some APs like 240 * Privacy bit may NOT be set in some APs like
244 * LinkSys WRT54G && bss_desc->privacy 241 * LinkSys WRT54G && bss_desc->privacy
@@ -253,8 +250,7 @@ mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv,
253 (bss_desc->bcn_rsn_ie) ? 250 (bss_desc->bcn_rsn_ie) ?
254 (*(bss_desc->bcn_rsn_ie)). 251 (*(bss_desc->bcn_rsn_ie)).
255 ieee_hdr.element_id : 0, 252 ieee_hdr.element_id : 0,
256 (priv->sec_info.wep_status == 253 (priv->sec_info.wep_enabled) ? "e" : "d",
257 MWIFIEX_802_11_WEP_ENABLED) ? "e" : "d",
258 (priv->sec_info.wpa_enabled) ? "e" : "d", 254 (priv->sec_info.wpa_enabled) ? "e" : "d",
259 (priv->sec_info.wpa2_enabled) ? "e" : "d", 255 (priv->sec_info.wpa2_enabled) ? "e" : "d",
260 priv->sec_info.encryption_mode, 256 priv->sec_info.encryption_mode,
@@ -272,10 +268,9 @@ static bool
272mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv, 268mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv,
273 struct mwifiex_bssdescriptor *bss_desc) 269 struct mwifiex_bssdescriptor *bss_desc)
274{ 270{
275 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED 271 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
276 && !priv->sec_info.wpa_enabled && priv->sec_info.wpa2_enabled 272 priv->sec_info.wpa2_enabled && ((bss_desc->bcn_rsn_ie) &&
277 && ((bss_desc->bcn_rsn_ie) && ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. 273 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))
278 element_id == WLAN_EID_RSN))
279 /* 274 /*
280 * Privacy bit may NOT be set in some APs like 275 * Privacy bit may NOT be set in some APs like
281 * LinkSys WRT54G && bss_desc->privacy 276 * LinkSys WRT54G && bss_desc->privacy
@@ -290,8 +285,7 @@ mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv,
290 (bss_desc->bcn_rsn_ie) ? 285 (bss_desc->bcn_rsn_ie) ?
291 (*(bss_desc->bcn_rsn_ie)). 286 (*(bss_desc->bcn_rsn_ie)).
292 ieee_hdr.element_id : 0, 287 ieee_hdr.element_id : 0,
293 (priv->sec_info.wep_status == 288 (priv->sec_info.wep_enabled) ? "e" : "d",
294 MWIFIEX_802_11_WEP_ENABLED) ? "e" : "d",
295 (priv->sec_info.wpa_enabled) ? "e" : "d", 289 (priv->sec_info.wpa_enabled) ? "e" : "d",
296 (priv->sec_info.wpa2_enabled) ? "e" : "d", 290 (priv->sec_info.wpa2_enabled) ? "e" : "d",
297 priv->sec_info.encryption_mode, 291 priv->sec_info.encryption_mode,
@@ -309,10 +303,9 @@ static bool
309mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv, 303mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv,
310 struct mwifiex_bssdescriptor *bss_desc) 304 struct mwifiex_bssdescriptor *bss_desc)
311{ 305{
312 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED 306 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
313 && !priv->sec_info.wpa_enabled && !priv->sec_info.wpa2_enabled 307 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
314 && ((!bss_desc->bcn_wpa_ie) || ((*(bss_desc->bcn_wpa_ie)).vend_hdr. 308 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA))
315 element_id != WLAN_EID_WPA))
316 && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. 309 && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.
317 element_id != WLAN_EID_RSN)) 310 element_id != WLAN_EID_RSN))
318 && !priv->sec_info.encryption_mode 311 && !priv->sec_info.encryption_mode
@@ -330,10 +323,9 @@ static bool
330mwifiex_is_network_compatible_for_dynamic_wep(struct mwifiex_private *priv, 323mwifiex_is_network_compatible_for_dynamic_wep(struct mwifiex_private *priv,
331 struct mwifiex_bssdescriptor *bss_desc) 324 struct mwifiex_bssdescriptor *bss_desc)
332{ 325{
333 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED 326 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
334 && !priv->sec_info.wpa_enabled && !priv->sec_info.wpa2_enabled 327 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
335 && ((!bss_desc->bcn_wpa_ie) || ((*(bss_desc->bcn_wpa_ie)).vend_hdr. 328 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA))
336 element_id != WLAN_EID_WPA))
337 && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. 329 && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.
338 element_id != WLAN_EID_RSN)) 330 element_id != WLAN_EID_RSN))
339 && priv->sec_info.encryption_mode 331 && priv->sec_info.encryption_mode
@@ -468,8 +460,7 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
468 (bss_desc->bcn_rsn_ie) ? 460 (bss_desc->bcn_rsn_ie) ?
469 (*(bss_desc->bcn_rsn_ie)).ieee_hdr. 461 (*(bss_desc->bcn_rsn_ie)).ieee_hdr.
470 element_id : 0, 462 element_id : 0,
471 (priv->sec_info.wep_status == 463 (priv->sec_info.wep_enabled) ? "e" : "d",
472 MWIFIEX_802_11_WEP_ENABLED) ? "e" : "d",
473 (priv->sec_info.wpa_enabled) ? "e" : "d", 464 (priv->sec_info.wpa_enabled) ? "e" : "d",
474 (priv->sec_info.wpa2_enabled) ? "e" : "d", 465 (priv->sec_info.wpa2_enabled) ? "e" : "d",
475 priv->sec_info.encryption_mode, bss_desc->privacy); 466 priv->sec_info.encryption_mode, bss_desc->privacy);
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index b0fbf5d4fea0..866026ecca44 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -471,7 +471,7 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv,
471 471
472 info->bcn_nf_last = priv->bcn_nf_last; 472 info->bcn_nf_last = priv->bcn_nf_last;
473 473
474 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED) 474 if (priv->sec_info.wep_enabled)
475 info->wep_status = true; 475 info->wep_status = true;
476 else 476 else
477 info->wep_status = false; 477 info->wep_status = false;
@@ -1020,7 +1020,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
1020 wep_key = &priv->wep_key[priv->wep_key_curr_index]; 1020 wep_key = &priv->wep_key[priv->wep_key_curr_index];
1021 index = encrypt_key->key_index; 1021 index = encrypt_key->key_index;
1022 if (encrypt_key->key_disable) { 1022 if (encrypt_key->key_disable) {
1023 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_DISABLED; 1023 priv->sec_info.wep_enabled = 0;
1024 } else if (!encrypt_key->key_len) { 1024 } else if (!encrypt_key->key_len) {
1025 /* Copy the required key as the current key */ 1025 /* Copy the required key as the current key */
1026 wep_key = &priv->wep_key[index]; 1026 wep_key = &priv->wep_key[index];
@@ -1030,7 +1030,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
1030 return -1; 1030 return -1;
1031 } 1031 }
1032 priv->wep_key_curr_index = (u16) index; 1032 priv->wep_key_curr_index = (u16) index;
1033 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_ENABLED; 1033 priv->sec_info.wep_enabled = 1;
1034 } else { 1034 } else {
1035 wep_key = &priv->wep_key[index]; 1035 wep_key = &priv->wep_key[index];
1036 memset(wep_key, 0, sizeof(struct mwifiex_wep_key)); 1036 memset(wep_key, 0, sizeof(struct mwifiex_wep_key));
@@ -1040,7 +1040,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
1040 encrypt_key->key_len); 1040 encrypt_key->key_len);
1041 wep_key->key_index = index; 1041 wep_key->key_index = index;
1042 wep_key->key_length = encrypt_key->key_len; 1042 wep_key->key_length = encrypt_key->key_len;
1043 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_ENABLED; 1043 priv->sec_info.wep_enabled = 1;
1044 } 1044 }
1045 if (wep_key->key_length) { 1045 if (wep_key->key_length) {
1046 /* Send request to firmware */ 1046 /* Send request to firmware */
@@ -1050,7 +1050,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
1050 if (ret) 1050 if (ret)
1051 return ret; 1051 return ret;
1052 } 1052 }
1053 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED) 1053 if (priv->sec_info.wep_enabled)
1054 priv->curr_pkt_filter |= HostCmd_ACT_MAC_WEP_ENABLE; 1054 priv->curr_pkt_filter |= HostCmd_ACT_MAC_WEP_ENABLE;
1055 else 1055 else
1056 priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE; 1056 priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE;