aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/wl12xx/init.c')
-rw-r--r--drivers/net/wireless/wl12xx/init.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index e54cc693ff69..1eaa0a3d9273 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -233,35 +233,37 @@ int wl1271_init_phy_config(struct wl1271 *wl)
233 return 0; 233 return 0;
234} 234}
235 235
236static int wl12xx_init_phy_vif_config(struct wl1271 *wl) 236static int wl12xx_init_phy_vif_config(struct wl1271 *wl,
237 struct wl12xx_vif *wlvif)
237{ 238{
238 int ret; 239 int ret;
239 240
240 ret = wl1271_acx_slot(wl, DEFAULT_SLOT_TIME); 241 ret = wl1271_acx_slot(wl, wlvif, DEFAULT_SLOT_TIME);
241 if (ret < 0) 242 if (ret < 0)
242 return ret; 243 return ret;
243 244
244 ret = wl1271_acx_service_period_timeout(wl); 245 ret = wl1271_acx_service_period_timeout(wl, wlvif);
245 if (ret < 0) 246 if (ret < 0)
246 return ret; 247 return ret;
247 248
248 ret = wl1271_acx_rts_threshold(wl, wl->hw->wiphy->rts_threshold); 249 ret = wl1271_acx_rts_threshold(wl, wlvif, wl->hw->wiphy->rts_threshold);
249 if (ret < 0) 250 if (ret < 0)
250 return ret; 251 return ret;
251 252
252 return 0; 253 return 0;
253} 254}
254 255
255static int wl1271_init_beacon_filter(struct wl1271 *wl) 256static int wl1271_init_beacon_filter(struct wl1271 *wl,
257 struct wl12xx_vif *wlvif)
256{ 258{
257 int ret; 259 int ret;
258 260
259 /* disable beacon filtering at this stage */ 261 /* disable beacon filtering at this stage */
260 ret = wl1271_acx_beacon_filter_opt(wl, false); 262 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
261 if (ret < 0) 263 if (ret < 0)
262 return ret; 264 return ret;
263 265
264 ret = wl1271_acx_beacon_filter_table(wl); 266 ret = wl1271_acx_beacon_filter_table(wl, wlvif);
265 if (ret < 0) 267 if (ret < 0)
266 return ret; 268 return ret;
267 269
@@ -294,11 +296,12 @@ int wl1271_init_energy_detection(struct wl1271 *wl)
294 return 0; 296 return 0;
295} 297}
296 298
297static int wl1271_init_beacon_broadcast(struct wl1271 *wl) 299static int wl1271_init_beacon_broadcast(struct wl1271 *wl,
300 struct wl12xx_vif *wlvif)
298{ 301{
299 int ret; 302 int ret;
300 303
301 ret = wl1271_acx_bcn_dtim_options(wl); 304 ret = wl1271_acx_bcn_dtim_options(wl, wlvif);
302 if (ret < 0) 305 if (ret < 0)
303 return ret; 306 return ret;
304 307
@@ -352,20 +355,22 @@ static int wl1271_sta_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
352 return 0; 355 return 0;
353} 356}
354 357
355static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl) 358static int wl1271_sta_hw_init_post_mem(struct wl1271 *wl,
359 struct ieee80211_vif *vif)
356{ 360{
361 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
357 int ret, i; 362 int ret, i;
358 363
359 /* disable all keep-alive templates */ 364 /* disable all keep-alive templates */
360 for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { 365 for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
361 ret = wl1271_acx_keep_alive_config(wl, i, 366 ret = wl1271_acx_keep_alive_config(wl, wlvif, i,
362 ACX_KEEP_ALIVE_TPL_INVALID); 367 ACX_KEEP_ALIVE_TPL_INVALID);
363 if (ret < 0) 368 if (ret < 0)
364 return ret; 369 return ret;
365 } 370 }
366 371
367 /* disable the keep-alive feature */ 372 /* disable the keep-alive feature */
368 ret = wl1271_acx_keep_alive_mode(wl, false); 373 ret = wl1271_acx_keep_alive_mode(wl, wlvif, false);
369 if (ret < 0) 374 if (ret < 0)
370 return ret; 375 return ret;
371 376
@@ -410,7 +415,7 @@ int wl1271_ap_init_templates(struct wl1271 *wl, struct ieee80211_vif *vif)
410 * when operating as AP we want to receive external beacons for 415 * when operating as AP we want to receive external beacons for
411 * configuring ERP protection. 416 * configuring ERP protection.
412 */ 417 */
413 ret = wl1271_acx_beacon_filter_opt(wl, false); 418 ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
414 if (ret < 0) 419 if (ret < 0)
415 return ret; 420 return ret;
416 421
@@ -495,7 +500,7 @@ static int wl1271_set_ba_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif)
495 wl->ba_support = true; 500 wl->ba_support = true;
496 501
497 /* 802.11n initiator BA session setting */ 502 /* 802.11n initiator BA session setting */
498 return wl12xx_acx_set_ba_initiator_policy(wl); 503 return wl12xx_acx_set_ba_initiator_policy(wl, wlvif);
499} 504}
500 505
501int wl1271_chip_specific_init(struct wl1271 *wl) 506int wl1271_chip_specific_init(struct wl1271 *wl)
@@ -519,31 +524,31 @@ out:
519} 524}
520 525
521/* vif-specifc initialization */ 526/* vif-specifc initialization */
522static int wl12xx_init_sta_role(struct wl1271 *wl, struct ieee80211_vif *vif) 527static int wl12xx_init_sta_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
523{ 528{
524 int ret; 529 int ret;
525 530
526 ret = wl1271_acx_group_address_tbl(wl, true, NULL, 0); 531 ret = wl1271_acx_group_address_tbl(wl, wlvif, true, NULL, 0);
527 if (ret < 0) 532 if (ret < 0)
528 return ret; 533 return ret;
529 534
530 /* Initialize connection monitoring thresholds */ 535 /* Initialize connection monitoring thresholds */
531 ret = wl1271_acx_conn_monit_params(wl, false); 536 ret = wl1271_acx_conn_monit_params(wl, wlvif, false);
532 if (ret < 0) 537 if (ret < 0)
533 return ret; 538 return ret;
534 539
535 /* Beacon filtering */ 540 /* Beacon filtering */
536 ret = wl1271_init_beacon_filter(wl); 541 ret = wl1271_init_beacon_filter(wl, wlvif);
537 if (ret < 0) 542 if (ret < 0)
538 return ret; 543 return ret;
539 544
540 /* Beacons and broadcast settings */ 545 /* Beacons and broadcast settings */
541 ret = wl1271_init_beacon_broadcast(wl); 546 ret = wl1271_init_beacon_broadcast(wl, wlvif);
542 if (ret < 0) 547 if (ret < 0)
543 return ret; 548 return ret;
544 549
545 /* Configure rssi/snr averaging weights */ 550 /* Configure rssi/snr averaging weights */
546 ret = wl1271_acx_rssi_snr_avg_weights(wl); 551 ret = wl1271_acx_rssi_snr_avg_weights(wl, wlvif);
547 if (ret < 0) 552 if (ret < 0)
548 return ret; 553 return ret;
549 554
@@ -551,16 +556,16 @@ static int wl12xx_init_sta_role(struct wl1271 *wl, struct ieee80211_vif *vif)
551} 556}
552 557
553/* vif-specific intialization */ 558/* vif-specific intialization */
554static int wl12xx_init_ap_role(struct wl1271 *wl, struct ieee80211_vif *vif) 559static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
555{ 560{
556 int ret; 561 int ret;
557 562
558 ret = wl1271_acx_ap_max_tx_retry(wl); 563 ret = wl1271_acx_ap_max_tx_retry(wl, wlvif);
559 if (ret < 0) 564 if (ret < 0)
560 return ret; 565 return ret;
561 566
562 /* initialize Tx power */ 567 /* initialize Tx power */
563 ret = wl1271_acx_tx_power(wl, wl->power_level); 568 ret = wl1271_acx_tx_power(wl, wlvif, wl->power_level);
564 if (ret < 0) 569 if (ret < 0)
565 return ret; 570 return ret;
566 571
@@ -582,7 +587,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
582 if (ret < 0) 587 if (ret < 0)
583 return ret; 588 return ret;
584 589
585 ret = wl12xx_init_ap_role(wl, vif); 590 ret = wl12xx_init_ap_role(wl, wlvif);
586 if (ret < 0) 591 if (ret < 0)
587 return ret; 592 return ret;
588 } else { 593 } else {
@@ -590,25 +595,25 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
590 if (ret < 0) 595 if (ret < 0)
591 return ret; 596 return ret;
592 597
593 ret = wl12xx_init_sta_role(wl, vif); 598 ret = wl12xx_init_sta_role(wl, wlvif);
594 if (ret < 0) 599 if (ret < 0)
595 return ret; 600 return ret;
596 } 601 }
597 602
598 wl12xx_init_phy_vif_config(wl); 603 wl12xx_init_phy_vif_config(wl, wlvif);
599 604
600 /* Default TID/AC configuration */ 605 /* Default TID/AC configuration */
601 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count); 606 BUG_ON(wl->conf.tx.tid_conf_count != wl->conf.tx.ac_conf_count);
602 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) { 607 for (i = 0; i < wl->conf.tx.tid_conf_count; i++) {
603 conf_ac = &wl->conf.tx.ac_conf[i]; 608 conf_ac = &wl->conf.tx.ac_conf[i];
604 ret = wl1271_acx_ac_cfg(wl, conf_ac->ac, conf_ac->cw_min, 609 ret = wl1271_acx_ac_cfg(wl, wlvif, conf_ac->ac,
605 conf_ac->cw_max, conf_ac->aifsn, 610 conf_ac->cw_min, conf_ac->cw_max,
606 conf_ac->tx_op_limit); 611 conf_ac->aifsn, conf_ac->tx_op_limit);
607 if (ret < 0) 612 if (ret < 0)
608 return ret; 613 return ret;
609 614
610 conf_tid = &wl->conf.tx.tid_conf[i]; 615 conf_tid = &wl->conf.tx.tid_conf[i];
611 ret = wl1271_acx_tid_cfg(wl, 616 ret = wl1271_acx_tid_cfg(wl, wlvif,
612 conf_tid->queue_id, 617 conf_tid->queue_id,
613 conf_tid->channel_type, 618 conf_tid->channel_type,
614 conf_tid->tsid, 619 conf_tid->tsid,
@@ -621,7 +626,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
621 } 626 }
622 627
623 /* Configure HW encryption */ 628 /* Configure HW encryption */
624 ret = wl1271_acx_feature_cfg(wl); 629 ret = wl1271_acx_feature_cfg(wl, wlvif);
625 if (ret < 0) 630 if (ret < 0)
626 return ret; 631 return ret;
627 632
@@ -629,7 +634,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
629 if (is_ap) 634 if (is_ap)
630 ret = wl1271_ap_hw_init_post_mem(wl, vif); 635 ret = wl1271_ap_hw_init_post_mem(wl, vif);
631 else 636 else
632 ret = wl1271_sta_hw_init_post_mem(wl); 637 ret = wl1271_sta_hw_init_post_mem(wl, vif);
633 638
634 if (ret < 0) 639 if (ret < 0)
635 return ret; 640 return ret;