aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-02-14 20:45:59 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-14 20:45:59 -0500
commitf6f223039c0d0683bdea1eabd35b309e10311a60 (patch)
tree890e07acf8c18ddc2994ebc0a0bdcdda38b0dcc6 /drivers/net
parentb3b3f04fb587ecb61b5baa6c1c5f0e666fd12d73 (diff)
parent42c4568a4ace0adc27a9d6f02936e2047ba6fc7e (diff)
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/adm8211.c13
-rw-r--r--drivers/net/wireless/ath/ar9170/ar9170.h8
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c13
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h1
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c44
-rw-r--r--drivers/net/wireless/ath/ath5k/base.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c25
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c7
-rw-r--r--drivers/net/wireless/ath/regd.c5
-rw-r--r--drivers/net/wireless/b43/b43.h1
-rw-r--r--drivers/net/wireless/b43/dma.c17
-rw-r--r--drivers/net/wireless/b43/dma.h5
-rw-r--r--drivers/net/wireless/b43/main.c38
-rw-r--r--drivers/net/wireless/b43/phy_n.c302
-rw-r--r--drivers/net/wireless/b43/phy_n.h4
-rw-r--r--drivers/net/wireless/b43/pio.c17
-rw-r--r--drivers/net/wireless/b43/pio.h5
-rw-r--r--drivers/net/wireless/b43legacy/dma.c20
-rw-r--r--drivers/net/wireless/b43legacy/dma.h10
-rw-r--r--drivers/net/wireless/b43legacy/main.c26
-rw-r--r--drivers/net/wireless/b43legacy/pio.c13
-rw-r--r--drivers/net/wireless/b43legacy/pio.h11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c25
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c37
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c49
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c5
-rw-r--r--drivers/net/wireless/libertas/dev.h1
-rw-r--r--drivers/net/wireless/libertas/if_spi.c1
-rw-r--r--drivers/net/wireless/libertas/main.c31
-rw-r--r--drivers/net/wireless/libertas_tf/main.c3
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c44
-rw-r--r--drivers/net/wireless/mwl8k.c35
-rw-r--r--drivers/net/wireless/p54/main.c11
-rw-r--r--drivers/net/wireless/p54/p54.h8
-rw-r--r--drivers/net/wireless/p54/txrx.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c16
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c1
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_main.c3
53 files changed, 517 insertions, 401 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index e6ca3eb4c0d3..547912e6843f 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -302,18 +302,6 @@ static int adm8211_get_stats(struct ieee80211_hw *dev,
302 return 0; 302 return 0;
303} 303}
304 304
305static int adm8211_get_tx_stats(struct ieee80211_hw *dev,
306 struct ieee80211_tx_queue_stats *stats)
307{
308 struct adm8211_priv *priv = dev->priv;
309
310 stats[0].len = priv->cur_tx - priv->dirty_tx;
311 stats[0].limit = priv->tx_ring_size - 2;
312 stats[0].count = priv->dirty_tx;
313
314 return 0;
315}
316
317static void adm8211_interrupt_tci(struct ieee80211_hw *dev) 305static void adm8211_interrupt_tci(struct ieee80211_hw *dev)
318{ 306{
319 struct adm8211_priv *priv = dev->priv; 307 struct adm8211_priv *priv = dev->priv;
@@ -1773,7 +1761,6 @@ static const struct ieee80211_ops adm8211_ops = {
1773 .prepare_multicast = adm8211_prepare_multicast, 1761 .prepare_multicast = adm8211_prepare_multicast,
1774 .configure_filter = adm8211_configure_filter, 1762 .configure_filter = adm8211_configure_filter,
1775 .get_stats = adm8211_get_stats, 1763 .get_stats = adm8211_get_stats,
1776 .get_tx_stats = adm8211_get_tx_stats,
1777 .get_tsf = adm8211_get_tsft 1764 .get_tsf = adm8211_get_tsft
1778}; 1765};
1779 1766
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h
index b99a8c2053d8..8c8ce67971e9 100644
--- a/drivers/net/wireless/ath/ar9170/ar9170.h
+++ b/drivers/net/wireless/ath/ar9170/ar9170.h
@@ -144,6 +144,12 @@ struct ar9170_sta_tid {
144 bool active; 144 bool active;
145}; 145};
146 146
147struct ar9170_tx_queue_stats {
148 unsigned int len;
149 unsigned int limit;
150 unsigned int count;
151};
152
147#define AR9170_QUEUE_TIMEOUT 64 153#define AR9170_QUEUE_TIMEOUT 64
148#define AR9170_TX_TIMEOUT 8 154#define AR9170_TX_TIMEOUT 8
149#define AR9170_BA_TIMEOUT 4 155#define AR9170_BA_TIMEOUT 4
@@ -211,7 +217,7 @@ struct ar9170 {
211 217
212 /* qos queue settings */ 218 /* qos queue settings */
213 spinlock_t tx_stats_lock; 219 spinlock_t tx_stats_lock;
214 struct ieee80211_tx_queue_stats tx_stats[5]; 220 struct ar9170_tx_queue_stats tx_stats[5];
215 struct ieee80211_tx_queue_params edcf[5]; 221 struct ieee80211_tx_queue_params edcf[5];
216 222
217 spinlock_t cmdlock; 223 spinlock_t cmdlock;
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 4d27f7f67c76..91797cb6e0e8 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -2396,18 +2396,6 @@ static int ar9170_get_stats(struct ieee80211_hw *hw,
2396 return 0; 2396 return 0;
2397} 2397}
2398 2398
2399static int ar9170_get_tx_stats(struct ieee80211_hw *hw,
2400 struct ieee80211_tx_queue_stats *tx_stats)
2401{
2402 struct ar9170 *ar = hw->priv;
2403
2404 spin_lock_bh(&ar->tx_stats_lock);
2405 memcpy(tx_stats, ar->tx_stats, sizeof(tx_stats[0]) * hw->queues);
2406 spin_unlock_bh(&ar->tx_stats_lock);
2407
2408 return 0;
2409}
2410
2411static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue, 2399static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue,
2412 const struct ieee80211_tx_queue_params *param) 2400 const struct ieee80211_tx_queue_params *param)
2413{ 2401{
@@ -2509,7 +2497,6 @@ static const struct ieee80211_ops ar9170_ops = {
2509 .set_key = ar9170_set_key, 2497 .set_key = ar9170_set_key,
2510 .sta_notify = ar9170_sta_notify, 2498 .sta_notify = ar9170_sta_notify,
2511 .get_stats = ar9170_get_stats, 2499 .get_stats = ar9170_get_stats,
2512 .get_tx_stats = ar9170_get_tx_stats,
2513 .ampdu_action = ar9170_ampdu_action, 2500 .ampdu_action = ar9170_ampdu_action,
2514}; 2501};
2515 2502
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index ad4d446f0264..ac67f02e26d8 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -541,7 +541,6 @@ struct ath5k_txq_info {
541/* 541/*
542 * Transmit packet types. 542 * Transmit packet types.
543 * used on tx control descriptor 543 * used on tx control descriptor
544 * TODO: Use them inside base.c corectly
545 */ 544 */
546enum ath5k_pkt_type { 545enum ath5k_pkt_type {
547 AR5K_PKT_TYPE_NORMAL = 0, 546 AR5K_PKT_TYPE_NORMAL = 0,
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index edb6c90e376f..8dce0077b023 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -241,8 +241,6 @@ static int ath5k_set_key(struct ieee80211_hw *hw,
241 struct ieee80211_key_conf *key); 241 struct ieee80211_key_conf *key);
242static int ath5k_get_stats(struct ieee80211_hw *hw, 242static int ath5k_get_stats(struct ieee80211_hw *hw,
243 struct ieee80211_low_level_stats *stats); 243 struct ieee80211_low_level_stats *stats);
244static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
245 struct ieee80211_tx_queue_stats *stats);
246static u64 ath5k_get_tsf(struct ieee80211_hw *hw); 244static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
247static void ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf); 245static void ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf);
248static void ath5k_reset_tsf(struct ieee80211_hw *hw); 246static void ath5k_reset_tsf(struct ieee80211_hw *hw);
@@ -269,7 +267,6 @@ static const struct ieee80211_ops ath5k_hw_ops = {
269 .set_key = ath5k_set_key, 267 .set_key = ath5k_set_key,
270 .get_stats = ath5k_get_stats, 268 .get_stats = ath5k_get_stats,
271 .conf_tx = NULL, 269 .conf_tx = NULL,
272 .get_tx_stats = ath5k_get_tx_stats,
273 .get_tsf = ath5k_get_tsf, 270 .get_tsf = ath5k_get_tsf,
274 .set_tsf = ath5k_set_tsf, 271 .set_tsf = ath5k_set_tsf,
275 .reset_tsf = ath5k_reset_tsf, 272 .reset_tsf = ath5k_reset_tsf,
@@ -1249,6 +1246,29 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1249 return 0; 1246 return 0;
1250} 1247}
1251 1248
1249static enum ath5k_pkt_type get_hw_packet_type(struct sk_buff *skb)
1250{
1251 struct ieee80211_hdr *hdr;
1252 enum ath5k_pkt_type htype;
1253 __le16 fc;
1254
1255 hdr = (struct ieee80211_hdr *)skb->data;
1256 fc = hdr->frame_control;
1257
1258 if (ieee80211_is_beacon(fc))
1259 htype = AR5K_PKT_TYPE_BEACON;
1260 else if (ieee80211_is_probe_resp(fc))
1261 htype = AR5K_PKT_TYPE_PROBE_RESP;
1262 else if (ieee80211_is_atim(fc))
1263 htype = AR5K_PKT_TYPE_ATIM;
1264 else if (ieee80211_is_pspoll(fc))
1265 htype = AR5K_PKT_TYPE_PSPOLL;
1266 else
1267 htype = AR5K_PKT_TYPE_NORMAL;
1268
1269 return htype;
1270}
1271
1252static int 1272static int
1253ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, 1273ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1254 struct ath5k_txq *txq) 1274 struct ath5k_txq *txq)
@@ -1303,7 +1323,8 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1303 sc->vif, pktlen, info)); 1323 sc->vif, pktlen, info));
1304 } 1324 }
1305 ret = ah->ah_setup_tx_desc(ah, ds, pktlen, 1325 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
1306 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL, 1326 ieee80211_get_hdrlen_from_skb(skb),
1327 get_hw_packet_type(skb),
1307 (sc->power_level * 2), 1328 (sc->power_level * 2),
1308 hw_rate, 1329 hw_rate,
1309 info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags, 1330 info->control.rates[0].count, keyidx, ah->ah_tx_ant, flags,
@@ -1332,7 +1353,6 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1332 1353
1333 spin_lock_bh(&txq->lock); 1354 spin_lock_bh(&txq->lock);
1334 list_add_tail(&bf->list, &txq->q); 1355 list_add_tail(&bf->list, &txq->q);
1335 sc->tx_stats[txq->qnum].len++;
1336 if (txq->link == NULL) /* is this first packet? */ 1356 if (txq->link == NULL) /* is this first packet? */
1337 ath5k_hw_set_txdp(ah, txq->qnum, bf->daddr); 1357 ath5k_hw_set_txdp(ah, txq->qnum, bf->daddr);
1338 else /* no, so only link it */ 1358 else /* no, so only link it */
@@ -1581,7 +1601,6 @@ ath5k_txq_drainq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1581 ath5k_txbuf_free(sc, bf); 1601 ath5k_txbuf_free(sc, bf);
1582 1602
1583 spin_lock_bh(&sc->txbuflock); 1603 spin_lock_bh(&sc->txbuflock);
1584 sc->tx_stats[txq->qnum].len--;
1585 list_move_tail(&bf->list, &sc->txbuf); 1604 list_move_tail(&bf->list, &sc->txbuf);
1586 sc->txbuf_len++; 1605 sc->txbuf_len++;
1587 spin_unlock_bh(&sc->txbuflock); 1606 spin_unlock_bh(&sc->txbuflock);
@@ -2011,10 +2030,8 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
2011 } 2030 }
2012 2031
2013 ieee80211_tx_status(sc->hw, skb); 2032 ieee80211_tx_status(sc->hw, skb);
2014 sc->tx_stats[txq->qnum].count++;
2015 2033
2016 spin_lock(&sc->txbuflock); 2034 spin_lock(&sc->txbuflock);
2017 sc->tx_stats[txq->qnum].len--;
2018 list_move_tail(&bf->list, &sc->txbuf); 2035 list_move_tail(&bf->list, &sc->txbuf);
2019 sc->txbuf_len++; 2036 sc->txbuf_len++;
2020 spin_unlock(&sc->txbuflock); 2037 spin_unlock(&sc->txbuflock);
@@ -3116,17 +3133,6 @@ ath5k_get_stats(struct ieee80211_hw *hw,
3116 return 0; 3133 return 0;
3117} 3134}
3118 3135
3119static int
3120ath5k_get_tx_stats(struct ieee80211_hw *hw,
3121 struct ieee80211_tx_queue_stats *stats)
3122{
3123 struct ath5k_softc *sc = hw->priv;
3124
3125 memcpy(stats, &sc->tx_stats, sizeof(sc->tx_stats));
3126
3127 return 0;
3128}
3129
3130static u64 3136static u64
3131ath5k_get_tsf(struct ieee80211_hw *hw) 3137ath5k_get_tsf(struct ieee80211_hw *hw)
3132{ 3138{
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 952b3a21bbc3..7e1a88a5abdb 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -117,7 +117,6 @@ struct ath5k_softc {
117 struct pci_dev *pdev; /* for dma mapping */ 117 struct pci_dev *pdev; /* for dma mapping */
118 void __iomem *iobase; /* address of the device */ 118 void __iomem *iobase; /* address of the device */
119 struct mutex lock; /* dev-level lock */ 119 struct mutex lock; /* dev-level lock */
120 struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES];
121 struct ieee80211_low_level_stats ll_stats; 120 struct ieee80211_low_level_stats ll_stats;
122 struct ieee80211_hw *hw; /* IEEE 802.11 common */ 121 struct ieee80211_hw *hw; /* IEEE 802.11 common */
123 struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS]; 122 struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 0ea340fd071c..83c7ea4c007f 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -267,6 +267,7 @@ void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
267 u16 tid, u16 *ssn); 267 u16 tid, u16 *ssn);
268void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 268void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
269void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); 269void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
270void ath9k_enable_ps(struct ath_softc *sc);
270 271
271/********/ 272/********/
272/* VIFs */ 273/* VIFs */
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 422454fe4ff0..d088ebfe63a6 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -577,6 +577,13 @@ static void ath_beacon_config_sta(struct ath_softc *sc,
577 u64 tsf; 577 u64 tsf;
578 int num_beacons, offset, dtim_dec_count, cfp_dec_count; 578 int num_beacons, offset, dtim_dec_count, cfp_dec_count;
579 579
580 /* No need to configure beacon if we are not associated */
581 if (!common->curaid) {
582 ath_print(common, ATH_DBG_BEACON,
583 "STA is not yet associated..skipping beacon config\n");
584 return;
585 }
586
580 memset(&bs, 0, sizeof(bs)); 587 memset(&bs, 0, sizeof(bs));
581 intval = conf->beacon_interval & ATH9K_BEACON_PERIOD; 588 intval = conf->beacon_interval & ATH9K_BEACON_PERIOD;
582 589
@@ -739,7 +746,6 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
739 enum nl80211_iftype iftype; 746 enum nl80211_iftype iftype;
740 747
741 /* Setup the beacon configuration parameters */ 748 /* Setup the beacon configuration parameters */
742
743 if (vif) { 749 if (vif) {
744 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; 750 struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
745 751
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f15fee76a4e2..f00f5c744f48 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1217,6 +1217,17 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
1217 /* As defined by IEEE 802.11-2007 17.3.8.6 */ 1217 /* As defined by IEEE 802.11-2007 17.3.8.6 */
1218 slottime = ah->slottime + 3 * ah->coverage_class; 1218 slottime = ah->slottime + 3 * ah->coverage_class;
1219 acktimeout = slottime + sifstime; 1219 acktimeout = slottime + sifstime;
1220
1221 /*
1222 * Workaround for early ACK timeouts, add an offset to match the
1223 * initval's 64us ack timeout value.
1224 * This was initially only meant to work around an issue with delayed
1225 * BA frames in some implementations, but it has been found to fix ACK
1226 * timeout issues in other cases as well.
1227 */
1228 if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ)
1229 acktimeout += 64 - sifstime - ah->slottime;
1230
1220 ath9k_hw_setslottime(ah, slottime); 1231 ath9k_hw_setslottime(ah, slottime);
1221 ath9k_hw_set_ack_timeout(ah, acktimeout); 1232 ath9k_hw_set_ack_timeout(ah, acktimeout);
1222 ath9k_hw_set_cts_timeout(ah, acktimeout); 1233 ath9k_hw_set_cts_timeout(ah, acktimeout);
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 4b5e54848683..623c2f884987 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -622,7 +622,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
622 IEEE80211_HW_SIGNAL_DBM | 622 IEEE80211_HW_SIGNAL_DBM |
623 IEEE80211_HW_SUPPORTS_PS | 623 IEEE80211_HW_SUPPORTS_PS |
624 IEEE80211_HW_PS_NULLFUNC_STACK | 624 IEEE80211_HW_PS_NULLFUNC_STACK |
625 IEEE80211_HW_SPECTRUM_MGMT; 625 IEEE80211_HW_SPECTRUM_MGMT |
626 IEEE80211_HW_REPORTS_TX_ACK_STATUS;
626 627
627 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) 628 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
628 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION; 629 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 6796d5cdc293..9c8f925c2093 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -809,6 +809,7 @@ static void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf
809 809
810 clear_bit(key->hw_key_idx + 64, common->keymap); 810 clear_bit(key->hw_key_idx + 64, common->keymap);
811 if (common->splitmic) { 811 if (common->splitmic) {
812 ath9k_hw_keyreset(ah, key->hw_key_idx + 32);
812 clear_bit(key->hw_key_idx + 32, common->keymap); 813 clear_bit(key->hw_key_idx + 32, common->keymap);
813 clear_bit(key->hw_key_idx + 64 + 32, common->keymap); 814 clear_bit(key->hw_key_idx + 64 + 32, common->keymap);
814 } 815 }
@@ -1492,6 +1493,19 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1492 mutex_unlock(&sc->mutex); 1493 mutex_unlock(&sc->mutex);
1493} 1494}
1494 1495
1496void ath9k_enable_ps(struct ath_softc *sc)
1497{
1498 sc->ps_enabled = true;
1499 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
1500 if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) {
1501 sc->imask |= ATH9K_INT_TIM_TIMER;
1502 ath9k_hw_set_interrupts(sc->sc_ah,
1503 sc->imask);
1504 }
1505 }
1506 ath9k_hw_setrxabort(sc->sc_ah, 1);
1507}
1508
1495static int ath9k_config(struct ieee80211_hw *hw, u32 changed) 1509static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1496{ 1510{
1497 struct ath_wiphy *aphy = hw->priv; 1511 struct ath_wiphy *aphy = hw->priv;
@@ -1546,22 +1560,13 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
1546 if (changed & IEEE80211_CONF_CHANGE_PS) { 1560 if (changed & IEEE80211_CONF_CHANGE_PS) {
1547 if (conf->flags & IEEE80211_CONF_PS) { 1561 if (conf->flags & IEEE80211_CONF_PS) {
1548 sc->ps_flags |= PS_ENABLED; 1562 sc->ps_flags |= PS_ENABLED;
1549 if (!(ah->caps.hw_caps &
1550 ATH9K_HW_CAP_AUTOSLEEP)) {
1551 if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) {
1552 sc->imask |= ATH9K_INT_TIM_TIMER;
1553 ath9k_hw_set_interrupts(sc->sc_ah,
1554 sc->imask);
1555 }
1556 }
1557 /* 1563 /*
1558 * At this point we know hardware has received an ACK 1564 * At this point we know hardware has received an ACK
1559 * of a previously sent null data frame. 1565 * of a previously sent null data frame.
1560 */ 1566 */
1561 if ((sc->ps_flags & PS_NULLFUNC_COMPLETED)) { 1567 if ((sc->ps_flags & PS_NULLFUNC_COMPLETED)) {
1562 sc->ps_flags &= ~PS_NULLFUNC_COMPLETED; 1568 sc->ps_flags &= ~PS_NULLFUNC_COMPLETED;
1563 sc->ps_enabled = true; 1569 ath9k_enable_ps(sc);
1564 ath9k_hw_setrxabort(sc->sc_ah, 1);
1565 } 1570 }
1566 } else { 1571 } else {
1567 sc->ps_enabled = false; 1572 sc->ps_enabled = false;
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 3c790a4f38f7..f5cbbcb9a4aa 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2048,10 +2048,9 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
2048 */ 2048 */
2049 if (bf->bf_isnullfunc && 2049 if (bf->bf_isnullfunc &&
2050 (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) { 2050 (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) {
2051 if ((sc->ps_flags & PS_ENABLED)) { 2051 if ((sc->ps_flags & PS_ENABLED))
2052 sc->ps_enabled = true; 2052 ath9k_enable_ps(sc);
2053 ath9k_hw_setrxabort(sc->sc_ah, 1); 2053 else
2054 } else
2055 sc->ps_flags |= PS_NULLFUNC_COMPLETED; 2054 sc->ps_flags |= PS_NULLFUNC_COMPLETED;
2056 } 2055 }
2057 2056
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 039ac490465c..04abd1f556b7 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -110,8 +110,9 @@ static const struct ieee80211_regdomain ath_world_regdom_67_68_6A = {
110 110
111static inline bool is_wwr_sku(u16 regd) 111static inline bool is_wwr_sku(u16 regd)
112{ 112{
113 return ((regd & WORLD_SKU_MASK) == WORLD_SKU_PREFIX) || 113 return ((regd & COUNTRY_ERD_FLAG) != COUNTRY_ERD_FLAG) &&
114 (regd == WORLD); 114 (((regd & WORLD_SKU_MASK) == WORLD_SKU_PREFIX) ||
115 (regd == WORLD));
115} 116}
116 117
117static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg) 118static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg)
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 54d6085a887b..6a6ab0f630e5 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -115,6 +115,7 @@
115#define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */ 115#define B43_MMIO_TSF_2 0x636 /* core rev < 3 only */
116#define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */ 116#define B43_MMIO_TSF_3 0x638 /* core rev < 3 only */
117#define B43_MMIO_RNG 0x65A 117#define B43_MMIO_RNG 0x65A
118#define B43_MMIO_IFSSLOT 0x684 /* Interframe slot time */
118#define B43_MMIO_IFSCTL 0x688 /* Interframe space control */ 119#define B43_MMIO_IFSCTL 0x688 /* Interframe space control */
119#define B43_MMIO_IFSCTL_USE_EDCF 0x0004 120#define B43_MMIO_IFSCTL_USE_EDCF 0x0004
120#define B43_MMIO_POWERUP_DELAY 0x6A8 121#define B43_MMIO_POWERUP_DELAY 0x6A8
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 615af22c49fd..be7abf8916ad 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1369,7 +1369,6 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1369 b43err(dev->wl, "DMA tx mapping failure\n"); 1369 b43err(dev->wl, "DMA tx mapping failure\n");
1370 goto out; 1370 goto out;
1371 } 1371 }
1372 ring->nr_tx_packets++;
1373 if ((free_slots(ring) < TX_SLOTS_PER_FRAME) || 1372 if ((free_slots(ring) < TX_SLOTS_PER_FRAME) ||
1374 should_inject_overflow(ring)) { 1373 should_inject_overflow(ring)) {
1375 /* This TX ring is full. */ 1374 /* This TX ring is full. */
@@ -1500,22 +1499,6 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1500 } 1499 }
1501} 1500}
1502 1501
1503void b43_dma_get_tx_stats(struct b43_wldev *dev,
1504 struct ieee80211_tx_queue_stats *stats)
1505{
1506 const int nr_queues = dev->wl->hw->queues;
1507 struct b43_dmaring *ring;
1508 int i;
1509
1510 for (i = 0; i < nr_queues; i++) {
1511 ring = select_ring_by_priority(dev, i);
1512
1513 stats[i].len = ring->used_slots / TX_SLOTS_PER_FRAME;
1514 stats[i].limit = ring->nr_slots / TX_SLOTS_PER_FRAME;
1515 stats[i].count = ring->nr_tx_packets;
1516 }
1517}
1518
1519static void dma_rx(struct b43_dmaring *ring, int *slot) 1502static void dma_rx(struct b43_dmaring *ring, int *slot)
1520{ 1503{
1521 const struct b43_dma_ops *ops = ring->ops; 1504 const struct b43_dma_ops *ops = ring->ops;
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index f7ab37c4cdbc..dc91944d6022 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -228,8 +228,6 @@ struct b43_dmaring {
228 int used_slots; 228 int used_slots;
229 /* Currently used slot in the ring. */ 229 /* Currently used slot in the ring. */
230 int current_slot; 230 int current_slot;
231 /* Total number of packets sent. Statistics only. */
232 unsigned int nr_tx_packets;
233 /* Frameoffset in octets. */ 231 /* Frameoffset in octets. */
234 u32 frameoffset; 232 u32 frameoffset;
235 /* Descriptor buffer size. */ 233 /* Descriptor buffer size. */
@@ -278,9 +276,6 @@ void b43_dma_free(struct b43_wldev *dev);
278void b43_dma_tx_suspend(struct b43_wldev *dev); 276void b43_dma_tx_suspend(struct b43_wldev *dev);
279void b43_dma_tx_resume(struct b43_wldev *dev); 277void b43_dma_tx_resume(struct b43_wldev *dev);
280 278
281void b43_dma_get_tx_stats(struct b43_wldev *dev,
282 struct ieee80211_tx_queue_stats *stats);
283
284int b43_dma_tx(struct b43_wldev *dev, 279int b43_dma_tx(struct b43_wldev *dev,
285 struct sk_buff *skb); 280 struct sk_buff *skb);
286void b43_dma_handle_txstatus(struct b43_wldev *dev, 281void b43_dma_handle_txstatus(struct b43_wldev *dev,
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 316a913860d7..aa33d741e5e6 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -637,10 +637,17 @@ static void b43_upload_card_macaddress(struct b43_wldev *dev)
637static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time) 637static void b43_set_slot_time(struct b43_wldev *dev, u16 slot_time)
638{ 638{
639 /* slot_time is in usec. */ 639 /* slot_time is in usec. */
640 if (dev->phy.type != B43_PHYTYPE_G) 640 /* This test used to exit for all but a G PHY. */
641 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
641 return; 642 return;
642 b43_write16(dev, 0x684, 510 + slot_time); 643 b43_write16(dev, B43_MMIO_IFSSLOT, 510 + slot_time);
643 b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time); 644 /* Shared memory location 0x0010 is the slot time and should be
645 * set to slot_time; however, this register is initially 0 and changing
646 * the value adversely affects the transmit rate for BCM4311
647 * devices. Until this behavior is unterstood, delete this step
648 *
649 * b43_shm_write16(dev, B43_SHM_SHARED, 0x0010, slot_time);
650 */
644} 651}
645 652
646static void b43_short_slot_timing_enable(struct b43_wldev *dev) 653static void b43_short_slot_timing_enable(struct b43_wldev *dev)
@@ -3349,27 +3356,6 @@ out_unlock:
3349 return err; 3356 return err;
3350} 3357}
3351 3358
3352static int b43_op_get_tx_stats(struct ieee80211_hw *hw,
3353 struct ieee80211_tx_queue_stats *stats)
3354{
3355 struct b43_wl *wl = hw_to_b43_wl(hw);
3356 struct b43_wldev *dev;
3357 int err = -ENODEV;
3358
3359 mutex_lock(&wl->mutex);
3360 dev = wl->current_dev;
3361 if (dev && b43_status(dev) >= B43_STAT_STARTED) {
3362 if (b43_using_pio_transfers(dev))
3363 b43_pio_get_tx_stats(dev, stats);
3364 else
3365 b43_dma_get_tx_stats(dev, stats);
3366 err = 0;
3367 }
3368 mutex_unlock(&wl->mutex);
3369
3370 return err;
3371}
3372
3373static int b43_op_get_stats(struct ieee80211_hw *hw, 3359static int b43_op_get_stats(struct ieee80211_hw *hw,
3374 struct ieee80211_low_level_stats *stats) 3360 struct ieee80211_low_level_stats *stats)
3375{ 3361{
@@ -3980,6 +3966,7 @@ static int b43_wireless_core_start(struct b43_wldev *dev)
3980 } 3966 }
3981 3967
3982 /* We are ready to run. */ 3968 /* We are ready to run. */
3969 ieee80211_wake_queues(dev->wl->hw);
3983 b43_set_status(dev, B43_STAT_STARTED); 3970 b43_set_status(dev, B43_STAT_STARTED);
3984 3971
3985 /* Start data flow (TX/RX). */ 3972 /* Start data flow (TX/RX). */
@@ -4389,8 +4376,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4389 4376
4390 ieee80211_wake_queues(dev->wl->hw); 4377 ieee80211_wake_queues(dev->wl->hw);
4391 4378
4392 ieee80211_wake_queues(dev->wl->hw);
4393
4394 b43_set_status(dev, B43_STAT_INITIALIZED); 4379 b43_set_status(dev, B43_STAT_INITIALIZED);
4395 4380
4396out: 4381out:
@@ -4596,7 +4581,6 @@ static const struct ieee80211_ops b43_hw_ops = {
4596 .set_key = b43_op_set_key, 4581 .set_key = b43_op_set_key,
4597 .update_tkip_key = b43_op_update_tkip_key, 4582 .update_tkip_key = b43_op_update_tkip_key,
4598 .get_stats = b43_op_get_stats, 4583 .get_stats = b43_op_get_stats,
4599 .get_tx_stats = b43_op_get_tx_stats,
4600 .get_tsf = b43_op_get_tsf, 4584 .get_tsf = b43_op_get_tsf,
4601 .set_tsf = b43_op_set_tsf, 4585 .set_tsf = b43_op_set_tsf,
4602 .start = b43_op_start, 4586 .start = b43_op_start,
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 6392da25efed..795bb1e3345d 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -68,6 +68,10 @@ static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
68 u8 *events, u8 *delays, u8 length); 68 u8 *events, u8 *delays, u8 length);
69static void b43_nphy_force_rf_sequence(struct b43_wldev *dev, 69static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
70 enum b43_nphy_rf_sequence seq); 70 enum b43_nphy_rf_sequence seq);
71static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
72 u16 value, u8 core, bool off);
73static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
74 u16 value, u8 core);
71 75
72void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna) 76void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
73{//TODO 77{//TODO
@@ -498,8 +502,8 @@ static void b43_nphy_rx_cal_phy_setup(struct b43_wldev *dev, u8 core)
498 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0007); 502 b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x0007);
499 } 503 }
500 504
501 /* TODO: Call N PHY RF Ctrl Intc Override with 2, 0, 3 as arguments */ 505 b43_nphy_rf_control_intc_override(dev, 2, 0, 3);
502 /* TODO: Call N PHY RF Intc Override with 8, 0, 3, 0 as arguments */ 506 b43_nphy_rf_control_override(dev, 8, 0, 3, false);
503 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX); 507 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RX2TX);
504 508
505 if (core == 0) { 509 if (core == 0) {
@@ -509,9 +513,8 @@ static void b43_nphy_rx_cal_phy_setup(struct b43_wldev *dev, u8 core)
509 rxval = 4; 513 rxval = 4;
510 txval = 2; 514 txval = 2;
511 } 515 }
512 516 b43_nphy_rf_control_intc_override(dev, 1, rxval, (core + 1));
513 /* TODO: Call N PHY RF Ctrl Intc Override with 1, rxval, (core + 1) */ 517 b43_nphy_rf_control_intc_override(dev, 1, txval, (2 - core));
514 /* TODO: Call N PHY RF Ctrl Intc Override with 1, txval, (2 - core) */
515} 518}
516 519
517/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */ 520/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */
@@ -714,6 +717,67 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev)
714 b43_nphy_stay_in_carrier_search(dev, 0); 717 b43_nphy_stay_in_carrier_search(dev, 0);
715} 718}
716 719
720/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */
721static void b43_nphy_spur_workaround(struct b43_wldev *dev)
722{
723 struct b43_phy_n *nphy = dev->phy.n;
724
725 unsigned int channel;
726 int tone[2] = { 57, 58 };
727 u32 noise[2] = { 0x3FF, 0x3FF };
728
729 B43_WARN_ON(dev->phy.rev < 3);
730
731 if (nphy->hang_avoid)
732 b43_nphy_stay_in_carrier_search(dev, 1);
733
734 /* FIXME: channel = radio_chanspec */
735
736 if (nphy->gband_spurwar_en) {
737 /* TODO: N PHY Adjust Analog Pfbw (7) */
738 if (channel == 11 && dev->phy.is_40mhz)
739 ; /* TODO: N PHY Adjust Min Noise Var(2, tone, noise)*/
740 else
741 ; /* TODO: N PHY Adjust Min Noise Var(0, NULL, NULL)*/
742 /* TODO: N PHY Adjust CRS Min Power (0x1E) */
743 }
744
745 if (nphy->aband_spurwar_en) {
746 if (channel == 54) {
747 tone[0] = 0x20;
748 noise[0] = 0x25F;
749 } else if (channel == 38 || channel == 102 || channel == 118) {
750 if (0 /* FIXME */) {
751 tone[0] = 0x20;
752 noise[0] = 0x21F;
753 } else {
754 tone[0] = 0;
755 noise[0] = 0;
756 }
757 } else if (channel == 134) {
758 tone[0] = 0x20;
759 noise[0] = 0x21F;
760 } else if (channel == 151) {
761 tone[0] = 0x10;
762 noise[0] = 0x23F;
763 } else if (channel == 153 || channel == 161) {
764 tone[0] = 0x30;
765 noise[0] = 0x23F;
766 } else {
767 tone[0] = 0;
768 noise[0] = 0;
769 }
770
771 if (!tone[0] && !noise[0])
772 ; /* TODO: N PHY Adjust Min Noise Var(1, tone, noise)*/
773 else
774 ; /* TODO: N PHY Adjust Min Noise Var(0, NULL, NULL)*/
775 }
776
777 if (nphy->hang_avoid)
778 b43_nphy_stay_in_carrier_search(dev, 0);
779}
780
717/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */ 781/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
718static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev) 782static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev)
719{ 783{
@@ -953,6 +1017,33 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
953 b43_nphy_stay_in_carrier_search(dev, 0); 1017 b43_nphy_stay_in_carrier_search(dev, 0);
954} 1018}
955 1019
1020/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/LoadSampleTable */
1021static int b43_nphy_load_samples(struct b43_wldev *dev,
1022 struct b43_c32 *samples, u16 len) {
1023 struct b43_phy_n *nphy = dev->phy.n;
1024 u16 i;
1025 u32 *data;
1026
1027 data = kzalloc(len * sizeof(u32), GFP_KERNEL);
1028 if (!data) {
1029 b43err(dev->wl, "allocation for samples loading failed\n");
1030 return -ENOMEM;
1031 }
1032 if (nphy->hang_avoid)
1033 b43_nphy_stay_in_carrier_search(dev, 1);
1034
1035 for (i = 0; i < len; i++) {
1036 data[i] = (samples[i].i & 0x3FF << 10);
1037 data[i] |= samples[i].q & 0x3FF;
1038 }
1039 b43_ntab_write_bulk(dev, B43_NTAB32(17, 0), len, data);
1040
1041 kfree(data);
1042 if (nphy->hang_avoid)
1043 b43_nphy_stay_in_carrier_search(dev, 0);
1044 return 0;
1045}
1046
956/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */ 1047/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
957static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max, 1048static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
958 bool test) 1049 bool test)
@@ -978,6 +1069,10 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
978 } 1069 }
979 1070
980 samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL); 1071 samples = kzalloc(len * sizeof(struct b43_c32), GFP_KERNEL);
1072 if (!samples) {
1073 b43err(dev->wl, "allocation for samples generation failed\n");
1074 return 0;
1075 }
981 rot = (((freq * 36) / bw) << 16) / 100; 1076 rot = (((freq * 36) / bw) << 16) / 100;
982 angle = 0; 1077 angle = 0;
983 1078
@@ -988,9 +1083,9 @@ static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
988 samples[i].i = CORDIC_CONVERT(samples[i].i * max); 1083 samples[i].i = CORDIC_CONVERT(samples[i].i * max);
989 } 1084 }
990 1085
991 /* TODO: Call N PHY Load Sample Table with buffer, len as arguments */ 1086 i = b43_nphy_load_samples(dev, samples, len);
992 kfree(samples); 1087 kfree(samples);
993 return len; 1088 return (i < 0) ? 0 : len;
994} 1089}
995 1090
996/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */ 1091/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
@@ -1264,6 +1359,104 @@ static void b43_nphy_rf_control_override(struct b43_wldev *dev, u16 field,
1264 } 1359 }
1265} 1360}
1266 1361
1362/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */
1363static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
1364 u16 value, u8 core)
1365{
1366 u8 i, j;
1367 u16 reg, tmp, val;
1368
1369 B43_WARN_ON(dev->phy.rev < 3);
1370 B43_WARN_ON(field > 4);
1371
1372 for (i = 0; i < 2; i++) {
1373 if ((core == 1 && i == 1) || (core == 2 && !i))
1374 continue;
1375
1376 reg = (i == 0) ?
1377 B43_NPHY_RFCTL_INTC1 : B43_NPHY_RFCTL_INTC2;
1378 b43_phy_mask(dev, reg, 0xFBFF);
1379
1380 switch (field) {
1381 case 0:
1382 b43_phy_write(dev, reg, 0);
1383 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
1384 break;
1385 case 1:
1386 if (!i) {
1387 b43_phy_maskset(dev, B43_NPHY_RFCTL_INTC1,
1388 0xFC3F, (value << 6));
1389 b43_phy_maskset(dev, B43_NPHY_TXF_40CO_B1S1,
1390 0xFFFE, 1);
1391 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
1392 B43_NPHY_RFCTL_CMD_START);
1393 for (j = 0; j < 100; j++) {
1394 if (b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_START) {
1395 j = 0;
1396 break;
1397 }
1398 udelay(10);
1399 }
1400 if (j)
1401 b43err(dev->wl,
1402 "intc override timeout\n");
1403 b43_phy_mask(dev, B43_NPHY_TXF_40CO_B1S1,
1404 0xFFFE);
1405 } else {
1406 b43_phy_maskset(dev, B43_NPHY_RFCTL_INTC2,
1407 0xFC3F, (value << 6));
1408 b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER,
1409 0xFFFE, 1);
1410 b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
1411 B43_NPHY_RFCTL_CMD_RXTX);
1412 for (j = 0; j < 100; j++) {
1413 if (b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_RXTX) {
1414 j = 0;
1415 break;
1416 }
1417 udelay(10);
1418 }
1419 if (j)
1420 b43err(dev->wl,
1421 "intc override timeout\n");
1422 b43_phy_mask(dev, B43_NPHY_RFCTL_OVER,
1423 0xFFFE);
1424 }
1425 break;
1426 case 2:
1427 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
1428 tmp = 0x0020;
1429 val = value << 5;
1430 } else {
1431 tmp = 0x0010;
1432 val = value << 4;
1433 }
1434 b43_phy_maskset(dev, reg, ~tmp, val);
1435 break;
1436 case 3:
1437 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
1438 tmp = 0x0001;
1439 val = value;
1440 } else {
1441 tmp = 0x0004;
1442 val = value << 2;
1443 }
1444 b43_phy_maskset(dev, reg, ~tmp, val);
1445 break;
1446 case 4:
1447 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) {
1448 tmp = 0x0002;
1449 val = value << 1;
1450 } else {
1451 tmp = 0x0008;
1452 val = value << 3;
1453 }
1454 b43_phy_maskset(dev, reg, ~tmp, val);
1455 break;
1456 }
1457 }
1458}
1459
1267static void b43_nphy_bphy_init(struct b43_wldev *dev) 1460static void b43_nphy_bphy_init(struct b43_wldev *dev)
1268{ 1461{
1269 unsigned int i; 1462 unsigned int i;
@@ -2161,9 +2354,9 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
2161 regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); 2354 regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
2162 regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2); 2355 regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
2163 2356
2164 /* TODO: Call N PHY RF Ctrl Intc Override with 2, 1, 3 */ 2357 b43_nphy_rf_control_intc_override(dev, 2, 1, 3);
2165 /* TODO: Call N PHY RF Ctrl Intc Override with 1, 2, 1 */ 2358 b43_nphy_rf_control_intc_override(dev, 1, 2, 1);
2166 /* TODO: Call N PHY RF Ctrl Intc Override with 1, 8, 2 */ 2359 b43_nphy_rf_control_intc_override(dev, 1, 8, 2);
2167 2360
2168 regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0); 2361 regs[9] = b43_phy_read(dev, B43_NPHY_PAPD_EN0);
2169 regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1); 2362 regs[10] = b43_phy_read(dev, B43_NPHY_PAPD_EN1);
@@ -2194,6 +2387,55 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
2194 } 2387 }
2195} 2388}
2196 2389
2390/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */
2391static void b43_nphy_save_cal(struct b43_wldev *dev)
2392{
2393 struct b43_phy_n *nphy = dev->phy.n;
2394
2395 struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;
2396 u16 *txcal_radio_regs = NULL;
2397 u8 *iqcal_chanspec;
2398 u16 *table = NULL;
2399
2400 if (nphy->hang_avoid)
2401 b43_nphy_stay_in_carrier_search(dev, 1);
2402
2403 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
2404 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_2G;
2405 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_2G;
2406 iqcal_chanspec = &nphy->iqcal_chanspec_2G;
2407 table = nphy->cal_cache.txcal_coeffs_2G;
2408 } else {
2409 rxcal_coeffs = &nphy->cal_cache.rxcal_coeffs_5G;
2410 txcal_radio_regs = nphy->cal_cache.txcal_radio_regs_5G;
2411 iqcal_chanspec = &nphy->iqcal_chanspec_5G;
2412 table = nphy->cal_cache.txcal_coeffs_5G;
2413 }
2414
2415 b43_nphy_rx_iq_coeffs(dev, false, rxcal_coeffs);
2416 /* TODO use some definitions */
2417 if (dev->phy.rev >= 3) {
2418 txcal_radio_regs[0] = b43_radio_read(dev, 0x2021);
2419 txcal_radio_regs[1] = b43_radio_read(dev, 0x2022);
2420 txcal_radio_regs[2] = b43_radio_read(dev, 0x3021);
2421 txcal_radio_regs[3] = b43_radio_read(dev, 0x3022);
2422 txcal_radio_regs[4] = b43_radio_read(dev, 0x2023);
2423 txcal_radio_regs[5] = b43_radio_read(dev, 0x2024);
2424 txcal_radio_regs[6] = b43_radio_read(dev, 0x3023);
2425 txcal_radio_regs[7] = b43_radio_read(dev, 0x3024);
2426 } else {
2427 txcal_radio_regs[0] = b43_radio_read(dev, 0x8B);
2428 txcal_radio_regs[1] = b43_radio_read(dev, 0xBA);
2429 txcal_radio_regs[2] = b43_radio_read(dev, 0x8D);
2430 txcal_radio_regs[3] = b43_radio_read(dev, 0xBC);
2431 }
2432 *iqcal_chanspec = nphy->radio_chanspec;
2433 b43_ntab_write_bulk(dev, B43_NTAB16(15, 80), 8, table);
2434
2435 if (nphy->hang_avoid)
2436 b43_nphy_stay_in_carrier_search(dev, 0);
2437}
2438
2197/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */ 2439/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
2198static void b43_nphy_restore_cal(struct b43_wldev *dev) 2440static void b43_nphy_restore_cal(struct b43_wldev *dev)
2199{ 2441{
@@ -2486,6 +2728,39 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
2486 return error; 2728 return error;
2487} 2729}
2488 2730
2731/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ReapplyTxCalCoeffs */
2732static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev)
2733{
2734 struct b43_phy_n *nphy = dev->phy.n;
2735 u8 i;
2736 u16 buffer[7];
2737 bool equal = true;
2738
2739 if (!nphy->txiqlocal_coeffsvalid || 1 /* FIXME */)
2740 return;
2741
2742 b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer);
2743 for (i = 0; i < 4; i++) {
2744 if (buffer[i] != nphy->txiqlocal_bestc[i]) {
2745 equal = false;
2746 break;
2747 }
2748 }
2749
2750 if (!equal) {
2751 b43_ntab_write_bulk(dev, B43_NTAB16(15, 80), 4,
2752 nphy->txiqlocal_bestc);
2753 for (i = 0; i < 4; i++)
2754 buffer[i] = 0;
2755 b43_ntab_write_bulk(dev, B43_NTAB16(15, 88), 4,
2756 buffer);
2757 b43_ntab_write_bulk(dev, B43_NTAB16(15, 85), 2,
2758 &nphy->txiqlocal_bestc[5]);
2759 b43_ntab_write_bulk(dev, B43_NTAB16(15, 93), 2,
2760 &nphy->txiqlocal_bestc[5]);
2761 }
2762}
2763
2489/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */ 2764/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */
2490static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, 2765static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
2491 struct nphy_txgains target, u8 type, bool debug) 2766 struct nphy_txgains target, u8 type, bool debug)
@@ -2516,7 +2791,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
2516 b43_nphy_stay_in_carrier_search(dev, 1); 2791 b43_nphy_stay_in_carrier_search(dev, 1);
2517 2792
2518 if (dev->phy.rev < 2) 2793 if (dev->phy.rev < 2)
2519 ;/* TODO: Call N PHY Reapply TX Cal Coeffs */ 2794 b43_nphy_reapply_tx_cal_coeffs(dev);
2520 b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save); 2795 b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save);
2521 for (i = 0; i < 2; i++) { 2796 for (i = 0; i < 2; i++) {
2522 b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]); 2797 b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]);
@@ -2858,7 +3133,7 @@ int b43_phy_initn(struct b43_wldev *dev)
2858 3133
2859 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) { 3134 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false)) {
2860 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0) 3135 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0)
2861 ;/* Call N PHY Save Cal */ 3136 b43_nphy_save_cal(dev);
2862 else if (nphy->mphase_cal_phase_id == 0) 3137 else if (nphy->mphase_cal_phase_id == 0)
2863 ;/* N PHY Periodic Calibration with argument 3 */ 3138 ;/* N PHY Periodic Calibration with argument 3 */
2864 } else { 3139 } else {
@@ -2872,7 +3147,8 @@ int b43_phy_initn(struct b43_wldev *dev)
2872 if (phy->rev >= 3 && phy->rev <= 6) 3147 if (phy->rev >= 3 && phy->rev <= 6)
2873 b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 0x0014); 3148 b43_phy_write(dev, B43_NPHY_PLOAD_CSENSE_EXTLEN, 0x0014);
2874 b43_nphy_tx_lp_fbw(dev); 3149 b43_nphy_tx_lp_fbw(dev);
2875 /* TODO N PHY Spur Workaround */ 3150 if (phy->rev >= 3)
3151 b43_nphy_spur_workaround(dev);
2876 3152
2877 b43err(dev->wl, "IEEE 802.11n devices are not supported, yet.\n"); 3153 b43err(dev->wl, "IEEE 802.11n devices are not supported, yet.\n");
2878 return 0; 3154 return 0;
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index ae82f0fc2096..403aad3f894f 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -975,6 +975,7 @@ struct b43_phy_n {
975 u16 papd_epsilon_offset[2]; 975 u16 papd_epsilon_offset[2];
976 s32 preamble_override; 976 s32 preamble_override;
977 u32 bb_mult_save; 977 u32 bb_mult_save;
978 u16 radio_chanspec;
978 979
979 bool gain_boost; 980 bool gain_boost;
980 bool elna_gain_config; 981 bool elna_gain_config;
@@ -1001,6 +1002,9 @@ struct b43_phy_n {
1001 u16 classifier_state; 1002 u16 classifier_state;
1002 u16 clip_state[2]; 1003 u16 clip_state[2];
1003 1004
1005 bool aband_spurwar_en;
1006 bool gband_spurwar_en;
1007
1004 bool ipa2g_on; 1008 bool ipa2g_on;
1005 u8 iqcal_chanspec_2G; 1009 u8 iqcal_chanspec_2G;
1006 u8 rssical_chanspec_2G; 1010 u8 rssical_chanspec_2G;
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index c01b8e02412f..a6062c3e89a5 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -559,7 +559,6 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
559 b43err(dev->wl, "PIO transmission failure\n"); 559 b43err(dev->wl, "PIO transmission failure\n");
560 goto out; 560 goto out;
561 } 561 }
562 q->nr_tx_packets++;
563 562
564 B43_WARN_ON(q->buffer_used > q->buffer_size); 563 B43_WARN_ON(q->buffer_used > q->buffer_size);
565 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || 564 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) ||
@@ -605,22 +604,6 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,
605 } 604 }
606} 605}
607 606
608void b43_pio_get_tx_stats(struct b43_wldev *dev,
609 struct ieee80211_tx_queue_stats *stats)
610{
611 const int nr_queues = dev->wl->hw->queues;
612 struct b43_pio_txqueue *q;
613 int i;
614
615 for (i = 0; i < nr_queues; i++) {
616 q = select_queue_by_priority(dev, i);
617
618 stats[i].len = B43_PIO_MAX_NR_TXPACKETS - q->free_packet_slots;
619 stats[i].limit = B43_PIO_MAX_NR_TXPACKETS;
620 stats[i].count = q->nr_tx_packets;
621 }
622}
623
624/* Returns whether we should fetch another frame. */ 607/* Returns whether we should fetch another frame. */
625static bool pio_rx_frame(struct b43_pio_rxqueue *q) 608static bool pio_rx_frame(struct b43_pio_rxqueue *q)
626{ 609{
diff --git a/drivers/net/wireless/b43/pio.h b/drivers/net/wireless/b43/pio.h
index 7b3c42f93a16..1e516147424f 100644
--- a/drivers/net/wireless/b43/pio.h
+++ b/drivers/net/wireless/b43/pio.h
@@ -90,9 +90,6 @@ struct b43_pio_txqueue {
90 struct b43_pio_txpacket packets[B43_PIO_MAX_NR_TXPACKETS]; 90 struct b43_pio_txpacket packets[B43_PIO_MAX_NR_TXPACKETS];
91 struct list_head packets_list; 91 struct list_head packets_list;
92 92
93 /* Total number of transmitted packets. */
94 unsigned int nr_tx_packets;
95
96 /* Shortcut to the 802.11 core revision. This is to 93 /* Shortcut to the 802.11 core revision. This is to
97 * avoid horrible pointer dereferencing in the fastpaths. */ 94 * avoid horrible pointer dereferencing in the fastpaths. */
98 u8 rev; 95 u8 rev;
@@ -160,8 +157,6 @@ void b43_pio_free(struct b43_wldev *dev);
160int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb); 157int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb);
161void b43_pio_handle_txstatus(struct b43_wldev *dev, 158void b43_pio_handle_txstatus(struct b43_wldev *dev,
162 const struct b43_txstatus *status); 159 const struct b43_txstatus *status);
163void b43_pio_get_tx_stats(struct b43_wldev *dev,
164 struct ieee80211_tx_queue_stats *stats);
165void b43_pio_rx(struct b43_pio_rxqueue *q); 160void b43_pio_rx(struct b43_pio_rxqueue *q);
166 161
167void b43_pio_tx_suspend(struct b43_wldev *dev); 162void b43_pio_tx_suspend(struct b43_wldev *dev);
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 0a86bdf53154..8b9387c6ff36 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1411,7 +1411,6 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev,
1411 b43legacyerr(dev->wl, "DMA tx mapping failure\n"); 1411 b43legacyerr(dev->wl, "DMA tx mapping failure\n");
1412 goto out_unlock; 1412 goto out_unlock;
1413 } 1413 }
1414 ring->nr_tx_packets++;
1415 if ((free_slots(ring) < SLOTS_PER_PACKET) || 1414 if ((free_slots(ring) < SLOTS_PER_PACKET) ||
1416 should_inject_overflow(ring)) { 1415 should_inject_overflow(ring)) {
1417 /* This TX ring is full. */ 1416 /* This TX ring is full. */
@@ -1527,25 +1526,6 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
1527 spin_unlock(&ring->lock); 1526 spin_unlock(&ring->lock);
1528} 1527}
1529 1528
1530void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
1531 struct ieee80211_tx_queue_stats *stats)
1532{
1533 const int nr_queues = dev->wl->hw->queues;
1534 struct b43legacy_dmaring *ring;
1535 unsigned long flags;
1536 int i;
1537
1538 for (i = 0; i < nr_queues; i++) {
1539 ring = priority_to_txring(dev, i);
1540
1541 spin_lock_irqsave(&ring->lock, flags);
1542 stats[i].len = ring->used_slots / SLOTS_PER_PACKET;
1543 stats[i].limit = ring->nr_slots / SLOTS_PER_PACKET;
1544 stats[i].count = ring->nr_tx_packets;
1545 spin_unlock_irqrestore(&ring->lock, flags);
1546 }
1547}
1548
1549static void dma_rx(struct b43legacy_dmaring *ring, 1529static void dma_rx(struct b43legacy_dmaring *ring,
1550 int *slot) 1530 int *slot)
1551{ 1531{
diff --git a/drivers/net/wireless/b43legacy/dma.h b/drivers/net/wireless/b43legacy/dma.h
index 2f186003c31e..f9681041c2d8 100644
--- a/drivers/net/wireless/b43legacy/dma.h
+++ b/drivers/net/wireless/b43legacy/dma.h
@@ -243,8 +243,6 @@ struct b43legacy_dmaring {
243 int used_slots; 243 int used_slots;
244 /* Currently used slot in the ring. */ 244 /* Currently used slot in the ring. */
245 int current_slot; 245 int current_slot;
246 /* Total number of packets sent. Statistics only. */
247 unsigned int nr_tx_packets;
248 /* Frameoffset in octets. */ 246 /* Frameoffset in octets. */
249 u32 frameoffset; 247 u32 frameoffset;
250 /* Descriptor buffer size. */ 248 /* Descriptor buffer size. */
@@ -292,9 +290,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev);
292void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev); 290void b43legacy_dma_tx_suspend(struct b43legacy_wldev *dev);
293void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev); 291void b43legacy_dma_tx_resume(struct b43legacy_wldev *dev);
294 292
295void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
296 struct ieee80211_tx_queue_stats *stats);
297
298int b43legacy_dma_tx(struct b43legacy_wldev *dev, 293int b43legacy_dma_tx(struct b43legacy_wldev *dev,
299 struct sk_buff *skb); 294 struct sk_buff *skb);
300void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, 295void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
@@ -315,11 +310,6 @@ void b43legacy_dma_free(struct b43legacy_wldev *dev)
315{ 310{
316} 311}
317static inline 312static inline
318void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
319 struct ieee80211_tx_queue_stats *stats)
320{
321}
322static inline
323int b43legacy_dma_tx(struct b43legacy_wldev *dev, 313int b43legacy_dma_tx(struct b43legacy_wldev *dev,
324 struct sk_buff *skb) 314 struct sk_buff *skb)
325{ 315{
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 874a64a6c610..1d070be5a678 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2446,29 +2446,6 @@ static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, u16 queue,
2446 return 0; 2446 return 0;
2447} 2447}
2448 2448
2449static int b43legacy_op_get_tx_stats(struct ieee80211_hw *hw,
2450 struct ieee80211_tx_queue_stats *stats)
2451{
2452 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2453 struct b43legacy_wldev *dev = wl->current_dev;
2454 unsigned long flags;
2455 int err = -ENODEV;
2456
2457 if (!dev)
2458 goto out;
2459 spin_lock_irqsave(&wl->irq_lock, flags);
2460 if (likely(b43legacy_status(dev) >= B43legacy_STAT_STARTED)) {
2461 if (b43legacy_using_pio(dev))
2462 b43legacy_pio_get_tx_stats(dev, stats);
2463 else
2464 b43legacy_dma_get_tx_stats(dev, stats);
2465 err = 0;
2466 }
2467 spin_unlock_irqrestore(&wl->irq_lock, flags);
2468out:
2469 return err;
2470}
2471
2472static int b43legacy_op_get_stats(struct ieee80211_hw *hw, 2449static int b43legacy_op_get_stats(struct ieee80211_hw *hw,
2473 struct ieee80211_low_level_stats *stats) 2450 struct ieee80211_low_level_stats *stats)
2474{ 2451{
@@ -2923,6 +2900,7 @@ static int b43legacy_wireless_core_start(struct b43legacy_wldev *dev)
2923 goto out; 2900 goto out;
2924 } 2901 }
2925 /* We are ready to run. */ 2902 /* We are ready to run. */
2903 ieee80211_wake_queues(dev->wl->hw);
2926 b43legacy_set_status(dev, B43legacy_STAT_STARTED); 2904 b43legacy_set_status(dev, B43legacy_STAT_STARTED);
2927 2905
2928 /* Start data flow (TX/RX) */ 2906 /* Start data flow (TX/RX) */
@@ -3343,6 +3321,7 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
3343 b43legacy_security_init(dev); 3321 b43legacy_security_init(dev);
3344 b43legacy_rng_init(wl); 3322 b43legacy_rng_init(wl);
3345 3323
3324 ieee80211_wake_queues(dev->wl->hw);
3346 b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED); 3325 b43legacy_set_status(dev, B43legacy_STAT_INITIALIZED);
3347 3326
3348 b43legacy_leds_init(dev); 3327 b43legacy_leds_init(dev);
@@ -3511,7 +3490,6 @@ static const struct ieee80211_ops b43legacy_hw_ops = {
3511 .bss_info_changed = b43legacy_op_bss_info_changed, 3490 .bss_info_changed = b43legacy_op_bss_info_changed,
3512 .configure_filter = b43legacy_op_configure_filter, 3491 .configure_filter = b43legacy_op_configure_filter,
3513 .get_stats = b43legacy_op_get_stats, 3492 .get_stats = b43legacy_op_get_stats,
3514 .get_tx_stats = b43legacy_op_get_tx_stats,
3515 .start = b43legacy_op_start, 3493 .start = b43legacy_op_start,
3516 .stop = b43legacy_op_stop, 3494 .stop = b43legacy_op_stop,
3517 .set_tim = b43legacy_op_beacon_set_tim, 3495 .set_tim = b43legacy_op_beacon_set_tim,
diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c
index 51866c9a2769..017c0e9c37ef 100644
--- a/drivers/net/wireless/b43legacy/pio.c
+++ b/drivers/net/wireless/b43legacy/pio.c
@@ -477,7 +477,6 @@ int b43legacy_pio_tx(struct b43legacy_wldev *dev,
477 477
478 list_move_tail(&packet->list, &queue->txqueue); 478 list_move_tail(&packet->list, &queue->txqueue);
479 queue->nr_txfree--; 479 queue->nr_txfree--;
480 queue->nr_tx_packets++;
481 B43legacy_WARN_ON(queue->nr_txfree >= B43legacy_PIO_MAXTXPACKETS); 480 B43legacy_WARN_ON(queue->nr_txfree >= B43legacy_PIO_MAXTXPACKETS);
482 481
483 tasklet_schedule(&queue->txtask); 482 tasklet_schedule(&queue->txtask);
@@ -546,18 +545,6 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
546 tasklet_schedule(&queue->txtask); 545 tasklet_schedule(&queue->txtask);
547} 546}
548 547
549void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
550 struct ieee80211_tx_queue_stats *stats)
551{
552 struct b43legacy_pio *pio = &dev->pio;
553 struct b43legacy_pioqueue *queue;
554
555 queue = pio->queue1;
556 stats[0].len = B43legacy_PIO_MAXTXPACKETS - queue->nr_txfree;
557 stats[0].limit = B43legacy_PIO_MAXTXPACKETS;
558 stats[0].count = queue->nr_tx_packets;
559}
560
561static void pio_rx_error(struct b43legacy_pioqueue *queue, 548static void pio_rx_error(struct b43legacy_pioqueue *queue,
562 int clear_buffers, 549 int clear_buffers,
563 const char *error) 550 const char *error)
diff --git a/drivers/net/wireless/b43legacy/pio.h b/drivers/net/wireless/b43legacy/pio.h
index 464fec05a06d..8e6773ea6e75 100644
--- a/drivers/net/wireless/b43legacy/pio.h
+++ b/drivers/net/wireless/b43legacy/pio.h
@@ -74,10 +74,6 @@ struct b43legacy_pioqueue {
74 * posted to the device. We are waiting for the txstatus. 74 * posted to the device. We are waiting for the txstatus.
75 */ 75 */
76 struct list_head txrunning; 76 struct list_head txrunning;
77 /* Total number or packets sent.
78 * (This counter can obviously wrap).
79 */
80 unsigned int nr_tx_packets;
81 struct tasklet_struct txtask; 77 struct tasklet_struct txtask;
82 struct b43legacy_pio_txpacket 78 struct b43legacy_pio_txpacket
83 tx_packets_cache[B43legacy_PIO_MAXTXPACKETS]; 79 tx_packets_cache[B43legacy_PIO_MAXTXPACKETS];
@@ -106,8 +102,6 @@ int b43legacy_pio_tx(struct b43legacy_wldev *dev,
106 struct sk_buff *skb); 102 struct sk_buff *skb);
107void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev, 103void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
108 const struct b43legacy_txstatus *status); 104 const struct b43legacy_txstatus *status);
109void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
110 struct ieee80211_tx_queue_stats *stats);
111void b43legacy_pio_rx(struct b43legacy_pioqueue *queue); 105void b43legacy_pio_rx(struct b43legacy_pioqueue *queue);
112 106
113/* Suspend TX queue in hardware. */ 107/* Suspend TX queue in hardware. */
@@ -140,11 +134,6 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
140{ 134{
141} 135}
142static inline 136static inline
143void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
144 struct ieee80211_tx_queue_stats *stats)
145{
146}
147static inline
148void b43legacy_pio_rx(struct b43legacy_pioqueue *queue) 137void b43legacy_pio_rx(struct b43legacy_pioqueue *queue)
149{ 138{
150} 139}
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 9d1820676f30..694ceef88590 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -247,6 +247,7 @@ struct iwl_cfg iwl1000_bgn_cfg = {
247 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 247 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
248 .support_ct_kill_exit = true, 248 .support_ct_kill_exit = true,
249 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 249 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
250 .chain_noise_scale = 1000,
250}; 251};
251 252
252struct iwl_cfg iwl1000_bg_cfg = { 253struct iwl_cfg iwl1000_bg_cfg = {
@@ -274,6 +275,7 @@ struct iwl_cfg iwl1000_bg_cfg = {
274 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 275 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
275 .support_ct_kill_exit = true, 276 .support_ct_kill_exit = true,
276 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 277 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
278 .chain_noise_scale = 1000,
277}; 279};
278 280
279MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); 281MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 6d5988901341..f3d662c8cbcf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -179,14 +179,24 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
179 data->delta_gain_code[i] = 0; 179 data->delta_gain_code[i] = 0;
180 continue; 180 continue;
181 } 181 }
182 delta_g = (1000 * ((s32)average_noise[default_chain] - 182
183 delta_g = (priv->cfg->chain_noise_scale *
184 ((s32)average_noise[default_chain] -
183 (s32)average_noise[i])) / 1500; 185 (s32)average_noise[i])) / 1500;
186
184 /* bound gain by 2 bits value max, 3rd bit is sign */ 187 /* bound gain by 2 bits value max, 3rd bit is sign */
185 data->delta_gain_code[i] = 188 data->delta_gain_code[i] =
186 min(abs(delta_g), (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE); 189 min(abs(delta_g), (long) CHAIN_NOISE_MAX_DELTA_GAIN_CODE);
187 190
188 if (delta_g < 0) 191 if (delta_g < 0)
189 /* set negative sign */ 192 /*
193 * set negative sign ...
194 * note to Intel developers: This is uCode API format,
195 * not the format of any internal device registers.
196 * Do not change this format for e.g. 6050 or similar
197 * devices. Change format only if more resolution
198 * (i.e. more than 2 bits magnitude) is needed.
199 */
190 data->delta_gain_code[i] |= (1 << 2); 200 data->delta_gain_code[i] |= (1 << 2);
191 } 201 }
192 202
@@ -1587,6 +1597,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
1587 .use_rts_for_ht = true, /* use rts/cts protection */ 1597 .use_rts_for_ht = true, /* use rts/cts protection */
1588 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1598 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1589 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1599 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1600 .chain_noise_scale = 1000,
1590}; 1601};
1591 1602
1592struct iwl_cfg iwl5100_bgn_cfg = { 1603struct iwl_cfg iwl5100_bgn_cfg = {
@@ -1612,6 +1623,7 @@ struct iwl_cfg iwl5100_bgn_cfg = {
1612 .use_rts_for_ht = true, /* use rts/cts protection */ 1623 .use_rts_for_ht = true, /* use rts/cts protection */
1613 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1624 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1614 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1625 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1626 .chain_noise_scale = 1000,
1615}; 1627};
1616 1628
1617struct iwl_cfg iwl5100_abg_cfg = { 1629struct iwl_cfg iwl5100_abg_cfg = {
@@ -1635,6 +1647,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
1635 .led_compensation = 51, 1647 .led_compensation = 51,
1636 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1648 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1637 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1649 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1650 .chain_noise_scale = 1000,
1638}; 1651};
1639 1652
1640struct iwl_cfg iwl5100_agn_cfg = { 1653struct iwl_cfg iwl5100_agn_cfg = {
@@ -1660,6 +1673,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
1660 .use_rts_for_ht = true, /* use rts/cts protection */ 1673 .use_rts_for_ht = true, /* use rts/cts protection */
1661 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1674 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1662 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1675 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1676 .chain_noise_scale = 1000,
1663}; 1677};
1664 1678
1665struct iwl_cfg iwl5350_agn_cfg = { 1679struct iwl_cfg iwl5350_agn_cfg = {
@@ -1685,6 +1699,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
1685 .use_rts_for_ht = true, /* use rts/cts protection */ 1699 .use_rts_for_ht = true, /* use rts/cts protection */
1686 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1700 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1687 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1701 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1702 .chain_noise_scale = 1000,
1688}; 1703};
1689 1704
1690struct iwl_cfg iwl5150_agn_cfg = { 1705struct iwl_cfg iwl5150_agn_cfg = {
@@ -1710,6 +1725,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
1710 .use_rts_for_ht = true, /* use rts/cts protection */ 1725 .use_rts_for_ht = true, /* use rts/cts protection */
1711 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1726 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1712 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1727 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1728 .chain_noise_scale = 1000,
1713}; 1729};
1714 1730
1715struct iwl_cfg iwl5150_abg_cfg = { 1731struct iwl_cfg iwl5150_abg_cfg = {
@@ -1733,6 +1749,7 @@ struct iwl_cfg iwl5150_abg_cfg = {
1733 .led_compensation = 51, 1749 .led_compensation = 51,
1734 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, 1750 .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
1735 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, 1751 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
1752 .chain_noise_scale = 1000,
1736}; 1753};
1737 1754
1738MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); 1755MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index a9f8551e0e40..782e23a26984 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -277,21 +277,6 @@ static const struct iwl_ops iwl6000_ops = {
277 .led = &iwlagn_led_ops, 277 .led = &iwlagn_led_ops,
278}; 278};
279 279
280static struct iwl_hcmd_utils_ops iwl6050_hcmd_utils = {
281 .get_hcmd_size = iwl5000_get_hcmd_size,
282 .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
283 .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag,
284 .calc_rssi = iwl5000_calc_rssi,
285};
286
287static const struct iwl_ops iwl6050_ops = {
288 .ucode = &iwl5000_ucode,
289 .lib = &iwl6000_lib,
290 .hcmd = &iwl5000_hcmd,
291 .utils = &iwl6050_hcmd_utils,
292 .led = &iwlagn_led_ops,
293};
294
295/* 280/*
296 * "i": Internal configuration, use internal Power Amplifier 281 * "i": Internal configuration, use internal Power Amplifier
297 */ 282 */
@@ -324,6 +309,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
324 .adv_thermal_throttle = true, 309 .adv_thermal_throttle = true,
325 .support_ct_kill_exit = true, 310 .support_ct_kill_exit = true,
326 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 311 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
312 .chain_noise_scale = 1000,
327}; 313};
328 314
329struct iwl_cfg iwl6000i_2abg_cfg = { 315struct iwl_cfg iwl6000i_2abg_cfg = {
@@ -354,6 +340,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
354 .adv_thermal_throttle = true, 340 .adv_thermal_throttle = true,
355 .support_ct_kill_exit = true, 341 .support_ct_kill_exit = true,
356 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 342 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
343 .chain_noise_scale = 1000,
357}; 344};
358 345
359struct iwl_cfg iwl6000i_2bg_cfg = { 346struct iwl_cfg iwl6000i_2bg_cfg = {
@@ -384,6 +371,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
384 .adv_thermal_throttle = true, 371 .adv_thermal_throttle = true,
385 .support_ct_kill_exit = true, 372 .support_ct_kill_exit = true,
386 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 373 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
374 .chain_noise_scale = 1000,
387}; 375};
388 376
389struct iwl_cfg iwl6050_2agn_cfg = { 377struct iwl_cfg iwl6050_2agn_cfg = {
@@ -392,7 +380,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
392 .ucode_api_max = IWL6050_UCODE_API_MAX, 380 .ucode_api_max = IWL6050_UCODE_API_MAX,
393 .ucode_api_min = IWL6050_UCODE_API_MIN, 381 .ucode_api_min = IWL6050_UCODE_API_MIN,
394 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 382 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
395 .ops = &iwl6050_ops, 383 .ops = &iwl6000_ops,
396 .eeprom_size = OTP_LOW_IMAGE_SIZE, 384 .eeprom_size = OTP_LOW_IMAGE_SIZE,
397 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 385 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
398 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 386 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
@@ -415,6 +403,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
415 .adv_thermal_throttle = true, 403 .adv_thermal_throttle = true,
416 .support_ct_kill_exit = true, 404 .support_ct_kill_exit = true,
417 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 405 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
406 .chain_noise_scale = 1500,
418}; 407};
419 408
420struct iwl_cfg iwl6050_2abg_cfg = { 409struct iwl_cfg iwl6050_2abg_cfg = {
@@ -423,7 +412,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
423 .ucode_api_max = IWL6050_UCODE_API_MAX, 412 .ucode_api_max = IWL6050_UCODE_API_MAX,
424 .ucode_api_min = IWL6050_UCODE_API_MIN, 413 .ucode_api_min = IWL6050_UCODE_API_MIN,
425 .sku = IWL_SKU_A|IWL_SKU_G, 414 .sku = IWL_SKU_A|IWL_SKU_G,
426 .ops = &iwl6050_ops, 415 .ops = &iwl6000_ops,
427 .eeprom_size = OTP_LOW_IMAGE_SIZE, 416 .eeprom_size = OTP_LOW_IMAGE_SIZE,
428 .eeprom_ver = EEPROM_6050_EEPROM_VERSION, 417 .eeprom_ver = EEPROM_6050_EEPROM_VERSION,
429 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 418 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
@@ -445,6 +434,7 @@ struct iwl_cfg iwl6050_2abg_cfg = {
445 .adv_thermal_throttle = true, 434 .adv_thermal_throttle = true,
446 .support_ct_kill_exit = true, 435 .support_ct_kill_exit = true,
447 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 436 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
437 .chain_noise_scale = 1500,
448}; 438};
449 439
450struct iwl_cfg iwl6000_3agn_cfg = { 440struct iwl_cfg iwl6000_3agn_cfg = {
@@ -476,6 +466,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
476 .adv_thermal_throttle = true, 466 .adv_thermal_throttle = true,
477 .support_ct_kill_exit = true, 467 .support_ct_kill_exit = true,
478 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 468 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
469 .chain_noise_scale = 1000,
479}; 470};
480 471
481MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); 472MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d0268280d679..1854c720b5e0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2631,7 +2631,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv)
2631 */ 2631 */
2632 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; 2632 hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
2633 2633
2634 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; 2634 hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX + 1;
2635 /* we create the 802.11 header and a zero-length SSID element */ 2635 /* we create the 802.11 header and a zero-length SSID element */
2636 hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; 2636 hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2;
2637 2637
@@ -3440,7 +3440,6 @@ static struct ieee80211_ops iwl_hw_ops = {
3440 .set_key = iwl_mac_set_key, 3440 .set_key = iwl_mac_set_key,
3441 .update_tkip_key = iwl_mac_update_tkip_key, 3441 .update_tkip_key = iwl_mac_update_tkip_key,
3442 .get_stats = iwl_mac_get_stats, 3442 .get_stats = iwl_mac_get_stats,
3443 .get_tx_stats = iwl_mac_get_tx_stats,
3444 .conf_tx = iwl_mac_conf_tx, 3443 .conf_tx = iwl_mac_conf_tx,
3445 .reset_tsf = iwl_mac_reset_tsf, 3444 .reset_tsf = iwl_mac_reset_tsf,
3446 .bss_info_changed = iwl_bss_info_changed, 3445 .bss_info_changed = iwl_bss_info_changed,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 02bf17ecaf54..d390eef2efe5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2787,6 +2787,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2787 if ((le16_to_cpu(priv->staging_rxon.channel) != ch)) 2787 if ((le16_to_cpu(priv->staging_rxon.channel) != ch))
2788 priv->staging_rxon.flags = 0; 2788 priv->staging_rxon.flags = 0;
2789 2789
2790 iwl_set_rxon_ht(priv, ht_conf);
2790 iwl_set_rxon_channel(priv, conf->channel); 2791 iwl_set_rxon_channel(priv, conf->channel);
2791 2792
2792 iwl_set_flags_for_band(priv, conf->channel->band); 2793 iwl_set_flags_for_band(priv, conf->channel->band);
@@ -2850,42 +2851,6 @@ out:
2850} 2851}
2851EXPORT_SYMBOL(iwl_mac_config); 2852EXPORT_SYMBOL(iwl_mac_config);
2852 2853
2853int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
2854 struct ieee80211_tx_queue_stats *stats)
2855{
2856 struct iwl_priv *priv = hw->priv;
2857 int i, avail;
2858 struct iwl_tx_queue *txq;
2859 struct iwl_queue *q;
2860 unsigned long flags;
2861
2862 IWL_DEBUG_MAC80211(priv, "enter\n");
2863
2864 if (!iwl_is_ready_rf(priv)) {
2865 IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
2866 return -EIO;
2867 }
2868
2869 spin_lock_irqsave(&priv->lock, flags);
2870
2871 for (i = 0; i < AC_NUM; i++) {
2872 txq = &priv->txq[i];
2873 q = &txq->q;
2874 avail = iwl_queue_space(q);
2875
2876 stats[i].len = q->n_window - avail;
2877 stats[i].limit = q->n_window - q->high_mark;
2878 stats[i].count = q->n_window;
2879
2880 }
2881 spin_unlock_irqrestore(&priv->lock, flags);
2882
2883 IWL_DEBUG_MAC80211(priv, "leave\n");
2884
2885 return 0;
2886}
2887EXPORT_SYMBOL(iwl_mac_get_tx_stats);
2888
2889void iwl_mac_reset_tsf(struct ieee80211_hw *hw) 2854void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
2890{ 2855{
2891 struct iwl_priv *priv = hw->priv; 2856 struct iwl_priv *priv = hw->priv;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index ec1fe1d7cc9a..8f0c564e68b0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -293,6 +293,7 @@ struct iwl_cfg {
293 bool support_ct_kill_exit; 293 bool support_ct_kill_exit;
294 const bool support_wimax_coexist; 294 const bool support_wimax_coexist;
295 u8 plcp_delta_threshold; 295 u8 plcp_delta_threshold;
296 s32 chain_noise_scale;
296}; 297};
297 298
298/*************************** 299/***************************
@@ -341,8 +342,6 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
341 struct ieee80211_vif *vif); 342 struct ieee80211_vif *vif);
342int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); 343int iwl_mac_config(struct ieee80211_hw *hw, u32 changed);
343void iwl_config_ap(struct iwl_priv *priv); 344void iwl_config_ap(struct iwl_priv *priv);
344int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
345 struct ieee80211_tx_queue_stats *stats);
346void iwl_mac_reset_tsf(struct ieee80211_hw *hw); 345void iwl_mac_reset_tsf(struct ieee80211_hw *hw);
347int iwl_alloc_txq_mem(struct iwl_priv *priv); 346int iwl_alloc_txq_mem(struct iwl_priv *priv);
348void iwl_free_txq_mem(struct iwl_priv *priv); 347void iwl_free_txq_mem(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 08faafae8497..f786a407638f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -651,9 +651,20 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
651 if (left < 0) 651 if (left < 0)
652 return 0; 652 return 0;
653 *pos++ = WLAN_EID_SSID; 653 *pos++ = WLAN_EID_SSID;
654 *pos++ = 0; 654 if (!priv->is_internal_short_scan &&
655 655 priv->scan_request->n_ssids) {
656 len += 2; 656 struct cfg80211_ssid *ssid =
657 priv->scan_request->ssids;
658
659 /* Broadcast if ssid_len is 0 */
660 *pos++ = ssid->ssid_len;
661 memcpy(pos, ssid->ssid, ssid->ssid_len);
662 pos += ssid->ssid_len;
663 len += 2 + ssid->ssid_len;
664 } else {
665 *pos++ = 0;
666 len += 2;
667 }
657 668
658 if (WARN_ON(left < ie_len)) 669 if (WARN_ON(left < ie_len))
659 return len; 670 return len;
@@ -782,20 +793,26 @@ static void iwl_bg_request_scan(struct work_struct *data)
782 if (priv->is_internal_short_scan) { 793 if (priv->is_internal_short_scan) {
783 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n"); 794 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
784 } else if (priv->scan_request->n_ssids) { 795 } else if (priv->scan_request->n_ssids) {
785 int i, p = 0;
786 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); 796 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
787 for (i = 0; i < priv->scan_request->n_ssids; i++) { 797 /*
788 /* always does wildcard anyway */ 798 * The first SSID to scan is stuffed into the probe request
789 if (!priv->scan_request->ssids[i].ssid_len) 799 * template and the remaining ones are handled through the
790 continue; 800 * direct_scan array.
791 scan->direct_scan[p].id = WLAN_EID_SSID; 801 */
792 scan->direct_scan[p].len = 802 if (priv->scan_request->n_ssids > 1) {
793 priv->scan_request->ssids[i].ssid_len; 803 int i, p = 0;
794 memcpy(scan->direct_scan[p].ssid, 804 for (i = 1; i < priv->scan_request->n_ssids; i++) {
795 priv->scan_request->ssids[i].ssid, 805 if (!priv->scan_request->ssids[i].ssid_len)
796 priv->scan_request->ssids[i].ssid_len); 806 continue;
797 n_probes++; 807 scan->direct_scan[p].id = WLAN_EID_SSID;
798 p++; 808 scan->direct_scan[p].len =
809 priv->scan_request->ssids[i].ssid_len;
810 memcpy(scan->direct_scan[p].ssid,
811 priv->scan_request->ssids[i].ssid,
812 priv->scan_request->ssids[i].ssid_len);
813 n_probes++;
814 p++;
815 }
799 } 816 }
800 is_active = true; 817 is_active = true;
801 } else 818 } else
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 119da54116de..eac2b9a95711 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3835,7 +3835,6 @@ static struct ieee80211_ops iwl3945_hw_ops = {
3835 .config = iwl_mac_config, 3835 .config = iwl_mac_config,
3836 .configure_filter = iwl_configure_filter, 3836 .configure_filter = iwl_configure_filter,
3837 .set_key = iwl3945_mac_set_key, 3837 .set_key = iwl3945_mac_set_key,
3838 .get_tx_stats = iwl_mac_get_tx_stats,
3839 .conf_tx = iwl_mac_conf_tx, 3838 .conf_tx = iwl_mac_conf_tx,
3840 .reset_tsf = iwl_mac_reset_tsf, 3839 .reset_tsf = iwl_mac_reset_tsf,
3841 .bss_info_changed = iwl_bss_info_changed, 3840 .bss_info_changed = iwl_bss_info_changed,
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 0334a58820ee..e7470442f76b 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -240,11 +240,6 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
240 /* Now we got response from FW, cancel the command timer */ 240 /* Now we got response from FW, cancel the command timer */
241 del_timer(&priv->command_timer); 241 del_timer(&priv->command_timer);
242 priv->cmd_timed_out = 0; 242 priv->cmd_timed_out = 0;
243 if (priv->nr_retries) {
244 lbs_pr_info("Received result %x to command %x after %d retries\n",
245 result, curcmd, priv->nr_retries);
246 priv->nr_retries = 0;
247 }
248 243
249 /* Store the response code to cur_cmd_retcode. */ 244 /* Store the response code to cur_cmd_retcode. */
250 priv->cur_cmd_retcode = result; 245 priv->cur_cmd_retcode = result;
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index c348aff8f309..6977ee820214 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -109,7 +109,6 @@ struct lbs_private {
109 struct list_head cmdpendingq; /* pending command buffers */ 109 struct list_head cmdpendingq; /* pending command buffers */
110 wait_queue_head_t cmd_pending; 110 wait_queue_head_t cmd_pending;
111 struct timer_list command_timer; 111 struct timer_list command_timer;
112 int nr_retries;
113 int cmd_timed_out; 112 int cmd_timed_out;
114 113
115 /* Command responses sent from the hardware to the driver */ 114 /* Command responses sent from the hardware to the driver */
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index bf4bfbae6227..3ea03f259ee7 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -23,6 +23,7 @@
23#include <linux/kthread.h> 23#include <linux/kthread.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/netdevice.h> 25#include <linux/netdevice.h>
26#include <linux/semaphore.h>
26#include <linux/spi/libertas_spi.h> 27#include <linux/spi/libertas_spi.h>
27#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
28 29
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 60bde1233a30..cd8ed7fdafad 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -536,31 +536,14 @@ static int lbs_thread(void *data)
536 if (priv->cmd_timed_out && priv->cur_cmd) { 536 if (priv->cmd_timed_out && priv->cur_cmd) {
537 struct cmd_ctrl_node *cmdnode = priv->cur_cmd; 537 struct cmd_ctrl_node *cmdnode = priv->cur_cmd;
538 538
539 if (++priv->nr_retries > 3) { 539 lbs_pr_info("Timeout submitting command 0x%04x\n",
540 lbs_pr_info("Excessive timeouts submitting " 540 le16_to_cpu(cmdnode->cmdbuf->command));
541 "command 0x%04x\n", 541 lbs_complete_command(priv, cmdnode, -ETIMEDOUT);
542 le16_to_cpu(cmdnode->cmdbuf->command)); 542 if (priv->reset_card)
543 lbs_complete_command(priv, cmdnode, -ETIMEDOUT); 543 priv->reset_card(priv);
544 priv->nr_retries = 0;
545 if (priv->reset_card)
546 priv->reset_card(priv);
547 } else {
548 priv->cur_cmd = NULL;
549 priv->dnld_sent = DNLD_RES_RECEIVED;
550 lbs_pr_info("requeueing command 0x%04x due "
551 "to timeout (#%d)\n",
552 le16_to_cpu(cmdnode->cmdbuf->command),
553 priv->nr_retries);
554
555 /* Stick it back at the _top_ of the pending queue
556 for immediate resubmission */
557 list_add(&cmdnode->list, &priv->cmdpendingq);
558 }
559 } 544 }
560 priv->cmd_timed_out = 0; 545 priv->cmd_timed_out = 0;
561 546
562
563
564 if (!priv->fw_ready) 547 if (!priv->fw_ready)
565 continue; 548 continue;
566 549
@@ -732,7 +715,7 @@ done:
732 * This function handles the timeout of command sending. 715 * This function handles the timeout of command sending.
733 * It will re-send the same command again. 716 * It will re-send the same command again.
734 */ 717 */
735static void command_timer_fn(unsigned long data) 718static void lbs_cmd_timeout_handler(unsigned long data)
736{ 719{
737 struct lbs_private *priv = (struct lbs_private *)data; 720 struct lbs_private *priv = (struct lbs_private *)data;
738 unsigned long flags; 721 unsigned long flags;
@@ -851,7 +834,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
851 834
852 mutex_init(&priv->lock); 835 mutex_init(&priv->lock);
853 836
854 setup_timer(&priv->command_timer, command_timer_fn, 837 setup_timer(&priv->command_timer, lbs_cmd_timeout_handler,
855 (unsigned long)priv); 838 (unsigned long)priv);
856 setup_timer(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn, 839 setup_timer(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn,
857 (unsigned long)priv); 840 (unsigned long)priv);
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index ba3eb0101d55..6ab30033c26c 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -555,6 +555,9 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
555 priv->band.n_channels = ARRAY_SIZE(lbtf_channels); 555 priv->band.n_channels = ARRAY_SIZE(lbtf_channels);
556 priv->band.channels = priv->channels; 556 priv->band.channels = priv->channels;
557 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; 557 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
558 hw->wiphy->interface_modes =
559 BIT(NL80211_IFTYPE_STATION) |
560 BIT(NL80211_IFTYPE_ADHOC);
558 skb_queue_head_init(&priv->bc_ps_buf); 561 skb_queue_head_init(&priv->bc_ps_buf);
559 562
560 SET_IEEE80211_DEV(hw, dmdev); 563 SET_IEEE80211_DEV(hw, dmdev);
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 0dbda8dfbd99..00ffe6dd435e 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -32,6 +32,10 @@ static int radios = 2;
32module_param(radios, int, 0444); 32module_param(radios, int, 0444);
33MODULE_PARM_DESC(radios, "Number of simulated radios"); 33MODULE_PARM_DESC(radios, "Number of simulated radios");
34 34
35static bool fake_hw_scan;
36module_param(fake_hw_scan, bool, 0444);
37MODULE_PARM_DESC(fake_hw_scan, "Install fake (no-op) hw-scan handler");
38
35/** 39/**
36 * enum hwsim_regtest - the type of regulatory tests we offer 40 * enum hwsim_regtest - the type of regulatory tests we offer
37 * 41 *
@@ -908,8 +912,43 @@ static void mac80211_hwsim_flush(struct ieee80211_hw *hw, bool drop)
908 */ 912 */
909} 913}
910 914
915struct hw_scan_done {
916 struct delayed_work w;
917 struct ieee80211_hw *hw;
918};
911 919
912static const struct ieee80211_ops mac80211_hwsim_ops = 920static void hw_scan_done(struct work_struct *work)
921{
922 struct hw_scan_done *hsd =
923 container_of(work, struct hw_scan_done, w.work);
924
925 ieee80211_scan_completed(hsd->hw, false);
926 kfree(hsd);
927}
928
929static int mac80211_hwsim_hw_scan(struct ieee80211_hw *hw,
930 struct cfg80211_scan_request *req)
931{
932 struct hw_scan_done *hsd = kzalloc(sizeof(*hsd), GFP_KERNEL);
933 int i;
934
935 if (!hsd)
936 return -ENOMEM;
937
938 hsd->hw = hw;
939 INIT_DELAYED_WORK(&hsd->w, hw_scan_done);
940
941 printk(KERN_DEBUG "hwsim scan request\n");
942 for (i = 0; i < req->n_channels; i++)
943 printk(KERN_DEBUG "hwsim scan freq %d\n",
944 req->channels[i]->center_freq);
945
946 ieee80211_queue_delayed_work(hw, &hsd->w, 2 * HZ);
947
948 return 0;
949}
950
951static struct ieee80211_ops mac80211_hwsim_ops =
913{ 952{
914 .tx = mac80211_hwsim_tx, 953 .tx = mac80211_hwsim_tx,
915 .start = mac80211_hwsim_start, 954 .start = mac80211_hwsim_start,
@@ -1119,6 +1158,9 @@ static int __init init_mac80211_hwsim(void)
1119 if (radios < 1 || radios > 100) 1158 if (radios < 1 || radios > 100)
1120 return -EINVAL; 1159 return -EINVAL;
1121 1160
1161 if (fake_hw_scan)
1162 mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
1163
1122 spin_lock_init(&hwsim_radio_lock); 1164 spin_lock_init(&hwsim_radio_lock);
1123 INIT_LIST_HEAD(&hwsim_radios); 1165 INIT_LIST_HEAD(&hwsim_radios);
1124 1166
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index f0f08f3919cc..0cfdb9db66f7 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -119,7 +119,7 @@ struct mwl8k_tx_queue {
119 /* sw appends here */ 119 /* sw appends here */
120 int tail; 120 int tail;
121 121
122 struct ieee80211_tx_queue_stats stats; 122 unsigned int len;
123 struct mwl8k_tx_desc *txd; 123 struct mwl8k_tx_desc *txd;
124 dma_addr_t txd_dma; 124 dma_addr_t txd_dma;
125 struct sk_buff **skb; 125 struct sk_buff **skb;
@@ -1136,8 +1136,7 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index)
1136 int size; 1136 int size;
1137 int i; 1137 int i;
1138 1138
1139 memset(&txq->stats, 0, sizeof(struct ieee80211_tx_queue_stats)); 1139 txq->len = 0;
1140 txq->stats.limit = MWL8K_TX_DESCS;
1141 txq->head = 0; 1140 txq->head = 0;
1142 txq->tail = 0; 1141 txq->tail = 0;
1143 1142
@@ -1213,7 +1212,7 @@ static void mwl8k_dump_tx_rings(struct ieee80211_hw *hw)
1213 printk(KERN_ERR "%s: txq[%d] len=%d head=%d tail=%d " 1212 printk(KERN_ERR "%s: txq[%d] len=%d head=%d tail=%d "
1214 "fw_owned=%d drv_owned=%d unused=%d\n", 1213 "fw_owned=%d drv_owned=%d unused=%d\n",
1215 wiphy_name(hw->wiphy), i, 1214 wiphy_name(hw->wiphy), i,
1216 txq->stats.len, txq->head, txq->tail, 1215 txq->len, txq->head, txq->tail,
1217 fw_owned, drv_owned, unused); 1216 fw_owned, drv_owned, unused);
1218 } 1217 }
1219} 1218}
@@ -1299,7 +1298,7 @@ mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int limit, int force)
1299 int processed; 1298 int processed;
1300 1299
1301 processed = 0; 1300 processed = 0;
1302 while (txq->stats.len > 0 && limit--) { 1301 while (txq->len > 0 && limit--) {
1303 int tx; 1302 int tx;
1304 struct mwl8k_tx_desc *tx_desc; 1303 struct mwl8k_tx_desc *tx_desc;
1305 unsigned long addr; 1304 unsigned long addr;
@@ -1321,8 +1320,8 @@ mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int limit, int force)
1321 } 1320 }
1322 1321
1323 txq->head = (tx + 1) % MWL8K_TX_DESCS; 1322 txq->head = (tx + 1) % MWL8K_TX_DESCS;
1324 BUG_ON(txq->stats.len == 0); 1323 BUG_ON(txq->len == 0);
1325 txq->stats.len--; 1324 txq->len--;
1326 priv->pending_tx_pkts--; 1325 priv->pending_tx_pkts--;
1327 1326
1328 addr = le32_to_cpu(tx_desc->pkt_phys_addr); 1327 addr = le32_to_cpu(tx_desc->pkt_phys_addr);
@@ -1454,8 +1453,7 @@ mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb)
1454 wmb(); 1453 wmb();
1455 tx->status = cpu_to_le32(MWL8K_TXD_STATUS_FW_OWNED | txstatus); 1454 tx->status = cpu_to_le32(MWL8K_TXD_STATUS_FW_OWNED | txstatus);
1456 1455
1457 txq->stats.count++; 1456 txq->len++;
1458 txq->stats.len++;
1459 priv->pending_tx_pkts++; 1457 priv->pending_tx_pkts++;
1460 1458
1461 txq->tail++; 1459 txq->tail++;
@@ -3818,24 +3816,6 @@ static int mwl8k_conf_tx(struct ieee80211_hw *hw, u16 queue,
3818 return rc; 3816 return rc;
3819} 3817}
3820 3818
3821static int mwl8k_get_tx_stats(struct ieee80211_hw *hw,
3822 struct ieee80211_tx_queue_stats *stats)
3823{
3824 struct mwl8k_priv *priv = hw->priv;
3825 struct mwl8k_tx_queue *txq;
3826 int index;
3827
3828 spin_lock_bh(&priv->tx_lock);
3829 for (index = 0; index < MWL8K_TX_QUEUES; index++) {
3830 txq = priv->txq + index;
3831 memcpy(&stats[index], &txq->stats,
3832 sizeof(struct ieee80211_tx_queue_stats));
3833 }
3834 spin_unlock_bh(&priv->tx_lock);
3835
3836 return 0;
3837}
3838
3839static int mwl8k_get_stats(struct ieee80211_hw *hw, 3819static int mwl8k_get_stats(struct ieee80211_hw *hw,
3840 struct ieee80211_low_level_stats *stats) 3820 struct ieee80211_low_level_stats *stats)
3841{ 3821{
@@ -3871,7 +3851,6 @@ static const struct ieee80211_ops mwl8k_ops = {
3871 .set_rts_threshold = mwl8k_set_rts_threshold, 3851 .set_rts_threshold = mwl8k_set_rts_threshold,
3872 .sta_notify = mwl8k_sta_notify, 3852 .sta_notify = mwl8k_sta_notify,
3873 .conf_tx = mwl8k_conf_tx, 3853 .conf_tx = mwl8k_conf_tx,
3874 .get_tx_stats = mwl8k_get_tx_stats,
3875 .get_stats = mwl8k_get_stats, 3854 .get_stats = mwl8k_get_stats,
3876 .ampdu_action = mwl8k_ampdu_action, 3855 .ampdu_action = mwl8k_ampdu_action,
3877}; 3856};
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c
index 26428e4c9c60..3fe6366e567c 100644
--- a/drivers/net/wireless/p54/main.c
+++ b/drivers/net/wireless/p54/main.c
@@ -358,16 +358,6 @@ static int p54_get_stats(struct ieee80211_hw *dev,
358 return 0; 358 return 0;
359} 359}
360 360
361static int p54_get_tx_stats(struct ieee80211_hw *dev,
362 struct ieee80211_tx_queue_stats *stats)
363{
364 struct p54_common *priv = dev->priv;
365
366 memcpy(stats, &priv->tx_stats[P54_QUEUE_DATA],
367 sizeof(stats[0]) * dev->queues);
368 return 0;
369}
370
371static void p54_bss_info_changed(struct ieee80211_hw *dev, 361static void p54_bss_info_changed(struct ieee80211_hw *dev,
372 struct ieee80211_vif *vif, 362 struct ieee80211_vif *vif,
373 struct ieee80211_bss_conf *info, 363 struct ieee80211_bss_conf *info,
@@ -522,7 +512,6 @@ static const struct ieee80211_ops p54_ops = {
522 .configure_filter = p54_configure_filter, 512 .configure_filter = p54_configure_filter,
523 .conf_tx = p54_conf_tx, 513 .conf_tx = p54_conf_tx,
524 .get_stats = p54_get_stats, 514 .get_stats = p54_get_stats,
525 .get_tx_stats = p54_get_tx_stats
526}; 515};
527 516
528struct ieee80211_hw *p54_init_common(size_t priv_data_len) 517struct ieee80211_hw *p54_init_common(size_t priv_data_len)
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index 1afc39410e85..43a3b2ead81a 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -157,6 +157,12 @@ struct p54_led_dev {
157 157
158#endif /* CONFIG_P54_LEDS */ 158#endif /* CONFIG_P54_LEDS */
159 159
160struct p54_tx_queue_stats {
161 unsigned int len;
162 unsigned int limit;
163 unsigned int count;
164};
165
160struct p54_common { 166struct p54_common {
161 struct ieee80211_hw *hw; 167 struct ieee80211_hw *hw;
162 struct ieee80211_vif *vif; 168 struct ieee80211_vif *vif;
@@ -183,7 +189,7 @@ struct p54_common {
183 /* (e)DCF / QOS state */ 189 /* (e)DCF / QOS state */
184 bool use_short_slot; 190 bool use_short_slot;
185 spinlock_t tx_stats_lock; 191 spinlock_t tx_stats_lock;
186 struct ieee80211_tx_queue_stats tx_stats[8]; 192 struct p54_tx_queue_stats tx_stats[8];
187 struct p54_edcf_queue_param qos_params[8]; 193 struct p54_edcf_queue_param qos_params[8];
188 194
189 /* Radio data */ 195 /* Radio data */
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index b6dda2b27fb5..0e8f69461ffe 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -183,7 +183,7 @@ static int p54_tx_qos_accounting_alloc(struct p54_common *priv,
183 struct sk_buff *skb, 183 struct sk_buff *skb,
184 const u16 p54_queue) 184 const u16 p54_queue)
185{ 185{
186 struct ieee80211_tx_queue_stats *queue; 186 struct p54_tx_queue_stats *queue;
187 unsigned long flags; 187 unsigned long flags;
188 188
189 if (WARN_ON(p54_queue > P54_QUEUE_NUM)) 189 if (WARN_ON(p54_queue > P54_QUEUE_NUM))
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index aa579eb8723f..108982762d45 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1561,7 +1561,6 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = {
1561 .get_stats = rt2x00mac_get_stats, 1561 .get_stats = rt2x00mac_get_stats,
1562 .bss_info_changed = rt2x00mac_bss_info_changed, 1562 .bss_info_changed = rt2x00mac_bss_info_changed,
1563 .conf_tx = rt2400pci_conf_tx, 1563 .conf_tx = rt2400pci_conf_tx,
1564 .get_tx_stats = rt2x00mac_get_tx_stats,
1565 .get_tsf = rt2400pci_get_tsf, 1564 .get_tsf = rt2400pci_get_tsf,
1566 .tx_last_beacon = rt2400pci_tx_last_beacon, 1565 .tx_last_beacon = rt2400pci_tx_last_beacon,
1567 .rfkill_poll = rt2x00mac_rfkill_poll, 1566 .rfkill_poll = rt2x00mac_rfkill_poll,
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 77ee1df7933f..f6440bb0e5f6 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1859,7 +1859,6 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = {
1859 .get_stats = rt2x00mac_get_stats, 1859 .get_stats = rt2x00mac_get_stats,
1860 .bss_info_changed = rt2x00mac_bss_info_changed, 1860 .bss_info_changed = rt2x00mac_bss_info_changed,
1861 .conf_tx = rt2x00mac_conf_tx, 1861 .conf_tx = rt2x00mac_conf_tx,
1862 .get_tx_stats = rt2x00mac_get_tx_stats,
1863 .get_tsf = rt2500pci_get_tsf, 1862 .get_tsf = rt2500pci_get_tsf,
1864 .tx_last_beacon = rt2500pci_tx_last_beacon, 1863 .tx_last_beacon = rt2500pci_tx_last_beacon,
1865 .rfkill_poll = rt2x00mac_rfkill_poll, 1864 .rfkill_poll = rt2x00mac_rfkill_poll,
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 9e6f865c57f2..81ca4ec068db 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1761,7 +1761,6 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = {
1761 .get_stats = rt2x00mac_get_stats, 1761 .get_stats = rt2x00mac_get_stats,
1762 .bss_info_changed = rt2x00mac_bss_info_changed, 1762 .bss_info_changed = rt2x00mac_bss_info_changed,
1763 .conf_tx = rt2x00mac_conf_tx, 1763 .conf_tx = rt2x00mac_conf_tx,
1764 .get_tx_stats = rt2x00mac_get_tx_stats,
1765 .rfkill_poll = rt2x00mac_rfkill_poll, 1764 .rfkill_poll = rt2x00mac_rfkill_poll,
1766}; 1765};
1767 1766
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 529a37364eb0..a45e027f2d1f 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2297,7 +2297,6 @@ const struct ieee80211_ops rt2800_mac80211_ops = {
2297 .set_rts_threshold = rt2800_set_rts_threshold, 2297 .set_rts_threshold = rt2800_set_rts_threshold,
2298 .bss_info_changed = rt2x00mac_bss_info_changed, 2298 .bss_info_changed = rt2x00mac_bss_info_changed,
2299 .conf_tx = rt2800_conf_tx, 2299 .conf_tx = rt2800_conf_tx,
2300 .get_tx_stats = rt2x00mac_get_tx_stats,
2301 .get_tsf = rt2800_get_tsf, 2300 .get_tsf = rt2800_get_tsf,
2302 .rfkill_poll = rt2x00mac_rfkill_poll, 2301 .rfkill_poll = rt2x00mac_rfkill_poll,
2303}; 2302};
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 096da85a66fa..43b70c6e4e9c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -1044,8 +1044,6 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1044#endif /* CONFIG_RT2X00_LIB_CRYPTO */ 1044#endif /* CONFIG_RT2X00_LIB_CRYPTO */
1045int rt2x00mac_get_stats(struct ieee80211_hw *hw, 1045int rt2x00mac_get_stats(struct ieee80211_hw *hw,
1046 struct ieee80211_low_level_stats *stats); 1046 struct ieee80211_low_level_stats *stats);
1047int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw,
1048 struct ieee80211_tx_queue_stats *stats);
1049void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, 1047void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
1050 struct ieee80211_vif *vif, 1048 struct ieee80211_vif *vif,
1051 struct ieee80211_bss_conf *bss_conf, 1049 struct ieee80211_bss_conf *bss_conf,
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 00f1f939f1bb..abbd857ec759 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -555,22 +555,6 @@ int rt2x00mac_get_stats(struct ieee80211_hw *hw,
555} 555}
556EXPORT_SYMBOL_GPL(rt2x00mac_get_stats); 556EXPORT_SYMBOL_GPL(rt2x00mac_get_stats);
557 557
558int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw,
559 struct ieee80211_tx_queue_stats *stats)
560{
561 struct rt2x00_dev *rt2x00dev = hw->priv;
562 unsigned int i;
563
564 for (i = 0; i < rt2x00dev->ops->tx_queues; i++) {
565 stats[i].len = rt2x00dev->tx[i].length;
566 stats[i].limit = rt2x00dev->tx[i].limit;
567 stats[i].count = rt2x00dev->tx[i].count;
568 }
569
570 return 0;
571}
572EXPORT_SYMBOL_GPL(rt2x00mac_get_tx_stats);
573
574void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, 558void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
575 struct ieee80211_vif *vif, 559 struct ieee80211_vif *vif,
576 struct ieee80211_bss_conf *bss_conf, 560 struct ieee80211_bss_conf *bss_conf,
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 1f97a797bc41..74de53e68b4e 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2730,7 +2730,6 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = {
2730 .get_stats = rt2x00mac_get_stats, 2730 .get_stats = rt2x00mac_get_stats,
2731 .bss_info_changed = rt2x00mac_bss_info_changed, 2731 .bss_info_changed = rt2x00mac_bss_info_changed,
2732 .conf_tx = rt61pci_conf_tx, 2732 .conf_tx = rt61pci_conf_tx,
2733 .get_tx_stats = rt2x00mac_get_tx_stats,
2734 .get_tsf = rt61pci_get_tsf, 2733 .get_tsf = rt61pci_get_tsf,
2735 .rfkill_poll = rt2x00mac_rfkill_poll, 2734 .rfkill_poll = rt2x00mac_rfkill_poll,
2736}; 2735};
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index a02691294395..3781eb7b4aa0 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2245,7 +2245,6 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
2245 .get_stats = rt2x00mac_get_stats, 2245 .get_stats = rt2x00mac_get_stats,
2246 .bss_info_changed = rt2x00mac_bss_info_changed, 2246 .bss_info_changed = rt2x00mac_bss_info_changed,
2247 .conf_tx = rt73usb_conf_tx, 2247 .conf_tx = rt73usb_conf_tx,
2248 .get_tx_stats = rt2x00mac_get_tx_stats,
2249 .get_tsf = rt73usb_get_tsf, 2248 .get_tsf = rt73usb_get_tsf,
2250 .rfkill_poll = rt2x00mac_rfkill_poll, 2249 .rfkill_poll = rt2x00mac_rfkill_poll,
2251}; 2250};
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index a717dde4822e..24ae6a360ac8 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -1144,9 +1144,10 @@ static int wl1251_op_conf_tx(struct ieee80211_hw *hw, u16 queue,
1144 if (ret < 0) 1144 if (ret < 0)
1145 goto out; 1145 goto out;
1146 1146
1147 /* mac80211 uses units of 32 usec */
1147 ret = wl1251_acx_ac_cfg(wl, wl1251_tx_get_queue(queue), 1148 ret = wl1251_acx_ac_cfg(wl, wl1251_tx_get_queue(queue),
1148 params->cw_min, params->cw_max, 1149 params->cw_min, params->cw_max,
1149 params->aifs, params->txop); 1150 params->aifs, params->txop * 32);
1150 if (ret < 0) 1151 if (ret < 0)
1151 goto out_sleep; 1152 goto out_sleep;
1152 1153