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/net/wireless/mwifiex/cfg80211.c | |
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/net/wireless/mwifiex/cfg80211.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 76 |
1 files changed, 10 insertions, 66 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) |