diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 83 |
1 files changed, 49 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 39419ea845cc..ca10a8b3a381 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -61,10 +61,14 @@ static int ath9k_ps_enable; | |||
61 | module_param_named(ps_enable, ath9k_ps_enable, int, 0444); | 61 | module_param_named(ps_enable, ath9k_ps_enable, int, 0444); |
62 | MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave"); | 62 | MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave"); |
63 | 63 | ||
64 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
65 | |||
64 | int ath9k_use_chanctx; | 66 | int ath9k_use_chanctx; |
65 | module_param_named(use_chanctx, ath9k_use_chanctx, int, 0444); | 67 | module_param_named(use_chanctx, ath9k_use_chanctx, int, 0444); |
66 | MODULE_PARM_DESC(use_chanctx, "Enable channel context for concurrency"); | 68 | MODULE_PARM_DESC(use_chanctx, "Enable channel context for concurrency"); |
67 | 69 | ||
70 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
71 | |||
68 | bool is_ath9k_unloaded; | 72 | bool is_ath9k_unloaded; |
69 | 73 | ||
70 | #ifdef CONFIG_MAC80211_LEDS | 74 | #ifdef CONFIG_MAC80211_LEDS |
@@ -511,7 +515,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | |||
511 | sc->tx99_power = MAX_RATE_POWER + 1; | 515 | sc->tx99_power = MAX_RATE_POWER + 1; |
512 | init_waitqueue_head(&sc->tx_wait); | 516 | init_waitqueue_head(&sc->tx_wait); |
513 | sc->cur_chan = &sc->chanctx[0]; | 517 | sc->cur_chan = &sc->chanctx[0]; |
514 | if (!ath9k_use_chanctx) | 518 | if (!ath9k_is_chanctx_enabled()) |
515 | sc->cur_chan->hw_queue_base = 0; | 519 | sc->cur_chan->hw_queue_base = 0; |
516 | 520 | ||
517 | if (!pdata || pdata->use_eeprom) { | 521 | if (!pdata || pdata->use_eeprom) { |
@@ -567,11 +571,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | |||
567 | setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc); | 571 | setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc); |
568 | INIT_WORK(&sc->hw_reset_work, ath_reset_work); | 572 | INIT_WORK(&sc->hw_reset_work, ath_reset_work); |
569 | INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); | 573 | INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); |
570 | INIT_WORK(&sc->chanctx_work, ath_chanctx_work); | ||
571 | INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); | 574 | INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); |
572 | setup_timer(&sc->offchannel.timer, ath_offchannel_timer, | 575 | |
573 | (unsigned long)sc); | 576 | ath9k_init_channel_context(sc); |
574 | setup_timer(&sc->sched.timer, ath_chanctx_timer, (unsigned long)sc); | ||
575 | 577 | ||
576 | /* | 578 | /* |
577 | * Cache line size is used to size and align various | 579 | * Cache line size is used to size and align various |
@@ -600,13 +602,15 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, | |||
600 | if (ret) | 602 | if (ret) |
601 | goto err_btcoex; | 603 | goto err_btcoex; |
602 | 604 | ||
603 | sc->p2p_ps_timer = ath_gen_timer_alloc(sc->sc_ah, ath9k_p2p_ps_timer, | 605 | ret = ath9k_init_p2p(sc); |
604 | NULL, sc, AR_FIRST_NDP_TIMER); | 606 | if (ret) |
607 | goto err_btcoex; | ||
605 | 608 | ||
606 | ath9k_cmn_init_crypto(sc->sc_ah); | 609 | ath9k_cmn_init_crypto(sc->sc_ah); |
607 | ath9k_init_misc(sc); | 610 | ath9k_init_misc(sc); |
608 | ath_fill_led_pin(sc); | 611 | ath_fill_led_pin(sc); |
609 | ath_chanctx_init(sc); | 612 | ath_chanctx_init(sc); |
613 | ath9k_offchannel_init(sc); | ||
610 | 614 | ||
611 | if (common->bus_ops->aspm_init) | 615 | if (common->bus_ops->aspm_init) |
612 | common->bus_ops->aspm_init(common); | 616 | common->bus_ops->aspm_init(common); |
@@ -672,18 +676,14 @@ static const struct ieee80211_iface_limit wds_limits[] = { | |||
672 | { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) }, | 676 | { .max = 2048, .types = BIT(NL80211_IFTYPE_WDS) }, |
673 | }; | 677 | }; |
674 | 678 | ||
679 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
680 | |||
675 | static const struct ieee80211_iface_limit if_limits_multi[] = { | 681 | static const struct ieee80211_iface_limit if_limits_multi[] = { |
676 | { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) }, | 682 | { .max = 2, .types = BIT(NL80211_IFTYPE_STATION) | |
677 | { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | | 683 | BIT(NL80211_IFTYPE_AP) | |
684 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
678 | BIT(NL80211_IFTYPE_P2P_GO) }, | 685 | BIT(NL80211_IFTYPE_P2P_GO) }, |
679 | }; | 686 | { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) }, |
680 | |||
681 | static const struct ieee80211_iface_limit if_dfs_limits[] = { | ||
682 | { .max = 1, .types = BIT(NL80211_IFTYPE_AP) | | ||
683 | #ifdef CONFIG_MAC80211_MESH | ||
684 | BIT(NL80211_IFTYPE_MESH_POINT) | | ||
685 | #endif | ||
686 | BIT(NL80211_IFTYPE_ADHOC) }, | ||
687 | }; | 687 | }; |
688 | 688 | ||
689 | static const struct ieee80211_iface_combination if_comb_multi[] = { | 689 | static const struct ieee80211_iface_combination if_comb_multi[] = { |
@@ -696,6 +696,16 @@ static const struct ieee80211_iface_combination if_comb_multi[] = { | |||
696 | }, | 696 | }, |
697 | }; | 697 | }; |
698 | 698 | ||
699 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
700 | |||
701 | static const struct ieee80211_iface_limit if_dfs_limits[] = { | ||
702 | { .max = 1, .types = BIT(NL80211_IFTYPE_AP) | | ||
703 | #ifdef CONFIG_MAC80211_MESH | ||
704 | BIT(NL80211_IFTYPE_MESH_POINT) | | ||
705 | #endif | ||
706 | BIT(NL80211_IFTYPE_ADHOC) }, | ||
707 | }; | ||
708 | |||
699 | static const struct ieee80211_iface_combination if_comb[] = { | 709 | static const struct ieee80211_iface_combination if_comb[] = { |
700 | { | 710 | { |
701 | .limits = if_limits, | 711 | .limits = if_limits, |
@@ -763,24 +773,31 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
763 | BIT(NL80211_IFTYPE_AP) | | 773 | BIT(NL80211_IFTYPE_AP) | |
764 | BIT(NL80211_IFTYPE_STATION) | | 774 | BIT(NL80211_IFTYPE_STATION) | |
765 | BIT(NL80211_IFTYPE_ADHOC) | | 775 | BIT(NL80211_IFTYPE_ADHOC) | |
766 | BIT(NL80211_IFTYPE_MESH_POINT); | 776 | BIT(NL80211_IFTYPE_MESH_POINT) | |
767 | if (!ath9k_use_chanctx) { | 777 | BIT(NL80211_IFTYPE_WDS); |
778 | |||
768 | hw->wiphy->iface_combinations = if_comb; | 779 | hw->wiphy->iface_combinations = if_comb; |
769 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | 780 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); |
770 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_WDS); | ||
771 | } else { | ||
772 | hw->wiphy->iface_combinations = if_comb_multi; | ||
773 | hw->wiphy->n_iface_combinations = | ||
774 | ARRAY_SIZE(if_comb_multi); | ||
775 | hw->wiphy->max_scan_ssids = 255; | ||
776 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | ||
777 | hw->wiphy->max_remain_on_channel_duration = 10000; | ||
778 | hw->chanctx_data_size = sizeof(void *); | ||
779 | hw->extra_beacon_tailroom = | ||
780 | sizeof(struct ieee80211_p2p_noa_attr) + 9; | ||
781 | } | ||
782 | } | 781 | } |
783 | 782 | ||
783 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
784 | |||
785 | if (ath9k_is_chanctx_enabled()) { | ||
786 | hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); | ||
787 | hw->wiphy->iface_combinations = if_comb_multi; | ||
788 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); | ||
789 | hw->wiphy->max_scan_ssids = 255; | ||
790 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | ||
791 | hw->wiphy->max_remain_on_channel_duration = 10000; | ||
792 | hw->chanctx_data_size = sizeof(void *); | ||
793 | hw->extra_beacon_tailroom = | ||
794 | sizeof(struct ieee80211_p2p_noa_attr) + 9; | ||
795 | |||
796 | ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); | ||
797 | } | ||
798 | |||
799 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
800 | |||
784 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 801 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
785 | 802 | ||
786 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 803 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
@@ -915,9 +932,7 @@ static void ath9k_deinit_softc(struct ath_softc *sc) | |||
915 | { | 932 | { |
916 | int i = 0; | 933 | int i = 0; |
917 | 934 | ||
918 | if (sc->p2p_ps_timer) | 935 | ath9k_deinit_p2p(sc); |
919 | ath_gen_timer_free(sc->sc_ah, sc->p2p_ps_timer); | ||
920 | |||
921 | ath9k_deinit_btcoex(sc); | 936 | ath9k_deinit_btcoex(sc); |
922 | 937 | ||
923 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) | 938 | for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) |