diff options
author | Yogesh Ashok Powar <yogeshp@marvell.com> | 2011-04-01 21:36:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-07 15:34:12 -0400 |
commit | 2be50b8df53f2f329b7ddcc8be286ef6a7469fd2 (patch) | |
tree | 7ae394235800749a21c89c5ea510a4b5d73f8f88 /drivers | |
parent | 2d3d0a88bd136f8e6f39bc53242712852e5d0bb2 (diff) |
mwifiex: remove redundant encryption_mode mapping
remove MWIFIEX_ENCRYPTION_MODE_ and use WLAN_CIPHER_SUITE_
macros directly
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 76 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/init.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/ioctl.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/join.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_event.c | 2 |
6 files changed, 19 insertions, 83 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 4ac4f5a0ce61..ec0895f4e8d3 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -90,8 +90,8 @@ mwifiex_is_alg_wep(u32 cipher) | |||
90 | int alg = 0; | 90 | int alg = 0; |
91 | 91 | ||
92 | switch (cipher) { | 92 | switch (cipher) { |
93 | case MWIFIEX_ENCRYPTION_MODE_WEP40: | 93 | case WLAN_CIPHER_SUITE_WEP40: |
94 | case MWIFIEX_ENCRYPTION_MODE_WEP104: | 94 | case WLAN_CIPHER_SUITE_WEP104: |
95 | alg = 1; | 95 | alg = 1; |
96 | break; | 96 | break; |
97 | default: | 97 | default: |
@@ -102,55 +102,6 @@ mwifiex_is_alg_wep(u32 cipher) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * This function maps the given cipher type into driver specific type. | ||
106 | * | ||
107 | * It also sets a flag to indicate whether WPA is enabled or not. | ||
108 | * | ||
109 | * The mapping table is - | ||
110 | * Input cipher Driver cipher type WPA enabled? | ||
111 | * ------------ ------------------ ------------ | ||
112 | * IW_AUTH_CIPHER_NONE MWIFIEX_ENCRYPTION_MODE_NONE No | ||
113 | * WLAN_CIPHER_SUITE_WEP40 MWIFIEX_ENCRYPTION_MODE_WEP40 No | ||
114 | * WLAN_CIPHER_SUITE_WEP104 MWIFIEX_ENCRYPTION_MODE_WEP104 No | ||
115 | * WLAN_CIPHER_SUITE_TKIP MWIFIEX_ENCRYPTION_MODE_TKIP Yes | ||
116 | * WLAN_CIPHER_SUITE_CCMP MWIFIEX_ENCRYPTION_MODE_CCMP Yes | ||
117 | * Others -1 No | ||
118 | */ | ||
119 | static int | ||
120 | mwifiex_get_mwifiex_cipher(u32 cipher, int *wpa_enabled) | ||
121 | { | ||
122 | int encrypt_mode; | ||
123 | |||
124 | if (wpa_enabled) | ||
125 | *wpa_enabled = 0; | ||
126 | switch (cipher) { | ||
127 | case IW_AUTH_CIPHER_NONE: | ||
128 | encrypt_mode = MWIFIEX_ENCRYPTION_MODE_NONE; | ||
129 | break; | ||
130 | case WLAN_CIPHER_SUITE_WEP40: | ||
131 | encrypt_mode = MWIFIEX_ENCRYPTION_MODE_WEP40; | ||
132 | break; | ||
133 | case WLAN_CIPHER_SUITE_WEP104: | ||
134 | encrypt_mode = MWIFIEX_ENCRYPTION_MODE_WEP104; | ||
135 | break; | ||
136 | case WLAN_CIPHER_SUITE_TKIP: | ||
137 | encrypt_mode = MWIFIEX_ENCRYPTION_MODE_TKIP; | ||
138 | if (wpa_enabled) | ||
139 | *wpa_enabled = 1; | ||
140 | break; | ||
141 | case WLAN_CIPHER_SUITE_CCMP: | ||
142 | encrypt_mode = MWIFIEX_ENCRYPTION_MODE_CCMP; | ||
143 | if (wpa_enabled) | ||
144 | *wpa_enabled = 1; | ||
145 | break; | ||
146 | default: | ||
147 | encrypt_mode = -1; | ||
148 | } | ||
149 | |||
150 | return encrypt_mode; | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | * This function retrieves the private structure from kernel wiphy structure. | 105 | * This function retrieves the private structure from kernel wiphy structure. |
155 | */ | 106 | */ |
156 | static void *mwifiex_cfg80211_get_priv(struct wiphy *wiphy) | 107 | static void *mwifiex_cfg80211_get_priv(struct wiphy *wiphy) |
@@ -252,13 +203,9 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, | |||
252 | { | 203 | { |
253 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); | 204 | struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); |
254 | int ret = 0; | 205 | int ret = 0; |
255 | int encrypt_mode; | ||
256 | |||
257 | encrypt_mode = mwifiex_get_mwifiex_cipher(params->cipher, NULL); | ||
258 | 206 | ||
259 | if (encrypt_mode != -1) | 207 | ret = mwifiex_set_encode(priv, params->key, params->key_len, |
260 | ret = mwifiex_set_encode(priv, params->key, params->key_len, | 208 | key_index, 0); |
261 | key_index, 0); | ||
262 | 209 | ||
263 | wiphy_dbg(wiphy, "info: crypto keys added\n"); | 210 | wiphy_dbg(wiphy, "info: crypto keys added\n"); |
264 | 211 | ||
@@ -1019,7 +966,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1019 | struct mwifiex_802_11_ssid req_ssid; | 966 | struct mwifiex_802_11_ssid req_ssid; |
1020 | struct mwifiex_ssid_bssid ssid_bssid; | 967 | struct mwifiex_ssid_bssid ssid_bssid; |
1021 | int ret = 0; | 968 | int ret = 0; |
1022 | int auth_type = 0, pairwise_encrypt_mode = 0, wpa_enabled = 0; | 969 | int auth_type = 0, pairwise_encrypt_mode = 0; |
1023 | int group_encrypt_mode = 0; | 970 | int group_encrypt_mode = 0; |
1024 | int alg_is_wep = 0; | 971 | int alg_is_wep = 0; |
1025 | 972 | ||
@@ -1052,13 +999,13 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1052 | /* "privacy" is set only for ad-hoc mode */ | 999 | /* "privacy" is set only for ad-hoc mode */ |
1053 | if (privacy) { | 1000 | if (privacy) { |
1054 | /* | 1001 | /* |
1055 | * Keep MWIFIEX_ENCRYPTION_MODE_WEP104 for now so that | 1002 | * Keep WLAN_CIPHER_SUITE_WEP104 for now so that |
1056 | * the firmware can find a matching network from the | 1003 | * the firmware can find a matching network from the |
1057 | * scan. The cfg80211 does not give us the encryption | 1004 | * scan. The cfg80211 does not give us the encryption |
1058 | * mode at this stage so just setting it to WEP here. | 1005 | * mode at this stage so just setting it to WEP here. |
1059 | */ | 1006 | */ |
1060 | priv->sec_info.encryption_mode = | 1007 | priv->sec_info.encryption_mode = |
1061 | MWIFIEX_ENCRYPTION_MODE_WEP104; | 1008 | WLAN_CIPHER_SUITE_WEP104; |
1062 | priv->sec_info.authentication_mode = | 1009 | priv->sec_info.authentication_mode = |
1063 | NL80211_AUTHTYPE_OPEN_SYSTEM; | 1010 | NL80211_AUTHTYPE_OPEN_SYSTEM; |
1064 | } | 1011 | } |
@@ -1074,16 +1021,13 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, | |||
1074 | auth_type = NL80211_AUTHTYPE_SHARED_KEY; | 1021 | auth_type = NL80211_AUTHTYPE_SHARED_KEY; |
1075 | 1022 | ||
1076 | if (sme->crypto.n_ciphers_pairwise) { | 1023 | if (sme->crypto.n_ciphers_pairwise) { |
1077 | pairwise_encrypt_mode = mwifiex_get_mwifiex_cipher(sme->crypto. | 1024 | priv->sec_info.encryption_mode = |
1078 | ciphers_pairwise[0], &wpa_enabled); | 1025 | sme->crypto.ciphers_pairwise[0]; |
1079 | priv->sec_info.encryption_mode = pairwise_encrypt_mode; | ||
1080 | priv->sec_info.authentication_mode = auth_type; | 1026 | priv->sec_info.authentication_mode = auth_type; |
1081 | } | 1027 | } |
1082 | 1028 | ||
1083 | if (sme->crypto.cipher_group) { | 1029 | if (sme->crypto.cipher_group) { |
1084 | group_encrypt_mode = mwifiex_get_mwifiex_cipher(sme->crypto. | 1030 | priv->sec_info.encryption_mode = sme->crypto.cipher_group; |
1085 | cipher_group, &wpa_enabled); | ||
1086 | priv->sec_info.encryption_mode = group_encrypt_mode; | ||
1087 | priv->sec_info.authentication_mode = auth_type; | 1031 | priv->sec_info.authentication_mode = auth_type; |
1088 | } | 1032 | } |
1089 | if (sme->ie) | 1033 | if (sme->ie) |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index 43ea87d0f348..8189862da1f9 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -86,7 +86,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv) | |||
86 | 86 | ||
87 | priv->sec_info.wep_status = MWIFIEX_802_11_WEP_DISABLED; | 87 | priv->sec_info.wep_status = MWIFIEX_802_11_WEP_DISABLED; |
88 | priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; | 88 | priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM; |
89 | priv->sec_info.encryption_mode = MWIFIEX_ENCRYPTION_MODE_NONE; | 89 | priv->sec_info.encryption_mode = 0; |
90 | for (i = 0; i < ARRAY_SIZE(priv->wep_key); i++) | 90 | for (i = 0; i < ARRAY_SIZE(priv->wep_key); i++) |
91 | memset(&priv->wep_key[i], 0, sizeof(struct mwifiex_wep_key)); | 91 | memset(&priv->wep_key[i], 0, sizeof(struct mwifiex_wep_key)); |
92 | priv->wep_key_curr_index = 0; | 92 | priv->wep_key_curr_index = 0; |
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h index d01160aa1db8..703a6d12ebf3 100644 --- a/drivers/net/wireless/mwifiex/ioctl.h +++ b/drivers/net/wireless/mwifiex/ioctl.h | |||
@@ -267,14 +267,6 @@ struct mwifiex_debug_info { | |||
267 | u8 event_received; | 267 | u8 event_received; |
268 | }; | 268 | }; |
269 | 269 | ||
270 | enum { | ||
271 | MWIFIEX_ENCRYPTION_MODE_NONE = 0, | ||
272 | MWIFIEX_ENCRYPTION_MODE_WEP40 = 1, | ||
273 | MWIFIEX_ENCRYPTION_MODE_TKIP = 2, | ||
274 | MWIFIEX_ENCRYPTION_MODE_CCMP = 3, | ||
275 | MWIFIEX_ENCRYPTION_MODE_WEP104 = 4, | ||
276 | }; | ||
277 | |||
278 | #define MWIFIEX_KEY_INDEX_UNICAST 0x40000000 | 270 | #define MWIFIEX_KEY_INDEX_UNICAST 0x40000000 |
279 | #define MWIFIEX_MAX_KEY_LENGTH 32 | 271 | #define MWIFIEX_MAX_KEY_LENGTH 32 |
280 | #define WAPI_RXPN_LEN 16 | 272 | #define WAPI_RXPN_LEN 16 |
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 8a1eb2a9ab13..7a9e0b5962ed 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -869,7 +869,7 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, | |||
869 | tmp_cap |= WLAN_CAPABILITY_IBSS; | 869 | tmp_cap |= WLAN_CAPABILITY_IBSS; |
870 | 870 | ||
871 | /* Set up privacy in bss_desc */ | 871 | /* Set up privacy in bss_desc */ |
872 | if (priv->sec_info.encryption_mode != MWIFIEX_ENCRYPTION_MODE_NONE) { | 872 | if (priv->sec_info.encryption_mode) { |
873 | /* Ad-Hoc capability privacy on */ | 873 | /* Ad-Hoc capability privacy on */ |
874 | dev_dbg(adapter->dev, | 874 | dev_dbg(adapter->dev, |
875 | "info: ADHOC_S_CMD: wep_status set privacy to WEP\n"); | 875 | "info: ADHOC_S_CMD: wep_status set privacy to WEP\n"); |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index 64ed60a80977..6bb52d0e6cfa 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -273,8 +273,8 @@ mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv, | |||
273 | && ((!bss_desc->bcn_rsn_ie) || | 273 | && ((!bss_desc->bcn_rsn_ie) || |
274 | ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != | 274 | ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != |
275 | WLAN_EID_RSN)) | 275 | WLAN_EID_RSN)) |
276 | && priv->sec_info.encryption_mode == | 276 | && !priv->sec_info.encryption_mode |
277 | MWIFIEX_ENCRYPTION_MODE_NONE && !bss_desc->privacy) { | 277 | && !bss_desc->privacy) { |
278 | return true; | 278 | return true; |
279 | } | 279 | } |
280 | return false; | 280 | return false; |
@@ -386,8 +386,8 @@ mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv, | |||
386 | element_id != WLAN_EID_WPA)) | 386 | element_id != WLAN_EID_WPA)) |
387 | && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. | 387 | && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. |
388 | element_id != WLAN_EID_RSN)) | 388 | element_id != WLAN_EID_RSN)) |
389 | && priv->sec_info.encryption_mode == | 389 | && !priv->sec_info.encryption_mode |
390 | MWIFIEX_ENCRYPTION_MODE_NONE && bss_desc->privacy) { | 390 | && bss_desc->privacy) { |
391 | return true; | 391 | return true; |
392 | } | 392 | } |
393 | return false; | 393 | return false; |
@@ -408,8 +408,8 @@ mwifiex_is_network_compatible_for_dynamic_wep(struct mwifiex_private *priv, | |||
408 | element_id != WLAN_EID_WPA)) | 408 | element_id != WLAN_EID_WPA)) |
409 | && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. | 409 | && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. |
410 | element_id != WLAN_EID_RSN)) | 410 | element_id != WLAN_EID_RSN)) |
411 | && priv->sec_info.encryption_mode != | 411 | && priv->sec_info.encryption_mode |
412 | MWIFIEX_ENCRYPTION_MODE_NONE && bss_desc->privacy) { | 412 | && bss_desc->privacy) { |
413 | dev_dbg(priv->adapter->dev, "info: %s: dynamic " | 413 | dev_dbg(priv->adapter->dev, "info: %s: dynamic " |
414 | "WEP: index=%d wpa_ie=%#x wpa2_ie=%#x " | 414 | "WEP: index=%d wpa_ie=%#x wpa2_ie=%#x " |
415 | "EncMode=%#x privacy=%#x\n", | 415 | "EncMode=%#x privacy=%#x\n", |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index 0187185a1fc6..936d7c175e75 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -76,7 +76,7 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv) | |||
76 | priv->wapi_ie_len = 0; | 76 | priv->wapi_ie_len = 0; |
77 | priv->sec_info.wapi_key_on = false; | 77 | priv->sec_info.wapi_key_on = false; |
78 | 78 | ||
79 | priv->sec_info.encryption_mode = MWIFIEX_ENCRYPTION_MODE_NONE; | 79 | priv->sec_info.encryption_mode = 0; |
80 | 80 | ||
81 | /* Enable auto data rate */ | 81 | /* Enable auto data rate */ |
82 | priv->is_data_rate_auto = true; | 82 | priv->is_data_rate_auto = true; |