aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/adm8211.c21
-rw-r--r--drivers/net/wireless/ath5k/base.c34
-rw-r--r--drivers/net/wireless/ath9k/main.c18
-rw-r--r--drivers/net/wireless/ath9k/rc.c40
-rw-r--r--drivers/net/wireless/ath9k/xmit.c28
-rw-r--r--drivers/net/wireless/b43/dma.c4
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43/pio.c3
-rw-r--r--drivers/net/wireless/b43/xmit.c60
-rw-r--r--drivers/net/wireless/b43/xmit.h5
-rw-r--r--drivers/net/wireless/b43legacy/dma.c46
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/pio.c31
-rw-r--r--drivers/net/wireless/b43legacy/xmit.c26
-rw-r--r--drivers/net/wireless/b43legacy/xmit.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c57
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c65
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c37
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
-rw-r--r--drivers/net/wireless/libertas_tf/main.c4
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c12
-rw-r--r--drivers/net/wireless/p54/p54common.c26
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c22
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h9
-rw-r--r--drivers/net/wireless/rtl8180_dev.c28
-rw-r--r--drivers/net/wireless/rtl8187_dev.c18
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c32
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c2
34 files changed, 427 insertions, 277 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 9a1e0c514c08..b96ebfe4ef3e 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -341,15 +341,14 @@ static void adm8211_interrupt_tci(struct ieee80211_hw *dev)
341 pci_unmap_single(priv->pdev, info->mapping, 341 pci_unmap_single(priv->pdev, info->mapping,
342 info->skb->len, PCI_DMA_TODEVICE); 342 info->skb->len, PCI_DMA_TODEVICE);
343 343
344 memset(&txi->status, 0, sizeof(txi->status)); 344 ieee80211_tx_info_clear_status(txi);
345
345 skb_pull(skb, sizeof(struct adm8211_tx_hdr)); 346 skb_pull(skb, sizeof(struct adm8211_tx_hdr));
346 memcpy(skb_push(skb, info->hdrlen), skb->cb, info->hdrlen); 347 memcpy(skb_push(skb, info->hdrlen), skb->cb, info->hdrlen);
347 if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK)) { 348 if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) &&
348 if (status & TDES0_STATUS_ES) 349 !(status & TDES0_STATUS_ES))
349 txi->status.excessive_retries = 1; 350 txi->flags |= IEEE80211_TX_STAT_ACK;
350 else 351
351 txi->flags |= IEEE80211_TX_STAT_ACK;
352 }
353 ieee80211_tx_status_irqsafe(dev, skb); 352 ieee80211_tx_status_irqsafe(dev, skb);
354 353
355 info->skb = NULL; 354 info->skb = NULL;
@@ -1691,8 +1690,10 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1691 struct ieee80211_hdr *hdr; 1690 struct ieee80211_hdr *hdr;
1692 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1691 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1693 struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info); 1692 struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info);
1693 u8 rc_flags;
1694 1694
1695 short_preamble = !!(txrate->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE); 1695 rc_flags = info->control.rates[0].flags;
1696 short_preamble = !!(rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE);
1696 plcp_signal = txrate->bitrate; 1697 plcp_signal = txrate->bitrate;
1697 1698
1698 hdr = (struct ieee80211_hdr *)skb->data; 1699 hdr = (struct ieee80211_hdr *)skb->data;
@@ -1724,10 +1725,10 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1724 if (short_preamble) 1725 if (short_preamble)
1725 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE); 1726 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE);
1726 1727
1727 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) 1728 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS)
1728 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS); 1729 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS);
1729 1730
1730 txhdr->retry_limit = info->control.retry_limit; 1731 txhdr->retry_limit = info->control.rates[0].count;
1731 1732
1732 adm8211_tx_raw(dev, skb, plcp_signal, hdrlen); 1733 adm8211_tx_raw(dev, skb, plcp_signal, hdrlen);
1733 1734
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 44401f6f578d..3773d983ea66 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -541,8 +541,8 @@ ath5k_pci_probe(struct pci_dev *pdev,
541 541
542 /* set up multi-rate retry capabilities */ 542 /* set up multi-rate retry capabilities */
543 if (sc->ah->ah_version == AR5K_AR5212) { 543 if (sc->ah->ah_version == AR5K_AR5212) {
544 hw->max_altrates = 3; 544 hw->max_rates = 4;
545 hw->max_altrate_tries = 11; 545 hw->max_rate_tries = 11;
546 } 546 }
547 547
548 /* Finish private driver data initialization */ 548 /* Finish private driver data initialization */
@@ -1181,7 +1181,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1181 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL, 1181 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
1182 (sc->power_level * 2), 1182 (sc->power_level * 2),
1183 ieee80211_get_tx_rate(sc->hw, info)->hw_value, 1183 ieee80211_get_tx_rate(sc->hw, info)->hw_value,
1184 info->control.retry_limit, keyidx, 0, flags, 0, 0); 1184 info->control.rates[0].count, keyidx, 0, flags, 0, 0);
1185 if (ret) 1185 if (ret)
1186 goto err_unmap; 1186 goto err_unmap;
1187 1187
@@ -1193,7 +1193,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1193 break; 1193 break;
1194 1194
1195 mrr_rate[i] = rate->hw_value; 1195 mrr_rate[i] = rate->hw_value;
1196 mrr_tries[i] = info->control.retries[i].limit; 1196 mrr_tries[i] = info->control.rates[i + 1].count;
1197 } 1197 }
1198 1198
1199 ah->ah_setup_mrr_tx_desc(ah, ds, 1199 ah->ah_setup_mrr_tx_desc(ah, ds,
@@ -1849,30 +1849,26 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1849 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, 1849 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len,
1850 PCI_DMA_TODEVICE); 1850 PCI_DMA_TODEVICE);
1851 1851
1852 memset(&info->status, 0, sizeof(info->status)); 1852 ieee80211_tx_info_clear_status(info);
1853 info->tx_rate_idx = ath5k_hw_to_driver_rix(sc,
1854 ts.ts_rate[ts.ts_final_idx]);
1855 info->status.retry_count = ts.ts_longretry;
1856
1857 for (i = 0; i < 4; i++) { 1853 for (i = 0; i < 4; i++) {
1858 struct ieee80211_tx_altrate *r = 1854 struct ieee80211_tx_rate *r =
1859 &info->status.retries[i]; 1855 &info->status.rates[i];
1860 1856
1861 if (ts.ts_rate[i]) { 1857 if (ts.ts_rate[i]) {
1862 r->rate_idx = ath5k_hw_to_driver_rix(sc, ts.ts_rate[i]); 1858 r->idx = ath5k_hw_to_driver_rix(sc, ts.ts_rate[i]);
1863 r->limit = ts.ts_retry[i]; 1859 r->count = ts.ts_retry[i];
1864 } else { 1860 } else {
1865 r->rate_idx = -1; 1861 r->idx = -1;
1866 r->limit = 0; 1862 r->count = 0;
1867 } 1863 }
1868 } 1864 }
1869 1865
1870 info->status.excessive_retries = 0; 1866 /* count the successful attempt as well */
1867 info->status.rates[ts.ts_final_idx].count++;
1868
1871 if (unlikely(ts.ts_status)) { 1869 if (unlikely(ts.ts_status)) {
1872 sc->ll_stats.dot11ACKFailureCount++; 1870 sc->ll_stats.dot11ACKFailureCount++;
1873 if (ts.ts_status & AR5K_TXERR_XRETRY) 1871 if (ts.ts_status & AR5K_TXERR_FILT)
1874 info->status.excessive_retries = 1;
1875 else if (ts.ts_status & AR5K_TXERR_FILT)
1876 info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 1872 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
1877 } else { 1873 } else {
1878 info->flags |= IEEE80211_TX_STAT_ACK; 1874 info->flags |= IEEE80211_TX_STAT_ACK;
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 32acaf7ff622..a7656a3ea1b0 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -457,12 +457,13 @@ void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
457 DPRINTF(sc, ATH_DBG_XMIT, 457 DPRINTF(sc, ATH_DBG_XMIT,
458 "%s: TX complete: skb: %p\n", __func__, skb); 458 "%s: TX complete: skb: %p\n", __func__, skb);
459 459
460 ieee80211_tx_info_clear_status(tx_info);
460 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK || 461 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK ||
461 tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) { 462 tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
462 /* free driver's private data area of tx_info */ 463 /* free driver's private data area of tx_info, XXX: HACK! */
463 if (tx_info->driver_data[0] != NULL) 464 if (tx_info->control.vif != NULL)
464 kfree(tx_info->driver_data[0]); 465 kfree(tx_info->control.vif);
465 tx_info->driver_data[0] = NULL; 466 tx_info->control.vif = NULL;
466 } 467 }
467 468
468 if (tx_status->flags & ATH_TX_BAR) { 469 if (tx_status->flags & ATH_TX_BAR) {
@@ -470,17 +471,12 @@ void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
470 tx_status->flags &= ~ATH_TX_BAR; 471 tx_status->flags &= ~ATH_TX_BAR;
471 } 472 }
472 473
473 if (tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY)) { 474 if (!(tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
474 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
475 /* Frame was not ACKed, but an ACK was expected */
476 tx_info->status.excessive_retries = 1;
477 }
478 } else {
479 /* Frame was ACKed */ 475 /* Frame was ACKed */
480 tx_info->flags |= IEEE80211_TX_STAT_ACK; 476 tx_info->flags |= IEEE80211_TX_STAT_ACK;
481 } 477 }
482 478
483 tx_info->status.retry_count = tx_status->retries; 479 tx_info->status.rates[0].count = tx_status->retries + 1;
484 480
485 ieee80211_tx_status(hw, skb); 481 ieee80211_tx_status(hw, skb);
486 if (an) 482 if (an)
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 9b2526030965..6afafeddeda2 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -1864,24 +1864,21 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1864 1864
1865 hdr = (struct ieee80211_hdr *)skb->data; 1865 hdr = (struct ieee80211_hdr *)skb->data;
1866 fc = hdr->frame_control; 1866 fc = hdr->frame_control;
1867 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 1867 /* XXX: UGLY HACK!! */
1868 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
1868 1869
1869 spin_lock_bh(&sc->node_lock); 1870 spin_lock_bh(&sc->node_lock);
1870 an = ath_node_find(sc, hdr->addr1); 1871 an = ath_node_find(sc, hdr->addr1);
1871 spin_unlock_bh(&sc->node_lock); 1872 spin_unlock_bh(&sc->node_lock);
1872 1873
1873 if (!an || !priv_sta || !ieee80211_is_data(fc)) { 1874 if (tx_info_priv == NULL)
1874 if (tx_info->driver_data[0] != NULL) {
1875 kfree(tx_info->driver_data[0]);
1876 tx_info->driver_data[0] = NULL;
1877 }
1878 return; 1875 return;
1879 } 1876
1880 if (tx_info->driver_data[0] != NULL) { 1877 if (an && priv_sta && ieee80211_is_data(fc))
1881 ath_rate_tx_complete(sc, an, priv_sta, tx_info_priv); 1878 ath_rate_tx_complete(sc, an, priv_sta, tx_info_priv);
1882 kfree(tx_info->driver_data[0]); 1879
1883 tx_info->driver_data[0] = NULL; 1880 kfree(tx_info_priv);
1884 } 1881 tx_info->control.vif = NULL;
1885} 1882}
1886 1883
1887static void ath_tx_aggr_resp(struct ath_softc *sc, 1884static void ath_tx_aggr_resp(struct ath_softc *sc,
@@ -1927,10 +1924,11 @@ static void ath_tx_aggr_resp(struct ath_softc *sc,
1927 } 1924 }
1928} 1925}
1929 1926
1930static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband, 1927static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1931 struct ieee80211_sta *sta, void *priv_sta, 1928 struct ieee80211_tx_rate_control *txrc)
1932 struct sk_buff *skb, struct rate_selection *sel)
1933{ 1929{
1930 struct ieee80211_supported_band *sband = txrc->sband;
1931 struct sk_buff *skb = txrc->skb;
1934 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1932 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1935 struct ath_softc *sc = priv; 1933 struct ath_softc *sc = priv;
1936 struct ieee80211_hw *hw = sc->hw; 1934 struct ieee80211_hw *hw = sc->hw;
@@ -1945,17 +1943,17 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1945 1943
1946 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__); 1944 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
1947 1945
1948 /* allocate driver private area of tx_info */ 1946 /* allocate driver private area of tx_info, XXX: UGLY HACK! */
1949 tx_info->driver_data[0] = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC); 1947 tx_info->control.vif = kzalloc(sizeof(*tx_info_priv), GFP_ATOMIC);
1950 ASSERT(tx_info->driver_data[0] != NULL); 1948 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
1951 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 1949 ASSERT(tx_info_priv != NULL);
1952 1950
1953 lowest_idx = rate_lowest_index(sband, sta); 1951 lowest_idx = rate_lowest_index(sband, sta);
1954 tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10; 1952 tx_info_priv->min_rate = (sband->bitrates[lowest_idx].bitrate * 2) / 10;
1955 /* lowest rate for management and multicast/broadcast frames */ 1953 /* lowest rate for management and multicast/broadcast frames */
1956 if (!ieee80211_is_data(fc) || 1954 if (!ieee80211_is_data(fc) ||
1957 is_multicast_ether_addr(hdr->addr1) || !sta) { 1955 is_multicast_ether_addr(hdr->addr1) || !sta) {
1958 sel->rate_idx = lowest_idx; 1956 tx_info->control.rates[0].idx = lowest_idx;
1959 return; 1957 return;
1960 } 1958 }
1961 1959
@@ -1966,8 +1964,10 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1966 tx_info_priv->rcs, 1964 tx_info_priv->rcs,
1967 &is_probe, 1965 &is_probe,
1968 false); 1966 false);
1967#if 0
1969 if (is_probe) 1968 if (is_probe)
1970 sel->probe_idx = ath_rc_priv->tx_ratectrl.probe_rate; 1969 sel->probe_idx = ath_rc_priv->tx_ratectrl.probe_rate;
1970#endif
1971 1971
1972 /* Ratecontrol sometimes returns invalid rate index */ 1972 /* Ratecontrol sometimes returns invalid rate index */
1973 if (tx_info_priv->rcs[0].rix != 0xff) 1973 if (tx_info_priv->rcs[0].rix != 0xff)
@@ -1975,7 +1975,7 @@ static void ath_get_rate(void *priv, struct ieee80211_supported_band *sband,
1975 else 1975 else
1976 tx_info_priv->rcs[0].rix = ath_rc_priv->prev_data_rix; 1976 tx_info_priv->rcs[0].rix = ath_rc_priv->prev_data_rix;
1977 1977
1978 sel->rate_idx = tx_info_priv->rcs[0].rix; 1978 tx_info->control.rates[0].idx = tx_info_priv->rcs[0].rix;
1979 1979
1980 /* Check if aggregation has to be enabled for this tid */ 1980 /* Check if aggregation has to be enabled for this tid */
1981 1981
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index ba818cc2fb5c..9fa395418a6c 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -168,7 +168,9 @@ static void fill_min_rates(struct sk_buff *skb, struct ath_tx_control *txctl)
168 168
169 hdr = (struct ieee80211_hdr *)skb->data; 169 hdr = (struct ieee80211_hdr *)skb->data;
170 fc = hdr->frame_control; 170 fc = hdr->frame_control;
171 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 171
172 /* XXX: HACK! */
173 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
172 174
173 if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) { 175 if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) {
174 txctl->use_minrate = 1; 176 txctl->use_minrate = 1;
@@ -288,13 +290,16 @@ static int ath_tx_prepare(struct ath_softc *sc,
288 290
289 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) 291 if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
290 txctl->flags |= ATH9K_TXDESC_NOACK; 292 txctl->flags |= ATH9K_TXDESC_NOACK;
291 if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) 293
294 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
292 txctl->flags |= ATH9K_TXDESC_RTSENA; 295 txctl->flags |= ATH9K_TXDESC_RTSENA;
293 296
294 /* 297 /*
295 * Setup for rate calculations. 298 * Setup for rate calculations.
296 */ 299 */
297 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 300
301 /* XXX: HACK! */
302 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
298 rcs = tx_info_priv->rcs; 303 rcs = tx_info_priv->rcs;
299 304
300 if (ieee80211_is_data(fc) && !txctl->use_minrate) { 305 if (ieee80211_is_data(fc) && !txctl->use_minrate) {
@@ -855,7 +860,9 @@ static int ath_tx_send_normal(struct ath_softc *sc,
855 860
856 skb = (struct sk_buff *)bf->bf_mpdu; 861 skb = (struct sk_buff *)bf->bf_mpdu;
857 tx_info = IEEE80211_SKB_CB(skb); 862 tx_info = IEEE80211_SKB_CB(skb);
858 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 863
864 /* XXX: HACK! */
865 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
859 memcpy(bf->bf_rcs, tx_info_priv->rcs, 4 * sizeof(tx_info_priv->rcs[0])); 866 memcpy(bf->bf_rcs, tx_info_priv->rcs, 4 * sizeof(tx_info_priv->rcs[0]));
860 867
861 /* update starting sequence number for subsequent ADDBA request */ 868 /* update starting sequence number for subsequent ADDBA request */
@@ -1249,8 +1256,9 @@ static int ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
1249 } 1256 }
1250 skb = bf->bf_mpdu; 1257 skb = bf->bf_mpdu;
1251 tx_info = IEEE80211_SKB_CB(skb); 1258 tx_info = IEEE80211_SKB_CB(skb);
1252 tx_info_priv = (struct ath_tx_info_priv *) 1259
1253 tx_info->driver_data[0]; 1260 /* XXX: HACK! */
1261 tx_info_priv = (struct ath_tx_info_priv *) tx_info->control.vif;
1254 if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) 1262 if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT)
1255 tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; 1263 tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
1256 if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 && 1264 if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 &&
@@ -1431,7 +1439,8 @@ static int ath_tx_send_ampdu(struct ath_softc *sc,
1431 1439
1432 skb = (struct sk_buff *)bf->bf_mpdu; 1440 skb = (struct sk_buff *)bf->bf_mpdu;
1433 tx_info = IEEE80211_SKB_CB(skb); 1441 tx_info = IEEE80211_SKB_CB(skb);
1434 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 1442 /* XXX: HACK! */
1443 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
1435 memcpy(bf->bf_rcs, tx_info_priv->rcs, 4 * sizeof(tx_info_priv->rcs[0])); 1444 memcpy(bf->bf_rcs, tx_info_priv->rcs, 4 * sizeof(tx_info_priv->rcs[0]));
1436 1445
1437 /* Add sub-frame to BAW */ 1446 /* Add sub-frame to BAW */
@@ -1466,7 +1475,7 @@ static u32 ath_lookup_rate(struct ath_softc *sc,
1466 skb = (struct sk_buff *)bf->bf_mpdu; 1475 skb = (struct sk_buff *)bf->bf_mpdu;
1467 tx_info = IEEE80211_SKB_CB(skb); 1476 tx_info = IEEE80211_SKB_CB(skb);
1468 tx_info_priv = (struct ath_tx_info_priv *) 1477 tx_info_priv = (struct ath_tx_info_priv *)
1469 tx_info->driver_data[0]; 1478 tx_info->control.vif; /* XXX: HACK! */
1470 memcpy(bf->bf_rcs, 1479 memcpy(bf->bf_rcs,
1471 tx_info_priv->rcs, 4 * sizeof(tx_info_priv->rcs[0])); 1480 tx_info_priv->rcs, 4 * sizeof(tx_info_priv->rcs[0]));
1472 1481
@@ -1927,7 +1936,8 @@ static int ath_tx_start_dma(struct ath_softc *sc,
1927 1936
1928 bf->bf_flags = txctl->flags; 1937 bf->bf_flags = txctl->flags;
1929 bf->bf_keytype = txctl->keytype; 1938 bf->bf_keytype = txctl->keytype;
1930 tx_info_priv = (struct ath_tx_info_priv *)tx_info->driver_data[0]; 1939 /* XXX: HACK! */
1940 tx_info_priv = (struct ath_tx_info_priv *)tx_info->control.vif;
1931 rcs = tx_info_priv->rcs; 1941 rcs = tx_info_priv->rcs;
1932 bf->bf_rcs[0] = rcs[0]; 1942 bf->bf_rcs[0] = rcs[0];
1933 bf->bf_rcs[1] = rcs[1]; 1943 bf->bf_rcs[1] = rcs[1];
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 098f886976f6..6d65a02b7052 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1387,13 +1387,11 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1387 1387
1388 info = IEEE80211_SKB_CB(meta->skb); 1388 info = IEEE80211_SKB_CB(meta->skb);
1389 1389
1390 memset(&info->status, 0, sizeof(info->status));
1391
1392 /* 1390 /*
1393 * Call back to inform the ieee80211 subsystem about 1391 * Call back to inform the ieee80211 subsystem about
1394 * the status of the transmission. 1392 * the status of the transmission.
1395 */ 1393 */
1396 frame_succeed = b43_fill_txstatus_report(info, status); 1394 frame_succeed = b43_fill_txstatus_report(dev, info, status);
1397#ifdef CONFIG_B43_DEBUG 1395#ifdef CONFIG_B43_DEBUG
1398 if (frame_succeed) 1396 if (frame_succeed)
1399 ring->nr_succeed_tx_packets++; 1397 ring->nr_succeed_tx_packets++;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9aeeb6553a91..2a599fb772d9 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4555,7 +4555,7 @@ static int b43_wireless_init(struct ssb_device *dev)
4555 BIT(NL80211_IFTYPE_ADHOC); 4555 BIT(NL80211_IFTYPE_ADHOC);
4556 4556
4557 hw->queues = b43_modparam_qos ? 4 : 1; 4557 hw->queues = b43_modparam_qos ? 4 : 1;
4558 hw->max_altrates = 1; 4558 hw->max_rates = 2;
4559 SET_IEEE80211_DEV(hw, dev->dev); 4559 SET_IEEE80211_DEV(hw, dev->dev);
4560 if (is_valid_ether_addr(sprom->et1mac)) 4560 if (is_valid_ether_addr(sprom->et1mac))
4561 SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac); 4561 SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac);
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 401591267592..1036bef8c4cc 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -587,9 +587,8 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,
587 spin_lock(&q->lock); /* IRQs are already disabled. */ 587 spin_lock(&q->lock); /* IRQs are already disabled. */
588 588
589 info = IEEE80211_SKB_CB(pack->skb); 589 info = IEEE80211_SKB_CB(pack->skb);
590 memset(&info->status, 0, sizeof(info->status));
591 590
592 b43_fill_txstatus_report(info, status); 591 b43_fill_txstatus_report(dev, info, status);
593 592
594 total_len = pack->skb->len + b43_txhdr_size(dev); 593 total_len = pack->skb->len + b43_txhdr_size(dev);
595 total_len = roundup(total_len, 4); 594 total_len = roundup(total_len, 4);
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 2fabcf8f0474..adba89b816d4 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -185,7 +185,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
185 u8 *_txhdr, 185 u8 *_txhdr,
186 const unsigned char *fragment_data, 186 const unsigned char *fragment_data,
187 unsigned int fragment_len, 187 unsigned int fragment_len,
188 const struct ieee80211_tx_info *info, 188 struct ieee80211_tx_info *info,
189 u16 cookie) 189 u16 cookie)
190{ 190{
191 struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr; 191 struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr;
@@ -202,6 +202,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
202 u16 phy_ctl = 0; 202 u16 phy_ctl = 0;
203 u8 extra_ft = 0; 203 u8 extra_ft = 0;
204 struct ieee80211_rate *txrate; 204 struct ieee80211_rate *txrate;
205 struct ieee80211_tx_rate *rates;
205 206
206 memset(txhdr, 0, sizeof(*txhdr)); 207 memset(txhdr, 0, sizeof(*txhdr));
207 208
@@ -291,7 +292,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
291 phy_ctl |= B43_TXH_PHY_ENC_OFDM; 292 phy_ctl |= B43_TXH_PHY_ENC_OFDM;
292 else 293 else
293 phy_ctl |= B43_TXH_PHY_ENC_CCK; 294 phy_ctl |= B43_TXH_PHY_ENC_CCK;
294 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) 295 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
295 phy_ctl |= B43_TXH_PHY_SHORTPRMBL; 296 phy_ctl |= B43_TXH_PHY_SHORTPRMBL;
296 297
297 switch (b43_ieee80211_antenna_sanitize(dev, info->antenna_sel_tx)) { 298 switch (b43_ieee80211_antenna_sanitize(dev, info->antenna_sel_tx)) {
@@ -314,6 +315,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
314 B43_WARN_ON(1); 315 B43_WARN_ON(1);
315 } 316 }
316 317
318 rates = info->control.rates;
317 /* MAC control */ 319 /* MAC control */
318 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) 320 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
319 mac_ctl |= B43_TXH_MAC_ACK; 321 mac_ctl |= B43_TXH_MAC_ACK;
@@ -324,12 +326,22 @@ int b43_generate_txhdr(struct b43_wldev *dev,
324 mac_ctl |= B43_TXH_MAC_STMSDU; 326 mac_ctl |= B43_TXH_MAC_STMSDU;
325 if (phy->type == B43_PHYTYPE_A) 327 if (phy->type == B43_PHYTYPE_A)
326 mac_ctl |= B43_TXH_MAC_5GHZ; 328 mac_ctl |= B43_TXH_MAC_5GHZ;
327 if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT) 329
330 /* Overwrite rates[0].count to make the retry calculation
331 * in the tx status easier. need the actual retry limit to
332 * detect whether the fallback rate was used.
333 */
334 if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
335 (rates[0].count <= dev->wl->hw->conf.long_frame_max_tx_count)) {
336 rates[0].count = dev->wl->hw->conf.long_frame_max_tx_count;
328 mac_ctl |= B43_TXH_MAC_LONGFRAME; 337 mac_ctl |= B43_TXH_MAC_LONGFRAME;
338 } else {
339 rates[0].count = dev->wl->hw->conf.short_frame_max_tx_count;
340 }
329 341
330 /* Generate the RTS or CTS-to-self frame */ 342 /* Generate the RTS or CTS-to-self frame */
331 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || 343 if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
332 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { 344 (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) {
333 unsigned int len; 345 unsigned int len;
334 struct ieee80211_hdr *hdr; 346 struct ieee80211_hdr *hdr;
335 int rts_rate, rts_rate_fb; 347 int rts_rate, rts_rate_fb;
@@ -344,7 +356,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
344 rts_rate_fb = b43_calc_fallback_rate(rts_rate); 356 rts_rate_fb = b43_calc_fallback_rate(rts_rate);
345 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); 357 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
346 358
347 if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 359 if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
348 struct ieee80211_cts *cts; 360 struct ieee80211_cts *cts;
349 361
350 if (b43_is_old_txhdr_format(dev)) { 362 if (b43_is_old_txhdr_format(dev)) {
@@ -687,10 +699,18 @@ void b43_handle_txstatus(struct b43_wldev *dev,
687/* Fill out the mac80211 TXstatus report based on the b43-specific 699/* Fill out the mac80211 TXstatus report based on the b43-specific
688 * txstatus report data. This returns a boolean whether the frame was 700 * txstatus report data. This returns a boolean whether the frame was
689 * successfully transmitted. */ 701 * successfully transmitted. */
690bool b43_fill_txstatus_report(struct ieee80211_tx_info *report, 702bool b43_fill_txstatus_report(struct b43_wldev *dev,
703 struct ieee80211_tx_info *report,
691 const struct b43_txstatus *status) 704 const struct b43_txstatus *status)
692{ 705{
693 bool frame_success = 1; 706 bool frame_success = 1;
707 int retry_limit;
708
709 /* preserve the confiured retry limit before clearing the status
710 * The xmit function has overwritten the rc's value with the actual
711 * retry limit done by the hardware */
712 retry_limit = report->status.rates[0].count;
713 ieee80211_tx_info_clear_status(report);
694 714
695 if (status->acked) { 715 if (status->acked) {
696 /* The frame was ACKed. */ 716 /* The frame was ACKed. */
@@ -700,14 +720,32 @@ bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
700 if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) { 720 if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) {
701 /* ...but we expected an ACK. */ 721 /* ...but we expected an ACK. */
702 frame_success = 0; 722 frame_success = 0;
703 report->status.excessive_retries = 1;
704 } 723 }
705 } 724 }
706 if (status->frame_count == 0) { 725 if (status->frame_count == 0) {
707 /* The frame was not transmitted at all. */ 726 /* The frame was not transmitted at all. */
708 report->status.retry_count = 0; 727 report->status.rates[0].count = 0;
709 } else 728 } else if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) {
710 report->status.retry_count = status->frame_count - 1; 729 /*
730 * If the short retries (RTS, not data frame) have exceeded
731 * the limit, the hw will not have tried the selected rate,
732 * but will have used the fallback rate instead.
733 * Don't let the rate control count attempts for the selected
734 * rate in this case, otherwise the statistics will be off.
735 */
736 report->status.rates[0].count = 0;
737 report->status.rates[1].count = status->frame_count;
738 } else {
739 if (status->frame_count > retry_limit) {
740 report->status.rates[0].count = retry_limit;
741 report->status.rates[1].count = status->frame_count -
742 retry_limit;
743
744 } else {
745 report->status.rates[0].count = status->frame_count;
746 report->status.rates[1].idx = -1;
747 }
748 }
711 749
712 return frame_success; 750 return frame_success;
713} 751}
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 0215faf47541..4fb2a190f7a7 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -178,7 +178,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
178 u8 * txhdr, 178 u8 * txhdr,
179 const unsigned char *fragment_data, 179 const unsigned char *fragment_data,
180 unsigned int fragment_len, 180 unsigned int fragment_len,
181 const struct ieee80211_tx_info *txctl, u16 cookie); 181 struct ieee80211_tx_info *txctl, u16 cookie);
182 182
183/* Transmit Status */ 183/* Transmit Status */
184struct b43_txstatus { 184struct b43_txstatus {
@@ -294,7 +294,8 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr);
294 294
295void b43_handle_txstatus(struct b43_wldev *dev, 295void b43_handle_txstatus(struct b43_wldev *dev,
296 const struct b43_txstatus *status); 296 const struct b43_txstatus *status);
297bool b43_fill_txstatus_report(struct ieee80211_tx_info *report, 297bool b43_fill_txstatus_report(struct b43_wldev *dev,
298 struct ieee80211_tx_info *report,
298 const struct b43_txstatus *status); 299 const struct b43_txstatus *status);
299 300
300void b43_tx_suspend(struct b43_wldev *dev); 301void b43_tx_suspend(struct b43_wldev *dev);
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index fb6819e40f38..308c2647f002 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1411,6 +1411,7 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
1411 struct b43legacy_dmaring *ring; 1411 struct b43legacy_dmaring *ring;
1412 struct b43legacy_dmadesc_generic *desc; 1412 struct b43legacy_dmadesc_generic *desc;
1413 struct b43legacy_dmadesc_meta *meta; 1413 struct b43legacy_dmadesc_meta *meta;
1414 int retry_limit;
1414 int slot; 1415 int slot;
1415 1416
1416 ring = parse_cookie(dev, status->cookie, &slot); 1417 ring = parse_cookie(dev, status->cookie, &slot);
@@ -1437,25 +1438,42 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
1437 struct ieee80211_tx_info *info; 1438 struct ieee80211_tx_info *info;
1438 BUG_ON(!meta->skb); 1439 BUG_ON(!meta->skb);
1439 info = IEEE80211_SKB_CB(meta->skb); 1440 info = IEEE80211_SKB_CB(meta->skb);
1440 /* Call back to inform the ieee80211 subsystem about the
1441 * status of the transmission.
1442 * Some fields of txstat are already filled in dma_tx().
1443 */
1444 1441
1445 memset(&info->status, 0, sizeof(info->status)); 1442 /* preserve the confiured retry limit before clearing the status
1443 * The xmit function has overwritten the rc's value with the actual
1444 * retry limit done by the hardware */
1445 retry_limit = info->status.rates[0].count;
1446 ieee80211_tx_info_clear_status(info);
1446 1447
1447 if (status->acked) { 1448 if (status->acked)
1448 info->flags |= IEEE80211_TX_STAT_ACK; 1449 info->flags |= IEEE80211_TX_STAT_ACK;
1450
1451 if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) {
1452 /*
1453 * If the short retries (RTS, not data frame) have exceeded
1454 * the limit, the hw will not have tried the selected rate,
1455 * but will have used the fallback rate instead.
1456 * Don't let the rate control count attempts for the selected
1457 * rate in this case, otherwise the statistics will be off.
1458 */
1459 info->status.rates[0].count = 0;
1460 info->status.rates[1].count = status->frame_count;
1449 } else { 1461 } else {
1450 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) 1462 if (status->frame_count > retry_limit) {
1451 info->status.excessive_retries = 1; 1463 info->status.rates[0].count = retry_limit;
1464 info->status.rates[1].count = status->frame_count -
1465 retry_limit;
1466
1467 } else {
1468 info->status.rates[0].count = status->frame_count;
1469 info->status.rates[1].idx = -1;
1470 }
1452 } 1471 }
1453 if (status->frame_count == 0) { 1472
1454 /* The frame was not transmitted at all. */ 1473 /* Call back to inform the ieee80211 subsystem about the
1455 info->status.retry_count = 0; 1474 * status of the transmission.
1456 } else 1475 * Some fields of txstat are already filled in dma_tx().
1457 info->status.retry_count = status->frame_count 1476 */
1458 - 1;
1459 ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb); 1477 ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb);
1460 /* skb is freed by ieee80211_tx_status_irqsafe() */ 1478 /* skb is freed by ieee80211_tx_status_irqsafe() */
1461 meta->skb = NULL; 1479 meta->skb = NULL;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 78e46365f69e..9edbdf9cb50f 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3682,7 +3682,7 @@ static int b43legacy_wireless_init(struct ssb_device *dev)
3682 BIT(NL80211_IFTYPE_WDS) | 3682 BIT(NL80211_IFTYPE_WDS) |
3683 BIT(NL80211_IFTYPE_ADHOC); 3683 BIT(NL80211_IFTYPE_ADHOC);
3684 hw->queues = 1; /* FIXME: hardware has more queues */ 3684 hw->queues = 1; /* FIXME: hardware has more queues */
3685 hw->max_altrates = 1; 3685 hw->max_rates = 2;
3686 SET_IEEE80211_DEV(hw, dev->dev); 3686 SET_IEEE80211_DEV(hw, dev->dev);
3687 if (is_valid_ether_addr(sprom->et1mac)) 3687 if (is_valid_ether_addr(sprom->et1mac))
3688 SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac); 3688 SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac);
diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c
index a86c7647fa2d..746d5361bba0 100644
--- a/drivers/net/wireless/b43legacy/pio.c
+++ b/drivers/net/wireless/b43legacy/pio.c
@@ -491,6 +491,7 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
491 struct b43legacy_pioqueue *queue; 491 struct b43legacy_pioqueue *queue;
492 struct b43legacy_pio_txpacket *packet; 492 struct b43legacy_pio_txpacket *packet;
493 struct ieee80211_tx_info *info; 493 struct ieee80211_tx_info *info;
494 int retry_limit;
494 495
495 queue = parse_cookie(dev, status->cookie, &packet); 496 queue = parse_cookie(dev, status->cookie, &packet);
496 B43legacy_WARN_ON(!queue); 497 B43legacy_WARN_ON(!queue);
@@ -503,11 +504,37 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
503 sizeof(struct b43legacy_txhdr_fw3)); 504 sizeof(struct b43legacy_txhdr_fw3));
504 505
505 info = IEEE80211_SKB_CB(packet->skb); 506 info = IEEE80211_SKB_CB(packet->skb);
506 memset(&info->status, 0, sizeof(info->status)); 507
508 /* preserve the confiured retry limit before clearing the status
509 * The xmit function has overwritten the rc's value with the actual
510 * retry limit done by the hardware */
511 retry_limit = info->status.rates[0].count;
512 ieee80211_tx_info_clear_status(info);
507 513
508 if (status->acked) 514 if (status->acked)
509 info->flags |= IEEE80211_TX_STAT_ACK; 515 info->flags |= IEEE80211_TX_STAT_ACK;
510 info->status.retry_count = status->frame_count - 1; 516
517 if (status->rts_count > dev->wl->hw->conf.short_frame_max_tx_count) {
518 /*
519 * If the short retries (RTS, not data frame) have exceeded
520 * the limit, the hw will not have tried the selected rate,
521 * but will have used the fallback rate instead.
522 * Don't let the rate control count attempts for the selected
523 * rate in this case, otherwise the statistics will be off.
524 */
525 info->status.rates[0].count = 0;
526 info->status.rates[1].count = status->frame_count;
527 } else {
528 if (status->frame_count > retry_limit) {
529 info->status.rates[0].count = retry_limit;
530 info->status.rates[1].count = status->frame_count -
531 retry_limit;
532
533 } else {
534 info->status.rates[0].count = status->frame_count;
535 info->status.rates[1].idx = -1;
536 }
537 }
511 ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb); 538 ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb);
512 packet->skb = NULL; 539 packet->skb = NULL;
513 540
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index 65e833781608..12fca99f7578 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -188,7 +188,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
188 struct b43legacy_txhdr_fw3 *txhdr, 188 struct b43legacy_txhdr_fw3 *txhdr,
189 const unsigned char *fragment_data, 189 const unsigned char *fragment_data,
190 unsigned int fragment_len, 190 unsigned int fragment_len,
191 const struct ieee80211_tx_info *info, 191 struct ieee80211_tx_info *info,
192 u16 cookie) 192 u16 cookie)
193{ 193{
194 const struct ieee80211_hdr *wlhdr; 194 const struct ieee80211_hdr *wlhdr;
@@ -201,6 +201,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
201 u32 mac_ctl = 0; 201 u32 mac_ctl = 0;
202 u16 phy_ctl = 0; 202 u16 phy_ctl = 0;
203 struct ieee80211_rate *tx_rate; 203 struct ieee80211_rate *tx_rate;
204 struct ieee80211_tx_rate *rates;
204 205
205 wlhdr = (const struct ieee80211_hdr *)fragment_data; 206 wlhdr = (const struct ieee80211_hdr *)fragment_data;
206 207
@@ -274,7 +275,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
274 /* PHY TX Control word */ 275 /* PHY TX Control word */
275 if (rate_ofdm) 276 if (rate_ofdm)
276 phy_ctl |= B43legacy_TX4_PHY_OFDM; 277 phy_ctl |= B43legacy_TX4_PHY_OFDM;
277 if (dev->short_preamble) 278 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
278 phy_ctl |= B43legacy_TX4_PHY_SHORTPRMBL; 279 phy_ctl |= B43legacy_TX4_PHY_SHORTPRMBL;
279 switch (info->antenna_sel_tx) { 280 switch (info->antenna_sel_tx) {
280 case 0: 281 case 0:
@@ -291,6 +292,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
291 } 292 }
292 293
293 /* MAC control */ 294 /* MAC control */
295 rates = info->control.rates;
294 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) 296 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
295 mac_ctl |= B43legacy_TX4_MAC_ACK; 297 mac_ctl |= B43legacy_TX4_MAC_ACK;
296 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) 298 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
@@ -299,12 +301,22 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
299 mac_ctl |= B43legacy_TX4_MAC_STMSDU; 301 mac_ctl |= B43legacy_TX4_MAC_STMSDU;
300 if (rate_fb_ofdm) 302 if (rate_fb_ofdm)
301 mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM; 303 mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM;
302 if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT) 304
305 /* Overwrite rates[0].count to make the retry calculation
306 * in the tx status easier. need the actual retry limit to
307 * detect whether the fallback rate was used.
308 */
309 if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
310 (rates[0].count <= dev->wl->hw->conf.long_frame_max_tx_count)) {
311 rates[0].count = dev->wl->hw->conf.long_frame_max_tx_count;
303 mac_ctl |= B43legacy_TX4_MAC_LONGFRAME; 312 mac_ctl |= B43legacy_TX4_MAC_LONGFRAME;
313 } else {
314 rates[0].count = dev->wl->hw->conf.short_frame_max_tx_count;
315 }
304 316
305 /* Generate the RTS or CTS-to-self frame */ 317 /* Generate the RTS or CTS-to-self frame */
306 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || 318 if ((rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
307 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { 319 (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) {
308 unsigned int len; 320 unsigned int len;
309 struct ieee80211_hdr *hdr; 321 struct ieee80211_hdr *hdr;
310 int rts_rate; 322 int rts_rate;
@@ -319,7 +331,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
319 if (rts_rate_fb_ofdm) 331 if (rts_rate_fb_ofdm)
320 mac_ctl |= B43legacy_TX4_MAC_CTSFALLBACKOFDM; 332 mac_ctl |= B43legacy_TX4_MAC_CTSFALLBACKOFDM;
321 333
322 if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 334 if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
323 ieee80211_ctstoself_get(dev->wl->hw, 335 ieee80211_ctstoself_get(dev->wl->hw,
324 info->control.vif, 336 info->control.vif,
325 fragment_data, 337 fragment_data,
@@ -362,7 +374,7 @@ int b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
362 u8 *txhdr, 374 u8 *txhdr,
363 const unsigned char *fragment_data, 375 const unsigned char *fragment_data,
364 unsigned int fragment_len, 376 unsigned int fragment_len,
365 const struct ieee80211_tx_info *info, 377 struct ieee80211_tx_info *info,
366 u16 cookie) 378 u16 cookie)
367{ 379{
368 return generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr, 380 return generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr,
diff --git a/drivers/net/wireless/b43legacy/xmit.h b/drivers/net/wireless/b43legacy/xmit.h
index e56777e0feab..62e09d02788f 100644
--- a/drivers/net/wireless/b43legacy/xmit.h
+++ b/drivers/net/wireless/b43legacy/xmit.h
@@ -80,7 +80,7 @@ int b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
80 u8 *txhdr, 80 u8 *txhdr,
81 const unsigned char *fragment_data, 81 const unsigned char *fragment_data,
82 unsigned int fragment_len, 82 unsigned int fragment_len,
83 const struct ieee80211_tx_info *info, 83 struct ieee80211_tx_info *info,
84 u16 cookie); 84 u16 cookie);
85 85
86 86
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index c25daec4f93d..f440ed0fe543 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -422,34 +422,6 @@ static void rs_free_sta(void *priv, struct ieee80211_sta *sta,
422} 422}
423 423
424 424
425/*
426 * get ieee prev rate from rate scale table.
427 * for A and B mode we need to overright prev
428 * value
429 */
430static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
431{
432 int next_rate = iwl3945_get_prev_ieee_rate(rate);
433
434 switch (priv->band) {
435 case IEEE80211_BAND_5GHZ:
436 if (rate == IWL_RATE_12M_INDEX)
437 next_rate = IWL_RATE_9M_INDEX;
438 else if (rate == IWL_RATE_6M_INDEX)
439 next_rate = IWL_RATE_6M_INDEX;
440 break;
441/* XXX cannot be invoked in current mac80211 so not a regression
442 case MODE_IEEE80211B:
443 if (rate == IWL_RATE_11M_INDEX_TABLE)
444 next_rate = IWL_RATE_5M_INDEX_TABLE;
445 break;
446 */
447 default:
448 break;
449 }
450
451 return next_rate;
452}
453/** 425/**
454 * rs_tx_status - Update rate control values based on Tx results 426 * rs_tx_status - Update rate control values based on Tx results
455 * 427 *
@@ -460,17 +432,21 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
460 struct ieee80211_sta *sta, void *priv_sta, 432 struct ieee80211_sta *sta, void *priv_sta,
461 struct sk_buff *skb) 433 struct sk_buff *skb)
462{ 434{
463 u8 retries, current_count; 435 u8 retries = 0, current_count;
464 int scale_rate_index, first_index, last_index; 436 int scale_rate_index, first_index, last_index;
465 unsigned long flags; 437 unsigned long flags;
466 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; 438 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
467 struct iwl3945_rs_sta *rs_sta = priv_sta; 439 struct iwl3945_rs_sta *rs_sta = priv_sta;
468 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 440 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
441 int i;
469 442
470 IWL_DEBUG_RATE("enter\n"); 443 IWL_DEBUG_RATE("enter\n");
471 444
472 retries = info->status.retry_count; 445 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
473 first_index = sband->bitrates[info->tx_rate_idx].hw_value; 446 retries += info->status.rates[i].count;
447 retries--;
448
449 first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
474 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { 450 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) {
475 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); 451 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index);
476 return; 452 return;
@@ -502,7 +478,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
502 last_index = scale_rate_index; 478 last_index = scale_rate_index;
503 } else { 479 } else {
504 current_count = priv->retry_rate; 480 current_count = priv->retry_rate;
505 last_index = rs_adjust_next_rate(priv, 481 last_index = iwl3945_rs_next_rate(priv,
506 scale_rate_index); 482 scale_rate_index);
507 } 483 }
508 484
@@ -518,7 +494,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
518 494
519 if (retries) 495 if (retries)
520 scale_rate_index = 496 scale_rate_index =
521 rs_adjust_next_rate(priv, scale_rate_index); 497 iwl3945_rs_next_rate(priv, scale_rate_index);
522 } 498 }
523 499
524 500
@@ -630,10 +606,11 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
630 * rate table and must reference the driver allocated rate table 606 * rate table and must reference the driver allocated rate table
631 * 607 *
632 */ 608 */
633static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, 609static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
634 struct ieee80211_sta *sta, void *priv_sta, 610 void *priv_sta, struct ieee80211_tx_rate_control *txrc)
635 struct sk_buff *skb, struct rate_selection *sel)
636{ 611{
612 struct ieee80211_supported_band *sband = txrc->sband;
613 struct sk_buff *skb = txrc->skb;
637 u8 low = IWL_RATE_INVALID; 614 u8 low = IWL_RATE_INVALID;
638 u8 high = IWL_RATE_INVALID; 615 u8 high = IWL_RATE_INVALID;
639 u16 high_low; 616 u16 high_low;
@@ -649,6 +626,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
649 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 626 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
650 u16 fc, rate_mask; 627 u16 fc, rate_mask;
651 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; 628 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r;
629 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
652 630
653 IWL_DEBUG_RATE("enter\n"); 631 IWL_DEBUG_RATE("enter\n");
654 632
@@ -659,7 +637,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
659 is_multicast_ether_addr(hdr->addr1) || 637 is_multicast_ether_addr(hdr->addr1) ||
660 !sta || !priv_sta) { 638 !sta || !priv_sta) {
661 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 639 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
662 sel->rate_idx = rate_lowest_index(sband, sta); 640 info->control.rates[0].idx = rate_lowest_index(sband, sta);
663 return; 641 return;
664 } 642 }
665 643
@@ -792,9 +770,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
792 770
793 rs_sta->last_txrate_idx = index; 771 rs_sta->last_txrate_idx = index;
794 if (sband->band == IEEE80211_BAND_5GHZ) 772 if (sband->band == IEEE80211_BAND_5GHZ)
795 sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; 773 info->control.rates[0].idx = rs_sta->last_txrate_idx -
774 IWL_FIRST_OFDM_RATE;
796 else 775 else
797 sel->rate_idx = rs_sta->last_txrate_idx; 776 info->control.rates[0].idx = rs_sta->last_txrate_idx;
798 777
799 IWL_DEBUG_RATE("leave: %d\n", index); 778 IWL_DEBUG_RATE("leave: %d\n", index);
800} 779}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 8a00245be51e..7afafb629706 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -261,6 +261,35 @@ static inline const char *iwl3945_get_tx_fail_reason(u32 status)
261} 261}
262#endif 262#endif
263 263
264/*
265 * get ieee prev rate from rate scale table.
266 * for A and B mode we need to overright prev
267 * value
268 */
269int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate)
270{
271 int next_rate = iwl3945_get_prev_ieee_rate(rate);
272
273 switch (priv->band) {
274 case IEEE80211_BAND_5GHZ:
275 if (rate == IWL_RATE_12M_INDEX)
276 next_rate = IWL_RATE_9M_INDEX;
277 else if (rate == IWL_RATE_6M_INDEX)
278 next_rate = IWL_RATE_6M_INDEX;
279 break;
280/* XXX cannot be invoked in current mac80211 so not a regression
281 case MODE_IEEE80211B:
282 if (rate == IWL_RATE_11M_INDEX_TABLE)
283 next_rate = IWL_RATE_5M_INDEX_TABLE;
284 break;
285 */
286 default:
287 break;
288 }
289
290 return next_rate;
291}
292
264 293
265/** 294/**
266 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd 295 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd
@@ -308,6 +337,7 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
308 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 337 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
309 u32 status = le32_to_cpu(tx_resp->status); 338 u32 status = le32_to_cpu(tx_resp->status);
310 int rate_idx; 339 int rate_idx;
340 int fail, i;
311 341
312 if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) { 342 if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) {
313 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " 343 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
@@ -318,9 +348,36 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
318 } 348 }
319 349
320 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]); 350 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
321 memset(&info->status, 0, sizeof(info->status)); 351 ieee80211_tx_info_clear_status(info);
352
353 /* Fill the MRR chain with some info about on-chip retransmissions */
354 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate);
355 if (info->band == IEEE80211_BAND_5GHZ)
356 rate_idx -= IWL_FIRST_OFDM_RATE;
357
358 fail = tx_resp->failure_frame;
359 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
360 int next = iwl3945_rs_next_rate(priv, rate_idx);
361
362 info->status.rates[i].idx = rate_idx;
363
364 /*
365 * Put remaining into the last count as best approximation
366 * of saying exactly what the hardware would have done...
367 */
368 if ((rate_idx == next) || (i == IEEE80211_TX_MAX_RATES - 1)) {
369 info->status.rates[i].count = fail;
370 break;
371 }
372
373 info->status.rates[i].count = priv->retry_rate;
374 fail -= priv->retry_rate;
375 rate_idx = next;
376 if (fail <= 0)
377 break;
378 }
379 info->status.rates[i].count++; /* add final attempt */
322 380
323 info->status.retry_count = tx_resp->failure_frame;
324 /* tx_status->rts_retry_count = tx_resp->failure_rts; */ 381 /* tx_status->rts_retry_count = tx_resp->failure_rts; */
325 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? 382 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ?
326 IEEE80211_TX_STAT_ACK : 0; 383 IEEE80211_TX_STAT_ACK : 0;
@@ -329,10 +386,6 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
329 txq_id, iwl3945_get_tx_fail_reason(status), status, 386 txq_id, iwl3945_get_tx_fail_reason(status), status,
330 tx_resp->rate, tx_resp->failure_frame); 387 tx_resp->rate, tx_resp->failure_frame);
331 388
332 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate);
333 if (info->band == IEEE80211_BAND_5GHZ)
334 rate_idx -= IWL_FIRST_OFDM_RATE;
335 info->tx_rate_idx = rate_idx;
336 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 389 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
337 iwl3945_tx_queue_reclaim(priv, txq_id, index); 390 iwl3945_tx_queue_reclaim(priv, txq_id, index);
338 391
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index bdd32475b99c..592c5958723b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -954,6 +954,8 @@ static inline int is_channel_ibss(const struct iwl3945_channel_info *ch)
954extern const struct iwl3945_channel_info *iwl3945_get_channel_info( 954extern const struct iwl3945_channel_info *iwl3945_get_channel_info(
955 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); 955 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel);
956 956
957extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate);
958
957/* Requires full declaration of iwl3945_priv before including */ 959/* Requires full declaration of iwl3945_priv before including */
958#include "iwl-3945-io.h" 960#include "iwl-3945-io.h"
959 961
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 9838de5f4369..222c2baa95ca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -619,10 +619,10 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
619static void iwl4965_rts_tx_cmd_flag(struct ieee80211_tx_info *info, 619static void iwl4965_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
620 __le32 *tx_flags) 620 __le32 *tx_flags)
621{ 621{
622 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 622 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
623 *tx_flags |= TX_CMD_FLG_RTS_MSK; 623 *tx_flags |= TX_CMD_FLG_RTS_MSK;
624 *tx_flags &= ~TX_CMD_FLG_CTS_MSK; 624 *tx_flags &= ~TX_CMD_FLG_CTS_MSK;
625 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 625 } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
626 *tx_flags &= ~TX_CMD_FLG_RTS_MSK; 626 *tx_flags &= ~TX_CMD_FLG_RTS_MSK;
627 *tx_flags |= TX_CMD_FLG_CTS_MSK; 627 *tx_flags |= TX_CMD_FLG_CTS_MSK;
628 } 628 }
@@ -2070,7 +2070,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
2070 agg->frame_count, agg->start_idx, idx); 2070 agg->frame_count, agg->start_idx, idx);
2071 2071
2072 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); 2072 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
2073 info->status.retry_count = tx_resp->failure_frame; 2073 info->status.rates[0].count = tx_resp->failure_frame + 1;
2074 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 2074 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
2075 info->flags |= iwl_is_tx_success(status)? 2075 info->flags |= iwl_is_tx_success(status)?
2076 IEEE80211_TX_STAT_ACK : 0; 2076 IEEE80211_TX_STAT_ACK : 0;
@@ -2227,7 +2227,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2227 iwl_txq_check_empty(priv, sta_id, tid, txq_id); 2227 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
2228 } 2228 }
2229 } else { 2229 } else {
2230 info->status.retry_count = tx_resp->failure_frame; 2230 info->status.rates[0].count = tx_resp->failure_frame + 1;
2231 info->flags |= 2231 info->flags |=
2232 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; 2232 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
2233 iwl_hwrate_to_tx_control(priv, 2233 iwl_hwrate_to_tx_control(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 56a3f0c84a1e..d5282fa65084 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -390,8 +390,8 @@ static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
390static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info, 390static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
391 __le32 *tx_flags) 391 __le32 *tx_flags)
392{ 392{
393 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || 393 if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
394 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) 394 (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT))
395 *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; 395 *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK;
396 else 396 else
397 *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK; 397 *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK;
@@ -1154,7 +1154,7 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1154 agg->frame_count, agg->start_idx, idx); 1154 agg->frame_count, agg->start_idx, idx);
1155 1155
1156 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); 1156 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
1157 info->status.retry_count = tx_resp->failure_frame; 1157 info->status.rates[0].count = tx_resp->failure_frame + 1;
1158 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 1158 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1159 info->flags |= iwl_is_tx_success(status)? 1159 info->flags |= iwl_is_tx_success(status)?
1160 IEEE80211_TX_STAT_ACK : 0; 1160 IEEE80211_TX_STAT_ACK : 0;
@@ -1307,7 +1307,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1307 iwl_txq_check_empty(priv, sta_id, tid, txq_id); 1307 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
1308 } 1308 }
1309 } else { 1309 } else {
1310 info->status.retry_count = tx_resp->failure_frame; 1310 info->status.rates[0].count = tx_resp->failure_frame + 1;
1311 info->flags = 1311 info->flags =
1312 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; 1312 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
1313 iwl_hwrate_to_tx_control(priv, 1313 iwl_hwrate_to_tx_control(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index e10e0ca09ce9..f685e5d6c281 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -798,7 +798,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
798 !(info->flags & IEEE80211_TX_STAT_AMPDU)) 798 !(info->flags & IEEE80211_TX_STAT_AMPDU))
799 return; 799 return;
800 800
801 retries = info->status.retry_count; 801 retries = info->status.rates[0].count - 1;
802 802
803 if (retries > 15) 803 if (retries > 15)
804 retries = 15; 804 retries = 15;
@@ -830,20 +830,15 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
830 if (priv->band == IEEE80211_BAND_5GHZ) 830 if (priv->band == IEEE80211_BAND_5GHZ)
831 rs_index -= IWL_FIRST_OFDM_RATE; 831 rs_index -= IWL_FIRST_OFDM_RATE;
832 832
833 if ((info->tx_rate_idx < 0) || 833 if ((info->status.rates[0].idx < 0) ||
834 (tbl_type.is_SGI ^ 834 (tbl_type.is_SGI != !!(info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) ||
835 !!(info->flags & IEEE80211_TX_CTL_SHORT_GI)) || 835 (tbl_type.is_fat != !!(info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) ||
836 (tbl_type.is_fat ^ 836 (tbl_type.is_dup != !!(info->status.rates[0].flags & IEEE80211_TX_RC_DUP_DATA)) ||
837 !!(info->flags & IEEE80211_TX_CTL_40_MHZ_WIDTH)) || 837 (tbl_type.ant_type != info->antenna_sel_tx) ||
838 (tbl_type.is_dup ^ 838 (!!(tx_rate & RATE_MCS_HT_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) ||
839 !!(info->flags & IEEE80211_TX_CTL_DUP_DATA)) || 839 (!!(tx_rate & RATE_MCS_GF_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) ||
840 (tbl_type.ant_type ^ info->antenna_sel_tx) ||
841 (!!(tx_rate & RATE_MCS_HT_MSK) ^
842 !!(info->flags & IEEE80211_TX_CTL_OFDM_HT)) ||
843 (!!(tx_rate & RATE_MCS_GF_MSK) ^
844 !!(info->flags & IEEE80211_TX_CTL_GREEN_FIELD)) ||
845 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != 840 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
846 hw->wiphy->bands[info->band]->bitrates[info->tx_rate_idx].bitrate)) { 841 hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) {
847 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); 842 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate);
848 goto out; 843 goto out;
849 } 844 }
@@ -2098,15 +2093,17 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2098 return; 2093 return;
2099} 2094}
2100 2095
2101static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, 2096static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2102 struct ieee80211_sta *sta, void *priv_sta, 2097 struct ieee80211_tx_rate_control *txrc)
2103 struct sk_buff *skb, struct rate_selection *sel)
2104{ 2098{
2105 2099
2106 int i; 2100 int i;
2101 struct sk_buff *skb = txrc->skb;
2102 struct ieee80211_supported_band *sband = txrc->sband;
2107 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 2103 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2108 struct ieee80211_conf *conf = &priv->hw->conf; 2104 struct ieee80211_conf *conf = &priv->hw->conf;
2109 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2105 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2106 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2110 __le16 fc; 2107 __le16 fc;
2111 struct iwl_lq_sta *lq_sta; 2108 struct iwl_lq_sta *lq_sta;
2112 2109
@@ -2117,7 +2114,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2117 fc = hdr->frame_control; 2114 fc = hdr->frame_control;
2118 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || 2115 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
2119 !sta || !priv_sta) { 2116 !sta || !priv_sta) {
2120 sel->rate_idx = rate_lowest_index(sband, sta); 2117 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2121 return; 2118 return;
2122 } 2119 }
2123 2120
@@ -2143,13 +2140,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2143 } 2140 }
2144 2141
2145 if ((i < 0) || (i > IWL_RATE_COUNT)) { 2142 if ((i < 0) || (i > IWL_RATE_COUNT)) {
2146 sel->rate_idx = rate_lowest_index(sband, sta); 2143 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2147 return; 2144 return;
2148 } 2145 }
2149 2146
2150 if (sband->band == IEEE80211_BAND_5GHZ) 2147 if (sband->band == IEEE80211_BAND_5GHZ)
2151 i -= IWL_FIRST_OFDM_RATE; 2148 i -= IWL_FIRST_OFDM_RATE;
2152 sel->rate_idx = i; 2149 info->control.rates[0].idx = i;
2153} 2150}
2154 2151
2155static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, 2152static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 10f5a0a233fe..2c4162e48140 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -88,26 +88,27 @@ EXPORT_SYMBOL(iwl_rates);
88 * translate ucode response to mac80211 tx status control values 88 * translate ucode response to mac80211 tx status control values
89 */ 89 */
90void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, 90void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
91 struct ieee80211_tx_info *control) 91 struct ieee80211_tx_info *info)
92{ 92{
93 int rate_index; 93 int rate_index;
94 struct ieee80211_tx_rate *r = &info->control.rates[0];
94 95
95 control->antenna_sel_tx = 96 info->antenna_sel_tx =
96 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); 97 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
97 if (rate_n_flags & RATE_MCS_HT_MSK) 98 if (rate_n_flags & RATE_MCS_HT_MSK)
98 control->flags |= IEEE80211_TX_CTL_OFDM_HT; 99 r->flags |= IEEE80211_TX_RC_MCS;
99 if (rate_n_flags & RATE_MCS_GF_MSK) 100 if (rate_n_flags & RATE_MCS_GF_MSK)
100 control->flags |= IEEE80211_TX_CTL_GREEN_FIELD; 101 r->flags |= IEEE80211_TX_RC_GREEN_FIELD;
101 if (rate_n_flags & RATE_MCS_FAT_MSK) 102 if (rate_n_flags & RATE_MCS_FAT_MSK)
102 control->flags |= IEEE80211_TX_CTL_40_MHZ_WIDTH; 103 r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
103 if (rate_n_flags & RATE_MCS_DUP_MSK) 104 if (rate_n_flags & RATE_MCS_DUP_MSK)
104 control->flags |= IEEE80211_TX_CTL_DUP_DATA; 105 r->flags |= IEEE80211_TX_RC_DUP_DATA;
105 if (rate_n_flags & RATE_MCS_SGI_MSK) 106 if (rate_n_flags & RATE_MCS_SGI_MSK)
106 control->flags |= IEEE80211_TX_CTL_SHORT_GI; 107 r->flags |= IEEE80211_TX_RC_SHORT_GI;
107 rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags); 108 rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags);
108 if (control->band == IEEE80211_BAND_5GHZ) 109 if (info->band == IEEE80211_BAND_5GHZ)
109 rate_index -= IWL_FIRST_OFDM_RATE; 110 rate_index -= IWL_FIRST_OFDM_RATE;
110 control->tx_rate_idx = rate_index; 111 r->idx = rate_index;
111} 112}
112EXPORT_SYMBOL(iwl_hwrate_to_tx_control); 113EXPORT_SYMBOL(iwl_hwrate_to_tx_control);
113 114
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index b1464c71ea0a..2cd33b4e9e13 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2395,6 +2395,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2395{ 2395{
2396 __le16 fc = hdr->frame_control; 2396 __le16 fc = hdr->frame_control;
2397 __le32 tx_flags = cmd->cmd.tx.tx_flags; 2397 __le32 tx_flags = cmd->cmd.tx.tx_flags;
2398 u8 rc_flags = info->control.rates[0].flags;
2398 2399
2399 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2400 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2400 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 2401 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
@@ -2421,10 +2422,10 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2421 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2422 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2422 } 2423 }
2423 2424
2424 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 2425 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
2425 tx_flags |= TX_CMD_FLG_RTS_MSK; 2426 tx_flags |= TX_CMD_FLG_RTS_MSK;
2426 tx_flags &= ~TX_CMD_FLG_CTS_MSK; 2427 tx_flags &= ~TX_CMD_FLG_CTS_MSK;
2427 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 2428 } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
2428 tx_flags &= ~TX_CMD_FLG_RTS_MSK; 2429 tx_flags &= ~TX_CMD_FLG_RTS_MSK;
2429 tx_flags |= TX_CMD_FLG_CTS_MSK; 2430 tx_flags |= TX_CMD_FLG_CTS_MSK;
2430 } 2431 }
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index 241ddcfa352e..d1fc305de5fe 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -592,14 +592,14 @@ EXPORT_SYMBOL_GPL(lbtf_remove_card);
592void lbtf_send_tx_feedback(struct lbtf_private *priv, u8 retrycnt, u8 fail) 592void lbtf_send_tx_feedback(struct lbtf_private *priv, u8 retrycnt, u8 fail)
593{ 593{
594 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(priv->tx_skb); 594 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(priv->tx_skb);
595 memset(&info->status, 0, sizeof(info->status)); 595
596 ieee80211_tx_info_clear_status(info);
596 /* 597 /*
597 * Commented out, otherwise we never go beyond 1Mbit/s using mac80211 598 * Commented out, otherwise we never go beyond 1Mbit/s using mac80211
598 * default pid rc algorithm. 599 * default pid rc algorithm.
599 * 600 *
600 * info->status.retry_count = MRVL_DEFAULT_RETRIES - retrycnt; 601 * info->status.retry_count = MRVL_DEFAULT_RETRIES - retrycnt;
601 */ 602 */
602 info->status.excessive_retries = fail ? 1 : 0;
603 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && !fail) 603 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && !fail)
604 info->flags |= IEEE80211_TX_STAT_ACK; 604 info->flags |= IEEE80211_TX_STAT_ACK;
605 skb_pull(priv->tx_skb, sizeof(struct txpd)); 605 skb_pull(priv->tx_skb, sizeof(struct txpd));
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index e2aeef8de707..c57652325286 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -209,7 +209,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
209 /* TODO: set mactime */ 209 /* TODO: set mactime */
210 rx_status.freq = data->channel->center_freq; 210 rx_status.freq = data->channel->center_freq;
211 rx_status.band = data->channel->band; 211 rx_status.band = data->channel->band;
212 rx_status.rate_idx = info->tx_rate_idx; 212 rx_status.rate_idx = info->control.rates[0].idx;
213 /* TODO: simulate signal strength (and optional packet drop) */ 213 /* TODO: simulate signal strength (and optional packet drop) */
214 214
215 /* Copy skb to all enabled radios that are on the current frequency */ 215 /* Copy skb to all enabled radios that are on the current frequency */
@@ -269,13 +269,9 @@ static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
269 if (txi->control.sta) 269 if (txi->control.sta)
270 hwsim_check_sta_magic(txi->control.sta); 270 hwsim_check_sta_magic(txi->control.sta);
271 271
272 memset(&txi->status, 0, sizeof(txi->status)); 272 ieee80211_tx_info_clear_status(txi);
273 if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK)) { 273 if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) && ack)
274 if (ack) 274 txi->flags |= IEEE80211_TX_STAT_ACK;
275 txi->flags |= IEEE80211_TX_STAT_ACK;
276 else
277 txi->status.excessive_retries = 1;
278 }
279 ieee80211_tx_status_irqsafe(hw, skb); 275 ieee80211_tx_status_irqsafe(hw, skb);
280 return NETDEV_TX_OK; 276 return NETDEV_TX_OK;
281} 277}
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 81a9756254fb..65be5eca2340 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -548,7 +548,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
548 spin_lock_irqsave(&priv->tx_queue.lock, flags); 548 spin_lock_irqsave(&priv->tx_queue.lock, flags);
549 while (entry != (struct sk_buff *)&priv->tx_queue) { 549 while (entry != (struct sk_buff *)&priv->tx_queue) {
550 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 550 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
551 range = (void *)info->driver_data; 551 range = (void *)info->rate_driver_data;
552 if (range->start_addr == addr) { 552 if (range->start_addr == addr) {
553 struct p54_control_hdr *entry_hdr; 553 struct p54_control_hdr *entry_hdr;
554 struct p54_tx_control_allocdata *entry_data; 554 struct p54_tx_control_allocdata *entry_data;
@@ -559,7 +559,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
559 struct memrecord *mr; 559 struct memrecord *mr;
560 560
561 ni = IEEE80211_SKB_CB(entry->next); 561 ni = IEEE80211_SKB_CB(entry->next);
562 mr = (struct memrecord *)ni->driver_data; 562 mr = (struct memrecord *)ni->rate_driver_data;
563 freed = mr->start_addr - last_addr; 563 freed = mr->start_addr - last_addr;
564 } else 564 } else
565 freed = priv->rx_end - last_addr; 565 freed = priv->rx_end - last_addr;
@@ -568,7 +568,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
568 __skb_unlink(entry, &priv->tx_queue); 568 __skb_unlink(entry, &priv->tx_queue);
569 spin_unlock_irqrestore(&priv->tx_queue.lock, flags); 569 spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
570 570
571 memset(&info->status, 0, sizeof(info->status)); 571 ieee80211_tx_info_clear_status(info);
572 entry_hdr = (struct p54_control_hdr *) entry->data; 572 entry_hdr = (struct p54_control_hdr *) entry->data;
573 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 573 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
574 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 574 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
@@ -578,10 +578,8 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
578 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 578 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
579 if (!(payload->status & 0x01)) 579 if (!(payload->status & 0x01))
580 info->flags |= IEEE80211_TX_STAT_ACK; 580 info->flags |= IEEE80211_TX_STAT_ACK;
581 else
582 info->status.excessive_retries = 1;
583 } 581 }
584 info->status.retry_count = payload->retries - 1; 582 info->status.rates[0].count = payload->retries;
585 info->status.ack_signal = p54_rssi_to_dbm(dev, 583 info->status.ack_signal = p54_rssi_to_dbm(dev,
586 le16_to_cpu(payload->ack_rssi)); 584 le16_to_cpu(payload->ack_rssi));
587 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 585 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
@@ -699,7 +697,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
699 while (left--) { 697 while (left--) {
700 u32 hole_size; 698 u32 hole_size;
701 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); 699 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
702 struct memrecord *range = (void *)info->driver_data; 700 struct memrecord *range = (void *)info->rate_driver_data;
703 hole_size = range->start_addr - last_addr; 701 hole_size = range->start_addr - last_addr;
704 if (!target_skb && hole_size >= len) { 702 if (!target_skb && hole_size >= len) {
705 target_skb = entry->prev; 703 target_skb = entry->prev;
@@ -715,7 +713,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
715 largest_hole = max(largest_hole, priv->rx_end - last_addr - len); 713 largest_hole = max(largest_hole, priv->rx_end - last_addr - len);
716 if (!skb_queue_empty(&priv->tx_queue)) { 714 if (!skb_queue_empty(&priv->tx_queue)) {
717 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(target_skb); 715 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(target_skb);
718 struct memrecord *range = (void *)info->driver_data; 716 struct memrecord *range = (void *)info->rate_driver_data;
719 target_addr = range->end_addr; 717 target_addr = range->end_addr;
720 } 718 }
721 } else 719 } else
@@ -723,7 +721,7 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
723 721
724 if (skb) { 722 if (skb) {
725 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 723 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
726 struct memrecord *range = (void *)info->driver_data; 724 struct memrecord *range = (void *)info->rate_driver_data;
727 range->start_addr = target_addr; 725 range->start_addr = target_addr;
728 range->end_addr = target_addr + len; 726 range->end_addr = target_addr + len;
729 __skb_queue_after(&priv->tx_queue, target_skb, skb); 727 __skb_queue_after(&priv->tx_queue, target_skb, skb);
@@ -806,6 +804,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
806 size_t padding, len; 804 size_t padding, len;
807 u8 rate; 805 u8 rate;
808 u8 cts_rate = 0x20; 806 u8 cts_rate = 0x20;
807 u8 rc_flags;
809 808
810 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb) + 4]; 809 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb) + 4];
811 if (unlikely(current_queue->len > current_queue->limit)) 810 if (unlikely(current_queue->len > current_queue->limit))
@@ -828,18 +827,19 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
828 hdr->magic1 = cpu_to_le16(0x0010); 827 hdr->magic1 = cpu_to_le16(0x0010);
829 hdr->len = cpu_to_le16(len); 828 hdr->len = cpu_to_le16(len);
830 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); 829 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1);
831 hdr->retry1 = hdr->retry2 = info->control.retry_limit; 830 hdr->retry1 = hdr->retry2 = info->control.rates[0].count;
832 831
833 /* TODO: add support for alternate retry TX rates */ 832 /* TODO: add support for alternate retry TX rates */
834 rate = ieee80211_get_tx_rate(dev, info)->hw_value; 833 rate = ieee80211_get_tx_rate(dev, info)->hw_value;
835 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) { 834 rc_flags = info->control.rates[0].flags;
835 if (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) {
836 rate |= 0x10; 836 rate |= 0x10;
837 cts_rate |= 0x10; 837 cts_rate |= 0x10;
838 } 838 }
839 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 839 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
840 rate |= 0x40; 840 rate |= 0x40;
841 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value; 841 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
842 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 842 } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
843 rate |= 0x20; 843 rate |= 0x20;
844 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value; 844 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
845 } 845 }
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 697806cf94e2..e1feab8b6b02 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -498,7 +498,9 @@ void rt2x00lib_txdone(struct queue_entry *entry,
498{ 498{
499 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 499 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
500 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); 500 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
501 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
501 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb); 502 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
503 u8 rate_idx, rate_flags;
502 504
503 /* 505 /*
504 * Unmap the skb. 506 * Unmap the skb.
@@ -528,14 +530,18 @@ void rt2x00lib_txdone(struct queue_entry *entry,
528 rt2x00dev->link.qual.tx_failed += 530 rt2x00dev->link.qual.tx_failed +=
529 test_bit(TXDONE_FAILURE, &txdesc->flags); 531 test_bit(TXDONE_FAILURE, &txdesc->flags);
530 532
533 rate_idx = skbdesc->tx_rate_idx;
534 rate_flags = skbdesc->tx_rate_flags;
535
531 /* 536 /*
532 * Initialize TX status 537 * Initialize TX status
533 */ 538 */
534 memset(&tx_info->status, 0, sizeof(tx_info->status)); 539 memset(&tx_info->status, 0, sizeof(tx_info->status));
535 tx_info->status.ack_signal = 0; 540 tx_info->status.ack_signal = 0;
536 tx_info->status.excessive_retries = 541 tx_info->status.rates[0].idx = rate_idx;
537 test_bit(TXDONE_EXCESSIVE_RETRY, &txdesc->flags); 542 tx_info->status.rates[0].flags = rate_flags;
538 tx_info->status.retry_count = txdesc->retry; 543 tx_info->status.rates[0].count = txdesc->retry + 1;
544 tx_info->status.rates[1].idx = -1; /* terminate */
539 545
540 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { 546 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
541 if (test_bit(TXDONE_SUCCESS, &txdesc->flags)) 547 if (test_bit(TXDONE_SUCCESS, &txdesc->flags))
@@ -544,7 +550,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
544 rt2x00dev->low_level_stats.dot11ACKFailureCount++; 550 rt2x00dev->low_level_stats.dot11ACKFailureCount++;
545 } 551 }
546 552
547 if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 553 if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
548 if (test_bit(TXDONE_SUCCESS, &txdesc->flags)) 554 if (test_bit(TXDONE_SUCCESS, &txdesc->flags))
549 rt2x00dev->low_level_stats.dot11RTSSuccessCount++; 555 rt2x00dev->low_level_stats.dot11RTSSuccessCount++;
550 else if (test_bit(TXDONE_FAILURE, &txdesc->flags)) 556 else if (test_bit(TXDONE_FAILURE, &txdesc->flags))
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 931183369f07..b32d59eafaa3 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -39,7 +39,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
39 unsigned int data_length; 39 unsigned int data_length;
40 int retval = 0; 40 int retval = 0;
41 41
42 if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) 42 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
43 data_length = sizeof(struct ieee80211_cts); 43 data_length = sizeof(struct ieee80211_cts);
44 else 44 else
45 data_length = sizeof(struct ieee80211_rts); 45 data_length = sizeof(struct ieee80211_rts);
@@ -64,11 +64,11 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
64 */ 64 */
65 memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb)); 65 memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb));
66 rts_info = IEEE80211_SKB_CB(skb); 66 rts_info = IEEE80211_SKB_CB(skb);
67 rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS; 67 rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS;
68 rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT; 68 rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_CTS_PROTECT;
69 rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS; 69 rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
70 70
71 if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) 71 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
72 rts_info->flags |= IEEE80211_TX_CTL_NO_ACK; 72 rts_info->flags |= IEEE80211_TX_CTL_NO_ACK;
73 else 73 else
74 rts_info->flags &= ~IEEE80211_TX_CTL_NO_ACK; 74 rts_info->flags &= ~IEEE80211_TX_CTL_NO_ACK;
@@ -84,7 +84,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
84 data_length += rt2x00crypto_tx_overhead(tx_info); 84 data_length += rt2x00crypto_tx_overhead(tx_info);
85#endif /* CONFIG_RT2X00_LIB_CRYPTO */ 85#endif /* CONFIG_RT2X00_LIB_CRYPTO */
86 86
87 if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) 87 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
88 ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif, 88 ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif,
89 frag_skb->data, data_length, tx_info, 89 frag_skb->data, data_length, tx_info,
90 (struct ieee80211_cts *)(skb->data)); 90 (struct ieee80211_cts *)(skb->data));
@@ -146,8 +146,8 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
146 * inside the hardware. 146 * inside the hardware.
147 */ 147 */
148 frame_control = le16_to_cpu(ieee80211hdr->frame_control); 148 frame_control = le16_to_cpu(ieee80211hdr->frame_control);
149 if ((tx_info->flags & (IEEE80211_TX_CTL_USE_RTS_CTS | 149 if ((tx_info->control.rates[0].flags & (IEEE80211_TX_RC_USE_RTS_CTS |
150 IEEE80211_TX_CTL_USE_CTS_PROTECT)) && 150 IEEE80211_TX_RC_USE_CTS_PROTECT)) &&
151 !rt2x00dev->ops->hw->set_rts_threshold) { 151 !rt2x00dev->ops->hw->set_rts_threshold) {
152 if (rt2x00queue_available(queue) <= 1) 152 if (rt2x00queue_available(queue) <= 1)
153 goto exit_fail; 153 goto exit_fail;
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 451d410ecdae..070786ebd076 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -230,8 +230,15 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
230 /* 230 /*
231 * Determine retry information. 231 * Determine retry information.
232 */ 232 */
233 txdesc->retry_limit = tx_info->control.retry_limit; 233 txdesc->retry_limit = tx_info->control.rates[0].count - 1;
234 if (tx_info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT) 234 /*
235 * XXX: If at this point we knew whether the HW is going to use
236 * the RETRY_MODE bit or the retry_limit (currently all
237 * use the RETRY_MODE bit) we could do something like b43
238 * does, set the RETRY_MODE bit when the RC algorithm is
239 * requesting more than the long retry limit.
240 */
241 if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
235 __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags); 242 __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags);
236 243
237 /* 244 /*
@@ -371,10 +378,12 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
371 378
372int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) 379int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
373{ 380{
381 struct ieee80211_tx_info *tx_info;
374 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); 382 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
375 struct txentry_desc txdesc; 383 struct txentry_desc txdesc;
376 struct skb_frame_desc *skbdesc; 384 struct skb_frame_desc *skbdesc;
377 unsigned int iv_len = 0; 385 unsigned int iv_len = 0;
386 u8 rate_idx, rate_flags;
378 387
379 if (unlikely(rt2x00queue_full(queue))) 388 if (unlikely(rt2x00queue_full(queue)))
380 return -EINVAL; 389 return -EINVAL;
@@ -399,13 +408,18 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
399 iv_len = IEEE80211_SKB_CB(skb)->control.hw_key->iv_len; 408 iv_len = IEEE80211_SKB_CB(skb)->control.hw_key->iv_len;
400 409
401 /* 410 /*
402 * All information is retreived from the skb->cb array, 411 * All information is retrieved from the skb->cb array,
403 * now we should claim ownership of the driver part of that 412 * now we should claim ownership of the driver part of that
404 * array. 413 * array, preserving the bitrate index and flags.
405 */ 414 */
415 tx_info = IEEE80211_SKB_CB(skb);
416 rate_idx = tx_info->control.rates[0].idx;
417 rate_flags = tx_info->control.rates[0].flags;
406 skbdesc = get_skb_frame_desc(entry->skb); 418 skbdesc = get_skb_frame_desc(entry->skb);
407 memset(skbdesc, 0, sizeof(*skbdesc)); 419 memset(skbdesc, 0, sizeof(*skbdesc));
408 skbdesc->entry = entry; 420 skbdesc->entry = entry;
421 skbdesc->tx_rate_idx = rate_idx;
422 skbdesc->tx_rate_flags = rate_flags;
409 423
410 /* 424 /*
411 * When hardware encryption is supported, and this frame 425 * When hardware encryption is supported, and this frame
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 9dbf04f0f04c..4d3c7246f9ae 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -104,6 +104,8 @@ enum skb_frame_desc_flags {
104 * 104 *
105 * @flags: Frame flags, see &enum skb_frame_desc_flags. 105 * @flags: Frame flags, see &enum skb_frame_desc_flags.
106 * @desc_len: Length of the frame descriptor. 106 * @desc_len: Length of the frame descriptor.
107 * @tx_rate_idx: the index of the TX rate, used for TX status reporting
108 * @tx_rate_flags: the TX rate flags, used for TX status reporting
107 * @desc: Pointer to descriptor part of the frame. 109 * @desc: Pointer to descriptor part of the frame.
108 * Note that this pointer could point to something outside 110 * Note that this pointer could point to something outside
109 * of the scope of the skb->data pointer. 111 * of the scope of the skb->data pointer.
@@ -113,9 +115,12 @@ enum skb_frame_desc_flags {
113 * @entry: The entry to which this sk buffer belongs. 115 * @entry: The entry to which this sk buffer belongs.
114 */ 116 */
115struct skb_frame_desc { 117struct skb_frame_desc {
116 unsigned int flags; 118 u8 flags;
119
120 u8 desc_len;
121 u8 tx_rate_idx;
122 u8 tx_rate_flags;
117 123
118 unsigned int desc_len;
119 void *desc; 124 void *desc;
120 125
121 __le32 iv; 126 __le32 iv;
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c
index e8d22393797f..6c226c024dd9 100644
--- a/drivers/net/wireless/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl8180_dev.c
@@ -182,15 +182,13 @@ static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio)
182 skb->len, PCI_DMA_TODEVICE); 182 skb->len, PCI_DMA_TODEVICE);
183 183
184 info = IEEE80211_SKB_CB(skb); 184 info = IEEE80211_SKB_CB(skb);
185 memset(&info->status, 0, sizeof(info->status)); 185 ieee80211_tx_info_clear_status(info);
186 186
187 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 187 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
188 if (flags & RTL818X_TX_DESC_FLAG_TX_OK) 188 (flags & RTL818X_TX_DESC_FLAG_TX_OK))
189 info->flags |= IEEE80211_TX_STAT_ACK; 189 info->flags |= IEEE80211_TX_STAT_ACK;
190 else 190
191 info->status.excessive_retries = 1; 191 info->status.rates[0].count = (flags & 0xFF) + 1;
192 }
193 info->status.retry_count = flags & 0xFF;
194 192
195 ieee80211_tx_status_irqsafe(dev, skb); 193 ieee80211_tx_status_irqsafe(dev, skb);
196 if (ring->entries - skb_queue_len(&ring->queue) == 2) 194 if (ring->entries - skb_queue_len(&ring->queue) == 2)
@@ -243,6 +241,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
243 unsigned int idx, prio; 241 unsigned int idx, prio;
244 dma_addr_t mapping; 242 dma_addr_t mapping;
245 u32 tx_flags; 243 u32 tx_flags;
244 u8 rc_flags;
246 u16 plcp_len = 0; 245 u16 plcp_len = 0;
247 __le16 rts_duration = 0; 246 __le16 rts_duration = 0;
248 247
@@ -261,15 +260,16 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
261 tx_flags |= RTL818X_TX_DESC_FLAG_DMA | 260 tx_flags |= RTL818X_TX_DESC_FLAG_DMA |
262 RTL818X_TX_DESC_FLAG_NO_ENC; 261 RTL818X_TX_DESC_FLAG_NO_ENC;
263 262
264 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 263 rc_flags = info->control.rates[0].flags;
264 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
265 tx_flags |= RTL818X_TX_DESC_FLAG_RTS; 265 tx_flags |= RTL818X_TX_DESC_FLAG_RTS;
266 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 266 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
267 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 267 } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
268 tx_flags |= RTL818X_TX_DESC_FLAG_CTS; 268 tx_flags |= RTL818X_TX_DESC_FLAG_CTS;
269 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 269 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
270 } 270 }
271 271
272 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) 272 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS)
273 rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, 273 rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len,
274 info); 274 info);
275 275
@@ -292,9 +292,9 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
292 entry->plcp_len = cpu_to_le16(plcp_len); 292 entry->plcp_len = cpu_to_le16(plcp_len);
293 entry->tx_buf = cpu_to_le32(mapping); 293 entry->tx_buf = cpu_to_le32(mapping);
294 entry->frame_len = cpu_to_le32(skb->len); 294 entry->frame_len = cpu_to_le32(skb->len);
295 entry->flags2 = info->control.retries[0].rate_idx >= 0 ? 295 entry->flags2 = info->control.rates[1].idx >= 0 ?
296 ieee80211_get_alt_retry_rate(dev, info, 0)->bitrate << 4 : 0; 296 ieee80211_get_alt_retry_rate(dev, info, 0)->bitrate << 4 : 0;
297 entry->retry_limit = info->control.retry_limit; 297 entry->retry_limit = info->control.rates[0].count;
298 entry->flags = cpu_to_le32(tx_flags); 298 entry->flags = cpu_to_le32(tx_flags);
299 __skb_queue_tail(&ring->queue, skb); 299 __skb_queue_tail(&ring->queue, skb);
300 if (ring->entries - skb_queue_len(&ring->queue) < 2) 300 if (ring->entries - skb_queue_len(&ring->queue) < 2)
@@ -855,7 +855,7 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,
855 priv = dev->priv; 855 priv = dev->priv;
856 priv->pdev = pdev; 856 priv->pdev = pdev;
857 857
858 dev->max_altrates = 1; 858 dev->max_rates = 2;
859 SET_IEEE80211_DEV(dev, &pdev->dev); 859 SET_IEEE80211_DEV(dev, &pdev->dev);
860 pci_set_drvdata(pdev, dev); 860 pci_set_drvdata(pdev, dev);
861 861
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index cd839bcb6d78..6260ed8ce12b 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -160,13 +160,13 @@ static void rtl8187_tx_cb(struct urb *urb)
160{ 160{
161 struct sk_buff *skb = (struct sk_buff *)urb->context; 161 struct sk_buff *skb = (struct sk_buff *)urb->context;
162 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 162 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
163 struct ieee80211_hw *hw = info->driver_data[0]; 163 struct ieee80211_hw *hw = info->rate_driver_data[0];
164 struct rtl8187_priv *priv = hw->priv; 164 struct rtl8187_priv *priv = hw->priv;
165 165
166 usb_free_urb(info->driver_data[1]); 166 usb_free_urb(info->rate_driver_data[1]);
167 skb_pull(skb, priv->is_rtl8187b ? sizeof(struct rtl8187b_tx_hdr) : 167 skb_pull(skb, priv->is_rtl8187b ? sizeof(struct rtl8187b_tx_hdr) :
168 sizeof(struct rtl8187_tx_hdr)); 168 sizeof(struct rtl8187_tx_hdr));
169 memset(&info->status, 0, sizeof(info->status)); 169 ieee80211_tx_info_clear_status(info);
170 info->flags |= IEEE80211_TX_STAT_ACK; 170 info->flags |= IEEE80211_TX_STAT_ACK;
171 ieee80211_tx_status_irqsafe(hw, skb); 171 ieee80211_tx_status_irqsafe(hw, skb);
172} 172}
@@ -194,12 +194,12 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
194 flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24; 194 flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;
195 if (ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control)) 195 if (ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control))
196 flags |= RTL818X_TX_DESC_FLAG_MOREFRAG; 196 flags |= RTL818X_TX_DESC_FLAG_MOREFRAG;
197 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 197 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
198 flags |= RTL818X_TX_DESC_FLAG_RTS; 198 flags |= RTL818X_TX_DESC_FLAG_RTS;
199 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 199 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
200 rts_dur = ieee80211_rts_duration(dev, priv->vif, 200 rts_dur = ieee80211_rts_duration(dev, priv->vif,
201 skb->len, info); 201 skb->len, info);
202 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 202 } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
203 flags |= RTL818X_TX_DESC_FLAG_CTS; 203 flags |= RTL818X_TX_DESC_FLAG_CTS;
204 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19; 204 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
205 } 205 }
@@ -210,7 +210,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
210 hdr->flags = cpu_to_le32(flags); 210 hdr->flags = cpu_to_le32(flags);
211 hdr->len = 0; 211 hdr->len = 0;
212 hdr->rts_duration = rts_dur; 212 hdr->rts_duration = rts_dur;
213 hdr->retry = cpu_to_le32(info->control.retry_limit << 8); 213 hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
214 buf = hdr; 214 buf = hdr;
215 215
216 ep = 2; 216 ep = 2;
@@ -228,7 +228,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
228 memset(hdr, 0, sizeof(*hdr)); 228 memset(hdr, 0, sizeof(*hdr));
229 hdr->flags = cpu_to_le32(flags); 229 hdr->flags = cpu_to_le32(flags);
230 hdr->rts_duration = rts_dur; 230 hdr->rts_duration = rts_dur;
231 hdr->retry = cpu_to_le32(info->control.retry_limit << 8); 231 hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
232 hdr->tx_duration = 232 hdr->tx_duration =
233 ieee80211_generic_frame_duration(dev, priv->vif, 233 ieee80211_generic_frame_duration(dev, priv->vif,
234 skb->len, txrate); 234 skb->len, txrate);
@@ -240,8 +240,8 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
240 ep = epmap[skb_get_queue_mapping(skb)]; 240 ep = epmap[skb_get_queue_mapping(skb)];
241 } 241 }
242 242
243 info->driver_data[0] = dev; 243 info->rate_driver_data[0] = dev;
244 info->driver_data[1] = urb; 244 info->rate_driver_data[1] = urb;
245 245
246 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep), 246 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, ep),
247 buf, skb->len, rtl8187_tx_cb, skb); 247 buf, skb->len, rtl8187_tx_cb, skb);
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 6c3e21887fc8..2f0802b29c4b 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -296,15 +296,14 @@ static void zd_op_stop(struct ieee80211_hw *hw)
296 * If no status information has been requested, the skb is freed. 296 * If no status information has been requested, the skb is freed.
297 */ 297 */
298static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, 298static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
299 u32 flags, int ackssi, bool success) 299 int ackssi, bool success)
300{ 300{
301 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 301 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
302 302
303 memset(&info->status, 0, sizeof(info->status)); 303 ieee80211_tx_info_clear_status(info);
304 304
305 if (!success) 305 if (success)
306 info->status.excessive_retries = 1; 306 info->flags |= IEEE80211_TX_STAT_ACK;
307 info->flags |= flags;
308 info->status.ack_signal = ackssi; 307 info->status.ack_signal = ackssi;
309 ieee80211_tx_status_irqsafe(hw, skb); 308 ieee80211_tx_status_irqsafe(hw, skb);
310} 309}
@@ -326,7 +325,7 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw)
326 if (skb == NULL) 325 if (skb == NULL)
327 return; 326 return;
328 327
329 tx_status(hw, skb, 0, 0, 0); 328 tx_status(hw, skb, 0, 0);
330} 329}
331 330
332/** 331/**
@@ -342,12 +341,12 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw)
342void zd_mac_tx_to_dev(struct sk_buff *skb, int error) 341void zd_mac_tx_to_dev(struct sk_buff *skb, int error)
343{ 342{
344 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 343 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
345 struct ieee80211_hw *hw = info->driver_data[0]; 344 struct ieee80211_hw *hw = info->rate_driver_data[0];
346 345
347 skb_pull(skb, sizeof(struct zd_ctrlset)); 346 skb_pull(skb, sizeof(struct zd_ctrlset));
348 if (unlikely(error || 347 if (unlikely(error ||
349 (info->flags & IEEE80211_TX_CTL_NO_ACK))) { 348 (info->flags & IEEE80211_TX_CTL_NO_ACK))) {
350 tx_status(hw, skb, 0, 0, !error); 349 tx_status(hw, skb, 0, !error);
351 } else { 350 } else {
352 struct sk_buff_head *q = 351 struct sk_buff_head *q =
353 &zd_hw_mac(hw)->ack_wait_queue; 352 &zd_hw_mac(hw)->ack_wait_queue;
@@ -406,7 +405,8 @@ static int zd_calc_tx_length_us(u8 *service, u8 zd_rate, u16 tx_length)
406} 405}
407 406
408static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs, 407static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
409 struct ieee80211_hdr *header, u32 flags) 408 struct ieee80211_hdr *header,
409 struct ieee80211_tx_info *info)
410{ 410{
411 /* 411 /*
412 * CONTROL TODO: 412 * CONTROL TODO:
@@ -417,7 +417,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
417 cs->control = 0; 417 cs->control = 0;
418 418
419 /* First fragment */ 419 /* First fragment */
420 if (flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) 420 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
421 cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; 421 cs->control |= ZD_CS_NEED_RANDOM_BACKOFF;
422 422
423 /* Multicast */ 423 /* Multicast */
@@ -428,10 +428,10 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
428 if (ieee80211_is_pspoll(header->frame_control)) 428 if (ieee80211_is_pspoll(header->frame_control))
429 cs->control |= ZD_CS_PS_POLL_FRAME; 429 cs->control |= ZD_CS_PS_POLL_FRAME;
430 430
431 if (flags & IEEE80211_TX_CTL_USE_RTS_CTS) 431 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
432 cs->control |= ZD_CS_RTS; 432 cs->control |= ZD_CS_RTS;
433 433
434 if (flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) 434 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
435 cs->control |= ZD_CS_SELF_CTS; 435 cs->control |= ZD_CS_SELF_CTS;
436 436
437 /* FIXME: Management frame? */ 437 /* FIXME: Management frame? */
@@ -517,12 +517,12 @@ static int fill_ctrlset(struct zd_mac *mac,
517 txrate = ieee80211_get_tx_rate(mac->hw, info); 517 txrate = ieee80211_get_tx_rate(mac->hw, info);
518 518
519 cs->modulation = txrate->hw_value; 519 cs->modulation = txrate->hw_value;
520 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) 520 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
521 cs->modulation = txrate->hw_value_short; 521 cs->modulation = txrate->hw_value_short;
522 522
523 cs->tx_length = cpu_to_le16(frag_len); 523 cs->tx_length = cpu_to_le16(frag_len);
524 524
525 cs_set_control(mac, cs, hdr, info->flags); 525 cs_set_control(mac, cs, hdr, info);
526 526
527 packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; 527 packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
528 ZD_ASSERT(packet_length <= 0xffff); 528 ZD_ASSERT(packet_length <= 0xffff);
@@ -577,7 +577,7 @@ static int zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
577 if (r) 577 if (r)
578 return r; 578 return r;
579 579
580 info->driver_data[0] = hw; 580 info->rate_driver_data[0] = hw;
581 581
582 r = zd_usb_tx(&mac->chip.usb, skb); 582 r = zd_usb_tx(&mac->chip.usb, skb);
583 if (r) 583 if (r)
@@ -618,7 +618,7 @@ static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr,
618 if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1))) 618 if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1)))
619 { 619 {
620 __skb_unlink(skb, q); 620 __skb_unlink(skb, q);
621 tx_status(hw, skb, IEEE80211_TX_STAT_ACK, stats->signal, 1); 621 tx_status(hw, skb, stats->signal, 1);
622 goto out; 622 goto out;
623 } 623 }
624 } 624 }
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index a60ae86bd5c9..d7a2f52e40cf 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -907,7 +907,7 @@ free_urb:
907 * it might be freed by zd_mac_tx_to_dev or mac80211) 907 * it might be freed by zd_mac_tx_to_dev or mac80211)
908 */ 908 */
909 info = IEEE80211_SKB_CB(skb); 909 info = IEEE80211_SKB_CB(skb);
910 usb = &zd_hw_mac(info->driver_data[0])->chip.usb; 910 usb = &zd_hw_mac(info->rate_driver_data[0])->chip.usb;
911 zd_mac_tx_to_dev(skb, urb->status); 911 zd_mac_tx_to_dev(skb, urb->status);
912 free_tx_urb(usb, urb); 912 free_tx_urb(usb, urb);
913 tx_dec_submitted_urbs(usb); 913 tx_dec_submitted_urbs(usb);