Commit 3aede78a authored by Simon Wunderlich's avatar Simon Wunderlich Committed by Johannes Berg
Browse files

mac80211: change IBSS channel state to chandef



This should make some parts cleaner and is also required for handling
5/10 MHz properly.
Signed-off-by: default avatarSimon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: default avatarMathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 0418a445
...@@ -81,7 +81,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -81,7 +81,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
cfg80211_chandef_create(&chandef, chan, ifibss->channel_type); chandef = ifibss->chandef;
if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) { if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) {
chandef.width = NL80211_CHAN_WIDTH_20; chandef.width = NL80211_CHAN_WIDTH_20;
chandef.center_freq1 = chan->center_freq; chandef.center_freq1 = chan->center_freq;
...@@ -516,7 +516,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -516,7 +516,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
set_sta_flag(sta, WLAN_STA_WME); set_sta_flag(sta, WLAN_STA_WME);
if (sta && elems->ht_operation && elems->ht_cap_elem && if (sta && elems->ht_operation && elems->ht_cap_elem &&
sdata->u.ibss.channel_type != NL80211_CHAN_NO_HT) { sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_5 &&
sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_10) {
/* we both use HT */ /* we both use HT */
struct ieee80211_ht_cap htcap_ie; struct ieee80211_ht_cap htcap_ie;
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef;
...@@ -531,8 +533,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -531,8 +533,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
* fall back to HT20 if we don't use or use * fall back to HT20 if we don't use or use
* the other extension channel * the other extension channel
*/ */
if (cfg80211_get_chandef_type(&chandef) != if (chandef.center_freq1 !=
sdata->u.ibss.channel_type) sdata->u.ibss.chandef.center_freq1)
htcap_ie.cap_info &= htcap_ie.cap_info &=
cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40); cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);
...@@ -571,7 +573,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -571,7 +573,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
/* different channel */ /* different channel */
if (sdata->u.ibss.fixed_channel && if (sdata->u.ibss.fixed_channel &&
sdata->u.ibss.channel != cbss->channel) sdata->u.ibss.chandef.chan != cbss->channel)
goto put_bss; goto put_bss;
/* different SSID */ /* different SSID */
...@@ -761,7 +763,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) ...@@ -761,7 +763,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
sdata->drop_unencrypted = 0; sdata->drop_unencrypted = 0;
__ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
ifibss->channel, ifibss->basic_rates, ifibss->chandef.chan, ifibss->basic_rates,
capability, 0, true); capability, 0, true);
} }
...@@ -793,7 +795,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) ...@@ -793,7 +795,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
if (ifibss->fixed_bssid) if (ifibss->fixed_bssid)
bssid = ifibss->bssid; bssid = ifibss->bssid;
if (ifibss->fixed_channel) if (ifibss->fixed_channel)
chan = ifibss->channel; chan = ifibss->chandef.chan;
if (!is_zero_ether_addr(ifibss->bssid)) if (!is_zero_ether_addr(ifibss->bssid))
bssid = ifibss->bssid; bssid = ifibss->bssid;
cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid, cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
...@@ -1060,9 +1062,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, ...@@ -1060,9 +1062,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
sdata->vif.bss_conf.beacon_int = params->beacon_interval; sdata->vif.bss_conf.beacon_int = params->beacon_interval;
sdata->u.ibss.channel = params->chandef.chan; sdata->u.ibss.chandef = params->chandef;
sdata->u.ibss.channel_type =
cfg80211_get_chandef_type(&params->chandef);
sdata->u.ibss.fixed_channel = params->channel_fixed; sdata->u.ibss.fixed_channel = params->channel_fixed;
if (params->ie) { if (params->ie) {
...@@ -1121,7 +1121,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) ...@@ -1121,7 +1121,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
if (ifibss->privacy) if (ifibss->privacy)
capability |= WLAN_CAPABILITY_PRIVACY; capability |= WLAN_CAPABILITY_PRIVACY;
cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->channel, cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->chandef.chan,
ifibss->bssid, ifibss->ssid, ifibss->bssid, ifibss->ssid,
ifibss->ssid_len, WLAN_CAPABILITY_IBSS | ifibss->ssid_len, WLAN_CAPABILITY_IBSS |
WLAN_CAPABILITY_PRIVACY, WLAN_CAPABILITY_PRIVACY,
......
...@@ -504,8 +504,7 @@ struct ieee80211_if_ibss { ...@@ -504,8 +504,7 @@ struct ieee80211_if_ibss {
u8 ssid[IEEE80211_MAX_SSID_LEN]; u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len, ie_len; u8 ssid_len, ie_len;
u8 *ie; u8 *ie;
struct ieee80211_channel *channel; struct cfg80211_chan_def chandef;
enum nl80211_channel_type channel_type;
unsigned long ibss_join_req; unsigned long ibss_join_req;
/* probe response/beacon for IBSS */ /* probe response/beacon for IBSS */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment