|
52 | 52 | #define BRCMF_PNO_SCAN_COMPLETE 1 |
53 | 53 | #define BRCMF_PNO_SCAN_INCOMPLETE 0 |
54 | 54 |
|
55 | | -#define BRCMF_IFACE_MAX_CNT 3 |
56 | | - |
57 | 55 | #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */ |
58 | 56 | #define WPA_OUI_TYPE 1 |
59 | 57 | #define RSN_OUI "\x00\x0F\xAC" /* RSN OUI */ |
@@ -5640,53 +5638,6 @@ static int brcmf_setup_wiphybands(struct wiphy *wiphy) |
5640 | 5638 | return 0; |
5641 | 5639 | } |
5642 | 5640 |
|
5643 | | -static const struct ieee80211_iface_limit brcmf_iface_limits_mbss[] = { |
5644 | | - { |
5645 | | - .max = 1, |
5646 | | - .types = BIT(NL80211_IFTYPE_STATION) | |
5647 | | - BIT(NL80211_IFTYPE_ADHOC) |
5648 | | - }, |
5649 | | - { |
5650 | | - .max = 4, |
5651 | | - .types = BIT(NL80211_IFTYPE_AP) |
5652 | | - }, |
5653 | | - { |
5654 | | - .max = 1, |
5655 | | - .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
5656 | | - BIT(NL80211_IFTYPE_P2P_GO) |
5657 | | - }, |
5658 | | - { |
5659 | | - .max = 1, |
5660 | | - .types = BIT(NL80211_IFTYPE_P2P_DEVICE) |
5661 | | - } |
5662 | | -}; |
5663 | | - |
5664 | | -static const struct ieee80211_iface_limit brcmf_iface_limits_sbss[] = { |
5665 | | - { |
5666 | | - .max = 2, |
5667 | | - .types = BIT(NL80211_IFTYPE_STATION) | |
5668 | | - BIT(NL80211_IFTYPE_ADHOC) | |
5669 | | - BIT(NL80211_IFTYPE_AP) |
5670 | | - }, |
5671 | | - { |
5672 | | - .max = 1, |
5673 | | - .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
5674 | | - BIT(NL80211_IFTYPE_P2P_GO) |
5675 | | - }, |
5676 | | - { |
5677 | | - .max = 1, |
5678 | | - .types = BIT(NL80211_IFTYPE_P2P_DEVICE) |
5679 | | - } |
5680 | | -}; |
5681 | | -static struct ieee80211_iface_combination brcmf_iface_combos[] = { |
5682 | | - { |
5683 | | - .max_interfaces = BRCMF_IFACE_MAX_CNT, |
5684 | | - .num_different_channels = 1, |
5685 | | - .n_limits = ARRAY_SIZE(brcmf_iface_limits_sbss), |
5686 | | - .limits = brcmf_iface_limits_sbss, |
5687 | | - } |
5688 | | -}; |
5689 | | - |
5690 | 5641 | static const struct ieee80211_txrx_stypes |
5691 | 5642 | brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = { |
5692 | 5643 | [NL80211_IFTYPE_STATION] = { |
@@ -5716,6 +5667,67 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = { |
5716 | 5667 | } |
5717 | 5668 | }; |
5718 | 5669 |
|
| 5670 | +static int brcmf_setup_ifmodes(struct wiphy *wiphy, struct brcmf_if *ifp) |
| 5671 | +{ |
| 5672 | + struct ieee80211_iface_combination *combo = NULL; |
| 5673 | + struct ieee80211_iface_limit *limits = NULL; |
| 5674 | + int i = 0, max_iface_cnt; |
| 5675 | + |
| 5676 | + combo = kzalloc(sizeof(*combo), GFP_KERNEL); |
| 5677 | + if (!combo) |
| 5678 | + goto err; |
| 5679 | + |
| 5680 | + limits = kzalloc(sizeof(*limits) * 4, GFP_KERNEL); |
| 5681 | + if (!limits) |
| 5682 | + goto err; |
| 5683 | + |
| 5684 | + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
| 5685 | + BIT(NL80211_IFTYPE_ADHOC) | |
| 5686 | + BIT(NL80211_IFTYPE_AP); |
| 5687 | + |
| 5688 | + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN)) |
| 5689 | + combo->num_different_channels = 2; |
| 5690 | + else |
| 5691 | + combo->num_different_channels = 1; |
| 5692 | + |
| 5693 | + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) { |
| 5694 | + limits[i].max = 1; |
| 5695 | + limits[i++].types = BIT(NL80211_IFTYPE_STATION); |
| 5696 | + limits[i].max = 4; |
| 5697 | + limits[i++].types = BIT(NL80211_IFTYPE_AP); |
| 5698 | + max_iface_cnt = 5; |
| 5699 | + } else { |
| 5700 | + limits[i].max = 2; |
| 5701 | + limits[i++].types = BIT(NL80211_IFTYPE_STATION) | |
| 5702 | + BIT(NL80211_IFTYPE_AP); |
| 5703 | + max_iface_cnt = 2; |
| 5704 | + } |
| 5705 | + |
| 5706 | + if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_P2P)) { |
| 5707 | + wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_CLIENT) | |
| 5708 | + BIT(NL80211_IFTYPE_P2P_GO) | |
| 5709 | + BIT(NL80211_IFTYPE_P2P_DEVICE); |
| 5710 | + limits[i].max = 1; |
| 5711 | + limits[i++].types = BIT(NL80211_IFTYPE_P2P_CLIENT) | |
| 5712 | + BIT(NL80211_IFTYPE_P2P_GO); |
| 5713 | + limits[i].max = 1; |
| 5714 | + limits[i++].types = BIT(NL80211_IFTYPE_P2P_DEVICE); |
| 5715 | + max_iface_cnt += 2; |
| 5716 | + } |
| 5717 | + combo->max_interfaces = max_iface_cnt; |
| 5718 | + combo->limits = limits; |
| 5719 | + combo->n_limits = i; |
| 5720 | + |
| 5721 | + wiphy->iface_combinations = combo; |
| 5722 | + wiphy->n_iface_combinations = 1; |
| 5723 | + return 0; |
| 5724 | + |
| 5725 | +err: |
| 5726 | + kfree(limits); |
| 5727 | + kfree(combo); |
| 5728 | + return -ENOMEM; |
| 5729 | +} |
| 5730 | + |
5719 | 5731 | static void brcmf_wiphy_pno_params(struct wiphy *wiphy) |
5720 | 5732 | { |
5721 | 5733 | /* scheduled scan settings */ |
@@ -5746,32 +5758,18 @@ static void brcmf_wiphy_wowl_params(struct wiphy *wiphy) |
5746 | 5758 | static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) |
5747 | 5759 | { |
5748 | 5760 | struct ieee80211_supported_band *band; |
5749 | | - struct ieee80211_iface_combination ifc_combo; |
5750 | 5761 | __le32 bandlist[3]; |
5751 | 5762 | u32 n_bands; |
5752 | 5763 | int err, i; |
5753 | 5764 |
|
5754 | 5765 | wiphy->max_scan_ssids = WL_NUM_SCAN_MAX; |
5755 | 5766 | wiphy->max_scan_ie_len = BRCMF_SCAN_IE_LEN_MAX; |
5756 | 5767 | wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX; |
5757 | | - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
5758 | | - BIT(NL80211_IFTYPE_ADHOC) | |
5759 | | - BIT(NL80211_IFTYPE_AP) | |
5760 | | - BIT(NL80211_IFTYPE_P2P_CLIENT) | |
5761 | | - BIT(NL80211_IFTYPE_P2P_GO) | |
5762 | | - BIT(NL80211_IFTYPE_P2P_DEVICE); |
5763 | | - /* need VSDB firmware feature for concurrent channels */ |
5764 | | - ifc_combo = brcmf_iface_combos[0]; |
5765 | | - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MCHAN)) |
5766 | | - ifc_combo.num_different_channels = 2; |
5767 | | - if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) { |
5768 | | - ifc_combo.n_limits = ARRAY_SIZE(brcmf_iface_limits_mbss), |
5769 | | - ifc_combo.limits = brcmf_iface_limits_mbss; |
5770 | | - } |
5771 | | - wiphy->iface_combinations = kmemdup(&ifc_combo, |
5772 | | - sizeof(ifc_combo), |
5773 | | - GFP_KERNEL); |
5774 | | - wiphy->n_iface_combinations = ARRAY_SIZE(brcmf_iface_combos); |
| 5768 | + |
| 5769 | + err = brcmf_setup_ifmodes(wiphy, ifp); |
| 5770 | + if (err) |
| 5771 | + return err; |
| 5772 | + |
5775 | 5773 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
5776 | 5774 | wiphy->cipher_suites = __wl_cipher_suites; |
5777 | 5775 | wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites); |
@@ -6036,6 +6034,8 @@ static void brcmf_free_wiphy(struct wiphy *wiphy) |
6036 | 6034 | if (!wiphy) |
6037 | 6035 | return; |
6038 | 6036 |
|
| 6037 | + if (wiphy->iface_combinations) |
| 6038 | + kfree(wiphy->iface_combinations->limits); |
6039 | 6039 | kfree(wiphy->iface_combinations); |
6040 | 6040 | if (wiphy->bands[IEEE80211_BAND_2GHZ]) { |
6041 | 6041 | kfree(wiphy->bands[IEEE80211_BAND_2GHZ]->channels); |
|
0 commit comments