aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2015-01-28 05:24:20 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-01-29 03:22:01 -0500
commit2ade5667e2e0244549818f16e2520141661e8bcd (patch)
tree83a385a3281877dc50ad59b2e186d96ea3a073b8 /drivers/net/wireless/mwifiex
parentb654ca182a2f54c3e3ce682420045f7dd79c8187 (diff)
mwifiex: separate function for parsing head and tail IEs
Head & Tail IEs are supposed to be added to beacon and probe response. This patch adds separate function for parsing head and tail IEs from cfg80211_beacon_data and sets them to FW. Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Qingshui Gao <gaoqs@marvell.com> Signed-off-by: Cathy Luo <cluo@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r--drivers/net/wireless/mwifiex/ie.c81
-rw-r--r--drivers/net/wireless/mwifiex/main.c2
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
3 files changed, 48 insertions, 37 deletions
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c
index b933794758b7..a6af7b88bf05 100644
--- a/drivers/net/wireless/mwifiex/ie.c
+++ b/drivers/net/wireless/mwifiex/ie.c
@@ -317,27 +317,26 @@ done:
317 return ret; 317 return ret;
318} 318}
319 319
320/* This function parses different IEs-tail IEs, beacon IEs, probe response IEs, 320/* This function parses head and tail IEs, from cfg80211_beacon_data and sets
321 * association response IEs from cfg80211_ap_settings function and sets these IE 321 * these IE to FW.
322 * to FW.
323 */ 322 */
324int mwifiex_set_mgmt_ies(struct mwifiex_private *priv, 323static int mwifiex_uap_set_head_tail_ies(struct mwifiex_private *priv,
325 struct cfg80211_beacon_data *info) 324 struct cfg80211_beacon_data *info)
326{ 325{
327 struct mwifiex_ie *gen_ie; 326 struct mwifiex_ie *gen_ie;
328 struct ieee_types_header *rsn_ie, *wpa_ie = NULL; 327 struct ieee_types_header *rsn_ie = NULL, *wpa_ie = NULL;
329 u16 rsn_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0; 328 u16 gen_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0;
330 const u8 *vendor_ie; 329 const u8 *vendor_ie;
331 330
332 if (info->tail && info->tail_len) { 331 gen_ie = kzalloc(sizeof(*gen_ie), GFP_KERNEL);
333 gen_ie = kzalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); 332 if (!gen_ie)
334 if (!gen_ie) 333 return -ENOMEM;
335 return -ENOMEM; 334 gen_ie->ie_index = cpu_to_le16(gen_idx);
336 gen_ie->ie_index = cpu_to_le16(rsn_idx); 335 gen_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON |
337 gen_ie->mgmt_subtype_mask = cpu_to_le16(MGMT_MASK_BEACON | 336 MGMT_MASK_PROBE_RESP |
338 MGMT_MASK_PROBE_RESP | 337 MGMT_MASK_ASSOC_RESP);
339 MGMT_MASK_ASSOC_RESP);
340 338
339 if (info->tail && info->tail_len) {
341 rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN, 340 rsn_ie = (void *)cfg80211_find_ie(WLAN_EID_RSN,
342 info->tail, info->tail_len); 341 info->tail, info->tail_len);
343 if (rsn_ie) { 342 if (rsn_ie) {
@@ -357,20 +356,33 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
357 ie_len += wpa_ie->len + 2; 356 ie_len += wpa_ie->len + 2;
358 gen_ie->ie_length = cpu_to_le16(ie_len); 357 gen_ie->ie_length = cpu_to_le16(ie_len);
359 } 358 }
359 }
360 360
361 if (rsn_ie || wpa_ie) { 361 if (rsn_ie || wpa_ie) {
362 if (mwifiex_update_uap_custom_ie(priv, gen_ie, &rsn_idx, 362 if (mwifiex_update_uap_custom_ie(priv, gen_ie, &gen_idx, NULL,
363 NULL, NULL, 363 NULL, NULL, NULL)) {
364 NULL, NULL)) { 364 kfree(gen_ie);
365 kfree(gen_ie); 365 return -1;
366 return -1;
367 }
368 priv->rsn_idx = rsn_idx;
369 } 366 }
370 367 priv->gen_idx = gen_idx;
371 kfree(gen_ie);
372 } 368 }
373 369
370 kfree(gen_ie);
371 return 0;
372}
373
374/* This function parses different IEs-head & tail IEs, beacon IEs,
375 * probe response IEs, association response IEs from cfg80211_ap_settings
376 * function and sets these IE to FW.
377 */
378int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
379 struct cfg80211_beacon_data *info)
380{
381 int ret;
382
383 ret = mwifiex_uap_set_head_tail_ies(priv, info);
384 return ret;
385
374 return mwifiex_set_mgmt_beacon_data_ies(priv, info); 386 return mwifiex_set_mgmt_beacon_data_ies(priv, info);
375} 387}
376 388
@@ -378,25 +390,25 @@ int mwifiex_set_mgmt_ies(struct mwifiex_private *priv,
378int mwifiex_del_mgmt_ies(struct mwifiex_private *priv) 390int mwifiex_del_mgmt_ies(struct mwifiex_private *priv)
379{ 391{
380 struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL; 392 struct mwifiex_ie *beacon_ie = NULL, *pr_ie = NULL;
381 struct mwifiex_ie *ar_ie = NULL, *rsn_ie = NULL; 393 struct mwifiex_ie *ar_ie = NULL, *gen_ie = NULL;
382 int ret = 0; 394 int ret = 0;
383 395
384 if (priv->rsn_idx != MWIFIEX_AUTO_IDX_MASK) { 396 if (priv->gen_idx != MWIFIEX_AUTO_IDX_MASK) {
385 rsn_ie = kmalloc(sizeof(struct mwifiex_ie), GFP_KERNEL); 397 gen_ie = kmalloc(sizeof(*gen_ie), GFP_KERNEL);
386 if (!rsn_ie) 398 if (!gen_ie)
387 return -ENOMEM; 399 return -ENOMEM;
388 400
389 rsn_ie->ie_index = cpu_to_le16(priv->rsn_idx); 401 gen_ie->ie_index = cpu_to_le16(priv->gen_idx);
390 rsn_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK); 402 gen_ie->mgmt_subtype_mask = cpu_to_le16(MWIFIEX_DELETE_MASK);
391 rsn_ie->ie_length = 0; 403 gen_ie->ie_length = 0;
392 if (mwifiex_update_uap_custom_ie(priv, rsn_ie, &priv->rsn_idx, 404 if (mwifiex_update_uap_custom_ie(priv, gen_ie, &priv->gen_idx,
393 NULL, &priv->proberesp_idx, 405 NULL, &priv->proberesp_idx,
394 NULL, &priv->assocresp_idx)) { 406 NULL, &priv->assocresp_idx)) {
395 ret = -1; 407 ret = -1;
396 goto done; 408 goto done;
397 } 409 }
398 410
399 priv->rsn_idx = MWIFIEX_AUTO_IDX_MASK; 411 priv->gen_idx = MWIFIEX_AUTO_IDX_MASK;
400 } 412 }
401 413
402 if (priv->beacon_idx != MWIFIEX_AUTO_IDX_MASK) { 414 if (priv->beacon_idx != MWIFIEX_AUTO_IDX_MASK) {
@@ -440,7 +452,6 @@ done:
440 kfree(beacon_ie); 452 kfree(beacon_ie);
441 kfree(pr_ie); 453 kfree(pr_ie);
442 kfree(ar_ie); 454 kfree(ar_ie);
443 kfree(rsn_ie);
444 455
445 return ret; 456 return ret;
446} 457}
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 30e519369ba6..7e74b4fccddd 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -973,7 +973,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv,
973 priv->beacon_idx = MWIFIEX_AUTO_IDX_MASK; 973 priv->beacon_idx = MWIFIEX_AUTO_IDX_MASK;
974 priv->proberesp_idx = MWIFIEX_AUTO_IDX_MASK; 974 priv->proberesp_idx = MWIFIEX_AUTO_IDX_MASK;
975 priv->assocresp_idx = MWIFIEX_AUTO_IDX_MASK; 975 priv->assocresp_idx = MWIFIEX_AUTO_IDX_MASK;
976 priv->rsn_idx = MWIFIEX_AUTO_IDX_MASK; 976 priv->gen_idx = MWIFIEX_AUTO_IDX_MASK;
977 priv->num_tx_timeout = 0; 977 priv->num_tx_timeout = 0;
978 ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr); 978 ether_addr_copy(priv->curr_addr, priv->adapter->perm_addr);
979 memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN); 979 memcpy(dev->dev_addr, priv->curr_addr, ETH_ALEN);
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 0c75eff23e8b..c5ac20da273c 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -567,7 +567,7 @@ struct mwifiex_private {
567 u16 beacon_idx; 567 u16 beacon_idx;
568 u16 proberesp_idx; 568 u16 proberesp_idx;
569 u16 assocresp_idx; 569 u16 assocresp_idx;
570 u16 rsn_idx; 570 u16 gen_idx;
571 u8 ap_11n_enabled; 571 u8 ap_11n_enabled;
572 u8 ap_11ac_enabled; 572 u8 ap_11ac_enabled;
573 u32 mgmt_frame_mask; 573 u32 mgmt_frame_mask;