diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2014-02-18 10:07:53 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-04-09 04:55:45 -0400 |
commit | 71965c1d04b2b48ab7c56395bd1f996a56aaa592 (patch) | |
tree | d3d3c158bb8508b7f274d52b2127512d67bfbd5a /net | |
parent | 73de86a38962b18edad3205c2358599dd9c83e9f (diff) |
cfg80211/mac80211: move combination check to mac80211 for ibss
Now that mac80211 can check the interface combinations itself, move
the combinations check from cfg80211 to mac80211 when joining an IBSS.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ibss.c | 32 | ||||
-rw-r--r-- | net/wireless/ibss.c | 28 |
2 files changed, 29 insertions, 31 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 1759bd661e25..ff4d4155a84d 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -1639,7 +1639,33 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1639 | u32 changed = 0; | 1639 | u32 changed = 0; |
1640 | u32 rate_flags; | 1640 | u32 rate_flags; |
1641 | struct ieee80211_supported_band *sband; | 1641 | struct ieee80211_supported_band *sband; |
1642 | enum ieee80211_chanctx_mode chanmode; | ||
1643 | struct ieee80211_local *local = sdata->local; | ||
1644 | int radar_detect_width = 0; | ||
1642 | int i; | 1645 | int i; |
1646 | int ret; | ||
1647 | |||
1648 | ret = cfg80211_chandef_dfs_required(local->hw.wiphy, | ||
1649 | ¶ms->chandef, | ||
1650 | sdata->wdev.iftype); | ||
1651 | if (ret < 0) | ||
1652 | return ret; | ||
1653 | |||
1654 | if (ret > 0) { | ||
1655 | if (!params->userspace_handles_dfs) | ||
1656 | return -EINVAL; | ||
1657 | radar_detect_width = BIT(params->chandef.width); | ||
1658 | } | ||
1659 | |||
1660 | chanmode = (params->channel_fixed && !ret) ? | ||
1661 | IEEE80211_CHANCTX_SHARED : IEEE80211_CHANCTX_EXCLUSIVE; | ||
1662 | |||
1663 | mutex_lock(&local->chanctx_mtx); | ||
1664 | ret = ieee80211_check_combinations(sdata, ¶ms->chandef, chanmode, | ||
1665 | radar_detect_width); | ||
1666 | mutex_unlock(&local->chanctx_mtx); | ||
1667 | if (ret < 0) | ||
1668 | return ret; | ||
1643 | 1669 | ||
1644 | if (params->bssid) { | 1670 | if (params->bssid) { |
1645 | memcpy(sdata->u.ibss.bssid, params->bssid, ETH_ALEN); | 1671 | memcpy(sdata->u.ibss.bssid, params->bssid, ETH_ALEN); |
@@ -1654,7 +1680,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1654 | 1680 | ||
1655 | /* fix basic_rates if channel does not support these rates */ | 1681 | /* fix basic_rates if channel does not support these rates */ |
1656 | rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef); | 1682 | rate_flags = ieee80211_chandef_rate_flags(¶ms->chandef); |
1657 | sband = sdata->local->hw.wiphy->bands[params->chandef.chan->band]; | 1683 | sband = local->hw.wiphy->bands[params->chandef.chan->band]; |
1658 | for (i = 0; i < sband->n_bitrates; i++) { | 1684 | for (i = 0; i < sband->n_bitrates; i++) { |
1659 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) | 1685 | if ((rate_flags & sband->bitrates[i].flags) != rate_flags) |
1660 | sdata->u.ibss.basic_rates &= ~BIT(i); | 1686 | sdata->u.ibss.basic_rates &= ~BIT(i); |
@@ -1703,9 +1729,9 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1703 | ieee80211_bss_info_change_notify(sdata, changed); | 1729 | ieee80211_bss_info_change_notify(sdata, changed); |
1704 | 1730 | ||
1705 | sdata->smps_mode = IEEE80211_SMPS_OFF; | 1731 | sdata->smps_mode = IEEE80211_SMPS_OFF; |
1706 | sdata->needed_rx_chains = sdata->local->rx_chains; | 1732 | sdata->needed_rx_chains = local->rx_chains; |
1707 | 1733 | ||
1708 | ieee80211_queue_work(&sdata->local->hw, &sdata->work); | 1734 | ieee80211_queue_work(&local->hw, &sdata->work); |
1709 | 1735 | ||
1710 | return 0; | 1736 | return 0; |
1711 | } | 1737 | } |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index faf4961d47d8..071e99c75e82 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -88,8 +88,6 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
88 | struct cfg80211_cached_keys *connkeys) | 88 | struct cfg80211_cached_keys *connkeys) |
89 | { | 89 | { |
90 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 90 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
91 | struct ieee80211_channel *check_chan; | ||
92 | u8 radar_detect_width = 0; | ||
93 | int err; | 91 | int err; |
94 | 92 | ||
95 | ASSERT_WDEV_LOCK(wdev); | 93 | ASSERT_WDEV_LOCK(wdev); |
@@ -126,32 +124,6 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, | |||
126 | #ifdef CONFIG_CFG80211_WEXT | 124 | #ifdef CONFIG_CFG80211_WEXT |
127 | wdev->wext.ibss.chandef = params->chandef; | 125 | wdev->wext.ibss.chandef = params->chandef; |
128 | #endif | 126 | #endif |
129 | check_chan = params->chandef.chan; | ||
130 | if (params->userspace_handles_dfs) { | ||
131 | /* Check for radar even if the current channel is not | ||
132 | * a radar channel - it might decide to change to DFS | ||
133 | * channel later. | ||
134 | */ | ||
135 | radar_detect_width = BIT(params->chandef.width); | ||
136 | } | ||
137 | |||
138 | /* TODO: We need to check the combinations at this point, we | ||
139 | * probably must move this call down to join_ibss() in | ||
140 | * mac80211. | ||
141 | */ | ||
142 | err = cfg80211_can_use_iftype_chan(rdev, wdev, wdev->iftype, | ||
143 | check_chan, | ||
144 | (params->channel_fixed && | ||
145 | !radar_detect_width) | ||
146 | ? CHAN_MODE_SHARED | ||
147 | : CHAN_MODE_EXCLUSIVE, | ||
148 | radar_detect_width); | ||
149 | |||
150 | if (err) { | ||
151 | wdev->connect_keys = NULL; | ||
152 | return err; | ||
153 | } | ||
154 | |||
155 | err = rdev_join_ibss(rdev, dev, params); | 127 | err = rdev_join_ibss(rdev, dev, params); |
156 | if (err) { | 128 | if (err) { |
157 | wdev->connect_keys = NULL; | 129 | wdev->connect_keys = NULL; |