aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-07-26 11:24:39 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-17 05:02:09 -0400
commit55de908ab292c03f1eb280f51170ddb9c6b57e31 (patch)
treebc75bb5cea581cadf6fe8b4f121cce02d07c276a /net/mac80211/cfg.c
parentfe57d9f5c0a2c1ef97ba8cdc42cfda5743f287b8 (diff)
mac80211: use channel contexts
Instead of operating on a single channel only, use the new channel context infrastructure in all mac80211 code. This enables drivers that want to use the new channel context infrastructure to use multiple channels, while nothing should change for all the other drivers that don't support it. Right now this disables both TX power settings and spatial multiplexing powersave. Both need to be re-enabled on a channel context basis. Additionally, when channel contexts are used drop the connection when channel switch is received rather than trying to handle it. This will have to be improved later. [With fixes from Eliad and Emmanuel incorporated] Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c248
1 files changed, 128 insertions, 120 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 70a5d262815f..09c90627fd19 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -372,10 +372,11 @@ static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
372 372
373static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, int idx) 373static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, int idx)
374{ 374{
375 enum ieee80211_band band = ieee80211_get_sdata_band(sta->sdata);
376
375 if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { 377 if (!(rate->flags & RATE_INFO_FLAGS_MCS)) {
376 struct ieee80211_supported_band *sband; 378 struct ieee80211_supported_band *sband;
377 sband = sta->local->hw.wiphy->bands[ 379 sband = sta->local->hw.wiphy->bands[band];
378 sta->local->oper_channel->band];
379 rate->legacy = sband->bitrates[idx].bitrate; 380 rate->legacy = sband->bitrates[idx].bitrate;
380 } else 381 } else
381 rate->mcs = idx; 382 rate->mcs = idx;
@@ -532,6 +533,8 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
532 u64 *data) 533 u64 *data)
533{ 534{
534 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 535 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
536 struct ieee80211_chanctx_conf *chanctx_conf;
537 struct ieee80211_channel *channel;
535 struct sta_info *sta; 538 struct sta_info *sta;
536 struct ieee80211_local *local = sdata->local; 539 struct ieee80211_local *local = sdata->local;
537 struct station_info sinfo; 540 struct station_info sinfo;
@@ -607,19 +610,26 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
607do_survey: 610do_survey:
608 i = STA_STATS_LEN - STA_STATS_SURVEY_LEN; 611 i = STA_STATS_LEN - STA_STATS_SURVEY_LEN;
609 /* Get survey stats for current channel */ 612 /* Get survey stats for current channel */
610 q = 0; 613 survey.filled = 0;
611 while (true) {
612 survey.filled = 0;
613 if (drv_get_survey(local, q, &survey) != 0) {
614 survey.filled = 0;
615 break;
616 }
617 614
618 if (survey.channel && 615 rcu_read_lock();
619 (local->oper_channel->center_freq == 616 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
620 survey.channel->center_freq)) 617 if (chanctx_conf)
621 break; 618 channel = chanctx_conf->channel;
622 q++; 619 else
620 channel = NULL;
621 rcu_read_unlock();
622
623 if (channel) {
624 q = 0;
625 do {
626 survey.filled = 0;
627 if (drv_get_survey(local, q, &survey) != 0) {
628 survey.filled = 0;
629 break;
630 }
631 q++;
632 } while (channel != survey.channel);
623 } 633 }
624 634
625 if (survey.filled) 635 if (survey.filled)
@@ -724,47 +734,42 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
724 return ret; 734 return ret;
725} 735}
726 736
727static int ieee80211_set_channel(struct wiphy *wiphy, 737static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
728 struct net_device *netdev, 738 struct ieee80211_channel *chan,
729 struct ieee80211_channel *chan, 739 enum nl80211_channel_type channel_type)
730 enum nl80211_channel_type channel_type)
731{ 740{
732 struct ieee80211_local *local = wiphy_priv(wiphy); 741 struct ieee80211_local *local = wiphy_priv(wiphy);
733 struct ieee80211_sub_if_data *sdata = NULL; 742 struct ieee80211_sub_if_data *sdata;
734 743 int ret = 0;
735 if (netdev)
736 sdata = IEEE80211_DEV_TO_SUB_IF(netdev);
737
738 switch (ieee80211_get_channel_mode(local, NULL)) {
739 case CHAN_MODE_HOPPING:
740 return -EBUSY;
741 case CHAN_MODE_FIXED:
742 if (local->oper_channel != chan ||
743 (!sdata && local->_oper_channel_type != channel_type))
744 return -EBUSY;
745 if (!sdata && local->_oper_channel_type == channel_type)
746 return 0;
747 break;
748 case CHAN_MODE_UNDEFINED:
749 break;
750 }
751
752 if (!ieee80211_set_channel_type(local, sdata, channel_type))
753 return -EBUSY;
754 744
755 local->oper_channel = chan; 745 if (local->monitor_channel == chan &&
746 local->monitor_channel_type == channel_type)
747 return 0;
756 748
757 /* auto-detects changes */ 749 mutex_lock(&local->iflist_mtx);
758 ieee80211_hw_config(local, 0); 750 if (local->use_chanctx) {
751 sdata = rcu_dereference_protected(
752 local->monitor_sdata,
753 lockdep_is_held(&local->iflist_mtx));
754 if (sdata) {
755 ieee80211_vif_release_channel(sdata);
756 ret = ieee80211_vif_use_channel(
757 sdata, chan, channel_type,
758 IEEE80211_CHANCTX_EXCLUSIVE);
759 }
760 } else if (local->open_count == local->monitors) {
761 local->_oper_channel = chan;
762 local->_oper_channel_type = channel_type;
763 ieee80211_hw_config(local, 0);
764 }
759 765
760 return 0; 766 if (ret == 0) {
761} 767 local->monitor_channel = chan;
768 local->monitor_channel_type = channel_type;
769 }
770 mutex_unlock(&local->iflist_mtx);
762 771
763static int ieee80211_set_monitor_channel(struct wiphy *wiphy, 772 return ret;
764 struct ieee80211_channel *chan,
765 enum nl80211_channel_type channel_type)
766{
767 return ieee80211_set_channel(wiphy, NULL, chan, channel_type);
768} 773}
769 774
770static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, 775static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
@@ -879,8 +884,9 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
879 if (old) 884 if (old)
880 return -EALREADY; 885 return -EALREADY;
881 886
882 err = ieee80211_set_channel(wiphy, dev, params->channel, 887 err = ieee80211_vif_use_channel(sdata, params->channel,
883 params->channel_type); 888 params->channel_type,
889 IEEE80211_CHANCTX_SHARED);
884 if (err) 890 if (err)
885 return err; 891 return err;
886 892
@@ -963,6 +969,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
963 sta_info_flush(sdata->local, sdata); 969 sta_info_flush(sdata->local, sdata);
964 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); 970 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
965 971
972 ieee80211_vif_release_channel(sdata);
973
966 return 0; 974 return 0;
967} 975}
968 976
@@ -1019,9 +1027,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
1019 int i, j; 1027 int i, j;
1020 struct ieee80211_supported_band *sband; 1028 struct ieee80211_supported_band *sband;
1021 struct ieee80211_sub_if_data *sdata = sta->sdata; 1029 struct ieee80211_sub_if_data *sdata = sta->sdata;
1030 enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
1022 u32 mask, set; 1031 u32 mask, set;
1023 1032
1024 sband = local->hw.wiphy->bands[local->oper_channel->band]; 1033 sband = local->hw.wiphy->bands[band];
1025 1034
1026 mask = params->sta_flags_mask; 1035 mask = params->sta_flags_mask;
1027 set = params->sta_flags_set; 1036 set = params->sta_flags_set;
@@ -1136,7 +1145,7 @@ static int sta_apply_parameters(struct ieee80211_local *local,
1136 rates |= BIT(j); 1145 rates |= BIT(j);
1137 } 1146 }
1138 } 1147 }
1139 sta->sta.supp_rates[local->oper_channel->band] = rates; 1148 sta->sta.supp_rates[band] = rates;
1140 } 1149 }
1141 1150
1142 if (params->ht_capa) 1151 if (params->ht_capa)
@@ -1664,8 +1673,9 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
1664 if (err) 1673 if (err)
1665 return err; 1674 return err;
1666 1675
1667 err = ieee80211_set_channel(wiphy, dev, setup->channel, 1676 err = ieee80211_vif_use_channel(sdata, setup->channel,
1668 setup->channel_type); 1677 setup->channel_type,
1678 IEEE80211_CHANCTX_SHARED);
1669 if (err) 1679 if (err)
1670 return err; 1680 return err;
1671 1681
@@ -1679,6 +1689,7 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
1679 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1689 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1680 1690
1681 ieee80211_stop_mesh(sdata); 1691 ieee80211_stop_mesh(sdata);
1692 ieee80211_vif_release_channel(sdata);
1682 1693
1683 return 0; 1694 return 0;
1684} 1695}
@@ -1688,10 +1699,14 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1688 struct net_device *dev, 1699 struct net_device *dev,
1689 struct bss_parameters *params) 1700 struct bss_parameters *params)
1690{ 1701{
1691 struct ieee80211_sub_if_data *sdata; 1702 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1703 enum ieee80211_band band;
1692 u32 changed = 0; 1704 u32 changed = 0;
1693 1705
1694 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1706 if (!rtnl_dereference(sdata->u.ap.beacon))
1707 return -ENOENT;
1708
1709 band = ieee80211_get_sdata_band(sdata);
1695 1710
1696 if (params->use_cts_prot >= 0) { 1711 if (params->use_cts_prot >= 0) {
1697 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; 1712 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
@@ -1704,7 +1719,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1704 } 1719 }
1705 1720
1706 if (!sdata->vif.bss_conf.use_short_slot && 1721 if (!sdata->vif.bss_conf.use_short_slot &&
1707 sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) { 1722 band == IEEE80211_BAND_5GHZ) {
1708 sdata->vif.bss_conf.use_short_slot = true; 1723 sdata->vif.bss_conf.use_short_slot = true;
1709 changed |= BSS_CHANGED_ERP_SLOT; 1724 changed |= BSS_CHANGED_ERP_SLOT;
1710 } 1725 }
@@ -1718,9 +1733,7 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1718 if (params->basic_rates) { 1733 if (params->basic_rates) {
1719 int i, j; 1734 int i, j;
1720 u32 rates = 0; 1735 u32 rates = 0;
1721 struct ieee80211_local *local = wiphy_priv(wiphy); 1736 struct ieee80211_supported_band *sband = wiphy->bands[band];
1722 struct ieee80211_supported_band *sband =
1723 wiphy->bands[local->oper_channel->band];
1724 1737
1725 for (i = 0; i < params->basic_rates_len; i++) { 1738 for (i = 0; i < params->basic_rates_len; i++) {
1726 int rate = (params->basic_rates[i] & 0x7f) * 5; 1739 int rate = (params->basic_rates[i] & 0x7f) * 5;
@@ -1872,20 +1885,6 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1872static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, 1885static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1873 struct cfg80211_assoc_request *req) 1886 struct cfg80211_assoc_request *req)
1874{ 1887{
1875 struct ieee80211_local *local = wiphy_priv(wiphy);
1876 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1877
1878 switch (ieee80211_get_channel_mode(local, sdata)) {
1879 case CHAN_MODE_HOPPING:
1880 return -EBUSY;
1881 case CHAN_MODE_FIXED:
1882 if (local->oper_channel == req->bss->channel)
1883 break;
1884 return -EBUSY;
1885 case CHAN_MODE_UNDEFINED:
1886 break;
1887 }
1888
1889 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); 1888 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req);
1890} 1889}
1891 1890
@@ -1904,30 +1903,12 @@ static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
1904static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, 1903static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1905 struct cfg80211_ibss_params *params) 1904 struct cfg80211_ibss_params *params)
1906{ 1905{
1907 struct ieee80211_local *local = wiphy_priv(wiphy); 1906 return ieee80211_ibss_join(IEEE80211_DEV_TO_SUB_IF(dev), params);
1908 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1909
1910 switch (ieee80211_get_channel_mode(local, sdata)) {
1911 case CHAN_MODE_HOPPING:
1912 return -EBUSY;
1913 case CHAN_MODE_FIXED:
1914 if (!params->channel_fixed)
1915 return -EBUSY;
1916 if (local->oper_channel == params->channel)
1917 break;
1918 return -EBUSY;
1919 case CHAN_MODE_UNDEFINED:
1920 break;
1921 }
1922
1923 return ieee80211_ibss_join(sdata, params);
1924} 1907}
1925 1908
1926static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) 1909static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
1927{ 1910{
1928 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1911 return ieee80211_ibss_leave(IEEE80211_DEV_TO_SUB_IF(dev));
1929
1930 return ieee80211_ibss_leave(sdata);
1931} 1912}
1932 1913
1933static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) 1914static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
@@ -1971,9 +1952,13 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy,
1971 enum nl80211_tx_power_setting type, int mbm) 1952 enum nl80211_tx_power_setting type, int mbm)
1972{ 1953{
1973 struct ieee80211_local *local = wiphy_priv(wiphy); 1954 struct ieee80211_local *local = wiphy_priv(wiphy);
1974 struct ieee80211_channel *chan = local->oper_channel; 1955 struct ieee80211_channel *chan = local->_oper_channel;
1975 u32 changes = 0; 1956 u32 changes = 0;
1976 1957
1958 /* FIXME */
1959 if (local->use_chanctx)
1960 return -EOPNOTSUPP;
1961
1977 switch (type) { 1962 switch (type) {
1978 case NL80211_TX_POWER_AUTOMATIC: 1963 case NL80211_TX_POWER_AUTOMATIC:
1979 local->user_power_level = -1; 1964 local->user_power_level = -1;
@@ -2518,10 +2503,20 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2518 2503
2519 /* Check if the operating channel is the requested channel */ 2504 /* Check if the operating channel is the requested channel */
2520 if (!need_offchan) { 2505 if (!need_offchan) {
2521 need_offchan = chan != local->oper_channel; 2506 struct ieee80211_chanctx_conf *chanctx_conf;
2522 if (channel_type_valid && 2507
2523 channel_type != local->_oper_channel_type) 2508 rcu_read_lock();
2509 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2510
2511 if (chanctx_conf) {
2512 need_offchan = chan != chanctx_conf->channel;
2513 if (channel_type_valid &&
2514 channel_type != chanctx_conf->channel_type)
2515 need_offchan = true;
2516 } else {
2524 need_offchan = true; 2517 need_offchan = true;
2518 }
2519 rcu_read_unlock();
2525 } 2520 }
2526 2521
2527 if (need_offchan && !offchan) { 2522 if (need_offchan && !offchan) {
@@ -2670,7 +2665,7 @@ static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata)
2670 u16 capab; 2665 u16 capab;
2671 2666
2672 capab = 0; 2667 capab = 0;
2673 if (local->oper_channel->band != IEEE80211_BAND_2GHZ) 2668 if (ieee80211_get_sdata_band(sdata) != IEEE80211_BAND_2GHZ)
2674 return capab; 2669 return capab;
2675 2670
2676 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) 2671 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE))
@@ -2702,7 +2697,7 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev,
2702 u16 status_code, struct sk_buff *skb) 2697 u16 status_code, struct sk_buff *skb)
2703{ 2698{
2704 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2699 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2705 struct ieee80211_local *local = sdata->local; 2700 enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
2706 struct ieee80211_tdls_data *tf; 2701 struct ieee80211_tdls_data *tf;
2707 2702
2708 tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); 2703 tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u));
@@ -2722,10 +2717,8 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev,
2722 tf->u.setup_req.capability = 2717 tf->u.setup_req.capability =
2723 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2718 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2724 2719
2725 ieee80211_add_srates_ie(sdata, skb, false, 2720 ieee80211_add_srates_ie(sdata, skb, false, band);
2726 local->oper_channel->band); 2721 ieee80211_add_ext_srates_ie(sdata, skb, false, band);
2727 ieee80211_add_ext_srates_ie(sdata, skb, false,
2728 local->oper_channel->band);
2729 ieee80211_tdls_add_ext_capab(skb); 2722 ieee80211_tdls_add_ext_capab(skb);
2730 break; 2723 break;
2731 case WLAN_TDLS_SETUP_RESPONSE: 2724 case WLAN_TDLS_SETUP_RESPONSE:
@@ -2738,10 +2731,8 @@ ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev,
2738 tf->u.setup_resp.capability = 2731 tf->u.setup_resp.capability =
2739 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2732 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2740 2733
2741 ieee80211_add_srates_ie(sdata, skb, false, 2734 ieee80211_add_srates_ie(sdata, skb, false, band);
2742 local->oper_channel->band); 2735 ieee80211_add_ext_srates_ie(sdata, skb, false, band);
2743 ieee80211_add_ext_srates_ie(sdata, skb, false,
2744 local->oper_channel->band);
2745 ieee80211_tdls_add_ext_capab(skb); 2736 ieee80211_tdls_add_ext_capab(skb);
2746 break; 2737 break;
2747 case WLAN_TDLS_SETUP_CONFIRM: 2738 case WLAN_TDLS_SETUP_CONFIRM:
@@ -2779,7 +2770,7 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,
2779 u16 status_code, struct sk_buff *skb) 2770 u16 status_code, struct sk_buff *skb)
2780{ 2771{
2781 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2772 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2782 struct ieee80211_local *local = sdata->local; 2773 enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
2783 struct ieee80211_mgmt *mgmt; 2774 struct ieee80211_mgmt *mgmt;
2784 2775
2785 mgmt = (void *)skb_put(skb, 24); 2776 mgmt = (void *)skb_put(skb, 24);
@@ -2802,10 +2793,8 @@ ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev,
2802 mgmt->u.action.u.tdls_discover_resp.capability = 2793 mgmt->u.action.u.tdls_discover_resp.capability =
2803 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2794 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata));
2804 2795
2805 ieee80211_add_srates_ie(sdata, skb, false, 2796 ieee80211_add_srates_ie(sdata, skb, false, band);
2806 local->oper_channel->band); 2797 ieee80211_add_ext_srates_ie(sdata, skb, false, band);
2807 ieee80211_add_ext_srates_ie(sdata, skb, false,
2808 local->oper_channel->band);
2809 ieee80211_tdls_add_ext_capab(skb); 2798 ieee80211_tdls_add_ext_capab(skb);
2810 break; 2799 break;
2811 default: 2800 default:
@@ -2985,12 +2974,19 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
2985 bool qos; 2974 bool qos;
2986 struct ieee80211_tx_info *info; 2975 struct ieee80211_tx_info *info;
2987 struct sta_info *sta; 2976 struct sta_info *sta;
2977 struct ieee80211_chanctx_conf *chanctx_conf;
2978 enum ieee80211_band band;
2988 2979
2989 rcu_read_lock(); 2980 rcu_read_lock();
2981 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2982 if (WARN_ON(!chanctx_conf)) {
2983 rcu_read_unlock();
2984 return -EINVAL;
2985 }
2986 band = chanctx_conf->channel->band;
2990 sta = sta_info_get(sdata, peer); 2987 sta = sta_info_get(sdata, peer);
2991 if (sta) { 2988 if (sta) {
2992 qos = test_sta_flag(sta, WLAN_STA_WME); 2989 qos = test_sta_flag(sta, WLAN_STA_WME);
2993 rcu_read_unlock();
2994 } else { 2990 } else {
2995 rcu_read_unlock(); 2991 rcu_read_unlock();
2996 return -ENOLINK; 2992 return -ENOLINK;
@@ -3008,8 +3004,10 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
3008 } 3004 }
3009 3005
3010 skb = dev_alloc_skb(local->hw.extra_tx_headroom + size); 3006 skb = dev_alloc_skb(local->hw.extra_tx_headroom + size);
3011 if (!skb) 3007 if (!skb) {
3008 rcu_read_unlock();
3012 return -ENOMEM; 3009 return -ENOMEM;
3010 }
3013 3011
3014 skb->dev = dev; 3012 skb->dev = dev;
3015 3013
@@ -3034,8 +3032,9 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
3034 nullfunc->qos_ctrl = cpu_to_le16(7); 3032 nullfunc->qos_ctrl = cpu_to_le16(7);
3035 3033
3036 local_bh_disable(); 3034 local_bh_disable();
3037 ieee80211_xmit(sdata, skb); 3035 ieee80211_xmit(sdata, skb, band);
3038 local_bh_enable(); 3036 local_bh_enable();
3037 rcu_read_unlock();
3039 3038
3040 *cookie = (unsigned long) skb; 3039 *cookie = (unsigned long) skb;
3041 return 0; 3040 return 0;
@@ -3045,10 +3044,19 @@ static struct ieee80211_channel *
3045ieee80211_cfg_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, 3044ieee80211_cfg_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
3046 enum nl80211_channel_type *type) 3045 enum nl80211_channel_type *type)
3047{ 3046{
3048 struct ieee80211_local *local = wiphy_priv(wiphy); 3047 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
3048 struct ieee80211_chanctx_conf *chanctx_conf;
3049 struct ieee80211_channel *chan = NULL;
3050
3051 rcu_read_lock();
3052 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
3053 if (chanctx_conf) {
3054 *type = chanctx_conf->channel_type;
3055 chan = chanctx_conf->channel;
3056 }
3057 rcu_read_unlock();
3049 3058
3050 *type = local->_oper_channel_type; 3059 return chan;
3051 return local->oper_channel;
3052} 3060}
3053 3061
3054#ifdef CONFIG_PM 3062#ifdef CONFIG_PM