aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2013-04-10 14:09:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-04-10 14:09:54 -0400
commit655d8e2328a6ef6b6b514609a4c1e33508d3a1da (patch)
tree144b686bf3fd6512a55987da2d911f739646ce02
parent6fe5468f452c0c40348ebd4e737758a842286ca8 (diff)
parentddc4db2e3d5393ede7a9222bb3b7522a603a4678 (diff)
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
Conflicts: drivers/net/wireless/ath/carl9170/debug.c drivers/net/wireless/ath/carl9170/main.c net/mac80211/ieee80211_i.h
-rw-r--r--drivers/net/wireless/adm8211.c3
-rw-r--r--drivers/net/wireless/at76c50x-usb.c4
-rw-r--r--drivers/net/wireless/ath/ar5523/ar5523.c14
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c2
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c16
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/link.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c6
-rw-r--r--drivers/net/wireless/ath/carl9170/debug.c4
-rw-r--r--drivers/net/wireless/ath/carl9170/mac.c8
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c9
-rw-r--r--drivers/net/wireless/ath/carl9170/phy.c4
-rw-r--r--drivers/net/wireless/b43/b43.h2
-rw-r--r--drivers/net/wireless/b43/main.c8
-rw-r--r--drivers/net/wireless/b43/phy_ht.c5
-rw-r--r--drivers/net/wireless/b43/phy_lcn.c5
-rw-r--r--drivers/net/wireless/b43/phy_n.c5
-rw-r--r--drivers/net/wireless/b43legacy/main.c9
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/channel.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c6
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c4
-rw-r--r--drivers/net/wireless/iwlegacy/3945-rs.c2
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c2
-rw-r--r--drivers/net/wireless/iwlegacy/common.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c9
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c12
-rw-r--r--drivers/net/wireless/libertas_tf/main.c8
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c45
-rw-r--r--drivers/net/wireless/mwl8k.c36
-rw-r--r--drivers/net/wireless/p54/fwio.c4
-rw-r--r--drivers/net/wireless/p54/main.c4
-rw-r--r--drivers/net/wireless/p54/txrx.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c10
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/grf5101.c3
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/max2820.c2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/rtl8225.c3
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/sa2400.c3
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/dev.c4
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187/rtl8225.c3
-rw-r--r--drivers/net/wireless/rtlwifi/base.c8
-rw-r--r--drivers/net/wireless/rtlwifi/core.c6
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/trx.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.c8
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/trx.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/trx.c4
-rw-r--r--drivers/net/wireless/ti/wl1251/main.c5
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c4
-rw-r--r--include/linux/ieee80211.h30
-rw-r--r--include/net/cfg80211.h4
-rw-r--r--include/net/mac80211.h37
-rw-r--r--net/mac80211/cfg.c42
-rw-r--r--net/mac80211/chan.c11
-rw-r--r--net/mac80211/debugfs_netdev.c11
-rw-r--r--net/mac80211/debugfs_sta.c2
-rw-r--r--net/mac80211/ibss.c140
-rw-r--r--net/mac80211/ieee80211_i.h35
-rw-r--r--net/mac80211/iface.c116
-rw-r--r--net/mac80211/main.c75
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mesh.h3
-rw-r--r--net/mac80211/mesh_hwmp.c26
-rw-r--r--net/mac80211/mesh_pathtbl.c56
-rw-r--r--net/mac80211/mlme.c128
-rw-r--r--net/mac80211/offchannel.c6
-rw-r--r--net/mac80211/pm.c8
-rw-r--r--net/mac80211/scan.c11
-rw-r--r--net/mac80211/trace.h43
-rw-r--r--net/mac80211/tx.c11
-rw-r--r--net/mac80211/util.c53
84 files changed, 677 insertions, 560 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 3d339e04efb7..f9a24e599dee 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -1293,7 +1293,8 @@ static int adm8211_config(struct ieee80211_hw *dev, u32 changed)
1293{ 1293{
1294 struct adm8211_priv *priv = dev->priv; 1294 struct adm8211_priv *priv = dev->priv;
1295 struct ieee80211_conf *conf = &dev->conf; 1295 struct ieee80211_conf *conf = &dev->conf;
1296 int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 1296 int channel =
1297 ieee80211_frequency_to_channel(conf->chandef.chan->center_freq);
1297 1298
1298 if (channel != priv->channel) { 1299 if (channel != priv->channel) {
1299 priv->channel = channel; 1300 priv->channel = channel;
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 5ac5f7ae2721..34c8a33cac06 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -1943,12 +1943,12 @@ static int at76_config(struct ieee80211_hw *hw, u32 changed)
1943 struct at76_priv *priv = hw->priv; 1943 struct at76_priv *priv = hw->priv;
1944 1944
1945 at76_dbg(DBG_MAC80211, "%s(): channel %d", 1945 at76_dbg(DBG_MAC80211, "%s(): channel %d",
1946 __func__, hw->conf.channel->hw_value); 1946 __func__, hw->conf.chandef.chan->hw_value);
1947 at76_dbg_dump(DBG_MAC80211, priv->bssid, ETH_ALEN, "bssid:"); 1947 at76_dbg_dump(DBG_MAC80211, priv->bssid, ETH_ALEN, "bssid:");
1948 1948
1949 mutex_lock(&priv->mtx); 1949 mutex_lock(&priv->mtx);
1950 1950
1951 priv->channel = hw->conf.channel->hw_value; 1951 priv->channel = hw->conf.chandef.chan->hw_value;
1952 1952
1953 if (is_valid_ether_addr(priv->bssid)) 1953 if (is_valid_ether_addr(priv->bssid))
1954 at76_join(priv); 1954 at76_join(priv);
diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index afd1e36d308f..17d7fece35d2 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -457,14 +457,14 @@ static int ar5523_set_chan(struct ar5523 *ar)
457 memset(&reset, 0, sizeof(reset)); 457 memset(&reset, 0, sizeof(reset));
458 reset.flags |= cpu_to_be32(UATH_CHAN_2GHZ); 458 reset.flags |= cpu_to_be32(UATH_CHAN_2GHZ);
459 reset.flags |= cpu_to_be32(UATH_CHAN_OFDM); 459 reset.flags |= cpu_to_be32(UATH_CHAN_OFDM);
460 reset.freq = cpu_to_be32(conf->channel->center_freq); 460 reset.freq = cpu_to_be32(conf->chandef.chan->center_freq);
461 reset.maxrdpower = cpu_to_be32(50); /* XXX */ 461 reset.maxrdpower = cpu_to_be32(50); /* XXX */
462 reset.channelchange = cpu_to_be32(1); 462 reset.channelchange = cpu_to_be32(1);
463 reset.keeprccontent = cpu_to_be32(0); 463 reset.keeprccontent = cpu_to_be32(0);
464 464
465 ar5523_dbg(ar, "set chan flags 0x%x freq %d\n", 465 ar5523_dbg(ar, "set chan flags 0x%x freq %d\n",
466 be32_to_cpu(reset.flags), 466 be32_to_cpu(reset.flags),
467 conf->channel->center_freq); 467 conf->chandef.chan->center_freq);
468 return ar5523_cmd_write(ar, WDCMSG_RESET, &reset, sizeof(reset), 0); 468 return ar5523_cmd_write(ar, WDCMSG_RESET, &reset, sizeof(reset), 0);
469} 469}
470 470
@@ -594,7 +594,7 @@ static void ar5523_data_rx_cb(struct urb *urb)
594 rx_status = IEEE80211_SKB_RXCB(data->skb); 594 rx_status = IEEE80211_SKB_RXCB(data->skb);
595 memset(rx_status, 0, sizeof(*rx_status)); 595 memset(rx_status, 0, sizeof(*rx_status));
596 rx_status->freq = be32_to_cpu(desc->channel); 596 rx_status->freq = be32_to_cpu(desc->channel);
597 rx_status->band = hw->conf.channel->band; 597 rx_status->band = hw->conf.chandef.chan->band;
598 rx_status->signal = -95 + be32_to_cpu(desc->rssi); 598 rx_status->signal = -95 + be32_to_cpu(desc->rssi);
599 599
600 ieee80211_rx_irqsafe(hw, data->skb); 600 ieee80211_rx_irqsafe(hw, data->skb);
@@ -1153,13 +1153,13 @@ static int ar5523_get_wlan_mode(struct ar5523 *ar,
1153 struct ieee80211_sta *sta; 1153 struct ieee80211_sta *sta;
1154 u32 sta_rate_set; 1154 u32 sta_rate_set;
1155 1155
1156 band = ar->hw->wiphy->bands[ar->hw->conf.channel->band]; 1156 band = ar->hw->wiphy->bands[ar->hw->conf.chandef.chan->band];
1157 sta = ieee80211_find_sta(ar->vif, bss_conf->bssid); 1157 sta = ieee80211_find_sta(ar->vif, bss_conf->bssid);
1158 if (!sta) { 1158 if (!sta) {
1159 ar5523_info(ar, "STA not found!\n"); 1159 ar5523_info(ar, "STA not found!\n");
1160 return WLAN_MODE_11b; 1160 return WLAN_MODE_11b;
1161 } 1161 }
1162 sta_rate_set = sta->supp_rates[ar->hw->conf.channel->band]; 1162 sta_rate_set = sta->supp_rates[ar->hw->conf.chandef.chan->band];
1163 1163
1164 for (bit = 0; bit < band->n_bitrates; bit++) { 1164 for (bit = 0; bit < band->n_bitrates; bit++) {
1165 if (sta_rate_set & 1) { 1165 if (sta_rate_set & 1) {
@@ -1197,11 +1197,11 @@ static void ar5523_create_rateset(struct ar5523 *ar,
1197 ar5523_info(ar, "STA not found. Cannot set rates\n"); 1197 ar5523_info(ar, "STA not found. Cannot set rates\n");
1198 sta_rate_set = bss_conf->basic_rates; 1198 sta_rate_set = bss_conf->basic_rates;
1199 } else 1199 } else
1200 sta_rate_set = sta->supp_rates[ar->hw->conf.channel->band]; 1200 sta_rate_set = sta->supp_rates[ar->hw->conf.chandef.chan->band];
1201 1201
1202 ar5523_dbg(ar, "sta rate_set = %08x\n", sta_rate_set); 1202 ar5523_dbg(ar, "sta rate_set = %08x\n", sta_rate_set);
1203 1203
1204 band = ar->hw->wiphy->bands[ar->hw->conf.channel->band]; 1204 band = ar->hw->wiphy->bands[ar->hw->conf.chandef.chan->band];
1205 for (bit = 0; bit < band->n_bitrates; bit++) { 1205 for (bit = 0; bit < band->n_bitrates; bit++) {
1206 BUG_ON(i >= AR5523_MAX_NRATES); 1206 BUG_ON(i >= AR5523_MAX_NRATES);
1207 ar5523_dbg(ar, "Considering rate %d : %d\n", 1207 ar5523_dbg(ar, "Considering rate %d : %d\n",
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 1d264c0f5a9b..9b20d9ee2719 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2639,7 +2639,7 @@ int ath5k_start(struct ieee80211_hw *hw)
2639 * be followed by initialization of the appropriate bits 2639 * be followed by initialization of the appropriate bits
2640 * and then setup of the interrupt mask. 2640 * and then setup of the interrupt mask.
2641 */ 2641 */
2642 ah->curchan = ah->hw->conf.channel; 2642 ah->curchan = ah->hw->conf.chandef.chan;
2643 ah->imask = AR5K_INT_RXOK 2643 ah->imask = AR5K_INT_RXOK
2644 | AR5K_INT_RXERR 2644 | AR5K_INT_RXERR
2645 | AR5K_INT_RXEOL 2645 | AR5K_INT_RXEOL
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index 4264341533ea..06f86f435711 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -202,7 +202,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
202 mutex_lock(&ah->lock); 202 mutex_lock(&ah->lock);
203 203
204 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 204 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
205 ret = ath5k_chan_set(ah, conf->channel); 205 ret = ath5k_chan_set(ah, conf->chandef.chan);
206 if (ret < 0) 206 if (ret < 0)
207 goto unlock; 207 goto unlock;
208 } 208 }
@@ -678,7 +678,7 @@ ath5k_get_survey(struct ieee80211_hw *hw, int idx, struct survey_info *survey)
678 678
679 memcpy(survey, &ah->survey, sizeof(*survey)); 679 memcpy(survey, &ah->survey, sizeof(*survey));
680 680
681 survey->channel = conf->channel; 681 survey->channel = conf->chandef.chan;
682 survey->noise = ah->ah_noise_floor; 682 survey->noise = ah->ah_noise_floor;
683 survey->filled = SURVEY_INFO_NOISE_DBM | 683 survey->filled = SURVEY_INFO_NOISE_DBM |
684 SURVEY_INFO_CHANNEL_TIME | 684 SURVEY_INFO_CHANNEL_TIME |
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 5f05c26d1ec4..2ff570f7f8ff 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -79,7 +79,7 @@ static void ath9k_beacon_setup(struct ath_softc *sc, struct ieee80211_vif *vif,
79 u8 chainmask = ah->txchainmask; 79 u8 chainmask = ah->txchainmask;
80 u8 rate = 0; 80 u8 rate = 0;
81 81
82 sband = &sc->sbands[common->hw->conf.channel->band]; 82 sband = &sc->sbands[common->hw->conf.chandef.chan->band];
83 rate = sband->bitrates[rateidx].hw_value; 83 rate = sband->bitrates[rateidx].hw_value;
84 if (vif->bss_conf.use_short_preamble) 84 if (vif->bss_conf.use_short_preamble)
85 rate |= sband->bitrates[rateidx].hw_value_short; 85 rate |= sband->bitrates[rateidx].hw_value_short;
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 7bdd726c7a8f..7304e7585009 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -208,7 +208,7 @@ bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
208 return true; 208 return true;
209 209
210 ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n", 210 ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n",
211 currCal->calData->calType, conf->channel->center_freq); 211 currCal->calData->calType, conf->chandef.chan->center_freq);
212 212
213 ah->caldata->CalValid &= ~currCal->calData->calType; 213 ah->caldata->CalValid &= ~currCal->calData->calType;
214 currCal->calState = CAL_WAITING; 214 currCal->calState = CAL_WAITING;
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 905f1b313961..6c78fe7ca54d 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -133,13 +133,14 @@ EXPORT_SYMBOL(ath9k_cmn_update_ichannel);
133struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, 133struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
134 struct ath_hw *ah) 134 struct ath_hw *ah)
135{ 135{
136 struct ieee80211_channel *curchan = hw->conf.channel; 136 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
137 struct ath9k_channel *channel; 137 struct ath9k_channel *channel;
138 u8 chan_idx; 138 u8 chan_idx;
139 139
140 chan_idx = curchan->hw_value; 140 chan_idx = curchan->hw_value;
141 channel = &ah->channels[chan_idx]; 141 channel = &ah->channels[chan_idx];
142 ath9k_cmn_update_ichannel(channel, curchan, hw->conf.channel_type); 142 ath9k_cmn_update_ichannel(channel, curchan,
143 cfg80211_get_chandef_type(&hw->conf.chandef));
143 144
144 return channel; 145 return channel;
145} 146}
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index a8016d70088a..098e3545e512 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -190,7 +190,7 @@ void ath9k_htc_reset(struct ath9k_htc_priv *priv)
190{ 190{
191 struct ath_hw *ah = priv->ah; 191 struct ath_hw *ah = priv->ah;
192 struct ath_common *common = ath9k_hw_common(ah); 192 struct ath_common *common = ath9k_hw_common(ah);
193 struct ieee80211_channel *channel = priv->hw->conf.channel; 193 struct ieee80211_channel *channel = priv->hw->conf.chandef.chan;
194 struct ath9k_hw_cal_data *caldata = NULL; 194 struct ath9k_hw_cal_data *caldata = NULL;
195 enum htc_phymode mode; 195 enum htc_phymode mode;
196 __be16 htc_mode; 196 __be16 htc_mode;
@@ -250,7 +250,7 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
250 struct ath_common *common = ath9k_hw_common(ah); 250 struct ath_common *common = ath9k_hw_common(ah);
251 struct ieee80211_conf *conf = &common->hw->conf; 251 struct ieee80211_conf *conf = &common->hw->conf;
252 bool fastcc; 252 bool fastcc;
253 struct ieee80211_channel *channel = hw->conf.channel; 253 struct ieee80211_channel *channel = hw->conf.chandef.chan;
254 struct ath9k_hw_cal_data *caldata = NULL; 254 struct ath9k_hw_cal_data *caldata = NULL;
255 enum htc_phymode mode; 255 enum htc_phymode mode;
256 __be16 htc_mode; 256 __be16 htc_mode;
@@ -602,7 +602,7 @@ static void ath9k_htc_setup_rate(struct ath9k_htc_priv *priv,
602 u32 caps = 0; 602 u32 caps = 0;
603 int i, j; 603 int i, j;
604 604
605 sband = priv->hw->wiphy->bands[priv->hw->conf.channel->band]; 605 sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band];
606 606
607 for (i = 0, j = 0; i < sband->n_bitrates; i++) { 607 for (i = 0, j = 0; i < sband->n_bitrates; i++) {
608 if (sta->supp_rates[sband->band] & BIT(i)) { 608 if (sta->supp_rates[sband->band] & BIT(i)) {
@@ -904,7 +904,7 @@ static int ath9k_htc_start(struct ieee80211_hw *hw)
904 struct ath9k_htc_priv *priv = hw->priv; 904 struct ath9k_htc_priv *priv = hw->priv;
905 struct ath_hw *ah = priv->ah; 905 struct ath_hw *ah = priv->ah;
906 struct ath_common *common = ath9k_hw_common(ah); 906 struct ath_common *common = ath9k_hw_common(ah);
907 struct ieee80211_channel *curchan = hw->conf.channel; 907 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
908 struct ath9k_channel *init_channel; 908 struct ath9k_channel *init_channel;
909 int ret = 0; 909 int ret = 0;
910 enum htc_phymode mode; 910 enum htc_phymode mode;
@@ -1193,15 +1193,17 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1193 } 1193 }
1194 1194
1195 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) { 1195 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) {
1196 struct ieee80211_channel *curchan = hw->conf.channel; 1196 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
1197 enum nl80211_channel_type channel_type =
1198 cfg80211_get_chandef_type(&hw->conf.chandef);
1197 int pos = curchan->hw_value; 1199 int pos = curchan->hw_value;
1198 1200
1199 ath_dbg(common, CONFIG, "Set channel: %d MHz\n", 1201 ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
1200 curchan->center_freq); 1202 curchan->center_freq);
1201 1203
1202 ath9k_cmn_update_ichannel(&priv->ah->channels[pos], 1204 ath9k_cmn_update_ichannel(&priv->ah->channels[pos],
1203 hw->conf.channel, 1205 hw->conf.chandef.chan,
1204 hw->conf.channel_type); 1206 channel_type);
1205 1207
1206 if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) { 1208 if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
1207 ath_err(common, "Unable to set channel\n"); 1209 ath_err(common, "Unable to set channel\n");
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index bd8251c1c749..2774dd13c786 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -490,7 +490,7 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv,
490 if (txs->ts_flags & ATH9K_HTC_TXSTAT_SGI) 490 if (txs->ts_flags & ATH9K_HTC_TXSTAT_SGI)
491 rate->flags |= IEEE80211_TX_RC_SHORT_GI; 491 rate->flags |= IEEE80211_TX_RC_SHORT_GI;
492 } else { 492 } else {
493 if (cur_conf->channel->band == IEEE80211_BAND_5GHZ) 493 if (cur_conf->chandef.chan->band == IEEE80211_BAND_5GHZ)
494 rate->idx += 4; /* No CCK rates */ 494 rate->idx += 4; /* No CCK rates */
495 } 495 }
496 496
@@ -939,7 +939,7 @@ static void ath9k_process_rate(struct ieee80211_hw *hw,
939 return; 939 return;
940 } 940 }
941 941
942 band = hw->conf.channel->band; 942 band = hw->conf.chandef.chan->band;
943 sband = hw->wiphy->bands[band]; 943 sband = hw->wiphy->bands[band];
944 944
945 for (i = 0; i < sband->n_bitrates; i++) { 945 for (i = 0; i < sband->n_bitrates; i++) {
@@ -1082,8 +1082,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
1082 } 1082 }
1083 1083
1084 rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp); 1084 rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
1085 rx_status->band = hw->conf.channel->band; 1085 rx_status->band = hw->conf.chandef.chan->band;
1086 rx_status->freq = hw->conf.channel->center_freq; 1086 rx_status->freq = hw->conf.chandef.chan->center_freq;
1087 rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR; 1087 rx_status->signal = rxbuf->rxstatus.rs_rssi + ATH_DEFAULT_NOISE_FLOOR;
1088 rx_status->antenna = rxbuf->rxstatus.rs_antenna; 1088 rx_status->antenna = rxbuf->rxstatus.rs_antenna;
1089 rx_status->flag |= RX_FLAG_MACTIME_END; 1089 rx_status->flag |= RX_FLAG_MACTIME_END;
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 3473a797651a..8a980a4bf4ec 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -139,7 +139,7 @@ static void ath9k_hw_set_clockrate(struct ath_hw *ah)
139 clockrate = 117; 139 clockrate = 117;
140 else if (!ah->curchan) /* should really check for CCK instead */ 140 else if (!ah->curchan) /* should really check for CCK instead */
141 clockrate = ATH9K_CLOCK_RATE_CCK; 141 clockrate = ATH9K_CLOCK_RATE_CCK;
142 else if (conf->channel->band == IEEE80211_BAND_2GHZ) 142 else if (conf->chandef.chan->band == IEEE80211_BAND_2GHZ)
143 clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; 143 clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM;
144 else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK) 144 else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)
145 clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM; 145 clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM;
@@ -1110,7 +1110,8 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
1110 * BA frames in some implementations, but it has been found to fix ACK 1110 * BA frames in some implementations, but it has been found to fix ACK
1111 * timeout issues in other cases as well. 1111 * timeout issues in other cases as well.
1112 */ 1112 */
1113 if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ && 1113 if (conf->chandef.chan &&
1114 conf->chandef.chan->band == IEEE80211_BAND_2GHZ &&
1114 !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) { 1115 !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) {
1115 acktimeout += 64 - sifstime - ah->slottime; 1116 acktimeout += 64 - sifstime - ah->slottime;
1116 ctstimeout += 48 - sifstime - ah->slottime; 1117 ctstimeout += 48 - sifstime - ah->slottime;
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
index 7fdac6c7b3ea..849259b07370 100644
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -214,7 +214,7 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int
214 txctl.txq = sc->tx.txq_map[IEEE80211_AC_BE]; 214 txctl.txq = sc->tx.txq_map[IEEE80211_AC_BE];
215 215
216 memset(tx_info, 0, sizeof(*tx_info)); 216 memset(tx_info, 0, sizeof(*tx_info));
217 tx_info->band = hw->conf.channel->band; 217 tx_info->band = hw->conf.chandef.chan->band;
218 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK; 218 tx_info->flags |= IEEE80211_TX_CTL_NO_ACK;
219 tx_info->control.rates[0].idx = 0; 219 tx_info->control.rates[0].idx = 0;
220 tx_info->control.rates[0].count = 1; 220 tx_info->control.rates[0].count = 1;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 1bf52c88004a..a383483d0387 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -589,7 +589,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
589 struct ath_softc *sc = hw->priv; 589 struct ath_softc *sc = hw->priv;
590 struct ath_hw *ah = sc->sc_ah; 590 struct ath_hw *ah = sc->sc_ah;
591 struct ath_common *common = ath9k_hw_common(ah); 591 struct ath_common *common = ath9k_hw_common(ah);
592 struct ieee80211_channel *curchan = hw->conf.channel; 592 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
593 struct ath9k_channel *init_channel; 593 struct ath9k_channel *init_channel;
594 int r; 594 int r;
595 595
@@ -1188,7 +1188,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1188 } 1188 }
1189 1189
1190 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { 1190 if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
1191 struct ieee80211_channel *curchan = hw->conf.channel; 1191 struct ieee80211_channel *curchan = hw->conf.chandef.chan;
1192 enum nl80211_channel_type channel_type =
1193 cfg80211_get_chandef_type(&conf->chandef);
1192 int pos = curchan->hw_value; 1194 int pos = curchan->hw_value;
1193 int old_pos = -1; 1195 int old_pos = -1;
1194 unsigned long flags; 1196 unsigned long flags;
@@ -1197,7 +1199,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1197 old_pos = ah->curchan - &ah->channels[0]; 1199 old_pos = ah->curchan - &ah->channels[0];
1198 1200
1199 ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n", 1201 ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n",
1200 curchan->center_freq, conf->channel_type); 1202 curchan->center_freq, channel_type);
1201 1203
1202 /* update survey stats for the old channel before switching */ 1204 /* update survey stats for the old channel before switching */
1203 spin_lock_irqsave(&common->cc_lock, flags); 1205 spin_lock_irqsave(&common->cc_lock, flags);
@@ -1212,7 +1214,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1212 ath9k_hw_getnf(ah, ah->curchan); 1214 ath9k_hw_getnf(ah, ah->curchan);
1213 1215
1214 ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos], 1216 ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
1215 curchan, conf->channel_type); 1217 curchan, channel_type);
1216 1218
1217 /* 1219 /*
1218 * If the operating channel changes, change the survey in-use flags 1220 * If the operating channel changes, change the survey in-use flags
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 96ac433ba7f6..aa4d368d8d3d 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -814,7 +814,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
814 * So, set fourth rate in series to be same as third one for 814 * So, set fourth rate in series to be same as third one for
815 * above conditions. 815 * above conditions.
816 */ 816 */
817 if ((sc->hw->conf.channel->band == IEEE80211_BAND_2GHZ) && 817 if ((sc->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) &&
818 (conf_is_ht(&sc->hw->conf))) { 818 (conf_is_ht(&sc->hw->conf))) {
819 u8 dot11rate = rate_table->info[rix].dot11rate; 819 u8 dot11rate = rate_table->info[rix].dot11rate;
820 u8 phy = rate_table->info[rix].phy; 820 u8 phy = rate_table->info[rix].phy;
@@ -1328,7 +1328,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1328 1328
1329 ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG, 1329 ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG,
1330 "Operating HT Bandwidth changed to: %d\n", 1330 "Operating HT Bandwidth changed to: %d\n",
1331 sc->hw->conf.channel_type); 1331 cfg80211_get_chandef_type(&sc->hw->conf.chandef));
1332 } 1332 }
1333} 1333}
1334 1334
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index ee7ca5aecdb0..e656e4891568 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -863,7 +863,7 @@ static int ath9k_process_rate(struct ath_common *common,
863 unsigned int i = 0; 863 unsigned int i = 0;
864 struct ath_softc __maybe_unused *sc = common->priv; 864 struct ath_softc __maybe_unused *sc = common->priv;
865 865
866 band = hw->conf.channel->band; 866 band = hw->conf.chandef.chan->band;
867 sband = hw->wiphy->bands[band]; 867 sband = hw->wiphy->bands[band];
868 868
869 if (rx_stats->rs_rate & 0x80) { 869 if (rx_stats->rs_rate & 0x80) {
@@ -958,8 +958,8 @@ static int ath9k_rx_skb_preprocess(struct ath_common *common,
958 if (ath9k_process_rate(common, hw, rx_stats, rx_status)) 958 if (ath9k_process_rate(common, hw, rx_stats, rx_status))
959 return -EINVAL; 959 return -EINVAL;
960 960
961 rx_status->band = hw->conf.channel->band; 961 rx_status->band = hw->conf.chandef.chan->band;
962 rx_status->freq = hw->conf.channel->center_freq; 962 rx_status->freq = hw->conf.chandef.chan->center_freq;
963 rx_status->signal = ah->noise + rx_stats->rs_rssi; 963 rx_status->signal = ah->noise + rx_stats->rs_rssi;
964 rx_status->antenna = rx_stats->rs_antenna; 964 rx_status->antenna = rx_stats->rs_antenna;
965 rx_status->flag |= RX_FLAG_MACTIME_END; 965 rx_status->flag |= RX_FLAG_MACTIME_END;
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c
index 40109be81f7c..3d70cd277fd7 100644
--- a/drivers/net/wireless/ath/carl9170/debug.c
+++ b/drivers/net/wireless/ath/carl9170/debug.c
@@ -654,8 +654,8 @@ static ssize_t carl9170_debugfs_bug_write(struct ar9170 *ar, const char *buf,
654 goto out; 654 goto out;
655 655
656 case 'P': 656 case 'P':
657 err = carl9170_set_channel(ar, ar->hw->conf.channel, 657 err = carl9170_set_channel(ar, ar->hw->conf.chandef.chan,
658 ar->hw->conf.channel_type); 658 cfg80211_get_chandef_type(&ar->hw->conf.chandef));
659 if (err < 0) 659 if (err < 0)
660 count = err; 660 count = err;
661 661
diff --git a/drivers/net/wireless/ath/carl9170/mac.c b/drivers/net/wireless/ath/carl9170/mac.c
index 24d75ab94f0d..a2f005703c04 100644
--- a/drivers/net/wireless/ath/carl9170/mac.c
+++ b/drivers/net/wireless/ath/carl9170/mac.c
@@ -48,7 +48,7 @@ int carl9170_set_dyn_sifs_ack(struct ar9170 *ar)
48 if (conf_is_ht40(&ar->hw->conf)) 48 if (conf_is_ht40(&ar->hw->conf))
49 val = 0x010a; 49 val = 0x010a;
50 else { 50 else {
51 if (ar->hw->conf.channel->band == IEEE80211_BAND_2GHZ) 51 if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
52 val = 0x105; 52 val = 0x105;
53 else 53 else
54 val = 0x104; 54 val = 0x104;
@@ -66,7 +66,7 @@ int carl9170_set_rts_cts_rate(struct ar9170 *ar)
66 rts_rate = 0x1da; 66 rts_rate = 0x1da;
67 cts_rate = 0x10a; 67 cts_rate = 0x10a;
68 } else { 68 } else {
69 if (ar->hw->conf.channel->band == IEEE80211_BAND_2GHZ) { 69 if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) {
70 /* 11 mbit CCK */ 70 /* 11 mbit CCK */
71 rts_rate = 033; 71 rts_rate = 033;
72 cts_rate = 003; 72 cts_rate = 003;
@@ -93,7 +93,7 @@ int carl9170_set_slot_time(struct ar9170 *ar)
93 return 0; 93 return 0;
94 } 94 }
95 95
96 if ((ar->hw->conf.channel->band == IEEE80211_BAND_5GHZ) || 96 if ((ar->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ) ||
97 vif->bss_conf.use_short_slot) 97 vif->bss_conf.use_short_slot)
98 slottime = 9; 98 slottime = 9;
99 99
@@ -120,7 +120,7 @@ int carl9170_set_mac_rates(struct ar9170 *ar)
120 basic |= (vif->bss_conf.basic_rates & 0xff0) << 4; 120 basic |= (vif->bss_conf.basic_rates & 0xff0) << 4;
121 rcu_read_unlock(); 121 rcu_read_unlock();
122 122
123 if (ar->hw->conf.channel->band == IEEE80211_BAND_5GHZ) 123 if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ)
124 mandatory = 0xff00; /* OFDM 6/9/12/18/24/36/48/54 */ 124 mandatory = 0xff00; /* OFDM 6/9/12/18/24/36/48/54 */
125 else 125 else
126 mandatory = 0xff0f; /* OFDM (6/9../54) + CCK (1/2/5.5/11) */ 126 mandatory = 0xff0f; /* OFDM (6/9../54) + CCK (1/2/5.5/11) */
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 699c557bc2c7..e9010a481dfd 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -929,6 +929,9 @@ static int carl9170_op_config(struct ieee80211_hw *hw, u32 changed)
929 } 929 }
930 930
931 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 931 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
932 enum nl80211_channel_type channel_type =
933 cfg80211_get_chandef_type(&hw->conf.chandef);
934
932 /* adjust slot time for 5 GHz */ 935 /* adjust slot time for 5 GHz */
933 err = carl9170_set_slot_time(ar); 936 err = carl9170_set_slot_time(ar);
934 if (err) 937 if (err)
@@ -938,8 +941,8 @@ static int carl9170_op_config(struct ieee80211_hw *hw, u32 changed)
938 if (err) 941 if (err)
939 goto out; 942 goto out;
940 943
941 err = carl9170_set_channel(ar, hw->conf.channel, 944 err = carl9170_set_channel(ar, hw->conf.chandef.chan,
942 hw->conf.channel_type); 945 channel_type);
943 if (err) 946 if (err)
944 goto out; 947 goto out;
945 948
@@ -957,7 +960,7 @@ static int carl9170_op_config(struct ieee80211_hw *hw, u32 changed)
957 } 960 }
958 961
959 if (changed & IEEE80211_CONF_CHANGE_POWER) { 962 if (changed & IEEE80211_CONF_CHANGE_POWER) {
960 err = carl9170_set_mac_tpc(ar, ar->hw->conf.channel); 963 err = carl9170_set_mac_tpc(ar, ar->hw->conf.chandef.chan);
961 if (err) 964 if (err)
962 goto out; 965 goto out;
963 } 966 }
diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c
index 07f82234c860..ab4ee7d39ad3 100644
--- a/drivers/net/wireless/ath/carl9170/phy.c
+++ b/drivers/net/wireless/ath/carl9170/phy.c
@@ -1331,7 +1331,7 @@ static void carl9170_calc_ctl(struct ar9170 *ar, u32 freq, enum carl9170_bw bw)
1331 * CTL_ETSI for 2GHz and CTL_FCC for 5GHz. 1331 * CTL_ETSI for 2GHz and CTL_FCC for 5GHz.
1332 */ 1332 */
1333 ctl_grp = ath_regd_get_band_ctl(&ar->common.regulatory, 1333 ctl_grp = ath_regd_get_band_ctl(&ar->common.regulatory,
1334 ar->hw->conf.channel->band); 1334 ar->hw->conf.chandef.chan->band);
1335 1335
1336 /* ctl group not found - either invalid band (NO_CTL) or ww roaming */ 1336 /* ctl group not found - either invalid band (NO_CTL) or ww roaming */
1337 if (ctl_grp == NO_CTL || ctl_grp == SD_NO_CTL) 1337 if (ctl_grp == NO_CTL || ctl_grp == SD_NO_CTL)
@@ -1341,7 +1341,7 @@ static void carl9170_calc_ctl(struct ar9170 *ar, u32 freq, enum carl9170_bw bw)
1341 /* skip CTL and heavy clip for CTL_MKK and CTL_ETSI */ 1341 /* skip CTL and heavy clip for CTL_MKK and CTL_ETSI */
1342 return; 1342 return;
1343 1343
1344 if (ar->hw->conf.channel->band == IEEE80211_BAND_2GHZ) { 1344 if (ar->hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) {
1345 modes = mode_list_2ghz; 1345 modes = mode_list_2ghz;
1346 nr_modes = ARRAY_SIZE(mode_list_2ghz); 1346 nr_modes = ARRAY_SIZE(mode_list_2ghz);
1347 } else { 1347 } else {
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index f5e840104f4b..7f3d461f7e8d 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -980,7 +980,7 @@ static inline int b43_is_mode(struct b43_wl *wl, int type)
980 */ 980 */
981static inline enum ieee80211_band b43_current_band(struct b43_wl *wl) 981static inline enum ieee80211_band b43_current_band(struct b43_wl *wl)
982{ 982{
983 return wl->hw->conf.channel->band; 983 return wl->hw->conf.chandef.chan->band;
984} 984}
985 985
986static inline int b43_bus_may_powerdown(struct b43_wldev *wldev) 986static inline int b43_bus_may_powerdown(struct b43_wldev *wldev)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 4ac73d2f8605..d377f77d30b5 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3852,7 +3852,7 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
3852 dev = wl->current_dev; 3852 dev = wl->current_dev;
3853 3853
3854 /* Switch the band (if necessary). This might change the active core. */ 3854 /* Switch the band (if necessary). This might change the active core. */
3855 err = b43_switch_band(wl, conf->channel); 3855 err = b43_switch_band(wl, conf->chandef.chan);
3856 if (err) 3856 if (err)
3857 goto out_unlock_mutex; 3857 goto out_unlock_mutex;
3858 3858
@@ -3882,8 +3882,8 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
3882 3882
3883 /* Switch to the requested channel. 3883 /* Switch to the requested channel.
3884 * The firmware takes care of races with the TX handler. */ 3884 * The firmware takes care of races with the TX handler. */
3885 if (conf->channel->hw_value != phy->channel) 3885 if (conf->chandef.chan->hw_value != phy->channel)
3886 b43_switch_channel(dev, conf->channel->hw_value); 3886 b43_switch_channel(dev, conf->chandef.chan->hw_value);
3887 3887
3888 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR); 3888 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR);
3889 3889
@@ -5006,7 +5006,7 @@ static int b43_op_get_survey(struct ieee80211_hw *hw, int idx,
5006 if (idx != 0) 5006 if (idx != 0)
5007 return -ENOENT; 5007 return -ENOENT;
5008 5008
5009 survey->channel = conf->channel; 5009 survey->channel = conf->chandef.chan;
5010 survey->filled = SURVEY_INFO_NOISE_DBM; 5010 survey->filled = SURVEY_INFO_NOISE_DBM;
5011 survey->noise = dev->stats.link_noise; 5011 survey->noise = dev->stats.link_noise;
5012 5012
diff --git a/drivers/net/wireless/b43/phy_ht.c b/drivers/net/wireless/b43/phy_ht.c
index b8667706fc27..83239fd87040 100644
--- a/drivers/net/wireless/b43/phy_ht.c
+++ b/drivers/net/wireless/b43/phy_ht.c
@@ -1011,8 +1011,9 @@ static void b43_phy_ht_op_switch_analog(struct b43_wldev *dev, bool on)
1011static int b43_phy_ht_op_switch_channel(struct b43_wldev *dev, 1011static int b43_phy_ht_op_switch_channel(struct b43_wldev *dev,
1012 unsigned int new_channel) 1012 unsigned int new_channel)
1013{ 1013{
1014 struct ieee80211_channel *channel = dev->wl->hw->conf.channel; 1014 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan;
1015 enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type; 1015 enum nl80211_channel_type channel_type =
1016 cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
1016 1017
1017 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 1018 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
1018 if ((new_channel < 1) || (new_channel > 14)) 1019 if ((new_channel < 1) || (new_channel > 14))
diff --git a/drivers/net/wireless/b43/phy_lcn.c b/drivers/net/wireless/b43/phy_lcn.c
index a13e28ef6246..0bafa3b17035 100644
--- a/drivers/net/wireless/b43/phy_lcn.c
+++ b/drivers/net/wireless/b43/phy_lcn.c
@@ -808,8 +808,9 @@ static void b43_phy_lcn_op_switch_analog(struct b43_wldev *dev, bool on)
808static int b43_phy_lcn_op_switch_channel(struct b43_wldev *dev, 808static int b43_phy_lcn_op_switch_channel(struct b43_wldev *dev,
809 unsigned int new_channel) 809 unsigned int new_channel)
810{ 810{
811 struct ieee80211_channel *channel = dev->wl->hw->conf.channel; 811 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan;
812 enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type; 812 enum nl80211_channel_type channel_type =
813 cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
813 814
814 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 815 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
815 if ((new_channel < 1) || (new_channel > 14)) 816 if ((new_channel < 1) || (new_channel > 14))
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index f9339e7ea6af..45d63d70a66b 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -5526,8 +5526,9 @@ static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
5526static int b43_nphy_op_switch_channel(struct b43_wldev *dev, 5526static int b43_nphy_op_switch_channel(struct b43_wldev *dev,
5527 unsigned int new_channel) 5527 unsigned int new_channel)
5528{ 5528{
5529 struct ieee80211_channel *channel = dev->wl->hw->conf.channel; 5529 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan;
5530 enum nl80211_channel_type channel_type = dev->wl->hw->conf.channel_type; 5530 enum nl80211_channel_type channel_type =
5531 cfg80211_get_chandef_type(&dev->wl->hw->conf.chandef);
5531 5532
5532 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 5533 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
5533 if ((new_channel < 1) || (new_channel > 14)) 5534 if ((new_channel < 1) || (new_channel > 14))
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 8c3f70e1a013..572668821862 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2720,7 +2720,7 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
2720 goto out_unlock_mutex; 2720 goto out_unlock_mutex;
2721 2721
2722 /* Switch the PHY mode (if necessary). */ 2722 /* Switch the PHY mode (if necessary). */
2723 switch (conf->channel->band) { 2723 switch (conf->chandef.chan->band) {
2724 case IEEE80211_BAND_2GHZ: 2724 case IEEE80211_BAND_2GHZ:
2725 if (phy->type == B43legacy_PHYTYPE_B) 2725 if (phy->type == B43legacy_PHYTYPE_B)
2726 new_phymode = B43legacy_PHYMODE_B; 2726 new_phymode = B43legacy_PHYMODE_B;
@@ -2748,8 +2748,9 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
2748 2748
2749 /* Switch to the requested channel. 2749 /* Switch to the requested channel.
2750 * The firmware takes care of races with the TX handler. */ 2750 * The firmware takes care of races with the TX handler. */
2751 if (conf->channel->hw_value != phy->channel) 2751 if (conf->chandef.chan->hw_value != phy->channel)
2752 b43legacy_radio_selectchannel(dev, conf->channel->hw_value, 0); 2752 b43legacy_radio_selectchannel(dev, conf->chandef.chan->hw_value,
2753 0);
2753 2754
2754 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR); 2755 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR);
2755 2756
@@ -3558,7 +3559,7 @@ static int b43legacy_op_get_survey(struct ieee80211_hw *hw, int idx,
3558 if (idx != 0) 3559 if (idx != 0)
3559 return -ENOENT; 3560 return -ENOENT;
3560 3561
3561 survey->channel = conf->channel; 3562 survey->channel = conf->chandef.chan;
3562 survey->filled = SURVEY_INFO_NOISE_DBM; 3563 survey->filled = SURVEY_INFO_NOISE_DBM;
3563 survey->noise = dev->stats.link_noise; 3564 survey->noise = dev->stats.link_noise;
3564 3565
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
index 10ee314c4229..cc87926f5055 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
@@ -379,7 +379,7 @@ brcms_c_channel_set_chanspec(struct brcms_cm_info *wlc_cm, u16 chanspec,
379 u8 local_constraint_qdbm) 379 u8 local_constraint_qdbm)
380{ 380{
381 struct brcms_c_info *wlc = wlc_cm->wlc; 381 struct brcms_c_info *wlc = wlc_cm->wlc;
382 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; 382 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.chandef.chan;
383 struct txpwr_limits txpwr; 383 struct txpwr_limits txpwr;
384 384
385 brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr); 385 brcms_c_channel_reg_limits(wlc_cm, chanspec, &txpwr);
@@ -404,7 +404,7 @@ brcms_c_channel_reg_limits(struct brcms_cm_info *wlc_cm, u16 chanspec,
404 struct txpwr_limits *txpwr) 404 struct txpwr_limits *txpwr)
405{ 405{
406 struct brcms_c_info *wlc = wlc_cm->wlc; 406 struct brcms_c_info *wlc = wlc_cm->wlc;
407 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; 407 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.chandef.chan;
408 uint i; 408 uint i;
409 uint chan; 409 uint chan;
410 int maxpwr; 410 int maxpwr;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index cd837860cd42..db663230088d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -424,10 +424,10 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
424 new_int); 424 new_int);
425 } 425 }
426 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 426 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
427 if (conf->channel_type == NL80211_CHAN_HT20 || 427 if (conf->chandef.width == NL80211_CHAN_WIDTH_20 ||
428 conf->channel_type == NL80211_CHAN_NO_HT) 428 conf->chandef.width == NL80211_CHAN_WIDTH_20_NOHT)
429 err = brcms_c_set_channel(wl->wlc, 429 err = brcms_c_set_channel(wl->wlc,
430 conf->channel->hw_value); 430 conf->chandef.chan->hw_value);
431 else 431 else
432 err = -ENOTSUPP; 432 err = -ENOTSUPP;
433 } 433 }
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 59d438409dfb..28e7aeedd184 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -5135,7 +5135,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
5135 wlc->pub->up = true; 5135 wlc->pub->up = true;
5136 5136
5137 if (wlc->bandinit_pending) { 5137 if (wlc->bandinit_pending) {
5138 ch = wlc->pub->ieee_hw->conf.channel; 5138 ch = wlc->pub->ieee_hw->conf.chandef.chan;
5139 brcms_c_suspend_mac_and_wait(wlc); 5139 brcms_c_suspend_mac_and_wait(wlc);
5140 brcms_c_set_chanspec(wlc, ch20mhz_chspec(ch->hw_value)); 5140 brcms_c_set_chanspec(wlc, ch20mhz_chspec(ch->hw_value));
5141 wlc->bandinit_pending = false; 5141 wlc->bandinit_pending = false;
@@ -7919,7 +7919,7 @@ bool brcms_c_dpc(struct brcms_c_info *wlc, bool bounded)
7919void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx) 7919void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)
7920{ 7920{
7921 struct bcma_device *core = wlc->hw->d11core; 7921 struct bcma_device *core = wlc->hw->d11core;
7922 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.channel; 7922 struct ieee80211_channel *ch = wlc->pub->ieee_hw->conf.chandef.chan;
7923 u16 chanspec; 7923 u16 chanspec;
7924 7924
7925 brcms_dbg_info(core, "wl%d\n", wlc->pub->unit); 7925 brcms_dbg_info(core, "wl%d\n", wlc->pub->unit);
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index d4fd29ad90dc..c9f197d9ca1e 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -347,7 +347,7 @@ il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
347 347
348 psta = (struct il3945_sta_priv *)sta->drv_priv; 348 psta = (struct il3945_sta_priv *)sta->drv_priv;
349 rs_sta = &psta->rs_sta; 349 rs_sta = &psta->rs_sta;
350 sband = hw->wiphy->bands[conf->channel->band]; 350 sband = hw->wiphy->bands[conf->chandef.chan->band];
351 351
352 rs_sta->il = il; 352 rs_sta->il = il;
353 353
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index 6c7493c2d698..1fc0b227e120 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -2300,7 +2300,7 @@ il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
2300 2300
2301 sta_priv = (struct il_station_priv *)sta->drv_priv; 2301 sta_priv = (struct il_station_priv *)sta->drv_priv;
2302 lq_sta = &sta_priv->lq_sta; 2302 lq_sta = &sta_priv->lq_sta;
2303 sband = hw->wiphy->bands[conf->channel->band]; 2303 sband = hw->wiphy->bands[conf->chandef.chan->band];
2304 2304
2305 lq_sta->lq.sta_id = sta_id; 2305 lq_sta->lq.sta_id = sta_id;
2306 2306
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 1a518feb4b26..65becfe57a7d 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -4974,7 +4974,7 @@ il_mac_config(struct ieee80211_hw *hw, u32 changed)
4974 struct il_priv *il = hw->priv; 4974 struct il_priv *il = hw->priv;
4975 const struct il_channel_info *ch_info; 4975 const struct il_channel_info *ch_info;
4976 struct ieee80211_conf *conf = &hw->conf; 4976 struct ieee80211_conf *conf = &hw->conf;
4977 struct ieee80211_channel *channel = conf->channel; 4977 struct ieee80211_channel *channel = conf->chandef.chan;
4978 struct il_ht_config *ht_conf = &il->current_ht_config; 4978 struct il_ht_config *ht_conf = &il->current_ht_config;
4979 unsigned long flags = 0; 4979 unsigned long flags = 0;
4980 int ret = 0; 4980 int ret = 0;
diff --git a/drivers/net/wireless/iwlwifi/dvm/rs.c b/drivers/net/wireless/iwlwifi/dvm/rs.c
index abe304267261..907bd6e50aad 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rs.c
@@ -2831,7 +2831,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2831 2831
2832 sta_priv = (struct iwl_station_priv *) sta->drv_priv; 2832 sta_priv = (struct iwl_station_priv *) sta->drv_priv;
2833 lq_sta = &sta_priv->lq_sta; 2833 lq_sta = &sta_priv->lq_sta;
2834 sband = hw->wiphy->bands[conf->channel->band]; 2834 sband = hw->wiphy->bands[conf->chandef.chan->band];
2835 2835
2836 2836
2837 lq_sta->lq.sta_id = sta_id; 2837 lq_sta->lq.sta_id = sta_id;
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index a82b6b39d4ff..2a349004f18d 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -78,8 +78,9 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv,
78 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 78 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
79#endif 79#endif
80 80
81 ctx->staging.channel = cpu_to_le16(priv->hw->conf.channel->hw_value); 81 ctx->staging.channel =
82 priv->band = priv->hw->conf.channel->band; 82 cpu_to_le16(priv->hw->conf.chandef.chan->hw_value);
83 priv->band = priv->hw->conf.chandef.chan->band;
83 84
84 iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif); 85 iwl_set_flags_for_band(priv, ctx, priv->band, ctx->vif);
85 86
@@ -951,7 +952,7 @@ static void iwl_calc_basic_rates(struct iwl_priv *priv,
951 unsigned long basic = ctx->vif->bss_conf.basic_rates; 952 unsigned long basic = ctx->vif->bss_conf.basic_rates;
952 int i; 953 int i;
953 954
954 sband = priv->hw->wiphy->bands[priv->hw->conf.channel->band]; 955 sband = priv->hw->wiphy->bands[priv->hw->conf.chandef.chan->band];
955 956
956 for_each_set_bit(i, &basic, BITS_PER_LONG) { 957 for_each_set_bit(i, &basic, BITS_PER_LONG) {
957 int hw = sband->bitrates[i].hw_value; 958 int hw = sband->bitrates[i].hw_value;
@@ -1181,7 +1182,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
1181 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); 1182 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
1182 struct iwl_rxon_context *ctx; 1183 struct iwl_rxon_context *ctx;
1183 struct ieee80211_conf *conf = &hw->conf; 1184 struct ieee80211_conf *conf = &hw->conf;
1184 struct ieee80211_channel *channel = conf->channel; 1185 struct ieee80211_channel *channel = conf->chandef.chan;
1185 int ret = 0; 1186 int ret = 0;
1186 1187
1187 IWL_DEBUG_MAC80211(priv, "enter: changed %#x\n", changed); 1188 IWL_DEBUG_MAC80211(priv, "enter: changed %#x\n", changed);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 86e312a4f629..e6eca4d66f6c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -669,6 +669,7 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm,
669 u32 action) 669 u32 action)
670{ 670{
671 struct iwl_mac_ctx_cmd cmd = {}; 671 struct iwl_mac_ctx_cmd cmd = {};
672 struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr;
672 673
673 WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p); 674 WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p);
674 675
@@ -678,7 +679,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm,
678 /* Fill the data specific for station mode */ 679 /* Fill the data specific for station mode */
679 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); 680 iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta);
680 681
681 cmd.p2p_sta.ctwin = cpu_to_le32(vif->bss_conf.p2p_ctwindow); 682 cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow &
683 IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
682 684
683 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 685 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
684} 686}
@@ -919,6 +921,7 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
919 u32 action) 921 u32 action)
920{ 922{
921 struct iwl_mac_ctx_cmd cmd = {}; 923 struct iwl_mac_ctx_cmd cmd = {};
924 struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr;
922 925
923 WARN_ON(vif->type != NL80211_IFTYPE_AP || !vif->p2p); 926 WARN_ON(vif->type != NL80211_IFTYPE_AP || !vif->p2p);
924 927
@@ -929,8 +932,11 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
929 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap, 932 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap,
930 action == FW_CTXT_ACTION_ADD); 933 action == FW_CTXT_ACTION_ADD);
931 934
932 cmd.go.ctwin = cpu_to_le32(vif->bss_conf.p2p_ctwindow); 935 cmd.go.ctwin = cpu_to_le32(noa->oppps_ctwindow &
933 cmd.go.opp_ps_enabled = cpu_to_le32(!!vif->bss_conf.p2p_oppps); 936 IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
937 cmd.go.opp_ps_enabled =
938 cpu_to_le32(!!(noa->oppps_ctwindow &
939 IEEE80211_P2P_OPPPS_ENABLE_BIT));
934 940
935 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 941 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
936} 942}
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index 7001856241e6..088de9d25c39 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -412,9 +412,9 @@ static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed)
412 struct ieee80211_conf *conf = &hw->conf; 412 struct ieee80211_conf *conf = &hw->conf;
413 lbtf_deb_enter(LBTF_DEB_MACOPS); 413 lbtf_deb_enter(LBTF_DEB_MACOPS);
414 414
415 if (conf->channel->center_freq != priv->cur_freq) { 415 if (conf->chandef.chan->center_freq != priv->cur_freq) {
416 priv->cur_freq = conf->channel->center_freq; 416 priv->cur_freq = conf->chandef.chan->center_freq;
417 lbtf_set_channel(priv, conf->channel->hw_value); 417 lbtf_set_channel(priv, conf->chandef.chan->hw_value);
418 } 418 }
419 lbtf_deb_leave(LBTF_DEB_MACOPS); 419 lbtf_deb_leave(LBTF_DEB_MACOPS);
420 return 0; 420 return 0;
@@ -537,7 +537,7 @@ static int lbtf_op_get_survey(struct ieee80211_hw *hw, int idx,
537 if (idx != 0) 537 if (idx != 0)
538 return -ENOENT; 538 return -ENOENT;
539 539
540 survey->channel = conf->channel; 540 survey->channel = conf->chandef.chan;
541 survey->filled = SURVEY_INFO_NOISE_DBM; 541 survey->filled = SURVEY_INFO_NOISE_DBM;
542 survey->noise = priv->noise; 542 survey->noise = priv->noise;
543 543
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 0064d38276bf..70b6ce61fea9 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1062,11 +1062,13 @@ out:
1062 return HRTIMER_NORESTART; 1062 return HRTIMER_NORESTART;
1063} 1063}
1064 1064
1065static const char *hwsim_chantypes[] = { 1065static const char * const hwsim_chanwidths[] = {
1066 [NL80211_CHAN_NO_HT] = "noht", 1066 [NL80211_CHAN_WIDTH_20_NOHT] = "noht",
1067 [NL80211_CHAN_HT20] = "ht20", 1067 [NL80211_CHAN_WIDTH_20] = "ht20",
1068 [NL80211_CHAN_HT40MINUS] = "ht40-", 1068 [NL80211_CHAN_WIDTH_40] = "ht40",
1069 [NL80211_CHAN_HT40PLUS] = "ht40+", 1069 [NL80211_CHAN_WIDTH_80] = "vht80",
1070 [NL80211_CHAN_WIDTH_80P80] = "vht80p80",
1071 [NL80211_CHAN_WIDTH_160] = "vht160",
1070}; 1072};
1071 1073
1072static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) 1074static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
@@ -1080,18 +1082,28 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
1080 [IEEE80211_SMPS_DYNAMIC] = "dynamic", 1082 [IEEE80211_SMPS_DYNAMIC] = "dynamic",
1081 }; 1083 };
1082 1084
1083 wiphy_debug(hw->wiphy, 1085 if (conf->chandef.chan)
1084 "%s (freq=%d/%s idle=%d ps=%d smps=%s)\n", 1086 wiphy_debug(hw->wiphy,
1085 __func__, 1087 "%s (freq=%d(%d - %d)/%s idle=%d ps=%d smps=%s)\n",
1086 conf->channel ? conf->channel->center_freq : 0, 1088 __func__,
1087 hwsim_chantypes[conf->channel_type], 1089 conf->chandef.chan->center_freq,
1088 !!(conf->flags & IEEE80211_CONF_IDLE), 1090 conf->chandef.center_freq1,
1089 !!(conf->flags & IEEE80211_CONF_PS), 1091 conf->chandef.center_freq2,
1090 smps_modes[conf->smps_mode]); 1092 hwsim_chanwidths[conf->chandef.width],
1093 !!(conf->flags & IEEE80211_CONF_IDLE),
1094 !!(conf->flags & IEEE80211_CONF_PS),
1095 smps_modes[conf->smps_mode]);
1096 else
1097 wiphy_debug(hw->wiphy,
1098 "%s (freq=0 idle=%d ps=%d smps=%s)\n",
1099 __func__,
1100 !!(conf->flags & IEEE80211_CONF_IDLE),
1101 !!(conf->flags & IEEE80211_CONF_PS),
1102 smps_modes[conf->smps_mode]);
1091 1103
1092 data->idle = !!(conf->flags & IEEE80211_CONF_IDLE); 1104 data->idle = !!(conf->flags & IEEE80211_CONF_IDLE);
1093 1105
1094 data->channel = conf->channel; 1106 data->channel = conf->chandef.chan;
1095 1107
1096 WARN_ON(data->channel && channels > 1); 1108 WARN_ON(data->channel && channels > 1);
1097 1109
@@ -1277,7 +1289,7 @@ static int mac80211_hwsim_get_survey(
1277 return -ENOENT; 1289 return -ENOENT;
1278 1290
1279 /* Current channel */ 1291 /* Current channel */
1280 survey->channel = conf->channel; 1292 survey->channel = conf->chandef.chan;
1281 1293
1282 /* 1294 /*
1283 * Magically conjured noise level --- this is only ok for simulated hardware. 1295 * Magically conjured noise level --- this is only ok for simulated hardware.
@@ -2298,9 +2310,6 @@ static int __init init_mac80211_hwsim(void)
2298 2310
2299 hw->wiphy->bands[band] = sband; 2311 hw->wiphy->bands[band] = sband;
2300 2312
2301 if (channels == 1)
2302 continue;
2303
2304 sband->vht_cap.vht_supported = true; 2313 sband->vht_cap.vht_supported = true;
2305 sband->vht_cap.cap = 2314 sband->vht_cap.cap =
2306 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | 2315 IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index 956c1084ebf1..ee1778cf270f 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -2852,7 +2852,9 @@ static int mwl8k_cmd_tx_power(struct ieee80211_hw *hw,
2852 struct ieee80211_conf *conf, 2852 struct ieee80211_conf *conf,
2853 unsigned short pwr) 2853 unsigned short pwr)
2854{ 2854{
2855 struct ieee80211_channel *channel = conf->channel; 2855 struct ieee80211_channel *channel = conf->chandef.chan;
2856 enum nl80211_channel_type channel_type =
2857 cfg80211_get_chandef_type(&conf->chandef);
2856 struct mwl8k_cmd_tx_power *cmd; 2858 struct mwl8k_cmd_tx_power *cmd;
2857 int rc; 2859 int rc;
2858 int i; 2860 int i;
@@ -2872,14 +2874,14 @@ static int mwl8k_cmd_tx_power(struct ieee80211_hw *hw,
2872 2874
2873 cmd->channel = cpu_to_le16(channel->hw_value); 2875 cmd->channel = cpu_to_le16(channel->hw_value);
2874 2876
2875 if (conf->channel_type == NL80211_CHAN_NO_HT || 2877 if (channel_type == NL80211_CHAN_NO_HT ||
2876 conf->channel_type == NL80211_CHAN_HT20) { 2878 channel_type == NL80211_CHAN_HT20) {
2877 cmd->bw = cpu_to_le16(0x2); 2879 cmd->bw = cpu_to_le16(0x2);
2878 } else { 2880 } else {
2879 cmd->bw = cpu_to_le16(0x4); 2881 cmd->bw = cpu_to_le16(0x4);
2880 if (conf->channel_type == NL80211_CHAN_HT40MINUS) 2882 if (channel_type == NL80211_CHAN_HT40MINUS)
2881 cmd->sub_ch = cpu_to_le16(0x3); 2883 cmd->sub_ch = cpu_to_le16(0x3);
2882 else if (conf->channel_type == NL80211_CHAN_HT40PLUS) 2884 else if (channel_type == NL80211_CHAN_HT40PLUS)
2883 cmd->sub_ch = cpu_to_le16(0x1); 2885 cmd->sub_ch = cpu_to_le16(0x1);
2884 } 2886 }
2885 2887
@@ -3023,7 +3025,9 @@ struct mwl8k_cmd_set_rf_channel {
3023static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw, 3025static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw,
3024 struct ieee80211_conf *conf) 3026 struct ieee80211_conf *conf)
3025{ 3027{
3026 struct ieee80211_channel *channel = conf->channel; 3028 struct ieee80211_channel *channel = conf->chandef.chan;
3029 enum nl80211_channel_type channel_type =
3030 cfg80211_get_chandef_type(&conf->chandef);
3027 struct mwl8k_cmd_set_rf_channel *cmd; 3031 struct mwl8k_cmd_set_rf_channel *cmd;
3028 int rc; 3032 int rc;
3029 3033
@@ -3041,12 +3045,12 @@ static int mwl8k_cmd_set_rf_channel(struct ieee80211_hw *hw,
3041 else if (channel->band == IEEE80211_BAND_5GHZ) 3045 else if (channel->band == IEEE80211_BAND_5GHZ)
3042 cmd->channel_flags |= cpu_to_le32(0x00000004); 3046 cmd->channel_flags |= cpu_to_le32(0x00000004);
3043 3047
3044 if (conf->channel_type == NL80211_CHAN_NO_HT || 3048 if (channel_type == NL80211_CHAN_NO_HT ||
3045 conf->channel_type == NL80211_CHAN_HT20) 3049 channel_type == NL80211_CHAN_HT20)
3046 cmd->channel_flags |= cpu_to_le32(0x00000080); 3050 cmd->channel_flags |= cpu_to_le32(0x00000080);
3047 else if (conf->channel_type == NL80211_CHAN_HT40MINUS) 3051 else if (channel_type == NL80211_CHAN_HT40MINUS)
3048 cmd->channel_flags |= cpu_to_le32(0x000001900); 3052 cmd->channel_flags |= cpu_to_le32(0x000001900);
3049 else if (conf->channel_type == NL80211_CHAN_HT40PLUS) 3053 else if (channel_type == NL80211_CHAN_HT40PLUS)
3050 cmd->channel_flags |= cpu_to_le32(0x000000900); 3054 cmd->channel_flags |= cpu_to_le32(0x000000900);
3051 3055
3052 rc = mwl8k_post_cmd(hw, &cmd->header); 3056 rc = mwl8k_post_cmd(hw, &cmd->header);
@@ -3965,7 +3969,7 @@ static int mwl8k_cmd_set_new_stn_add(struct ieee80211_hw *hw,
3965 memcpy(cmd->mac_addr, sta->addr, ETH_ALEN); 3969 memcpy(cmd->mac_addr, sta->addr, ETH_ALEN);
3966 cmd->stn_id = cpu_to_le16(sta->aid); 3970 cmd->stn_id = cpu_to_le16(sta->aid);
3967 cmd->action = cpu_to_le16(MWL8K_STA_ACTION_ADD); 3971 cmd->action = cpu_to_le16(MWL8K_STA_ACTION_ADD);
3968 if (hw->conf.channel->band == IEEE80211_BAND_2GHZ) 3972 if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
3969 rates = sta->supp_rates[IEEE80211_BAND_2GHZ]; 3973 rates = sta->supp_rates[IEEE80211_BAND_2GHZ];
3970 else 3974 else
3971 rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5; 3975 rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5;
@@ -4400,7 +4404,7 @@ static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw,
4400 p->ht_caps = cpu_to_le16(sta->ht_cap.cap); 4404 p->ht_caps = cpu_to_le16(sta->ht_cap.cap);
4401 p->extended_ht_caps = (sta->ht_cap.ampdu_factor & 3) | 4405 p->extended_ht_caps = (sta->ht_cap.ampdu_factor & 3) |
4402 ((sta->ht_cap.ampdu_density & 7) << 2); 4406 ((sta->ht_cap.ampdu_density & 7) << 2);
4403 if (hw->conf.channel->band == IEEE80211_BAND_2GHZ) 4407 if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
4404 rates = sta->supp_rates[IEEE80211_BAND_2GHZ]; 4408 rates = sta->supp_rates[IEEE80211_BAND_2GHZ];
4405 else 4409 else
4406 rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5; 4410 rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5;
@@ -4881,7 +4885,7 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4881 goto out; 4885 goto out;
4882 } 4886 }
4883 4887
4884 if (hw->conf.channel->band == IEEE80211_BAND_2GHZ) { 4888 if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ) {
4885 ap_legacy_rates = ap->supp_rates[IEEE80211_BAND_2GHZ]; 4889 ap_legacy_rates = ap->supp_rates[IEEE80211_BAND_2GHZ];
4886 } else { 4890 } else {
4887 ap_legacy_rates = 4891 ap_legacy_rates =
@@ -4913,7 +4917,7 @@ mwl8k_bss_info_changed_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4913 if (idx) 4917 if (idx)
4914 idx--; 4918 idx--;
4915 4919
4916 if (hw->conf.channel->band == IEEE80211_BAND_2GHZ) 4920 if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
4917 rate = mwl8k_rates_24[idx].hw_value; 4921 rate = mwl8k_rates_24[idx].hw_value;
4918 else 4922 else
4919 rate = mwl8k_rates_50[idx].hw_value; 4923 rate = mwl8k_rates_50[idx].hw_value;
@@ -4986,7 +4990,7 @@ mwl8k_bss_info_changed_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4986 if (idx) 4990 if (idx)
4987 idx--; 4991 idx--;
4988 4992
4989 if (hw->conf.channel->band == IEEE80211_BAND_2GHZ) 4993 if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
4990 rate = mwl8k_rates_24[idx].hw_value; 4994 rate = mwl8k_rates_24[idx].hw_value;
4991 else 4995 else
4992 rate = mwl8k_rates_50[idx].hw_value; 4996 rate = mwl8k_rates_50[idx].hw_value;
@@ -5259,7 +5263,7 @@ static int mwl8k_get_survey(struct ieee80211_hw *hw, int idx,
5259 if (idx != 0) 5263 if (idx != 0)
5260 return -ENOENT; 5264 return -ENOENT;
5261 5265
5262 survey->channel = conf->channel; 5266 survey->channel = conf->chandef.chan;
5263 survey->filled = SURVEY_INFO_NOISE_DBM; 5267 survey->filled = SURVEY_INFO_NOISE_DBM;
5264 survey->noise = priv->noise; 5268 survey->noise = priv->noise;
5265 5269
diff --git a/drivers/net/wireless/p54/fwio.c b/drivers/net/wireless/p54/fwio.c
index 9ba85106eec0..b3879fbf5368 100644
--- a/drivers/net/wireless/p54/fwio.c
+++ b/drivers/net/wireless/p54/fwio.c
@@ -402,7 +402,7 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell)
402 struct p54_rssi_db_entry *rssi_data; 402 struct p54_rssi_db_entry *rssi_data;
403 unsigned int i; 403 unsigned int i;
404 void *entry; 404 void *entry;
405 __le16 freq = cpu_to_le16(priv->hw->conf.channel->center_freq); 405 __le16 freq = cpu_to_le16(priv->hw->conf.chandef.chan->center_freq);
406 406
407 skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*head) + 407 skb = p54_alloc_skb(priv, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*head) +
408 2 + sizeof(*iq_autocal) + sizeof(*body) + 408 2 + sizeof(*iq_autocal) + sizeof(*body) +
@@ -532,7 +532,7 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell)
532err: 532err:
533 wiphy_err(priv->hw->wiphy, "frequency change to channel %d failed.\n", 533 wiphy_err(priv->hw->wiphy, "frequency change to channel %d failed.\n",
534 ieee80211_frequency_to_channel( 534 ieee80211_frequency_to_channel(
535 priv->hw->conf.channel->center_freq)); 535 priv->hw->conf.chandef.chan->center_freq));
536 536
537 dev_kfree_skb_any(skb); 537 dev_kfree_skb_any(skb);
538 return -EINVAL; 538 return -EINVAL;
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c
index ee654a691f38..067e6f2fd050 100644
--- a/drivers/net/wireless/p54/main.c
+++ b/drivers/net/wireless/p54/main.c
@@ -340,7 +340,7 @@ static int p54_config(struct ieee80211_hw *dev, u32 changed)
340 * TODO: Use the LM_SCAN_TRAP to determine the current 340 * TODO: Use the LM_SCAN_TRAP to determine the current
341 * operating channel. 341 * operating channel.
342 */ 342 */
343 priv->curchan = priv->hw->conf.channel; 343 priv->curchan = priv->hw->conf.chandef.chan;
344 p54_reset_stats(priv); 344 p54_reset_stats(priv);
345 WARN_ON(p54_fetch_statistics(priv)); 345 WARN_ON(p54_fetch_statistics(priv));
346 } 346 }
@@ -480,7 +480,7 @@ static void p54_bss_info_changed(struct ieee80211_hw *dev,
480 p54_set_edcf(priv); 480 p54_set_edcf(priv);
481 } 481 }
482 if (changed & BSS_CHANGED_BASIC_RATES) { 482 if (changed & BSS_CHANGED_BASIC_RATES) {
483 if (dev->conf.channel->band == IEEE80211_BAND_5GHZ) 483 if (dev->conf.chandef.chan->band == IEEE80211_BAND_5GHZ)
484 priv->basic_rate_mask = (info->basic_rates << 4); 484 priv->basic_rate_mask = (info->basic_rates << 4);
485 else 485 else
486 priv->basic_rate_mask = info->basic_rates; 486 priv->basic_rate_mask = info->basic_rates;
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index 12f0a34477f2..f95de0d16216 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -354,13 +354,13 @@ static int p54_rx_data(struct p54_common *priv, struct sk_buff *skb)
354 rx_status->signal = p54_rssi_to_dbm(priv, hdr->rssi); 354 rx_status->signal = p54_rssi_to_dbm(priv, hdr->rssi);
355 if (hdr->rate & 0x10) 355 if (hdr->rate & 0x10)
356 rx_status->flag |= RX_FLAG_SHORTPRE; 356 rx_status->flag |= RX_FLAG_SHORTPRE;
357 if (priv->hw->conf.channel->band == IEEE80211_BAND_5GHZ) 357 if (priv->hw->conf.chandef.chan->band == IEEE80211_BAND_5GHZ)
358 rx_status->rate_idx = (rate < 4) ? 0 : rate - 4; 358 rx_status->rate_idx = (rate < 4) ? 0 : rate - 4;
359 else 359 else
360 rx_status->rate_idx = rate; 360 rx_status->rate_idx = rate;
361 361
362 rx_status->freq = freq; 362 rx_status->freq = freq;
363 rx_status->band = priv->hw->conf.channel->band; 363 rx_status->band = priv->hw->conf.chandef.chan->band;
364 rx_status->antenna = hdr->antenna; 364 rx_status->antenna = hdr->antenna;
365 365
366 tsf32 = le32_to_cpu(hdr->tsf32); 366 tsf32 = le32_to_cpu(hdr->tsf32);
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 7deac4d2459f..72bbb962579f 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -3147,7 +3147,7 @@ static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
3147 3147
3148void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev) 3148void rt2800_gain_calibration(struct rt2x00_dev *rt2x00dev)
3149{ 3149{
3150 rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.channel, 3150 rt2800_config_txpower(rt2x00dev, rt2x00dev->hw->conf.chandef.chan,
3151 rt2x00dev->tx_power); 3151 rt2x00dev->tx_power);
3152} 3152}
3153EXPORT_SYMBOL_GPL(rt2800_gain_calibration); 3153EXPORT_SYMBOL_GPL(rt2800_gain_calibration);
@@ -3282,11 +3282,11 @@ void rt2800_config(struct rt2x00_dev *rt2x00dev,
3282 if (flags & IEEE80211_CONF_CHANGE_CHANNEL) { 3282 if (flags & IEEE80211_CONF_CHANGE_CHANNEL) {
3283 rt2800_config_channel(rt2x00dev, libconf->conf, 3283 rt2800_config_channel(rt2x00dev, libconf->conf,
3284 &libconf->rf, &libconf->channel); 3284 &libconf->rf, &libconf->channel);
3285 rt2800_config_txpower(rt2x00dev, libconf->conf->channel, 3285 rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan,
3286 libconf->conf->power_level); 3286 libconf->conf->power_level);
3287 } 3287 }
3288 if (flags & IEEE80211_CONF_CHANGE_POWER) 3288 if (flags & IEEE80211_CONF_CHANGE_POWER)
3289 rt2800_config_txpower(rt2x00dev, libconf->conf->channel, 3289 rt2800_config_txpower(rt2x00dev, libconf->conf->chandef.chan,
3290 libconf->conf->power_level); 3290 libconf->conf->power_level);
3291 if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS) 3291 if (flags & IEEE80211_CONF_CHANGE_RETRY_LIMITS)
3292 rt2800_config_retry_limit(rt2x00dev, libconf); 3292 rt2800_config_retry_limit(rt2x00dev, libconf);
@@ -6340,7 +6340,7 @@ int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
6340 if (idx != 0) 6340 if (idx != 0)
6341 return -ENOENT; 6341 return -ENOENT;
6342 6342
6343 survey->channel = conf->channel; 6343 survey->channel = conf->chandef.chan;
6344 6344
6345 rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle); 6345 rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle);
6346 rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy); 6346 rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy);
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 49a63e973934..8cb43f8f3efc 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -184,7 +184,7 @@ static u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
184 /* 184 /*
185 * Initialize center channel to current channel. 185 * Initialize center channel to current channel.
186 */ 186 */
187 center_channel = spec->channels[conf->channel->hw_value].channel; 187 center_channel = spec->channels[conf->chandef.chan->hw_value].channel;
188 188
189 /* 189 /*
190 * Adjust center channel to HT40+ and HT40- operation. 190 * Adjust center channel to HT40+ and HT40- operation.
@@ -199,7 +199,7 @@ static u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
199 return i; 199 return i;
200 200
201 WARN_ON(1); 201 WARN_ON(1);
202 return conf->channel->hw_value; 202 return conf->chandef.chan->hw_value;
203} 203}
204 204
205void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, 205void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
@@ -227,7 +227,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
227 hw_value = rt2x00ht_center_channel(rt2x00dev, conf); 227 hw_value = rt2x00ht_center_channel(rt2x00dev, conf);
228 } else { 228 } else {
229 clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags); 229 clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
230 hw_value = conf->channel->hw_value; 230 hw_value = conf->chandef.chan->hw_value;
231 } 231 }
232 232
233 memcpy(&libconf.rf, 233 memcpy(&libconf.rf,
@@ -279,8 +279,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
279 else 279 else
280 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); 280 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
281 281
282 rt2x00dev->curr_band = conf->channel->band; 282 rt2x00dev->curr_band = conf->chandef.chan->band;
283 rt2x00dev->curr_freq = conf->channel->center_freq; 283 rt2x00dev->curr_freq = conf->chandef.chan->center_freq;
284 rt2x00dev->tx_power = conf->power_level; 284 rt2x00dev->tx_power = conf->power_level;
285 rt2x00dev->short_retry = conf->short_frame_max_tx_count; 285 rt2x00dev->short_retry = conf->short_frame_max_tx_count;
286 rt2x00dev->long_retry = conf->long_frame_max_tx_count; 286 rt2x00dev->long_retry = conf->long_frame_max_tx_count;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 9e3c8ff53e3f..9d630b4ee3e5 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -848,7 +848,7 @@ static void rt61pci_config_lna_gain(struct rt2x00_dev *rt2x00dev,
848 u16 eeprom; 848 u16 eeprom;
849 short lna_gain = 0; 849 short lna_gain = 0;
850 850
851 if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) { 851 if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {
852 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) 852 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
853 lna_gain += 14; 853 lna_gain += 14;
854 854
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 24eec66e9fd2..a3387b146bb5 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -739,7 +739,7 @@ static void rt73usb_config_lna_gain(struct rt2x00_dev *rt2x00dev,
739 u16 eeprom; 739 u16 eeprom;
740 short lna_gain = 0; 740 short lna_gain = 0;
741 741
742 if (libconf->conf->channel->band == IEEE80211_BAND_2GHZ) { 742 if (libconf->conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {
743 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags)) 743 if (test_bit(CAPABILITY_EXTERNAL_LNA_BG, &rt2x00dev->cap_flags))
744 lna_gain += 14; 744 lna_gain += 14;
745 745
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 1b3c2843221d..91a04e2b8ece 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -147,8 +147,8 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev)
147 signal = priv->rf->calc_rssi(agc, sq); 147 signal = priv->rf->calc_rssi(agc, sq);
148 } 148 }
149 rx_status.signal = signal; 149 rx_status.signal = signal;
150 rx_status.freq = dev->conf.channel->center_freq; 150 rx_status.freq = dev->conf.chandef.chan->center_freq;
151 rx_status.band = dev->conf.channel->band; 151 rx_status.band = dev->conf.chandef.chan->band;
152 rx_status.mactime = le64_to_cpu(entry->tsft); 152 rx_status.mactime = le64_to_cpu(entry->tsft);
153 rx_status.flag |= RX_FLAG_MACTIME_START; 153 rx_status.flag |= RX_FLAG_MACTIME_START;
154 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) 154 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
diff --git a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c
index 5ee7589dd546..077ff92cc139 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/grf5101.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/grf5101.c
@@ -82,7 +82,8 @@ static void grf5101_rf_set_channel(struct ieee80211_hw *dev,
82 struct ieee80211_conf *conf) 82 struct ieee80211_conf *conf)
83{ 83{
84 struct rtl8180_priv *priv = dev->priv; 84 struct rtl8180_priv *priv = dev->priv;
85 int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 85 int channel =
86 ieee80211_frequency_to_channel(conf->chandef.chan->center_freq);
86 u32 txpw = priv->channels[channel - 1].hw_value & 0xFF; 87 u32 txpw = priv->channels[channel - 1].hw_value & 0xFF;
87 u32 chan = channel - 1; 88 u32 chan = channel - 1;
88 89
diff --git a/drivers/net/wireless/rtl818x/rtl8180/max2820.c b/drivers/net/wireless/rtl818x/rtl8180/max2820.c
index 667b3363d437..4715000c94dd 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/max2820.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/max2820.c
@@ -95,7 +95,7 @@ static void max2820_rf_set_channel(struct ieee80211_hw *dev,
95{ 95{
96 struct rtl8180_priv *priv = dev->priv; 96 struct rtl8180_priv *priv = dev->priv;
97 int channel = conf ? 97 int channel = conf ?
98 ieee80211_frequency_to_channel(conf->channel->center_freq) : 1; 98 ieee80211_frequency_to_channel(conf->chandef.chan->center_freq) : 1;
99 unsigned int chan_idx = channel - 1; 99 unsigned int chan_idx = channel - 1;
100 u32 txpw = priv->channels[chan_idx].hw_value & 0xFF; 100 u32 txpw = priv->channels[chan_idx].hw_value & 0xFF;
101 u32 chan = max2820_chan[chan_idx]; 101 u32 chan = max2820_chan[chan_idx];
diff --git a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c
index 7c4574ba9d75..cc2a5412c1f0 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/rtl8225.c
@@ -719,7 +719,8 @@ static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
719 struct ieee80211_conf *conf) 719 struct ieee80211_conf *conf)
720{ 720{
721 struct rtl8180_priv *priv = dev->priv; 721 struct rtl8180_priv *priv = dev->priv;
722 int chan = ieee80211_frequency_to_channel(conf->channel->center_freq); 722 int chan =
723 ieee80211_frequency_to_channel(conf->chandef.chan->center_freq);
723 724
724 if (priv->rf->init == rtl8225_rf_init) 725 if (priv->rf->init == rtl8225_rf_init)
725 rtl8225_rf_set_tx_power(dev, chan); 726 rtl8225_rf_set_tx_power(dev, chan);
diff --git a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c
index 44771a6286af..b3ec40f6bd23 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/sa2400.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/sa2400.c
@@ -105,7 +105,8 @@ static void sa2400_rf_set_channel(struct ieee80211_hw *dev,
105 struct ieee80211_conf *conf) 105 struct ieee80211_conf *conf)
106{ 106{
107 struct rtl8180_priv *priv = dev->priv; 107 struct rtl8180_priv *priv = dev->priv;
108 int channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 108 int channel =
109 ieee80211_frequency_to_channel(conf->chandef.chan->center_freq);
109 u32 txpw = priv->channels[channel - 1].hw_value & 0xFF; 110 u32 txpw = priv->channels[channel - 1].hw_value & 0xFF;
110 u32 chan = sa2400_chan[channel - 1]; 111 u32 chan = sa2400_chan[channel - 1];
111 112
diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
index 4574bd213705..f49220e234b0 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
@@ -379,8 +379,8 @@ static void rtl8187_rx_cb(struct urb *urb)
379 rate = (flags >> 20) & 0xF; 379 rate = (flags >> 20) & 0xF;
380 skb_trim(skb, flags & 0x0FFF); 380 skb_trim(skb, flags & 0x0FFF);
381 rx_status.rate_idx = rate; 381 rx_status.rate_idx = rate;
382 rx_status.freq = dev->conf.channel->center_freq; 382 rx_status.freq = dev->conf.chandef.chan->center_freq;
383 rx_status.band = dev->conf.channel->band; 383 rx_status.band = dev->conf.chandef.chan->band;
384 rx_status.flag |= RX_FLAG_MACTIME_START; 384 rx_status.flag |= RX_FLAG_MACTIME_START;
385 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR) 385 if (flags & RTL818X_RX_DESC_FLAG_CRC32_ERR)
386 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC; 386 rx_status.flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c
index 908903f721f5..f0bf35fedbaf 100644
--- a/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8225.c
@@ -905,7 +905,8 @@ static void rtl8225_rf_set_channel(struct ieee80211_hw *dev,
905 struct ieee80211_conf *conf) 905 struct ieee80211_conf *conf)
906{ 906{
907 struct rtl8187_priv *priv = dev->priv; 907 struct rtl8187_priv *priv = dev->priv;
908 int chan = ieee80211_frequency_to_channel(conf->channel->center_freq); 908 int chan =
909 ieee80211_frequency_to_channel(conf->chandef.chan->center_freq);
909 910
910 if (priv->rf->init == rtl8225_rf_init) 911 if (priv->rf->init == rtl8225_rf_init)
911 rtl8225_rf_set_tx_power(dev, chan); 912 rtl8225_rf_set_tx_power(dev, chan);
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index cac1fa912e8c..af59dd5718e1 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -722,7 +722,7 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
722 int rate_idx; 722 int rate_idx;
723 723
724 if (false == isht) { 724 if (false == isht) {
725 if (IEEE80211_BAND_2GHZ == hw->conf.channel->band) { 725 if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) {
726 switch (desc_rate) { 726 switch (desc_rate) {
727 case DESC92_RATE1M: 727 case DESC92_RATE1M:
728 rate_idx = 0; 728 rate_idx = 0;
@@ -987,8 +987,8 @@ static bool addbareq_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
987 if (tid_data->agg.rx_agg_state == RTL_RX_AGG_START) { 987 if (tid_data->agg.rx_agg_state == RTL_RX_AGG_START) {
988 skb_delba = rtl_make_del_ba(hw, hdr->addr2, hdr->addr3, tid); 988 skb_delba = rtl_make_del_ba(hw, hdr->addr2, hdr->addr3, tid);
989 if (skb_delba) { 989 if (skb_delba) {
990 rx_status.freq = hw->conf.channel->center_freq; 990 rx_status.freq = hw->conf.chandef.chan->center_freq;
991 rx_status.band = hw->conf.channel->band; 991 rx_status.band = hw->conf.chandef.chan->band;
992 rx_status.flag |= RX_FLAG_DECRYPTED; 992 rx_status.flag |= RX_FLAG_DECRYPTED;
993 rx_status.flag |= RX_FLAG_MACTIME_END; 993 rx_status.flag |= RX_FLAG_MACTIME_END;
994 rx_status.rate_idx = 0; 994 rx_status.rate_idx = 0;
@@ -1593,7 +1593,7 @@ int rtl_send_smps_action(struct ieee80211_hw *hw,
1593 sta_entry->mimo_ps = smps; 1593 sta_entry->mimo_ps = smps;
1594 1594
1595 info->control.rates[0].idx = 0; 1595 info->control.rates[0].idx = 0;
1596 info->band = hw->conf.channel->band; 1596 info->band = hw->conf.chandef.chan->band;
1597 rtlpriv->intf_ops->adapter_tx(hw, sta, skb, &tcb_desc); 1597 rtlpriv->intf_ops->adapter_tx(hw, sta, skb, &tcb_desc);
1598 } 1598 }
1599 return 1; 1599 return 1;
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index 2201b5cee08f..ee84844be008 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -370,7 +370,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
370 } 370 }
371 371
372 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 372 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
373 struct ieee80211_channel *channel = hw->conf.channel; 373 struct ieee80211_channel *channel = hw->conf.chandef.chan;
374 u8 wide_chan = (u8) channel->hw_value; 374 u8 wide_chan = (u8) channel->hw_value;
375 375
376 if (mac->act_scanning) 376 if (mac->act_scanning)
@@ -392,7 +392,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
392 *info for cisco1253 bw20, so we modify 392 *info for cisco1253 bw20, so we modify
393 *it here based on UPPER & LOWER 393 *it here based on UPPER & LOWER
394 */ 394 */
395 switch (hw->conf.channel_type) { 395 switch (cfg80211_get_chandef_type(&hw->conf.chandef)) {
396 case NL80211_CHAN_HT20: 396 case NL80211_CHAN_HT20:
397 case NL80211_CHAN_NO_HT: 397 case NL80211_CHAN_NO_HT:
398 /* SC */ 398 /* SC */
@@ -450,7 +450,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
450 rtlpriv->cfg->ops->switch_channel(hw); 450 rtlpriv->cfg->ops->switch_channel(hw);
451 rtlpriv->cfg->ops->set_channel_access(hw); 451 rtlpriv->cfg->ops->set_channel_access(hw);
452 rtlpriv->cfg->ops->set_bw_mode(hw, 452 rtlpriv->cfg->ops->set_bw_mode(hw,
453 hw->conf.channel_type); 453 cfg80211_get_chandef_type(&hw->conf.chandef));
454 } 454 }
455 455
456 mutex_unlock(&rtlpriv->locks.conf_mutex); 456 mutex_unlock(&rtlpriv->locks.conf_mutex);
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
index d075237add51..a8871d66d56a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
@@ -421,8 +421,8 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
421 RT_TRACE(rtlpriv, COMP_RXDESC, DBG_LOUD, 421 RT_TRACE(rtlpriv, COMP_RXDESC, DBG_LOUD,
422 "Get Wakeup Packet!! WakeMatch =%d\n", 422 "Get Wakeup Packet!! WakeMatch =%d\n",
423 status->wake_match); 423 status->wake_match);
424 rx_status->freq = hw->conf.channel->center_freq; 424 rx_status->freq = hw->conf.chandef.chan->center_freq;
425 rx_status->band = hw->conf.channel->band; 425 rx_status->band = hw->conf.chandef.chan->band;
426 426
427 if (status->crc) 427 if (status->crc)
428 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 428 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 65bf5fb97002..6ad23b413eb3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -363,8 +363,8 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
363 363
364 stats->is_cck = RX_HAL_IS_CCK_RATE(pdesc); 364 stats->is_cck = RX_HAL_IS_CCK_RATE(pdesc);
365 365
366 rx_status->freq = hw->conf.channel->center_freq; 366 rx_status->freq = hw->conf.chandef.chan->center_freq;
367 rx_status->band = hw->conf.channel->band; 367 rx_status->band = hw->conf.chandef.chan->band;
368 368
369 hdr = (struct ieee80211_hdr *)(skb->data + stats->rx_drvinfo_size 369 hdr = (struct ieee80211_hdr *)(skb->data + stats->rx_drvinfo_size
370 + stats->rx_bufshift); 370 + stats->rx_bufshift);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index 710f7904ecdf..763cf1defab5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -324,8 +324,8 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
324 && (GET_RX_DESC_FAGGR(pdesc) == 1)); 324 && (GET_RX_DESC_FAGGR(pdesc) == 1));
325 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); 325 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
326 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); 326 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc);
327 rx_status->freq = hw->conf.channel->center_freq; 327 rx_status->freq = hw->conf.chandef.chan->center_freq;
328 rx_status->band = hw->conf.channel->band; 328 rx_status->band = hw->conf.chandef.chan->band;
329 if (GET_RX_DESC_CRC32(pdesc)) 329 if (GET_RX_DESC_CRC32(pdesc))
330 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 330 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
331 if (!GET_RX_DESC_SWDEC(pdesc)) 331 if (!GET_RX_DESC_SWDEC(pdesc))
@@ -395,8 +395,8 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
395 stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc); 395 stats.rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(rxdesc);
396 /* TODO: is center_freq changed when doing scan? */ 396 /* TODO: is center_freq changed when doing scan? */
397 /* TODO: Shall we add protection or just skip those two step? */ 397 /* TODO: Shall we add protection or just skip those two step? */
398 rx_status->freq = hw->conf.channel->center_freq; 398 rx_status->freq = hw->conf.chandef.chan->center_freq;
399 rx_status->band = hw->conf.channel->band; 399 rx_status->band = hw->conf.chandef.chan->band;
400 if (GET_RX_DESC_CRC32(rxdesc)) 400 if (GET_RX_DESC_CRC32(rxdesc))
401 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 401 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
402 if (!GET_RX_DESC_SWDEC(rxdesc)) 402 if (!GET_RX_DESC_SWDEC(rxdesc))
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
index 941080e03c06..b8ec718a0fab 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
@@ -499,8 +499,8 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
499 && (GET_RX_DESC_FAGGR(pdesc) == 1)); 499 && (GET_RX_DESC_FAGGR(pdesc) == 1));
500 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc); 500 stats->timestamp_low = GET_RX_DESC_TSFL(pdesc);
501 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); 501 stats->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc);
502 rx_status->freq = hw->conf.channel->center_freq; 502 rx_status->freq = hw->conf.chandef.chan->center_freq;
503 rx_status->band = hw->conf.channel->band; 503 rx_status->band = hw->conf.chandef.chan->band;
504 if (GET_RX_DESC_CRC32(pdesc)) 504 if (GET_RX_DESC_CRC32(pdesc))
505 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 505 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
506 if (!GET_RX_DESC_SWDEC(pdesc)) 506 if (!GET_RX_DESC_SWDEC(pdesc))
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index 960bc28cc51e..c7095118de6e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -281,8 +281,8 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
281 if (stats->hwerror) 281 if (stats->hwerror)
282 return false; 282 return false;
283 283
284 rx_status->freq = hw->conf.channel->center_freq; 284 rx_status->freq = hw->conf.chandef.chan->center_freq;
285 rx_status->band = hw->conf.channel->band; 285 rx_status->band = hw->conf.chandef.chan->band;
286 286
287 if (stats->crc) 287 if (stats->crc)
288 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 288 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
index 6c64365308d3..c72758d8f4ed 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
@@ -304,8 +304,8 @@ bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw,
304 304
305 status->is_cck = RTL8723E_RX_HAL_IS_CCK_RATE(status->rate); 305 status->is_cck = RTL8723E_RX_HAL_IS_CCK_RATE(status->rate);
306 306
307 rx_status->freq = hw->conf.channel->center_freq; 307 rx_status->freq = hw->conf.chandef.chan->center_freq;
308 rx_status->band = hw->conf.channel->band; 308 rx_status->band = hw->conf.chandef.chan->band;
309 309
310 if (status->crc) 310 if (status->crc)
311 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; 311 rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index bbbf68cf50a7..3291ffa95273 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -572,7 +572,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
572 struct ieee80211_conf *conf = &hw->conf; 572 struct ieee80211_conf *conf = &hw->conf;
573 int channel, ret = 0; 573 int channel, ret = 0;
574 574
575 channel = ieee80211_frequency_to_channel(conf->channel->center_freq); 575 channel = ieee80211_frequency_to_channel(
576 conf->chandef.chan->center_freq);
576 577
577 wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d", 578 wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
578 channel, 579 channel,
@@ -1223,7 +1224,7 @@ static int wl1251_op_get_survey(struct ieee80211_hw *hw, int idx,
1223 if (idx != 0) 1224 if (idx != 0)
1224 return -ENOENT; 1225 return -ENOENT;
1225 1226
1226 survey->channel = conf->channel; 1227 survey->channel = conf->chandef.chan;
1227 survey->filled = SURVEY_INFO_NOISE_DBM; 1228 survey->filled = SURVEY_INFO_NOISE_DBM;
1228 survey->noise = wl->noise; 1229 survey->noise = wl->noise;
1229 1230
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index d10954c0c181..953111a502ee 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -4502,7 +4502,7 @@ static int wl1271_op_get_survey(struct ieee80211_hw *hw, int idx,
4502 if (idx != 0) 4502 if (idx != 0)
4503 return -ENOENT; 4503 return -ENOENT;
4504 4504
4505 survey->channel = conf->channel; 4505 survey->channel = conf->chandef.chan;
4506 survey->filled = 0; 4506 survey->filled = 0;
4507 return 0; 4507 return 0;
4508} 4508}
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 114364b5d466..c6208a7988e4 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1156,10 +1156,10 @@ static int zd_op_config(struct ieee80211_hw *hw, u32 changed)
1156 struct ieee80211_conf *conf = &hw->conf; 1156 struct ieee80211_conf *conf = &hw->conf;
1157 1157
1158 spin_lock_irq(&mac->lock); 1158 spin_lock_irq(&mac->lock);
1159 mac->channel = conf->channel->hw_value; 1159 mac->channel = conf->chandef.chan->hw_value;
1160 spin_unlock_irq(&mac->lock); 1160 spin_unlock_irq(&mac->lock);
1161 1161
1162 return zd_chip_set_channel(&mac->chip, conf->channel->hw_value); 1162 return zd_chip_set_channel(&mac->chip, conf->chandef.chan->hw_value);
1163} 1163}
1164 1164
1165static void zd_beacon_done(struct zd_mac *mac) 1165static void zd_beacon_done(struct zd_mac *mac)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 4cf0c9e4dd99..e46fea8b972e 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1027,6 +1027,26 @@ enum ieee80211_p2p_attr_id {
1027 IEEE80211_P2P_ATTR_MAX 1027 IEEE80211_P2P_ATTR_MAX
1028}; 1028};
1029 1029
1030/* Notice of Absence attribute - described in P2P spec 4.1.14 */
1031/* Typical max value used here */
1032#define IEEE80211_P2P_NOA_DESC_MAX 4
1033
1034struct ieee80211_p2p_noa_desc {
1035 u8 count;
1036 __le32 duration;
1037 __le32 interval;
1038 __le32 start_time;
1039} __packed;
1040
1041struct ieee80211_p2p_noa_attr {
1042 u8 index;
1043 u8 oppps_ctwindow;
1044 struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX];
1045} __packed;
1046
1047#define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7)
1048#define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F
1049
1030/** 1050/**
1031 * struct ieee80211_bar - HT Block Ack Request 1051 * struct ieee80211_bar - HT Block Ack Request
1032 * 1052 *
@@ -1935,6 +1955,16 @@ enum ieee80211_timeout_interval_type {
1935 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, 1955 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
1936}; 1956};
1937 1957
1958/**
1959 * struct ieee80211_timeout_interval_ie - Timeout Interval element
1960 * @type: type, see &enum ieee80211_timeout_interval_type
1961 * @value: timeout interval value
1962 */
1963struct ieee80211_timeout_interval_ie {
1964 u8 type;
1965 __le32 value;
1966} __packed;
1967
1938/* BACK action code */ 1968/* BACK action code */
1939enum ieee80211_back_actioncode { 1969enum ieee80211_back_actioncode {
1940 WLAN_ACTION_ADDBA_REQ = 0, 1970 WLAN_ACTION_ADDBA_REQ = 0,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bdba9b619064..57870b646974 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1998,6 +1998,10 @@ struct cfg80211_update_ft_ies_params {
1998 * advertise the support for MAC based ACL have to implement this callback. 1998 * advertise the support for MAC based ACL have to implement this callback.
1999 * 1999 *
2000 * @start_radar_detection: Start radar detection in the driver. 2000 * @start_radar_detection: Start radar detection in the driver.
2001 *
2002 * @update_ft_ies: Provide updated Fast BSS Transition information to the
2003 * driver. If the SME is in the driver/firmware, this information can be
2004 * used in building Authentication and Reassociation Request frames.
2001 */ 2005 */
2002struct cfg80211_ops { 2006struct cfg80211_ops {
2003 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2007 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index dd73b8c6746b..64faf015dd1e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -330,8 +330,7 @@ enum ieee80211_rssi_event {
330 * @ssid_len: Length of SSID given in @ssid. 330 * @ssid_len: Length of SSID given in @ssid.
331 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. 331 * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
332 * @txpower: TX power in dBm 332 * @txpower: TX power in dBm
333 * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces 333 * @p2p_noa_attr: P2P NoA attribute for P2P powersave
334 * @p2p_oppps: P2P opportunistic PS is enabled
335 */ 334 */
336struct ieee80211_bss_conf { 335struct ieee80211_bss_conf {
337 const u8 *bssid; 336 const u8 *bssid;
@@ -365,8 +364,7 @@ struct ieee80211_bss_conf {
365 size_t ssid_len; 364 size_t ssid_len;
366 bool hidden_ssid; 365 bool hidden_ssid;
367 int txpower; 366 int txpower;
368 u8 p2p_ctwindow; 367 struct ieee80211_p2p_noa_attr p2p_noa_attr;
369 bool p2p_oppps;
370}; 368};
371 369
372/** 370/**
@@ -976,8 +974,7 @@ enum ieee80211_smps_mode {
976 * @power_level: requested transmit power (in dBm), backward compatibility 974 * @power_level: requested transmit power (in dBm), backward compatibility
977 * value only that is set to the minimum of all interfaces 975 * value only that is set to the minimum of all interfaces
978 * 976 *
979 * @channel: the channel to tune to 977 * @chandef: the channel definition to tune to
980 * @channel_type: the channel (HT) type
981 * @radar_enabled: whether radar detection is enabled 978 * @radar_enabled: whether radar detection is enabled
982 * 979 *
983 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 980 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
@@ -1003,8 +1000,7 @@ struct ieee80211_conf {
1003 1000
1004 u8 long_frame_max_tx_count, short_frame_max_tx_count; 1001 u8 long_frame_max_tx_count, short_frame_max_tx_count;
1005 1002
1006 struct ieee80211_channel *channel; 1003 struct cfg80211_chan_def chandef;
1007 enum nl80211_channel_type channel_type;
1008 bool radar_enabled; 1004 bool radar_enabled;
1009 enum ieee80211_smps_mode smps_mode; 1005 enum ieee80211_smps_mode smps_mode;
1010}; 1006};
@@ -1536,6 +1532,17 @@ enum ieee80211_hw_flags {
1536 * @netdev_features: netdev features to be set in each netdev created 1532 * @netdev_features: netdev features to be set in each netdev created
1537 * from this HW. Note only HW checksum features are currently 1533 * from this HW. Note only HW checksum features are currently
1538 * compatible with mac80211. Other feature bits will be rejected. 1534 * compatible with mac80211. Other feature bits will be rejected.
1535 *
1536 * @uapsd_queues: This bitmap is included in (re)association frame to indicate
1537 * for each access category if it is uAPSD trigger-enabled and delivery-
1538 * enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
1539 * Each bit corresponds to different AC. Value '1' in specific bit means
1540 * that corresponding AC is both trigger- and delivery-enabled. '0' means
1541 * neither enabled.
1542 *
1543 * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
1544 * deliver to a WMM STA during any Service Period triggered by the WMM STA.
1545 * Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
1539 */ 1546 */
1540struct ieee80211_hw { 1547struct ieee80211_hw {
1541 struct ieee80211_conf conf; 1548 struct ieee80211_conf conf;
@@ -1561,6 +1568,8 @@ struct ieee80211_hw {
1561 u8 radiotap_mcs_details; 1568 u8 radiotap_mcs_details;
1562 u16 radiotap_vht_details; 1569 u16 radiotap_vht_details;
1563 netdev_features_t netdev_features; 1570 netdev_features_t netdev_features;
1571 u8 uapsd_queues;
1572 u8 uapsd_max_sp_len;
1564}; 1573};
1565 1574
1566/** 1575/**
@@ -4205,31 +4214,33 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
4205static inline bool 4214static inline bool
4206conf_is_ht20(struct ieee80211_conf *conf) 4215conf_is_ht20(struct ieee80211_conf *conf)
4207{ 4216{
4208 return conf->channel_type == NL80211_CHAN_HT20; 4217 return conf->chandef.width == NL80211_CHAN_WIDTH_20;
4209} 4218}
4210 4219
4211static inline bool 4220static inline bool
4212conf_is_ht40_minus(struct ieee80211_conf *conf) 4221conf_is_ht40_minus(struct ieee80211_conf *conf)
4213{ 4222{
4214 return conf->channel_type == NL80211_CHAN_HT40MINUS; 4223 return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
4224 conf->chandef.center_freq1 < conf->chandef.chan->center_freq;
4215} 4225}
4216 4226
4217static inline bool 4227static inline bool
4218conf_is_ht40_plus(struct ieee80211_conf *conf) 4228conf_is_ht40_plus(struct ieee80211_conf *conf)
4219{ 4229{
4220 return conf->channel_type == NL80211_CHAN_HT40PLUS; 4230 return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
4231 conf->chandef.center_freq1 > conf->chandef.chan->center_freq;
4221} 4232}
4222 4233
4223static inline bool 4234static inline bool
4224conf_is_ht40(struct ieee80211_conf *conf) 4235conf_is_ht40(struct ieee80211_conf *conf)
4225{ 4236{
4226 return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); 4237 return conf->chandef.width == NL80211_CHAN_WIDTH_40;
4227} 4238}
4228 4239
4229static inline bool 4240static inline bool
4230conf_is_ht(struct ieee80211_conf *conf) 4241conf_is_ht(struct ieee80211_conf *conf)
4231{ 4242{
4232 return conf->channel_type != NL80211_CHAN_NO_HT; 4243 return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT;
4233} 4244}
4234 4245
4235static inline enum nl80211_iftype 4246static inline enum nl80211_iftype
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c50c19402588..764dd9a6a072 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -805,8 +805,7 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
805 IEEE80211_CHANCTX_EXCLUSIVE); 805 IEEE80211_CHANCTX_EXCLUSIVE);
806 } 806 }
807 } else if (local->open_count == local->monitors) { 807 } else if (local->open_count == local->monitors) {
808 local->_oper_channel = chandef->chan; 808 local->_oper_chandef = *chandef;
809 local->_oper_channel_type = cfg80211_get_chandef_type(chandef);
810 ieee80211_hw_config(local, 0); 809 ieee80211_hw_config(local, 0);
811 } 810 }
812 811
@@ -965,8 +964,13 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
965 sdata->vif.bss_conf.hidden_ssid = 964 sdata->vif.bss_conf.hidden_ssid =
966 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); 965 (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE);
967 966
968 sdata->vif.bss_conf.p2p_ctwindow = params->p2p_ctwindow; 967 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0,
969 sdata->vif.bss_conf.p2p_oppps = params->p2p_opp_ps; 968 sizeof(sdata->vif.bss_conf.p2p_noa_attr));
969 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow =
970 params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK;
971 if (params->p2p_opp_ps)
972 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
973 IEEE80211_P2P_OPPPS_ENABLE_BIT;
970 974
971 err = ieee80211_assign_beacon(sdata, &params->beacon); 975 err = ieee80211_assign_beacon(sdata, &params->beacon);
972 if (err < 0) 976 if (err < 0)
@@ -1536,7 +1540,6 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
1536 struct ieee80211_sub_if_data *sdata; 1540 struct ieee80211_sub_if_data *sdata;
1537 struct mesh_path *mpath; 1541 struct mesh_path *mpath;
1538 struct sta_info *sta; 1542 struct sta_info *sta;
1539 int err;
1540 1543
1541 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1544 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1542 1545
@@ -1547,17 +1550,12 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
1547 return -ENOENT; 1550 return -ENOENT;
1548 } 1551 }
1549 1552
1550 err = mesh_path_add(sdata, dst); 1553 mpath = mesh_path_add(sdata, dst);
1551 if (err) { 1554 if (IS_ERR(mpath)) {
1552 rcu_read_unlock(); 1555 rcu_read_unlock();
1553 return err; 1556 return PTR_ERR(mpath);
1554 } 1557 }
1555 1558
1556 mpath = mesh_path_lookup(sdata, dst);
1557 if (!mpath) {
1558 rcu_read_unlock();
1559 return -ENXIO;
1560 }
1561 mesh_path_fix_nexthop(mpath, sta); 1559 mesh_path_fix_nexthop(mpath, sta);
1562 1560
1563 rcu_read_unlock(); 1561 rcu_read_unlock();
@@ -1961,12 +1959,20 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1961 } 1959 }
1962 1960
1963 if (params->p2p_ctwindow >= 0) { 1961 if (params->p2p_ctwindow >= 0) {
1964 sdata->vif.bss_conf.p2p_ctwindow = params->p2p_ctwindow; 1962 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow &=
1963 ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK;
1964 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
1965 params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK;
1965 changed |= BSS_CHANGED_P2P_PS; 1966 changed |= BSS_CHANGED_P2P_PS;
1966 } 1967 }
1967 1968
1968 if (params->p2p_opp_ps >= 0) { 1969 if (params->p2p_opp_ps > 0) {
1969 sdata->vif.bss_conf.p2p_oppps = params->p2p_opp_ps; 1970 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |=
1971 IEEE80211_P2P_OPPPS_ENABLE_BIT;
1972 changed |= BSS_CHANGED_P2P_PS;
1973 } else if (params->p2p_opp_ps == 0) {
1974 sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow &=
1975 ~IEEE80211_P2P_OPPPS_ENABLE_BIT;
1970 changed |= BSS_CHANGED_P2P_PS; 1976 changed |= BSS_CHANGED_P2P_PS;
1971 } 1977 }
1972 1978
@@ -3362,9 +3368,7 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
3362 if (local->use_chanctx) 3368 if (local->use_chanctx)
3363 *chandef = local->monitor_chandef; 3369 *chandef = local->monitor_chandef;
3364 else 3370 else
3365 cfg80211_chandef_create(chandef, 3371 *chandef = local->_oper_chandef;
3366 local->_oper_channel,
3367 local->_oper_channel_type);
3368 ret = 0; 3372 ret = 0;
3369 } 3373 }
3370 rcu_read_unlock(); 3374 rcu_read_unlock();
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 931be419ab5a..7d0baa89c784 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -22,7 +22,7 @@ static void ieee80211_change_chanctx(struct ieee80211_local *local,
22 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH); 22 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH);
23 23
24 if (!local->use_chanctx) { 24 if (!local->use_chanctx) {
25 local->_oper_channel_type = cfg80211_get_chandef_type(chandef); 25 local->_oper_chandef = *chandef;
26 ieee80211_hw_config(local, 0); 26 ieee80211_hw_config(local, 0);
27 } 27 }
28} 28}
@@ -85,9 +85,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
85 ieee80211_hw_config(local, changed); 85 ieee80211_hw_config(local, changed);
86 86
87 if (!local->use_chanctx) { 87 if (!local->use_chanctx) {
88 local->_oper_channel_type = 88 local->_oper_chandef = *chandef;
89 cfg80211_get_chandef_type(chandef);
90 local->_oper_channel = chandef->chan;
91 ieee80211_hw_config(local, 0); 89 ieee80211_hw_config(local, 0);
92 } else { 90 } else {
93 err = drv_add_chanctx(local, ctx); 91 err = drv_add_chanctx(local, ctx);
@@ -117,7 +115,10 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local,
117 WARN_ON_ONCE(ctx->refcount != 0); 115 WARN_ON_ONCE(ctx->refcount != 0);
118 116
119 if (!local->use_chanctx) { 117 if (!local->use_chanctx) {
120 local->_oper_channel_type = NL80211_CHAN_NO_HT; 118 struct cfg80211_chan_def *chandef = &local->_oper_chandef;
119 chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
120 chandef->center_freq1 = chandef->chan->center_freq;
121 chandef->center_freq2 = 0;
121 ieee80211_hw_config(local, 0); 122 ieee80211_hw_config(local, 0);
122 } else { 123 } else {
123 drv_remove_chanctx(local, ctx); 124 drv_remove_chanctx(local, ctx);
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index ddb426867904..14abcf44f974 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -124,6 +124,15 @@ static ssize_t ieee80211_if_fmt_##name( \
124 return scnprintf(buf, buflen, "%d\n", sdata->field / 16); \ 124 return scnprintf(buf, buflen, "%d\n", sdata->field / 16); \
125} 125}
126 126
127#define IEEE80211_IF_FMT_JIFFIES_TO_MS(name, field) \
128static ssize_t ieee80211_if_fmt_##name( \
129 const struct ieee80211_sub_if_data *sdata, \
130 char *buf, int buflen) \
131{ \
132 return scnprintf(buf, buflen, "%d\n", \
133 jiffies_to_msecs(sdata->field)); \
134}
135
127#define __IEEE80211_IF_FILE(name, _write) \ 136#define __IEEE80211_IF_FILE(name, _write) \
128static ssize_t ieee80211_if_read_##name(struct file *file, \ 137static ssize_t ieee80211_if_read_##name(struct file *file, \
129 char __user *userbuf, \ 138 char __user *userbuf, \
@@ -197,6 +206,7 @@ IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
197IEEE80211_IF_FILE(aid, u.mgd.aid, DEC); 206IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
198IEEE80211_IF_FILE(last_beacon, u.mgd.last_beacon_signal, DEC); 207IEEE80211_IF_FILE(last_beacon, u.mgd.last_beacon_signal, DEC);
199IEEE80211_IF_FILE(ave_beacon, u.mgd.ave_beacon_signal, DEC_DIV_16); 208IEEE80211_IF_FILE(ave_beacon, u.mgd.ave_beacon_signal, DEC_DIV_16);
209IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
200 210
201static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata, 211static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
202 enum ieee80211_smps_mode smps_mode) 212 enum ieee80211_smps_mode smps_mode)
@@ -542,6 +552,7 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata)
542 DEBUGFS_ADD(aid); 552 DEBUGFS_ADD(aid);
543 DEBUGFS_ADD(last_beacon); 553 DEBUGFS_ADD(last_beacon);
544 DEBUGFS_ADD(ave_beacon); 554 DEBUGFS_ADD(ave_beacon);
555 DEBUGFS_ADD(beacon_timeout);
545 DEBUGFS_ADD_MODE(smps, 0600); 556 DEBUGFS_ADD_MODE(smps, 0600);
546 DEBUGFS_ADD_MODE(tkip_mic_test, 0200); 557 DEBUGFS_ADD_MODE(tkip_mic_test, 0200);
547 DEBUGFS_ADD_MODE(uapsd_queues, 0600); 558 DEBUGFS_ADD_MODE(uapsd_queues, 0600);
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 4f841fe559df..44e201d60a13 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -54,6 +54,7 @@ STA_FILE(aid, sta.aid, D);
54STA_FILE(dev, sdata->name, S); 54STA_FILE(dev, sdata->name, S);
55STA_FILE(last_signal, last_signal, D); 55STA_FILE(last_signal, last_signal, D);
56STA_FILE(last_ack_signal, last_ack_signal, D); 56STA_FILE(last_ack_signal, last_ack_signal, D);
57STA_FILE(beacon_loss_count, beacon_loss_count, D);
57 58
58static ssize_t sta_flags_read(struct file *file, char __user *userbuf, 59static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
59 size_t count, loff_t *ppos) 60 size_t count, loff_t *ppos)
@@ -434,6 +435,7 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
434 DEBUGFS_ADD(agg_status); 435 DEBUGFS_ADD(agg_status);
435 DEBUGFS_ADD(dev); 436 DEBUGFS_ADD(dev);
436 DEBUGFS_ADD(last_signal); 437 DEBUGFS_ADD(last_signal);
438 DEBUGFS_ADD(beacon_loss_count);
437 DEBUGFS_ADD(ht_capa); 439 DEBUGFS_ADD(ht_capa);
438 DEBUGFS_ADD(vht_capa); 440 DEBUGFS_ADD(vht_capa);
439 DEBUGFS_ADD(last_ack_signal); 441 DEBUGFS_ADD(last_ack_signal);
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 539d4a11b47b..2a0b2186d98f 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -44,7 +44,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
44 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 44 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
45 struct ieee80211_local *local = sdata->local; 45 struct ieee80211_local *local = sdata->local;
46 int rates, i; 46 int rates, i;
47 struct sk_buff *skb;
48 struct ieee80211_mgmt *mgmt; 47 struct ieee80211_mgmt *mgmt;
49 u8 *pos; 48 u8 *pos;
50 struct ieee80211_supported_band *sband; 49 struct ieee80211_supported_band *sband;
@@ -52,20 +51,14 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
52 u32 bss_change; 51 u32 bss_change;
53 u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 52 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
54 struct cfg80211_chan_def chandef; 53 struct cfg80211_chan_def chandef;
54 struct beacon_data *presp;
55 int frame_len;
55 56
56 lockdep_assert_held(&ifibss->mtx); 57 lockdep_assert_held(&ifibss->mtx);
57 58
58 /* Reset own TSF to allow time synchronization work. */ 59 /* Reset own TSF to allow time synchronization work. */
59 drv_reset_tsf(local, sdata); 60 drv_reset_tsf(local, sdata);
60 61
61 skb = ifibss->skb;
62 RCU_INIT_POINTER(ifibss->presp, NULL);
63 synchronize_rcu();
64 skb->data = skb->head;
65 skb->len = 0;
66 skb_reset_tail_pointer(skb);
67 skb_reserve(skb, sdata->local->hw.extra_tx_headroom);
68
69 if (!ether_addr_equal(ifibss->bssid, bssid)) 62 if (!ether_addr_equal(ifibss->bssid, bssid))
70 sta_info_flush(sdata); 63 sta_info_flush(sdata);
71 64
@@ -73,10 +66,19 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
73 if (sdata->vif.bss_conf.ibss_joined) { 66 if (sdata->vif.bss_conf.ibss_joined) {
74 sdata->vif.bss_conf.ibss_joined = false; 67 sdata->vif.bss_conf.ibss_joined = false;
75 sdata->vif.bss_conf.ibss_creator = false; 68 sdata->vif.bss_conf.ibss_creator = false;
69 sdata->vif.bss_conf.enable_beacon = false;
76 netif_carrier_off(sdata->dev); 70 netif_carrier_off(sdata->dev);
77 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IBSS); 71 ieee80211_bss_info_change_notify(sdata,
72 BSS_CHANGED_IBSS |
73 BSS_CHANGED_BEACON_ENABLED);
78 } 74 }
79 75
76 presp = rcu_dereference_protected(ifibss->presp,
77 lockdep_is_held(&ifibss->mtx));
78 rcu_assign_pointer(ifibss->presp, NULL);
79 if (presp)
80 kfree_rcu(presp, rcu_head);
81
80 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 82 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
81 83
82 cfg80211_chandef_create(&chandef, chan, ifibss->channel_type); 84 cfg80211_chandef_create(&chandef, chan, ifibss->channel_type);
@@ -98,19 +100,24 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
98 100
99 sband = local->hw.wiphy->bands[chan->band]; 101 sband = local->hw.wiphy->bands[chan->band];
100 102
101 /* build supported rates array */
102 pos = supp_rates;
103 for (i = 0; i < sband->n_bitrates; i++) {
104 int rate = sband->bitrates[i].bitrate;
105 u8 basic = 0;
106 if (basic_rates & BIT(i))
107 basic = 0x80;
108 *pos++ = basic | (u8) (rate / 5);
109 }
110
111 /* Build IBSS probe response */ 103 /* Build IBSS probe response */
112 mgmt = (void *) skb_put(skb, 24 + sizeof(mgmt->u.beacon)); 104 frame_len = sizeof(struct ieee80211_hdr_3addr) +
113 memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); 105 12 /* struct ieee80211_mgmt.u.beacon */ +
106 2 + IEEE80211_MAX_SSID_LEN /* max SSID */ +
107 2 + 8 /* max Supported Rates */ +
108 3 /* max DS params */ +
109 4 /* IBSS params */ +
110 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
111 2 + sizeof(struct ieee80211_ht_cap) +
112 2 + sizeof(struct ieee80211_ht_operation) +
113 ifibss->ie_len;
114 presp = kzalloc(sizeof(*presp) + frame_len, GFP_KERNEL);
115 if (!presp)
116 return;
117
118 presp->head = (void *)(presp + 1);
119
120 mgmt = (void *) presp->head;
114 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 121 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
115 IEEE80211_STYPE_PROBE_RESP); 122 IEEE80211_STYPE_PROBE_RESP);
116 eth_broadcast_addr(mgmt->da); 123 eth_broadcast_addr(mgmt->da);
@@ -120,27 +127,30 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
120 mgmt->u.beacon.timestamp = cpu_to_le64(tsf); 127 mgmt->u.beacon.timestamp = cpu_to_le64(tsf);
121 mgmt->u.beacon.capab_info = cpu_to_le16(capability); 128 mgmt->u.beacon.capab_info = cpu_to_le16(capability);
122 129
123 pos = skb_put(skb, 2 + ifibss->ssid_len); 130 pos = (u8 *)mgmt + offsetof(struct ieee80211_mgmt, u.beacon.variable);
131
124 *pos++ = WLAN_EID_SSID; 132 *pos++ = WLAN_EID_SSID;
125 *pos++ = ifibss->ssid_len; 133 *pos++ = ifibss->ssid_len;
126 memcpy(pos, ifibss->ssid, ifibss->ssid_len); 134 memcpy(pos, ifibss->ssid, ifibss->ssid_len);
135 pos += ifibss->ssid_len;
127 136
128 rates = sband->n_bitrates; 137 rates = min_t(int, 8, sband->n_bitrates);
129 if (rates > 8)
130 rates = 8;
131 pos = skb_put(skb, 2 + rates);
132 *pos++ = WLAN_EID_SUPP_RATES; 138 *pos++ = WLAN_EID_SUPP_RATES;
133 *pos++ = rates; 139 *pos++ = rates;
134 memcpy(pos, supp_rates, rates); 140 for (i = 0; i < rates; i++) {
141 int rate = sband->bitrates[i].bitrate;
142 u8 basic = 0;
143 if (basic_rates & BIT(i))
144 basic = 0x80;
145 *pos++ = basic | (u8) (rate / 5);
146 }
135 147
136 if (sband->band == IEEE80211_BAND_2GHZ) { 148 if (sband->band == IEEE80211_BAND_2GHZ) {
137 pos = skb_put(skb, 2 + 1);
138 *pos++ = WLAN_EID_DS_PARAMS; 149 *pos++ = WLAN_EID_DS_PARAMS;
139 *pos++ = 1; 150 *pos++ = 1;
140 *pos++ = ieee80211_frequency_to_channel(chan->center_freq); 151 *pos++ = ieee80211_frequency_to_channel(chan->center_freq);
141 } 152 }
142 153
143 pos = skb_put(skb, 2 + 2);
144 *pos++ = WLAN_EID_IBSS_PARAMS; 154 *pos++ = WLAN_EID_IBSS_PARAMS;
145 *pos++ = 2; 155 *pos++ = 2;
146 /* FIX: set ATIM window based on scan results */ 156 /* FIX: set ATIM window based on scan results */
@@ -148,23 +158,25 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
148 *pos++ = 0; 158 *pos++ = 0;
149 159
150 if (sband->n_bitrates > 8) { 160 if (sband->n_bitrates > 8) {
151 rates = sband->n_bitrates - 8;
152 pos = skb_put(skb, 2 + rates);
153 *pos++ = WLAN_EID_EXT_SUPP_RATES; 161 *pos++ = WLAN_EID_EXT_SUPP_RATES;
154 *pos++ = rates; 162 *pos++ = sband->n_bitrates - 8;
155 memcpy(pos, &supp_rates[8], rates); 163 for (i = 8; i < sband->n_bitrates; i++) {
164 int rate = sband->bitrates[i].bitrate;
165 u8 basic = 0;
166 if (basic_rates & BIT(i))
167 basic = 0x80;
168 *pos++ = basic | (u8) (rate / 5);
169 }
156 } 170 }
157 171
158 if (ifibss->ie_len) 172 if (ifibss->ie_len) {
159 memcpy(skb_put(skb, ifibss->ie_len), 173 memcpy(pos, ifibss->ie, ifibss->ie_len);
160 ifibss->ie, ifibss->ie_len); 174 pos += ifibss->ie_len;
175 }
161 176
162 /* add HT capability and information IEs */ 177 /* add HT capability and information IEs */
163 if (chandef.width != NL80211_CHAN_WIDTH_20_NOHT && 178 if (chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
164 sband->ht_cap.ht_supported) { 179 sband->ht_cap.ht_supported) {
165 pos = skb_put(skb, 4 +
166 sizeof(struct ieee80211_ht_cap) +
167 sizeof(struct ieee80211_ht_operation));
168 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, 180 pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap,
169 sband->ht_cap.cap); 181 sband->ht_cap.cap);
170 /* 182 /*
@@ -177,7 +189,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
177 } 189 }
178 190
179 if (local->hw.queues >= IEEE80211_NUM_ACS) { 191 if (local->hw.queues >= IEEE80211_NUM_ACS) {
180 pos = skb_put(skb, 9);
181 *pos++ = WLAN_EID_VENDOR_SPECIFIC; 192 *pos++ = WLAN_EID_VENDOR_SPECIFIC;
182 *pos++ = 7; /* len */ 193 *pos++ = 7; /* len */
183 *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */ 194 *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */
@@ -189,7 +200,11 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
189 *pos++ = 0; /* U-APSD no in use */ 200 *pos++ = 0; /* U-APSD no in use */
190 } 201 }
191 202
192 rcu_assign_pointer(ifibss->presp, skb); 203 presp->head_len = pos - presp->head;
204 if (WARN_ON(presp->head_len > frame_len))
205 return;
206
207 rcu_assign_pointer(ifibss->presp, presp);
193 208
194 sdata->vif.bss_conf.enable_beacon = true; 209 sdata->vif.bss_conf.enable_beacon = true;
195 sdata->vif.bss_conf.beacon_int = beacon_int; 210 sdata->vif.bss_conf.beacon_int = beacon_int;
@@ -227,7 +242,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
227 round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); 242 round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL));
228 243
229 bss = cfg80211_inform_bss_frame(local->hw.wiphy, chan, 244 bss = cfg80211_inform_bss_frame(local->hw.wiphy, chan,
230 mgmt, skb->len, 0, GFP_KERNEL); 245 mgmt, presp->head_len, 0, GFP_KERNEL);
231 cfg80211_put_bss(local->hw.wiphy, bss); 246 cfg80211_put_bss(local->hw.wiphy, bss);
232 netif_carrier_on(sdata->dev); 247 netif_carrier_on(sdata->dev);
233 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL); 248 cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL);
@@ -448,7 +463,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
448 struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; 463 struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
449 bool rates_updated = false; 464 bool rates_updated = false;
450 465
451 if (elems->ds_params && elems->ds_params_len == 1) 466 if (elems->ds_params)
452 freq = ieee80211_channel_to_frequency(elems->ds_params[0], 467 freq = ieee80211_channel_to_frequency(elems->ds_params[0],
453 band); 468 band);
454 else 469 else
@@ -822,8 +837,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
822 struct ieee80211_local *local = sdata->local; 837 struct ieee80211_local *local = sdata->local;
823 int tx_last_beacon, len = req->len; 838 int tx_last_beacon, len = req->len;
824 struct sk_buff *skb; 839 struct sk_buff *skb;
825 struct ieee80211_mgmt *resp; 840 struct beacon_data *presp;
826 struct sk_buff *presp;
827 u8 *pos, *end; 841 u8 *pos, *end;
828 842
829 lockdep_assert_held(&ifibss->mtx); 843 lockdep_assert_held(&ifibss->mtx);
@@ -864,13 +878,15 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
864 } 878 }
865 879
866 /* Reply with ProbeResp */ 880 /* Reply with ProbeResp */
867 skb = skb_copy(presp, GFP_KERNEL); 881 skb = dev_alloc_skb(local->tx_headroom + presp->head_len);
868 if (!skb) 882 if (!skb)
869 return; 883 return;
870 884
871 resp = (struct ieee80211_mgmt *) skb->data; 885 skb_reserve(skb, local->tx_headroom);
872 memcpy(resp->da, mgmt->sa, ETH_ALEN); 886 memcpy(skb_put(skb, presp->head_len), presp->head, presp->head_len);
873 ibss_dbg(sdata, "Sending ProbeResp to %pM\n", resp->da); 887
888 memcpy(((struct ieee80211_mgmt *) skb->data)->da, mgmt->sa, ETH_ALEN);
889 ibss_dbg(sdata, "Sending ProbeResp to %pM\n", mgmt->sa);
874 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 890 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
875 ieee80211_tx_skb(sdata, skb); 891 ieee80211_tx_skb(sdata, skb);
876} 892}
@@ -1020,23 +1036,8 @@ void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local)
1020int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1036int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1021 struct cfg80211_ibss_params *params) 1037 struct cfg80211_ibss_params *params)
1022{ 1038{
1023 struct sk_buff *skb;
1024 u32 changed = 0; 1039 u32 changed = 0;
1025 1040
1026 skb = dev_alloc_skb(sdata->local->hw.extra_tx_headroom +
1027 sizeof(struct ieee80211_hdr_3addr) +
1028 12 /* struct ieee80211_mgmt.u.beacon */ +
1029 2 + IEEE80211_MAX_SSID_LEN /* max SSID */ +
1030 2 + 8 /* max Supported Rates */ +
1031 3 /* max DS params */ +
1032 4 /* IBSS params */ +
1033 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
1034 2 + sizeof(struct ieee80211_ht_cap) +
1035 2 + sizeof(struct ieee80211_ht_operation) +
1036 params->ie_len);
1037 if (!skb)
1038 return -ENOMEM;
1039
1040 mutex_lock(&sdata->u.ibss.mtx); 1041 mutex_lock(&sdata->u.ibss.mtx);
1041 1042
1042 if (params->bssid) { 1043 if (params->bssid) {
@@ -1065,7 +1066,6 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1065 sdata->u.ibss.ie_len = params->ie_len; 1066 sdata->u.ibss.ie_len = params->ie_len;
1066 } 1067 }
1067 1068
1068 sdata->u.ibss.skb = skb;
1069 sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; 1069 sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
1070 sdata->u.ibss.ibss_join_req = jiffies; 1070 sdata->u.ibss.ibss_join_req = jiffies;
1071 1071
@@ -1101,13 +1101,13 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1101 1101
1102int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) 1102int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
1103{ 1103{
1104 struct sk_buff *skb;
1105 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 1104 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
1106 struct ieee80211_local *local = sdata->local; 1105 struct ieee80211_local *local = sdata->local;
1107 struct cfg80211_bss *cbss; 1106 struct cfg80211_bss *cbss;
1108 u16 capability; 1107 u16 capability;
1109 int active_ibss; 1108 int active_ibss;
1110 struct sta_info *sta; 1109 struct sta_info *sta;
1110 struct beacon_data *presp;
1111 1111
1112 mutex_lock(&sdata->u.ibss.mtx); 1112 mutex_lock(&sdata->u.ibss.mtx);
1113 1113
@@ -1153,8 +1153,8 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
1153 1153
1154 /* remove beacon */ 1154 /* remove beacon */
1155 kfree(sdata->u.ibss.ie); 1155 kfree(sdata->u.ibss.ie);
1156 skb = rcu_dereference_protected(sdata->u.ibss.presp, 1156 presp = rcu_dereference_protected(ifibss->presp,
1157 lockdep_is_held(&sdata->u.ibss.mtx)); 1157 lockdep_is_held(&sdata->u.ibss.mtx));
1158 RCU_INIT_POINTER(sdata->u.ibss.presp, NULL); 1158 RCU_INIT_POINTER(sdata->u.ibss.presp, NULL);
1159 sdata->vif.bss_conf.ibss_joined = false; 1159 sdata->vif.bss_conf.ibss_joined = false;
1160 sdata->vif.bss_conf.ibss_creator = false; 1160 sdata->vif.bss_conf.ibss_creator = false;
@@ -1163,7 +1163,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
1163 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | 1163 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
1164 BSS_CHANGED_IBSS); 1164 BSS_CHANGED_IBSS);
1165 synchronize_rcu(); 1165 synchronize_rcu();
1166 kfree_skb(skb); 1166 kfree(presp);
1167 1167
1168 skb_queue_purge(&sdata->skb_queue); 1168 skb_queue_purge(&sdata->skb_queue);
1169 1169
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 0b09716d22ad..135ab463cfd9 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -443,7 +443,7 @@ struct ieee80211_if_managed {
443 443
444 u8 use_4addr; 444 u8 use_4addr;
445 445
446 u8 p2p_noa_index; 446 s16 p2p_noa_index;
447 447
448 /* Signal strength from the last Beacon frame in the current BSS. */ 448 /* Signal strength from the last Beacon frame in the current BSS. */
449 int last_beacon_signal; 449 int last_beacon_signal;
@@ -509,8 +509,7 @@ struct ieee80211_if_ibss {
509 509
510 unsigned long ibss_join_req; 510 unsigned long ibss_join_req;
511 /* probe response/beacon for IBSS */ 511 /* probe response/beacon for IBSS */
512 struct sk_buff __rcu *presp; 512 struct beacon_data __rcu *presp;
513 struct sk_buff *skb;
514 513
515 spinlock_t incomplete_lock; 514 spinlock_t incomplete_lock;
516 struct list_head incomplete_stations; 515 struct list_head incomplete_stations;
@@ -1023,8 +1022,7 @@ struct ieee80211_local {
1023 struct ieee80211_sub_if_data __rcu *scan_sdata; 1022 struct ieee80211_sub_if_data __rcu *scan_sdata;
1024 struct ieee80211_channel *csa_channel; 1023 struct ieee80211_channel *csa_channel;
1025 /* For backward compatibility only -- do not use */ 1024 /* For backward compatibility only -- do not use */
1026 struct ieee80211_channel *_oper_channel; 1025 struct cfg80211_chan_def _oper_chandef;
1027 enum nl80211_channel_type _oper_channel_type;
1028 1026
1029 /* Temporary remain-on-channel for off-channel operations */ 1027 /* Temporary remain-on-channel for off-channel operations */
1030 struct ieee80211_channel *tmp_channel; 1028 struct ieee80211_channel *tmp_channel;
@@ -1160,11 +1158,8 @@ struct ieee802_11_elems {
1160 /* pointers to IEs */ 1158 /* pointers to IEs */
1161 const u8 *ssid; 1159 const u8 *ssid;
1162 const u8 *supp_rates; 1160 const u8 *supp_rates;
1163 const u8 *fh_params;
1164 const u8 *ds_params; 1161 const u8 *ds_params;
1165 const u8 *cf_params;
1166 const struct ieee80211_tim_ie *tim; 1162 const struct ieee80211_tim_ie *tim;
1167 const u8 *ibss_params;
1168 const u8 *challenge; 1163 const u8 *challenge;
1169 const u8 *rsn; 1164 const u8 *rsn;
1170 const u8 *erp_info; 1165 const u8 *erp_info;
@@ -1186,21 +1181,15 @@ struct ieee802_11_elems {
1186 const struct ieee80211_channel_sw_ie *ch_switch_ie; 1181 const struct ieee80211_channel_sw_ie *ch_switch_ie;
1187 const u8 *country_elem; 1182 const u8 *country_elem;
1188 const u8 *pwr_constr_elem; 1183 const u8 *pwr_constr_elem;
1189 const u8 *quiet_elem; /* first quite element */ 1184 const struct ieee80211_timeout_interval_ie *timeout_int;
1190 const u8 *timeout_int;
1191 const u8 *opmode_notif; 1185 const u8 *opmode_notif;
1192 1186
1193 /* length of them, respectively */ 1187 /* length of them, respectively */
1194 u8 ssid_len; 1188 u8 ssid_len;
1195 u8 supp_rates_len; 1189 u8 supp_rates_len;
1196 u8 fh_params_len;
1197 u8 ds_params_len;
1198 u8 cf_params_len;
1199 u8 tim_len; 1190 u8 tim_len;
1200 u8 ibss_params_len;
1201 u8 challenge_len; 1191 u8 challenge_len;
1202 u8 rsn_len; 1192 u8 rsn_len;
1203 u8 erp_info_len;
1204 u8 ext_supp_rates_len; 1193 u8 ext_supp_rates_len;
1205 u8 wmm_info_len; 1194 u8 wmm_info_len;
1206 u8 wmm_param_len; 1195 u8 wmm_param_len;
@@ -1210,9 +1199,6 @@ struct ieee802_11_elems {
1210 u8 prep_len; 1199 u8 prep_len;
1211 u8 perr_len; 1200 u8 perr_len;
1212 u8 country_elem_len; 1201 u8 country_elem_len;
1213 u8 quiet_elem_len;
1214 u8 num_of_quiet_elem; /* can be more the one */
1215 u8 timeout_int_len;
1216 1202
1217 /* whether a parse error occurred while retrieving these elements */ 1203 /* whether a parse error occurred while retrieving these elements */
1218 bool parse_error; 1204 bool parse_error;
@@ -1330,7 +1316,8 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
1330void ieee80211_offchannel_return(struct ieee80211_local *local); 1316void ieee80211_offchannel_return(struct ieee80211_local *local);
1331void ieee80211_roc_setup(struct ieee80211_local *local); 1317void ieee80211_roc_setup(struct ieee80211_local *local);
1332void ieee80211_start_next_roc(struct ieee80211_local *local); 1318void ieee80211_start_next_roc(struct ieee80211_local *local);
1333void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); 1319void ieee80211_roc_purge(struct ieee80211_local *local,
1320 struct ieee80211_sub_if_data *sdata);
1334void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free); 1321void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free);
1335void ieee80211_sw_roc_work(struct work_struct *work); 1322void ieee80211_sw_roc_work(struct work_struct *work);
1336void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); 1323void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc);
@@ -1351,6 +1338,8 @@ void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
1351 const int offset); 1338 const int offset);
1352int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); 1339int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
1353void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); 1340void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
1341int ieee80211_add_virtual_monitor(struct ieee80211_local *local);
1342void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
1354 1343
1355bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 1344bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
1356void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 1345void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
@@ -1505,11 +1494,15 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
1505 ieee80211_tx_skb_tid(sdata, skb, 7); 1494 ieee80211_tx_skb_tid(sdata, skb, 7);
1506} 1495}
1507 1496
1508void ieee802_11_parse_elems(u8 *start, size_t len,
1509 struct ieee802_11_elems *elems);
1510u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, 1497u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
1511 struct ieee802_11_elems *elems, 1498 struct ieee802_11_elems *elems,
1512 u64 filter, u32 crc); 1499 u64 filter, u32 crc);
1500static inline void ieee802_11_parse_elems(u8 *start, size_t len,
1501 struct ieee802_11_elems *elems)
1502{
1503 ieee802_11_parse_elems_crc(start, len, elems, 0, 0);
1504}
1505
1513u32 ieee80211_mandatory_rates(struct ieee80211_local *local, 1506u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
1514 enum ieee80211_band band); 1507 enum ieee80211_band band);
1515 1508
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 69aaba79a9f7..146b1320af4e 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Interface handling (except master interface) 2 * Interface handling
3 * 3 *
4 * Copyright 2002-2005, Instant802 Networks, Inc. 4 * Copyright 2002-2005, Instant802 Networks, Inc.
5 * Copyright 2005-2006, Devicescape Software, Inc. 5 * Copyright 2005-2006, Devicescape Software, Inc.
@@ -346,7 +346,7 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata)
346 sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE; 346 sdata->vif.cab_queue = IEEE80211_INVAL_HW_QUEUE;
347} 347}
348 348
349static int ieee80211_add_virtual_monitor(struct ieee80211_local *local) 349int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
350{ 350{
351 struct ieee80211_sub_if_data *sdata; 351 struct ieee80211_sub_if_data *sdata;
352 int ret; 352 int ret;
@@ -399,7 +399,7 @@ static int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
399 return 0; 399 return 0;
400} 400}
401 401
402static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) 402void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
403{ 403{
404 struct ieee80211_sub_if_data *sdata; 404 struct ieee80211_sub_if_data *sdata;
405 405
@@ -584,7 +584,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
584 case NL80211_IFTYPE_P2P_DEVICE: 584 case NL80211_IFTYPE_P2P_DEVICE:
585 break; 585 break;
586 default: 586 default:
587 netif_carrier_on(dev); 587 /* not reached */
588 WARN_ON(1);
588 } 589 }
589 590
590 /* 591 /*
@@ -641,8 +642,28 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
641 642
642 ieee80211_recalc_ps(local, -1); 643 ieee80211_recalc_ps(local, -1);
643 644
644 if (dev) 645 if (dev) {
645 netif_tx_start_all_queues(dev); 646 unsigned long flags;
647 int n_acs = IEEE80211_NUM_ACS;
648 int ac;
649
650 if (local->hw.queues < IEEE80211_NUM_ACS)
651 n_acs = 1;
652
653 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
654 if (sdata->vif.cab_queue == IEEE80211_INVAL_HW_QUEUE ||
655 (local->queue_stop_reasons[sdata->vif.cab_queue] == 0 &&
656 skb_queue_empty(&local->pending[sdata->vif.cab_queue]))) {
657 for (ac = 0; ac < n_acs; ac++) {
658 int ac_queue = sdata->vif.hw_queue[ac];
659
660 if (local->queue_stop_reasons[ac_queue] == 0 &&
661 skb_queue_empty(&local->pending[ac_queue]))
662 netif_start_subqueue(dev, ac);
663 }
664 }
665 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
666 }
646 667
647 return 0; 668 return 0;
648 err_del_interface: 669 err_del_interface:
@@ -696,7 +717,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
696 if (sdata->dev) 717 if (sdata->dev)
697 netif_tx_stop_all_queues(sdata->dev); 718 netif_tx_stop_all_queues(sdata->dev);
698 719
699 ieee80211_roc_purge(sdata); 720 ieee80211_roc_purge(local, sdata);
700 721
701 if (sdata->vif.type == NL80211_IFTYPE_STATION) 722 if (sdata->vif.type == NL80211_IFTYPE_STATION)
702 ieee80211_mgd_stop(sdata); 723 ieee80211_mgd_stop(sdata);
@@ -721,12 +742,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
721 WARN_ON_ONCE((sdata->vif.type != NL80211_IFTYPE_WDS && flushed > 0) || 742 WARN_ON_ONCE((sdata->vif.type != NL80211_IFTYPE_WDS && flushed > 0) ||
722 (sdata->vif.type == NL80211_IFTYPE_WDS && flushed != 1)); 743 (sdata->vif.type == NL80211_IFTYPE_WDS && flushed != 1));
723 744
724 /* 745 /* don't count this interface for promisc/allmulti while it is down */
725 * Don't count this interface for promisc/allmulti while it
726 * is down. dev_mc_unsync() will invoke set_multicast_list
727 * on the master interface which will sync these down to the
728 * hardware as filter flags.
729 */
730 if (sdata->flags & IEEE80211_SDATA_ALLMULTI) 746 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
731 atomic_dec(&local->iff_allmultis); 747 atomic_dec(&local->iff_allmultis);
732 748
@@ -747,8 +763,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
747 sdata->dev->addr_len); 763 sdata->dev->addr_len);
748 spin_unlock_bh(&local->filter_lock); 764 spin_unlock_bh(&local->filter_lock);
749 netif_addr_unlock_bh(sdata->dev); 765 netif_addr_unlock_bh(sdata->dev);
750
751 ieee80211_configure_filter(local);
752 } 766 }
753 767
754 del_timer_sync(&local->dynamic_ps_timer); 768 del_timer_sync(&local->dynamic_ps_timer);
@@ -759,6 +773,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
759 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); 773 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
760 774
761 if (sdata->wdev.cac_started) { 775 if (sdata->wdev.cac_started) {
776 WARN_ON(local->suspended);
762 mutex_lock(&local->iflist_mtx); 777 mutex_lock(&local->iflist_mtx);
763 ieee80211_vif_release_channel(sdata); 778 ieee80211_vif_release_channel(sdata);
764 mutex_unlock(&local->iflist_mtx); 779 mutex_unlock(&local->iflist_mtx);
@@ -809,14 +824,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
809 if (local->monitors == 0) { 824 if (local->monitors == 0) {
810 local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR; 825 local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR;
811 hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; 826 hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR;
812 ieee80211_del_virtual_monitor(local);
813 } 827 }
814 828
815 ieee80211_adjust_monitor_flags(sdata, -1); 829 ieee80211_adjust_monitor_flags(sdata, -1);
816 ieee80211_configure_filter(local);
817 mutex_lock(&local->mtx);
818 ieee80211_recalc_idle(local);
819 mutex_unlock(&local->mtx);
820 break; 830 break;
821 case NL80211_IFTYPE_P2P_DEVICE: 831 case NL80211_IFTYPE_P2P_DEVICE:
822 /* relies on synchronize_rcu() below */ 832 /* relies on synchronize_rcu() below */
@@ -846,27 +856,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
846 /* fall through */ 856 /* fall through */
847 case NL80211_IFTYPE_AP: 857 case NL80211_IFTYPE_AP:
848 skb_queue_purge(&sdata->skb_queue); 858 skb_queue_purge(&sdata->skb_queue);
849
850 if (going_down)
851 drv_remove_interface(local, sdata);
852 } 859 }
853 860
854 sdata->bss = NULL; 861 sdata->bss = NULL;
855 862
856 ieee80211_recalc_ps(local, -1);
857
858 if (local->open_count == 0) {
859 ieee80211_clear_tx_pending(local);
860 ieee80211_stop_device(local);
861
862 /* no reconfiguring after stop! */
863 hw_reconf_flags = 0;
864 }
865
866 /* do after stop to avoid reconfiguring when we stop anyway */
867 if (hw_reconf_flags)
868 ieee80211_hw_config(local, hw_reconf_flags);
869
870 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 863 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
871 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) { 864 for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
872 skb_queue_walk_safe(&local->pending[i], skb, tmp) { 865 skb_queue_walk_safe(&local->pending[i], skb, tmp) {
@@ -879,7 +872,54 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
879 } 872 }
880 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 873 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
881 874
882 if (local->monitors == local->open_count && local->monitors > 0) 875 if (local->open_count == 0)
876 ieee80211_clear_tx_pending(local);
877
878 /*
879 * If the interface goes down while suspended, presumably because
880 * the device was unplugged and that happens before our resume,
881 * then the driver is already unconfigured and the remainder of
882 * this function isn't needed.
883 * XXX: what about WoWLAN? If the device has software state, e.g.
884 * memory allocated, it might expect teardown commands from
885 * mac80211 here?
886 */
887 if (local->suspended) {
888 WARN_ON(local->wowlan);
889 WARN_ON(rtnl_dereference(local->monitor_sdata));
890 return;
891 }
892
893 switch (sdata->vif.type) {
894 case NL80211_IFTYPE_AP_VLAN:
895 break;
896 case NL80211_IFTYPE_MONITOR:
897 if (local->monitors == 0)
898 ieee80211_del_virtual_monitor(local);
899
900 mutex_lock(&local->mtx);
901 ieee80211_recalc_idle(local);
902 mutex_unlock(&local->mtx);
903 break;
904 default:
905 if (going_down)
906 drv_remove_interface(local, sdata);
907 }
908
909 ieee80211_recalc_ps(local, -1);
910
911 if (local->open_count == 0) {
912 ieee80211_stop_device(local);
913
914 /* no reconfiguring after stop! */
915 return;
916 }
917
918 /* do after stop to avoid reconfiguring when we stop anyway */
919 ieee80211_configure_filter(local);
920 ieee80211_hw_config(local, hw_reconf_flags);
921
922 if (local->monitors == local->open_count)
883 ieee80211_add_virtual_monitor(local); 923 ieee80211_add_virtual_monitor(local);
884} 924}
885 925
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index c6f81ecc36a1..52136fd5ba97 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -95,42 +95,47 @@ static void ieee80211_reconfig_filter(struct work_struct *work)
95static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local) 95static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
96{ 96{
97 struct ieee80211_sub_if_data *sdata; 97 struct ieee80211_sub_if_data *sdata;
98 struct ieee80211_channel *chan; 98 struct cfg80211_chan_def chandef = {};
99 u32 changed = 0; 99 u32 changed = 0;
100 int power; 100 int power;
101 enum nl80211_channel_type channel_type;
102 u32 offchannel_flag; 101 u32 offchannel_flag;
103 102
104 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; 103 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
104
105 if (local->scan_channel) { 105 if (local->scan_channel) {
106 chan = local->scan_channel; 106 chandef.chan = local->scan_channel;
107 /* If scanning on oper channel, use whatever channel-type 107 /* If scanning on oper channel, use whatever channel-type
108 * is currently in use. 108 * is currently in use.
109 */ 109 */
110 if (chan == local->_oper_channel) 110 if (chandef.chan == local->_oper_chandef.chan) {
111 channel_type = local->_oper_channel_type; 111 chandef = local->_oper_chandef;
112 else 112 } else {
113 channel_type = NL80211_CHAN_NO_HT; 113 chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
114 chandef.center_freq1 = chandef.chan->center_freq;
115 }
114 } else if (local->tmp_channel) { 116 } else if (local->tmp_channel) {
115 chan = local->tmp_channel; 117 chandef.chan = local->tmp_channel;
116 channel_type = NL80211_CHAN_NO_HT; 118 chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
117 } else { 119 chandef.center_freq1 = chandef.chan->center_freq;
118 chan = local->_oper_channel; 120 } else
119 channel_type = local->_oper_channel_type; 121 chandef = local->_oper_chandef;
120 } 122
121 123 WARN(!cfg80211_chandef_valid(&chandef),
122 if (chan != local->_oper_channel || 124 "control:%d MHz width:%d center: %d/%d MHz",
123 channel_type != local->_oper_channel_type) 125 chandef.chan->center_freq, chandef.width,
126 chandef.center_freq1, chandef.center_freq2);
127
128 if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef))
124 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; 129 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
125 else 130 else
126 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL; 131 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
127 132
128 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; 133 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
129 134
130 if (offchannel_flag || chan != local->hw.conf.channel || 135 if (offchannel_flag ||
131 channel_type != local->hw.conf.channel_type) { 136 !cfg80211_chandef_identical(&local->hw.conf.chandef,
132 local->hw.conf.channel = chan; 137 &local->_oper_chandef)) {
133 local->hw.conf.channel_type = channel_type; 138 local->hw.conf.chandef = chandef;
134 changed |= IEEE80211_CONF_CHANGE_CHANNEL; 139 changed |= IEEE80211_CONF_CHANGE_CHANNEL;
135 } 140 }
136 141
@@ -146,7 +151,7 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
146 changed |= IEEE80211_CONF_CHANGE_SMPS; 151 changed |= IEEE80211_CONF_CHANGE_SMPS;
147 } 152 }
148 153
149 power = chan->max_power; 154 power = chandef.chan->max_power;
150 155
151 rcu_read_lock(); 156 rcu_read_lock();
152 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 157 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
@@ -587,6 +592,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
587 IEEE80211_RADIOTAP_MCS_HAVE_BW; 592 IEEE80211_RADIOTAP_MCS_HAVE_BW;
588 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | 593 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
589 IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH; 594 IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
595 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
596 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
590 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; 597 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
591 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; 598 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
592 wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask; 599 wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
@@ -738,11 +745,15 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
738 sband = local->hw.wiphy->bands[band]; 745 sband = local->hw.wiphy->bands[band];
739 if (!sband) 746 if (!sband)
740 continue; 747 continue;
741 if (!local->use_chanctx && !local->_oper_channel) { 748 if (!local->use_chanctx && !local->_oper_chandef.chan) {
742 /* init channel we're on */ 749 /* init channel we're on */
743 local->hw.conf.channel = 750 struct cfg80211_chan_def chandef = {
744 local->_oper_channel = &sband->channels[0]; 751 .chan = &sband->channels[0],
745 local->hw.conf.channel_type = NL80211_CHAN_NO_HT; 752 .width = NL80211_CHAN_NO_HT,
753 .center_freq1 = sband->channels[0].center_freq,
754 .center_freq2 = 0
755 };
756 local->hw.conf.chandef = local->_oper_chandef = chandef;
746 } 757 }
747 cfg80211_chandef_create(&local->monitor_chandef, 758 cfg80211_chandef_create(&local->monitor_chandef,
748 &sband->channels[0], 759 &sband->channels[0],
@@ -829,22 +840,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
829 if (supp_ht) 840 if (supp_ht)
830 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap); 841 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
831 842
832 if (supp_vht) { 843 if (supp_vht)
833 local->scan_ies_len += 844 local->scan_ies_len +=
834 2 + sizeof(struct ieee80211_vht_cap); 845 2 + sizeof(struct ieee80211_vht_cap);
835 846
836 /*
837 * (for now at least), drivers wanting to use VHT must
838 * support channel contexts, as they contain all the
839 * necessary VHT information and the global hw config
840 * doesn't (yet)
841 */
842 if (WARN_ON(!local->use_chanctx)) {
843 result = -EINVAL;
844 goto fail_wiphy_register;
845 }
846 }
847
848 if (!local->ops->hw_scan) { 847 if (!local->ops->hw_scan) {
849 /* For hw_scan, driver needs to set these up. */ 848 /* For hw_scan, driver needs to set these up. */
850 local->hw.wiphy->max_scan_ssids = 4; 849 local->hw.wiphy->max_scan_ssids = 4;
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 123a300cef57..fd1024ef393b 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -907,7 +907,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
907 (!elems.rsn && sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE)) 907 (!elems.rsn && sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE))
908 return; 908 return;
909 909
910 if (elems.ds_params && elems.ds_params_len == 1) 910 if (elems.ds_params)
911 freq = ieee80211_channel_to_frequency(elems.ds_params[0], band); 911 freq = ieee80211_channel_to_frequency(elems.ds_params[0], band);
912 else 912 else
913 freq = rx_status->freq; 913 freq = rx_status->freq;
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 6ffabbe99c46..da158774eebb 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -275,7 +275,8 @@ void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop);
275void mesh_path_expire(struct ieee80211_sub_if_data *sdata); 275void mesh_path_expire(struct ieee80211_sub_if_data *sdata);
276void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata, 276void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,
277 struct ieee80211_mgmt *mgmt, size_t len); 277 struct ieee80211_mgmt *mgmt, size_t len);
278int mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst); 278struct mesh_path *
279mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst);
279 280
280int mesh_path_add_gate(struct mesh_path *mpath); 281int mesh_path_add_gate(struct mesh_path *mpath);
281int mesh_path_send_to_gates(struct mesh_path *mpath); 282int mesh_path_send_to_gates(struct mesh_path *mpath);
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index bdb8d3b14587..c82d5e6a24c0 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -144,7 +144,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
144 *pos++ = WLAN_EID_PREQ; 144 *pos++ = WLAN_EID_PREQ;
145 break; 145 break;
146 case MPATH_PREP: 146 case MPATH_PREP:
147 mhwmp_dbg(sdata, "sending PREP to %pM\n", target); 147 mhwmp_dbg(sdata, "sending PREP to %pM\n", orig_addr);
148 ie_len = 31; 148 ie_len = 31;
149 pos = skb_put(skb, 2 + ie_len); 149 pos = skb_put(skb, 2 + ie_len);
150 *pos++ = WLAN_EID_PREP; 150 *pos++ = WLAN_EID_PREP;
@@ -445,9 +445,8 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
445 } 445 }
446 } 446 }
447 } else { 447 } else {
448 mesh_path_add(sdata, orig_addr); 448 mpath = mesh_path_add(sdata, orig_addr);
449 mpath = mesh_path_lookup(sdata, orig_addr); 449 if (IS_ERR(mpath)) {
450 if (!mpath) {
451 rcu_read_unlock(); 450 rcu_read_unlock();
452 return 0; 451 return 0;
453 } 452 }
@@ -486,9 +485,8 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
486 (last_hop_metric > mpath->metric))) 485 (last_hop_metric > mpath->metric)))
487 fresh_info = false; 486 fresh_info = false;
488 } else { 487 } else {
489 mesh_path_add(sdata, ta); 488 mpath = mesh_path_add(sdata, ta);
490 mpath = mesh_path_lookup(sdata, ta); 489 if (IS_ERR(mpath)) {
491 if (!mpath) {
492 rcu_read_unlock(); 490 rcu_read_unlock();
493 return 0; 491 return 0;
494 } 492 }
@@ -661,7 +659,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
661 u32 target_sn, orig_sn, lifetime; 659 u32 target_sn, orig_sn, lifetime;
662 660
663 mhwmp_dbg(sdata, "received PREP from %pM\n", 661 mhwmp_dbg(sdata, "received PREP from %pM\n",
664 PREP_IE_ORIG_ADDR(prep_elem)); 662 PREP_IE_TARGET_ADDR(prep_elem));
665 663
666 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 664 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
667 if (ether_addr_equal(orig_addr, sdata->vif.addr)) 665 if (ether_addr_equal(orig_addr, sdata->vif.addr))
@@ -804,9 +802,8 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
804 802
805 mpath = mesh_path_lookup(sdata, orig_addr); 803 mpath = mesh_path_lookup(sdata, orig_addr);
806 if (!mpath) { 804 if (!mpath) {
807 mesh_path_add(sdata, orig_addr); 805 mpath = mesh_path_add(sdata, orig_addr);
808 mpath = mesh_path_lookup(sdata, orig_addr); 806 if (IS_ERR(mpath)) {
809 if (!mpath) {
810 rcu_read_unlock(); 807 rcu_read_unlock();
811 sdata->u.mesh.mshstats.dropped_frames_no_route++; 808 sdata->u.mesh.mshstats.dropped_frames_no_route++;
812 return; 809 return;
@@ -1098,11 +1095,10 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
1098 /* no nexthop found, start resolving */ 1095 /* no nexthop found, start resolving */
1099 mpath = mesh_path_lookup(sdata, target_addr); 1096 mpath = mesh_path_lookup(sdata, target_addr);
1100 if (!mpath) { 1097 if (!mpath) {
1101 mesh_path_add(sdata, target_addr); 1098 mpath = mesh_path_add(sdata, target_addr);
1102 mpath = mesh_path_lookup(sdata, target_addr); 1099 if (IS_ERR(mpath)) {
1103 if (!mpath) {
1104 mesh_path_discard_frame(sdata, skb); 1100 mesh_path_discard_frame(sdata, skb);
1105 err = -ENOSPC; 1101 err = PTR_ERR(mpath);
1106 goto endlookup; 1102 goto endlookup;
1107 } 1103 }
1108 } 1104 }
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index dc7c8df40c2c..89aacfd2756d 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -493,7 +493,8 @@ int mesh_gate_num(struct ieee80211_sub_if_data *sdata)
493 * 493 *
494 * State: the initial state of the new path is set to 0 494 * State: the initial state of the new path is set to 0
495 */ 495 */
496int mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst) 496struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata,
497 const u8 *dst)
497{ 498{
498 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 499 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
499 struct ieee80211_local *local = sdata->local; 500 struct ieee80211_local *local = sdata->local;
@@ -502,18 +503,33 @@ int mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst)
502 struct mpath_node *node, *new_node; 503 struct mpath_node *node, *new_node;
503 struct hlist_head *bucket; 504 struct hlist_head *bucket;
504 int grow = 0; 505 int grow = 0;
505 int err = 0; 506 int err;
506 u32 hash_idx; 507 u32 hash_idx;
507 508
508 if (ether_addr_equal(dst, sdata->vif.addr)) 509 if (ether_addr_equal(dst, sdata->vif.addr))
509 /* never add ourselves as neighbours */ 510 /* never add ourselves as neighbours */
510 return -ENOTSUPP; 511 return ERR_PTR(-ENOTSUPP);
511 512
512 if (is_multicast_ether_addr(dst)) 513 if (is_multicast_ether_addr(dst))
513 return -ENOTSUPP; 514 return ERR_PTR(-ENOTSUPP);
514 515
515 if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0) 516 if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0)
516 return -ENOSPC; 517 return ERR_PTR(-ENOSPC);
518
519 read_lock_bh(&pathtbl_resize_lock);
520 tbl = resize_dereference_mesh_paths();
521
522 hash_idx = mesh_table_hash(dst, sdata, tbl);
523 bucket = &tbl->hash_buckets[hash_idx];
524
525 spin_lock(&tbl->hashwlock[hash_idx]);
526
527 hlist_for_each_entry(node, bucket, list) {
528 mpath = node->mpath;
529 if (mpath->sdata == sdata &&
530 ether_addr_equal(dst, mpath->dst))
531 goto found;
532 }
517 533
518 err = -ENOMEM; 534 err = -ENOMEM;
519 new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC); 535 new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC);
@@ -524,7 +540,6 @@ int mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst)
524 if (!new_node) 540 if (!new_node)
525 goto err_node_alloc; 541 goto err_node_alloc;
526 542
527 read_lock_bh(&pathtbl_resize_lock);
528 memcpy(new_mpath->dst, dst, ETH_ALEN); 543 memcpy(new_mpath->dst, dst, ETH_ALEN);
529 eth_broadcast_addr(new_mpath->rann_snd_addr); 544 eth_broadcast_addr(new_mpath->rann_snd_addr);
530 new_mpath->is_root = false; 545 new_mpath->is_root = false;
@@ -538,21 +553,6 @@ int mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst)
538 spin_lock_init(&new_mpath->state_lock); 553 spin_lock_init(&new_mpath->state_lock);
539 init_timer(&new_mpath->timer); 554 init_timer(&new_mpath->timer);
540 555
541 tbl = resize_dereference_mesh_paths();
542
543 hash_idx = mesh_table_hash(dst, sdata, tbl);
544 bucket = &tbl->hash_buckets[hash_idx];
545
546 spin_lock(&tbl->hashwlock[hash_idx]);
547
548 err = -EEXIST;
549 hlist_for_each_entry(node, bucket, list) {
550 mpath = node->mpath;
551 if (mpath->sdata == sdata &&
552 ether_addr_equal(dst, mpath->dst))
553 goto err_exists;
554 }
555
556 hlist_add_head_rcu(&new_node->list, bucket); 556 hlist_add_head_rcu(&new_node->list, bucket);
557 if (atomic_inc_return(&tbl->entries) >= 557 if (atomic_inc_return(&tbl->entries) >=
558 tbl->mean_chain_len * (tbl->hash_mask + 1)) 558 tbl->mean_chain_len * (tbl->hash_mask + 1))
@@ -560,23 +560,23 @@ int mesh_path_add(struct ieee80211_sub_if_data *sdata, const u8 *dst)
560 560
561 mesh_paths_generation++; 561 mesh_paths_generation++;
562 562
563 spin_unlock(&tbl->hashwlock[hash_idx]);
564 read_unlock_bh(&pathtbl_resize_lock);
565 if (grow) { 563 if (grow) {
566 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags); 564 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags);
567 ieee80211_queue_work(&local->hw, &sdata->work); 565 ieee80211_queue_work(&local->hw, &sdata->work);
568 } 566 }
569 return 0; 567 mpath = new_mpath;
570 568found:
571err_exists:
572 spin_unlock(&tbl->hashwlock[hash_idx]); 569 spin_unlock(&tbl->hashwlock[hash_idx]);
573 read_unlock_bh(&pathtbl_resize_lock); 570 read_unlock_bh(&pathtbl_resize_lock);
574 kfree(new_node); 571 return mpath;
572
575err_node_alloc: 573err_node_alloc:
576 kfree(new_mpath); 574 kfree(new_mpath);
577err_path_alloc: 575err_path_alloc:
578 atomic_dec(&sdata->u.mesh.mpaths); 576 atomic_dec(&sdata->u.mesh.mpaths);
579 return err; 577 spin_unlock(&tbl->hashwlock[hash_idx]);
578 read_unlock_bh(&pathtbl_resize_lock);
579 return ERR_PTR(err);
580} 580}
581 581
582static void mesh_table_free_rcu(struct rcu_head *rcu) 582static void mesh_table_free_rcu(struct rcu_head *rcu)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e06dbbf8cb4c..9c4968938472 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -56,7 +56,10 @@ MODULE_PARM_DESC(max_probe_tries,
56 * probe on beacon miss before declaring the connection lost 56 * probe on beacon miss before declaring the connection lost
57 * default to what we want. 57 * default to what we want.
58 */ 58 */
59#define IEEE80211_BEACON_LOSS_COUNT 7 59static int beacon_loss_count = 7;
60module_param(beacon_loss_count, int, 0644);
61MODULE_PARM_DESC(beacon_loss_count,
62 "Number of beacon intervals before we decide beacon was lost.");
60 63
61/* 64/*
62 * Time the connection can be idle before we probe 65 * Time the connection can be idle before we probe
@@ -985,6 +988,7 @@ static void ieee80211_chswitch_work(struct work_struct *work)
985{ 988{
986 struct ieee80211_sub_if_data *sdata = 989 struct ieee80211_sub_if_data *sdata =
987 container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work); 990 container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work);
991 struct ieee80211_local *local = sdata->local;
988 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 992 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
989 993
990 if (!ieee80211_sdata_running(sdata)) 994 if (!ieee80211_sdata_running(sdata))
@@ -994,21 +998,30 @@ static void ieee80211_chswitch_work(struct work_struct *work)
994 if (!ifmgd->associated) 998 if (!ifmgd->associated)
995 goto out; 999 goto out;
996 1000
997 sdata->local->_oper_channel = sdata->local->csa_channel; 1001 /*
998 if (!sdata->local->ops->channel_switch) { 1002 * FIXME: Here we are downgrading to NL80211_CHAN_WIDTH_20_NOHT
1003 * and don't adjust our ht/vht settings
1004 * This is wrong - we should behave according to the CSA params
1005 */
1006 local->_oper_chandef.chan = local->csa_channel;
1007 local->_oper_chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
1008 local->_oper_chandef.center_freq1 =
1009 local->_oper_chandef.chan->center_freq;
1010 local->_oper_chandef.center_freq2 = 0;
1011
1012 if (!local->ops->channel_switch) {
999 /* call "hw_config" only if doing sw channel switch */ 1013 /* call "hw_config" only if doing sw channel switch */
1000 ieee80211_hw_config(sdata->local, 1014 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
1001 IEEE80211_CONF_CHANGE_CHANNEL);
1002 } else { 1015 } else {
1003 /* update the device channel directly */ 1016 /* update the device channel directly */
1004 sdata->local->hw.conf.channel = sdata->local->_oper_channel; 1017 local->hw.conf.chandef = local->_oper_chandef;
1005 } 1018 }
1006 1019
1007 /* XXX: shouldn't really modify cfg80211-owned data! */ 1020 /* XXX: shouldn't really modify cfg80211-owned data! */
1008 ifmgd->associated->channel = sdata->local->_oper_channel; 1021 ifmgd->associated->channel = local->_oper_chandef.chan;
1009 1022
1010 /* XXX: wait for a beacon first? */ 1023 /* XXX: wait for a beacon first? */
1011 ieee80211_wake_queues_by_reason(&sdata->local->hw, 1024 ieee80211_wake_queues_by_reason(&local->hw,
1012 IEEE80211_MAX_QUEUE_MAP, 1025 IEEE80211_MAX_QUEUE_MAP,
1013 IEEE80211_QUEUE_STOP_REASON_CSA); 1026 IEEE80211_QUEUE_STOP_REASON_CSA);
1014 out: 1027 out:
@@ -1430,13 +1443,11 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
1430 1443
1431 if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && 1444 if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
1432 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { 1445 !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) {
1433 netif_tx_stop_all_queues(sdata->dev); 1446 if (drv_tx_frames_pending(local)) {
1434
1435 if (drv_tx_frames_pending(local))
1436 mod_timer(&local->dynamic_ps_timer, jiffies + 1447 mod_timer(&local->dynamic_ps_timer, jiffies +
1437 msecs_to_jiffies( 1448 msecs_to_jiffies(
1438 local->hw.conf.dynamic_ps_timeout)); 1449 local->hw.conf.dynamic_ps_timeout));
1439 else { 1450 } else {
1440 ieee80211_send_nullfunc(local, sdata, 1); 1451 ieee80211_send_nullfunc(local, sdata, 1);
1441 /* Flush to get the tx status of nullfunc frame */ 1452 /* Flush to get the tx status of nullfunc frame */
1442 ieee80211_flush_queues(local, sdata); 1453 ieee80211_flush_queues(local, sdata);
@@ -1450,9 +1461,6 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
1450 local->hw.conf.flags |= IEEE80211_CONF_PS; 1461 local->hw.conf.flags |= IEEE80211_CONF_PS;
1451 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); 1462 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
1452 } 1463 }
1453
1454 if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
1455 netif_tx_wake_all_queues(sdata->dev);
1456} 1464}
1457 1465
1458void ieee80211_dynamic_ps_timer(unsigned long data) 1466void ieee80211_dynamic_ps_timer(unsigned long data)
@@ -1645,7 +1653,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1645 bss_conf->assoc_capability, bss->has_erp_value, bss->erp_value); 1653 bss_conf->assoc_capability, bss->has_erp_value, bss->erp_value);
1646 1654
1647 sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec( 1655 sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec(
1648 IEEE80211_BEACON_LOSS_COUNT * bss_conf->beacon_int)); 1656 beacon_loss_count * bss_conf->beacon_int));
1649 1657
1650 sdata->u.mgd.associated = cbss; 1658 sdata->u.mgd.associated = cbss;
1651 memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN); 1659 memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN);
@@ -1658,18 +1666,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1658 rcu_read_lock(); 1666 rcu_read_lock();
1659 ies = rcu_dereference(cbss->ies); 1667 ies = rcu_dereference(cbss->ies);
1660 if (ies) { 1668 if (ies) {
1661 u8 noa[2];
1662 int ret; 1669 int ret;
1663 1670
1664 ret = cfg80211_get_p2p_attr( 1671 ret = cfg80211_get_p2p_attr(
1665 ies->data, ies->len, 1672 ies->data, ies->len,
1666 IEEE80211_P2P_ATTR_ABSENCE_NOTICE, 1673 IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
1667 noa, sizeof(noa)); 1674 (u8 *) &bss_conf->p2p_noa_attr,
1675 sizeof(bss_conf->p2p_noa_attr));
1668 if (ret >= 2) { 1676 if (ret >= 2) {
1669 bss_conf->p2p_oppps = noa[1] & 0x80; 1677 sdata->u.mgd.p2p_noa_index =
1670 bss_conf->p2p_ctwindow = noa[1] & 0x7f; 1678 bss_conf->p2p_noa_attr.index;
1671 bss_info_changed |= BSS_CHANGED_P2P_PS; 1679 bss_info_changed |= BSS_CHANGED_P2P_PS;
1672 sdata->u.mgd.p2p_noa_index = noa[0];
1673 } 1680 }
1674 } 1681 }
1675 rcu_read_unlock(); 1682 rcu_read_unlock();
@@ -1713,7 +1720,6 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1713 ieee80211_recalc_smps(sdata); 1720 ieee80211_recalc_smps(sdata);
1714 ieee80211_recalc_ps_vif(sdata); 1721 ieee80211_recalc_ps_vif(sdata);
1715 1722
1716 netif_tx_start_all_queues(sdata->dev);
1717 netif_carrier_on(sdata->dev); 1723 netif_carrier_on(sdata->dev);
1718} 1724}
1719 1725
@@ -1736,22 +1742,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1736 ieee80211_stop_poll(sdata); 1742 ieee80211_stop_poll(sdata);
1737 1743
1738 ifmgd->associated = NULL; 1744 ifmgd->associated = NULL;
1739
1740 /*
1741 * we need to commit the associated = NULL change because the
1742 * scan code uses that to determine whether this iface should
1743 * go to/wake up from powersave or not -- and could otherwise
1744 * wake the queues erroneously.
1745 */
1746 smp_mb();
1747
1748 /*
1749 * Thus, we can only afterwards stop the queues -- to account
1750 * for the case where another CPU is finishing a scan at this
1751 * time -- we don't want the scan code to enable queues.
1752 */
1753
1754 netif_tx_stop_all_queues(sdata->dev);
1755 netif_carrier_off(sdata->dev); 1745 netif_carrier_off(sdata->dev);
1756 1746
1757 /* 1747 /*
@@ -1794,8 +1784,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1794 changed |= BSS_CHANGED_ASSOC; 1784 changed |= BSS_CHANGED_ASSOC;
1795 sdata->vif.bss_conf.assoc = false; 1785 sdata->vif.bss_conf.assoc = false;
1796 1786
1797 sdata->vif.bss_conf.p2p_ctwindow = 0; 1787 ifmgd->p2p_noa_index = -1;
1798 sdata->vif.bss_conf.p2p_oppps = false; 1788 memset(&sdata->vif.bss_conf.p2p_noa_attr, 0,
1789 sizeof(sdata->vif.bss_conf.p2p_noa_attr));
1799 1790
1800 /* on the next assoc, re-program HT/VHT parameters */ 1791 /* on the next assoc, re-program HT/VHT parameters */
1801 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); 1792 memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa));
@@ -1975,12 +1966,15 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
1975 goto out; 1966 goto out;
1976 } 1967 }
1977 1968
1978 if (beacon) 1969 if (beacon) {
1979 mlme_dbg_ratelimited(sdata, 1970 mlme_dbg_ratelimited(sdata,
1980 "detected beacon loss from AP - probing\n"); 1971 "detected beacon loss from AP (missed %d beacons) - probing\n",
1972 beacon_loss_count);
1981 1973
1982 ieee80211_cqm_rssi_notify(&sdata->vif, 1974 ieee80211_cqm_rssi_notify(&sdata->vif,
1983 NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL); 1975 NL80211_CQM_RSSI_BEACON_LOSS_EVENT,
1976 GFP_KERNEL);
1977 }
1984 1978
1985 /* 1979 /*
1986 * The driver/our work has already reported this event or the 1980 * The driver/our work has already reported this event or the
@@ -2613,10 +2607,10 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2613 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 2607 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
2614 2608
2615 if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY && 2609 if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY &&
2616 elems.timeout_int && elems.timeout_int_len == 5 && 2610 elems.timeout_int &&
2617 elems.timeout_int[0] == WLAN_TIMEOUT_ASSOC_COMEBACK) { 2611 elems.timeout_int->type == WLAN_TIMEOUT_ASSOC_COMEBACK) {
2618 u32 tu, ms; 2612 u32 tu, ms;
2619 tu = get_unaligned_le32(elems.timeout_int + 1); 2613 tu = le32_to_cpu(elems.timeout_int->value);
2620 ms = tu * 1024 / 1000; 2614 ms = tu * 1024 / 1000;
2621 sdata_info(sdata, 2615 sdata_info(sdata,
2622 "%pM rejected association temporarily; comeback duration %u TU (%u ms)\n", 2616 "%pM rejected association temporarily; comeback duration %u TU (%u ms)\n",
@@ -2679,7 +2673,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2679 } 2673 }
2680 } 2674 }
2681 2675
2682 if (elems->ds_params && elems->ds_params_len == 1) 2676 if (elems->ds_params)
2683 freq = ieee80211_channel_to_frequency(elems->ds_params[0], 2677 freq = ieee80211_channel_to_frequency(elems->ds_params[0],
2684 rx_status->band); 2678 rx_status->band);
2685 else 2679 else
@@ -2957,22 +2951,30 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2957 } 2951 }
2958 2952
2959 if (sdata->vif.p2p) { 2953 if (sdata->vif.p2p) {
2960 u8 noa[2]; 2954 struct ieee80211_p2p_noa_attr noa = {};
2961 int ret; 2955 int ret;
2962 2956
2963 ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable, 2957 ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable,
2964 len - baselen, 2958 len - baselen,
2965 IEEE80211_P2P_ATTR_ABSENCE_NOTICE, 2959 IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
2966 noa, sizeof(noa)); 2960 (u8 *) &noa, sizeof(noa));
2967 if (ret >= 2 && sdata->u.mgd.p2p_noa_index != noa[0]) { 2961 if (ret >= 2) {
2968 bss_conf->p2p_oppps = noa[1] & 0x80; 2962 if (sdata->u.mgd.p2p_noa_index != noa.index) {
2969 bss_conf->p2p_ctwindow = noa[1] & 0x7f; 2963 /* valid noa_attr and index changed */
2964 sdata->u.mgd.p2p_noa_index = noa.index;
2965 memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa));
2966 changed |= BSS_CHANGED_P2P_PS;
2967 /*
2968 * make sure we update all information, the CRC
2969 * mechanism doesn't look at P2P attributes.
2970 */
2971 ifmgd->beacon_crc_valid = false;
2972 }
2973 } else if (sdata->u.mgd.p2p_noa_index != -1) {
2974 /* noa_attr not found and we had valid noa_attr before */
2975 sdata->u.mgd.p2p_noa_index = -1;
2976 memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr));
2970 changed |= BSS_CHANGED_P2P_PS; 2977 changed |= BSS_CHANGED_P2P_PS;
2971 sdata->u.mgd.p2p_noa_index = noa[0];
2972 /*
2973 * make sure we update all information, the CRC
2974 * mechanism doesn't look at P2P attributes.
2975 */
2976 ifmgd->beacon_crc_valid = false; 2978 ifmgd->beacon_crc_valid = false;
2977 } 2979 }
2978 } 2980 }
@@ -3014,7 +3016,7 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
3014 changed |= BSS_CHANGED_DTIM_PERIOD; 3016 changed |= BSS_CHANGED_DTIM_PERIOD;
3015 } 3017 }
3016 3018
3017 if (elems.erp_info && elems.erp_info_len >= 1) { 3019 if (elems.erp_info) {
3018 erp_valid = true; 3020 erp_valid = true;
3019 erp_value = elems.erp_info[0]; 3021 erp_value = elems.erp_info[0];
3020 } else { 3022 } else {
@@ -3513,8 +3515,9 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
3513 3515
3514 ifmgd->flags = 0; 3516 ifmgd->flags = 0;
3515 ifmgd->powersave = sdata->wdev.ps; 3517 ifmgd->powersave = sdata->wdev.ps;
3516 ifmgd->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; 3518 ifmgd->uapsd_queues = sdata->local->hw.uapsd_queues;
3517 ifmgd->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; 3519 ifmgd->uapsd_max_sp_len = sdata->local->hw.uapsd_max_sp_len;
3520 ifmgd->p2p_noa_index = -1;
3518 3521
3519 mutex_init(&ifmgd->mtx); 3522 mutex_init(&ifmgd->mtx);
3520 3523
@@ -4063,7 +4066,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
4063 rcu_read_unlock(); 4066 rcu_read_unlock();
4064 4067
4065 if (bss->wmm_used && bss->uapsd_supported && 4068 if (bss->wmm_used && bss->uapsd_supported &&
4066 (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) { 4069 (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) &&
4070 sdata->wmm_acm != 0xff) {
4067 assoc_data->uapsd = true; 4071 assoc_data->uapsd = true;
4068 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; 4072 ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED;
4069 } else { 4073 } else {
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index cce795871ab1..acd1f71adc03 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -445,15 +445,15 @@ void ieee80211_roc_setup(struct ieee80211_local *local)
445 INIT_LIST_HEAD(&local->roc_list); 445 INIT_LIST_HEAD(&local->roc_list);
446} 446}
447 447
448void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata) 448void ieee80211_roc_purge(struct ieee80211_local *local,
449 struct ieee80211_sub_if_data *sdata)
449{ 450{
450 struct ieee80211_local *local = sdata->local;
451 struct ieee80211_roc_work *roc, *tmp; 451 struct ieee80211_roc_work *roc, *tmp;
452 LIST_HEAD(tmp_list); 452 LIST_HEAD(tmp_list);
453 453
454 mutex_lock(&local->mtx); 454 mutex_lock(&local->mtx);
455 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { 455 list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
456 if (roc->sdata != sdata) 456 if (sdata && roc->sdata != sdata)
457 continue; 457 continue;
458 458
459 if (roc->started && local->ops->remain_on_channel) { 459 if (roc->started && local->ops->remain_on_channel) {
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index 3d16f4e61743..d1c021b62fe5 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -19,6 +19,10 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
19 19
20 ieee80211_dfs_cac_cancel(local); 20 ieee80211_dfs_cac_cancel(local);
21 21
22 ieee80211_roc_purge(local, NULL);
23
24 ieee80211_del_virtual_monitor(local);
25
22 if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { 26 if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) {
23 mutex_lock(&local->sta_mtx); 27 mutex_lock(&local->sta_mtx);
24 list_for_each_entry(sta, &local->sta_list, list) { 28 list_for_each_entry(sta, &local->sta_list, list) {
@@ -101,10 +105,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
101 drv_remove_interface(local, sdata); 105 drv_remove_interface(local, sdata);
102 } 106 }
103 107
104 sdata = rtnl_dereference(local->monitor_sdata);
105 if (sdata)
106 drv_remove_interface(local, sdata);
107
108 /* 108 /*
109 * We disconnected on all interfaces before suspend, all channel 109 * We disconnected on all interfaces before suspend, all channel
110 * contexts should be released. 110 * contexts should be released.
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index cb34cbbaa20c..33fbf1045690 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -98,9 +98,8 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
98 } 98 }
99 99
100 /* save the ERP value so that it is available at association time */ 100 /* save the ERP value so that it is available at association time */
101 if (elems->erp_info && elems->erp_info_len >= 1 && 101 if (elems->erp_info && (!elems->parse_error ||
102 (!elems->parse_error || 102 !(bss->valid_data & IEEE80211_BSS_VALID_ERP))) {
103 !(bss->valid_data & IEEE80211_BSS_VALID_ERP))) {
104 bss->erp_value = elems->erp_info[0]; 103 bss->erp_value = elems->erp_info[0];
105 bss->has_erp_value = true; 104 bss->has_erp_value = true;
106 if (!elems->parse_error) 105 if (!elems->parse_error)
@@ -384,7 +383,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
384{ 383{
385 int i; 384 int i;
386 struct ieee80211_sub_if_data *sdata; 385 struct ieee80211_sub_if_data *sdata;
387 enum ieee80211_band band = local->hw.conf.channel->band; 386 enum ieee80211_band band = local->hw.conf.chandef.chan->band;
388 u32 tx_flags; 387 u32 tx_flags;
389 388
390 tx_flags = IEEE80211_TX_INTFL_OFFCHAN_TX_OK; 389 tx_flags = IEEE80211_TX_INTFL_OFFCHAN_TX_OK;
@@ -401,7 +400,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
401 local->scan_req->ssids[i].ssid_len, 400 local->scan_req->ssids[i].ssid_len,
402 local->scan_req->ie, local->scan_req->ie_len, 401 local->scan_req->ie, local->scan_req->ie_len,
403 local->scan_req->rates[band], false, 402 local->scan_req->rates[band], false,
404 tx_flags, local->hw.conf.channel, true); 403 tx_flags, local->hw.conf.chandef.chan, true);
405 404
406 /* 405 /*
407 * After sending probe requests, wait for probe responses 406 * After sending probe requests, wait for probe responses
@@ -467,7 +466,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
467 if (local->ops->hw_scan) { 466 if (local->ops->hw_scan) {
468 __set_bit(SCAN_HW_SCANNING, &local->scanning); 467 __set_bit(SCAN_HW_SCANNING, &local->scanning);
469 } else if ((req->n_channels == 1) && 468 } else if ((req->n_channels == 1) &&
470 (req->channels[0] == local->_oper_channel)) { 469 (req->channels[0] == local->_oper_chandef.chan)) {
471 /* 470 /*
472 * If we are scanning only on the operating channel 471 * If we are scanning only on the operating channel
473 * then we do not need to stop normal activities 472 * then we do not need to stop normal activities
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index c5899797a8d4..8286dcef228b 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -28,27 +28,27 @@
28#define VIF_PR_FMT " vif:%s(%d%s)" 28#define VIF_PR_FMT " vif:%s(%d%s)"
29#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" 29#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
30 30
31#define CHANDEF_ENTRY __field(u32, control_freq) \ 31#define CHANDEF_ENTRY __field(u32, control_freq) \
32 __field(u32, chan_width) \ 32 __field(u32, chan_width) \
33 __field(u32, center_freq1) \ 33 __field(u32, center_freq1) \
34 __field(u32, center_freq2) 34 __field(u32, center_freq2)
35#define CHANDEF_ASSIGN(c) \ 35#define CHANDEF_ASSIGN(c) \
36 __entry->control_freq = (c)->chan->center_freq; \ 36 __entry->control_freq = (c)->chan ? (c)->chan->center_freq : 0; \
37 __entry->chan_width = (c)->width; \ 37 __entry->chan_width = (c)->width; \
38 __entry->center_freq1 = (c)->center_freq1; \ 38 __entry->center_freq1 = (c)->center_freq1; \
39 __entry->center_freq2 = (c)->center_freq2; 39 __entry->center_freq2 = (c)->center_freq2;
40#define CHANDEF_PR_FMT " control:%d MHz width:%d center: %d/%d MHz" 40#define CHANDEF_PR_FMT " control:%d MHz width:%d center: %d/%d MHz"
41#define CHANDEF_PR_ARG __entry->control_freq, __entry->chan_width, \ 41#define CHANDEF_PR_ARG __entry->control_freq, __entry->chan_width, \
42 __entry->center_freq1, __entry->center_freq2 42 __entry->center_freq1, __entry->center_freq2
43 43
44#define CHANCTX_ENTRY CHANDEF_ENTRY \ 44#define CHANCTX_ENTRY CHANDEF_ENTRY \
45 __field(u8, rx_chains_static) \ 45 __field(u8, rx_chains_static) \
46 __field(u8, rx_chains_dynamic) 46 __field(u8, rx_chains_dynamic)
47#define CHANCTX_ASSIGN CHANDEF_ASSIGN(&ctx->conf.def) \ 47#define CHANCTX_ASSIGN CHANDEF_ASSIGN(&ctx->conf.def) \
48 __entry->rx_chains_static = ctx->conf.rx_chains_static; \ 48 __entry->rx_chains_static = ctx->conf.rx_chains_static; \
49 __entry->rx_chains_dynamic = ctx->conf.rx_chains_dynamic 49 __entry->rx_chains_dynamic = ctx->conf.rx_chains_dynamic
50#define CHANCTX_PR_FMT CHANDEF_PR_FMT " chains:%d/%d" 50#define CHANCTX_PR_FMT CHANDEF_PR_FMT " chains:%d/%d"
51#define CHANCTX_PR_ARG CHANDEF_PR_ARG, \ 51#define CHANCTX_PR_ARG CHANDEF_PR_ARG, \
52 __entry->rx_chains_static, __entry->rx_chains_dynamic 52 __entry->rx_chains_static, __entry->rx_chains_dynamic
53 53
54 54
@@ -286,8 +286,7 @@ TRACE_EVENT(drv_config,
286 __field(u16, listen_interval) 286 __field(u16, listen_interval)
287 __field(u8, long_frame_max_tx_count) 287 __field(u8, long_frame_max_tx_count)
288 __field(u8, short_frame_max_tx_count) 288 __field(u8, short_frame_max_tx_count)
289 __field(int, center_freq) 289 CHANDEF_ENTRY
290 __field(int, channel_type)
291 __field(int, smps) 290 __field(int, smps)
292 ), 291 ),
293 292
@@ -303,15 +302,13 @@ TRACE_EVENT(drv_config,
303 local->hw.conf.long_frame_max_tx_count; 302 local->hw.conf.long_frame_max_tx_count;
304 __entry->short_frame_max_tx_count = 303 __entry->short_frame_max_tx_count =
305 local->hw.conf.short_frame_max_tx_count; 304 local->hw.conf.short_frame_max_tx_count;
306 __entry->center_freq = local->hw.conf.channel ? 305 CHANDEF_ASSIGN(&local->hw.conf.chandef)
307 local->hw.conf.channel->center_freq : 0;
308 __entry->channel_type = local->hw.conf.channel_type;
309 __entry->smps = local->hw.conf.smps_mode; 306 __entry->smps = local->hw.conf.smps_mode;
310 ), 307 ),
311 308
312 TP_printk( 309 TP_printk(
313 LOCAL_PR_FMT " ch:%#x freq:%d", 310 LOCAL_PR_FMT " ch:%#x" CHANDEF_PR_FMT,
314 LOCAL_PR_ARG, __entry->changed, __entry->center_freq 311 LOCAL_PR_ARG, __entry->changed, CHANDEF_PR_ARG
315 ) 312 )
316); 313);
317 314
@@ -359,8 +356,7 @@ TRACE_EVENT(drv_bss_info_changed,
359 __dynamic_array(u8, ssid, info->ssid_len); 356 __dynamic_array(u8, ssid, info->ssid_len);
360 __field(bool, hidden_ssid); 357 __field(bool, hidden_ssid);
361 __field(int, txpower) 358 __field(int, txpower)
362 __field(u8, p2p_ctwindow) 359 __field(u8, p2p_oppps_ctwindow)
363 __field(bool, p2p_oppps)
364 ), 360 ),
365 361
366 TP_fast_assign( 362 TP_fast_assign(
@@ -400,8 +396,7 @@ TRACE_EVENT(drv_bss_info_changed,
400 memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len); 396 memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len);
401 __entry->hidden_ssid = info->hidden_ssid; 397 __entry->hidden_ssid = info->hidden_ssid;
402 __entry->txpower = info->txpower; 398 __entry->txpower = info->txpower;
403 __entry->p2p_ctwindow = info->p2p_ctwindow; 399 __entry->p2p_oppps_ctwindow = info->p2p_noa_attr.oppps_ctwindow;
404 __entry->p2p_oppps = info->p2p_oppps;
405 ), 400 ),
406 401
407 TP_printk( 402 TP_printk(
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 2a6ae8030bd9..aad0bf5d8812 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1709,7 +1709,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1709 if (chanctx_conf) 1709 if (chanctx_conf)
1710 chan = chanctx_conf->def.chan; 1710 chan = chanctx_conf->def.chan;
1711 else if (!local->use_chanctx) 1711 else if (!local->use_chanctx)
1712 chan = local->_oper_channel; 1712 chan = local->_oper_chandef.chan;
1713 else 1713 else
1714 goto fail_rcu; 1714 goto fail_rcu;
1715 1715
@@ -1843,7 +1843,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1843 * This is the exception! WDS style interfaces are prohibited 1843 * This is the exception! WDS style interfaces are prohibited
1844 * when channel contexts are in used so this must be valid 1844 * when channel contexts are in used so this must be valid
1845 */ 1845 */
1846 band = local->hw.conf.channel->band; 1846 band = local->hw.conf.chandef.chan->band;
1847 break; 1847 break;
1848#ifdef CONFIG_MAC80211_MESH 1848#ifdef CONFIG_MAC80211_MESH
1849 case NL80211_IFTYPE_MESH_POINT: 1849 case NL80211_IFTYPE_MESH_POINT:
@@ -2442,14 +2442,17 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2442 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { 2442 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
2443 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 2443 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
2444 struct ieee80211_hdr *hdr; 2444 struct ieee80211_hdr *hdr;
2445 struct sk_buff *presp = rcu_dereference(ifibss->presp); 2445 struct beacon_data *presp = rcu_dereference(ifibss->presp);
2446 2446
2447 if (!presp) 2447 if (!presp)
2448 goto out; 2448 goto out;
2449 2449
2450 skb = skb_copy(presp, GFP_ATOMIC); 2450 skb = dev_alloc_skb(local->tx_headroom + presp->head_len);
2451 if (!skb) 2451 if (!skb)
2452 goto out; 2452 goto out;
2453 skb_reserve(skb, local->tx_headroom);
2454 memcpy(skb_put(skb, presp->head_len), presp->head,
2455 presp->head_len);
2453 2456
2454 hdr = (struct ieee80211_hdr *) skb->data; 2457 hdr = (struct ieee80211_hdr *) skb->data;
2455 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 2458 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index a7368870c8ee..447e6651e7fa 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -738,17 +738,11 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
738 elems->supp_rates = pos; 738 elems->supp_rates = pos;
739 elems->supp_rates_len = elen; 739 elems->supp_rates_len = elen;
740 break; 740 break;
741 case WLAN_EID_FH_PARAMS:
742 elems->fh_params = pos;
743 elems->fh_params_len = elen;
744 break;
745 case WLAN_EID_DS_PARAMS: 741 case WLAN_EID_DS_PARAMS:
746 elems->ds_params = pos; 742 if (elen >= 1)
747 elems->ds_params_len = elen; 743 elems->ds_params = pos;
748 break; 744 else
749 case WLAN_EID_CF_PARAMS: 745 elem_parse_failed = true;
750 elems->cf_params = pos;
751 elems->cf_params_len = elen;
752 break; 746 break;
753 case WLAN_EID_TIM: 747 case WLAN_EID_TIM:
754 if (elen >= sizeof(struct ieee80211_tim_ie)) { 748 if (elen >= sizeof(struct ieee80211_tim_ie)) {
@@ -757,10 +751,6 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
757 } else 751 } else
758 elem_parse_failed = true; 752 elem_parse_failed = true;
759 break; 753 break;
760 case WLAN_EID_IBSS_PARAMS:
761 elems->ibss_params = pos;
762 elems->ibss_params_len = elen;
763 break;
764 case WLAN_EID_CHALLENGE: 754 case WLAN_EID_CHALLENGE:
765 elems->challenge = pos; 755 elems->challenge = pos;
766 elems->challenge_len = elen; 756 elems->challenge_len = elen;
@@ -790,8 +780,10 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
790 elems->rsn_len = elen; 780 elems->rsn_len = elen;
791 break; 781 break;
792 case WLAN_EID_ERP_INFO: 782 case WLAN_EID_ERP_INFO:
793 elems->erp_info = pos; 783 if (elen >= 1)
794 elems->erp_info_len = elen; 784 elems->erp_info = pos;
785 else
786 elem_parse_failed = true;
795 break; 787 break;
796 case WLAN_EID_EXT_SUPP_RATES: 788 case WLAN_EID_EXT_SUPP_RATES:
797 elems->ext_supp_rates = pos; 789 elems->ext_supp_rates = pos;
@@ -870,13 +862,6 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
870 } 862 }
871 elems->ch_switch_ie = (void *)pos; 863 elems->ch_switch_ie = (void *)pos;
872 break; 864 break;
873 case WLAN_EID_QUIET:
874 if (!elems->quiet_elem) {
875 elems->quiet_elem = pos;
876 elems->quiet_elem_len = elen;
877 }
878 elems->num_of_quiet_elem++;
879 break;
880 case WLAN_EID_COUNTRY: 865 case WLAN_EID_COUNTRY:
881 elems->country_elem = pos; 866 elems->country_elem = pos;
882 elems->country_elem_len = elen; 867 elems->country_elem_len = elen;
@@ -889,8 +874,10 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
889 elems->pwr_constr_elem = pos; 874 elems->pwr_constr_elem = pos;
890 break; 875 break;
891 case WLAN_EID_TIMEOUT_INTERVAL: 876 case WLAN_EID_TIMEOUT_INTERVAL:
892 elems->timeout_int = pos; 877 if (elen >= sizeof(struct ieee80211_timeout_interval_ie))
893 elems->timeout_int_len = elen; 878 elems->timeout_int = (void *)pos;
879 else
880 elem_parse_failed = true;
894 break; 881 break;
895 default: 882 default:
896 break; 883 break;
@@ -911,12 +898,6 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
911 return crc; 898 return crc;
912} 899}
913 900
914void ieee802_11_parse_elems(u8 *start, size_t len,
915 struct ieee802_11_elems *elems)
916{
917 ieee802_11_parse_elems_crc(start, len, elems, 0, 0);
918}
919
920void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, 901void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
921 bool bss_notify) 902 bool bss_notify)
922{ 903{
@@ -1474,6 +1455,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1474 /* add interfaces */ 1455 /* add interfaces */
1475 sdata = rtnl_dereference(local->monitor_sdata); 1456 sdata = rtnl_dereference(local->monitor_sdata);
1476 if (sdata) { 1457 if (sdata) {
1458 /* in HW restart it exists already */
1459 WARN_ON(local->resuming);
1477 res = drv_add_interface(local, sdata); 1460 res = drv_add_interface(local, sdata);
1478 if (WARN_ON(res)) { 1461 if (WARN_ON(res)) {
1479 rcu_assign_pointer(local->monitor_sdata, NULL); 1462 rcu_assign_pointer(local->monitor_sdata, NULL);
@@ -1663,6 +1646,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1663 local->in_reconfig = false; 1646 local->in_reconfig = false;
1664 barrier(); 1647 barrier();
1665 1648
1649 if (local->monitors == local->open_count && local->monitors > 0)
1650 ieee80211_add_virtual_monitor(local);
1651
1666 /* 1652 /*
1667 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation 1653 * Clear the WLAN_STA_BLOCK_BA flag so new aggregation
1668 * sessions can be established after a resume. 1654 * sessions can be established after a resume.
@@ -2056,7 +2042,7 @@ int ieee80211_ave_rssi(struct ieee80211_vif *vif)
2056 /* non-managed type inferfaces */ 2042 /* non-managed type inferfaces */
2057 return 0; 2043 return 0;
2058 } 2044 }
2059 return ifmgd->ave_beacon_signal; 2045 return ifmgd->ave_beacon_signal / 16;
2060} 2046}
2061EXPORT_SYMBOL_GPL(ieee80211_ave_rssi); 2047EXPORT_SYMBOL_GPL(ieee80211_ave_rssi);
2062 2048
@@ -2171,8 +2157,7 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work)
2171 /* currently not handled */ 2157 /* currently not handled */
2172 WARN_ON(1); 2158 WARN_ON(1);
2173 else { 2159 else {
2174 cfg80211_chandef_create(&chandef, local->hw.conf.channel, 2160 chandef = local->hw.conf.chandef;
2175 local->hw.conf.channel_type);
2176 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL); 2161 cfg80211_radar_event(local->hw.wiphy, &chandef, GFP_KERNEL);
2177 } 2162 }
2178} 2163}