aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-15 06:55:27 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:09 -0400
commit2e92e6f2c50b4baf85cca968f0e6f1b5c0df7d39 (patch)
treee845c2f3af6d29c807c540366b97b1d886b92c91 /drivers
parent36d6825b91bc492b65b6333c369cd96a2fc8c903 (diff)
mac80211: use rate index in TX control
This patch modifies struct ieee80211_tx_control to give band info and the rate index (instead of rate pointers) to drivers. This mostly serves to reduce the TX control structure size to make it fit into skb->cb so that the fragmentation code can put it there and we can think about passing it to drivers that way in the future. The rt2x00 driver update was done by Ivo, thanks. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/adm8211.c6
-rw-r--r--drivers/net/wireless/ath5k/base.c8
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43/xmit.c13
-rw-r--r--drivers/net/wireless/b43legacy/xmit.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2
-rw-r--r--drivers/net/wireless/p54/p54common.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c9
-rw-r--r--drivers/net/wireless/rtl8180_dev.c19
-rw-r--r--drivers/net/wireless/rtl8187_dev.c10
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c7
17 files changed, 73 insertions, 61 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 79dfca546c89..22db664a58d9 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -1693,10 +1693,10 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
1693 size_t payload_len, hdrlen; 1693 size_t payload_len, hdrlen;
1694 int plcp, dur, len, plcp_signal, short_preamble; 1694 int plcp, dur, len, plcp_signal, short_preamble;
1695 struct ieee80211_hdr *hdr; 1695 struct ieee80211_hdr *hdr;
1696 struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, control);
1696 1697
1697 short_preamble = !!(control->tx_rate->flags & 1698 short_preamble = !!(txrate->flags & IEEE80211_TXCTL_SHORT_PREAMBLE);
1698 IEEE80211_TXCTL_SHORT_PREAMBLE); 1699 plcp_signal = txrate->bitrate;
1699 plcp_signal = control->tx_rate->bitrate;
1700 1700
1701 hdr = (struct ieee80211_hdr *)skb->data; 1701 hdr = (struct ieee80211_hdr *)skb->data;
1702 fc = le16_to_cpu(hdr->frame_control) & ~IEEE80211_FCTL_PROTECTED; 1702 fc = le16_to_cpu(hdr->frame_control) & ~IEEE80211_FCTL_PROTECTED;
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 3f16ad66bdb5..32ee351a7650 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1323,7 +1323,8 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
1323 1323
1324 ret = ah->ah_setup_tx_desc(ah, ds, pktlen, 1324 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
1325 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL, 1325 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
1326 (sc->power_level * 2), ctl->tx_rate->hw_value, 1326 (sc->power_level * 2),
1327 ieee80211_get_tx_rate(sc->hw, ctl)->hw_value,
1327 ctl->retry_limit, keyidx, 0, flags, 0, 0); 1328 ctl->retry_limit, keyidx, 0, flags, 0, 0);
1328 if (ret) 1329 if (ret)
1329 goto err_unmap; 1330 goto err_unmap;
@@ -2046,7 +2047,8 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
2046 ret = ah->ah_setup_tx_desc(ah, ds, skb->len, 2047 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
2047 ieee80211_get_hdrlen_from_skb(skb), 2048 ieee80211_get_hdrlen_from_skb(skb),
2048 AR5K_PKT_TYPE_BEACON, (sc->power_level * 2), 2049 AR5K_PKT_TYPE_BEACON, (sc->power_level * 2),
2049 ctl->tx_rate->hw_value, 1, AR5K_TXKEYIX_INVALID, 2050 ieee80211_get_tx_rate(sc->hw, ctl)->hw_value,
2051 1, AR5K_TXKEYIX_INVALID,
2050 antenna, flags, 0, 0); 2052 antenna, flags, 0, 0);
2051 if (ret) 2053 if (ret)
2052 goto err_unmap; 2054 goto err_unmap;
@@ -2654,7 +2656,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
2654 memmove(skb->data, skb->data+pad, hdrlen); 2656 memmove(skb->data, skb->data+pad, hdrlen);
2655 } 2657 }
2656 2658
2657 sc->led_txrate = ctl->tx_rate->hw_value; 2659 sc->led_txrate = ieee80211_get_tx_rate(hw, ctl)->hw_value;
2658 2660
2659 spin_lock_irqsave(&sc->txbuflock, flags); 2661 spin_lock_irqsave(&sc->txbuflock, flags);
2660 if (list_empty(&sc->txbuf)) { 2662 if (list_empty(&sc->txbuf)) {
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 9445a604a966..e428645352b4 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1372,7 +1372,7 @@ static void b43_write_beacon_template(struct b43_wldev *dev,
1372 bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data); 1372 bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data);
1373 len = min((size_t) dev->wl->current_beacon->len, 1373 len = min((size_t) dev->wl->current_beacon->len,
1374 0x200 - sizeof(struct b43_plcp_hdr6)); 1374 0x200 - sizeof(struct b43_plcp_hdr6));
1375 rate = dev->wl->beacon_txctl.tx_rate->hw_value; 1375 rate = ieee80211_get_tx_rate(dev->wl->hw, &dev->wl->beacon_txctl)->hw_value;
1376 1376
1377 b43_write_template_common(dev, (const u8 *)bcn, 1377 b43_write_template_common(dev, (const u8 *)bcn,
1378 len, ram_offset, shm_size_offset, rate); 1378 len, ram_offset, shm_size_offset, rate);
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index afce9338d83a..9b682a3cf5e4 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -201,13 +201,14 @@ int b43_generate_txhdr(struct b43_wldev *dev,
201 u32 mac_ctl = 0; 201 u32 mac_ctl = 0;
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 205
205 memset(txhdr, 0, sizeof(*txhdr)); 206 memset(txhdr, 0, sizeof(*txhdr));
206 207
207 WARN_ON(!txctl->tx_rate); 208 txrate = ieee80211_get_tx_rate(dev->wl->hw, txctl);
208 rate = txctl->tx_rate ? txctl->tx_rate->hw_value : B43_CCK_RATE_1MB; 209 rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB;
209 rate_ofdm = b43_is_ofdm_rate(rate); 210 rate_ofdm = b43_is_ofdm_rate(rate);
210 fbrate = txctl->alt_retry_rate ? : txctl->tx_rate; 211 fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, txctl) ? : txrate;
211 rate_fb = fbrate->hw_value; 212 rate_fb = fbrate->hw_value;
212 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb); 213 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb);
213 214
@@ -336,9 +337,11 @@ int b43_generate_txhdr(struct b43_wldev *dev,
336 int rts_rate, rts_rate_fb; 337 int rts_rate, rts_rate_fb;
337 int rts_rate_ofdm, rts_rate_fb_ofdm; 338 int rts_rate_ofdm, rts_rate_fb_ofdm;
338 struct b43_plcp_hdr6 *plcp; 339 struct b43_plcp_hdr6 *plcp;
340 struct ieee80211_rate *rts_cts_rate;
339 341
340 WARN_ON(!txctl->rts_cts_rate); 342 rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, txctl);
341 rts_rate = txctl->rts_cts_rate ? txctl->rts_cts_rate->hw_value : B43_CCK_RATE_1MB; 343
344 rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB;
342 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); 345 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate);
343 rts_rate_fb = b43_calc_fallback_rate(rts_rate); 346 rts_rate_fb = b43_calc_fallback_rate(rts_rate);
344 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); 347 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index bed9e041d6c5..55dc251bf510 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -201,15 +201,18 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
201 unsigned int plcp_fragment_len; 201 unsigned int plcp_fragment_len;
202 u32 mac_ctl = 0; 202 u32 mac_ctl = 0;
203 u16 phy_ctl = 0; 203 u16 phy_ctl = 0;
204 struct ieee80211_rate *tx_rate;
204 205
205 wlhdr = (const struct ieee80211_hdr *)fragment_data; 206 wlhdr = (const struct ieee80211_hdr *)fragment_data;
206 fctl = le16_to_cpu(wlhdr->frame_control); 207 fctl = le16_to_cpu(wlhdr->frame_control);
207 208
208 memset(txhdr, 0, sizeof(*txhdr)); 209 memset(txhdr, 0, sizeof(*txhdr));
209 210
210 rate = txctl->tx_rate->hw_value; 211 tx_rate = ieee80211_get_tx_rate(dev->wl->hw, txctl);
212
213 rate = tx_rate->hw_value;
211 rate_ofdm = b43legacy_is_ofdm_rate(rate); 214 rate_ofdm = b43legacy_is_ofdm_rate(rate);
212 rate_fb = txctl->alt_retry_rate ? : txctl->tx_rate; 215 rate_fb = ieee80211_get_alt_retry_rate(dev->wl->hw, txctl) ? : tx_rate;
213 rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value); 216 rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value);
214 217
215 txhdr->mac_frame_ctl = wlhdr->frame_control; 218 txhdr->mac_frame_ctl = wlhdr->frame_control;
@@ -312,7 +315,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
312 int rts_rate_ofdm; 315 int rts_rate_ofdm;
313 int rts_rate_fb_ofdm; 316 int rts_rate_fb_ofdm;
314 317
315 rts_rate = txctl->rts_cts_rate->hw_value; 318 rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, txctl)->hw_value;
316 rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate); 319 rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate);
317 rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate); 320 rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate);
318 rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb); 321 rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index e51eeeff6992..f3ca02fe9619 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -464,7 +464,7 @@ static void rs_tx_status(void *priv_rate,
464 464
465 465
466 retries = tx_resp->retry_count; 466 retries = tx_resp->retry_count;
467 first_index = tx_resp->control.tx_rate->hw_value; 467 first_index = sband->bitrates[tx_resp->control.tx_rate_idx].hw_value;
468 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { 468 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) {
469 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); 469 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index);
470 return; 470 return;
@@ -669,7 +669,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
669 is_multicast_ether_addr(hdr->addr1) || 669 is_multicast_ether_addr(hdr->addr1) ||
670 !sta || !sta->rate_ctrl_priv) { 670 !sta || !sta->rate_ctrl_priv) {
671 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 671 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
672 sel->rate = rate_lowest(local, sband, sta); 672 sel->rate_idx = rate_lowest_index(local, sband, sta);
673 rcu_read_unlock(); 673 rcu_read_unlock();
674 return; 674 return;
675 } 675 }
@@ -813,7 +813,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
813 813
814 IWL_DEBUG_RATE("leave: %d\n", index); 814 IWL_DEBUG_RATE("leave: %d\n", index);
815 815
816 sel->rate = &sband->bitrates[sta->txrate_idx]; 816 sel->rate_idx = sta->txrate_idx;
817} 817}
818 818
819static struct rate_control_ops rs_ops = { 819static struct rate_control_ops rs_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index ad4e7b74ca24..f8e691f88ab3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -331,7 +331,9 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
331 tx_resp->rate, tx_resp->failure_frame); 331 tx_resp->rate, tx_resp->failure_frame);
332 332
333 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate); 333 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate);
334 tx_status->control.tx_rate = &priv->ieee_rates[rate_idx]; 334 if (tx_status->control.band == IEEE80211_BAND_5GHZ)
335 rate_idx -= IWL_FIRST_OFDM_RATE;
336 tx_status->control.tx_rate_idx = rate_idx;
335 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 337 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
336 iwl3945_tx_queue_reclaim(priv, txq_id, index); 338 iwl3945_tx_queue_reclaim(priv, txq_id, index);
337 339
@@ -962,7 +964,8 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
962 struct ieee80211_hdr *hdr, int sta_id, int tx_id) 964 struct ieee80211_hdr *hdr, int sta_id, int tx_id)
963{ 965{
964 unsigned long flags; 966 unsigned long flags;
965 u16 rate_index = min(ctrl->tx_rate->hw_value & 0xffff, IWL_RATE_COUNT - 1); 967 u16 hw_value = ieee80211_get_tx_rate(priv->hw, ctrl)->hw_value;
968 u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT - 1);
966 u16 rate_mask; 969 u16 rate_mask;
967 int rate; 970 int rate;
968 u8 rts_retry_limit; 971 u8 rts_retry_limit;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 2adc2281c77c..7993a1d83025 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -862,7 +862,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
862 if (priv->band == IEEE80211_BAND_5GHZ) 862 if (priv->band == IEEE80211_BAND_5GHZ)
863 rs_index -= IWL_FIRST_OFDM_RATE; 863 rs_index -= IWL_FIRST_OFDM_RATE;
864 864
865 if ((tx_resp->control.tx_rate == NULL) || 865 if ((tx_resp->control.tx_rate_idx < 0) ||
866 (tbl_type.is_SGI ^ 866 (tbl_type.is_SGI ^
867 !!(tx_resp->control.flags & IEEE80211_TXCTL_SHORT_GI)) || 867 !!(tx_resp->control.flags & IEEE80211_TXCTL_SHORT_GI)) ||
868 (tbl_type.is_fat ^ 868 (tbl_type.is_fat ^
@@ -875,7 +875,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
875 (!!(tx_rate & RATE_MCS_GF_MSK) ^ 875 (!!(tx_rate & RATE_MCS_GF_MSK) ^
876 !!(tx_resp->control.flags & IEEE80211_TXCTL_GREEN_FIELD)) || 876 !!(tx_resp->control.flags & IEEE80211_TXCTL_GREEN_FIELD)) ||
877 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != 877 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
878 tx_resp->control.tx_rate->bitrate)) { 878 hw->wiphy->bands[tx_resp->control.band]->bitrates[tx_resp->control.tx_rate_idx].bitrate)) {
879 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); 879 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate);
880 goto out; 880 goto out;
881 } 881 }
@@ -2154,7 +2154,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
2154 fc = le16_to_cpu(hdr->frame_control); 2154 fc = le16_to_cpu(hdr->frame_control);
2155 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || 2155 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
2156 !sta || !sta->rate_ctrl_priv) { 2156 !sta || !sta->rate_ctrl_priv) {
2157 sel->rate = rate_lowest(local, sband, sta); 2157 sel->rate_idx = rate_lowest_index(local, sband, sta);
2158 goto out; 2158 goto out;
2159 } 2159 }
2160 2160
@@ -2184,11 +2184,13 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
2184 2184
2185done: 2185done:
2186 if ((i < 0) || (i > IWL_RATE_COUNT)) { 2186 if ((i < 0) || (i > IWL_RATE_COUNT)) {
2187 sel->rate = rate_lowest(local, sband, sta); 2187 sel->rate_idx = rate_lowest_index(local, sband, sta);
2188 goto out; 2188 goto out;
2189 } 2189 }
2190 2190
2191 sel->rate = &priv->ieee_rates[i]; 2191 if (sband->band == IEEE80211_BAND_5GHZ)
2192 i -= IWL_FIRST_OFDM_RATE;
2193 sel->rate_idx = i;
2192out: 2194out:
2193 rcu_read_unlock(); 2195 rcu_read_unlock();
2194} 2196}
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index f848a5b0f622..fb670b5cfebb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -373,14 +373,10 @@ void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
373 control->flags |= IEEE80211_TXCTL_DUP_DATA; 373 control->flags |= IEEE80211_TXCTL_DUP_DATA;
374 if (rate_n_flags & RATE_MCS_SGI_MSK) 374 if (rate_n_flags & RATE_MCS_SGI_MSK)
375 control->flags |= IEEE80211_TXCTL_SHORT_GI; 375 control->flags |= IEEE80211_TXCTL_SHORT_GI;
376 /* since iwl4965_hwrate_to_plcp_idx is band indifferent, we always use
377 * IEEE80211_BAND_2GHZ band as it contains all the rates */
378 rate_index = iwl4965_hwrate_to_plcp_idx(rate_n_flags); 376 rate_index = iwl4965_hwrate_to_plcp_idx(rate_n_flags);
379 if (rate_index == -1) 377 if (control->band == IEEE80211_BAND_5GHZ)
380 control->tx_rate = NULL; 378 rate_index -= IWL_FIRST_OFDM_RATE;
381 else 379 control->tx_rate_idx = rate_index;
382 control->tx_rate =
383 &priv->bands[IEEE80211_BAND_2GHZ].bitrates[rate_index];
384} 380}
385 381
386int iwl4965_hw_rxq_stop(struct iwl_priv *priv) 382int iwl4965_hw_rxq_stop(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index f32cddabdf64..4b5149c8c32e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -578,7 +578,10 @@ static void iwl_tx_cmd_build_rate(struct iwl_priv *priv,
578 u8 data_retry_limit = 0; 578 u8 data_retry_limit = 0;
579 u8 rate_plcp; 579 u8 rate_plcp;
580 u16 rate_flags = 0; 580 u16 rate_flags = 0;
581 int rate_idx = min(ctrl->tx_rate->hw_value & 0xffff, IWL_RATE_COUNT - 1); 581 int rate_idx;
582
583 rate_idx = min(ieee80211_get_tx_rate(priv->hw, ctrl)->hw_value & 0xffff,
584 IWL_RATE_COUNT - 1);
582 585
583 rate_plcp = iwl_rates[rate_idx].plcp; 586 rate_plcp = iwl_rates[rate_idx].plcp;
584 587
@@ -723,7 +726,8 @@ int iwl_tx_skb(struct iwl_priv *priv,
723 goto drop_unlock; 726 goto drop_unlock;
724 } 727 }
725 728
726 if ((ctl->tx_rate->hw_value & 0xFF) == IWL_INVALID_RATE) { 729 if ((ieee80211_get_tx_rate(priv->hw, ctl)->hw_value & 0xFF) ==
730 IWL_INVALID_RATE) {
727 IWL_ERROR("ERROR: No TX rate available.\n"); 731 IWL_ERROR("ERROR: No TX rate available.\n");
728 goto drop_unlock; 732 goto drop_unlock;
729 } 733 }
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 54cde8a7b5fa..a28b4c9f6524 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2581,7 +2581,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2581 goto drop_unlock; 2581 goto drop_unlock;
2582 } 2582 }
2583 2583
2584 if ((ctl->tx_rate->hw_value & 0xFF) == IWL_INVALID_RATE) { 2584 if ((ieee80211_get_tx_rate(priv->hw, ctl)->hw_value & 0xFF) == IWL_INVALID_RATE) {
2585 IWL_ERROR("ERROR: No TX rate available.\n"); 2585 IWL_ERROR("ERROR: No TX rate available.\n");
2586 goto drop_unlock; 2586 goto drop_unlock;
2587 } 2587 }
@@ -6694,7 +6694,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6694 } 6694 }
6695 6695
6696 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6696 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
6697 ctl->tx_rate->bitrate); 6697 ieee80211_get_tx_rate(hw, ctl)->bitrate);
6698 6698
6699 if (iwl3945_tx_skb(priv, skb, ctl)) 6699 if (iwl3945_tx_skb(priv, skb, ctl))
6700 dev_kfree_skb_any(skb); 6700 dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index db4f606bad50..1fad6227aa51 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -4281,7 +4281,7 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
4281 } 4281 }
4282 4282
4283 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 4283 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
4284 ctl->tx_rate->bitrate); 4284 ieee80211_get_tx_rate(hw, ctl)->bitrate);
4285 4285
4286 if (iwl_tx_skb(priv, skb, ctl)) 4286 if (iwl_tx_skb(priv, skb, ctl))
4287 dev_kfree_skb_any(skb); 4287 dev_kfree_skb_any(skb);
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 3d35fe6a8f5f..3ca9386561ff 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -592,7 +592,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
592 txhdr->padding2 = 0; 592 txhdr->padding2 = 0;
593 593
594 /* TODO: add support for alternate retry TX rates */ 594 /* TODO: add support for alternate retry TX rates */
595 rate = control->tx_rate->hw_value; 595 rate = ieee80211_get_tx_rate(dev, control)->hw_value;
596 if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) 596 if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE)
597 rate |= 0x10; 597 rate |= 0x10;
598 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 598 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS)
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 19c10629c767..5cf4c2f59260 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -33,8 +33,10 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
33 struct txentry_desc *txdesc, 33 struct txentry_desc *txdesc,
34 struct ieee80211_tx_control *control) 34 struct ieee80211_tx_control *control)
35{ 35{
36 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
36 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; 37 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
37 struct ieee80211_rate *rate = control->tx_rate; 38 struct ieee80211_rate *rate =
39 ieee80211_get_tx_rate(rt2x00dev->hw, control);
38 const struct rt2x00_rate *hwrate; 40 const struct rt2x00_rate *hwrate;
39 unsigned int data_length; 41 unsigned int data_length;
40 unsigned int duration; 42 unsigned int duration;
@@ -77,8 +79,9 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
77 __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags); 79 __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags);
78 __clear_bit(ENTRY_TXD_ACK, &txdesc->flags); 80 __clear_bit(ENTRY_TXD_ACK, &txdesc->flags);
79 } 81 }
80 if (control->rts_cts_rate) 82 if (control->rts_cts_rate_idx >= 0)
81 rate = control->rts_cts_rate; 83 rate =
84 ieee80211_get_rts_cts_rate(rt2x00dev->hw, control);
82 } 85 }
83 86
84 /* 87 /*
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c
index c220998cee65..6263209b889e 100644
--- a/drivers/net/wireless/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl8180_dev.c
@@ -257,24 +257,21 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
257 mapping = pci_map_single(priv->pdev, skb->data, 257 mapping = pci_map_single(priv->pdev, skb->data,
258 skb->len, PCI_DMA_TODEVICE); 258 skb->len, PCI_DMA_TODEVICE);
259 259
260 BUG_ON(!control->tx_rate);
261
262 tx_flags = RTL8180_TX_DESC_FLAG_OWN | RTL8180_TX_DESC_FLAG_FS | 260 tx_flags = RTL8180_TX_DESC_FLAG_OWN | RTL8180_TX_DESC_FLAG_FS |
263 RTL8180_TX_DESC_FLAG_LS | 261 RTL8180_TX_DESC_FLAG_LS |
264 (control->tx_rate->hw_value << 24) | skb->len; 262 (ieee80211_get_tx_rate(dev, control)->hw_value << 24) |
263 skb->len;
265 264
266 if (priv->r8185) 265 if (priv->r8185)
267 tx_flags |= RTL8180_TX_DESC_FLAG_DMA | 266 tx_flags |= RTL8180_TX_DESC_FLAG_DMA |
268 RTL8180_TX_DESC_FLAG_NO_ENC; 267 RTL8180_TX_DESC_FLAG_NO_ENC;
269 268
270 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 269 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
271 BUG_ON(!control->rts_cts_rate);
272 tx_flags |= RTL8180_TX_DESC_FLAG_RTS; 270 tx_flags |= RTL8180_TX_DESC_FLAG_RTS;
273 tx_flags |= control->rts_cts_rate->hw_value << 19; 271 tx_flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19;
274 } else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 272 } else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) {
275 BUG_ON(!control->rts_cts_rate);
276 tx_flags |= RTL8180_TX_DESC_FLAG_CTS; 273 tx_flags |= RTL8180_TX_DESC_FLAG_CTS;
277 tx_flags |= control->rts_cts_rate->hw_value << 19; 274 tx_flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19;
278 } 275 }
279 276
280 *((struct ieee80211_tx_control **) skb->cb) = 277 *((struct ieee80211_tx_control **) skb->cb) =
@@ -288,9 +285,9 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
288 unsigned int remainder; 285 unsigned int remainder;
289 286
290 plcp_len = DIV_ROUND_UP(16 * (skb->len + 4), 287 plcp_len = DIV_ROUND_UP(16 * (skb->len + 4),
291 (control->tx_rate->bitrate * 2) / 10); 288 (ieee80211_get_tx_rate(dev, control)->bitrate * 2) / 10);
292 remainder = (16 * (skb->len + 4)) % 289 remainder = (16 * (skb->len + 4)) %
293 ((control->tx_rate->bitrate * 2) / 10); 290 ((ieee80211_get_tx_rate(dev, control)->bitrate * 2) / 10);
294 if (remainder > 0 && remainder <= 6) 291 if (remainder > 0 && remainder <= 6)
295 plcp_len |= 1 << 15; 292 plcp_len |= 1 << 15;
296 } 293 }
@@ -303,8 +300,8 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
303 entry->plcp_len = cpu_to_le16(plcp_len); 300 entry->plcp_len = cpu_to_le16(plcp_len);
304 entry->tx_buf = cpu_to_le32(mapping); 301 entry->tx_buf = cpu_to_le32(mapping);
305 entry->frame_len = cpu_to_le32(skb->len); 302 entry->frame_len = cpu_to_le32(skb->len);
306 entry->flags2 = control->alt_retry_rate != NULL ? 303 entry->flags2 = control->alt_retry_rate_idx >= 0 ?
307 control->alt_retry_rate->bitrate << 4 : 0; 304 ieee80211_get_alt_retry_rate(dev, control)->bitrate << 4 : 0;
308 entry->retry_limit = control->retry_limit; 305 entry->retry_limit = control->retry_limit;
309 entry->flags = cpu_to_le32(tx_flags); 306 entry->flags = cpu_to_le32(tx_flags);
310 __skb_queue_tail(&ring->queue, skb); 307 __skb_queue_tail(&ring->queue, skb);
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index e14c84248686..86a09b49681c 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -179,21 +179,17 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
179 flags = skb->len; 179 flags = skb->len;
180 flags |= RTL8187_TX_FLAG_NO_ENCRYPT; 180 flags |= RTL8187_TX_FLAG_NO_ENCRYPT;
181 181
182 BUG_ON(!control->tx_rate); 182 flags |= ieee80211_get_tx_rate(dev, control)->hw_value << 24;
183
184 flags |= control->tx_rate->hw_value << 24;
185 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data)) 183 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data))
186 flags |= RTL8187_TX_FLAG_MORE_FRAG; 184 flags |= RTL8187_TX_FLAG_MORE_FRAG;
187 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 185 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
188 BUG_ON(!control->rts_cts_rate);
189 flags |= RTL8187_TX_FLAG_RTS; 186 flags |= RTL8187_TX_FLAG_RTS;
190 flags |= control->rts_cts_rate->hw_value << 19; 187 flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19;
191 rts_dur = ieee80211_rts_duration(dev, priv->vif, 188 rts_dur = ieee80211_rts_duration(dev, priv->vif,
192 skb->len, control); 189 skb->len, control);
193 } else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 190 } else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) {
194 BUG_ON(!control->rts_cts_rate);
195 flags |= RTL8187_TX_FLAG_CTS; 191 flags |= RTL8187_TX_FLAG_CTS;
196 flags |= control->rts_cts_rate->hw_value << 19; 192 flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19;
197 } 193 }
198 194
199 hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); 195 hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 0c736735e217..99c508c09e5b 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -523,14 +523,17 @@ static int fill_ctrlset(struct zd_mac *mac,
523 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 523 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
524 unsigned int frag_len = skb->len + FCS_LEN; 524 unsigned int frag_len = skb->len + FCS_LEN;
525 unsigned int packet_length; 525 unsigned int packet_length;
526 struct ieee80211_rate *txrate;
526 struct zd_ctrlset *cs = (struct zd_ctrlset *) 527 struct zd_ctrlset *cs = (struct zd_ctrlset *)
527 skb_push(skb, sizeof(struct zd_ctrlset)); 528 skb_push(skb, sizeof(struct zd_ctrlset));
528 529
529 ZD_ASSERT(frag_len <= 0xffff); 530 ZD_ASSERT(frag_len <= 0xffff);
530 531
531 cs->modulation = control->tx_rate->hw_value; 532 txrate = ieee80211_get_tx_rate(mac->hw, control);
533
534 cs->modulation = txrate->hw_value;
532 if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) 535 if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE)
533 cs->modulation = control->tx_rate->hw_value_short; 536 cs->modulation = txrate->hw_value_short;
534 537
535 cs->tx_length = cpu_to_le16(frag_len); 538 cs->tx_length = cpu_to_le16(frag_len);
536 539