aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2012-06-28 23:30:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-09 16:36:00 -0400
commit2152fe9c2fa4c948347b83cb0649d24d214267f5 (patch)
tree456fc3f8a5df86663ba35e41641292f659182c7f
parent2dd2bd6b36bc10b896fe565e31328d5e8327f431 (diff)
mwifiex: parse WPS IEs from beacon_data
Parse WPS IEs from start_ap as well as change_beacon handlers and set them to FW. Beacon IEs, Probe Response IEs and Assoc Response IEs are parsed from beacon_data and set to FW with related masks. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/mwifiex/ie.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c
index 1f2d4b9a0ca5..1d8dd003e396 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -214,6 +214,38 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv,
214 return ret; 214 return ret;
215} 215}
216 216
217/* This function checks if WPS IE is present in passed buffer and copies it to
218 * mwifiex_ie structure.
219 * Function takes pointer to struct mwifiex_ie pointer as argument.
220 * If WPS IE is present memory is allocated for mwifiex_ie pointer and filled
221 * in with WPS IE. Caller should take care of freeing this memory.
222 */
223static int mwifiex_update_wps_ie(const u8 *ies, int ies_len,
224 struct mwifiex_ie **ie_ptr, u16 mask)
225{
226 struct ieee_types_header *wps_ie;
227 struct mwifiex_ie *ie = NULL;
228 const u8 *vendor_ie;
229
230 vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
231 WLAN_OUI_TYPE_MICROSOFT_WPS,
232 ies, ies_len);
233 if (vendor_ie) {
234 ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
235 if (!ie)
236 return -ENOMEM;
237
238 wps_ie = (struct ieee_types_header *)vendor_ie;
239 memcpy(ie->ie_buffer, wps_ie, wps_ie->len + 2);
240 ie->ie_length = cpu_to_le16(wps_ie->len + 2);
241 ie->mgmt_subtype_mask = cpu_to_le16(mask);
242 ie->ie_index = cpu_to_le16(MWIFIEX_AUTO_IDX_MASK);
243 }
244
245 *ie_ptr = ie;
246 return 0;
247}
248
217/* This function parses beacon IEs, probe response IEs, association response IEs 249/* This function parses beacon IEs, probe response IEs, association response IEs
218 * from cfg80211_ap_settings->beacon and sets these IE to FW. 250 * from cfg80211_ap_settings->beacon and sets these IE to FW.
219 */ 251 */
@@ -225,48 +257,20 @@ static int mwifiex_set_mgmt_beacon_data_ies(struct mwifiex_private *priv,
225 u16 ar_idx = MWIFIEX_AUTO_IDX_MASK; 257 u16 ar_idx = MWIFIEX_AUTO_IDX_MASK;
226 int ret = 0; 258 int ret = 0;
227 259
228 if (data->beacon_ies && data->beacon_ies_len) { 260 if (data->beacon_ies && data->beacon_ies_len)
229 beacon_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); 261 mwifiex_update_wps_ie(data->beacon_ies, data->beacon_ies_len,
230 if (!beacon_ie) { 262 &beacon_ie, MGMT_MASK_BEACON);
231 ret = -ENOMEM;
232 goto done;
233 }
234
235 beacon_ie->ie_index = cpu_to_le16(beacon_idx);
236 beacon_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON);
237 beacon_ie->ie_length = cpu_to_le16(data->beacon_ies_len);
238 memcpy(beacon_ie->ie_buffer, data->beacon_ies,
239 data->beacon_ies_len);
240 }
241
242 if (data->proberesp_ies && data->proberesp_ies_len) {
243 pr_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL);
244 if (!pr_ie) {
245 ret = -ENOMEM;
246 goto done;
247 }
248
249 pr_ie->ie_index = cpu_to_le16(pr_idx);
250 pr_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_PROBE_RESP);
251 pr_ie->ie_length = cpu_to_le16(data->proberesp_ies_len);
252 memcpy(pr_ie->ie_buffer, data->proberesp_ies,
253 data->proberesp_ies_len);
254 }
255 263
256 if (data->assocresp_ies && data->assocresp_ies_len) { 264 if (data->proberesp_ies && data->proberesp_ies_len)
257 ar_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); 265 mwifiex_update_wps_ie(data->proberesp_ies,
258 if (!ar_ie) { 266 data->proberesp_ies_len, &pr_ie,
259 ret = -ENOMEM; 267 MGMT_MASK_PROBE_RESP);
260 goto done;
261 }
262 268
263 ar_ie->ie_index = cpu_to_le16(ar_idx); 269 if (data->assocresp_ies && data->assocresp_ies_len)
264 ar_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_ASSOC_RESP | 270 mwifiex_update_wps_ie(data->assocresp_ies,
265 MGMT_MASK_REASSOC_RESP); 271 data->assocresp_ies_len, &ar_ie,
266 ar_ie->ie_length = cpu_to_le16(data->assocresp_ies_len); 272 MGMT_MASK_ASSOC_RESP |
267 memcpy(ar_ie->ie_buffer, data->assocresp_ies, 273 MGMT_MASK_REASSOC_RESP);
268 data->assocresp_ies_len);
269 }
270 274
271 if (beacon_ie || pr_ie || ar_ie) { 275 if (beacon_ie || pr_ie || ar_ie) {
272 ret = mwifiex_update_uap_custom_ie(priv, beacon_ie, 276 ret = mwifiex_update_uap_custom_ie(priv, beacon_ie,