aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-15 06:55:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:11 -0400
commite039fa4a4195ac4ee895e6f3d1334beed63256fe (patch)
treecfd0762d73df96b73052378be7b157c4ac6e7035
parente24549485f859be6518929bb1c9c0257d79f033d (diff)
mac80211: move TX info into skb->cb
This patch converts mac80211 and all drivers to have transmit information and status in skb->cb rather than allocating extra memory for it and copying all the data around. To make it fit, a union is used where only data that is necessary for all steps is kept outside of the union. A number of fixes were done by Ivo, as well as the rt2x00 part of this patch. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/adm8211.c31
-rw-r--r--drivers/net/wireless/adm8211.h1
-rw-r--r--drivers/net/wireless/ath5k/base.c70
-rw-r--r--drivers/net/wireless/ath5k/base.h1
-rw-r--r--drivers/net/wireless/b43/b43.h1
-rw-r--r--drivers/net/wireless/b43/dma.c45
-rw-r--r--drivers/net/wireless/b43/dma.h3
-rw-r--r--drivers/net/wireless/b43/main.c33
-rw-r--r--drivers/net/wireless/b43/pio.c36
-rw-r--r--drivers/net/wireless/b43/pio.h8
-rw-r--r--drivers/net/wireless/b43/xmit.c58
-rw-r--r--drivers/net/wireless/b43/xmit.h4
-rw-r--r--drivers/net/wireless/b43legacy/dma.c36
-rw-r--r--drivers/net/wireless/b43legacy/dma.h4
-rw-r--r--drivers/net/wireless/b43legacy/main.c12
-rw-r--r--drivers/net/wireless/b43legacy/pio.c19
-rw-r--r--drivers/net/wireless/b43legacy/pio.h4
-rw-r--r--drivers/net/wireless/b43legacy/xmit.c44
-rw-r--r--drivers/net/wireless/b43legacy/xmit.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c49
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c28
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c40
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c48
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c52
-rw-r--r--drivers/net/wireless/p54/p54common.c90
-rw-r--r--drivers/net/wireless/p54/p54common.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h10
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c49
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c74
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.h6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c31
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h15
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c12
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h9
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c8
-rw-r--r--drivers/net/wireless/rtl8180_dev.c57
-rw-r--r--drivers/net/wireless/rtl8187.h6
-rw-r--r--drivers/net/wireless/rtl8187_dev.c41
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c156
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.h16
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c6
-rw-r--r--include/net/mac80211.h299
-rw-r--r--net/mac80211/ieee80211_i.h18
-rw-r--r--net/mac80211/main.c128
-rw-r--r--net/mac80211/mlme.c30
-rw-r--r--net/mac80211/rate.h8
-rw-r--r--net/mac80211/rc80211_pid.h4
-rw-r--r--net/mac80211/rc80211_pid_algo.c18
-rw-r--r--net/mac80211/rc80211_pid_debugfs.c8
-rw-r--r--net/mac80211/rx.c10
-rw-r--r--net/mac80211/sta_info.c6
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/mac80211/tx.c310
-rw-r--r--net/mac80211/util.c10
-rw-r--r--net/mac80211/wep.c9
-rw-r--r--net/mac80211/wme.c22
-rw-r--r--net/mac80211/wpa.c65
67 files changed, 980 insertions, 1274 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index 22db664a58d9..0ba55ba93958 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -324,7 +324,7 @@ static void adm8211_interrupt_tci(struct ieee80211_hw *dev)
324 for (dirty_tx = priv->dirty_tx; priv->cur_tx - dirty_tx; dirty_tx++) { 324 for (dirty_tx = priv->dirty_tx; priv->cur_tx - dirty_tx; dirty_tx++) {
325 unsigned int entry = dirty_tx % priv->tx_ring_size; 325 unsigned int entry = dirty_tx % priv->tx_ring_size;
326 u32 status = le32_to_cpu(priv->tx_ring[entry].status); 326 u32 status = le32_to_cpu(priv->tx_ring[entry].status);
327 struct ieee80211_tx_status tx_status; 327 struct ieee80211_tx_info *txi;
328 struct adm8211_tx_ring_info *info; 328 struct adm8211_tx_ring_info *info;
329 struct sk_buff *skb; 329 struct sk_buff *skb;
330 330
@@ -334,24 +334,23 @@ static void adm8211_interrupt_tci(struct ieee80211_hw *dev)
334 334
335 info = &priv->tx_buffers[entry]; 335 info = &priv->tx_buffers[entry];
336 skb = info->skb; 336 skb = info->skb;
337 txi = IEEE80211_SKB_CB(skb);
337 338
338 /* TODO: check TDES0_STATUS_TUF and TDES0_STATUS_TRO */ 339 /* TODO: check TDES0_STATUS_TUF and TDES0_STATUS_TRO */
339 340
340 pci_unmap_single(priv->pdev, info->mapping, 341 pci_unmap_single(priv->pdev, info->mapping,
341 info->skb->len, PCI_DMA_TODEVICE); 342 info->skb->len, PCI_DMA_TODEVICE);
342 343
343 memset(&tx_status, 0, sizeof(tx_status)); 344 memset(&txi->status, 0, sizeof(txi->status));
344 skb_pull(skb, sizeof(struct adm8211_tx_hdr)); 345 skb_pull(skb, sizeof(struct adm8211_tx_hdr));
345 memcpy(skb_push(skb, info->hdrlen), skb->cb, info->hdrlen); 346 memcpy(skb_push(skb, info->hdrlen), skb->cb, info->hdrlen);
346 memcpy(&tx_status.control, &info->tx_control, 347 if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK)) {
347 sizeof(tx_status.control));
348 if (!(tx_status.control.flags & IEEE80211_TXCTL_NO_ACK)) {
349 if (status & TDES0_STATUS_ES) 348 if (status & TDES0_STATUS_ES)
350 tx_status.excessive_retries = 1; 349 txi->status.excessive_retries = 1;
351 else 350 else
352 tx_status.flags |= IEEE80211_TX_STATUS_ACK; 351 txi->flags |= IEEE80211_TX_STAT_ACK;
353 } 352 }
354 ieee80211_tx_status_irqsafe(dev, skb, &tx_status); 353 ieee80211_tx_status_irqsafe(dev, skb);
355 354
356 info->skb = NULL; 355 info->skb = NULL;
357 } 356 }
@@ -1638,7 +1637,6 @@ static void adm8211_calc_durations(int *dur, int *plcp, size_t payload_len, int
1638/* Transmit skb w/adm8211_tx_hdr (802.11 header created by hardware) */ 1637/* Transmit skb w/adm8211_tx_hdr (802.11 header created by hardware) */
1639static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb, 1638static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
1640 u16 plcp_signal, 1639 u16 plcp_signal,
1641 struct ieee80211_tx_control *control,
1642 size_t hdrlen) 1640 size_t hdrlen)
1643{ 1641{
1644 struct adm8211_priv *priv = dev->priv; 1642 struct adm8211_priv *priv = dev->priv;
@@ -1664,7 +1662,6 @@ static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
1664 1662
1665 priv->tx_buffers[entry].skb = skb; 1663 priv->tx_buffers[entry].skb = skb;
1666 priv->tx_buffers[entry].mapping = mapping; 1664 priv->tx_buffers[entry].mapping = mapping;
1667 memcpy(&priv->tx_buffers[entry].tx_control, control, sizeof(*control));
1668 priv->tx_buffers[entry].hdrlen = hdrlen; 1665 priv->tx_buffers[entry].hdrlen = hdrlen;
1669 priv->tx_ring[entry].buffer1 = cpu_to_le32(mapping); 1666 priv->tx_ring[entry].buffer1 = cpu_to_le32(mapping);
1670 1667
@@ -1685,17 +1682,17 @@ static void adm8211_tx_raw(struct ieee80211_hw *dev, struct sk_buff *skb,
1685} 1682}
1686 1683
1687/* Put adm8211_tx_hdr on skb and transmit */ 1684/* Put adm8211_tx_hdr on skb and transmit */
1688static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb, 1685static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
1689 struct ieee80211_tx_control *control)
1690{ 1686{
1691 struct adm8211_tx_hdr *txhdr; 1687 struct adm8211_tx_hdr *txhdr;
1692 u16 fc; 1688 u16 fc;
1693 size_t payload_len, hdrlen; 1689 size_t payload_len, hdrlen;
1694 int plcp, dur, len, plcp_signal, short_preamble; 1690 int plcp, dur, len, plcp_signal, short_preamble;
1695 struct ieee80211_hdr *hdr; 1691 struct ieee80211_hdr *hdr;
1696 struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, control); 1692 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1693 struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info);
1697 1694
1698 short_preamble = !!(txrate->flags & IEEE80211_TXCTL_SHORT_PREAMBLE); 1695 short_preamble = !!(txrate->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE);
1699 plcp_signal = txrate->bitrate; 1696 plcp_signal = txrate->bitrate;
1700 1697
1701 hdr = (struct ieee80211_hdr *)skb->data; 1698 hdr = (struct ieee80211_hdr *)skb->data;
@@ -1730,15 +1727,15 @@ static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
1730 if (short_preamble) 1727 if (short_preamble)
1731 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE); 1728 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_SHORT_PREAMBLE);
1732 1729
1733 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 1730 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
1734 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS); 1731 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_RTS);
1735 1732
1736 if (fc & IEEE80211_FCTL_PROTECTED) 1733 if (fc & IEEE80211_FCTL_PROTECTED)
1737 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE); 1734 txhdr->header_control |= cpu_to_le16(ADM8211_TXHDRCTL_ENABLE_WEP_ENGINE);
1738 1735
1739 txhdr->retry_limit = control->retry_limit; 1736 txhdr->retry_limit = info->control.retry_limit;
1740 1737
1741 adm8211_tx_raw(dev, skb, plcp_signal, control, hdrlen); 1738 adm8211_tx_raw(dev, skb, plcp_signal, hdrlen);
1742 1739
1743 return NETDEV_TX_OK; 1740 return NETDEV_TX_OK;
1744} 1741}
diff --git a/drivers/net/wireless/adm8211.h b/drivers/net/wireless/adm8211.h
index 8d7c564b3b04..9b190ee26e90 100644
--- a/drivers/net/wireless/adm8211.h
+++ b/drivers/net/wireless/adm8211.h
@@ -443,7 +443,6 @@ struct adm8211_rx_ring_info {
443struct adm8211_tx_ring_info { 443struct adm8211_tx_ring_info {
444 struct sk_buff *skb; 444 struct sk_buff *skb;
445 dma_addr_t mapping; 445 dma_addr_t mapping;
446 struct ieee80211_tx_control tx_control;
447 size_t hdrlen; 446 size_t hdrlen;
448}; 447};
449 448
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 32ee351a7650..7d97934265db 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -167,8 +167,7 @@ static struct pci_driver ath5k_pci_driver = {
167/* 167/*
168 * Prototypes - MAC 802.11 stack related functions 168 * Prototypes - MAC 802.11 stack related functions
169 */ 169 */
170static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 170static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
171 struct ieee80211_tx_control *ctl);
172static int ath5k_reset(struct ieee80211_hw *hw); 171static int ath5k_reset(struct ieee80211_hw *hw);
173static int ath5k_start(struct ieee80211_hw *hw); 172static int ath5k_start(struct ieee80211_hw *hw);
174static void ath5k_stop(struct ieee80211_hw *hw); 173static void ath5k_stop(struct ieee80211_hw *hw);
@@ -196,8 +195,7 @@ static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
196static u64 ath5k_get_tsf(struct ieee80211_hw *hw); 195static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
197static void ath5k_reset_tsf(struct ieee80211_hw *hw); 196static void ath5k_reset_tsf(struct ieee80211_hw *hw);
198static int ath5k_beacon_update(struct ieee80211_hw *hw, 197static int ath5k_beacon_update(struct ieee80211_hw *hw,
199 struct sk_buff *skb, 198 struct sk_buff *skb);
200 struct ieee80211_tx_control *ctl);
201 199
202static struct ieee80211_ops ath5k_hw_ops = { 200static struct ieee80211_ops ath5k_hw_ops = {
203 .tx = ath5k_tx, 201 .tx = ath5k_tx,
@@ -251,9 +249,7 @@ static void ath5k_desc_free(struct ath5k_softc *sc,
251static int ath5k_rxbuf_setup(struct ath5k_softc *sc, 249static int ath5k_rxbuf_setup(struct ath5k_softc *sc,
252 struct ath5k_buf *bf); 250 struct ath5k_buf *bf);
253static int ath5k_txbuf_setup(struct ath5k_softc *sc, 251static int ath5k_txbuf_setup(struct ath5k_softc *sc,
254 struct ath5k_buf *bf, 252 struct ath5k_buf *bf);
255 struct ieee80211_tx_control *ctl);
256
257static inline void ath5k_txbuf_free(struct ath5k_softc *sc, 253static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
258 struct ath5k_buf *bf) 254 struct ath5k_buf *bf)
259{ 255{
@@ -289,8 +285,7 @@ static void ath5k_tx_processq(struct ath5k_softc *sc,
289static void ath5k_tasklet_tx(unsigned long data); 285static void ath5k_tasklet_tx(unsigned long data);
290/* Beacon handling */ 286/* Beacon handling */
291static int ath5k_beacon_setup(struct ath5k_softc *sc, 287static int ath5k_beacon_setup(struct ath5k_softc *sc,
292 struct ath5k_buf *bf, 288 struct ath5k_buf *bf);
293 struct ieee80211_tx_control *ctl);
294static void ath5k_beacon_send(struct ath5k_softc *sc); 289static void ath5k_beacon_send(struct ath5k_softc *sc);
295static void ath5k_beacon_config(struct ath5k_softc *sc); 290static void ath5k_beacon_config(struct ath5k_softc *sc);
296static void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf); 291static void ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf);
@@ -1295,37 +1290,36 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1295} 1290}
1296 1291
1297static int 1292static int
1298ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, 1293ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1299 struct ieee80211_tx_control *ctl)
1300{ 1294{
1301 struct ath5k_hw *ah = sc->ah; 1295 struct ath5k_hw *ah = sc->ah;
1302 struct ath5k_txq *txq = sc->txq; 1296 struct ath5k_txq *txq = sc->txq;
1303 struct ath5k_desc *ds = bf->desc; 1297 struct ath5k_desc *ds = bf->desc;
1304 struct sk_buff *skb = bf->skb; 1298 struct sk_buff *skb = bf->skb;
1299 struct ieee80211_tx_info *info = (void*) skb->cb;
1305 unsigned int pktlen, flags, keyidx = AR5K_TXKEYIX_INVALID; 1300 unsigned int pktlen, flags, keyidx = AR5K_TXKEYIX_INVALID;
1306 int ret; 1301 int ret;
1307 1302
1308 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK; 1303 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK;
1309 bf->ctl = *ctl; 1304
1310 /* XXX endianness */ 1305 /* XXX endianness */
1311 bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, 1306 bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len,
1312 PCI_DMA_TODEVICE); 1307 PCI_DMA_TODEVICE);
1313 1308
1314 if (ctl->flags & IEEE80211_TXCTL_NO_ACK) 1309 if (info->flags & IEEE80211_TX_CTL_NO_ACK)
1315 flags |= AR5K_TXDESC_NOACK; 1310 flags |= AR5K_TXDESC_NOACK;
1316 1311
1317 pktlen = skb->len; 1312 pktlen = skb->len;
1318 1313
1319 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) { 1314 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) {
1320 keyidx = ctl->hw_key->hw_key_idx; 1315 keyidx = info->control.hw_key->hw_key_idx;
1321 pktlen += ctl->icv_len; 1316 pktlen += info->control.icv_len;
1322 } 1317 }
1323
1324 ret = ah->ah_setup_tx_desc(ah, ds, pktlen, 1318 ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
1325 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL, 1319 ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
1326 (sc->power_level * 2), 1320 (sc->power_level * 2),
1327 ieee80211_get_tx_rate(sc->hw, ctl)->hw_value, 1321 ieee80211_get_tx_rate(sc->hw, info)->hw_value,
1328 ctl->retry_limit, keyidx, 0, flags, 0, 0); 1322 info->control.retry_limit, keyidx, 0, flags, 0, 0);
1329 if (ret) 1323 if (ret)
1330 goto err_unmap; 1324 goto err_unmap;
1331 1325
@@ -1927,11 +1921,11 @@ next:
1927static void 1921static void
1928ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq) 1922ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1929{ 1923{
1930 struct ieee80211_tx_status txs = {};
1931 struct ath5k_tx_status ts = {}; 1924 struct ath5k_tx_status ts = {};
1932 struct ath5k_buf *bf, *bf0; 1925 struct ath5k_buf *bf, *bf0;
1933 struct ath5k_desc *ds; 1926 struct ath5k_desc *ds;
1934 struct sk_buff *skb; 1927 struct sk_buff *skb;
1928 struct ieee80211_tx_info *info;
1935 int ret; 1929 int ret;
1936 1930
1937 spin_lock(&txq->lock); 1931 spin_lock(&txq->lock);
@@ -1951,24 +1945,25 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1951 } 1945 }
1952 1946
1953 skb = bf->skb; 1947 skb = bf->skb;
1948 info = (void*) skb->cb;
1954 bf->skb = NULL; 1949 bf->skb = NULL;
1950
1955 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len, 1951 pci_unmap_single(sc->pdev, bf->skbaddr, skb->len,
1956 PCI_DMA_TODEVICE); 1952 PCI_DMA_TODEVICE);
1957 1953
1958 txs.control = bf->ctl; 1954 info->status.retry_count = ts.ts_shortretry + ts.ts_longretry / 6;
1959 txs.retry_count = ts.ts_shortretry + ts.ts_longretry / 6;
1960 if (unlikely(ts.ts_status)) { 1955 if (unlikely(ts.ts_status)) {
1961 sc->ll_stats.dot11ACKFailureCount++; 1956 sc->ll_stats.dot11ACKFailureCount++;
1962 if (ts.ts_status & AR5K_TXERR_XRETRY) 1957 if (ts.ts_status & AR5K_TXERR_XRETRY)
1963 txs.excessive_retries = 1; 1958 info->status.excessive_retries = 1;
1964 else if (ts.ts_status & AR5K_TXERR_FILT) 1959 else if (ts.ts_status & AR5K_TXERR_FILT)
1965 txs.flags |= IEEE80211_TX_STATUS_TX_FILTERED; 1960 info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
1966 } else { 1961 } else {
1967 txs.flags |= IEEE80211_TX_STATUS_ACK; 1962 info->flags |= IEEE80211_TX_STAT_ACK;
1968 txs.ack_signal = ts.ts_rssi; 1963 info->status.ack_signal = ts.ts_rssi;
1969 } 1964 }
1970 1965
1971 ieee80211_tx_status(sc->hw, skb, &txs); 1966 ieee80211_tx_status(sc->hw, skb);
1972 sc->tx_stats[txq->qnum].count++; 1967 sc->tx_stats[txq->qnum].count++;
1973 1968
1974 spin_lock(&sc->txbuflock); 1969 spin_lock(&sc->txbuflock);
@@ -2005,10 +2000,10 @@ ath5k_tasklet_tx(unsigned long data)
2005 * Setup the beacon frame for transmit. 2000 * Setup the beacon frame for transmit.
2006 */ 2001 */
2007static int 2002static int
2008ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, 2003ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
2009 struct ieee80211_tx_control *ctl)
2010{ 2004{
2011 struct sk_buff *skb = bf->skb; 2005 struct sk_buff *skb = bf->skb;
2006 struct ieee80211_tx_info *info = (void*) skb->cb;
2012 struct ath5k_hw *ah = sc->ah; 2007 struct ath5k_hw *ah = sc->ah;
2013 struct ath5k_desc *ds; 2008 struct ath5k_desc *ds;
2014 int ret, antenna = 0; 2009 int ret, antenna = 0;
@@ -2047,7 +2042,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
2047 ret = ah->ah_setup_tx_desc(ah, ds, skb->len, 2042 ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
2048 ieee80211_get_hdrlen_from_skb(skb), 2043 ieee80211_get_hdrlen_from_skb(skb),
2049 AR5K_PKT_TYPE_BEACON, (sc->power_level * 2), 2044 AR5K_PKT_TYPE_BEACON, (sc->power_level * 2),
2050 ieee80211_get_tx_rate(sc->hw, ctl)->hw_value, 2045 ieee80211_get_tx_rate(sc->hw, info)->hw_value,
2051 1, AR5K_TXKEYIX_INVALID, 2046 1, AR5K_TXKEYIX_INVALID,
2052 antenna, flags, 0, 0); 2047 antenna, flags, 0, 0);
2053 if (ret) 2048 if (ret)
@@ -2626,11 +2621,11 @@ ath5k_led_event(struct ath5k_softc *sc, int event)
2626\********************/ 2621\********************/
2627 2622
2628static int 2623static int
2629ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 2624ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2630 struct ieee80211_tx_control *ctl)
2631{ 2625{
2632 struct ath5k_softc *sc = hw->priv; 2626 struct ath5k_softc *sc = hw->priv;
2633 struct ath5k_buf *bf; 2627 struct ath5k_buf *bf;
2628 struct ieee80211_tx_info *info = (void*) skb->cb;
2634 unsigned long flags; 2629 unsigned long flags;
2635 int hdrlen; 2630 int hdrlen;
2636 int pad; 2631 int pad;
@@ -2656,13 +2651,13 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
2656 memmove(skb->data, skb->data+pad, hdrlen); 2651 memmove(skb->data, skb->data+pad, hdrlen);
2657 } 2652 }
2658 2653
2659 sc->led_txrate = ieee80211_get_tx_rate(hw, ctl)->hw_value; 2654 sc->led_txrate = ieee80211_get_tx_rate(hw, info)->hw_value;
2660 2655
2661 spin_lock_irqsave(&sc->txbuflock, flags); 2656 spin_lock_irqsave(&sc->txbuflock, flags);
2662 if (list_empty(&sc->txbuf)) { 2657 if (list_empty(&sc->txbuf)) {
2663 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n"); 2658 ATH5K_ERR(sc, "no further txbuf available, dropping packet\n");
2664 spin_unlock_irqrestore(&sc->txbuflock, flags); 2659 spin_unlock_irqrestore(&sc->txbuflock, flags);
2665 ieee80211_stop_queue(hw, ctl->queue); 2660 ieee80211_stop_queue(hw, info->queue);
2666 return -1; 2661 return -1;
2667 } 2662 }
2668 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list); 2663 bf = list_first_entry(&sc->txbuf, struct ath5k_buf, list);
@@ -2674,7 +2669,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
2674 2669
2675 bf->skb = skb; 2670 bf->skb = skb;
2676 2671
2677 if (ath5k_txbuf_setup(sc, bf, ctl)) { 2672 if (ath5k_txbuf_setup(sc, bf)) {
2678 bf->skb = NULL; 2673 bf->skb = NULL;
2679 spin_lock_irqsave(&sc->txbuflock, flags); 2674 spin_lock_irqsave(&sc->txbuflock, flags);
2680 list_add_tail(&bf->list, &sc->txbuf); 2675 list_add_tail(&bf->list, &sc->txbuf);
@@ -3052,8 +3047,7 @@ ath5k_reset_tsf(struct ieee80211_hw *hw)
3052} 3047}
3053 3048
3054static int 3049static int
3055ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 3050ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
3056 struct ieee80211_tx_control *ctl)
3057{ 3051{
3058 struct ath5k_softc *sc = hw->priv; 3052 struct ath5k_softc *sc = hw->priv;
3059 int ret; 3053 int ret;
@@ -3069,7 +3063,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
3069 3063
3070 ath5k_txbuf_free(sc, sc->bbuf); 3064 ath5k_txbuf_free(sc, sc->bbuf);
3071 sc->bbuf->skb = skb; 3065 sc->bbuf->skb = skb;
3072 ret = ath5k_beacon_setup(sc, sc->bbuf, ctl); 3066 ret = ath5k_beacon_setup(sc, sc->bbuf);
3073 if (ret) 3067 if (ret)
3074 sc->bbuf->skb = NULL; 3068 sc->bbuf->skb = NULL;
3075 else 3069 else
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index ecb17495488c..bb4b26d523ab 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -60,7 +60,6 @@ struct ath5k_buf {
60 dma_addr_t daddr; /* physical addr of desc */ 60 dma_addr_t daddr; /* physical addr of desc */
61 struct sk_buff *skb; /* skbuff for buf */ 61 struct sk_buff *skb; /* skbuff for buf */
62 dma_addr_t skbaddr;/* physical addr of skb data */ 62 dma_addr_t skbaddr;/* physical addr of skb data */
63 struct ieee80211_tx_control ctl;
64}; 63};
65 64
66/* 65/*
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 0c2bc061e8f3..aa493830a82d 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -733,7 +733,6 @@ struct b43_wl {
733 /* The beacon we are currently using (AP or IBSS mode). 733 /* The beacon we are currently using (AP or IBSS mode).
734 * This beacon stuff is protected by the irq_lock. */ 734 * This beacon stuff is protected by the irq_lock. */
735 struct sk_buff *current_beacon; 735 struct sk_buff *current_beacon;
736 struct ieee80211_tx_control beacon_txctl;
737 bool beacon0_uploaded; 736 bool beacon0_uploaded;
738 bool beacon1_uploaded; 737 bool beacon1_uploaded;
739 struct work_struct beacon_update_trigger; 738 struct work_struct beacon_update_trigger;
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index f50e2014ffbe..aced9866d815 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1131,10 +1131,10 @@ struct b43_dmaring *parse_cookie(struct b43_wldev *dev, u16 cookie, int *slot)
1131} 1131}
1132 1132
1133static int dma_tx_fragment(struct b43_dmaring *ring, 1133static int dma_tx_fragment(struct b43_dmaring *ring,
1134 struct sk_buff *skb, 1134 struct sk_buff *skb)
1135 struct ieee80211_tx_control *ctl)
1136{ 1135{
1137 const struct b43_dma_ops *ops = ring->ops; 1136 const struct b43_dma_ops *ops = ring->ops;
1137 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1138 u8 *header; 1138 u8 *header;
1139 int slot, old_top_slot, old_used_slots; 1139 int slot, old_top_slot, old_used_slots;
1140 int err; 1140 int err;
@@ -1158,7 +1158,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1158 header = &(ring->txhdr_cache[slot * hdrsize]); 1158 header = &(ring->txhdr_cache[slot * hdrsize]);
1159 cookie = generate_cookie(ring, slot); 1159 cookie = generate_cookie(ring, slot);
1160 err = b43_generate_txhdr(ring->dev, header, 1160 err = b43_generate_txhdr(ring->dev, header,
1161 skb->data, skb->len, ctl, cookie); 1161 skb->data, skb->len, info, cookie);
1162 if (unlikely(err)) { 1162 if (unlikely(err)) {
1163 ring->current_slot = old_top_slot; 1163 ring->current_slot = old_top_slot;
1164 ring->used_slots = old_used_slots; 1164 ring->used_slots = old_used_slots;
@@ -1180,7 +1180,6 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1180 desc = ops->idx2desc(ring, slot, &meta); 1180 desc = ops->idx2desc(ring, slot, &meta);
1181 memset(meta, 0, sizeof(*meta)); 1181 memset(meta, 0, sizeof(*meta));
1182 1182
1183 memcpy(&meta->txstat.control, ctl, sizeof(*ctl));
1184 meta->skb = skb; 1183 meta->skb = skb;
1185 meta->is_last_fragment = 1; 1184 meta->is_last_fragment = 1;
1186 1185
@@ -1210,7 +1209,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1210 1209
1211 ops->fill_descriptor(ring, desc, meta->dmaaddr, skb->len, 0, 1, 1); 1210 ops->fill_descriptor(ring, desc, meta->dmaaddr, skb->len, 0, 1, 1);
1212 1211
1213 if (ctl->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM) { 1212 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
1214 /* Tell the firmware about the cookie of the last 1213 /* Tell the firmware about the cookie of the last
1215 * mcast frame, so it can clear the more-data bit in it. */ 1214 * mcast frame, so it can clear the more-data bit in it. */
1216 b43_shm_write16(ring->dev, B43_SHM_SHARED, 1215 b43_shm_write16(ring->dev, B43_SHM_SHARED,
@@ -1281,16 +1280,16 @@ static struct b43_dmaring * select_ring_by_priority(struct b43_wldev *dev,
1281 return ring; 1280 return ring;
1282} 1281}
1283 1282
1284int b43_dma_tx(struct b43_wldev *dev, 1283int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb)
1285 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
1286{ 1284{
1287 struct b43_dmaring *ring; 1285 struct b43_dmaring *ring;
1288 struct ieee80211_hdr *hdr; 1286 struct ieee80211_hdr *hdr;
1289 int err = 0; 1287 int err = 0;
1290 unsigned long flags; 1288 unsigned long flags;
1289 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1291 1290
1292 hdr = (struct ieee80211_hdr *)skb->data; 1291 hdr = (struct ieee80211_hdr *)skb->data;
1293 if (ctl->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM) { 1292 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
1294 /* The multicast ring will be sent after the DTIM */ 1293 /* The multicast ring will be sent after the DTIM */
1295 ring = dev->dma.tx_ring_mcast; 1294 ring = dev->dma.tx_ring_mcast;
1296 /* Set the more-data bit. Ucode will clear it on 1295 /* Set the more-data bit. Ucode will clear it on
@@ -1298,7 +1297,7 @@ int b43_dma_tx(struct b43_wldev *dev,
1298 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); 1297 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
1299 } else { 1298 } else {
1300 /* Decide by priority where to put this frame. */ 1299 /* Decide by priority where to put this frame. */
1301 ring = select_ring_by_priority(dev, ctl->queue); 1300 ring = select_ring_by_priority(dev, info->queue);
1302 } 1301 }
1303 1302
1304 spin_lock_irqsave(&ring->lock, flags); 1303 spin_lock_irqsave(&ring->lock, flags);
@@ -1316,9 +1315,9 @@ int b43_dma_tx(struct b43_wldev *dev,
1316 /* Assign the queue number to the ring (if not already done before) 1315 /* Assign the queue number to the ring (if not already done before)
1317 * so TX status handling can use it. The queue to ring mapping is 1316 * so TX status handling can use it. The queue to ring mapping is
1318 * static, so we don't need to store it per frame. */ 1317 * static, so we don't need to store it per frame. */
1319 ring->queue_prio = ctl->queue; 1318 ring->queue_prio = info->queue;
1320 1319
1321 err = dma_tx_fragment(ring, skb, ctl); 1320 err = dma_tx_fragment(ring, skb);
1322 if (unlikely(err == -ENOKEY)) { 1321 if (unlikely(err == -ENOKEY)) {
1323 /* Drop this packet, as we don't have the encryption key 1322 /* Drop this packet, as we don't have the encryption key
1324 * anymore and must not transmit it unencrypted. */ 1323 * anymore and must not transmit it unencrypted. */
@@ -1334,7 +1333,7 @@ int b43_dma_tx(struct b43_wldev *dev,
1334 if ((free_slots(ring) < SLOTS_PER_PACKET) || 1333 if ((free_slots(ring) < SLOTS_PER_PACKET) ||
1335 should_inject_overflow(ring)) { 1334 should_inject_overflow(ring)) {
1336 /* This TX ring is full. */ 1335 /* This TX ring is full. */
1337 ieee80211_stop_queue(dev->wl->hw, ctl->queue); 1336 ieee80211_stop_queue(dev->wl->hw, info->queue);
1338 ring->stopped = 1; 1337 ring->stopped = 1;
1339 if (b43_debug(dev, B43_DBG_DMAVERBOSE)) { 1338 if (b43_debug(dev, B43_DBG_DMAVERBOSE)) {
1340 b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index); 1339 b43dbg(dev->wl, "Stopped TX ring %d\n", ring->index);
@@ -1377,13 +1376,19 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1377 b43_txhdr_size(dev), 1); 1376 b43_txhdr_size(dev), 1);
1378 1377
1379 if (meta->is_last_fragment) { 1378 if (meta->is_last_fragment) {
1380 B43_WARN_ON(!meta->skb); 1379 struct ieee80211_tx_info *info;
1381 /* Call back to inform the ieee80211 subsystem about the 1380
1382 * status of the transmission. 1381 BUG_ON(!meta->skb);
1383 * Some fields of txstat are already filled in dma_tx(). 1382
1383 info = IEEE80211_SKB_CB(meta->skb);
1384
1385 memset(&info->status, 0, sizeof(info->status));
1386
1387 /*
1388 * Call back to inform the ieee80211 subsystem about
1389 * the status of the transmission.
1384 */ 1390 */
1385 frame_succeed = b43_fill_txstatus_report( 1391 frame_succeed = b43_fill_txstatus_report(info, status);
1386 &(meta->txstat), status);
1387#ifdef CONFIG_B43_DEBUG 1392#ifdef CONFIG_B43_DEBUG
1388 if (frame_succeed) 1393 if (frame_succeed)
1389 ring->nr_succeed_tx_packets++; 1394 ring->nr_succeed_tx_packets++;
@@ -1391,8 +1396,8 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev,
1391 ring->nr_failed_tx_packets++; 1396 ring->nr_failed_tx_packets++;
1392 ring->nr_total_packet_tries += status->frame_count; 1397 ring->nr_total_packet_tries += status->frame_count;
1393#endif /* DEBUG */ 1398#endif /* DEBUG */
1394 ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb, 1399 ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb);
1395 &(meta->txstat)); 1400
1396 /* skb is freed by ieee80211_tx_status_irqsafe() */ 1401 /* skb is freed by ieee80211_tx_status_irqsafe() */
1397 meta->skb = NULL; 1402 meta->skb = NULL;
1398 } else { 1403 } else {
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index 20acf885dba5..d1eb5c0848a5 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -181,7 +181,6 @@ struct b43_dmadesc_meta {
181 dma_addr_t dmaaddr; 181 dma_addr_t dmaaddr;
182 /* ieee80211 TX status. Only used once per 802.11 frag. */ 182 /* ieee80211 TX status. Only used once per 802.11 frag. */
183 bool is_last_fragment; 183 bool is_last_fragment;
184 struct ieee80211_tx_status txstat;
185}; 184};
186 185
187struct b43_dmaring; 186struct b43_dmaring;
@@ -285,7 +284,7 @@ void b43_dma_get_tx_stats(struct b43_wldev *dev,
285 struct ieee80211_tx_queue_stats *stats); 284 struct ieee80211_tx_queue_stats *stats);
286 285
287int b43_dma_tx(struct b43_wldev *dev, 286int b43_dma_tx(struct b43_wldev *dev,
288 struct sk_buff *skb, struct ieee80211_tx_control *ctl); 287 struct sk_buff *skb);
289void b43_dma_handle_txstatus(struct b43_wldev *dev, 288void b43_dma_handle_txstatus(struct b43_wldev *dev,
290 const struct b43_txstatus *status); 289 const struct b43_txstatus *status);
291 290
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index e428645352b4..3622d76de1e1 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1368,18 +1368,18 @@ static void b43_write_beacon_template(struct b43_wldev *dev,
1368 unsigned int rate; 1368 unsigned int rate;
1369 u16 ctl; 1369 u16 ctl;
1370 int antenna; 1370 int antenna;
1371 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(dev->wl->current_beacon);
1371 1372
1372 bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data); 1373 bcn = (const struct ieee80211_mgmt *)(dev->wl->current_beacon->data);
1373 len = min((size_t) dev->wl->current_beacon->len, 1374 len = min((size_t) dev->wl->current_beacon->len,
1374 0x200 - sizeof(struct b43_plcp_hdr6)); 1375 0x200 - sizeof(struct b43_plcp_hdr6));
1375 rate = ieee80211_get_tx_rate(dev->wl->hw, &dev->wl->beacon_txctl)->hw_value; 1376 rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value;
1376 1377
1377 b43_write_template_common(dev, (const u8 *)bcn, 1378 b43_write_template_common(dev, (const u8 *)bcn,
1378 len, ram_offset, shm_size_offset, rate); 1379 len, ram_offset, shm_size_offset, rate);
1379 1380
1380 /* Write the PHY TX control parameters. */ 1381 /* Write the PHY TX control parameters. */
1381 antenna = b43_antenna_from_ieee80211(dev, 1382 antenna = b43_antenna_from_ieee80211(dev, info->antenna_sel_tx);
1382 dev->wl->beacon_txctl.antenna_sel_tx);
1383 antenna = b43_antenna_to_phyctl(antenna); 1383 antenna = b43_antenna_to_phyctl(antenna);
1384 ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL); 1384 ctl = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_BEACPHYCTL);
1385 /* We can't send beacons with short preamble. Would get PHY errors. */ 1385 /* We can't send beacons with short preamble. Would get PHY errors. */
@@ -1613,8 +1613,7 @@ static void b43_beacon_update_trigger_work(struct work_struct *work)
1613 1613
1614/* Asynchronously update the packet templates in template RAM. 1614/* Asynchronously update the packet templates in template RAM.
1615 * Locking: Requires wl->irq_lock to be locked. */ 1615 * Locking: Requires wl->irq_lock to be locked. */
1616static void b43_update_templates(struct b43_wl *wl, struct sk_buff *beacon, 1616static void b43_update_templates(struct b43_wl *wl, struct sk_buff *beacon)
1617 const struct ieee80211_tx_control *txctl)
1618{ 1617{
1619 /* This is the top half of the ansynchronous beacon update. 1618 /* This is the top half of the ansynchronous beacon update.
1620 * The bottom half is the beacon IRQ. 1619 * The bottom half is the beacon IRQ.
@@ -1625,7 +1624,6 @@ static void b43_update_templates(struct b43_wl *wl, struct sk_buff *beacon,
1625 if (wl->current_beacon) 1624 if (wl->current_beacon)
1626 dev_kfree_skb_any(wl->current_beacon); 1625 dev_kfree_skb_any(wl->current_beacon);
1627 wl->current_beacon = beacon; 1626 wl->current_beacon = beacon;
1628 memcpy(&wl->beacon_txctl, txctl, sizeof(wl->beacon_txctl));
1629 wl->beacon0_uploaded = 0; 1627 wl->beacon0_uploaded = 0;
1630 wl->beacon1_uploaded = 0; 1628 wl->beacon1_uploaded = 0;
1631 queue_work(wl->hw->workqueue, &wl->beacon_update_trigger); 1629 queue_work(wl->hw->workqueue, &wl->beacon_update_trigger);
@@ -2813,8 +2811,7 @@ static int b43_rng_init(struct b43_wl *wl)
2813} 2811}
2814 2812
2815static int b43_op_tx(struct ieee80211_hw *hw, 2813static int b43_op_tx(struct ieee80211_hw *hw,
2816 struct sk_buff *skb, 2814 struct sk_buff *skb)
2817 struct ieee80211_tx_control *ctl)
2818{ 2815{
2819 struct b43_wl *wl = hw_to_b43_wl(hw); 2816 struct b43_wl *wl = hw_to_b43_wl(hw);
2820 struct b43_wldev *dev = wl->current_dev; 2817 struct b43_wldev *dev = wl->current_dev;
@@ -2836,9 +2833,9 @@ static int b43_op_tx(struct ieee80211_hw *hw,
2836 err = -ENODEV; 2833 err = -ENODEV;
2837 if (likely(b43_status(dev) >= B43_STAT_STARTED)) { 2834 if (likely(b43_status(dev) >= B43_STAT_STARTED)) {
2838 if (b43_using_pio_transfers(dev)) 2835 if (b43_using_pio_transfers(dev))
2839 err = b43_pio_tx(dev, skb, ctl); 2836 err = b43_pio_tx(dev, skb);
2840 else 2837 else
2841 err = b43_dma_tx(dev, skb, ctl); 2838 err = b43_dma_tx(dev, skb);
2842 } 2839 }
2843 2840
2844 read_unlock_irqrestore(&wl->tx_lock, flags); 2841 read_unlock_irqrestore(&wl->tx_lock, flags);
@@ -3429,10 +3426,8 @@ static int b43_op_config_interface(struct ieee80211_hw *hw,
3429 if (b43_is_mode(wl, IEEE80211_IF_TYPE_AP)) { 3426 if (b43_is_mode(wl, IEEE80211_IF_TYPE_AP)) {
3430 B43_WARN_ON(conf->type != IEEE80211_IF_TYPE_AP); 3427 B43_WARN_ON(conf->type != IEEE80211_IF_TYPE_AP);
3431 b43_set_ssid(dev, conf->ssid, conf->ssid_len); 3428 b43_set_ssid(dev, conf->ssid, conf->ssid_len);
3432 if (conf->beacon) { 3429 if (conf->beacon)
3433 b43_update_templates(wl, conf->beacon, 3430 b43_update_templates(wl, conf->beacon);
3434 conf->beacon_control);
3435 }
3436 } 3431 }
3437 b43_write_mac_bssid_templates(dev); 3432 b43_write_mac_bssid_templates(dev);
3438 } 3433 }
@@ -4118,31 +4113,29 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, int aid, int set)
4118 struct b43_wl *wl = hw_to_b43_wl(hw); 4113 struct b43_wl *wl = hw_to_b43_wl(hw);
4119 struct sk_buff *beacon; 4114 struct sk_buff *beacon;
4120 unsigned long flags; 4115 unsigned long flags;
4121 struct ieee80211_tx_control txctl;
4122 4116
4123 /* We could modify the existing beacon and set the aid bit in 4117 /* We could modify the existing beacon and set the aid bit in
4124 * the TIM field, but that would probably require resizing and 4118 * the TIM field, but that would probably require resizing and
4125 * moving of data within the beacon template. 4119 * moving of data within the beacon template.
4126 * Simply request a new beacon and let mac80211 do the hard work. */ 4120 * Simply request a new beacon and let mac80211 do the hard work. */
4127 beacon = ieee80211_beacon_get(hw, wl->vif, &txctl); 4121 beacon = ieee80211_beacon_get(hw, wl->vif);
4128 if (unlikely(!beacon)) 4122 if (unlikely(!beacon))
4129 return -ENOMEM; 4123 return -ENOMEM;
4130 spin_lock_irqsave(&wl->irq_lock, flags); 4124 spin_lock_irqsave(&wl->irq_lock, flags);
4131 b43_update_templates(wl, beacon, &txctl); 4125 b43_update_templates(wl, beacon);
4132 spin_unlock_irqrestore(&wl->irq_lock, flags); 4126 spin_unlock_irqrestore(&wl->irq_lock, flags);
4133 4127
4134 return 0; 4128 return 0;
4135} 4129}
4136 4130
4137static int b43_op_ibss_beacon_update(struct ieee80211_hw *hw, 4131static int b43_op_ibss_beacon_update(struct ieee80211_hw *hw,
4138 struct sk_buff *beacon, 4132 struct sk_buff *beacon)
4139 struct ieee80211_tx_control *ctl)
4140{ 4133{
4141 struct b43_wl *wl = hw_to_b43_wl(hw); 4134 struct b43_wl *wl = hw_to_b43_wl(hw);
4142 unsigned long flags; 4135 unsigned long flags;
4143 4136
4144 spin_lock_irqsave(&wl->irq_lock, flags); 4137 spin_lock_irqsave(&wl->irq_lock, flags);
4145 b43_update_templates(wl, beacon, ctl); 4138 b43_update_templates(wl, beacon);
4146 spin_unlock_irqrestore(&wl->irq_lock, flags); 4139 spin_unlock_irqrestore(&wl->irq_lock, flags);
4147 4140
4148 return 0; 4141 return 0;
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 08c8a087f30e..284786a94e7d 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -446,29 +446,27 @@ static void pio_tx_frame_4byte_queue(struct b43_pio_txpacket *pack,
446} 446}
447 447
448static int pio_tx_frame(struct b43_pio_txqueue *q, 448static int pio_tx_frame(struct b43_pio_txqueue *q,
449 struct sk_buff *skb, 449 struct sk_buff *skb)
450 struct ieee80211_tx_control *ctl)
451{ 450{
452 struct b43_pio_txpacket *pack; 451 struct b43_pio_txpacket *pack;
453 struct b43_txhdr txhdr; 452 struct b43_txhdr txhdr;
454 u16 cookie; 453 u16 cookie;
455 int err; 454 int err;
456 unsigned int hdrlen; 455 unsigned int hdrlen;
456 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
457 457
458 B43_WARN_ON(list_empty(&q->packets_list)); 458 B43_WARN_ON(list_empty(&q->packets_list));
459 pack = list_entry(q->packets_list.next, 459 pack = list_entry(q->packets_list.next,
460 struct b43_pio_txpacket, list); 460 struct b43_pio_txpacket, list);
461 memset(&pack->txstat, 0, sizeof(pack->txstat));
462 memcpy(&pack->txstat.control, ctl, sizeof(*ctl));
463 461
464 cookie = generate_cookie(q, pack); 462 cookie = generate_cookie(q, pack);
465 hdrlen = b43_txhdr_size(q->dev); 463 hdrlen = b43_txhdr_size(q->dev);
466 err = b43_generate_txhdr(q->dev, (u8 *)&txhdr, skb->data, 464 err = b43_generate_txhdr(q->dev, (u8 *)&txhdr, skb->data,
467 skb->len, ctl, cookie); 465 skb->len, info, cookie);
468 if (err) 466 if (err)
469 return err; 467 return err;
470 468
471 if (ctl->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM) { 469 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
472 /* Tell the firmware about the cookie of the last 470 /* Tell the firmware about the cookie of the last
473 * mcast frame, so it can clear the more-data bit in it. */ 471 * mcast frame, so it can clear the more-data bit in it. */
474 b43_shm_write16(q->dev, B43_SHM_SHARED, 472 b43_shm_write16(q->dev, B43_SHM_SHARED,
@@ -492,17 +490,18 @@ static int pio_tx_frame(struct b43_pio_txqueue *q,
492 return 0; 490 return 0;
493} 491}
494 492
495int b43_pio_tx(struct b43_wldev *dev, 493int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)
496 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
497{ 494{
498 struct b43_pio_txqueue *q; 495 struct b43_pio_txqueue *q;
499 struct ieee80211_hdr *hdr; 496 struct ieee80211_hdr *hdr;
500 unsigned long flags; 497 unsigned long flags;
501 unsigned int hdrlen, total_len; 498 unsigned int hdrlen, total_len;
502 int err = 0; 499 int err = 0;
500 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
503 501
504 hdr = (struct ieee80211_hdr *)skb->data; 502 hdr = (struct ieee80211_hdr *)skb->data;
505 if (ctl->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM) { 503
504 if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
506 /* The multicast queue will be sent after the DTIM. */ 505 /* The multicast queue will be sent after the DTIM. */
507 q = dev->pio.tx_queue_mcast; 506 q = dev->pio.tx_queue_mcast;
508 /* Set the frame More-Data bit. Ucode will clear it 507 /* Set the frame More-Data bit. Ucode will clear it
@@ -510,7 +509,7 @@ int b43_pio_tx(struct b43_wldev *dev,
510 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); 509 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
511 } else { 510 } else {
512 /* Decide by priority where to put this frame. */ 511 /* Decide by priority where to put this frame. */
513 q = select_queue_by_priority(dev, ctl->queue); 512 q = select_queue_by_priority(dev, info->queue);
514 } 513 }
515 514
516 spin_lock_irqsave(&q->lock, flags); 515 spin_lock_irqsave(&q->lock, flags);
@@ -533,7 +532,7 @@ int b43_pio_tx(struct b43_wldev *dev,
533 if (total_len > (q->buffer_size - q->buffer_used)) { 532 if (total_len > (q->buffer_size - q->buffer_used)) {
534 /* Not enough memory on the queue. */ 533 /* Not enough memory on the queue. */
535 err = -EBUSY; 534 err = -EBUSY;
536 ieee80211_stop_queue(dev->wl->hw, ctl->queue); 535 ieee80211_stop_queue(dev->wl->hw, info->queue);
537 q->stopped = 1; 536 q->stopped = 1;
538 goto out_unlock; 537 goto out_unlock;
539 } 538 }
@@ -541,9 +540,9 @@ int b43_pio_tx(struct b43_wldev *dev,
541 /* Assign the queue number to the ring (if not already done before) 540 /* Assign the queue number to the ring (if not already done before)
542 * so TX status handling can use it. The mac80211-queue to b43-queue 541 * so TX status handling can use it. The mac80211-queue to b43-queue
543 * mapping is static, so we don't need to store it per frame. */ 542 * mapping is static, so we don't need to store it per frame. */
544 q->queue_prio = ctl->queue; 543 q->queue_prio = info->queue;
545 544
546 err = pio_tx_frame(q, skb, ctl); 545 err = pio_tx_frame(q, skb);
547 if (unlikely(err == -ENOKEY)) { 546 if (unlikely(err == -ENOKEY)) {
548 /* Drop this packet, as we don't have the encryption key 547 /* Drop this packet, as we don't have the encryption key
549 * anymore and must not transmit it unencrypted. */ 548 * anymore and must not transmit it unencrypted. */
@@ -561,7 +560,7 @@ int b43_pio_tx(struct b43_wldev *dev,
561 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) || 560 if (((q->buffer_size - q->buffer_used) < roundup(2 + 2 + 6, 4)) ||
562 (q->free_packet_slots == 0)) { 561 (q->free_packet_slots == 0)) {
563 /* The queue is full. */ 562 /* The queue is full. */
564 ieee80211_stop_queue(dev->wl->hw, ctl->queue); 563 ieee80211_stop_queue(dev->wl->hw, info->queue);
565 q->stopped = 1; 564 q->stopped = 1;
566 } 565 }
567 566
@@ -578,6 +577,7 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,
578 struct b43_pio_txqueue *q; 577 struct b43_pio_txqueue *q;
579 struct b43_pio_txpacket *pack = NULL; 578 struct b43_pio_txpacket *pack = NULL;
580 unsigned int total_len; 579 unsigned int total_len;
580 struct ieee80211_tx_info *info;
581 581
582 q = parse_cookie(dev, status->cookie, &pack); 582 q = parse_cookie(dev, status->cookie, &pack);
583 if (unlikely(!q)) 583 if (unlikely(!q))
@@ -586,15 +586,17 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,
586 586
587 spin_lock(&q->lock); /* IRQs are already disabled. */ 587 spin_lock(&q->lock); /* IRQs are already disabled. */
588 588
589 b43_fill_txstatus_report(&(pack->txstat), status); 589 info = (void *)pack->skb;
590 memset(&info->status, 0, sizeof(info->status));
591
592 b43_fill_txstatus_report(info, status);
590 593
591 total_len = pack->skb->len + b43_txhdr_size(dev); 594 total_len = pack->skb->len + b43_txhdr_size(dev);
592 total_len = roundup(total_len, 4); 595 total_len = roundup(total_len, 4);
593 q->buffer_used -= total_len; 596 q->buffer_used -= total_len;
594 q->free_packet_slots += 1; 597 q->free_packet_slots += 1;
595 598
596 ieee80211_tx_status_irqsafe(dev->wl->hw, pack->skb, 599 ieee80211_tx_status_irqsafe(dev->wl->hw, pack->skb);
597 &(pack->txstat));
598 pack->skb = NULL; 600 pack->skb = NULL;
599 list_add(&pack->list, &q->packets_list); 601 list_add(&pack->list, &q->packets_list);
600 602
diff --git a/drivers/net/wireless/b43/pio.h b/drivers/net/wireless/b43/pio.h
index e2ec676cc9e4..6c174c91ca20 100644
--- a/drivers/net/wireless/b43/pio.h
+++ b/drivers/net/wireless/b43/pio.h
@@ -62,8 +62,6 @@ struct b43_pio_txpacket {
62 struct b43_pio_txqueue *queue; 62 struct b43_pio_txqueue *queue;
63 /* The TX data packet. */ 63 /* The TX data packet. */
64 struct sk_buff *skb; 64 struct sk_buff *skb;
65 /* The status meta data. */
66 struct ieee80211_tx_status txstat;
67 /* Index in the (struct b43_pio_txqueue)->packets array. */ 65 /* Index in the (struct b43_pio_txqueue)->packets array. */
68 u8 index; 66 u8 index;
69 67
@@ -167,8 +165,7 @@ int b43_pio_init(struct b43_wldev *dev);
167void b43_pio_stop(struct b43_wldev *dev); 165void b43_pio_stop(struct b43_wldev *dev);
168void b43_pio_free(struct b43_wldev *dev); 166void b43_pio_free(struct b43_wldev *dev);
169 167
170int b43_pio_tx(struct b43_wldev *dev, 168int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb);
171 struct sk_buff *skb, struct ieee80211_tx_control *ctl);
172void b43_pio_handle_txstatus(struct b43_wldev *dev, 169void b43_pio_handle_txstatus(struct b43_wldev *dev,
173 const struct b43_txstatus *status); 170 const struct b43_txstatus *status);
174void b43_pio_get_tx_stats(struct b43_wldev *dev, 171void b43_pio_get_tx_stats(struct b43_wldev *dev,
@@ -193,8 +190,7 @@ static inline void b43_pio_stop(struct b43_wldev *dev)
193{ 190{
194} 191}
195static inline int b43_pio_tx(struct b43_wldev *dev, 192static inline int b43_pio_tx(struct b43_wldev *dev,
196 struct sk_buff *skb, 193 struct sk_buff *skb)
197 struct ieee80211_tx_control *ctl)
198{ 194{
199 return 0; 195 return 0;
200} 196}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 9b682a3cf5e4..f9e1cff2aecb 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -185,14 +185,14 @@ 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_control *txctl, 188 const 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;
192 const struct b43_phy *phy = &dev->phy; 192 const struct b43_phy *phy = &dev->phy;
193 const struct ieee80211_hdr *wlhdr = 193 const struct ieee80211_hdr *wlhdr =
194 (const struct ieee80211_hdr *)fragment_data; 194 (const struct ieee80211_hdr *)fragment_data;
195 int use_encryption = (!(txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)); 195 int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT));
196 u16 fctl = le16_to_cpu(wlhdr->frame_control); 196 u16 fctl = le16_to_cpu(wlhdr->frame_control);
197 struct ieee80211_rate *fbrate; 197 struct ieee80211_rate *fbrate;
198 u8 rate, rate_fb; 198 u8 rate, rate_fb;
@@ -205,10 +205,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
205 205
206 memset(txhdr, 0, sizeof(*txhdr)); 206 memset(txhdr, 0, sizeof(*txhdr));
207 207
208 txrate = ieee80211_get_tx_rate(dev->wl->hw, txctl); 208 txrate = ieee80211_get_tx_rate(dev->wl->hw, info);
209 rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB; 209 rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB;
210 rate_ofdm = b43_is_ofdm_rate(rate); 210 rate_ofdm = b43_is_ofdm_rate(rate);
211 fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, txctl) ? : txrate; 211 fbrate = ieee80211_get_alt_retry_rate(dev->wl->hw, info) ? : txrate;
212 rate_fb = fbrate->hw_value; 212 rate_fb = fbrate->hw_value;
213 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb); 213 rate_fb_ofdm = b43_is_ofdm_rate(rate_fb);
214 214
@@ -228,15 +228,13 @@ int b43_generate_txhdr(struct b43_wldev *dev,
228 * use the original dur_id field. */ 228 * use the original dur_id field. */
229 txhdr->dur_fb = wlhdr->duration_id; 229 txhdr->dur_fb = wlhdr->duration_id;
230 } else { 230 } else {
231 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, 231 txhdr->dur_fb = ieee80211_generic_frame_duration(
232 txctl->vif, 232 dev->wl->hw, info->control.vif, fragment_len, fbrate);
233 fragment_len,
234 fbrate);
235 } 233 }
236 234
237 plcp_fragment_len = fragment_len + FCS_LEN; 235 plcp_fragment_len = fragment_len + FCS_LEN;
238 if (use_encryption) { 236 if (use_encryption) {
239 u8 key_idx = txctl->hw_key->hw_key_idx; 237 u8 key_idx = info->control.hw_key->hw_key_idx;
240 struct b43_key *key; 238 struct b43_key *key;
241 int wlhdr_len; 239 int wlhdr_len;
242 size_t iv_len; 240 size_t iv_len;
@@ -254,7 +252,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
254 } 252 }
255 253
256 /* Hardware appends ICV. */ 254 /* Hardware appends ICV. */
257 plcp_fragment_len += txctl->icv_len; 255 plcp_fragment_len += info->control.icv_len;
258 256
259 key_idx = b43_kidx_to_fw(dev, key_idx); 257 key_idx = b43_kidx_to_fw(dev, key_idx);
260 mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) & 258 mac_ctl |= (key_idx << B43_TXH_MAC_KEYIDX_SHIFT) &
@@ -262,7 +260,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
262 mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & 260 mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) &
263 B43_TXH_MAC_KEYALG; 261 B43_TXH_MAC_KEYALG;
264 wlhdr_len = ieee80211_get_hdrlen(fctl); 262 wlhdr_len = ieee80211_get_hdrlen(fctl);
265 iv_len = min((size_t) txctl->iv_len, 263 iv_len = min((size_t) info->control.iv_len,
266 ARRAY_SIZE(txhdr->iv)); 264 ARRAY_SIZE(txhdr->iv));
267 memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); 265 memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len);
268 } 266 }
@@ -293,10 +291,10 @@ int b43_generate_txhdr(struct b43_wldev *dev,
293 phy_ctl |= B43_TXH_PHY_ENC_OFDM; 291 phy_ctl |= B43_TXH_PHY_ENC_OFDM;
294 else 292 else
295 phy_ctl |= B43_TXH_PHY_ENC_CCK; 293 phy_ctl |= B43_TXH_PHY_ENC_CCK;
296 if (txctl->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) 294 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE)
297 phy_ctl |= B43_TXH_PHY_SHORTPRMBL; 295 phy_ctl |= B43_TXH_PHY_SHORTPRMBL;
298 296
299 switch (b43_ieee80211_antenna_sanitize(dev, txctl->antenna_sel_tx)) { 297 switch (b43_ieee80211_antenna_sanitize(dev, info->antenna_sel_tx)) {
300 case 0: /* Default */ 298 case 0: /* Default */
301 phy_ctl |= B43_TXH_PHY_ANT01AUTO; 299 phy_ctl |= B43_TXH_PHY_ANT01AUTO;
302 break; 300 break;
@@ -317,21 +315,21 @@ int b43_generate_txhdr(struct b43_wldev *dev,
317 } 315 }
318 316
319 /* MAC control */ 317 /* MAC control */
320 if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK)) 318 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
321 mac_ctl |= B43_TXH_MAC_ACK; 319 mac_ctl |= B43_TXH_MAC_ACK;
322 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && 320 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
323 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL))) 321 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
324 mac_ctl |= B43_TXH_MAC_HWSEQ; 322 mac_ctl |= B43_TXH_MAC_HWSEQ;
325 if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) 323 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
326 mac_ctl |= B43_TXH_MAC_STMSDU; 324 mac_ctl |= B43_TXH_MAC_STMSDU;
327 if (phy->type == B43_PHYTYPE_A) 325 if (phy->type == B43_PHYTYPE_A)
328 mac_ctl |= B43_TXH_MAC_5GHZ; 326 mac_ctl |= B43_TXH_MAC_5GHZ;
329 if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) 327 if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT)
330 mac_ctl |= B43_TXH_MAC_LONGFRAME; 328 mac_ctl |= B43_TXH_MAC_LONGFRAME;
331 329
332 /* Generate the RTS or CTS-to-self frame */ 330 /* Generate the RTS or CTS-to-self frame */
333 if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 331 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
334 (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { 332 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
335 unsigned int len; 333 unsigned int len;
336 struct ieee80211_hdr *hdr; 334 struct ieee80211_hdr *hdr;
337 int rts_rate, rts_rate_fb; 335 int rts_rate, rts_rate_fb;
@@ -339,14 +337,14 @@ int b43_generate_txhdr(struct b43_wldev *dev,
339 struct b43_plcp_hdr6 *plcp; 337 struct b43_plcp_hdr6 *plcp;
340 struct ieee80211_rate *rts_cts_rate; 338 struct ieee80211_rate *rts_cts_rate;
341 339
342 rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, txctl); 340 rts_cts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info);
343 341
344 rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB; 342 rts_rate = rts_cts_rate ? rts_cts_rate->hw_value : B43_CCK_RATE_1MB;
345 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate); 343 rts_rate_ofdm = b43_is_ofdm_rate(rts_rate);
346 rts_rate_fb = b43_calc_fallback_rate(rts_rate); 344 rts_rate_fb = b43_calc_fallback_rate(rts_rate);
347 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); 345 rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb);
348 346
349 if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 347 if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
350 struct ieee80211_cts *cts; 348 struct ieee80211_cts *cts;
351 349
352 if (b43_is_old_txhdr_format(dev)) { 350 if (b43_is_old_txhdr_format(dev)) {
@@ -356,9 +354,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
356 cts = (struct ieee80211_cts *) 354 cts = (struct ieee80211_cts *)
357 (txhdr->new_format.rts_frame); 355 (txhdr->new_format.rts_frame);
358 } 356 }
359 ieee80211_ctstoself_get(dev->wl->hw, txctl->vif, 357 ieee80211_ctstoself_get(dev->wl->hw, info->control.vif,
360 fragment_data, fragment_len, 358 fragment_data, fragment_len,
361 txctl, cts); 359 info, cts);
362 mac_ctl |= B43_TXH_MAC_SENDCTS; 360 mac_ctl |= B43_TXH_MAC_SENDCTS;
363 len = sizeof(struct ieee80211_cts); 361 len = sizeof(struct ieee80211_cts);
364 } else { 362 } else {
@@ -371,9 +369,9 @@ int b43_generate_txhdr(struct b43_wldev *dev,
371 rts = (struct ieee80211_rts *) 369 rts = (struct ieee80211_rts *)
372 (txhdr->new_format.rts_frame); 370 (txhdr->new_format.rts_frame);
373 } 371 }
374 ieee80211_rts_get(dev->wl->hw, txctl->vif, 372 ieee80211_rts_get(dev->wl->hw, info->control.vif,
375 fragment_data, fragment_len, 373 fragment_data, fragment_len,
376 txctl, rts); 374 info, rts);
377 mac_ctl |= B43_TXH_MAC_SENDRTS; 375 mac_ctl |= B43_TXH_MAC_SENDRTS;
378 len = sizeof(struct ieee80211_rts); 376 len = sizeof(struct ieee80211_rts);
379 } 377 }
@@ -687,27 +685,27 @@ void b43_handle_txstatus(struct b43_wldev *dev,
687/* Fill out the mac80211 TXstatus report based on the b43-specific 685/* Fill out the mac80211 TXstatus report based on the b43-specific
688 * txstatus report data. This returns a boolean whether the frame was 686 * txstatus report data. This returns a boolean whether the frame was
689 * successfully transmitted. */ 687 * successfully transmitted. */
690bool b43_fill_txstatus_report(struct ieee80211_tx_status *report, 688bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
691 const struct b43_txstatus *status) 689 const struct b43_txstatus *status)
692{ 690{
693 bool frame_success = 1; 691 bool frame_success = 1;
694 692
695 if (status->acked) { 693 if (status->acked) {
696 /* The frame was ACKed. */ 694 /* The frame was ACKed. */
697 report->flags |= IEEE80211_TX_STATUS_ACK; 695 report->flags |= IEEE80211_TX_STAT_ACK;
698 } else { 696 } else {
699 /* The frame was not ACKed... */ 697 /* The frame was not ACKed... */
700 if (!(report->control.flags & IEEE80211_TXCTL_NO_ACK)) { 698 if (!(report->flags & IEEE80211_TX_CTL_NO_ACK)) {
701 /* ...but we expected an ACK. */ 699 /* ...but we expected an ACK. */
702 frame_success = 0; 700 frame_success = 0;
703 report->excessive_retries = 1; 701 report->status.excessive_retries = 1;
704 } 702 }
705 } 703 }
706 if (status->frame_count == 0) { 704 if (status->frame_count == 0) {
707 /* The frame was not transmitted at all. */ 705 /* The frame was not transmitted at all. */
708 report->retry_count = 0; 706 report->status.retry_count = 0;
709 } else 707 } else
710 report->retry_count = status->frame_count - 1; 708 report->status.retry_count = status->frame_count - 1;
711 709
712 return frame_success; 710 return frame_success;
713} 711}
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index b05f44e0d626..0215faf47541 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_control *txctl, u16 cookie); 181 const struct ieee80211_tx_info *txctl, u16 cookie);
182 182
183/* Transmit Status */ 183/* Transmit Status */
184struct b43_txstatus { 184struct b43_txstatus {
@@ -294,7 +294,7 @@ 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_status *report, 297bool b43_fill_txstatus_report(struct ieee80211_tx_info *report,
298 const struct b43_txstatus *status); 298 const struct b43_txstatus *status);
299 299
300void b43_tx_suspend(struct b43_wldev *dev); 300void b43_tx_suspend(struct b43_wldev *dev);
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index d6686f713b6d..c1c501d963bc 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -1205,10 +1205,10 @@ struct b43legacy_dmaring *parse_cookie(struct b43legacy_wldev *dev,
1205} 1205}
1206 1206
1207static int dma_tx_fragment(struct b43legacy_dmaring *ring, 1207static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1208 struct sk_buff *skb, 1208 struct sk_buff *skb)
1209 struct ieee80211_tx_control *ctl)
1210{ 1209{
1211 const struct b43legacy_dma_ops *ops = ring->ops; 1210 const struct b43legacy_dma_ops *ops = ring->ops;
1211 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1212 u8 *header; 1212 u8 *header;
1213 int slot, old_top_slot, old_used_slots; 1213 int slot, old_top_slot, old_used_slots;
1214 int err; 1214 int err;
@@ -1231,7 +1231,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1231 header = &(ring->txhdr_cache[slot * sizeof( 1231 header = &(ring->txhdr_cache[slot * sizeof(
1232 struct b43legacy_txhdr_fw3)]); 1232 struct b43legacy_txhdr_fw3)]);
1233 err = b43legacy_generate_txhdr(ring->dev, header, 1233 err = b43legacy_generate_txhdr(ring->dev, header,
1234 skb->data, skb->len, ctl, 1234 skb->data, skb->len, info,
1235 generate_cookie(ring, slot)); 1235 generate_cookie(ring, slot));
1236 if (unlikely(err)) { 1236 if (unlikely(err)) {
1237 ring->current_slot = old_top_slot; 1237 ring->current_slot = old_top_slot;
@@ -1255,7 +1255,6 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1255 desc = ops->idx2desc(ring, slot, &meta); 1255 desc = ops->idx2desc(ring, slot, &meta);
1256 memset(meta, 0, sizeof(*meta)); 1256 memset(meta, 0, sizeof(*meta));
1257 1257
1258 memcpy(&meta->txstat.control, ctl, sizeof(*ctl));
1259 meta->skb = skb; 1258 meta->skb = skb;
1260 meta->is_last_fragment = 1; 1259 meta->is_last_fragment = 1;
1261 1260
@@ -1323,14 +1322,14 @@ int should_inject_overflow(struct b43legacy_dmaring *ring)
1323} 1322}
1324 1323
1325int b43legacy_dma_tx(struct b43legacy_wldev *dev, 1324int b43legacy_dma_tx(struct b43legacy_wldev *dev,
1326 struct sk_buff *skb, 1325 struct sk_buff *skb)
1327 struct ieee80211_tx_control *ctl)
1328{ 1326{
1329 struct b43legacy_dmaring *ring; 1327 struct b43legacy_dmaring *ring;
1328 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1330 int err = 0; 1329 int err = 0;
1331 unsigned long flags; 1330 unsigned long flags;
1332 1331
1333 ring = priority_to_txring(dev, ctl->queue); 1332 ring = priority_to_txring(dev, info->queue);
1334 spin_lock_irqsave(&ring->lock, flags); 1333 spin_lock_irqsave(&ring->lock, flags);
1335 B43legacy_WARN_ON(!ring->tx); 1334 B43legacy_WARN_ON(!ring->tx);
1336 if (unlikely(free_slots(ring) < SLOTS_PER_PACKET)) { 1335 if (unlikely(free_slots(ring) < SLOTS_PER_PACKET)) {
@@ -1343,7 +1342,7 @@ int b43legacy_dma_tx(struct b43legacy_wldev *dev,
1343 * That would be a mac80211 bug. */ 1342 * That would be a mac80211 bug. */
1344 B43legacy_BUG_ON(ring->stopped); 1343 B43legacy_BUG_ON(ring->stopped);
1345 1344
1346 err = dma_tx_fragment(ring, skb, ctl); 1345 err = dma_tx_fragment(ring, skb);
1347 if (unlikely(err == -ENOKEY)) { 1346 if (unlikely(err == -ENOKEY)) {
1348 /* Drop this packet, as we don't have the encryption key 1347 /* Drop this packet, as we don't have the encryption key
1349 * anymore and must not transmit it unencrypted. */ 1348 * anymore and must not transmit it unencrypted. */
@@ -1401,26 +1400,29 @@ void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
1401 1); 1400 1);
1402 1401
1403 if (meta->is_last_fragment) { 1402 if (meta->is_last_fragment) {
1404 B43legacy_WARN_ON(!meta->skb); 1403 struct ieee80211_tx_info *info;
1404 BUG_ON(!meta->skb);
1405 info = IEEE80211_SKB_CB(meta->skb);
1405 /* Call back to inform the ieee80211 subsystem about the 1406 /* Call back to inform the ieee80211 subsystem about the
1406 * status of the transmission. 1407 * status of the transmission.
1407 * Some fields of txstat are already filled in dma_tx(). 1408 * Some fields of txstat are already filled in dma_tx().
1408 */ 1409 */
1410
1411 memset(&info->status, 0, sizeof(info->status));
1412
1409 if (status->acked) { 1413 if (status->acked) {
1410 meta->txstat.flags |= IEEE80211_TX_STATUS_ACK; 1414 info->flags |= IEEE80211_TX_STAT_ACK;
1411 } else { 1415 } else {
1412 if (!(meta->txstat.control.flags 1416 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
1413 & IEEE80211_TXCTL_NO_ACK)) 1417 info->status.excessive_retries = 1;
1414 meta->txstat.excessive_retries = 1;
1415 } 1418 }
1416 if (status->frame_count == 0) { 1419 if (status->frame_count == 0) {
1417 /* The frame was not transmitted at all. */ 1420 /* The frame was not transmitted at all. */
1418 meta->txstat.retry_count = 0; 1421 info->status.retry_count = 0;
1419 } else 1422 } else
1420 meta->txstat.retry_count = status->frame_count 1423 info->status.retry_count = status->frame_count
1421 - 1; 1424 - 1;
1422 ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb, 1425 ieee80211_tx_status_irqsafe(dev->wl->hw, meta->skb);
1423 &(meta->txstat));
1424 /* skb is freed by ieee80211_tx_status_irqsafe() */ 1426 /* skb is freed by ieee80211_tx_status_irqsafe() */
1425 meta->skb = NULL; 1427 meta->skb = NULL;
1426 } else { 1428 } else {
diff --git a/drivers/net/wireless/b43legacy/dma.h b/drivers/net/wireless/b43legacy/dma.h
index 2dd488c5be2d..67537a7495ff 100644
--- a/drivers/net/wireless/b43legacy/dma.h
+++ b/drivers/net/wireless/b43legacy/dma.h
@@ -195,7 +195,6 @@ struct b43legacy_dmadesc_meta {
195 dma_addr_t dmaaddr; 195 dma_addr_t dmaaddr;
196 /* ieee80211 TX status. Only used once per 802.11 frag. */ 196 /* ieee80211 TX status. Only used once per 802.11 frag. */
197 bool is_last_fragment; 197 bool is_last_fragment;
198 struct ieee80211_tx_status txstat;
199}; 198};
200 199
201struct b43legacy_dmaring; 200struct b43legacy_dmaring;
@@ -297,8 +296,7 @@ void b43legacy_dma_get_tx_stats(struct b43legacy_wldev *dev,
297 struct ieee80211_tx_queue_stats *stats); 296 struct ieee80211_tx_queue_stats *stats);
298 297
299int b43legacy_dma_tx(struct b43legacy_wldev *dev, 298int b43legacy_dma_tx(struct b43legacy_wldev *dev,
300 struct sk_buff *skb, 299 struct sk_buff *skb);
301 struct ieee80211_tx_control *ctl);
302void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev, 300void b43legacy_dma_handle_txstatus(struct b43legacy_wldev *dev,
303 const struct b43legacy_txstatus *status); 301 const struct b43legacy_txstatus *status);
304 302
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index b05a507ed44d..f706ca65f159 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2358,8 +2358,7 @@ static int b43legacy_rng_init(struct b43legacy_wl *wl)
2358} 2358}
2359 2359
2360static int b43legacy_op_tx(struct ieee80211_hw *hw, 2360static int b43legacy_op_tx(struct ieee80211_hw *hw,
2361 struct sk_buff *skb, 2361 struct sk_buff *skb)
2362 struct ieee80211_tx_control *ctl)
2363{ 2362{
2364 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 2363 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
2365 struct b43legacy_wldev *dev = wl->current_dev; 2364 struct b43legacy_wldev *dev = wl->current_dev;
@@ -2373,10 +2372,10 @@ static int b43legacy_op_tx(struct ieee80211_hw *hw,
2373 /* DMA-TX is done without a global lock. */ 2372 /* DMA-TX is done without a global lock. */
2374 if (b43legacy_using_pio(dev)) { 2373 if (b43legacy_using_pio(dev)) {
2375 spin_lock_irqsave(&wl->irq_lock, flags); 2374 spin_lock_irqsave(&wl->irq_lock, flags);
2376 err = b43legacy_pio_tx(dev, skb, ctl); 2375 err = b43legacy_pio_tx(dev, skb);
2377 spin_unlock_irqrestore(&wl->irq_lock, flags); 2376 spin_unlock_irqrestore(&wl->irq_lock, flags);
2378 } else 2377 } else
2379 err = b43legacy_dma_tx(dev, skb, ctl); 2378 err = b43legacy_dma_tx(dev, skb);
2380out: 2379out:
2381 if (unlikely(err)) 2380 if (unlikely(err))
2382 return NETDEV_TX_BUSY; 2381 return NETDEV_TX_BUSY;
@@ -3409,7 +3408,7 @@ static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,
3409 * field, but that would probably require resizing and moving of data 3408 * field, but that would probably require resizing and moving of data
3410 * within the beacon template. Simply request a new beacon and let 3409 * within the beacon template. Simply request a new beacon and let
3411 * mac80211 do the hard work. */ 3410 * mac80211 do the hard work. */
3412 beacon = ieee80211_beacon_get(hw, wl->vif, NULL); 3411 beacon = ieee80211_beacon_get(hw, wl->vif);
3413 if (unlikely(!beacon)) 3412 if (unlikely(!beacon))
3414 return -ENOMEM; 3413 return -ENOMEM;
3415 spin_lock_irqsave(&wl->irq_lock, flags); 3414 spin_lock_irqsave(&wl->irq_lock, flags);
@@ -3420,8 +3419,7 @@ static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,
3420} 3419}
3421 3420
3422static int b43legacy_op_ibss_beacon_update(struct ieee80211_hw *hw, 3421static int b43legacy_op_ibss_beacon_update(struct ieee80211_hw *hw,
3423 struct sk_buff *beacon, 3422 struct sk_buff *beacon)
3424 struct ieee80211_tx_control *ctl)
3425{ 3423{
3426 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 3424 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3427 unsigned long flags; 3425 unsigned long flags;
diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c
index 8d3d27d3cd67..a86c7647fa2d 100644
--- a/drivers/net/wireless/b43legacy/pio.c
+++ b/drivers/net/wireless/b43legacy/pio.c
@@ -196,7 +196,7 @@ static int pio_tx_write_fragment(struct b43legacy_pioqueue *queue,
196 B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0); 196 B43legacy_WARN_ON(skb_shinfo(skb)->nr_frags != 0);
197 err = b43legacy_generate_txhdr(queue->dev, 197 err = b43legacy_generate_txhdr(queue->dev,
198 txhdr, skb->data, skb->len, 198 txhdr, skb->data, skb->len,
199 &packet->txstat.control, 199 IEEE80211_SKB_CB(skb),
200 generate_cookie(queue, packet)); 200 generate_cookie(queue, packet));
201 if (err) 201 if (err)
202 return err; 202 return err;
@@ -463,8 +463,7 @@ err_destroy0:
463} 463}
464 464
465int b43legacy_pio_tx(struct b43legacy_wldev *dev, 465int b43legacy_pio_tx(struct b43legacy_wldev *dev,
466 struct sk_buff *skb, 466 struct sk_buff *skb)
467 struct ieee80211_tx_control *ctl)
468{ 467{
469 struct b43legacy_pioqueue *queue = dev->pio.queue1; 468 struct b43legacy_pioqueue *queue = dev->pio.queue1;
470 struct b43legacy_pio_txpacket *packet; 469 struct b43legacy_pio_txpacket *packet;
@@ -476,9 +475,6 @@ int b43legacy_pio_tx(struct b43legacy_wldev *dev,
476 list); 475 list);
477 packet->skb = skb; 476 packet->skb = skb;
478 477
479 memset(&packet->txstat, 0, sizeof(packet->txstat));
480 memcpy(&packet->txstat.control, ctl, sizeof(*ctl));
481
482 list_move_tail(&packet->list, &queue->txqueue); 478 list_move_tail(&packet->list, &queue->txqueue);
483 queue->nr_txfree--; 479 queue->nr_txfree--;
484 queue->nr_tx_packets++; 480 queue->nr_tx_packets++;
@@ -494,6 +490,7 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
494{ 490{
495 struct b43legacy_pioqueue *queue; 491 struct b43legacy_pioqueue *queue;
496 struct b43legacy_pio_txpacket *packet; 492 struct b43legacy_pio_txpacket *packet;
493 struct ieee80211_tx_info *info;
497 494
498 queue = parse_cookie(dev, status->cookie, &packet); 495 queue = parse_cookie(dev, status->cookie, &packet);
499 B43legacy_WARN_ON(!queue); 496 B43legacy_WARN_ON(!queue);
@@ -505,11 +502,13 @@ void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
505 queue->tx_devq_used -= (packet->skb->len + 502 queue->tx_devq_used -= (packet->skb->len +
506 sizeof(struct b43legacy_txhdr_fw3)); 503 sizeof(struct b43legacy_txhdr_fw3));
507 504
505 info = IEEE80211_SKB_CB(packet->skb);
506 memset(&info->status, 0, sizeof(info->status));
507
508 if (status->acked) 508 if (status->acked)
509 packet->txstat.flags |= IEEE80211_TX_STATUS_ACK; 509 info->flags |= IEEE80211_TX_STAT_ACK;
510 packet->txstat.retry_count = status->frame_count - 1; 510 info->status.retry_count = status->frame_count - 1;
511 ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb, 511 ieee80211_tx_status_irqsafe(dev->wl->hw, packet->skb);
512 &(packet->txstat));
513 packet->skb = NULL; 512 packet->skb = NULL;
514 513
515 free_txpacket(packet, 1); 514 free_txpacket(packet, 1);
diff --git a/drivers/net/wireless/b43legacy/pio.h b/drivers/net/wireless/b43legacy/pio.h
index 5bfed0c40030..49310dfaf2d1 100644
--- a/drivers/net/wireless/b43legacy/pio.h
+++ b/drivers/net/wireless/b43legacy/pio.h
@@ -41,7 +41,6 @@ struct b43legacy_xmitstatus;
41struct b43legacy_pio_txpacket { 41struct b43legacy_pio_txpacket {
42 struct b43legacy_pioqueue *queue; 42 struct b43legacy_pioqueue *queue;
43 struct sk_buff *skb; 43 struct sk_buff *skb;
44 struct ieee80211_tx_status txstat;
45 struct list_head list; 44 struct list_head list;
46}; 45};
47 46
@@ -104,8 +103,7 @@ int b43legacy_pio_init(struct b43legacy_wldev *dev);
104void b43legacy_pio_free(struct b43legacy_wldev *dev); 103void b43legacy_pio_free(struct b43legacy_wldev *dev);
105 104
106int b43legacy_pio_tx(struct b43legacy_wldev *dev, 105int b43legacy_pio_tx(struct b43legacy_wldev *dev,
107 struct sk_buff *skb, 106 struct sk_buff *skb);
108 struct ieee80211_tx_control *ctl);
109void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev, 107void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
110 const struct b43legacy_txstatus *status); 108 const struct b43legacy_txstatus *status);
111void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev, 109void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index 55dc251bf510..82dc04d59446 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -188,11 +188,11 @@ 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_control *txctl, 191 const 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;
195 int use_encryption = (!(txctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)); 195 int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT));
196 u16 fctl; 196 u16 fctl;
197 u8 rate; 197 u8 rate;
198 struct ieee80211_rate *rate_fb; 198 struct ieee80211_rate *rate_fb;
@@ -208,11 +208,11 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
208 208
209 memset(txhdr, 0, sizeof(*txhdr)); 209 memset(txhdr, 0, sizeof(*txhdr));
210 210
211 tx_rate = ieee80211_get_tx_rate(dev->wl->hw, txctl); 211 tx_rate = ieee80211_get_tx_rate(dev->wl->hw, info);
212 212
213 rate = tx_rate->hw_value; 213 rate = tx_rate->hw_value;
214 rate_ofdm = b43legacy_is_ofdm_rate(rate); 214 rate_ofdm = b43legacy_is_ofdm_rate(rate);
215 rate_fb = ieee80211_get_alt_retry_rate(dev->wl->hw, txctl) ? : tx_rate; 215 rate_fb = ieee80211_get_alt_retry_rate(dev->wl->hw, info) ? : tx_rate;
216 rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value); 216 rate_fb_ofdm = b43legacy_is_ofdm_rate(rate_fb->hw_value);
217 217
218 txhdr->mac_frame_ctl = wlhdr->frame_control; 218 txhdr->mac_frame_ctl = wlhdr->frame_control;
@@ -228,14 +228,14 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
228 txhdr->dur_fb = wlhdr->duration_id; 228 txhdr->dur_fb = wlhdr->duration_id;
229 } else { 229 } else {
230 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, 230 txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw,
231 txctl->vif, 231 info->control.vif,
232 fragment_len, 232 fragment_len,
233 rate_fb); 233 rate_fb);
234 } 234 }
235 235
236 plcp_fragment_len = fragment_len + FCS_LEN; 236 plcp_fragment_len = fragment_len + FCS_LEN;
237 if (use_encryption) { 237 if (use_encryption) {
238 u8 key_idx = txctl->hw_key->hw_key_idx; 238 u8 key_idx = info->control.hw_key->hw_key_idx;
239 struct b43legacy_key *key; 239 struct b43legacy_key *key;
240 int wlhdr_len; 240 int wlhdr_len;
241 size_t iv_len; 241 size_t iv_len;
@@ -245,7 +245,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
245 245
246 if (key->enabled) { 246 if (key->enabled) {
247 /* Hardware appends ICV. */ 247 /* Hardware appends ICV. */
248 plcp_fragment_len += txctl->icv_len; 248 plcp_fragment_len += info->control.icv_len;
249 249
250 key_idx = b43legacy_kidx_to_fw(dev, key_idx); 250 key_idx = b43legacy_kidx_to_fw(dev, key_idx);
251 mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) & 251 mac_ctl |= (key_idx << B43legacy_TX4_MAC_KEYIDX_SHIFT) &
@@ -254,7 +254,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
254 B43legacy_TX4_MAC_KEYALG_SHIFT) & 254 B43legacy_TX4_MAC_KEYALG_SHIFT) &
255 B43legacy_TX4_MAC_KEYALG; 255 B43legacy_TX4_MAC_KEYALG;
256 wlhdr_len = ieee80211_get_hdrlen(fctl); 256 wlhdr_len = ieee80211_get_hdrlen(fctl);
257 iv_len = min((size_t)txctl->iv_len, 257 iv_len = min((size_t)info->control.iv_len,
258 ARRAY_SIZE(txhdr->iv)); 258 ARRAY_SIZE(txhdr->iv));
259 memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len); 259 memcpy(txhdr->iv, ((u8 *)wlhdr) + wlhdr_len, iv_len);
260 } else { 260 } else {
@@ -278,7 +278,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
278 phy_ctl |= B43legacy_TX4_PHY_OFDM; 278 phy_ctl |= B43legacy_TX4_PHY_OFDM;
279 if (dev->short_preamble) 279 if (dev->short_preamble)
280 phy_ctl |= B43legacy_TX4_PHY_SHORTPRMBL; 280 phy_ctl |= B43legacy_TX4_PHY_SHORTPRMBL;
281 switch (txctl->antenna_sel_tx) { 281 switch (info->antenna_sel_tx) {
282 case 0: 282 case 0:
283 phy_ctl |= B43legacy_TX4_PHY_ANTLAST; 283 phy_ctl |= B43legacy_TX4_PHY_ANTLAST;
284 break; 284 break;
@@ -293,21 +293,21 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
293 } 293 }
294 294
295 /* MAC control */ 295 /* MAC control */
296 if (!(txctl->flags & IEEE80211_TXCTL_NO_ACK)) 296 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
297 mac_ctl |= B43legacy_TX4_MAC_ACK; 297 mac_ctl |= B43legacy_TX4_MAC_ACK;
298 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && 298 if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) &&
299 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL))) 299 ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)))
300 mac_ctl |= B43legacy_TX4_MAC_HWSEQ; 300 mac_ctl |= B43legacy_TX4_MAC_HWSEQ;
301 if (txctl->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) 301 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
302 mac_ctl |= B43legacy_TX4_MAC_STMSDU; 302 mac_ctl |= B43legacy_TX4_MAC_STMSDU;
303 if (rate_fb_ofdm) 303 if (rate_fb_ofdm)
304 mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM; 304 mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM;
305 if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) 305 if (info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT)
306 mac_ctl |= B43legacy_TX4_MAC_LONGFRAME; 306 mac_ctl |= B43legacy_TX4_MAC_LONGFRAME;
307 307
308 /* Generate the RTS or CTS-to-self frame */ 308 /* Generate the RTS or CTS-to-self frame */
309 if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 309 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
310 (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { 310 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
311 unsigned int len; 311 unsigned int len;
312 struct ieee80211_hdr *hdr; 312 struct ieee80211_hdr *hdr;
313 int rts_rate; 313 int rts_rate;
@@ -315,26 +315,26 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
315 int rts_rate_ofdm; 315 int rts_rate_ofdm;
316 int rts_rate_fb_ofdm; 316 int rts_rate_fb_ofdm;
317 317
318 rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, txctl)->hw_value; 318 rts_rate = ieee80211_get_rts_cts_rate(dev->wl->hw, info)->hw_value;
319 rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate); 319 rts_rate_ofdm = b43legacy_is_ofdm_rate(rts_rate);
320 rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate); 320 rts_rate_fb = b43legacy_calc_fallback_rate(rts_rate);
321 rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb); 321 rts_rate_fb_ofdm = b43legacy_is_ofdm_rate(rts_rate_fb);
322 if (rts_rate_fb_ofdm) 322 if (rts_rate_fb_ofdm)
323 mac_ctl |= B43legacy_TX4_MAC_CTSFALLBACKOFDM; 323 mac_ctl |= B43legacy_TX4_MAC_CTSFALLBACKOFDM;
324 324
325 if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 325 if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
326 ieee80211_ctstoself_get(dev->wl->hw, 326 ieee80211_ctstoself_get(dev->wl->hw,
327 txctl->vif, 327 info->control.vif,
328 fragment_data, 328 fragment_data,
329 fragment_len, txctl, 329 fragment_len, info,
330 (struct ieee80211_cts *) 330 (struct ieee80211_cts *)
331 (txhdr->rts_frame)); 331 (txhdr->rts_frame));
332 mac_ctl |= B43legacy_TX4_MAC_SENDCTS; 332 mac_ctl |= B43legacy_TX4_MAC_SENDCTS;
333 len = sizeof(struct ieee80211_cts); 333 len = sizeof(struct ieee80211_cts);
334 } else { 334 } else {
335 ieee80211_rts_get(dev->wl->hw, 335 ieee80211_rts_get(dev->wl->hw,
336 txctl->vif, 336 info->control.vif,
337 fragment_data, fragment_len, txctl, 337 fragment_data, fragment_len, info,
338 (struct ieee80211_rts *) 338 (struct ieee80211_rts *)
339 (txhdr->rts_frame)); 339 (txhdr->rts_frame));
340 mac_ctl |= B43legacy_TX4_MAC_SENDRTS; 340 mac_ctl |= B43legacy_TX4_MAC_SENDRTS;
@@ -365,12 +365,12 @@ int b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
365 u8 *txhdr, 365 u8 *txhdr,
366 const unsigned char *fragment_data, 366 const unsigned char *fragment_data,
367 unsigned int fragment_len, 367 unsigned int fragment_len,
368 const struct ieee80211_tx_control *txctl, 368 const struct ieee80211_tx_info *info,
369 u16 cookie) 369 u16 cookie)
370{ 370{
371 return generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr, 371 return generate_txhdr_fw3(dev, (struct b43legacy_txhdr_fw3 *)txhdr,
372 fragment_data, fragment_len, 372 fragment_data, fragment_len,
373 txctl, cookie); 373 info, cookie);
374} 374}
375 375
376static s8 b43legacy_rssi_postprocess(struct b43legacy_wldev *dev, 376static s8 b43legacy_rssi_postprocess(struct b43legacy_wldev *dev,
diff --git a/drivers/net/wireless/b43legacy/xmit.h b/drivers/net/wireless/b43legacy/xmit.h
index bab47928a0c9..e56777e0feab 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_control *txctl, 83 const 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 f3ca02fe9619..10c64bdb314c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -445,8 +445,7 @@ static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
445 */ 445 */
446static void rs_tx_status(void *priv_rate, 446static void rs_tx_status(void *priv_rate,
447 struct net_device *dev, 447 struct net_device *dev,
448 struct sk_buff *skb, 448 struct sk_buff *skb)
449 struct ieee80211_tx_status *tx_resp)
450{ 449{
451 u8 retries, current_count; 450 u8 retries, current_count;
452 int scale_rate_index, first_index, last_index; 451 int scale_rate_index, first_index, last_index;
@@ -457,14 +456,15 @@ static void rs_tx_status(void *priv_rate,
457 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 456 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
458 struct iwl3945_rs_sta *rs_sta; 457 struct iwl3945_rs_sta *rs_sta;
459 struct ieee80211_supported_band *sband; 458 struct ieee80211_supported_band *sband;
459 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
460 460
461 IWL_DEBUG_RATE("enter\n"); 461 IWL_DEBUG_RATE("enter\n");
462 462
463 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 463 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
464 464
465 465
466 retries = tx_resp->retry_count; 466 retries = info->status.retry_count;
467 first_index = sband->bitrates[tx_resp->control.tx_rate_idx].hw_value; 467 first_index = sband->bitrates[info->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;
@@ -525,11 +525,11 @@ static void rs_tx_status(void *priv_rate,
525 /* Update the last index window with success/failure based on ACK */ 525 /* Update the last index window with success/failure based on ACK */
526 IWL_DEBUG_RATE("Update rate %d with %s.\n", 526 IWL_DEBUG_RATE("Update rate %d with %s.\n",
527 last_index, 527 last_index,
528 (tx_resp->flags & IEEE80211_TX_STATUS_ACK) ? 528 (info->flags & IEEE80211_TX_STAT_ACK) ?
529 "success" : "failure"); 529 "success" : "failure");
530 iwl3945_collect_tx_data(rs_sta, 530 iwl3945_collect_tx_data(rs_sta,
531 &rs_sta->win[last_index], 531 &rs_sta->win[last_index],
532 tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1); 532 info->flags & IEEE80211_TX_STAT_ACK, 1);
533 533
534 /* We updated the rate scale window -- if its been more than 534 /* We updated the rate scale window -- if its been more than
535 * flush_time since the last run, schedule the flush 535 * flush_time since the last run, schedule the flush
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index f8e691f88ab3..0ba6889dfd41 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -283,8 +283,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv,
283 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 283 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
284 284
285 tx_info = &txq->txb[txq->q.read_ptr]; 285 tx_info = &txq->txb[txq->q.read_ptr];
286 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0], 286 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]);
287 &tx_info->status);
288 tx_info->skb[0] = NULL; 287 tx_info->skb[0] = NULL;
289 iwl3945_hw_txq_free_tfd(priv, txq); 288 iwl3945_hw_txq_free_tfd(priv, txq);
290 } 289 }
@@ -306,7 +305,7 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
306 int txq_id = SEQ_TO_QUEUE(sequence); 305 int txq_id = SEQ_TO_QUEUE(sequence);
307 int index = SEQ_TO_INDEX(sequence); 306 int index = SEQ_TO_INDEX(sequence);
308 struct iwl3945_tx_queue *txq = &priv->txq[txq_id]; 307 struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
309 struct ieee80211_tx_status *tx_status; 308 struct ieee80211_tx_info *info;
310 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 309 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
311 u32 status = le32_to_cpu(tx_resp->status); 310 u32 status = le32_to_cpu(tx_resp->status);
312 int rate_idx; 311 int rate_idx;
@@ -319,21 +318,22 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
319 return; 318 return;
320 } 319 }
321 320
322 tx_status = &(txq->txb[txq->q.read_ptr].status); 321 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
322 memset(&info->status, 0, sizeof(info->status));
323 323
324 tx_status->retry_count = tx_resp->failure_frame; 324 info->status.retry_count = tx_resp->failure_frame;
325 /* tx_status->rts_retry_count = tx_resp->failure_rts; */ 325 /* tx_status->rts_retry_count = tx_resp->failure_rts; */
326 tx_status->flags = ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? 326 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ?
327 IEEE80211_TX_STATUS_ACK : 0; 327 IEEE80211_TX_STAT_ACK : 0;
328 328
329 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n", 329 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n",
330 txq_id, iwl3945_get_tx_fail_reason(status), status, 330 txq_id, iwl3945_get_tx_fail_reason(status), status,
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 if (tx_status->control.band == IEEE80211_BAND_5GHZ) 334 if (info->band == IEEE80211_BAND_5GHZ)
335 rate_idx -= IWL_FIRST_OFDM_RATE; 335 rate_idx -= IWL_FIRST_OFDM_RATE;
336 tx_status->control.tx_rate_idx = rate_idx; 336 info->tx_rate_idx = rate_idx;
337 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 337 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
338 iwl3945_tx_queue_reclaim(priv, txq_id, index); 338 iwl3945_tx_queue_reclaim(priv, txq_id, index);
339 339
@@ -960,11 +960,11 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
960*/ 960*/
961void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, 961void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
962 struct iwl3945_cmd *cmd, 962 struct iwl3945_cmd *cmd,
963 struct ieee80211_tx_control *ctrl, 963 struct ieee80211_tx_info *info,
964 struct ieee80211_hdr *hdr, int sta_id, int tx_id) 964 struct ieee80211_hdr *hdr, int sta_id, int tx_id)
965{ 965{
966 unsigned long flags; 966 unsigned long flags;
967 u16 hw_value = ieee80211_get_tx_rate(priv->hw, ctrl)->hw_value; 967 u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value;
968 u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT - 1); 968 u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT - 1);
969 u16 rate_mask; 969 u16 rate_mask;
970 int rate; 970 int rate;
@@ -977,7 +977,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
977 tx_flags = cmd->cmd.tx.tx_flags; 977 tx_flags = cmd->cmd.tx.tx_flags;
978 978
979 /* We need to figure out how to get the sta->supp_rates while 979 /* We need to figure out how to get the sta->supp_rates while
980 * in this running context; perhaps encoding into ctrl->tx_rate? */ 980 * in this running context */
981 rate_mask = IWL_RATES_MASK; 981 rate_mask = IWL_RATES_MASK;
982 982
983 spin_lock_irqsave(&priv->sta_lock, flags); 983 spin_lock_irqsave(&priv->sta_lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 9fdc1405e853..835c5b4320e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -124,7 +124,6 @@ int iwl3945_x2_queue_used(const struct iwl3945_queue *q, int i);
124 124
125/* One for each TFD */ 125/* One for each TFD */
126struct iwl3945_tx_info { 126struct iwl3945_tx_info {
127 struct ieee80211_tx_status status;
128 struct sk_buff *skb[MAX_NUM_OF_TBS]; 127 struct sk_buff *skb[MAX_NUM_OF_TBS];
129}; 128};
130 129
@@ -645,7 +644,7 @@ extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
645extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv); 644extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv);
646extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, 645extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
647 struct iwl3945_cmd *cmd, 646 struct iwl3945_cmd *cmd,
648 struct ieee80211_tx_control *ctrl, 647 struct ieee80211_tx_info *info,
649 struct ieee80211_hdr *hdr, 648 struct ieee80211_hdr *hdr,
650 int sta_id, int tx_id); 649 int sta_id, int tx_id);
651extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv); 650extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 7993a1d83025..f28b3cc272df 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -785,8 +785,7 @@ out:
785 * mac80211 sends us Tx status 785 * mac80211 sends us Tx status
786 */ 786 */
787static void rs_tx_status(void *priv_rate, struct net_device *dev, 787static void rs_tx_status(void *priv_rate, struct net_device *dev,
788 struct sk_buff *skb, 788 struct sk_buff *skb)
789 struct ieee80211_tx_status *tx_resp)
790{ 789{
791 int status; 790 int status;
792 u8 retries; 791 u8 retries;
@@ -798,6 +797,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
798 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 797 struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
799 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 798 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
800 struct ieee80211_hw *hw = local_to_hw(local); 799 struct ieee80211_hw *hw = local_to_hw(local);
800 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
801 struct iwl4965_rate_scale_data *window = NULL; 801 struct iwl4965_rate_scale_data *window = NULL;
802 struct iwl4965_rate_scale_data *search_win = NULL; 802 struct iwl4965_rate_scale_data *search_win = NULL;
803 u32 tx_rate; 803 u32 tx_rate;
@@ -813,11 +813,11 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
813 return; 813 return;
814 814
815 /* This packet was aggregated but doesn't carry rate scale info */ 815 /* This packet was aggregated but doesn't carry rate scale info */
816 if ((tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) && 816 if ((info->flags & IEEE80211_TX_CTL_AMPDU) &&
817 !(tx_resp->flags & IEEE80211_TX_STATUS_AMPDU)) 817 !(info->flags & IEEE80211_TX_STAT_AMPDU))
818 return; 818 return;
819 819
820 retries = tx_resp->retry_count; 820 retries = info->status.retry_count;
821 821
822 if (retries > 15) 822 if (retries > 15)
823 retries = 15; 823 retries = 15;
@@ -862,20 +862,20 @@ 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_idx < 0) || 865 if ((info->tx_rate_idx < 0) ||
866 (tbl_type.is_SGI ^ 866 (tbl_type.is_SGI ^
867 !!(tx_resp->control.flags & IEEE80211_TXCTL_SHORT_GI)) || 867 !!(info->flags & IEEE80211_TX_CTL_SHORT_GI)) ||
868 (tbl_type.is_fat ^ 868 (tbl_type.is_fat ^
869 !!(tx_resp->control.flags & IEEE80211_TXCTL_40_MHZ_WIDTH)) || 869 !!(info->flags & IEEE80211_TX_CTL_40_MHZ_WIDTH)) ||
870 (tbl_type.is_dup ^ 870 (tbl_type.is_dup ^
871 !!(tx_resp->control.flags & IEEE80211_TXCTL_DUP_DATA)) || 871 !!(info->flags & IEEE80211_TX_CTL_DUP_DATA)) ||
872 (tbl_type.ant_type ^ tx_resp->control.antenna_sel_tx) || 872 (tbl_type.ant_type ^ info->antenna_sel_tx) ||
873 (!!(tx_rate & RATE_MCS_HT_MSK) ^ 873 (!!(tx_rate & RATE_MCS_HT_MSK) ^
874 !!(tx_resp->control.flags & IEEE80211_TXCTL_OFDM_HT)) || 874 !!(info->flags & IEEE80211_TX_CTL_OFDM_HT)) ||
875 (!!(tx_rate & RATE_MCS_GF_MSK) ^ 875 (!!(tx_rate & RATE_MCS_GF_MSK) ^
876 !!(tx_resp->control.flags & IEEE80211_TXCTL_GREEN_FIELD)) || 876 !!(info->flags & IEEE80211_TX_CTL_GREEN_FIELD)) ||
877 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != 877 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
878 hw->wiphy->bands[tx_resp->control.band]->bitrates[tx_resp->control.tx_rate_idx].bitrate)) { 878 hw->wiphy->bands[info->band]->bitrates[info->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 }
@@ -929,10 +929,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
929 rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); 929 rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index);
930 930
931 /* Update frame history window with "success" if Tx got ACKed ... */ 931 /* Update frame history window with "success" if Tx got ACKed ... */
932 if (tx_resp->flags & IEEE80211_TX_STATUS_ACK) 932 status = !!(info->flags & IEEE80211_TX_STAT_ACK);
933 status = 1;
934 else
935 status = 0;
936 933
937 /* If type matches "search" table, 934 /* If type matches "search" table,
938 * add final tx status to "search" history */ 935 * add final tx status to "search" history */
@@ -943,10 +940,10 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
943 tpt = search_tbl->expected_tpt[rs_index]; 940 tpt = search_tbl->expected_tpt[rs_index];
944 else 941 else
945 tpt = 0; 942 tpt = 0;
946 if (tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) 943 if (info->flags & IEEE80211_TX_CTL_AMPDU)
947 rs_collect_tx_data(search_win, rs_index, tpt, 944 rs_collect_tx_data(search_win, rs_index, tpt,
948 tx_resp->ampdu_ack_len, 945 info->status.ampdu_ack_len,
949 tx_resp->ampdu_ack_map); 946 info->status.ampdu_ack_map);
950 else 947 else
951 rs_collect_tx_data(search_win, rs_index, tpt, 948 rs_collect_tx_data(search_win, rs_index, tpt,
952 1, status); 949 1, status);
@@ -959,10 +956,10 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
959 tpt = curr_tbl->expected_tpt[rs_index]; 956 tpt = curr_tbl->expected_tpt[rs_index];
960 else 957 else
961 tpt = 0; 958 tpt = 0;
962 if (tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) 959 if (info->flags & IEEE80211_TX_CTL_AMPDU)
963 rs_collect_tx_data(window, rs_index, tpt, 960 rs_collect_tx_data(window, rs_index, tpt,
964 tx_resp->ampdu_ack_len, 961 info->status.ampdu_ack_len,
965 tx_resp->ampdu_ack_map); 962 info->status.ampdu_ack_map);
966 else 963 else
967 rs_collect_tx_data(window, rs_index, tpt, 964 rs_collect_tx_data(window, rs_index, tpt,
968 1, status); 965 1, status);
@@ -971,10 +968,10 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
971 /* If not searching for new mode, increment success/failed counter 968 /* If not searching for new mode, increment success/failed counter
972 * ... these help determine when to start searching again */ 969 * ... these help determine when to start searching again */
973 if (lq_sta->stay_in_tbl) { 970 if (lq_sta->stay_in_tbl) {
974 if (tx_resp->control.flags & IEEE80211_TXCTL_AMPDU) { 971 if (info->flags & IEEE80211_TX_CTL_AMPDU) {
975 lq_sta->total_success += tx_resp->ampdu_ack_map; 972 lq_sta->total_success += info->status.ampdu_ack_map;
976 lq_sta->total_failed += 973 lq_sta->total_failed +=
977 (tx_resp->ampdu_ack_len - tx_resp->ampdu_ack_map); 974 (info->status.ampdu_ack_len - info->status.ampdu_ack_map);
978 } else { 975 } else {
979 if (status) 976 if (status)
980 lq_sta->total_success++; 977 lq_sta->total_success++;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index fb670b5cfebb..ca9ca92bb7fd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -357,22 +357,22 @@ int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags)
357 * translate ucode response to mac80211 tx status control values 357 * translate ucode response to mac80211 tx status control values
358 */ 358 */
359void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, 359void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
360 struct ieee80211_tx_control *control) 360 struct ieee80211_tx_info *control)
361{ 361{
362 int rate_index; 362 int rate_index;
363 363
364 control->antenna_sel_tx = 364 control->antenna_sel_tx =
365 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); 365 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
366 if (rate_n_flags & RATE_MCS_HT_MSK) 366 if (rate_n_flags & RATE_MCS_HT_MSK)
367 control->flags |= IEEE80211_TXCTL_OFDM_HT; 367 control->flags |= IEEE80211_TX_CTL_OFDM_HT;
368 if (rate_n_flags & RATE_MCS_GF_MSK) 368 if (rate_n_flags & RATE_MCS_GF_MSK)
369 control->flags |= IEEE80211_TXCTL_GREEN_FIELD; 369 control->flags |= IEEE80211_TX_CTL_GREEN_FIELD;
370 if (rate_n_flags & RATE_MCS_FAT_MSK) 370 if (rate_n_flags & RATE_MCS_FAT_MSK)
371 control->flags |= IEEE80211_TXCTL_40_MHZ_WIDTH; 371 control->flags |= IEEE80211_TX_CTL_40_MHZ_WIDTH;
372 if (rate_n_flags & RATE_MCS_DUP_MSK) 372 if (rate_n_flags & RATE_MCS_DUP_MSK)
373 control->flags |= IEEE80211_TXCTL_DUP_DATA; 373 control->flags |= IEEE80211_TX_CTL_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_TX_CTL_SHORT_GI;
376 rate_index = iwl4965_hwrate_to_plcp_idx(rate_n_flags); 376 rate_index = iwl4965_hwrate_to_plcp_idx(rate_n_flags);
377 if (control->band == IEEE80211_BAND_5GHZ) 377 if (control->band == IEEE80211_BAND_5GHZ)
378 rate_index -= IWL_FIRST_OFDM_RATE; 378 rate_index -= IWL_FIRST_OFDM_RATE;
@@ -3007,7 +3007,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
3007 u16 scd_flow = le16_to_cpu(ba_resp->scd_flow); 3007 u16 scd_flow = le16_to_cpu(ba_resp->scd_flow);
3008 u64 bitmap; 3008 u64 bitmap;
3009 int successes = 0; 3009 int successes = 0;
3010 struct ieee80211_tx_status *tx_status; 3010 struct ieee80211_tx_info *info;
3011 3011
3012 if (unlikely(!agg->wait_for_ba)) { 3012 if (unlikely(!agg->wait_for_ba)) {
3013 IWL_ERROR("Received BA when not expected\n"); 3013 IWL_ERROR("Received BA when not expected\n");
@@ -3045,13 +3045,13 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
3045 agg->start_idx + i); 3045 agg->start_idx + i);
3046 } 3046 }
3047 3047
3048 tx_status = &priv->txq[scd_flow].txb[agg->start_idx].status; 3048 info = IEEE80211_SKB_CB(priv->txq[scd_flow].txb[agg->start_idx].skb[0]);
3049 tx_status->flags = IEEE80211_TX_STATUS_ACK; 3049 memset(&info->status, 0, sizeof(info->status));
3050 tx_status->flags |= IEEE80211_TX_STATUS_AMPDU; 3050 info->flags = IEEE80211_TX_STAT_ACK;
3051 tx_status->ampdu_ack_map = successes; 3051 info->flags |= IEEE80211_TX_STAT_AMPDU;
3052 tx_status->ampdu_ack_len = agg->frame_count; 3052 info->status.ampdu_ack_map = successes;
3053 iwl4965_hwrate_to_tx_control(priv, agg->rate_n_flags, 3053 info->status.ampdu_ack_len = agg->frame_count;
3054 &tx_status->control); 3054 iwl4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info);
3055 3055
3056 IWL_DEBUG_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap); 3056 IWL_DEBUG_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap);
3057 3057
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index a8d062f7b87a..ad7422eadab2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -207,8 +207,7 @@ void iwl_rx_allocate(struct iwl_priv *priv);
207* TX 207* TX
208******************************************************/ 208******************************************************/
209int iwl_txq_ctx_reset(struct iwl_priv *priv); 209int iwl_txq_ctx_reset(struct iwl_priv *priv);
210int iwl_tx_skb(struct iwl_priv *priv, 210int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb);
211 struct sk_buff *skb, struct ieee80211_tx_control *ctl);
212/* FIXME: remove when free Tx is fully merged into iwlcore */ 211/* FIXME: remove when free Tx is fully merged into iwlcore */
213int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq); 212int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);
214void iwl_hw_txq_ctx_free(struct iwl_priv *priv); 213void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 820542bac443..f7fd8ea61779 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -119,7 +119,6 @@ struct iwl_queue {
119 119
120/* One for each TFD */ 120/* One for each TFD */
121struct iwl_tx_info { 121struct iwl_tx_info {
122 struct ieee80211_tx_status status;
123 struct sk_buff *skb[MAX_NUM_OF_TBS]; 122 struct sk_buff *skb[MAX_NUM_OF_TBS];
124}; 123};
125 124
@@ -693,7 +692,7 @@ extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
693 struct iwl_frame *frame, u8 rate); 692 struct iwl_frame *frame, u8 rate);
694extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, 693extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
695 struct iwl_cmd *cmd, 694 struct iwl_cmd *cmd,
696 struct ieee80211_tx_control *ctrl, 695 struct ieee80211_tx_info *info,
697 struct ieee80211_hdr *hdr, 696 struct ieee80211_hdr *hdr,
698 int sta_id, int tx_id); 697 int sta_id, int tx_id);
699extern int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv); 698extern int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv);
@@ -749,7 +748,7 @@ extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
749extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); 748extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
750extern void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, 749extern void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv,
751 u32 rate_n_flags, 750 u32 rate_n_flags,
752 struct ieee80211_tx_control *control); 751 struct ieee80211_tx_info *info);
753 752
754#ifdef CONFIG_IWL4965_HT 753#ifdef CONFIG_IWL4965_HT
755extern void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv, 754extern void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 4b5149c8c32e..a61293ba3f6b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -502,7 +502,7 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv)
502 */ 502 */
503static void iwl_tx_cmd_build_basic(struct iwl_priv *priv, 503static void iwl_tx_cmd_build_basic(struct iwl_priv *priv,
504 struct iwl_tx_cmd *tx_cmd, 504 struct iwl_tx_cmd *tx_cmd,
505 struct ieee80211_tx_control *ctrl, 505 struct ieee80211_tx_info *info,
506 struct ieee80211_hdr *hdr, 506 struct ieee80211_hdr *hdr,
507 int is_unicast, u8 std_id) 507 int is_unicast, u8 std_id)
508{ 508{
@@ -510,7 +510,7 @@ static void iwl_tx_cmd_build_basic(struct iwl_priv *priv,
510 __le32 tx_flags = tx_cmd->tx_flags; 510 __le32 tx_flags = tx_cmd->tx_flags;
511 511
512 tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 512 tx_cmd->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
513 if (!(ctrl->flags & IEEE80211_TXCTL_NO_ACK)) { 513 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
514 tx_flags |= TX_CMD_FLG_ACK_MSK; 514 tx_flags |= TX_CMD_FLG_ACK_MSK;
515 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) 515 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)
516 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 516 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
@@ -538,10 +538,10 @@ static void iwl_tx_cmd_build_basic(struct iwl_priv *priv,
538 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 538 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
539 } 539 }
540 540
541 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 541 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
542 tx_flags |= TX_CMD_FLG_RTS_MSK; 542 tx_flags |= TX_CMD_FLG_RTS_MSK;
543 tx_flags &= ~TX_CMD_FLG_CTS_MSK; 543 tx_flags &= ~TX_CMD_FLG_CTS_MSK;
544 } else if (ctrl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 544 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
545 tx_flags &= ~TX_CMD_FLG_RTS_MSK; 545 tx_flags &= ~TX_CMD_FLG_RTS_MSK;
546 tx_flags |= TX_CMD_FLG_CTS_MSK; 546 tx_flags |= TX_CMD_FLG_CTS_MSK;
547 } 547 }
@@ -570,7 +570,7 @@ static void iwl_tx_cmd_build_basic(struct iwl_priv *priv,
570 570
571static void iwl_tx_cmd_build_rate(struct iwl_priv *priv, 571static void iwl_tx_cmd_build_rate(struct iwl_priv *priv,
572 struct iwl_tx_cmd *tx_cmd, 572 struct iwl_tx_cmd *tx_cmd,
573 struct ieee80211_tx_control *ctrl, 573 struct ieee80211_tx_info *info,
574 u16 fc, int sta_id, 574 u16 fc, int sta_id,
575 int is_hcca) 575 int is_hcca)
576{ 576{
@@ -580,7 +580,7 @@ static void iwl_tx_cmd_build_rate(struct iwl_priv *priv,
580 u16 rate_flags = 0; 580 u16 rate_flags = 0;
581 int rate_idx; 581 int rate_idx;
582 582
583 rate_idx = min(ieee80211_get_tx_rate(priv->hw, ctrl)->hw_value & 0xffff, 583 rate_idx = min(ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xffff,
584 IWL_RATE_COUNT - 1); 584 IWL_RATE_COUNT - 1);
585 585
586 rate_plcp = iwl_rates[rate_idx].plcp; 586 rate_plcp = iwl_rates[rate_idx].plcp;
@@ -637,18 +637,18 @@ static void iwl_tx_cmd_build_rate(struct iwl_priv *priv,
637} 637}
638 638
639static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv, 639static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
640 struct ieee80211_tx_control *ctl, 640 struct ieee80211_tx_info *info,
641 struct iwl_tx_cmd *tx_cmd, 641 struct iwl_tx_cmd *tx_cmd,
642 struct sk_buff *skb_frag, 642 struct sk_buff *skb_frag,
643 int sta_id) 643 int sta_id)
644{ 644{
645 struct ieee80211_key_conf *keyconf = ctl->hw_key; 645 struct ieee80211_key_conf *keyconf = info->control.hw_key;
646 646
647 switch (keyconf->alg) { 647 switch (keyconf->alg) {
648 case ALG_CCMP: 648 case ALG_CCMP:
649 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 649 tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
650 memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); 650 memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
651 if (ctl->flags & IEEE80211_TXCTL_AMPDU) 651 if (info->flags & IEEE80211_TX_CTL_AMPDU)
652 tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK; 652 tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK;
653 IWL_DEBUG_TX("tx_cmd with aes hwcrypto\n"); 653 IWL_DEBUG_TX("tx_cmd with aes hwcrypto\n");
654 break; 654 break;
@@ -690,13 +690,13 @@ static void iwl_update_tx_stats(struct iwl_priv *priv, u16 fc, u16 len)
690/* 690/*
691 * start REPLY_TX command process 691 * start REPLY_TX command process
692 */ 692 */
693int iwl_tx_skb(struct iwl_priv *priv, 693int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
694 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
695{ 694{
696 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 695 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
696 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
697 struct iwl_tfd_frame *tfd; 697 struct iwl_tfd_frame *tfd;
698 u32 *control_flags; 698 u32 *control_flags;
699 int txq_id = ctl->queue; 699 int txq_id = info->queue;
700 struct iwl_tx_queue *txq = NULL; 700 struct iwl_tx_queue *txq = NULL;
701 struct iwl_queue *q = NULL; 701 struct iwl_queue *q = NULL;
702 dma_addr_t phys_addr; 702 dma_addr_t phys_addr;
@@ -726,7 +726,7 @@ int iwl_tx_skb(struct iwl_priv *priv,
726 goto drop_unlock; 726 goto drop_unlock;
727 } 727 }
728 728
729 if ((ieee80211_get_tx_rate(priv->hw, ctl)->hw_value & 0xFF) == 729 if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) ==
730 IWL_INVALID_RATE) { 730 IWL_INVALID_RATE) {
731 IWL_ERROR("ERROR: No TX rate available.\n"); 731 IWL_ERROR("ERROR: No TX rate available.\n");
732 goto drop_unlock; 732 goto drop_unlock;
@@ -782,7 +782,7 @@ int iwl_tx_skb(struct iwl_priv *priv,
782 seq_number += 0x10; 782 seq_number += 0x10;
783#ifdef CONFIG_IWL4965_HT 783#ifdef CONFIG_IWL4965_HT
784 /* aggregation is on for this <sta,tid> */ 784 /* aggregation is on for this <sta,tid> */
785 if (ctl->flags & IEEE80211_TXCTL_AMPDU) 785 if (info->flags & IEEE80211_TX_CTL_AMPDU)
786 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; 786 txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
787 priv->stations[sta_id].tid[tid].tfds_in_queue++; 787 priv->stations[sta_id].tid[tid].tfds_in_queue++;
788#endif /* CONFIG_IWL4965_HT */ 788#endif /* CONFIG_IWL4965_HT */
@@ -803,8 +803,6 @@ int iwl_tx_skb(struct iwl_priv *priv,
803 /* Set up driver data for this TFD */ 803 /* Set up driver data for this TFD */
804 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); 804 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
805 txq->txb[q->write_ptr].skb[0] = skb; 805 txq->txb[q->write_ptr].skb[0] = skb;
806 memcpy(&(txq->txb[q->write_ptr].status.control),
807 ctl, sizeof(struct ieee80211_tx_control));
808 806
809 /* Set up first empty entry in queue's array of Tx/cmd buffers */ 807 /* Set up first empty entry in queue's array of Tx/cmd buffers */
810 out_cmd = &txq->cmd[idx]; 808 out_cmd = &txq->cmd[idx];
@@ -854,8 +852,8 @@ int iwl_tx_skb(struct iwl_priv *priv,
854 * first entry */ 852 * first entry */
855 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 853 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
856 854
857 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 855 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
858 iwl_tx_cmd_build_hwcrypto(priv, ctl, tx_cmd, skb, sta_id); 856 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
859 857
860 /* Set up TFD's 2nd entry to point directly to remainder of skb, 858 /* Set up TFD's 2nd entry to point directly to remainder of skb,
861 * if any (802.11 null frames have no payload). */ 859 * if any (802.11 null frames have no payload). */
@@ -874,10 +872,10 @@ int iwl_tx_skb(struct iwl_priv *priv,
874 len = (u16)skb->len; 872 len = (u16)skb->len;
875 tx_cmd->len = cpu_to_le16(len); 873 tx_cmd->len = cpu_to_le16(len);
876 /* TODO need this for burst mode later on */ 874 /* TODO need this for burst mode later on */
877 iwl_tx_cmd_build_basic(priv, tx_cmd, ctl, hdr, unicast, sta_id); 875 iwl_tx_cmd_build_basic(priv, tx_cmd, info, hdr, unicast, sta_id);
878 876
879 /* set is_hcca to 0; it probably will never be implemented */ 877 /* set is_hcca to 0; it probably will never be implemented */
880 iwl_tx_cmd_build_rate(priv, tx_cmd, ctl, fc, sta_id, 0); 878 iwl_tx_cmd_build_rate(priv, tx_cmd, info, fc, sta_id, 0);
881 879
882 iwl_update_tx_stats(priv, fc, len); 880 iwl_update_tx_stats(priv, fc, len);
883 881
@@ -919,7 +917,7 @@ int iwl_tx_skb(struct iwl_priv *priv,
919 spin_unlock_irqrestore(&priv->lock, flags); 917 spin_unlock_irqrestore(&priv->lock, flags);
920 } 918 }
921 919
922 ieee80211_stop_queue(priv->hw, ctl->queue); 920 ieee80211_stop_queue(priv->hw, info->queue);
923 } 921 }
924 922
925 return 0; 923 return 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index a28b4c9f6524..a740a1817d16 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2376,13 +2376,13 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
2376} 2376}
2377 2377
2378static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv, 2378static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2379 struct ieee80211_tx_control *ctl, 2379 struct ieee80211_tx_info *info,
2380 struct iwl3945_cmd *cmd, 2380 struct iwl3945_cmd *cmd,
2381 struct sk_buff *skb_frag, 2381 struct sk_buff *skb_frag,
2382 int last_frag) 2382 int last_frag)
2383{ 2383{
2384 struct iwl3945_hw_key *keyinfo = 2384 struct iwl3945_hw_key *keyinfo =
2385 &priv->stations[ctl->hw_key->hw_key_idx].keyinfo; 2385 &priv->stations[info->control.hw_key->hw_key_idx].keyinfo;
2386 2386
2387 switch (keyinfo->alg) { 2387 switch (keyinfo->alg) {
2388 case ALG_CCMP: 2388 case ALG_CCMP:
@@ -2405,7 +2405,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2405 2405
2406 case ALG_WEP: 2406 case ALG_WEP:
2407 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP | 2407 cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
2408 (ctl->hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; 2408 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
2409 2409
2410 if (keyinfo->keylen == 13) 2410 if (keyinfo->keylen == 13)
2411 cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128; 2411 cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
@@ -2413,7 +2413,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2413 memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen); 2413 memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
2414 2414
2415 IWL_DEBUG_TX("Configuring packet for WEP encryption " 2415 IWL_DEBUG_TX("Configuring packet for WEP encryption "
2416 "with key %d\n", ctl->hw_key->hw_key_idx); 2416 "with key %d\n", info->control.hw_key->hw_key_idx);
2417 break; 2417 break;
2418 2418
2419 default: 2419 default:
@@ -2427,7 +2427,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
2427 */ 2427 */
2428static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv, 2428static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2429 struct iwl3945_cmd *cmd, 2429 struct iwl3945_cmd *cmd,
2430 struct ieee80211_tx_control *ctrl, 2430 struct ieee80211_tx_info *info,
2431 struct ieee80211_hdr *hdr, 2431 struct ieee80211_hdr *hdr,
2432 int is_unicast, u8 std_id) 2432 int is_unicast, u8 std_id)
2433{ 2433{
@@ -2435,7 +2435,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2435 __le32 tx_flags = cmd->cmd.tx.tx_flags; 2435 __le32 tx_flags = cmd->cmd.tx.tx_flags;
2436 2436
2437 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2437 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2438 if (!(ctrl->flags & IEEE80211_TXCTL_NO_ACK)) { 2438 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
2439 tx_flags |= TX_CMD_FLG_ACK_MSK; 2439 tx_flags |= TX_CMD_FLG_ACK_MSK;
2440 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) 2440 if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)
2441 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2441 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
@@ -2459,10 +2459,10 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2459 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2459 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2460 } 2460 }
2461 2461
2462 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 2462 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
2463 tx_flags |= TX_CMD_FLG_RTS_MSK; 2463 tx_flags |= TX_CMD_FLG_RTS_MSK;
2464 tx_flags &= ~TX_CMD_FLG_CTS_MSK; 2464 tx_flags &= ~TX_CMD_FLG_CTS_MSK;
2465 } else if (ctrl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 2465 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
2466 tx_flags &= ~TX_CMD_FLG_RTS_MSK; 2466 tx_flags &= ~TX_CMD_FLG_RTS_MSK;
2467 tx_flags |= TX_CMD_FLG_CTS_MSK; 2467 tx_flags |= TX_CMD_FLG_CTS_MSK;
2468 } 2468 }
@@ -2546,13 +2546,13 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2546/* 2546/*
2547 * start REPLY_TX command process 2547 * start REPLY_TX command process
2548 */ 2548 */
2549static int iwl3945_tx_skb(struct iwl3945_priv *priv, 2549static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2550 struct sk_buff *skb, struct ieee80211_tx_control *ctl)
2551{ 2550{
2552 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2551 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2552 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2553 struct iwl3945_tfd_frame *tfd; 2553 struct iwl3945_tfd_frame *tfd;
2554 u32 *control_flags; 2554 u32 *control_flags;
2555 int txq_id = ctl->queue; 2555 int txq_id = info->queue;
2556 struct iwl3945_tx_queue *txq = NULL; 2556 struct iwl3945_tx_queue *txq = NULL;
2557 struct iwl3945_queue *q = NULL; 2557 struct iwl3945_queue *q = NULL;
2558 dma_addr_t phys_addr; 2558 dma_addr_t phys_addr;
@@ -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 ((ieee80211_get_tx_rate(priv->hw, ctl)->hw_value & 0xFF) == IWL_INVALID_RATE) { 2584 if ((ieee80211_get_tx_rate(priv->hw, info)->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 }
@@ -2650,8 +2650,6 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2650 /* Set up driver data for this TFD */ 2650 /* Set up driver data for this TFD */
2651 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info)); 2651 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info));
2652 txq->txb[q->write_ptr].skb[0] = skb; 2652 txq->txb[q->write_ptr].skb[0] = skb;
2653 memcpy(&(txq->txb[q->write_ptr].status.control),
2654 ctl, sizeof(struct ieee80211_tx_control));
2655 2653
2656 /* Init first empty entry in queue's array of Tx/cmd buffers */ 2654 /* Init first empty entry in queue's array of Tx/cmd buffers */
2657 out_cmd = &txq->cmd[idx]; 2655 out_cmd = &txq->cmd[idx];
@@ -2700,8 +2698,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2700 * first entry */ 2698 * first entry */
2701 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2699 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2702 2700
2703 if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 2701 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
2704 iwl3945_build_tx_cmd_hwcrypto(priv, ctl, out_cmd, skb, 0); 2702 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
2705 2703
2706 /* Set up TFD's 2nd entry to point directly to remainder of skb, 2704 /* Set up TFD's 2nd entry to point directly to remainder of skb,
2707 * if any (802.11 null frames have no payload). */ 2705 * if any (802.11 null frames have no payload). */
@@ -2726,10 +2724,10 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2726 out_cmd->cmd.tx.len = cpu_to_le16(len); 2724 out_cmd->cmd.tx.len = cpu_to_le16(len);
2727 2725
2728 /* TODO need this for burst mode later on */ 2726 /* TODO need this for burst mode later on */
2729 iwl3945_build_tx_cmd_basic(priv, out_cmd, ctl, hdr, unicast, sta_id); 2727 iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, unicast, sta_id);
2730 2728
2731 /* set is_hcca to 0; it probably will never be implemented */ 2729 /* set is_hcca to 0; it probably will never be implemented */
2732 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0); 2730 iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
2733 2731
2734 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 2732 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
2735 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 2733 out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
@@ -2767,7 +2765,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2767 spin_unlock_irqrestore(&priv->lock, flags); 2765 spin_unlock_irqrestore(&priv->lock, flags);
2768 } 2766 }
2769 2767
2770 ieee80211_stop_queue(priv->hw, ctl->queue); 2768 ieee80211_stop_queue(priv->hw, info->queue);
2771 } 2769 }
2772 2770
2773 return 0; 2771 return 0;
@@ -3230,7 +3228,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work)
3230 struct sk_buff *beacon; 3228 struct sk_buff *beacon;
3231 3229
3232 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 3230 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
3233 beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); 3231 beacon = ieee80211_beacon_get(priv->hw, priv->vif);
3234 3232
3235 if (!beacon) { 3233 if (!beacon) {
3236 IWL_ERROR("update beacon failed\n"); 3234 IWL_ERROR("update beacon failed\n");
@@ -6681,8 +6679,7 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
6681 IWL_DEBUG_MAC80211("leave\n"); 6679 IWL_DEBUG_MAC80211("leave\n");
6682} 6680}
6683 6681
6684static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 6682static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
6685 struct ieee80211_tx_control *ctl)
6686{ 6683{
6687 struct iwl3945_priv *priv = hw->priv; 6684 struct iwl3945_priv *priv = hw->priv;
6688 6685
@@ -6694,9 +6691,9 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
6694 } 6691 }
6695 6692
6696 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6693 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
6697 ieee80211_get_tx_rate(hw, ctl)->bitrate); 6694 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
6698 6695
6699 if (iwl3945_tx_skb(priv, skb, ctl)) 6696 if (iwl3945_tx_skb(priv, skb))
6700 dev_kfree_skb_any(skb); 6697 dev_kfree_skb_any(skb);
6701 6698
6702 IWL_DEBUG_MAC80211("leave\n"); 6699 IWL_DEBUG_MAC80211("leave\n");
@@ -7333,8 +7330,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
7333 7330
7334} 7331}
7335 7332
7336static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 7333static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
7337 struct ieee80211_tx_control *control)
7338{ 7334{
7339 struct iwl3945_priv *priv = hw->priv; 7335 struct iwl3945_priv *priv = hw->priv;
7340 unsigned long flags; 7336 unsigned long flags;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 1fad6227aa51..07c52b69d1e2 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1606,17 +1606,7 @@ static int iwl4965_get_measurement(struct iwl_priv *priv,
1606static void iwl4965_txstatus_to_ieee(struct iwl_priv *priv, 1606static void iwl4965_txstatus_to_ieee(struct iwl_priv *priv,
1607 struct iwl_tx_info *tx_sta) 1607 struct iwl_tx_info *tx_sta)
1608{ 1608{
1609 1609 ieee80211_tx_status_irqsafe(priv->hw, tx_sta->skb[0]);
1610 tx_sta->status.ack_signal = 0;
1611 tx_sta->status.excessive_retries = 0;
1612
1613 if (in_interrupt())
1614 ieee80211_tx_status_irqsafe(priv->hw,
1615 tx_sta->skb[0], &(tx_sta->status));
1616 else
1617 ieee80211_tx_status(priv->hw,
1618 tx_sta->skb[0], &(tx_sta->status));
1619
1620 tx_sta->skb[0] = NULL; 1610 tx_sta->skb[0] = NULL;
1621} 1611}
1622 1612
@@ -1710,7 +1700,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1710{ 1700{
1711 u16 status; 1701 u16 status;
1712 struct agg_tx_status *frame_status = &tx_resp->status; 1702 struct agg_tx_status *frame_status = &tx_resp->status;
1713 struct ieee80211_tx_status *tx_status = NULL; 1703 struct ieee80211_tx_info *info = NULL;
1714 struct ieee80211_hdr *hdr = NULL; 1704 struct ieee80211_hdr *hdr = NULL;
1715 int i, sh; 1705 int i, sh;
1716 int txq_id, idx; 1706 int txq_id, idx;
@@ -1736,14 +1726,14 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
1736 IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n", 1726 IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n",
1737 agg->frame_count, agg->start_idx, idx); 1727 agg->frame_count, agg->start_idx, idx);
1738 1728
1739 tx_status = &(priv->txq[txq_id].txb[idx].status); 1729 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
1740 tx_status->retry_count = tx_resp->failure_frame; 1730 info->status.retry_count = tx_resp->failure_frame;
1741 tx_status->control.flags &= ~IEEE80211_TXCTL_AMPDU; 1731 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1742 tx_status->flags = iwl4965_is_tx_success(status)? 1732 info->flags |= iwl4965_is_tx_success(status)?
1743 IEEE80211_TX_STATUS_ACK : 0; 1733 IEEE80211_TX_STAT_ACK : 0;
1744 iwl4965_hwrate_to_tx_control(priv, 1734 iwl4965_hwrate_to_tx_control(priv,
1745 le32_to_cpu(tx_resp->rate_n_flags), 1735 le32_to_cpu(tx_resp->rate_n_flags),
1746 &tx_status->control); 1736 info);
1747 /* FIXME: code repetition end */ 1737 /* FIXME: code repetition end */
1748 1738
1749 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n", 1739 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
@@ -1830,7 +1820,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
1830 int txq_id = SEQ_TO_QUEUE(sequence); 1820 int txq_id = SEQ_TO_QUEUE(sequence);
1831 int index = SEQ_TO_INDEX(sequence); 1821 int index = SEQ_TO_INDEX(sequence);
1832 struct iwl_tx_queue *txq = &priv->txq[txq_id]; 1822 struct iwl_tx_queue *txq = &priv->txq[txq_id];
1833 struct ieee80211_tx_status *tx_status; 1823 struct ieee80211_tx_info *info;
1834 struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 1824 struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
1835 u32 status = le32_to_cpu(tx_resp->status); 1825 u32 status = le32_to_cpu(tx_resp->status);
1836#ifdef CONFIG_IWL4965_HT 1826#ifdef CONFIG_IWL4965_HT
@@ -1848,6 +1838,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
1848 return; 1838 return;
1849 } 1839 }
1850 1840
1841 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
1842 memset(&info->status, 0, sizeof(info->status));
1843
1851#ifdef CONFIG_IWL4965_HT 1844#ifdef CONFIG_IWL4965_HT
1852 hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, index); 1845 hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, index);
1853 fc = le16_to_cpu(hdr->frame_control); 1846 fc = le16_to_cpu(hdr->frame_control);
@@ -1902,13 +1895,12 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
1902 } 1895 }
1903 } else { 1896 } else {
1904#endif /* CONFIG_IWL4965_HT */ 1897#endif /* CONFIG_IWL4965_HT */
1905 tx_status = &(txq->txb[txq->q.read_ptr].status);
1906 1898
1907 tx_status->retry_count = tx_resp->failure_frame; 1899 info->status.retry_count = tx_resp->failure_frame;
1908 tx_status->flags = 1900 info->flags |=
1909 iwl4965_is_tx_success(status) ? IEEE80211_TX_STATUS_ACK : 0; 1901 iwl4965_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
1910 iwl4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), 1902 iwl4965_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
1911 &tx_status->control); 1903 info);
1912 1904
1913 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x " 1905 IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) rate_n_flags 0x%x "
1914 "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status), 1906 "retries %d\n", txq_id, iwl4965_get_tx_fail_reason(status),
@@ -2053,7 +2045,7 @@ static void iwl4965_bg_beacon_update(struct work_struct *work)
2053 struct sk_buff *beacon; 2045 struct sk_buff *beacon;
2054 2046
2055 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 2047 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
2056 beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); 2048 beacon = ieee80211_beacon_get(priv->hw, priv->vif);
2057 2049
2058 if (!beacon) { 2050 if (!beacon) {
2059 IWL_ERROR("update beacon failed\n"); 2051 IWL_ERROR("update beacon failed\n");
@@ -4268,8 +4260,7 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
4268 IWL_DEBUG_MAC80211("leave\n"); 4260 IWL_DEBUG_MAC80211("leave\n");
4269} 4261}
4270 4262
4271static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 4263static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
4272 struct ieee80211_tx_control *ctl)
4273{ 4264{
4274 struct iwl_priv *priv = hw->priv; 4265 struct iwl_priv *priv = hw->priv;
4275 4266
@@ -4281,9 +4272,9 @@ static int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
4281 } 4272 }
4282 4273
4283 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 4274 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
4284 ieee80211_get_tx_rate(hw, ctl)->bitrate); 4275 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
4285 4276
4286 if (iwl_tx_skb(priv, skb, ctl)) 4277 if (iwl_tx_skb(priv, skb))
4287 dev_kfree_skb_any(skb); 4278 dev_kfree_skb_any(skb);
4288 4279
4289 IWL_DEBUG_MAC80211("leave\n"); 4280 IWL_DEBUG_MAC80211("leave\n");
@@ -5065,8 +5056,7 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
5065 IWL_DEBUG_MAC80211("leave\n"); 5056 IWL_DEBUG_MAC80211("leave\n");
5066} 5057}
5067 5058
5068static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 5059static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
5069 struct ieee80211_tx_control *control)
5070{ 5060{
5071 struct iwl_priv *priv = hw->priv; 5061 struct iwl_priv *priv = hw->priv;
5072 unsigned long flags; 5062 unsigned long flags;
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 3ca9386561ff..850857932e29 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -394,7 +394,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
394 while (entry != (struct sk_buff *)&priv->tx_queue) { 394 while (entry != (struct sk_buff *)&priv->tx_queue) {
395 range = (struct memrecord *)&entry->cb; 395 range = (struct memrecord *)&entry->cb;
396 if (range->start_addr == addr) { 396 if (range->start_addr == addr) {
397 struct ieee80211_tx_status status; 397 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
398 struct p54_control_hdr *entry_hdr; 398 struct p54_control_hdr *entry_hdr;
399 struct p54_tx_control_allocdata *entry_data; 399 struct p54_tx_control_allocdata *entry_data;
400 int pad = 0; 400 int pad = 0;
@@ -406,30 +406,23 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
406 406
407 last_addr = range->end_addr; 407 last_addr = range->end_addr;
408 __skb_unlink(entry, &priv->tx_queue); 408 __skb_unlink(entry, &priv->tx_queue);
409 if (!range->control) { 409 memset(&info->status, 0, sizeof(info->status));
410 kfree_skb(entry); 410 priv->tx_stats[info->queue].len--;
411 break;
412 }
413 memset(&status, 0, sizeof(status));
414 memcpy(&status.control, range->control,
415 sizeof(status.control));
416 kfree(range->control);
417 priv->tx_stats[status.control.queue].len--;
418 entry_hdr = (struct p54_control_hdr *) entry->data; 411 entry_hdr = (struct p54_control_hdr *) entry->data;
419 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 412 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
420 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 413 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
421 pad = entry_data->align[0]; 414 pad = entry_data->align[0];
422 415
423 if (!(status.control.flags & IEEE80211_TXCTL_NO_ACK)) { 416 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
424 if (!(payload->status & 0x01)) 417 if (!(payload->status & 0x01))
425 status.flags |= IEEE80211_TX_STATUS_ACK; 418 info->flags |= IEEE80211_TX_STAT_ACK;
426 else 419 else
427 status.excessive_retries = 1; 420 info->status.excessive_retries = 1;
428 } 421 }
429 status.retry_count = payload->retries - 1; 422 info->status.retry_count = payload->retries - 1;
430 status.ack_signal = le16_to_cpu(payload->ack_rssi); 423 info->status.ack_signal = le16_to_cpu(payload->ack_rssi);
431 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data)); 424 skb_pull(entry, sizeof(*hdr) + pad + sizeof(*entry_data));
432 ieee80211_tx_status_irqsafe(dev, entry, &status); 425 ieee80211_tx_status_irqsafe(dev, entry);
433 break; 426 break;
434 } else 427 } else
435 last_addr = range->end_addr; 428 last_addr = range->end_addr;
@@ -494,13 +487,11 @@ EXPORT_SYMBOL_GPL(p54_rx);
494 * allocated areas. 487 * allocated areas.
495 */ 488 */
496static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, 489static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
497 struct p54_control_hdr *data, u32 len, 490 struct p54_control_hdr *data, u32 len)
498 struct ieee80211_tx_control *control)
499{ 491{
500 struct p54_common *priv = dev->priv; 492 struct p54_common *priv = dev->priv;
501 struct sk_buff *entry = priv->tx_queue.next; 493 struct sk_buff *entry = priv->tx_queue.next;
502 struct sk_buff *target_skb = NULL; 494 struct sk_buff *target_skb = NULL;
503 struct memrecord *range;
504 u32 last_addr = priv->rx_start; 495 u32 last_addr = priv->rx_start;
505 u32 largest_hole = 0; 496 u32 largest_hole = 0;
506 u32 target_addr = priv->rx_start; 497 u32 target_addr = priv->rx_start;
@@ -512,7 +503,8 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
512 left = skb_queue_len(&priv->tx_queue); 503 left = skb_queue_len(&priv->tx_queue);
513 while (left--) { 504 while (left--) {
514 u32 hole_size; 505 u32 hole_size;
515 range = (struct memrecord *)&entry->cb; 506 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry);
507 struct memrecord *range = (void *)info->driver_data;
516 hole_size = range->start_addr - last_addr; 508 hole_size = range->start_addr - last_addr;
517 if (!target_skb && hole_size >= len) { 509 if (!target_skb && hole_size >= len) {
518 target_skb = entry->prev; 510 target_skb = entry->prev;
@@ -527,17 +519,18 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
527 target_skb = priv->tx_queue.prev; 519 target_skb = priv->tx_queue.prev;
528 largest_hole = max(largest_hole, priv->rx_end - last_addr - len); 520 largest_hole = max(largest_hole, priv->rx_end - last_addr - len);
529 if (!skb_queue_empty(&priv->tx_queue)) { 521 if (!skb_queue_empty(&priv->tx_queue)) {
530 range = (struct memrecord *)&target_skb->cb; 522 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(target_skb);
523 struct memrecord *range = (void *)info->driver_data;
531 target_addr = range->end_addr; 524 target_addr = range->end_addr;
532 } 525 }
533 } else 526 } else
534 largest_hole = max(largest_hole, priv->rx_end - last_addr); 527 largest_hole = max(largest_hole, priv->rx_end - last_addr);
535 528
536 if (skb) { 529 if (skb) {
537 range = (struct memrecord *)&skb->cb; 530 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
531 struct memrecord *range = (void *)info->driver_data;
538 range->start_addr = target_addr; 532 range->start_addr = target_addr;
539 range->end_addr = target_addr + len; 533 range->end_addr = target_addr + len;
540 range->control = control;
541 __skb_queue_after(&priv->tx_queue, target_skb, skb); 534 __skb_queue_after(&priv->tx_queue, target_skb, skb);
542 if (largest_hole < IEEE80211_MAX_RTS_THRESHOLD + 0x170 + 535 if (largest_hole < IEEE80211_MAX_RTS_THRESHOLD + 0x170 +
543 sizeof(struct p54_control_hdr)) 536 sizeof(struct p54_control_hdr))
@@ -548,32 +541,27 @@ static void p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
548 data->req_id = cpu_to_le32(target_addr + 0x70); 541 data->req_id = cpu_to_le32(target_addr + 0x70);
549} 542}
550 543
551static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb, 544static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
552 struct ieee80211_tx_control *control)
553{ 545{
546 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
554 struct ieee80211_tx_queue_stats *current_queue; 547 struct ieee80211_tx_queue_stats *current_queue;
555 struct p54_common *priv = dev->priv; 548 struct p54_common *priv = dev->priv;
556 struct p54_control_hdr *hdr; 549 struct p54_control_hdr *hdr;
557 struct p54_tx_control_allocdata *txhdr; 550 struct p54_tx_control_allocdata *txhdr;
558 struct ieee80211_tx_control *control_copy;
559 size_t padding, len; 551 size_t padding, len;
560 u8 rate; 552 u8 rate;
561 553
562 current_queue = &priv->tx_stats[control->queue]; 554 current_queue = &priv->tx_stats[info->queue];
563 if (unlikely(current_queue->len > current_queue->limit)) 555 if (unlikely(current_queue->len > current_queue->limit))
564 return NETDEV_TX_BUSY; 556 return NETDEV_TX_BUSY;
565 current_queue->len++; 557 current_queue->len++;
566 current_queue->count++; 558 current_queue->count++;
567 if (current_queue->len == current_queue->limit) 559 if (current_queue->len == current_queue->limit)
568 ieee80211_stop_queue(dev, control->queue); 560 ieee80211_stop_queue(dev, info->queue);
569 561
570 padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; 562 padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3;
571 len = skb->len; 563 len = skb->len;
572 564
573 control_copy = kmalloc(sizeof(*control), GFP_ATOMIC);
574 if (control_copy)
575 memcpy(control_copy, control, sizeof(*control));
576
577 txhdr = (struct p54_tx_control_allocdata *) 565 txhdr = (struct p54_tx_control_allocdata *)
578 skb_push(skb, sizeof(*txhdr) + padding); 566 skb_push(skb, sizeof(*txhdr) + padding);
579 hdr = (struct p54_control_hdr *) skb_push(skb, sizeof(*hdr)); 567 hdr = (struct p54_control_hdr *) skb_push(skb, sizeof(*hdr));
@@ -583,35 +571,37 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
583 else 571 else
584 hdr->magic1 = cpu_to_le16(0x0010); 572 hdr->magic1 = cpu_to_le16(0x0010);
585 hdr->len = cpu_to_le16(len); 573 hdr->len = cpu_to_le16(len);
586 hdr->type = (control->flags & IEEE80211_TXCTL_NO_ACK) ? 0 : cpu_to_le16(1); 574 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1);
587 hdr->retry1 = hdr->retry2 = control->retry_limit; 575 hdr->retry1 = hdr->retry2 = info->control.retry_limit;
588 p54_assign_address(dev, skb, hdr, skb->len, control_copy);
589 576
590 memset(txhdr->wep_key, 0x0, 16); 577 memset(txhdr->wep_key, 0x0, 16);
591 txhdr->padding = 0; 578 txhdr->padding = 0;
592 txhdr->padding2 = 0; 579 txhdr->padding2 = 0;
593 580
594 /* TODO: add support for alternate retry TX rates */ 581 /* TODO: add support for alternate retry TX rates */
595 rate = ieee80211_get_tx_rate(dev, control)->hw_value; 582 rate = ieee80211_get_tx_rate(dev, info)->hw_value;
596 if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) 583 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE)
597 rate |= 0x10; 584 rate |= 0x10;
598 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 585 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
599 rate |= 0x40; 586 rate |= 0x40;
600 else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 587 else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
601 rate |= 0x20; 588 rate |= 0x20;
602 memset(txhdr->rateset, rate, 8); 589 memset(txhdr->rateset, rate, 8);
603 txhdr->wep_key_present = 0; 590 txhdr->wep_key_present = 0;
604 txhdr->wep_key_len = 0; 591 txhdr->wep_key_len = 0;
605 txhdr->frame_type = cpu_to_le32(control->queue + 4); 592 txhdr->frame_type = cpu_to_le32(info->queue + 4);
606 txhdr->magic4 = 0; 593 txhdr->magic4 = 0;
607 txhdr->antenna = (control->antenna_sel_tx == 0) ? 594 txhdr->antenna = (info->antenna_sel_tx == 0) ?
608 2 : control->antenna_sel_tx - 1; 595 2 : info->antenna_sel_tx - 1;
609 txhdr->output_power = 0x7f; // HW Maximum 596 txhdr->output_power = 0x7f; // HW Maximum
610 txhdr->magic5 = (control->flags & IEEE80211_TXCTL_NO_ACK) ? 597 txhdr->magic5 = (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
611 0 : ((rate > 0x3) ? cpu_to_le32(0x33) : cpu_to_le32(0x23)); 598 0 : ((rate > 0x3) ? cpu_to_le32(0x33) : cpu_to_le32(0x23));
612 if (padding) 599 if (padding)
613 txhdr->align[0] = padding; 600 txhdr->align[0] = padding;
614 601
602 /* modifies skb->cb and with it info, so must be last! */
603 p54_assign_address(dev, skb, hdr, skb->len);
604
615 priv->tx(dev, hdr, skb->len, 0); 605 priv->tx(dev, hdr, skb->len, 0);
616 return 0; 606 return 0;
617} 607}
@@ -634,7 +624,7 @@ static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type,
634 filter = (struct p54_tx_control_filter *) hdr->data; 624 filter = (struct p54_tx_control_filter *) hdr->data;
635 hdr->magic1 = cpu_to_le16(0x8001); 625 hdr->magic1 = cpu_to_le16(0x8001);
636 hdr->len = cpu_to_le16(sizeof(*filter)); 626 hdr->len = cpu_to_le16(sizeof(*filter));
637 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*filter), NULL); 627 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*filter));
638 hdr->type = cpu_to_le16(P54_CONTROL_TYPE_FILTER_SET); 628 hdr->type = cpu_to_le16(P54_CONTROL_TYPE_FILTER_SET);
639 629
640 filter->filter_type = cpu_to_le16(filter_type); 630 filter->filter_type = cpu_to_le16(filter_type);
@@ -678,7 +668,7 @@ static int p54_set_freq(struct ieee80211_hw *dev, __le16 freq)
678 hdr->magic1 = cpu_to_le16(0x8001); 668 hdr->magic1 = cpu_to_le16(0x8001);
679 hdr->len = cpu_to_le16(sizeof(*chan)); 669 hdr->len = cpu_to_le16(sizeof(*chan));
680 hdr->type = cpu_to_le16(P54_CONTROL_TYPE_CHANNEL_CHANGE); 670 hdr->type = cpu_to_le16(P54_CONTROL_TYPE_CHANNEL_CHANGE);
681 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + payload_len, NULL); 671 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + payload_len);
682 672
683 chan->magic1 = cpu_to_le16(0x1); 673 chan->magic1 = cpu_to_le16(0x1);
684 chan->magic2 = cpu_to_le16(0x0); 674 chan->magic2 = cpu_to_le16(0x0);
@@ -751,7 +741,7 @@ static int p54_set_leds(struct ieee80211_hw *dev, int mode, int link, int act)
751 hdr->magic1 = cpu_to_le16(0x8001); 741 hdr->magic1 = cpu_to_le16(0x8001);
752 hdr->len = cpu_to_le16(sizeof(*led)); 742 hdr->len = cpu_to_le16(sizeof(*led));
753 hdr->type = cpu_to_le16(P54_CONTROL_TYPE_LED); 743 hdr->type = cpu_to_le16(P54_CONTROL_TYPE_LED);
754 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*led), NULL); 744 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*led));
755 745
756 led = (struct p54_tx_control_led *) hdr->data; 746 led = (struct p54_tx_control_led *) hdr->data;
757 led->mode = cpu_to_le16(mode); 747 led->mode = cpu_to_le16(mode);
@@ -801,7 +791,7 @@ static void p54_set_vdcf(struct ieee80211_hw *dev)
801 791
802 hdr = (void *)priv->cached_vdcf + priv->tx_hdr_len; 792 hdr = (void *)priv->cached_vdcf + priv->tx_hdr_len;
803 793
804 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*vdcf), NULL); 794 p54_assign_address(dev, NULL, hdr, sizeof(*hdr) + sizeof(*vdcf));
805 795
806 vdcf = (struct p54_tx_control_vdcf *) hdr->data; 796 vdcf = (struct p54_tx_control_vdcf *) hdr->data;
807 797
@@ -837,12 +827,8 @@ static void p54_stop(struct ieee80211_hw *dev)
837{ 827{
838 struct p54_common *priv = dev->priv; 828 struct p54_common *priv = dev->priv;
839 struct sk_buff *skb; 829 struct sk_buff *skb;
840 while ((skb = skb_dequeue(&priv->tx_queue))) { 830 while ((skb = skb_dequeue(&priv->tx_queue)))
841 struct memrecord *range = (struct memrecord *)&skb->cb;
842 if (range->control)
843 kfree(range->control);
844 kfree_skb(skb); 831 kfree_skb(skb);
845 }
846 priv->stop(dev); 832 priv->stop(dev);
847 priv->mode = IEEE80211_IF_TYPE_INVALID; 833 priv->mode = IEEE80211_IF_TYPE_INVALID;
848} 834}
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h
index c15b56e1d75e..2245fcce92dc 100644
--- a/drivers/net/wireless/p54/p54common.h
+++ b/drivers/net/wireless/p54/p54common.h
@@ -152,7 +152,6 @@ struct pda_pa_curve_data {
152struct memrecord { 152struct memrecord {
153 u32 start_addr; 153 u32 start_addr;
154 u32 end_addr; 154 u32 end_addr;
155 struct ieee80211_tx_control *control;
156}; 155};
157 156
158struct p54_eeprom_lm86 { 157struct p54_eeprom_lm86 {
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 4fcba9b4635f..900140d3b304 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1484,11 +1484,11 @@ static u64 rt2400pci_get_tsf(struct ieee80211_hw *hw)
1484 return tsf; 1484 return tsf;
1485} 1485}
1486 1486
1487static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 1487static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1488 struct ieee80211_tx_control *control)
1489{ 1488{
1490 struct rt2x00_dev *rt2x00dev = hw->priv; 1489 struct rt2x00_dev *rt2x00dev = hw->priv;
1491 struct rt2x00_intf *intf = vif_to_intf(control->vif); 1490 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1491 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1492 struct queue_entry_priv_pci *entry_priv; 1492 struct queue_entry_priv_pci *entry_priv;
1493 struct skb_frame_desc *skbdesc; 1493 struct skb_frame_desc *skbdesc;
1494 struct txentry_desc txdesc; 1494 struct txentry_desc txdesc;
@@ -1504,7 +1504,7 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1504 * for our information. 1504 * for our information.
1505 */ 1505 */
1506 intf->beacon->skb = skb; 1506 intf->beacon->skb = skb;
1507 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control); 1507 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1508 1508
1509 /* 1509 /*
1510 * Fill in skb descriptor 1510 * Fill in skb descriptor
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 06e87cdff455..673350953b89 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1799,11 +1799,11 @@ static u64 rt2500pci_get_tsf(struct ieee80211_hw *hw)
1799 return tsf; 1799 return tsf;
1800} 1800}
1801 1801
1802static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 1802static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1803 struct ieee80211_tx_control *control)
1804{ 1803{
1805 struct rt2x00_dev *rt2x00dev = hw->priv; 1804 struct rt2x00_dev *rt2x00dev = hw->priv;
1806 struct rt2x00_intf *intf = vif_to_intf(control->vif); 1805 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1806 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1807 struct queue_entry_priv_pci *entry_priv; 1807 struct queue_entry_priv_pci *entry_priv;
1808 struct skb_frame_desc *skbdesc; 1808 struct skb_frame_desc *skbdesc;
1809 struct txentry_desc txdesc; 1809 struct txentry_desc txdesc;
@@ -1820,7 +1820,7 @@ static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1820 * for our information. 1820 * for our information.
1821 */ 1821 */
1822 intf->beacon->skb = skb; 1822 intf->beacon->skb = skb;
1823 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control); 1823 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1824 1824
1825 /* 1825 /*
1826 * Fill in skb descriptor 1826 * Fill in skb descriptor
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 4122c5ebe7c3..cca1504550dc 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1666,13 +1666,12 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
1666/* 1666/*
1667 * IEEE80211 stack callback functions. 1667 * IEEE80211 stack callback functions.
1668 */ 1668 */
1669static int rt2500usb_beacon_update(struct ieee80211_hw *hw, 1669static int rt2500usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1670 struct sk_buff *skb,
1671 struct ieee80211_tx_control *control)
1672{ 1670{
1673 struct rt2x00_dev *rt2x00dev = hw->priv; 1671 struct rt2x00_dev *rt2x00dev = hw->priv;
1674 struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); 1672 struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev);
1675 struct rt2x00_intf *intf = vif_to_intf(control->vif); 1673 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1674 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1676 struct queue_entry_priv_usb_bcn *bcn_priv; 1675 struct queue_entry_priv_usb_bcn *bcn_priv;
1677 struct skb_frame_desc *skbdesc; 1676 struct skb_frame_desc *skbdesc;
1678 struct txentry_desc txdesc; 1677 struct txentry_desc txdesc;
@@ -1691,7 +1690,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
1691 * for our information. 1690 * for our information.
1692 */ 1691 */
1693 intf->beacon->skb = skb; 1692 intf->beacon->skb = skb;
1694 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control); 1693 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1695 1694
1696 /* 1695 /*
1697 * Add the descriptor in front of the skb. 1696 * Add the descriptor in front of the skb.
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 1900d4c0e846..5c7220ea46e6 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -542,8 +542,7 @@ struct rt2x00lib_ops {
542 struct sk_buff *skb, 542 struct sk_buff *skb,
543 struct txentry_desc *txdesc); 543 struct txentry_desc *txdesc);
544 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, 544 int (*write_tx_data) (struct rt2x00_dev *rt2x00dev,
545 struct data_queue *queue, struct sk_buff *skb, 545 struct data_queue *queue, struct sk_buff *skb);
546 struct ieee80211_tx_control *control);
547 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, 546 int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev,
548 struct sk_buff *skb); 547 struct sk_buff *skb);
549 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, 548 void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
@@ -930,7 +929,6 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)
930 * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input 929 * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input
931 * @entry: The entry which will be used to transfer the TX frame. 930 * @entry: The entry which will be used to transfer the TX frame.
932 * @txdesc: rt2x00 TX descriptor which will be initialized by this function. 931 * @txdesc: rt2x00 TX descriptor which will be initialized by this function.
933 * @control: mac80211 TX control structure from where we read the information.
934 * 932 *
935 * This function will initialize the &struct txentry_desc based on information 933 * This function will initialize the &struct txentry_desc based on information
936 * from mac80211. This descriptor can then be used by rt2x00lib and the drivers 934 * from mac80211. This descriptor can then be used by rt2x00lib and the drivers
@@ -943,8 +941,7 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)
943 * the &struct txentry_desc structure. 941 * the &struct txentry_desc structure.
944 */ 942 */
945void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, 943void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
946 struct txentry_desc *txdesc, 944 struct txentry_desc *txdesc);
947 struct ieee80211_tx_control *control);
948 945
949/** 946/**
950 * rt2x00queue_write_tx_descriptor - Write TX descriptor to hardware 947 * rt2x00queue_write_tx_descriptor - Write TX descriptor to hardware
@@ -1001,8 +998,7 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
1001/* 998/*
1002 * mac80211 handlers. 999 * mac80211 handlers.
1003 */ 1000 */
1004int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 1001int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
1005 struct ieee80211_tx_control *control);
1006int rt2x00mac_start(struct ieee80211_hw *hw); 1002int rt2x00mac_start(struct ieee80211_hw *hw);
1007void rt2x00mac_stop(struct ieee80211_hw *hw); 1003void rt2x00mac_stop(struct ieee80211_hw *hw);
1008int rt2x00mac_add_interface(struct ieee80211_hw *hw, 1004int rt2x00mac_add_interface(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index d341764e1b24..69e233610c94 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -415,7 +415,6 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
415 struct rt2x00_dev *rt2x00dev = data; 415 struct rt2x00_dev *rt2x00dev = data;
416 struct rt2x00_intf *intf = vif_to_intf(vif); 416 struct rt2x00_intf *intf = vif_to_intf(vif);
417 struct sk_buff *skb; 417 struct sk_buff *skb;
418 struct ieee80211_tx_control control;
419 struct ieee80211_bss_conf conf; 418 struct ieee80211_bss_conf conf;
420 int delayed_flags; 419 int delayed_flags;
421 420
@@ -433,9 +432,9 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
433 spin_unlock(&intf->lock); 432 spin_unlock(&intf->lock);
434 433
435 if (delayed_flags & DELAYED_UPDATE_BEACON) { 434 if (delayed_flags & DELAYED_UPDATE_BEACON) {
436 skb = ieee80211_beacon_get(rt2x00dev->hw, vif, &control); 435 skb = ieee80211_beacon_get(rt2x00dev->hw, vif);
437 if (skb && rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, 436 if (skb &&
438 skb, &control)) 437 rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, skb))
439 dev_kfree_skb(skb); 438 dev_kfree_skb(skb);
440 } 439 }
441 440
@@ -494,8 +493,13 @@ void rt2x00lib_txdone(struct queue_entry *entry,
494 struct txdone_entry_desc *txdesc) 493 struct txdone_entry_desc *txdesc)
495{ 494{
496 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 495 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
497 struct skb_frame_desc *skbdesc; 496 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
498 struct ieee80211_tx_status tx_status; 497
498 /*
499 * Send frame to debugfs immediately, after this call is completed
500 * we are going to overwrite the skb->cb array.
501 */
502 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry->skb);
499 503
500 /* 504 /*
501 * Update TX statistics. 505 * Update TX statistics.
@@ -508,21 +512,20 @@ void rt2x00lib_txdone(struct queue_entry *entry,
508 /* 512 /*
509 * Initialize TX status 513 * Initialize TX status
510 */ 514 */
511 tx_status.flags = 0; 515 memset(&tx_info->status, 0, sizeof(tx_info->status));
512 tx_status.ack_signal = 0; 516 tx_info->status.ack_signal = 0;
513 tx_status.excessive_retries = 517 tx_info->status.excessive_retries =
514 test_bit(TXDONE_EXCESSIVE_RETRY, &txdesc->flags); 518 test_bit(TXDONE_EXCESSIVE_RETRY, &txdesc->flags);
515 tx_status.retry_count = txdesc->retry; 519 tx_info->status.retry_count = txdesc->retry;
516 memcpy(&tx_status.control, txdesc->control, sizeof(*txdesc->control));
517 520
518 if (!(tx_status.control.flags & IEEE80211_TXCTL_NO_ACK)) { 521 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
519 if (test_bit(TXDONE_SUCCESS, &txdesc->flags)) 522 if (test_bit(TXDONE_SUCCESS, &txdesc->flags))
520 tx_status.flags |= IEEE80211_TX_STATUS_ACK; 523 tx_info->flags |= IEEE80211_TX_STAT_ACK;
521 else if (test_bit(TXDONE_FAILURE, &txdesc->flags)) 524 else if (test_bit(TXDONE_FAILURE, &txdesc->flags))
522 rt2x00dev->low_level_stats.dot11ACKFailureCount++; 525 rt2x00dev->low_level_stats.dot11ACKFailureCount++;
523 } 526 }
524 527
525 if (tx_status.control.flags & IEEE80211_TXCTL_USE_RTS_CTS) { 528 if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
526 if (test_bit(TXDONE_SUCCESS, &txdesc->flags)) 529 if (test_bit(TXDONE_SUCCESS, &txdesc->flags))
527 rt2x00dev->low_level_stats.dot11RTSSuccessCount++; 530 rt2x00dev->low_level_stats.dot11RTSSuccessCount++;
528 else if (test_bit(TXDONE_FAILURE, &txdesc->flags)) 531 else if (test_bit(TXDONE_FAILURE, &txdesc->flags))
@@ -530,19 +533,13 @@ void rt2x00lib_txdone(struct queue_entry *entry,
530 } 533 }
531 534
532 /* 535 /*
533 * Send the tx_status to debugfs. Only send the status report 536 * Only send the status report to mac80211 when TX status was
534 * to mac80211 when the frame originated from there. If this was 537 * requested by it. If this was a extra frame coming through
535 * a extra frame coming through a mac80211 library call (RTS/CTS) 538 * a mac80211 library call (RTS/CTS) then we should not send the
536 * then we should not send the status report back. 539 * status report back.
537 * If send to mac80211, mac80211 will clean up the skb structure,
538 * otherwise we have to do it ourself.
539 */ 540 */
540 rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry->skb); 541 if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)
541 542 ieee80211_tx_status_irqsafe(rt2x00dev->hw, entry->skb);
542 skbdesc = get_skb_frame_desc(entry->skb);
543 if (!(skbdesc->flags & FRAME_DESC_DRIVER_GENERATED))
544 ieee80211_tx_status_irqsafe(rt2x00dev->hw,
545 entry->skb, &tx_status);
546 else 543 else
547 dev_kfree_skb_irq(entry->skb); 544 dev_kfree_skb_irq(entry->skb);
548 entry->skb = NULL; 545 entry->skb = NULL;
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index c5cedb29b87d..b5379b027b18 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -31,14 +31,15 @@
31 31
32static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev, 32static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
33 struct data_queue *queue, 33 struct data_queue *queue,
34 struct sk_buff *frag_skb, 34 struct sk_buff *frag_skb)
35 struct ieee80211_tx_control *control)
36{ 35{
36 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(frag_skb);
37 struct skb_frame_desc *skbdesc; 37 struct skb_frame_desc *skbdesc;
38 struct ieee80211_tx_info *rts_info;
38 struct sk_buff *skb; 39 struct sk_buff *skb;
39 int size; 40 int size;
40 41
41 if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 42 if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
42 size = sizeof(struct ieee80211_cts); 43 size = sizeof(struct ieee80211_cts);
43 else 44 else
44 size = sizeof(struct ieee80211_rts); 45 size = sizeof(struct ieee80211_rts);
@@ -52,13 +53,33 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
52 skb_reserve(skb, rt2x00dev->hw->extra_tx_headroom); 53 skb_reserve(skb, rt2x00dev->hw->extra_tx_headroom);
53 skb_put(skb, size); 54 skb_put(skb, size);
54 55
55 if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 56 /*
56 ieee80211_ctstoself_get(rt2x00dev->hw, control->vif, 57 * Copy TX information over from original frame to
57 frag_skb->data, frag_skb->len, control, 58 * RTS/CTS frame. Note that we set the no encryption flag
59 * since we don't want this frame to be encrypted.
60 * RTS frames should be acked, while CTS-to-self frames
61 * should not. The ready for TX flag is cleared to prevent
62 * it being automatically send when the descriptor is
63 * written to the hardware.
64 */
65 memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb));
66 rts_info = IEEE80211_SKB_CB(skb);
67 rts_info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
68 rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT;
69 rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
70
71 if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
72 rts_info->flags |= IEEE80211_TX_CTL_NO_ACK;
73 else
74 rts_info->flags &= ~IEEE80211_TX_CTL_NO_ACK;
75
76 if (tx_info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
77 ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif,
78 frag_skb->data, size, tx_info,
58 (struct ieee80211_cts *)(skb->data)); 79 (struct ieee80211_cts *)(skb->data));
59 else 80 else
60 ieee80211_rts_get(rt2x00dev->hw, control->vif, 81 ieee80211_rts_get(rt2x00dev->hw, tx_info->control.vif,
61 frag_skb->data, frag_skb->len, control, 82 frag_skb->data, size, tx_info,
62 (struct ieee80211_rts *)(skb->data)); 83 (struct ieee80211_rts *)(skb->data));
63 84
64 /* 85 /*
@@ -68,7 +89,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
68 memset(skbdesc, 0, sizeof(*skbdesc)); 89 memset(skbdesc, 0, sizeof(*skbdesc));
69 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED; 90 skbdesc->flags |= FRAME_DESC_DRIVER_GENERATED;
70 91
71 if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, queue, skb, control)) { 92 if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, queue, skb)) {
72 WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n"); 93 WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n");
73 return NETDEV_TX_BUSY; 94 return NETDEV_TX_BUSY;
74 } 95 }
@@ -76,14 +97,13 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
76 return NETDEV_TX_OK; 97 return NETDEV_TX_OK;
77} 98}
78 99
79int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 100int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
80 struct ieee80211_tx_control *control)
81{ 101{
82 struct rt2x00_dev *rt2x00dev = hw->priv; 102 struct rt2x00_dev *rt2x00dev = hw->priv;
103 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
83 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; 104 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
84 enum data_queue_qid qid = mac80211_queue_to_qid(control->queue); 105 enum data_queue_qid qid = mac80211_queue_to_qid(tx_info->queue);
85 struct data_queue *queue; 106 struct data_queue *queue;
86 struct skb_frame_desc *skbdesc;
87 u16 frame_control; 107 u16 frame_control;
88 108
89 /* 109 /*
@@ -100,7 +120,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
100 /* 120 /*
101 * Determine which queue to put packet on. 121 * Determine which queue to put packet on.
102 */ 122 */
103 if (control->flags & IEEE80211_TXCTL_SEND_AFTER_DTIM && 123 if (tx_info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM &&
104 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) 124 test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags))
105 queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM); 125 queue = rt2x00queue_get_queue(rt2x00dev, QID_ATIM);
106 else 126 else
@@ -125,33 +145,27 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
125 */ 145 */
126 frame_control = le16_to_cpu(ieee80211hdr->frame_control); 146 frame_control = le16_to_cpu(ieee80211hdr->frame_control);
127 if (!is_rts_frame(frame_control) && !is_cts_frame(frame_control) && 147 if (!is_rts_frame(frame_control) && !is_cts_frame(frame_control) &&
128 (control->flags & (IEEE80211_TXCTL_USE_RTS_CTS | 148 (tx_info->flags & (IEEE80211_TX_CTL_USE_RTS_CTS |
129 IEEE80211_TXCTL_USE_CTS_PROTECT)) && 149 IEEE80211_TX_CTL_USE_CTS_PROTECT)) &&
130 !rt2x00dev->ops->hw->set_rts_threshold) { 150 !rt2x00dev->ops->hw->set_rts_threshold) {
131 if (rt2x00queue_available(queue) <= 1) { 151 if (rt2x00queue_available(queue) <= 1) {
132 ieee80211_stop_queue(rt2x00dev->hw, control->queue); 152 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue);
133 return NETDEV_TX_BUSY; 153 return NETDEV_TX_BUSY;
134 } 154 }
135 155
136 if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb, control)) { 156 if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb)) {
137 ieee80211_stop_queue(rt2x00dev->hw, control->queue); 157 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue);
138 return NETDEV_TX_BUSY; 158 return NETDEV_TX_BUSY;
139 } 159 }
140 } 160 }
141 161
142 /* 162 if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, queue, skb)) {
143 * Initialize skb descriptor 163 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue);
144 */
145 skbdesc = get_skb_frame_desc(skb);
146 memset(skbdesc, 0, sizeof(*skbdesc));
147
148 if (rt2x00dev->ops->lib->write_tx_data(rt2x00dev, queue, skb, control)) {
149 ieee80211_stop_queue(rt2x00dev->hw, control->queue);
150 return NETDEV_TX_BUSY; 164 return NETDEV_TX_BUSY;
151 } 165 }
152 166
153 if (rt2x00queue_full(queue)) 167 if (rt2x00queue_full(queue))
154 ieee80211_stop_queue(rt2x00dev->hw, control->queue); 168 ieee80211_stop_queue(rt2x00dev->hw, tx_info->queue);
155 169
156 if (rt2x00dev->ops->lib->kick_tx_queue) 170 if (rt2x00dev->ops->lib->kick_tx_queue)
157 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, qid); 171 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, qid);
@@ -380,9 +394,7 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,
380 if (conf->type != IEEE80211_IF_TYPE_AP || !conf->beacon) 394 if (conf->type != IEEE80211_IF_TYPE_AP || !conf->beacon)
381 return 0; 395 return 0;
382 396
383 status = rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, 397 status = rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, conf->beacon);
384 conf->beacon,
385 conf->beacon_control);
386 if (status) 398 if (status)
387 dev_kfree_skb(conf->beacon); 399 dev_kfree_skb(conf->beacon);
388 400
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index fa7de41be049..70a3d135f64e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -35,8 +35,7 @@
35 * TX data handlers. 35 * TX data handlers.
36 */ 36 */
37int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, 37int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
38 struct data_queue *queue, struct sk_buff *skb, 38 struct data_queue *queue, struct sk_buff *skb)
39 struct ieee80211_tx_control *control)
40{ 39{
41 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); 40 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
42 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 41 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
@@ -64,19 +63,19 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
64 * for our information. 63 * for our information.
65 */ 64 */
66 entry->skb = skb; 65 entry->skb = skb;
67 rt2x00queue_create_tx_descriptor(entry, &txdesc, control); 66 rt2x00queue_create_tx_descriptor(entry, &txdesc);
68 67
69 /* 68 /*
70 * Fill in skb descriptor 69 * Fill in skb descriptor
71 */ 70 */
72 skbdesc = get_skb_frame_desc(skb); 71 skbdesc = get_skb_frame_desc(skb);
72 memset(skbdesc, 0, sizeof(*skbdesc));
73 skbdesc->data = skb->data; 73 skbdesc->data = skb->data;
74 skbdesc->data_len = skb->len; 74 skbdesc->data_len = skb->len;
75 skbdesc->desc = entry_priv->desc; 75 skbdesc->desc = entry_priv->desc;
76 skbdesc->desc_len = queue->desc_size; 76 skbdesc->desc_len = queue->desc_size;
77 skbdesc->entry = entry; 77 skbdesc->entry = entry;
78 78
79 memcpy(&entry_priv->control, control, sizeof(entry_priv->control));
80 memcpy(entry_priv->data, skb->data, skb->len); 79 memcpy(entry_priv->data, skb->data, skb->len);
81 80
82 rt2x00queue_write_tx_descriptor(entry, &txdesc); 81 rt2x00queue_write_tx_descriptor(entry, &txdesc);
@@ -164,9 +163,9 @@ void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry,
164 struct txdone_entry_desc *txdesc) 163 struct txdone_entry_desc *txdesc)
165{ 164{
166 struct queue_entry_priv_pci *entry_priv = entry->priv_data; 165 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
166 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
167 u32 word; 167 u32 word;
168 168
169 txdesc->control = &entry_priv->control;
170 rt2x00lib_txdone(entry, txdesc); 169 rt2x00lib_txdone(entry, txdesc);
171 170
172 /* 171 /*
@@ -187,7 +186,7 @@ void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry,
187 * is reenabled when the txdone handler has finished. 186 * is reenabled when the txdone handler has finished.
188 */ 187 */
189 if (!rt2x00queue_full(entry->queue)) 188 if (!rt2x00queue_full(entry->queue))
190 ieee80211_wake_queue(rt2x00dev->hw, entry_priv->control.queue); 189 ieee80211_wake_queue(rt2x00dev->hw, qid);
191 190
192} 191}
193EXPORT_SYMBOL_GPL(rt2x00pci_txdone); 192EXPORT_SYMBOL_GPL(rt2x00pci_txdone);
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h
index 557d15a888ab..37c851e442c1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.h
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.h
@@ -91,8 +91,7 @@ rt2x00pci_register_multiwrite(struct rt2x00_dev *rt2x00dev,
91 * TX data handlers. 91 * TX data handlers.
92 */ 92 */
93int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, 93int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
94 struct data_queue *queue, struct sk_buff *skb, 94 struct data_queue *queue, struct sk_buff *skb);
95 struct ieee80211_tx_control *control);
96 95
97/** 96/**
98 * struct queue_entry_priv_pci: Per entry PCI specific information 97 * struct queue_entry_priv_pci: Per entry PCI specific information
@@ -101,7 +100,6 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
101 * @desc_dma: DMA pointer to &desc. 100 * @desc_dma: DMA pointer to &desc.
102 * @data: Pointer to device's entry memory. 101 * @data: Pointer to device's entry memory.
103 * @data_dma: DMA pointer to &data. 102 * @data_dma: DMA pointer to &data.
104 * @control: mac80211 control structure used to transmit data.
105 */ 103 */
106struct queue_entry_priv_pci { 104struct queue_entry_priv_pci {
107 __le32 *desc; 105 __le32 *desc;
@@ -109,8 +107,6 @@ struct queue_entry_priv_pci {
109 107
110 void *data; 108 void *data;
111 dma_addr_t data_dma; 109 dma_addr_t data_dma;
112
113 struct ieee80211_tx_control control;
114}; 110};
115 111
116/** 112/**
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 5cf4c2f59260..e69ef4b19239 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -30,13 +30,13 @@
30#include "rt2x00lib.h" 30#include "rt2x00lib.h"
31 31
32void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, 32void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
33 struct txentry_desc *txdesc, 33 struct txentry_desc *txdesc)
34 struct ieee80211_tx_control *control)
35{ 34{
36 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 35 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
36 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
37 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; 37 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
38 struct ieee80211_rate *rate = 38 struct ieee80211_rate *rate =
39 ieee80211_get_tx_rate(rt2x00dev->hw, control); 39 ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
40 const struct rt2x00_rate *hwrate; 40 const struct rt2x00_rate *hwrate;
41 unsigned int data_length; 41 unsigned int data_length;
42 unsigned int duration; 42 unsigned int duration;
@@ -64,7 +64,7 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
64 /* 64 /*
65 * Check whether this frame is to be acked. 65 * Check whether this frame is to be acked.
66 */ 66 */
67 if (!(control->flags & IEEE80211_TXCTL_NO_ACK)) 67 if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK))
68 __set_bit(ENTRY_TXD_ACK, &txdesc->flags); 68 __set_bit(ENTRY_TXD_ACK, &txdesc->flags);
69 69
70 /* 70 /*
@@ -72,23 +72,20 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
72 */ 72 */
73 if (is_rts_frame(frame_control) || is_cts_frame(frame_control)) { 73 if (is_rts_frame(frame_control) || is_cts_frame(frame_control)) {
74 __set_bit(ENTRY_TXD_BURST, &txdesc->flags); 74 __set_bit(ENTRY_TXD_BURST, &txdesc->flags);
75 if (is_rts_frame(frame_control)) { 75 if (is_rts_frame(frame_control))
76 __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags); 76 __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags);
77 __set_bit(ENTRY_TXD_ACK, &txdesc->flags); 77 else
78 } else {
79 __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags); 78 __set_bit(ENTRY_TXD_CTS_FRAME, &txdesc->flags);
80 __clear_bit(ENTRY_TXD_ACK, &txdesc->flags); 79 if (tx_info->control.rts_cts_rate_idx >= 0)
81 }
82 if (control->rts_cts_rate_idx >= 0)
83 rate = 80 rate =
84 ieee80211_get_rts_cts_rate(rt2x00dev->hw, control); 81 ieee80211_get_rts_cts_rate(rt2x00dev->hw, tx_info);
85 } 82 }
86 83
87 /* 84 /*
88 * Determine retry information. 85 * Determine retry information.
89 */ 86 */
90 txdesc->retry_limit = control->retry_limit; 87 txdesc->retry_limit = tx_info->control.retry_limit;
91 if (control->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) 88 if (tx_info->flags & IEEE80211_TX_CTL_LONG_RETRY_LIMIT)
92 __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags); 89 __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags);
93 90
94 /* 91 /*
@@ -113,7 +110,7 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
113 */ 110 */
114 if (test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)) { 111 if (test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)) {
115 txdesc->ifs = IFS_SIFS; 112 txdesc->ifs = IFS_SIFS;
116 } else if (control->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) { 113 } else if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) {
117 __set_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags); 114 __set_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags);
118 txdesc->ifs = IFS_BACKOFF; 115 txdesc->ifs = IFS_BACKOFF;
119 } else { 116 } else {
@@ -179,8 +176,10 @@ void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
179 176
180 /* 177 /*
181 * We are done writing the frame to the queue entry, 178 * We are done writing the frame to the queue entry,
182 * if this entry is a RTS of CTS-to-self frame we are done, 179 * also kick the queue in case the correct flags are set,
183 * otherwise we need to kick the queue. 180 * note that this will automatically filter beacons and
181 * RTS/CTS frames since those frames don't have this flag
182 * set.
184 */ 183 */
185 if (rt2x00dev->ops->lib->kick_tx_queue && 184 if (rt2x00dev->ops->lib->kick_tx_queue &&
186 !(skbdesc->flags & FRAME_DESC_DRIVER_GENERATED)) 185 !(skbdesc->flags & FRAME_DESC_DRIVER_GENERATED))
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index c6edc52873c4..f263fe422f87 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -105,8 +105,8 @@ enum skb_frame_desc_flags {
105/** 105/**
106 * struct skb_frame_desc: Descriptor information for the skb buffer 106 * struct skb_frame_desc: Descriptor information for the skb buffer
107 * 107 *
108 * This structure is placed over the skb->cb array, this means that 108 * This structure is placed over the driver_data array, this means that
109 * this structure should not exceed the size of that array (48 bytes). 109 * this structure should not exceed the size of that array (40 bytes).
110 * 110 *
111 * @flags: Frame flags, see &enum skb_frame_desc_flags. 111 * @flags: Frame flags, see &enum skb_frame_desc_flags.
112 * @data: Pointer to data part of frame (Start of ieee80211 header). 112 * @data: Pointer to data part of frame (Start of ieee80211 header).
@@ -129,10 +129,15 @@ struct skb_frame_desc {
129 struct queue_entry *entry; 129 struct queue_entry *entry;
130}; 130};
131 131
132/**
133 * get_skb_frame_desc - Obtain the rt2x00 frame descriptor from a sk_buff.
134 * @skb: &struct sk_buff from where we obtain the &struct skb_frame_desc
135 */
132static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb) 136static inline struct skb_frame_desc* get_skb_frame_desc(struct sk_buff *skb)
133{ 137{
134 BUILD_BUG_ON(sizeof(struct skb_frame_desc) > sizeof(skb->cb)); 138 BUILD_BUG_ON(sizeof(struct skb_frame_desc) >
135 return (struct skb_frame_desc *)&skb->cb[0]; 139 IEEE80211_TX_INFO_DRIVER_DATA_SIZE);
140 return (struct skb_frame_desc *)&IEEE80211_SKB_CB(skb)->driver_data;
136} 141}
137 142
138/** 143/**
@@ -189,12 +194,10 @@ enum txdone_entry_desc_flags {
189 * Summary of information that has been read from the TX frame descriptor 194 * Summary of information that has been read from the TX frame descriptor
190 * after the device is done with transmission. 195 * after the device is done with transmission.
191 * 196 *
192 * @control: Control structure which was used to transmit the frame.
193 * @flags: TX done flags (See &enum txdone_entry_desc_flags). 197 * @flags: TX done flags (See &enum txdone_entry_desc_flags).
194 * @retry: Retry count. 198 * @retry: Retry count.
195 */ 199 */
196struct txdone_entry_desc { 200struct txdone_entry_desc {
197 struct ieee80211_tx_control *control;
198 unsigned long flags; 201 unsigned long flags;
199 int retry; 202 int retry;
200}; 203};
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index dcee1b4f152b..52d12fdc0ccf 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -129,9 +129,9 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
129{ 129{
130 struct queue_entry *entry = (struct queue_entry *)urb->context; 130 struct queue_entry *entry = (struct queue_entry *)urb->context;
131 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 131 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
132 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
133 struct txdone_entry_desc txdesc; 132 struct txdone_entry_desc txdesc;
134 __le32 *txd = (__le32 *)entry->skb->data; 133 __le32 *txd = (__le32 *)entry->skb->data;
134 enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
135 u32 word; 135 u32 word;
136 136
137 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 137 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -159,7 +159,6 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
159 else 159 else
160 __set_bit(TXDONE_FAILURE, &txdesc.flags); 160 __set_bit(TXDONE_FAILURE, &txdesc.flags);
161 txdesc.retry = 0; 161 txdesc.retry = 0;
162 txdesc.control = &entry_priv->control;
163 162
164 rt2x00lib_txdone(entry, &txdesc); 163 rt2x00lib_txdone(entry, &txdesc);
165 164
@@ -175,12 +174,11 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
175 * is reenabled when the txdone handler has finished. 174 * is reenabled when the txdone handler has finished.
176 */ 175 */
177 if (!rt2x00queue_full(entry->queue)) 176 if (!rt2x00queue_full(entry->queue))
178 ieee80211_wake_queue(rt2x00dev->hw, entry_priv->control.queue); 177 ieee80211_wake_queue(rt2x00dev->hw, qid);
179} 178}
180 179
181int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, 180int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
182 struct data_queue *queue, struct sk_buff *skb, 181 struct data_queue *queue, struct sk_buff *skb)
183 struct ieee80211_tx_control *control)
184{ 182{
185 struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); 183 struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev);
186 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX); 184 struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
@@ -206,7 +204,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
206 * for our information. 204 * for our information.
207 */ 205 */
208 entry->skb = skb; 206 entry->skb = skb;
209 rt2x00queue_create_tx_descriptor(entry, &txdesc, control); 207 rt2x00queue_create_tx_descriptor(entry, &txdesc);
210 208
211 /* 209 /*
212 * Add the descriptor in front of the skb. 210 * Add the descriptor in front of the skb.
@@ -218,13 +216,13 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
218 * Fill in skb descriptor 216 * Fill in skb descriptor
219 */ 217 */
220 skbdesc = get_skb_frame_desc(skb); 218 skbdesc = get_skb_frame_desc(skb);
219 memset(skbdesc, 0, sizeof(*skbdesc));
221 skbdesc->data = skb->data + queue->desc_size; 220 skbdesc->data = skb->data + queue->desc_size;
222 skbdesc->data_len = skb->len - queue->desc_size; 221 skbdesc->data_len = skb->len - queue->desc_size;
223 skbdesc->desc = skb->data; 222 skbdesc->desc = skb->data;
224 skbdesc->desc_len = queue->desc_size; 223 skbdesc->desc_len = queue->desc_size;
225 skbdesc->entry = entry; 224 skbdesc->entry = entry;
226 225
227 memcpy(&entry_priv->control, control, sizeof(entry_priv->control));
228 rt2x00queue_write_tx_descriptor(entry, &txdesc); 226 rt2x00queue_write_tx_descriptor(entry, &txdesc);
229 227
230 /* 228 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index 15b404aa714d..26f53f868af6 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -216,19 +216,15 @@ void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev);
216 * TX data handlers. 216 * TX data handlers.
217 */ 217 */
218int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, 218int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
219 struct data_queue *queue, struct sk_buff *skb, 219 struct data_queue *queue, struct sk_buff *skb);
220 struct ieee80211_tx_control *control);
221 220
222/** 221/**
223 * struct queue_entry_priv_usb: Per entry USB specific information 222 * struct queue_entry_priv_usb: Per entry USB specific information
224 * 223 *
225 * @urb: Urb structure used for device communication. 224 * @urb: Urb structure used for device communication.
226 * @control: mac80211 control structure used to transmit data.
227 */ 225 */
228struct queue_entry_priv_usb { 226struct queue_entry_priv_usb {
229 struct urb *urb; 227 struct urb *urb;
230
231 struct ieee80211_tx_control control;
232}; 228};
233 229
234/** 230/**
@@ -239,15 +235,12 @@ struct queue_entry_priv_usb {
239 * with beacons. 235 * with beacons.
240 * 236 *
241 * @urb: Urb structure used for device communication. 237 * @urb: Urb structure used for device communication.
242 * @control: mac80211 control structure used to transmit data.
243 * @guardian_data: Set to 0, used for sending the guardian data. 238 * @guardian_data: Set to 0, used for sending the guardian data.
244 * @guardian_urb: Urb structure used to send the guardian data. 239 * @guardian_urb: Urb structure used to send the guardian data.
245 */ 240 */
246struct queue_entry_priv_usb_bcn { 241struct queue_entry_priv_usb_bcn {
247 struct urb *urb; 242 struct urb *urb;
248 243
249 struct ieee80211_tx_control control;
250
251 unsigned int guardian_data; 244 unsigned int guardian_data;
252 struct urb *guardian_urb; 245 struct urb *guardian_urb;
253}; 246};
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 7598b6e15784..e13ed5ced26e 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2357,11 +2357,11 @@ static u64 rt61pci_get_tsf(struct ieee80211_hw *hw)
2357 return tsf; 2357 return tsf;
2358} 2358}
2359 2359
2360static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 2360static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
2361 struct ieee80211_tx_control *control)
2362{ 2361{
2363 struct rt2x00_dev *rt2x00dev = hw->priv; 2362 struct rt2x00_dev *rt2x00dev = hw->priv;
2364 struct rt2x00_intf *intf = vif_to_intf(control->vif); 2363 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
2364 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
2365 struct queue_entry_priv_pci *entry_priv; 2365 struct queue_entry_priv_pci *entry_priv;
2366 struct skb_frame_desc *skbdesc; 2366 struct skb_frame_desc *skbdesc;
2367 struct txentry_desc txdesc; 2367 struct txentry_desc txdesc;
@@ -2377,7 +2377,7 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2377 * for our information. 2377 * for our information.
2378 */ 2378 */
2379 intf->beacon->skb = skb; 2379 intf->beacon->skb = skb;
2380 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control); 2380 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
2381 2381
2382 entry_priv = intf->beacon->priv_data; 2382 entry_priv = intf->beacon->priv_data;
2383 memset(entry_priv->desc, 0, intf->beacon->queue->desc_size); 2383 memset(entry_priv->desc, 0, intf->beacon->queue->desc_size);
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index e55bcbdfc1e1..26c2e0a1a308 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1948,11 +1948,11 @@ static u64 rt73usb_get_tsf(struct ieee80211_hw *hw)
1948#define rt73usb_get_tsf NULL 1948#define rt73usb_get_tsf NULL
1949#endif 1949#endif
1950 1950
1951static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb, 1951static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1952 struct ieee80211_tx_control *control)
1953{ 1952{
1954 struct rt2x00_dev *rt2x00dev = hw->priv; 1953 struct rt2x00_dev *rt2x00dev = hw->priv;
1955 struct rt2x00_intf *intf = vif_to_intf(control->vif); 1954 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1955 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1956 struct skb_frame_desc *skbdesc; 1956 struct skb_frame_desc *skbdesc;
1957 struct txentry_desc txdesc; 1957 struct txentry_desc txdesc;
1958 unsigned int beacon_base; 1958 unsigned int beacon_base;
@@ -1967,7 +1967,7 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
1967 * for our information. 1967 * for our information.
1968 */ 1968 */
1969 intf->beacon->skb = skb; 1969 intf->beacon->skb = skb;
1970 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control); 1970 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1971 1971
1972 /* 1972 /*
1973 * Add the descriptor in front of the skb. 1973 * Add the descriptor in front of the skb.
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c
index 6263209b889e..4427bc9f78a9 100644
--- a/drivers/net/wireless/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl8180_dev.c
@@ -170,34 +170,29 @@ static void rtl8180_handle_tx(struct ieee80211_hw *dev, unsigned int prio)
170 while (skb_queue_len(&ring->queue)) { 170 while (skb_queue_len(&ring->queue)) {
171 struct rtl8180_tx_desc *entry = &ring->desc[ring->idx]; 171 struct rtl8180_tx_desc *entry = &ring->desc[ring->idx];
172 struct sk_buff *skb; 172 struct sk_buff *skb;
173 struct ieee80211_tx_status status; 173 struct ieee80211_tx_info *info;
174 struct ieee80211_tx_control *control;
175 u32 flags = le32_to_cpu(entry->flags); 174 u32 flags = le32_to_cpu(entry->flags);
176 175
177 if (flags & RTL8180_TX_DESC_FLAG_OWN) 176 if (flags & RTL8180_TX_DESC_FLAG_OWN)
178 return; 177 return;
179 178
180 memset(&status, 0, sizeof(status));
181
182 ring->idx = (ring->idx + 1) % ring->entries; 179 ring->idx = (ring->idx + 1) % ring->entries;
183 skb = __skb_dequeue(&ring->queue); 180 skb = __skb_dequeue(&ring->queue);
184 pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf), 181 pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
185 skb->len, PCI_DMA_TODEVICE); 182 skb->len, PCI_DMA_TODEVICE);
186 183
187 control = *((struct ieee80211_tx_control **)skb->cb); 184 info = IEEE80211_SKB_CB(skb);
188 if (control) 185 memset(&info->status, 0, sizeof(info->status));
189 memcpy(&status.control, control, sizeof(*control));
190 kfree(control);
191 186
192 if (!(status.control.flags & IEEE80211_TXCTL_NO_ACK)) { 187 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
193 if (flags & RTL8180_TX_DESC_FLAG_TX_OK) 188 if (flags & RTL8180_TX_DESC_FLAG_TX_OK)
194 status.flags = IEEE80211_TX_STATUS_ACK; 189 info->flags |= IEEE80211_TX_STAT_ACK;
195 else 190 else
196 status.excessive_retries = 1; 191 info->status.excessive_retries = 1;
197 } 192 }
198 status.retry_count = flags & 0xFF; 193 info->status.retry_count = flags & 0xFF;
199 194
200 ieee80211_tx_status_irqsafe(dev, skb, &status); 195 ieee80211_tx_status_irqsafe(dev, skb);
201 if (ring->entries - skb_queue_len(&ring->queue) == 2) 196 if (ring->entries - skb_queue_len(&ring->queue) == 2)
202 ieee80211_wake_queue(dev, prio); 197 ieee80211_wake_queue(dev, prio);
203 } 198 }
@@ -238,9 +233,9 @@ static irqreturn_t rtl8180_interrupt(int irq, void *dev_id)
238 return IRQ_HANDLED; 233 return IRQ_HANDLED;
239} 234}
240 235
241static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb, 236static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
242 struct ieee80211_tx_control *control)
243{ 237{
238 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
244 struct rtl8180_priv *priv = dev->priv; 239 struct rtl8180_priv *priv = dev->priv;
245 struct rtl8180_tx_ring *ring; 240 struct rtl8180_tx_ring *ring;
246 struct rtl8180_tx_desc *entry; 241 struct rtl8180_tx_desc *entry;
@@ -251,7 +246,7 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
251 u16 plcp_len = 0; 246 u16 plcp_len = 0;
252 __le16 rts_duration = 0; 247 __le16 rts_duration = 0;
253 248
254 prio = control->queue; 249 prio = info->queue;
255 ring = &priv->tx_ring[prio]; 250 ring = &priv->tx_ring[prio];
256 251
257 mapping = pci_map_single(priv->pdev, skb->data, 252 mapping = pci_map_single(priv->pdev, skb->data,
@@ -259,35 +254,32 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
259 254
260 tx_flags = RTL8180_TX_DESC_FLAG_OWN | RTL8180_TX_DESC_FLAG_FS | 255 tx_flags = RTL8180_TX_DESC_FLAG_OWN | RTL8180_TX_DESC_FLAG_FS |
261 RTL8180_TX_DESC_FLAG_LS | 256 RTL8180_TX_DESC_FLAG_LS |
262 (ieee80211_get_tx_rate(dev, control)->hw_value << 24) | 257 (ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
263 skb->len; 258 skb->len;
264 259
265 if (priv->r8185) 260 if (priv->r8185)
266 tx_flags |= RTL8180_TX_DESC_FLAG_DMA | 261 tx_flags |= RTL8180_TX_DESC_FLAG_DMA |
267 RTL8180_TX_DESC_FLAG_NO_ENC; 262 RTL8180_TX_DESC_FLAG_NO_ENC;
268 263
269 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 264 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
270 tx_flags |= RTL8180_TX_DESC_FLAG_RTS; 265 tx_flags |= RTL8180_TX_DESC_FLAG_RTS;
271 tx_flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19; 266 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
272 } else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 267 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
273 tx_flags |= RTL8180_TX_DESC_FLAG_CTS; 268 tx_flags |= RTL8180_TX_DESC_FLAG_CTS;
274 tx_flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19; 269 tx_flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
275 } 270 }
276 271
277 *((struct ieee80211_tx_control **) skb->cb) = 272 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
278 kmemdup(control, sizeof(*control), GFP_ATOMIC);
279
280 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS)
281 rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, 273 rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len,
282 control); 274 info);
283 275
284 if (!priv->r8185) { 276 if (!priv->r8185) {
285 unsigned int remainder; 277 unsigned int remainder;
286 278
287 plcp_len = DIV_ROUND_UP(16 * (skb->len + 4), 279 plcp_len = DIV_ROUND_UP(16 * (skb->len + 4),
288 (ieee80211_get_tx_rate(dev, control)->bitrate * 2) / 10); 280 (ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
289 remainder = (16 * (skb->len + 4)) % 281 remainder = (16 * (skb->len + 4)) %
290 ((ieee80211_get_tx_rate(dev, control)->bitrate * 2) / 10); 282 ((ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
291 if (remainder > 0 && remainder <= 6) 283 if (remainder > 0 && remainder <= 6)
292 plcp_len |= 1 << 15; 284 plcp_len |= 1 << 15;
293 } 285 }
@@ -300,13 +292,13 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
300 entry->plcp_len = cpu_to_le16(plcp_len); 292 entry->plcp_len = cpu_to_le16(plcp_len);
301 entry->tx_buf = cpu_to_le32(mapping); 293 entry->tx_buf = cpu_to_le32(mapping);
302 entry->frame_len = cpu_to_le32(skb->len); 294 entry->frame_len = cpu_to_le32(skb->len);
303 entry->flags2 = control->alt_retry_rate_idx >= 0 ? 295 entry->flags2 = info->control.alt_retry_rate_idx >= 0 ?
304 ieee80211_get_alt_retry_rate(dev, control)->bitrate << 4 : 0; 296 ieee80211_get_alt_retry_rate(dev, info)->bitrate << 4 : 0;
305 entry->retry_limit = control->retry_limit; 297 entry->retry_limit = info->control.retry_limit;
306 entry->flags = cpu_to_le32(tx_flags); 298 entry->flags = cpu_to_le32(tx_flags);
307 __skb_queue_tail(&ring->queue, skb); 299 __skb_queue_tail(&ring->queue, skb);
308 if (ring->entries - skb_queue_len(&ring->queue) < 2) 300 if (ring->entries - skb_queue_len(&ring->queue) < 2)
309 ieee80211_stop_queue(dev, control->queue); 301 ieee80211_stop_queue(dev, info->queue);
310 spin_unlock_irqrestore(&priv->lock, flags); 302 spin_unlock_irqrestore(&priv->lock, flags);
311 303
312 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); 304 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4)));
@@ -522,7 +514,6 @@ static void rtl8180_free_tx_ring(struct ieee80211_hw *dev, unsigned int prio)
522 514
523 pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf), 515 pci_unmap_single(priv->pdev, le32_to_cpu(entry->tx_buf),
524 skb->len, PCI_DMA_TODEVICE); 516 skb->len, PCI_DMA_TODEVICE);
525 kfree(*((struct ieee80211_tx_control **) skb->cb));
526 kfree_skb(skb); 517 kfree_skb(skb);
527 ring->idx = (ring->idx + 1) % ring->entries; 518 ring->idx = (ring->idx + 1) % ring->entries;
528 } 519 }
diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h
index 076d88b6db0e..a0cfb666de0e 100644
--- a/drivers/net/wireless/rtl8187.h
+++ b/drivers/net/wireless/rtl8187.h
@@ -44,12 +44,6 @@ struct rtl8187_rx_hdr {
44 __le64 mac_time; 44 __le64 mac_time;
45} __attribute__((packed)); 45} __attribute__((packed));
46 46
47struct rtl8187_tx_info {
48 struct ieee80211_tx_control *control;
49 struct urb *urb;
50 struct ieee80211_hw *dev;
51};
52
53struct rtl8187_tx_hdr { 47struct rtl8187_tx_hdr {
54 __le32 flags; 48 __le32 flags;
55#define RTL8187_TX_FLAG_NO_ENCRYPT (1 << 15) 49#define RTL8187_TX_FLAG_NO_ENCRYPT (1 << 15)
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index 86a09b49681c..b581ef8a6377 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -145,27 +145,22 @@ void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data)
145 145
146static void rtl8187_tx_cb(struct urb *urb) 146static void rtl8187_tx_cb(struct urb *urb)
147{ 147{
148 struct ieee80211_tx_status status;
149 struct sk_buff *skb = (struct sk_buff *)urb->context; 148 struct sk_buff *skb = (struct sk_buff *)urb->context;
150 struct rtl8187_tx_info *info = (struct rtl8187_tx_info *)skb->cb; 149 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
150 struct ieee80211_hw *hw = info->driver_data[0];
151 151
152 memset(&status, 0, sizeof(status)); 152 usb_free_urb(info->driver_data[1]);
153
154 usb_free_urb(info->urb);
155 if (info->control)
156 memcpy(&status.control, info->control, sizeof(status.control));
157 kfree(info->control);
158 skb_pull(skb, sizeof(struct rtl8187_tx_hdr)); 153 skb_pull(skb, sizeof(struct rtl8187_tx_hdr));
159 status.flags |= IEEE80211_TX_STATUS_ACK; 154 memset(&info->status, 0, sizeof(info->status));
160 ieee80211_tx_status_irqsafe(info->dev, skb, &status); 155 info->flags |= IEEE80211_TX_STAT_ACK;
156 ieee80211_tx_status_irqsafe(hw, skb);
161} 157}
162 158
163static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, 159static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
164 struct ieee80211_tx_control *control)
165{ 160{
166 struct rtl8187_priv *priv = dev->priv; 161 struct rtl8187_priv *priv = dev->priv;
162 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
167 struct rtl8187_tx_hdr *hdr; 163 struct rtl8187_tx_hdr *hdr;
168 struct rtl8187_tx_info *info;
169 struct urb *urb; 164 struct urb *urb;
170 __le16 rts_dur = 0; 165 __le16 rts_dur = 0;
171 u32 flags; 166 u32 flags;
@@ -179,29 +174,27 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
179 flags = skb->len; 174 flags = skb->len;
180 flags |= RTL8187_TX_FLAG_NO_ENCRYPT; 175 flags |= RTL8187_TX_FLAG_NO_ENCRYPT;
181 176
182 flags |= ieee80211_get_tx_rate(dev, control)->hw_value << 24; 177 flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;
183 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data)) 178 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data))
184 flags |= RTL8187_TX_FLAG_MORE_FRAG; 179 flags |= RTL8187_TX_FLAG_MORE_FRAG;
185 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 180 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
186 flags |= RTL8187_TX_FLAG_RTS; 181 flags |= RTL8187_TX_FLAG_RTS;
187 flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19; 182 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
188 rts_dur = ieee80211_rts_duration(dev, priv->vif, 183 rts_dur = ieee80211_rts_duration(dev, priv->vif,
189 skb->len, control); 184 skb->len, info);
190 } else if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { 185 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
191 flags |= RTL8187_TX_FLAG_CTS; 186 flags |= RTL8187_TX_FLAG_CTS;
192 flags |= ieee80211_get_rts_cts_rate(dev, control)->hw_value << 19; 187 flags |= ieee80211_get_rts_cts_rate(dev, info)->hw_value << 19;
193 } 188 }
194 189
195 hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); 190 hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
196 hdr->flags = cpu_to_le32(flags); 191 hdr->flags = cpu_to_le32(flags);
197 hdr->len = 0; 192 hdr->len = 0;
198 hdr->rts_duration = rts_dur; 193 hdr->rts_duration = rts_dur;
199 hdr->retry = cpu_to_le32(control->retry_limit << 8); 194 hdr->retry = cpu_to_le32(info->control.retry_limit << 8);
200 195
201 info = (struct rtl8187_tx_info *)skb->cb; 196 info->driver_data[0] = dev;
202 info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC); 197 info->driver_data[1] = urb;
203 info->urb = urb;
204 info->dev = dev;
205 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2), 198 usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2),
206 hdr, skb->len, rtl8187_tx_cb, skb); 199 hdr, skb->len, rtl8187_tx_cb, skb);
207 usb_submit_urb(urb, GFP_ATOMIC); 200 usb_submit_urb(urb, GFP_ATOMIC);
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 99c508c09e5b..edb1aefb4add 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -224,36 +224,6 @@ out:
224 return r; 224 return r;
225} 225}
226 226
227/**
228 * clear_tx_skb_control_block - clears the control block of tx skbuffs
229 * @skb: a &struct sk_buff pointer
230 *
231 * This clears the control block of skbuff buffers, which were transmitted to
232 * the device. Notify that the function is not thread-safe, so prevent
233 * multiple calls.
234 */
235static void clear_tx_skb_control_block(struct sk_buff *skb)
236{
237 struct zd_tx_skb_control_block *cb =
238 (struct zd_tx_skb_control_block *)skb->cb;
239
240 kfree(cb->control);
241 cb->control = NULL;
242}
243
244/**
245 * kfree_tx_skb - frees a tx skbuff
246 * @skb: a &struct sk_buff pointer
247 *
248 * Frees the tx skbuff. Frees also the allocated control structure in the
249 * control block if necessary.
250 */
251static void kfree_tx_skb(struct sk_buff *skb)
252{
253 clear_tx_skb_control_block(skb);
254 dev_kfree_skb_any(skb);
255}
256
257static void zd_op_stop(struct ieee80211_hw *hw) 227static void zd_op_stop(struct ieee80211_hw *hw)
258{ 228{
259 struct zd_mac *mac = zd_hw_mac(hw); 229 struct zd_mac *mac = zd_hw_mac(hw);
@@ -276,40 +246,15 @@ static void zd_op_stop(struct ieee80211_hw *hw)
276 246
277 247
278 while ((skb = skb_dequeue(ack_wait_queue))) 248 while ((skb = skb_dequeue(ack_wait_queue)))
279 kfree_tx_skb(skb); 249 dev_kfree_skb_any(skb);
280}
281
282/**
283 * init_tx_skb_control_block - initializes skb control block
284 * @skb: a &sk_buff pointer
285 * @dev: pointer to the mac80221 device
286 * @control: mac80211 tx control applying for the frame in @skb
287 *
288 * Initializes the control block of the skbuff to be transmitted.
289 */
290static int init_tx_skb_control_block(struct sk_buff *skb,
291 struct ieee80211_hw *hw,
292 struct ieee80211_tx_control *control)
293{
294 struct zd_tx_skb_control_block *cb =
295 (struct zd_tx_skb_control_block *)skb->cb;
296
297 ZD_ASSERT(sizeof(*cb) <= sizeof(skb->cb));
298 memset(cb, 0, sizeof(*cb));
299 cb->hw= hw;
300 cb->control = kmalloc(sizeof(*control), GFP_ATOMIC);
301 if (cb->control == NULL)
302 return -ENOMEM;
303 memcpy(cb->control, control, sizeof(*control));
304
305 return 0;
306} 250}
307 251
308/** 252/**
309 * tx_status - reports tx status of a packet if required 253 * tx_status - reports tx status of a packet if required
310 * @hw - a &struct ieee80211_hw pointer 254 * @hw - a &struct ieee80211_hw pointer
311 * @skb - a sk-buffer 255 * @skb - a sk-buffer
312 * @status - the tx status of the packet without control information 256 * @flags: extra flags to set in the TX status info
257 * @ackssi: ACK signal strength
313 * @success - True for successfull transmission of the frame 258 * @success - True for successfull transmission of the frame
314 * 259 *
315 * This information calls ieee80211_tx_status_irqsafe() if required by the 260 * This information calls ieee80211_tx_status_irqsafe() if required by the
@@ -319,18 +264,17 @@ static int init_tx_skb_control_block(struct sk_buff *skb,
319 * If no status information has been requested, the skb is freed. 264 * If no status information has been requested, the skb is freed.
320 */ 265 */
321static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, 266static void tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
322 struct ieee80211_tx_status *status, 267 u32 flags, int ackssi, bool success)
323 bool success)
324{ 268{
325 struct zd_tx_skb_control_block *cb = (struct zd_tx_skb_control_block *) 269 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
326 skb->cb; 270
271 memset(&info->status, 0, sizeof(info->status));
327 272
328 ZD_ASSERT(cb->control != NULL);
329 memcpy(&status->control, cb->control, sizeof(status->control));
330 if (!success) 273 if (!success)
331 status->excessive_retries = 1; 274 info->status.excessive_retries = 1;
332 clear_tx_skb_control_block(skb); 275 info->flags |= flags;
333 ieee80211_tx_status_irqsafe(hw, skb, status); 276 info->status.ack_signal = ackssi;
277 ieee80211_tx_status_irqsafe(hw, skb);
334} 278}
335 279
336/** 280/**
@@ -345,15 +289,12 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw)
345{ 289{
346 struct sk_buff_head *q = &zd_hw_mac(hw)->ack_wait_queue; 290 struct sk_buff_head *q = &zd_hw_mac(hw)->ack_wait_queue;
347 struct sk_buff *skb; 291 struct sk_buff *skb;
348 struct ieee80211_tx_status status;
349 292
350 skb = skb_dequeue(q); 293 skb = skb_dequeue(q);
351 if (skb == NULL) 294 if (skb == NULL)
352 return; 295 return;
353 296
354 memset(&status, 0, sizeof(status)); 297 tx_status(hw, skb, 0, 0, 0);
355
356 tx_status(hw, skb, &status, 0);
357} 298}
358 299
359/** 300/**
@@ -368,28 +309,20 @@ void zd_mac_tx_failed(struct ieee80211_hw *hw)
368 */ 309 */
369void zd_mac_tx_to_dev(struct sk_buff *skb, int error) 310void zd_mac_tx_to_dev(struct sk_buff *skb, int error)
370{ 311{
371 struct zd_tx_skb_control_block *cb = 312 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
372 (struct zd_tx_skb_control_block *)skb->cb; 313 struct ieee80211_hw *hw = info->driver_data[0];
373 struct ieee80211_hw *hw = cb->hw;
374
375 if (likely(cb->control)) {
376 skb_pull(skb, sizeof(struct zd_ctrlset));
377 if (unlikely(error ||
378 (cb->control->flags & IEEE80211_TXCTL_NO_ACK)))
379 {
380 struct ieee80211_tx_status status;
381 memset(&status, 0, sizeof(status));
382 tx_status(hw, skb, &status, !error);
383 } else {
384 struct sk_buff_head *q =
385 &zd_hw_mac(hw)->ack_wait_queue;
386 314
387 skb_queue_tail(q, skb); 315 skb_pull(skb, sizeof(struct zd_ctrlset));
388 while (skb_queue_len(q) > ZD_MAC_MAX_ACK_WAITERS) 316 if (unlikely(error ||
389 zd_mac_tx_failed(hw); 317 (info->flags & IEEE80211_TX_CTL_NO_ACK))) {
390 } 318 tx_status(hw, skb, 0, 0, !error);
391 } else { 319 } else {
392 kfree_tx_skb(skb); 320 struct sk_buff_head *q =
321 &zd_hw_mac(hw)->ack_wait_queue;
322
323 skb_queue_tail(q, skb);
324 while (skb_queue_len(q) > ZD_MAC_MAX_ACK_WAITERS)
325 zd_mac_tx_failed(hw);
393 } 326 }
394} 327}
395 328
@@ -454,7 +387,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
454 cs->control = 0; 387 cs->control = 0;
455 388
456 /* First fragment */ 389 /* First fragment */
457 if (flags & IEEE80211_TXCTL_FIRST_FRAGMENT) 390 if (flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
458 cs->control |= ZD_CS_NEED_RANDOM_BACKOFF; 391 cs->control |= ZD_CS_NEED_RANDOM_BACKOFF;
459 392
460 /* Multicast */ 393 /* Multicast */
@@ -466,10 +399,10 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
466 (IEEE80211_FTYPE_CTL|IEEE80211_STYPE_PSPOLL)) 399 (IEEE80211_FTYPE_CTL|IEEE80211_STYPE_PSPOLL))
467 cs->control |= ZD_CS_PS_POLL_FRAME; 400 cs->control |= ZD_CS_PS_POLL_FRAME;
468 401
469 if (flags & IEEE80211_TXCTL_USE_RTS_CTS) 402 if (flags & IEEE80211_TX_CTL_USE_RTS_CTS)
470 cs->control |= ZD_CS_RTS; 403 cs->control |= ZD_CS_RTS;
471 404
472 if (flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 405 if (flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
473 cs->control |= ZD_CS_SELF_CTS; 406 cs->control |= ZD_CS_SELF_CTS;
474 407
475 /* FIXME: Management frame? */ 408 /* FIXME: Management frame? */
@@ -516,8 +449,7 @@ void zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon)
516} 449}
517 450
518static int fill_ctrlset(struct zd_mac *mac, 451static int fill_ctrlset(struct zd_mac *mac,
519 struct sk_buff *skb, 452 struct sk_buff *skb)
520 struct ieee80211_tx_control *control)
521{ 453{
522 int r; 454 int r;
523 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 455 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -526,18 +458,19 @@ static int fill_ctrlset(struct zd_mac *mac,
526 struct ieee80211_rate *txrate; 458 struct ieee80211_rate *txrate;
527 struct zd_ctrlset *cs = (struct zd_ctrlset *) 459 struct zd_ctrlset *cs = (struct zd_ctrlset *)
528 skb_push(skb, sizeof(struct zd_ctrlset)); 460 skb_push(skb, sizeof(struct zd_ctrlset));
461 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
529 462
530 ZD_ASSERT(frag_len <= 0xffff); 463 ZD_ASSERT(frag_len <= 0xffff);
531 464
532 txrate = ieee80211_get_tx_rate(mac->hw, control); 465 txrate = ieee80211_get_tx_rate(mac->hw, info);
533 466
534 cs->modulation = txrate->hw_value; 467 cs->modulation = txrate->hw_value;
535 if (control->flags & IEEE80211_TXCTL_SHORT_PREAMBLE) 468 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE)
536 cs->modulation = txrate->hw_value_short; 469 cs->modulation = txrate->hw_value_short;
537 470
538 cs->tx_length = cpu_to_le16(frag_len); 471 cs->tx_length = cpu_to_le16(frag_len);
539 472
540 cs_set_control(mac, cs, hdr, control->flags); 473 cs_set_control(mac, cs, hdr, info->flags);
541 474
542 packet_length = frag_len + sizeof(struct zd_ctrlset) + 10; 475 packet_length = frag_len + sizeof(struct zd_ctrlset) + 10;
543 ZD_ASSERT(packet_length <= 0xffff); 476 ZD_ASSERT(packet_length <= 0xffff);
@@ -582,24 +515,21 @@ static int fill_ctrlset(struct zd_mac *mac,
582 * control block of the skbuff will be initialized. If necessary the incoming 515 * control block of the skbuff will be initialized. If necessary the incoming
583 * mac80211 queues will be stopped. 516 * mac80211 queues will be stopped.
584 */ 517 */
585static int zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb, 518static int zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
586 struct ieee80211_tx_control *control)
587{ 519{
588 struct zd_mac *mac = zd_hw_mac(hw); 520 struct zd_mac *mac = zd_hw_mac(hw);
521 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
589 int r; 522 int r;
590 523
591 r = fill_ctrlset(mac, skb, control); 524 r = fill_ctrlset(mac, skb);
592 if (r) 525 if (r)
593 return r; 526 return r;
594 527
595 r = init_tx_skb_control_block(skb, hw, control); 528 info->driver_data[0] = hw;
596 if (r) 529
597 return r;
598 r = zd_usb_tx(&mac->chip.usb, skb); 530 r = zd_usb_tx(&mac->chip.usb, skb);
599 if (r) { 531 if (r)
600 clear_tx_skb_control_block(skb);
601 return r; 532 return r;
602 }
603 return 0; 533 return 0;
604} 534}
605 535
@@ -637,13 +567,8 @@ static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr,
637 tx_hdr = (struct ieee80211_hdr *)skb->data; 567 tx_hdr = (struct ieee80211_hdr *)skb->data;
638 if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1))) 568 if (likely(!compare_ether_addr(tx_hdr->addr2, rx_hdr->addr1)))
639 { 569 {
640 struct ieee80211_tx_status status;
641
642 memset(&status, 0, sizeof(status));
643 status.flags = IEEE80211_TX_STATUS_ACK;
644 status.ack_signal = stats->signal;
645 __skb_unlink(skb, q); 570 __skb_unlink(skb, q);
646 tx_status(hw, skb, &status, 1); 571 tx_status(hw, skb, IEEE80211_TX_STAT_ACK, stats->signal, 1);
647 goto out; 572 goto out;
648 } 573 }
649 } 574 }
@@ -947,8 +872,7 @@ static void zd_op_bss_info_changed(struct ieee80211_hw *hw,
947} 872}
948 873
949static int zd_op_beacon_update(struct ieee80211_hw *hw, 874static int zd_op_beacon_update(struct ieee80211_hw *hw,
950 struct sk_buff *skb, 875 struct sk_buff *skb)
951 struct ieee80211_tx_control *ctl)
952{ 876{
953 struct zd_mac *mac = zd_hw_mac(hw); 877 struct zd_mac *mac = zd_hw_mac(hw);
954 zd_mac_config_beacon(hw, skb); 878 zd_mac_config_beacon(hw, skb);
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h
index 71170244d2c9..18c1d56d3dd7 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.h
+++ b/drivers/net/wireless/zd1211rw/zd_mac.h
@@ -149,22 +149,6 @@ struct housekeeping {
149 struct delayed_work link_led_work; 149 struct delayed_work link_led_work;
150}; 150};
151 151
152/**
153 * struct zd_tx_skb_control_block - control block for tx skbuffs
154 * @control: &struct ieee80211_tx_control pointer
155 * @context: context pointer
156 *
157 * This structure is used to fill the cb field in an &sk_buff to transmit.
158 * The control field is NULL, if there is no requirement from the mac80211
159 * stack to report about the packet ACK. This is the case if the flag
160 * IEEE80211_TXCTL_NO_ACK is not set in &struct ieee80211_tx_control.
161 */
162struct zd_tx_skb_control_block {
163 struct ieee80211_tx_control *control;
164 struct ieee80211_hw *hw;
165 void *context;
166};
167
168#define ZD_MAC_STATS_BUFFER_SIZE 16 152#define ZD_MAC_STATS_BUFFER_SIZE 16
169 153
170#define ZD_MAC_MAX_ACK_WAITERS 10 154#define ZD_MAC_MAX_ACK_WAITERS 10
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 12e24f04dddf..c8a0b34aecc8 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -869,7 +869,7 @@ static void tx_urb_complete(struct urb *urb)
869{ 869{
870 int r; 870 int r;
871 struct sk_buff *skb; 871 struct sk_buff *skb;
872 struct zd_tx_skb_control_block *cb; 872 struct ieee80211_tx_info *info;
873 struct zd_usb *usb; 873 struct zd_usb *usb;
874 874
875 switch (urb->status) { 875 switch (urb->status) {
@@ -893,8 +893,8 @@ free_urb:
893 * grab 'usb' pointer before handing off the skb (since 893 * grab 'usb' pointer before handing off the skb (since
894 * it might be freed by zd_mac_tx_to_dev or mac80211) 894 * it might be freed by zd_mac_tx_to_dev or mac80211)
895 */ 895 */
896 cb = (struct zd_tx_skb_control_block *)skb->cb; 896 info = IEEE80211_SKB_CB(skb);
897 usb = &zd_hw_mac(cb->hw)->chip.usb; 897 usb = &zd_hw_mac(info->driver_data[0])->chip.usb;
898 zd_mac_tx_to_dev(skb, urb->status); 898 zd_mac_tx_to_dev(skb, urb->status);
899 free_tx_urb(usb, urb); 899 free_tx_urb(usb, urb);
900 tx_dec_submitted_urbs(usb); 900 tx_dec_submitted_urbs(usb);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 0df91bea6c1f..54960b83db79 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -201,101 +201,127 @@ struct ieee80211_bss_conf {
201}; 201};
202 202
203/** 203/**
204 * enum mac80211_tx_control_flags - flags to describe Tx configuration for 204 * enum mac80211_tx_flags - flags to transmission information/status
205 * the Tx frame 205 *
206 * 206 * These flags are used with the @flags member of &ieee80211_tx_info
207 * These flags are used with the @flags member of &ieee80211_tx_control 207 *
208 * 208 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
209 * @IEEE80211_TXCTL_REQ_TX_STATUS: request TX status callback for this frame. 209 * @IEEE80211_TX_CTL_DO_NOT_ENCRYPT: send this frame without encryption;
210 * @IEEE80211_TXCTL_DO_NOT_ENCRYPT: send this frame without encryption; 210 * e.g., for EAPOL frame
211 * e.g., for EAPOL frame 211 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame
212 * @IEEE80211_TXCTL_USE_RTS_CTS: use RTS-CTS before sending frame 212 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g.,
213 * @IEEE80211_TXCTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 213 * for combined 802.11g / 802.11b networks)
214 * for combined 802.11g / 802.11b networks) 214 * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
215 * @IEEE80211_TXCTL_NO_ACK: tell the low level not to wait for an ack 215 * @IEEE80211_TX_CTL_RATE_CTRL_PROBE
216 * @IEEE80211_TXCTL_RATE_CTRL_PROBE 216 * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
217 * @EEE80211_TXCTL_CLEAR_PS_FILT: clear powersave filter 217 * station
218 * for destination station 218 * @IEEE80211_TX_CTL_REQUEUE:
219 * @IEEE80211_TXCTL_REQUEUE: 219 * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
220 * @IEEE80211_TXCTL_FIRST_FRAGMENT: this is a first fragment of the frame 220 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
221 * @IEEE80211_TXCTL_LONG_RETRY_LIMIT: this frame should be send using the 221 * through set_retry_limit configured long retry value
222 * through set_retry_limit configured long 222 * @IEEE80211_TX_CTL_EAPOL_FRAME: internal to mac80211
223 * retry value 223 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
224 * @IEEE80211_TXCTL_EAPOL_FRAME: internal to mac80211 224 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
225 * @IEEE80211_TXCTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 225 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number
226 * @IEEE80211_TXCTL_AMPDU: this frame should be sent as part of an A-MPDU 226 * of streams when this flag is on can be extracted from antenna_sel_tx,
227 * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 227 * so if 1 antenna is marked use SISO, 2 antennas marked use MIMO, n
228 * of streams when this flag is on can be extracted 228 * antennas marked use MIMO_n.
229 * from antenna_sel_tx, so if 1 antenna is marked 229 * @IEEE80211_TX_CTL_GREEN_FIELD: use green field protection for this frame
230 * use SISO, 2 antennas marked use MIMO, n antennas 230 * @IEEE80211_TX_CTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
231 * marked use MIMO_n. 231 * @IEEE80211_TX_CTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
232 * @IEEE80211_TXCTL_GREEN_FIELD: use green field protection for this frame 232 * @IEEE80211_TX_CTL_SHORT_GI: send this frame using short guard interval
233 * @IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width 233 * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
234 * @IEEE80211_TXCTL_DUP_DATA: duplicate data frame on both 20 Mhz channels 234 * because the destination STA was in powersave mode.
235 * @IEEE80211_TXCTL_SHORT_GI: send this frame using short guard interval 235 * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
236 * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
237 * is for the whole aggregation.
236 */ 238 */
237enum mac80211_tx_control_flags { 239enum mac80211_tx_control_flags {
238 IEEE80211_TXCTL_REQ_TX_STATUS = (1<<0), 240 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
239 IEEE80211_TXCTL_DO_NOT_ENCRYPT = (1<<1), 241 IEEE80211_TX_CTL_DO_NOT_ENCRYPT = BIT(1),
240 IEEE80211_TXCTL_USE_RTS_CTS = (1<<2), 242 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2),
241 IEEE80211_TXCTL_USE_CTS_PROTECT = (1<<3), 243 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3),
242 IEEE80211_TXCTL_NO_ACK = (1<<4), 244 IEEE80211_TX_CTL_NO_ACK = BIT(4),
243 IEEE80211_TXCTL_RATE_CTRL_PROBE = (1<<5), 245 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(5),
244 IEEE80211_TXCTL_CLEAR_PS_FILT = (1<<6), 246 IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(6),
245 IEEE80211_TXCTL_REQUEUE = (1<<7), 247 IEEE80211_TX_CTL_REQUEUE = BIT(7),
246 IEEE80211_TXCTL_FIRST_FRAGMENT = (1<<8), 248 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8),
247 IEEE80211_TXCTL_SHORT_PREAMBLE = (1<<9), 249 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9),
248 IEEE80211_TXCTL_LONG_RETRY_LIMIT = (1<<10), 250 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10),
249 IEEE80211_TXCTL_EAPOL_FRAME = (1<<11), 251 IEEE80211_TX_CTL_EAPOL_FRAME = BIT(11),
250 IEEE80211_TXCTL_SEND_AFTER_DTIM = (1<<12), 252 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12),
251 IEEE80211_TXCTL_AMPDU = (1<<13), 253 IEEE80211_TX_CTL_AMPDU = BIT(13),
252 IEEE80211_TXCTL_OFDM_HT = (1<<14), 254 IEEE80211_TX_CTL_OFDM_HT = BIT(14),
253 IEEE80211_TXCTL_GREEN_FIELD = (1<<15), 255 IEEE80211_TX_CTL_GREEN_FIELD = BIT(15),
254 IEEE80211_TXCTL_40_MHZ_WIDTH = (1<<16), 256 IEEE80211_TX_CTL_40_MHZ_WIDTH = BIT(16),
255 IEEE80211_TXCTL_DUP_DATA = (1<<17), 257 IEEE80211_TX_CTL_DUP_DATA = BIT(17),
256 IEEE80211_TXCTL_SHORT_GI = (1<<18), 258 IEEE80211_TX_CTL_SHORT_GI = BIT(18),
259 IEEE80211_TX_CTL_INJECTED = BIT(19),
260 IEEE80211_TX_STAT_TX_FILTERED = BIT(20),
261 IEEE80211_TX_STAT_ACK = BIT(21),
262 IEEE80211_TX_STAT_AMPDU = BIT(22),
257}; 263};
258 264
259/* Transmit control fields. This data structure is passed to low-level driver
260 * with each TX frame. The low-level driver is responsible for configuring
261 * the hardware to use given values (depending on what is supported).
262 *
263 * NOTE: Be careful with using the pointers outside of the ieee80211_ops->tx()
264 * context (i.e. when defering the work to a workqueue).
265 * The vif pointer is valid until the it has been removed with the
266 * ieee80211_ops->remove_interface() callback funtion.
267 * The hw_key pointer is valid until it has been removed with the
268 * ieee80211_ops->set_key() callback function.
269 */
270struct ieee80211_tx_control {
271 u32 flags; /* tx control flags defined above */
272
273 s8 tx_rate_idx, /* Transmit rate (indexes registered rates) */
274 rts_cts_rate_idx, /* Transmit rate for RTS/CTS frame */
275 alt_retry_rate_idx; /* retry rate for the last retries */
276
277 s8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
278 * This could be used when set_retry_limit
279 * is not implemented by the driver */
280 265
281 struct ieee80211_vif *vif; 266#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE \
282 267 (sizeof(((struct sk_buff *)0)->cb) - 8)
283 /* Key used for hardware encryption 268#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
284 * NULL if IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */ 269 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
285 struct ieee80211_key_conf *hw_key;
286 270
287 enum ieee80211_band band; 271/**
272 * struct ieee80211_tx_info - skb transmit information
273 *
274 * This structure is placed in skb->cb for three uses:
275 * (1) mac80211 TX control - mac80211 tells the driver what to do
276 * (2) driver internal use (if applicable)
277 * (3) TX status information - driver tells mac80211 what happened
278 *
279 * @flags: transmit info flags, defined above
280 * @retry_count: number of retries
281 * @excessive_retries: set to 1 if the frame was retried many times
282 * but not acknowledged
283 * @ampdu_ack_len: number of aggregated frames.
284 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
285 * @ampdu_ack_map: block ack bit map for the aggregation.
286 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
287 * @ack_signal: signal strength of the ACK frame
288 */
289struct ieee80211_tx_info {
290 /* common information */
291 u32 flags;
292 u8 band;
293 s8 tx_rate_idx;
294 u8 antenna_sel_tx;
288 295
289 u8 antenna_sel_tx; /* 0 = default/diversity, otherwise bit 296 u8 queue; /* use skb_queue_mapping soon */
290 * position represents antenna number used */ 297
291 u8 icv_len; /* length of the ICV/MIC field in octets */ 298 union {
292 u8 iv_len; /* length of the IV field in octets */ 299 struct {
293 u16 queue; /* hardware queue to use for this frame; 300 struct ieee80211_vif *vif;
294 * 0 = highest, hw->queues-1 = lowest */ 301 struct ieee80211_key_conf *hw_key;
295 u16 aid; /* Station AID */ 302 unsigned long jiffies;
296 int type; /* internal */ 303 int ifindex;
304 u16 aid;
305 s8 rts_cts_rate_idx, alt_retry_rate_idx;
306 u8 retry_limit;
307 u8 icv_len;
308 u8 iv_len;
309 } control;
310 struct {
311 u64 ampdu_ack_map;
312 int ack_signal;
313 u8 retry_count;
314 bool excessive_retries;
315 u8 ampdu_ack_len;
316 } status;
317 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_PTRS];
318 };
297}; 319};
298 320
321static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
322{
323 return (struct ieee80211_tx_info *)skb->cb;
324}
299 325
300 326
301/** 327/**
@@ -363,52 +389,6 @@ struct ieee80211_rx_status {
363}; 389};
364 390
365/** 391/**
366 * enum ieee80211_tx_status_flags - transmit status flags
367 *
368 * Status flags to indicate various transmit conditions.
369 *
370 * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted
371 * because the destination STA was in powersave mode.
372 * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged
373 * @IEEE80211_TX_STATUS_AMPDU: The frame was aggregated, so status
374 * is for the whole aggregation.
375 */
376enum ieee80211_tx_status_flags {
377 IEEE80211_TX_STATUS_TX_FILTERED = 1<<0,
378 IEEE80211_TX_STATUS_ACK = 1<<1,
379 IEEE80211_TX_STATUS_AMPDU = 1<<2,
380};
381
382/**
383 * struct ieee80211_tx_status - transmit status
384 *
385 * As much information as possible should be provided for each transmitted
386 * frame with ieee80211_tx_status().
387 *
388 * @control: a copy of the &struct ieee80211_tx_control passed to the driver
389 * in the tx() callback.
390 * @flags: transmit status flags, defined above
391 * @retry_count: number of retries
392 * @excessive_retries: set to 1 if the frame was retried many times
393 * but not acknowledged
394 * @ampdu_ack_len: number of aggregated frames.
395 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
396 * @ampdu_ack_map: block ack bit map for the aggregation.
397 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
398 * @ack_signal: signal strength of the ACK frame either in dBm, dB or unspec
399 * depending on hardware capabilites flags @IEEE80211_HW_SIGNAL_*
400 */
401struct ieee80211_tx_status {
402 struct ieee80211_tx_control control;
403 u8 flags;
404 u8 retry_count;
405 bool excessive_retries;
406 u8 ampdu_ack_len;
407 u64 ampdu_ack_map;
408 int ack_signal;
409};
410
411/**
412 * enum ieee80211_conf_flags - configuration flags 392 * enum ieee80211_conf_flags - configuration flags
413 * 393 *
414 * Flags to define PHY configuration options 394 * Flags to define PHY configuration options
@@ -563,7 +543,6 @@ struct ieee80211_if_conf {
563 u8 *ssid; 543 u8 *ssid;
564 size_t ssid_len; 544 size_t ssid_len;
565 struct sk_buff *beacon; 545 struct sk_buff *beacon;
566 struct ieee80211_tx_control *beacon_control;
567}; 546};
568 547
569/** 548/**
@@ -825,7 +804,7 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
825 804
826static inline struct ieee80211_rate * 805static inline struct ieee80211_rate *
827ieee80211_get_tx_rate(const struct ieee80211_hw *hw, 806ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
828 const struct ieee80211_tx_control *c) 807 const struct ieee80211_tx_info *c)
829{ 808{
830 if (WARN_ON(c->tx_rate_idx < 0)) 809 if (WARN_ON(c->tx_rate_idx < 0))
831 return NULL; 810 return NULL;
@@ -834,20 +813,20 @@ ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
834 813
835static inline struct ieee80211_rate * 814static inline struct ieee80211_rate *
836ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw, 815ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
837 const struct ieee80211_tx_control *c) 816 const struct ieee80211_tx_info *c)
838{ 817{
839 if (c->rts_cts_rate_idx < 0) 818 if (c->control.rts_cts_rate_idx < 0)
840 return NULL; 819 return NULL;
841 return &hw->wiphy->bands[c->band]->bitrates[c->rts_cts_rate_idx]; 820 return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx];
842} 821}
843 822
844static inline struct ieee80211_rate * 823static inline struct ieee80211_rate *
845ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 824ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
846 const struct ieee80211_tx_control *c) 825 const struct ieee80211_tx_info *c)
847{ 826{
848 if (c->alt_retry_rate_idx < 0) 827 if (c->control.alt_retry_rate_idx < 0)
849 return NULL; 828 return NULL;
850 return &hw->wiphy->bands[c->band]->bitrates[c->alt_retry_rate_idx]; 829 return &hw->wiphy->bands[c->band]->bitrates[c->control.alt_retry_rate_idx];
851} 830}
852 831
853/** 832/**
@@ -1142,8 +1121,7 @@ enum ieee80211_ampdu_mlme_action {
1142 * that TX/RX_STOP can pass NULL for this parameter. 1121 * that TX/RX_STOP can pass NULL for this parameter.
1143 */ 1122 */
1144struct ieee80211_ops { 1123struct ieee80211_ops {
1145 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, 1124 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1146 struct ieee80211_tx_control *control);
1147 int (*start)(struct ieee80211_hw *hw); 1125 int (*start)(struct ieee80211_hw *hw);
1148 void (*stop)(struct ieee80211_hw *hw); 1126 void (*stop)(struct ieee80211_hw *hw);
1149 int (*add_interface)(struct ieee80211_hw *hw, 1127 int (*add_interface)(struct ieee80211_hw *hw,
@@ -1187,8 +1165,7 @@ struct ieee80211_ops {
1187 u64 (*get_tsf)(struct ieee80211_hw *hw); 1165 u64 (*get_tsf)(struct ieee80211_hw *hw);
1188 void (*reset_tsf)(struct ieee80211_hw *hw); 1166 void (*reset_tsf)(struct ieee80211_hw *hw);
1189 int (*beacon_update)(struct ieee80211_hw *hw, 1167 int (*beacon_update)(struct ieee80211_hw *hw,
1190 struct sk_buff *skb, 1168 struct sk_buff *skb);
1191 struct ieee80211_tx_control *control);
1192 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1169 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1193 int (*ampdu_action)(struct ieee80211_hw *hw, 1170 int (*ampdu_action)(struct ieee80211_hw *hw,
1194 enum ieee80211_ampdu_mlme_action action, 1171 enum ieee80211_ampdu_mlme_action action,
@@ -1384,13 +1361,9 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw,
1384 * 1361 *
1385 * @hw: the hardware the frame was transmitted by 1362 * @hw: the hardware the frame was transmitted by
1386 * @skb: the frame that was transmitted, owned by mac80211 after this call 1363 * @skb: the frame that was transmitted, owned by mac80211 after this call
1387 * @status: status information for this frame; the status pointer need not
1388 * be valid after this function returns and is not freed by mac80211,
1389 * it is recommended that it points to a stack area
1390 */ 1364 */
1391void ieee80211_tx_status(struct ieee80211_hw *hw, 1365void ieee80211_tx_status(struct ieee80211_hw *hw,
1392 struct sk_buff *skb, 1366 struct sk_buff *skb);
1393 struct ieee80211_tx_status *status);
1394 1367
1395/** 1368/**
1396 * ieee80211_tx_status_irqsafe - irq-safe transmit status callback 1369 * ieee80211_tx_status_irqsafe - irq-safe transmit status callback
@@ -1403,13 +1376,9 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
1403 * 1376 *
1404 * @hw: the hardware the frame was transmitted by 1377 * @hw: the hardware the frame was transmitted by
1405 * @skb: the frame that was transmitted, owned by mac80211 after this call 1378 * @skb: the frame that was transmitted, owned by mac80211 after this call
1406 * @status: status information for this frame; the status pointer need not
1407 * be valid after this function returns and is not freed by mac80211,
1408 * it is recommended that it points to a stack area
1409 */ 1379 */
1410void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, 1380void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1411 struct sk_buff *skb, 1381 struct sk_buff *skb);
1412 struct ieee80211_tx_status *status);
1413 1382
1414/** 1383/**
1415 * ieee80211_beacon_get - beacon generation function 1384 * ieee80211_beacon_get - beacon generation function
@@ -1425,8 +1394,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1425 * is responsible of freeing it. 1394 * is responsible of freeing it.
1426 */ 1395 */
1427struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1396struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1428 struct ieee80211_vif *vif, 1397 struct ieee80211_vif *vif);
1429 struct ieee80211_tx_control *control);
1430 1398
1431/** 1399/**
1432 * ieee80211_rts_get - RTS frame generation function 1400 * ieee80211_rts_get - RTS frame generation function
@@ -1434,7 +1402,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1434 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1402 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1435 * @frame: pointer to the frame that is going to be protected by the RTS. 1403 * @frame: pointer to the frame that is going to be protected by the RTS.
1436 * @frame_len: the frame length (in octets). 1404 * @frame_len: the frame length (in octets).
1437 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1405 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1438 * @rts: The buffer where to store the RTS frame. 1406 * @rts: The buffer where to store the RTS frame.
1439 * 1407 *
1440 * If the RTS frames are generated by the host system (i.e., not in 1408 * If the RTS frames are generated by the host system (i.e., not in
@@ -1444,7 +1412,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1444 */ 1412 */
1445void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1413void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1446 const void *frame, size_t frame_len, 1414 const void *frame, size_t frame_len,
1447 const struct ieee80211_tx_control *frame_txctl, 1415 const struct ieee80211_tx_info *frame_txctl,
1448 struct ieee80211_rts *rts); 1416 struct ieee80211_rts *rts);
1449 1417
1450/** 1418/**
@@ -1452,7 +1420,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1452 * @hw: pointer obtained from ieee80211_alloc_hw(). 1420 * @hw: pointer obtained from ieee80211_alloc_hw().
1453 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1421 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1454 * @frame_len: the length of the frame that is going to be protected by the RTS. 1422 * @frame_len: the length of the frame that is going to be protected by the RTS.
1455 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1423 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1456 * 1424 *
1457 * If the RTS is generated in firmware, but the host system must provide 1425 * If the RTS is generated in firmware, but the host system must provide
1458 * the duration field, the low-level driver uses this function to receive 1426 * the duration field, the low-level driver uses this function to receive
@@ -1460,7 +1428,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1460 */ 1428 */
1461__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, 1429__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1462 struct ieee80211_vif *vif, size_t frame_len, 1430 struct ieee80211_vif *vif, size_t frame_len,
1463 const struct ieee80211_tx_control *frame_txctl); 1431 const struct ieee80211_tx_info *frame_txctl);
1464 1432
1465/** 1433/**
1466 * ieee80211_ctstoself_get - CTS-to-self frame generation function 1434 * ieee80211_ctstoself_get - CTS-to-self frame generation function
@@ -1468,7 +1436,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1468 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1436 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1469 * @frame: pointer to the frame that is going to be protected by the CTS-to-self. 1437 * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
1470 * @frame_len: the frame length (in octets). 1438 * @frame_len: the frame length (in octets).
1471 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1439 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1472 * @cts: The buffer where to store the CTS-to-self frame. 1440 * @cts: The buffer where to store the CTS-to-self frame.
1473 * 1441 *
1474 * If the CTS-to-self frames are generated by the host system (i.e., not in 1442 * If the CTS-to-self frames are generated by the host system (i.e., not in
@@ -1479,7 +1447,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
1479void ieee80211_ctstoself_get(struct ieee80211_hw *hw, 1447void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1480 struct ieee80211_vif *vif, 1448 struct ieee80211_vif *vif,
1481 const void *frame, size_t frame_len, 1449 const void *frame, size_t frame_len,
1482 const struct ieee80211_tx_control *frame_txctl, 1450 const struct ieee80211_tx_info *frame_txctl,
1483 struct ieee80211_cts *cts); 1451 struct ieee80211_cts *cts);
1484 1452
1485/** 1453/**
@@ -1487,7 +1455,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1487 * @hw: pointer obtained from ieee80211_alloc_hw(). 1455 * @hw: pointer obtained from ieee80211_alloc_hw().
1488 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1456 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1489 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. 1457 * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
1490 * @frame_txctl: &struct ieee80211_tx_control of the frame. 1458 * @frame_txctl: &struct ieee80211_tx_info of the frame.
1491 * 1459 *
1492 * If the CTS-to-self is generated in firmware, but the host system must provide 1460 * If the CTS-to-self is generated in firmware, but the host system must provide
1493 * the duration field, the low-level driver uses this function to receive 1461 * the duration field, the low-level driver uses this function to receive
@@ -1496,7 +1464,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
1496__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, 1464__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1497 struct ieee80211_vif *vif, 1465 struct ieee80211_vif *vif,
1498 size_t frame_len, 1466 size_t frame_len,
1499 const struct ieee80211_tx_control *frame_txctl); 1467 const struct ieee80211_tx_info *frame_txctl);
1500 1468
1501/** 1469/**
1502 * ieee80211_generic_frame_duration - Calculate the duration field for a frame 1470 * ieee80211_generic_frame_duration - Calculate the duration field for a frame
@@ -1535,8 +1503,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1535 * use common code for all beacons. 1503 * use common code for all beacons.
1536 */ 1504 */
1537struct sk_buff * 1505struct sk_buff *
1538ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1506ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1539 struct ieee80211_tx_control *control);
1540 1507
1541/** 1508/**
1542 * ieee80211_get_hdrlen_from_skb - get header length from data 1509 * ieee80211_get_hdrlen_from_skb - get header length from data
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a4cccd1b7d53..79a65b3ee02b 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2,6 +2,7 @@
2 * Copyright 2002-2005, Instant802 Networks, Inc. 2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc. 3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -147,7 +148,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result;
147#define IEEE80211_TX_UNICAST BIT(1) 148#define IEEE80211_TX_UNICAST BIT(1)
148#define IEEE80211_TX_PS_BUFFERED BIT(2) 149#define IEEE80211_TX_PS_BUFFERED BIT(2)
149#define IEEE80211_TX_PROBE_LAST_FRAG BIT(3) 150#define IEEE80211_TX_PROBE_LAST_FRAG BIT(3)
150#define IEEE80211_TX_INJECTED BIT(4)
151 151
152struct ieee80211_tx_data { 152struct ieee80211_tx_data {
153 struct sk_buff *skb; 153 struct sk_buff *skb;
@@ -157,7 +157,6 @@ struct ieee80211_tx_data {
157 struct sta_info *sta; 157 struct sta_info *sta;
158 struct ieee80211_key *key; 158 struct ieee80211_key *key;
159 159
160 struct ieee80211_tx_control *control;
161 struct ieee80211_channel *channel; 160 struct ieee80211_channel *channel;
162 s8 rate_idx; 161 s8 rate_idx;
163 /* use this rate (if set) for last fragment; rate can 162 /* use this rate (if set) for last fragment; rate can
@@ -207,22 +206,7 @@ struct ieee80211_rx_data {
207 u16 tkip_iv16; 206 u16 tkip_iv16;
208}; 207};
209 208
210/* flags used in struct ieee80211_tx_packet_data.flags */
211#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)
212#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
213#define IEEE80211_TXPD_REQUEUE BIT(2)
214#define IEEE80211_TXPD_EAPOL_FRAME BIT(3)
215#define IEEE80211_TXPD_AMPDU BIT(4)
216/* Stored in sk_buff->cb */
217struct ieee80211_tx_packet_data {
218 int ifindex;
219 unsigned long jiffies;
220 unsigned int flags;
221 u8 queue;
222};
223
224struct ieee80211_tx_stored_packet { 209struct ieee80211_tx_stored_packet {
225 struct ieee80211_tx_control control;
226 struct sk_buff *skb; 210 struct sk_buff *skb;
227 struct sk_buff **extra_frag; 211 struct sk_buff **extra_frag;
228 s8 last_frag_rate_idx; 212 s8 last_frag_rate_idx;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 9761d9bd5a79..8f1ff7ef1667 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -971,8 +971,7 @@ void ieee80211_if_setup(struct net_device *dev)
971/* everything else */ 971/* everything else */
972 972
973static int __ieee80211_if_config(struct net_device *dev, 973static int __ieee80211_if_config(struct net_device *dev,
974 struct sk_buff *beacon, 974 struct sk_buff *beacon)
975 struct ieee80211_tx_control *control)
976{ 975{
977 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 976 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
978 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 977 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
@@ -990,13 +989,11 @@ static int __ieee80211_if_config(struct net_device *dev,
990 conf.ssid_len = sdata->u.sta.ssid_len; 989 conf.ssid_len = sdata->u.sta.ssid_len;
991 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { 990 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
992 conf.beacon = beacon; 991 conf.beacon = beacon;
993 conf.beacon_control = control;
994 ieee80211_start_mesh(dev); 992 ieee80211_start_mesh(dev);
995 } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { 993 } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
996 conf.ssid = sdata->u.ap.ssid; 994 conf.ssid = sdata->u.ap.ssid;
997 conf.ssid_len = sdata->u.ap.ssid_len; 995 conf.ssid_len = sdata->u.ap.ssid_len;
998 conf.beacon = beacon; 996 conf.beacon = beacon;
999 conf.beacon_control = control;
1000 } 997 }
1001 return local->ops->config_interface(local_to_hw(local), 998 return local->ops->config_interface(local_to_hw(local),
1002 &sdata->vif, &conf); 999 &sdata->vif, &conf);
@@ -1009,23 +1006,21 @@ int ieee80211_if_config(struct net_device *dev)
1009 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT && 1006 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT &&
1010 (local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) 1007 (local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
1011 return ieee80211_if_config_beacon(dev); 1008 return ieee80211_if_config_beacon(dev);
1012 return __ieee80211_if_config(dev, NULL, NULL); 1009 return __ieee80211_if_config(dev, NULL);
1013} 1010}
1014 1011
1015int ieee80211_if_config_beacon(struct net_device *dev) 1012int ieee80211_if_config_beacon(struct net_device *dev)
1016{ 1013{
1017 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1014 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1018 struct ieee80211_tx_control control;
1019 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1015 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1020 struct sk_buff *skb; 1016 struct sk_buff *skb;
1021 1017
1022 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) 1018 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
1023 return 0; 1019 return 0;
1024 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, 1020 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif);
1025 &control);
1026 if (!skb) 1021 if (!skb)
1027 return -ENOMEM; 1022 return -ENOMEM;
1028 return __ieee80211_if_config(dev, skb, &control); 1023 return __ieee80211_if_config(dev, skb);
1029} 1024}
1030 1025
1031int ieee80211_hw_config(struct ieee80211_local *local) 1026int ieee80211_hw_config(struct ieee80211_local *local)
@@ -1180,38 +1175,20 @@ void ieee80211_reset_erp_info(struct net_device *dev)
1180} 1175}
1181 1176
1182void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, 1177void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1183 struct sk_buff *skb, 1178 struct sk_buff *skb)
1184 struct ieee80211_tx_status *status)
1185{ 1179{
1186 struct ieee80211_local *local = hw_to_local(hw); 1180 struct ieee80211_local *local = hw_to_local(hw);
1187 struct ieee80211_tx_status *saved; 1181 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1188 int tmp; 1182 int tmp;
1189 1183
1190 skb->dev = local->mdev; 1184 skb->dev = local->mdev;
1191 saved = kmalloc(sizeof(struct ieee80211_tx_status), GFP_ATOMIC);
1192 if (unlikely(!saved)) {
1193 if (net_ratelimit())
1194 printk(KERN_WARNING "%s: Not enough memory, "
1195 "dropping tx status", skb->dev->name);
1196 /* should be dev_kfree_skb_irq, but due to this function being
1197 * named _irqsafe instead of just _irq we can't be sure that
1198 * people won't call it from non-irq contexts */
1199 dev_kfree_skb_any(skb);
1200 return;
1201 }
1202 memcpy(saved, status, sizeof(struct ieee80211_tx_status));
1203 /* copy pointer to saved status into skb->cb for use by tasklet */
1204 memcpy(skb->cb, &saved, sizeof(saved));
1205
1206 skb->pkt_type = IEEE80211_TX_STATUS_MSG; 1185 skb->pkt_type = IEEE80211_TX_STATUS_MSG;
1207 skb_queue_tail(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS ? 1186 skb_queue_tail(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS ?
1208 &local->skb_queue : &local->skb_queue_unreliable, skb); 1187 &local->skb_queue : &local->skb_queue_unreliable, skb);
1209 tmp = skb_queue_len(&local->skb_queue) + 1188 tmp = skb_queue_len(&local->skb_queue) +
1210 skb_queue_len(&local->skb_queue_unreliable); 1189 skb_queue_len(&local->skb_queue_unreliable);
1211 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && 1190 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT &&
1212 (skb = skb_dequeue(&local->skb_queue_unreliable))) { 1191 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
1213 memcpy(&saved, skb->cb, sizeof(saved));
1214 kfree(saved);
1215 dev_kfree_skb_irq(skb); 1192 dev_kfree_skb_irq(skb);
1216 tmp--; 1193 tmp--;
1217 I802_DEBUG_INC(local->tx_status_drop); 1194 I802_DEBUG_INC(local->tx_status_drop);
@@ -1225,7 +1202,6 @@ static void ieee80211_tasklet_handler(unsigned long data)
1225 struct ieee80211_local *local = (struct ieee80211_local *) data; 1202 struct ieee80211_local *local = (struct ieee80211_local *) data;
1226 struct sk_buff *skb; 1203 struct sk_buff *skb;
1227 struct ieee80211_rx_status rx_status; 1204 struct ieee80211_rx_status rx_status;
1228 struct ieee80211_tx_status *tx_status;
1229 struct ieee80211_ra_tid *ra_tid; 1205 struct ieee80211_ra_tid *ra_tid;
1230 1206
1231 while ((skb = skb_dequeue(&local->skb_queue)) || 1207 while ((skb = skb_dequeue(&local->skb_queue)) ||
@@ -1240,12 +1216,8 @@ static void ieee80211_tasklet_handler(unsigned long data)
1240 __ieee80211_rx(local_to_hw(local), skb, &rx_status); 1216 __ieee80211_rx(local_to_hw(local), skb, &rx_status);
1241 break; 1217 break;
1242 case IEEE80211_TX_STATUS_MSG: 1218 case IEEE80211_TX_STATUS_MSG:
1243 /* get pointer to saved status out of skb->cb */
1244 memcpy(&tx_status, skb->cb, sizeof(tx_status));
1245 skb->pkt_type = 0; 1219 skb->pkt_type = 0;
1246 ieee80211_tx_status(local_to_hw(local), 1220 ieee80211_tx_status(local_to_hw(local), skb);
1247 skb, tx_status);
1248 kfree(tx_status);
1249 break; 1221 break;
1250 case IEEE80211_DELBA_MSG: 1222 case IEEE80211_DELBA_MSG:
1251 ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 1223 ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
@@ -1274,24 +1246,15 @@ static void ieee80211_tasklet_handler(unsigned long data)
1274 * Also, tx_packet_data in cb is restored from tx_control. */ 1246 * Also, tx_packet_data in cb is restored from tx_control. */
1275static void ieee80211_remove_tx_extra(struct ieee80211_local *local, 1247static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
1276 struct ieee80211_key *key, 1248 struct ieee80211_key *key,
1277 struct sk_buff *skb, 1249 struct sk_buff *skb)
1278 struct ieee80211_tx_control *control)
1279{ 1250{
1280 int hdrlen, iv_len, mic_len; 1251 int hdrlen, iv_len, mic_len;
1281 struct ieee80211_tx_packet_data *pkt_data; 1252 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1282 1253
1283 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1254 info->flags &= IEEE80211_TX_CTL_REQ_TX_STATUS |
1284 pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; 1255 IEEE80211_TX_CTL_DO_NOT_ENCRYPT |
1285 pkt_data->flags = 0; 1256 IEEE80211_TX_CTL_REQUEUE |
1286 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) 1257 IEEE80211_TX_CTL_EAPOL_FRAME;
1287 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
1288 if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)
1289 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
1290 if (control->flags & IEEE80211_TXCTL_REQUEUE)
1291 pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
1292 if (control->flags & IEEE80211_TXCTL_EAPOL_FRAME)
1293 pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME;
1294 pkt_data->queue = control->queue;
1295 1258
1296 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1259 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
1297 1260
@@ -1338,9 +1301,10 @@ no_key:
1338 1301
1339static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, 1302static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1340 struct sta_info *sta, 1303 struct sta_info *sta,
1341 struct sk_buff *skb, 1304 struct sk_buff *skb)
1342 struct ieee80211_tx_status *status)
1343{ 1305{
1306 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1307
1344 sta->tx_filtered_count++; 1308 sta->tx_filtered_count++;
1345 1309
1346 /* 1310 /*
@@ -1382,18 +1346,16 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1382 */ 1346 */
1383 if (test_sta_flags(sta, WLAN_STA_PS) && 1347 if (test_sta_flags(sta, WLAN_STA_PS) &&
1384 skb_queue_len(&sta->tx_filtered) < STA_MAX_TX_BUFFER) { 1348 skb_queue_len(&sta->tx_filtered) < STA_MAX_TX_BUFFER) {
1385 ieee80211_remove_tx_extra(local, sta->key, skb, 1349 ieee80211_remove_tx_extra(local, sta->key, skb);
1386 &status->control);
1387 skb_queue_tail(&sta->tx_filtered, skb); 1350 skb_queue_tail(&sta->tx_filtered, skb);
1388 return; 1351 return;
1389 } 1352 }
1390 1353
1391 if (!test_sta_flags(sta, WLAN_STA_PS) && 1354 if (!test_sta_flags(sta, WLAN_STA_PS) &&
1392 !(status->control.flags & IEEE80211_TXCTL_REQUEUE)) { 1355 !(info->flags & IEEE80211_TX_CTL_REQUEUE)) {
1393 /* Software retry the packet once */ 1356 /* Software retry the packet once */
1394 status->control.flags |= IEEE80211_TXCTL_REQUEUE; 1357 info->flags |= IEEE80211_TX_CTL_REQUEUE;
1395 ieee80211_remove_tx_extra(local, sta->key, skb, 1358 ieee80211_remove_tx_extra(local, sta->key, skb);
1396 &status->control);
1397 dev_queue_xmit(skb); 1359 dev_queue_xmit(skb);
1398 return; 1360 return;
1399 } 1361 }
@@ -1407,28 +1369,20 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1407 dev_kfree_skb(skb); 1369 dev_kfree_skb(skb);
1408} 1370}
1409 1371
1410void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, 1372void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
1411 struct ieee80211_tx_status *status)
1412{ 1373{
1413 struct sk_buff *skb2; 1374 struct sk_buff *skb2;
1414 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1375 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1415 struct ieee80211_local *local = hw_to_local(hw); 1376 struct ieee80211_local *local = hw_to_local(hw);
1377 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1416 u16 frag, type; 1378 u16 frag, type;
1417 struct ieee80211_tx_status_rtap_hdr *rthdr; 1379 struct ieee80211_tx_status_rtap_hdr *rthdr;
1418 struct ieee80211_sub_if_data *sdata; 1380 struct ieee80211_sub_if_data *sdata;
1419 struct net_device *prev_dev = NULL; 1381 struct net_device *prev_dev = NULL;
1420 1382
1421 if (!status) {
1422 printk(KERN_ERR
1423 "%s: ieee80211_tx_status called with NULL status\n",
1424 wiphy_name(local->hw.wiphy));
1425 dev_kfree_skb(skb);
1426 return;
1427 }
1428
1429 rcu_read_lock(); 1383 rcu_read_lock();
1430 1384
1431 if (status->excessive_retries) { 1385 if (info->status.excessive_retries) {
1432 struct sta_info *sta; 1386 struct sta_info *sta;
1433 sta = sta_info_get(local, hdr->addr1); 1387 sta = sta_info_get(local, hdr->addr1);
1434 if (sta) { 1388 if (sta) {
@@ -1437,27 +1391,23 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
1437 * The STA is in power save mode, so assume 1391 * The STA is in power save mode, so assume
1438 * that this TX packet failed because of that. 1392 * that this TX packet failed because of that.
1439 */ 1393 */
1440 status->excessive_retries = 0; 1394 ieee80211_handle_filtered_frame(local, sta, skb);
1441 status->flags |= IEEE80211_TX_STATUS_TX_FILTERED;
1442 ieee80211_handle_filtered_frame(local, sta,
1443 skb, status);
1444 rcu_read_unlock(); 1395 rcu_read_unlock();
1445 return; 1396 return;
1446 } 1397 }
1447 } 1398 }
1448 } 1399 }
1449 1400
1450 if (status->flags & IEEE80211_TX_STATUS_TX_FILTERED) { 1401 if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
1451 struct sta_info *sta; 1402 struct sta_info *sta;
1452 sta = sta_info_get(local, hdr->addr1); 1403 sta = sta_info_get(local, hdr->addr1);
1453 if (sta) { 1404 if (sta) {
1454 ieee80211_handle_filtered_frame(local, sta, skb, 1405 ieee80211_handle_filtered_frame(local, sta, skb);
1455 status);
1456 rcu_read_unlock(); 1406 rcu_read_unlock();
1457 return; 1407 return;
1458 } 1408 }
1459 } else 1409 } else
1460 rate_control_tx_status(local->mdev, skb, status); 1410 rate_control_tx_status(local->mdev, skb);
1461 1411
1462 rcu_read_unlock(); 1412 rcu_read_unlock();
1463 1413
@@ -1471,14 +1421,14 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
1471 frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; 1421 frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
1472 type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE; 1422 type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE;
1473 1423
1474 if (status->flags & IEEE80211_TX_STATUS_ACK) { 1424 if (info->flags & IEEE80211_TX_STAT_ACK) {
1475 if (frag == 0) { 1425 if (frag == 0) {
1476 local->dot11TransmittedFrameCount++; 1426 local->dot11TransmittedFrameCount++;
1477 if (is_multicast_ether_addr(hdr->addr1)) 1427 if (is_multicast_ether_addr(hdr->addr1))
1478 local->dot11MulticastTransmittedFrameCount++; 1428 local->dot11MulticastTransmittedFrameCount++;
1479 if (status->retry_count > 0) 1429 if (info->status.retry_count > 0)
1480 local->dot11RetryCount++; 1430 local->dot11RetryCount++;
1481 if (status->retry_count > 1) 1431 if (info->status.retry_count > 1)
1482 local->dot11MultipleRetryCount++; 1432 local->dot11MultipleRetryCount++;
1483 } 1433 }
1484 1434
@@ -1524,17 +1474,17 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
1524 cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | 1474 cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) |
1525 (1 << IEEE80211_RADIOTAP_DATA_RETRIES)); 1475 (1 << IEEE80211_RADIOTAP_DATA_RETRIES));
1526 1476
1527 if (!(status->flags & IEEE80211_TX_STATUS_ACK) && 1477 if (!(info->flags & IEEE80211_TX_STAT_ACK) &&
1528 !is_multicast_ether_addr(hdr->addr1)) 1478 !is_multicast_ether_addr(hdr->addr1))
1529 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); 1479 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL);
1530 1480
1531 if ((status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) && 1481 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) &&
1532 (status->control.flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) 1482 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT))
1533 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); 1483 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS);
1534 else if (status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) 1484 else if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
1535 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); 1485 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS);
1536 1486
1537 rthdr->data_retries = status->retry_count; 1487 rthdr->data_retries = info->status.retry_count;
1538 1488
1539 /* XXX: is this sufficient for BPF? */ 1489 /* XXX: is this sufficient for BPF? */
1540 skb_set_mac_header(skb, 0); 1490 skb_set_mac_header(skb, 0);
@@ -1895,7 +1845,9 @@ static int __init ieee80211_init(void)
1895 struct sk_buff *skb; 1845 struct sk_buff *skb;
1896 int ret; 1846 int ret;
1897 1847
1898 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); 1848 BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
1849 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
1850 IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
1899 1851
1900 ret = rc80211_pid_init(); 1852 ret = rc80211_pid_init();
1901 if (ret) 1853 if (ret)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 604149369dc9..9a264379d7b1 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -578,7 +578,7 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
578 int encrypt) 578 int encrypt)
579{ 579{
580 struct ieee80211_sub_if_data *sdata; 580 struct ieee80211_sub_if_data *sdata;
581 struct ieee80211_tx_packet_data *pkt_data; 581 struct ieee80211_tx_info *info;
582 582
583 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 583 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
584 skb->dev = sdata->local->mdev; 584 skb->dev = sdata->local->mdev;
@@ -586,11 +586,11 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
586 skb_set_network_header(skb, 0); 586 skb_set_network_header(skb, 0);
587 skb_set_transport_header(skb, 0); 587 skb_set_transport_header(skb, 0);
588 588
589 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 589 info = IEEE80211_SKB_CB(skb);
590 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 590 memset(info, 0, sizeof(struct ieee80211_tx_info));
591 pkt_data->ifindex = sdata->dev->ifindex; 591 info->control.ifindex = sdata->dev->ifindex;
592 if (!encrypt) 592 if (!encrypt)
593 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; 593 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
594 594
595 dev_queue_xmit(skb); 595 dev_queue_xmit(skb);
596} 596}
@@ -2314,7 +2314,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2314 int res, rates, i, j; 2314 int res, rates, i, j;
2315 struct sk_buff *skb; 2315 struct sk_buff *skb;
2316 struct ieee80211_mgmt *mgmt; 2316 struct ieee80211_mgmt *mgmt;
2317 struct ieee80211_tx_control control; 2317 struct ieee80211_tx_info *control;
2318 struct rate_selection ratesel; 2318 struct rate_selection ratesel;
2319 u8 *pos; 2319 u8 *pos;
2320 struct ieee80211_sub_if_data *sdata; 2320 struct ieee80211_sub_if_data *sdata;
@@ -2404,21 +2404,22 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2404 memcpy(pos, &bss->supp_rates[8], rates); 2404 memcpy(pos, &bss->supp_rates[8], rates);
2405 } 2405 }
2406 2406
2407 memset(&control, 0, sizeof(control)); 2407 control = IEEE80211_SKB_CB(skb);
2408
2408 rate_control_get_rate(dev, sband, skb, &ratesel); 2409 rate_control_get_rate(dev, sband, skb, &ratesel);
2409 if (ratesel.rate_idx < 0) { 2410 if (ratesel.rate_idx < 0) {
2410 printk(KERN_DEBUG "%s: Failed to determine TX rate " 2411 printk(KERN_DEBUG "%s: Failed to determine TX rate "
2411 "for IBSS beacon\n", dev->name); 2412 "for IBSS beacon\n", dev->name);
2412 break; 2413 break;
2413 } 2414 }
2414 control.vif = &sdata->vif; 2415 control->control.vif = &sdata->vif;
2415 control.tx_rate_idx = ratesel.rate_idx; 2416 control->tx_rate_idx = ratesel.rate_idx;
2416 if (sdata->bss_conf.use_short_preamble && 2417 if (sdata->bss_conf.use_short_preamble &&
2417 sband->bitrates[ratesel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) 2418 sband->bitrates[ratesel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE)
2418 control.flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 2419 control->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
2419 control.antenna_sel_tx = local->hw.conf.antenna_sel_tx; 2420 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
2420 control.flags |= IEEE80211_TXCTL_NO_ACK; 2421 control->flags |= IEEE80211_TX_CTL_NO_ACK;
2421 control.retry_limit = 1; 2422 control->control.retry_limit = 1;
2422 2423
2423 ifsta->probe_resp = skb_copy(skb, GFP_ATOMIC); 2424 ifsta->probe_resp = skb_copy(skb, GFP_ATOMIC);
2424 if (ifsta->probe_resp) { 2425 if (ifsta->probe_resp) {
@@ -2433,8 +2434,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2433 } 2434 }
2434 2435
2435 if (local->ops->beacon_update && 2436 if (local->ops->beacon_update &&
2436 local->ops->beacon_update(local_to_hw(local), 2437 local->ops->beacon_update(local_to_hw(local), skb) == 0) {
2437 skb, &control) == 0) {
2438 printk(KERN_DEBUG "%s: Configured IBSS beacon " 2438 printk(KERN_DEBUG "%s: Configured IBSS beacon "
2439 "template\n", dev->name); 2439 "template\n", dev->name);
2440 skb = NULL; 2440 skb = NULL;
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index a29148dcca99..0ed9c8a2f56f 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -34,8 +34,7 @@ struct rate_control_ops {
34 struct module *module; 34 struct module *module;
35 const char *name; 35 const char *name;
36 void (*tx_status)(void *priv, struct net_device *dev, 36 void (*tx_status)(void *priv, struct net_device *dev,
37 struct sk_buff *skb, 37 struct sk_buff *skb);
38 struct ieee80211_tx_status *status);
39 void (*get_rate)(void *priv, struct net_device *dev, 38 void (*get_rate)(void *priv, struct net_device *dev,
40 struct ieee80211_supported_band *band, 39 struct ieee80211_supported_band *band,
41 struct sk_buff *skb, 40 struct sk_buff *skb,
@@ -77,13 +76,12 @@ struct rate_control_ref *rate_control_get(struct rate_control_ref *ref);
77void rate_control_put(struct rate_control_ref *ref); 76void rate_control_put(struct rate_control_ref *ref);
78 77
79static inline void rate_control_tx_status(struct net_device *dev, 78static inline void rate_control_tx_status(struct net_device *dev,
80 struct sk_buff *skb, 79 struct sk_buff *skb)
81 struct ieee80211_tx_status *status)
82{ 80{
83 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 81 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
84 struct rate_control_ref *ref = local->rate_ctrl; 82 struct rate_control_ref *ref = local->rate_ctrl;
85 83
86 ref->ops->tx_status(ref->priv, dev, skb, status); 84 ref->ops->tx_status(ref->priv, dev, skb);
87} 85}
88 86
89 87
diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h
index 04afc13ed825..2078803d3581 100644
--- a/net/mac80211/rc80211_pid.h
+++ b/net/mac80211/rc80211_pid.h
@@ -61,7 +61,7 @@ enum rc_pid_event_type {
61union rc_pid_event_data { 61union rc_pid_event_data {
62 /* RC_PID_EVENT_TX_STATUS */ 62 /* RC_PID_EVENT_TX_STATUS */
63 struct { 63 struct {
64 struct ieee80211_tx_status tx_status; 64 struct ieee80211_tx_info tx_status;
65 }; 65 };
66 /* RC_PID_EVENT_TYPE_RATE_CHANGE */ 66 /* RC_PID_EVENT_TYPE_RATE_CHANGE */
67 /* RC_PID_EVENT_TYPE_TX_RATE */ 67 /* RC_PID_EVENT_TYPE_TX_RATE */
@@ -158,7 +158,7 @@ struct rc_pid_debugfs_entries {
158}; 158};
159 159
160void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, 160void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf,
161 struct ieee80211_tx_status *stat); 161 struct ieee80211_tx_info *stat);
162 162
163void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf, 163void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf,
164 int index, int rate); 164 int index, int rate);
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 14cde36f5070..e8945413e4a2 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -237,8 +237,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
237} 237}
238 238
239static void rate_control_pid_tx_status(void *priv, struct net_device *dev, 239static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
240 struct sk_buff *skb, 240 struct sk_buff *skb)
241 struct ieee80211_tx_status *status)
242{ 241{
243 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 242 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
244 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 243 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -248,6 +247,7 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
248 struct rc_pid_sta_info *spinfo; 247 struct rc_pid_sta_info *spinfo;
249 unsigned long period; 248 unsigned long period;
250 struct ieee80211_supported_band *sband; 249 struct ieee80211_supported_band *sband;
250 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
251 251
252 rcu_read_lock(); 252 rcu_read_lock();
253 253
@@ -266,28 +266,28 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
266 266
267 /* Ignore all frames that were sent with a different rate than the rate 267 /* Ignore all frames that were sent with a different rate than the rate
268 * we currently advise mac80211 to use. */ 268 * we currently advise mac80211 to use. */
269 if (status->control.tx_rate_idx != sta->txrate_idx) 269 if (info->tx_rate_idx != sta->txrate_idx)
270 goto unlock; 270 goto unlock;
271 271
272 spinfo = sta->rate_ctrl_priv; 272 spinfo = sta->rate_ctrl_priv;
273 spinfo->tx_num_xmit++; 273 spinfo->tx_num_xmit++;
274 274
275#ifdef CONFIG_MAC80211_DEBUGFS 275#ifdef CONFIG_MAC80211_DEBUGFS
276 rate_control_pid_event_tx_status(&spinfo->events, status); 276 rate_control_pid_event_tx_status(&spinfo->events, info);
277#endif 277#endif
278 278
279 /* We count frames that totally failed to be transmitted as two bad 279 /* We count frames that totally failed to be transmitted as two bad
280 * frames, those that made it out but had some retries as one good and 280 * frames, those that made it out but had some retries as one good and
281 * one bad frame. */ 281 * one bad frame. */
282 if (status->excessive_retries) { 282 if (info->status.excessive_retries) {
283 spinfo->tx_num_failed += 2; 283 spinfo->tx_num_failed += 2;
284 spinfo->tx_num_xmit++; 284 spinfo->tx_num_xmit++;
285 } else if (status->retry_count) { 285 } else if (info->status.retry_count) {
286 spinfo->tx_num_failed++; 286 spinfo->tx_num_failed++;
287 spinfo->tx_num_xmit++; 287 spinfo->tx_num_xmit++;
288 } 288 }
289 289
290 if (status->excessive_retries) { 290 if (info->status.excessive_retries) {
291 sta->tx_retry_failed++; 291 sta->tx_retry_failed++;
292 sta->tx_num_consecutive_failures++; 292 sta->tx_num_consecutive_failures++;
293 sta->tx_num_mpdu_fail++; 293 sta->tx_num_mpdu_fail++;
@@ -295,8 +295,8 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
295 sta->tx_num_consecutive_failures = 0; 295 sta->tx_num_consecutive_failures = 0;
296 sta->tx_num_mpdu_ok++; 296 sta->tx_num_mpdu_ok++;
297 } 297 }
298 sta->tx_retry_count += status->retry_count; 298 sta->tx_retry_count += info->status.retry_count;
299 sta->tx_num_mpdu_fail += status->retry_count; 299 sta->tx_num_mpdu_fail += info->status.retry_count;
300 300
301 /* Update PID controller state. */ 301 /* Update PID controller state. */
302 period = (HZ * pinfo->sampling_period + 500) / 1000; 302 period = (HZ * pinfo->sampling_period + 500) / 1000;
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c
index ff5c380f3c13..8121d3bc6835 100644
--- a/net/mac80211/rc80211_pid_debugfs.c
+++ b/net/mac80211/rc80211_pid_debugfs.c
@@ -39,11 +39,11 @@ static void rate_control_pid_event(struct rc_pid_event_buffer *buf,
39} 39}
40 40
41void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, 41void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf,
42 struct ieee80211_tx_status *stat) 42 struct ieee80211_tx_info *stat)
43{ 43{
44 union rc_pid_event_data evd; 44 union rc_pid_event_data evd;
45 45
46 memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_status)); 46 memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_info));
47 rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd); 47 rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd);
48} 48}
49 49
@@ -167,8 +167,8 @@ static ssize_t rate_control_pid_events_read(struct file *file, char __user *buf,
167 switch (ev->type) { 167 switch (ev->type) {
168 case RC_PID_EVENT_TYPE_TX_STATUS: 168 case RC_PID_EVENT_TYPE_TX_STATUS:
169 p += snprintf(pb + p, length - p, "tx_status %u %u", 169 p += snprintf(pb + p, length - p, "tx_status %u %u",
170 ev->data.tx_status.excessive_retries, 170 ev->data.tx_status.status.excessive_retries,
171 ev->data.tx_status.retry_count); 171 ev->data.tx_status.status.retry_count);
172 break; 172 break;
173 case RC_PID_EVENT_TYPE_RATE_CHANGE: 173 case RC_PID_EVENT_TYPE_RATE_CHANGE:
174 p += snprintf(pb + p, length - p, "rate_change %d %d", 174 p += snprintf(pb + p, length - p, "rate_change %d %d",
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index fa68305fd59e..cf0de3b0fe24 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -714,7 +714,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
714 struct sk_buff *skb; 714 struct sk_buff *skb;
715 int sent = 0; 715 int sent = 0;
716 struct ieee80211_sub_if_data *sdata; 716 struct ieee80211_sub_if_data *sdata;
717 struct ieee80211_tx_packet_data *pkt_data; 717 struct ieee80211_tx_info *info;
718 DECLARE_MAC_BUF(mac); 718 DECLARE_MAC_BUF(mac);
719 719
720 sdata = sta->sdata; 720 sdata = sta->sdata;
@@ -734,13 +734,13 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
734 734
735 /* Send all buffered frames to the station */ 735 /* Send all buffered frames to the station */
736 while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { 736 while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
737 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 737 info = IEEE80211_SKB_CB(skb);
738 sent++; 738 sent++;
739 pkt_data->flags |= IEEE80211_TXPD_REQUEUE; 739 info->flags |= IEEE80211_TX_CTL_REQUEUE;
740 dev_queue_xmit(skb); 740 dev_queue_xmit(skb);
741 } 741 }
742 while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { 742 while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
743 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 743 info = IEEE80211_SKB_CB(skb);
744 local->total_ps_buffered--; 744 local->total_ps_buffered--;
745 sent++; 745 sent++;
746#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 746#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
@@ -748,7 +748,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
748 "since STA not sleeping anymore\n", dev->name, 748 "since STA not sleeping anymore\n", dev->name,
749 print_mac(mac, sta->addr), sta->aid); 749 print_mac(mac, sta->addr), sta->aid);
750#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 750#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
751 pkt_data->flags |= IEEE80211_TXPD_REQUEUE; 751 info->flags |= IEEE80211_TX_CTL_REQUEUE;
752 dev_queue_xmit(skb); 752 dev_queue_xmit(skb);
753 } 753 }
754 754
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index baf5e4746884..ef3149324d54 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -511,20 +511,20 @@ static inline int sta_info_buffer_expired(struct ieee80211_local *local,
511 struct sta_info *sta, 511 struct sta_info *sta,
512 struct sk_buff *skb) 512 struct sk_buff *skb)
513{ 513{
514 struct ieee80211_tx_packet_data *pkt_data; 514 struct ieee80211_tx_info *info;
515 int timeout; 515 int timeout;
516 516
517 if (!skb) 517 if (!skb)
518 return 0; 518 return 0;
519 519
520 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 520 info = IEEE80211_SKB_CB(skb);
521 521
522 /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ 522 /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */
523 timeout = (sta->listen_interval * local->hw.conf.beacon_int * 32 / 523 timeout = (sta->listen_interval * local->hw.conf.beacon_int * 32 /
524 15625) * HZ; 524 15625) * HZ;
525 if (timeout < STA_TX_BUFFER_EXPIRE) 525 if (timeout < STA_TX_BUFFER_EXPIRE)
526 timeout = STA_TX_BUFFER_EXPIRE; 526 timeout = STA_TX_BUFFER_EXPIRE;
527 return time_after(jiffies, pkt_data->jiffies + timeout); 527 return time_after(jiffies, info->control.jiffies + timeout);
528} 528}
529 529
530 530
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index e89cc1655547..f592290e42b9 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -32,7 +32,7 @@
32 * @WLAN_STA_WDS: Station is one of our WDS peers. 32 * @WLAN_STA_WDS: Station is one of our WDS peers.
33 * @WLAN_STA_PSPOLL: Station has just PS-polled us. 33 * @WLAN_STA_PSPOLL: Station has just PS-polled us.
34 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the 34 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
35 * IEEE80211_TXCTL_CLEAR_PS_FILT control flag) when the next 35 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
36 * frame to this station is transmitted. 36 * frame to this station is transmitted.
37 */ 37 */
38enum ieee80211_sta_info_flags { 38enum ieee80211_sta_info_flags {
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 666158f02a89..ac9a4af7ad42 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -238,12 +238,12 @@ static ieee80211_tx_result
238ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) 238ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
239{ 239{
240#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 240#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
241 struct sk_buff *skb = tx->skb; 241 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
242 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
243#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 242#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
243 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
244 u32 sta_flags; 244 u32 sta_flags;
245 245
246 if (unlikely(tx->flags & IEEE80211_TX_INJECTED)) 246 if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
247 return TX_CONTINUE; 247 return TX_CONTINUE;
248 248
249 if (unlikely(tx->local->sta_sw_scanning) && 249 if (unlikely(tx->local->sta_sw_scanning) &&
@@ -348,6 +348,8 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
348static ieee80211_tx_result 348static ieee80211_tx_result
349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) 349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
350{ 350{
351 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
352
351 /* 353 /*
352 * broadcast/multicast frame 354 * broadcast/multicast frame
353 * 355 *
@@ -383,7 +385,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
383 } 385 }
384 386
385 /* buffered in hardware */ 387 /* buffered in hardware */
386 tx->control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; 388 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM;
387 389
388 return TX_CONTINUE; 390 return TX_CONTINUE;
389} 391}
@@ -392,6 +394,7 @@ static ieee80211_tx_result
392ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) 394ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
393{ 395{
394 struct sta_info *sta = tx->sta; 396 struct sta_info *sta = tx->sta;
397 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
395 u32 staflags; 398 u32 staflags;
396 DECLARE_MAC_BUF(mac); 399 DECLARE_MAC_BUF(mac);
397 400
@@ -404,7 +407,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
404 407
405 if (unlikely((staflags & WLAN_STA_PS) && 408 if (unlikely((staflags & WLAN_STA_PS) &&
406 !(staflags & WLAN_STA_PSPOLL))) { 409 !(staflags & WLAN_STA_PSPOLL))) {
407 struct ieee80211_tx_packet_data *pkt_data;
408#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 410#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
409 printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " 411 printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries "
410 "before %d)\n", 412 "before %d)\n",
@@ -428,8 +430,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
428 if (skb_queue_empty(&sta->ps_tx_buf)) 430 if (skb_queue_empty(&sta->ps_tx_buf))
429 sta_info_set_tim_bit(sta); 431 sta_info_set_tim_bit(sta);
430 432
431 pkt_data = (struct ieee80211_tx_packet_data *)tx->skb->cb; 433 info->control.jiffies = jiffies;
432 pkt_data->jiffies = jiffies;
433 skb_queue_tail(&sta->ps_tx_buf, tx->skb); 434 skb_queue_tail(&sta->ps_tx_buf, tx->skb);
434 return TX_QUEUED; 435 return TX_QUEUED;
435 } 436 }
@@ -461,17 +462,18 @@ static ieee80211_tx_result
461ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) 462ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
462{ 463{
463 struct ieee80211_key *key; 464 struct ieee80211_key *key;
465 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
464 u16 fc = tx->fc; 466 u16 fc = tx->fc;
465 467
466 if (unlikely(tx->control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 468 if (unlikely(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
467 tx->key = NULL; 469 tx->key = NULL;
468 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 470 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
469 tx->key = key; 471 tx->key = key;
470 else if ((key = rcu_dereference(tx->sdata->default_key))) 472 else if ((key = rcu_dereference(tx->sdata->default_key)))
471 tx->key = key; 473 tx->key = key;
472 else if (tx->sdata->drop_unencrypted && 474 else if (tx->sdata->drop_unencrypted &&
473 !(tx->control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && 475 !(info->flags & IEEE80211_TX_CTL_EAPOL_FRAME) &&
474 !(tx->flags & IEEE80211_TX_INJECTED)) { 476 !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
475 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 477 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
476 return TX_DROP; 478 return TX_DROP;
477 } else 479 } else
@@ -500,7 +502,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
500 } 502 }
501 503
502 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 504 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
503 tx->control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 505 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
504 506
505 return TX_CONTINUE; 507 return TX_CONTINUE;
506} 508}
@@ -510,6 +512,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
510{ 512{
511 struct rate_selection rsel; 513 struct rate_selection rsel;
512 struct ieee80211_supported_band *sband; 514 struct ieee80211_supported_band *sband;
515 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
513 516
514 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 517 sband = tx->local->hw.wiphy->bands[tx->channel->band];
515 518
@@ -517,18 +520,17 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
517 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); 520 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel);
518 tx->rate_idx = rsel.rate_idx; 521 tx->rate_idx = rsel.rate_idx;
519 if (unlikely(rsel.probe_idx >= 0)) { 522 if (unlikely(rsel.probe_idx >= 0)) {
520 tx->control->flags |= 523 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
521 IEEE80211_TXCTL_RATE_CTRL_PROBE;
522 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; 524 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
523 tx->control->alt_retry_rate_idx = tx->rate_idx; 525 info->control.alt_retry_rate_idx = tx->rate_idx;
524 tx->rate_idx = rsel.probe_idx; 526 tx->rate_idx = rsel.probe_idx;
525 } else 527 } else
526 tx->control->alt_retry_rate_idx = -1; 528 info->control.alt_retry_rate_idx = -1;
527 529
528 if (unlikely(tx->rate_idx < 0)) 530 if (unlikely(tx->rate_idx < 0))
529 return TX_DROP; 531 return TX_DROP;
530 } else 532 } else
531 tx->control->alt_retry_rate_idx = -1; 533 info->control.alt_retry_rate_idx = -1;
532 534
533 if (tx->sdata->bss_conf.use_cts_prot && 535 if (tx->sdata->bss_conf.use_cts_prot &&
534 (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { 536 (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) {
@@ -538,13 +540,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
538 else 540 else
539 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; 541 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
540 tx->rate_idx = rsel.nonerp_idx; 542 tx->rate_idx = rsel.nonerp_idx;
541 tx->control->tx_rate_idx = rsel.nonerp_idx; 543 info->tx_rate_idx = rsel.nonerp_idx;
542 tx->control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 544 info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
543 } else { 545 } else {
544 tx->last_frag_rate_idx = tx->rate_idx; 546 tx->last_frag_rate_idx = tx->rate_idx;
545 tx->control->tx_rate_idx = tx->rate_idx; 547 info->tx_rate_idx = tx->rate_idx;
546 } 548 }
547 tx->control->tx_rate_idx = tx->rate_idx; 549 info->tx_rate_idx = tx->rate_idx;
548 550
549 return TX_CONTINUE; 551 return TX_CONTINUE;
550} 552}
@@ -555,28 +557,32 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
555 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 557 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
556 u16 fc = le16_to_cpu(hdr->frame_control); 558 u16 fc = le16_to_cpu(hdr->frame_control);
557 u16 dur; 559 u16 dur;
558 struct ieee80211_tx_control *control = tx->control; 560 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
559 struct ieee80211_supported_band *sband; 561 struct ieee80211_supported_band *sband;
560 562
561 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 563 sband = tx->local->hw.wiphy->bands[tx->channel->band];
562 564
563 if (!control->retry_limit) { 565 if (tx->sta)
566 info->control.aid = tx->sta->aid;
567
568 if (!info->control.retry_limit) {
564 if (!is_multicast_ether_addr(hdr->addr1)) { 569 if (!is_multicast_ether_addr(hdr->addr1)) {
565 if (tx->skb->len + FCS_LEN > tx->local->rts_threshold 570 int len = min_t(int, tx->skb->len + FCS_LEN,
571 tx->local->fragmentation_threshold);
572 if (len > tx->local->rts_threshold
566 && tx->local->rts_threshold < 573 && tx->local->rts_threshold <
567 IEEE80211_MAX_RTS_THRESHOLD) { 574 IEEE80211_MAX_RTS_THRESHOLD) {
568 control->flags |= 575 info->flags |= IEEE80211_TX_CTL_USE_RTS_CTS;
569 IEEE80211_TXCTL_USE_RTS_CTS; 576 info->flags |=
570 control->flags |= 577 IEEE80211_TX_CTL_LONG_RETRY_LIMIT;
571 IEEE80211_TXCTL_LONG_RETRY_LIMIT; 578 info->control.retry_limit =
572 control->retry_limit =
573 tx->local->long_retry_limit; 579 tx->local->long_retry_limit;
574 } else { 580 } else {
575 control->retry_limit = 581 info->control.retry_limit =
576 tx->local->short_retry_limit; 582 tx->local->short_retry_limit;
577 } 583 }
578 } else { 584 } else {
579 control->retry_limit = 1; 585 info->control.retry_limit = 1;
580 } 586 }
581 } 587 }
582 588
@@ -585,7 +591,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
585 * frames. 591 * frames.
586 * TODO: The last fragment could still use multiple retry 592 * TODO: The last fragment could still use multiple retry
587 * rates. */ 593 * rates. */
588 control->alt_retry_rate_idx = -1; 594 info->control.alt_retry_rate_idx = -1;
589 } 595 }
590 596
591 /* Use CTS protection for unicast frames sent using extended rates if 597 /* Use CTS protection for unicast frames sent using extended rates if
@@ -595,8 +601,8 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
595 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && 601 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) &&
596 (tx->flags & IEEE80211_TX_UNICAST) && 602 (tx->flags & IEEE80211_TX_UNICAST) &&
597 tx->sdata->bss_conf.use_cts_prot && 603 tx->sdata->bss_conf.use_cts_prot &&
598 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 604 !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS))
599 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 605 info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT;
600 606
601 /* Transmit data frames using short preambles if the driver supports 607 /* Transmit data frames using short preambles if the driver supports
602 * short preambles at the selected rate and short preambles are 608 * short preambles at the selected rate and short preambles are
@@ -605,7 +611,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
605 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && 611 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) &&
606 tx->sdata->bss_conf.use_short_preamble && 612 tx->sdata->bss_conf.use_short_preamble &&
607 (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { 613 (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) {
608 tx->control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 614 info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
609 } 615 }
610 616
611 /* Setup duration field for the first fragment of the frame. Duration 617 /* Setup duration field for the first fragment of the frame. Duration
@@ -616,8 +622,8 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
616 tx->extra_frag[0]->len : 0); 622 tx->extra_frag[0]->len : 0);
617 hdr->duration_id = cpu_to_le16(dur); 623 hdr->duration_id = cpu_to_le16(dur);
618 624
619 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 625 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
620 (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { 626 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
621 struct ieee80211_supported_band *sband; 627 struct ieee80211_supported_band *sband;
622 struct ieee80211_rate *rate; 628 struct ieee80211_rate *rate;
623 s8 baserate = -1; 629 s8 baserate = -1;
@@ -626,7 +632,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
626 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 632 sband = tx->local->hw.wiphy->bands[tx->channel->band];
627 633
628 /* Do not use multiple retry rates when using RTS/CTS */ 634 /* Do not use multiple retry rates when using RTS/CTS */
629 control->alt_retry_rate_idx = -1; 635 info->control.alt_retry_rate_idx = -1;
630 636
631 /* Use min(data rate, max base rate) as CTS/RTS rate */ 637 /* Use min(data rate, max base rate) as CTS/RTS rate */
632 rate = &sband->bitrates[tx->rate_idx]; 638 rate = &sband->bitrates[tx->rate_idx];
@@ -642,13 +648,13 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
642 } 648 }
643 649
644 if (baserate >= 0) 650 if (baserate >= 0)
645 control->rts_cts_rate_idx = baserate; 651 info->control.rts_cts_rate_idx = baserate;
646 else 652 else
647 control->rts_cts_rate_idx = 0; 653 info->control.rts_cts_rate_idx = 0;
648 } 654 }
649 655
650 if (tx->sta) 656 if (tx->sta)
651 control->aid = tx->sta->aid; 657 info->control.aid = tx->sta->aid;
652 658
653 return TX_CONTINUE; 659 return TX_CONTINUE;
654} 660}
@@ -762,6 +768,7 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
762 u32 load = 0, hdrtime; 768 u32 load = 0, hdrtime;
763 struct ieee80211_rate *rate; 769 struct ieee80211_rate *rate;
764 struct ieee80211_supported_band *sband; 770 struct ieee80211_supported_band *sband;
771 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
765 772
766 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 773 sband = tx->local->hw.wiphy->bands[tx->channel->band];
767 rate = &sband->bitrates[tx->rate_idx]; 774 rate = &sband->bitrates[tx->rate_idx];
@@ -786,9 +793,9 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
786 if (!is_multicast_ether_addr(hdr->addr1)) 793 if (!is_multicast_ether_addr(hdr->addr1))
787 load += hdrtime; 794 load += hdrtime;
788 795
789 if (tx->control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 796 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
790 load += 2 * hdrtime; 797 load += 2 * hdrtime;
791 else if (tx->control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 798 else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
792 load += hdrtime; 799 load += hdrtime;
793 800
794 /* TODO: optimise again */ 801 /* TODO: optimise again */
@@ -839,6 +846,7 @@ static ieee80211_tx_handler ieee80211_tx_handlers[] =
839 ieee80211_tx_h_rate_ctrl, 846 ieee80211_tx_h_rate_ctrl,
840 ieee80211_tx_h_misc, 847 ieee80211_tx_h_misc,
841 ieee80211_tx_h_fragment, 848 ieee80211_tx_h_fragment,
849 /* handlers after fragment must be aware of tx info fragmentation! */
842 ieee80211_tx_h_encrypt, 850 ieee80211_tx_h_encrypt,
843 ieee80211_tx_h_stats, 851 ieee80211_tx_h_stats,
844 NULL 852 NULL
@@ -867,12 +875,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
867 (struct ieee80211_radiotap_header *) skb->data; 875 (struct ieee80211_radiotap_header *) skb->data;
868 struct ieee80211_supported_band *sband; 876 struct ieee80211_supported_band *sband;
869 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); 877 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len);
870 struct ieee80211_tx_control *control = tx->control; 878 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
871 879
872 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 880 sband = tx->local->hw.wiphy->bands[tx->channel->band];
873 881
874 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 882 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
875 tx->flags |= IEEE80211_TX_INJECTED; 883 info->flags |= IEEE80211_TX_CTL_INJECTED;
876 tx->flags &= ~IEEE80211_TX_FRAGMENTED; 884 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
877 885
878 /* 886 /*
@@ -920,7 +928,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
920 * radiotap uses 0 for 1st ant, mac80211 is 1 for 928 * radiotap uses 0 for 1st ant, mac80211 is 1 for
921 * 1st ant 929 * 1st ant
922 */ 930 */
923 control->antenna_sel_tx = (*iterator.this_arg) + 1; 931 info->antenna_sel_tx = (*iterator.this_arg) + 1;
924 break; 932 break;
925 933
926#if 0 934#if 0
@@ -944,8 +952,8 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
944 skb_trim(skb, skb->len - FCS_LEN); 952 skb_trim(skb, skb->len - FCS_LEN);
945 } 953 }
946 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) 954 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
947 control->flags &= 955 info->flags &=
948 ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; 956 ~IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
949 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 957 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
950 tx->flags |= IEEE80211_TX_FRAGMENTED; 958 tx->flags |= IEEE80211_TX_FRAGMENTED;
951 break; 959 break;
@@ -980,12 +988,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
980static ieee80211_tx_result 988static ieee80211_tx_result
981__ieee80211_tx_prepare(struct ieee80211_tx_data *tx, 989__ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
982 struct sk_buff *skb, 990 struct sk_buff *skb,
983 struct net_device *dev, 991 struct net_device *dev)
984 struct ieee80211_tx_control *control)
985{ 992{
986 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 993 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
987 struct ieee80211_hdr *hdr; 994 struct ieee80211_hdr *hdr;
988 struct ieee80211_sub_if_data *sdata; 995 struct ieee80211_sub_if_data *sdata;
996 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
989 997
990 int hdrlen; 998 int hdrlen;
991 999
@@ -994,7 +1002,7 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
994 tx->dev = dev; /* use original interface */ 1002 tx->dev = dev; /* use original interface */
995 tx->local = local; 1003 tx->local = local;
996 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1004 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev);
997 tx->control = control; 1005 tx->channel = local->hw.conf.channel;
998 /* 1006 /*
999 * Set this flag (used below to indicate "automatic fragmentation"), 1007 * Set this flag (used below to indicate "automatic fragmentation"),
1000 * it will be cleared/left by radiotap as desired. 1008 * it will be cleared/left by radiotap as desired.
@@ -1021,10 +1029,10 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1021 1029
1022 if (is_multicast_ether_addr(hdr->addr1)) { 1030 if (is_multicast_ether_addr(hdr->addr1)) {
1023 tx->flags &= ~IEEE80211_TX_UNICAST; 1031 tx->flags &= ~IEEE80211_TX_UNICAST;
1024 control->flags |= IEEE80211_TXCTL_NO_ACK; 1032 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1025 } else { 1033 } else {
1026 tx->flags |= IEEE80211_TX_UNICAST; 1034 tx->flags |= IEEE80211_TX_UNICAST;
1027 control->flags &= ~IEEE80211_TXCTL_NO_ACK; 1035 info->flags &= ~IEEE80211_TX_CTL_NO_ACK;
1028 } 1036 }
1029 1037
1030 if (tx->flags & IEEE80211_TX_FRAGMENTED) { 1038 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
@@ -1037,16 +1045,16 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1037 } 1045 }
1038 1046
1039 if (!tx->sta) 1047 if (!tx->sta)
1040 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; 1048 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1041 else if (test_and_clear_sta_flags(tx->sta, WLAN_STA_CLEAR_PS_FILT)) 1049 else if (test_and_clear_sta_flags(tx->sta, WLAN_STA_CLEAR_PS_FILT))
1042 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; 1050 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1043 1051
1044 hdrlen = ieee80211_get_hdrlen(tx->fc); 1052 hdrlen = ieee80211_get_hdrlen(tx->fc);
1045 if (skb->len > hdrlen + sizeof(rfc1042_header) + 2) { 1053 if (skb->len > hdrlen + sizeof(rfc1042_header) + 2) {
1046 u8 *pos = &skb->data[hdrlen + sizeof(rfc1042_header)]; 1054 u8 *pos = &skb->data[hdrlen + sizeof(rfc1042_header)];
1047 tx->ethertype = (pos[0] << 8) | pos[1]; 1055 tx->ethertype = (pos[0] << 8) | pos[1];
1048 } 1056 }
1049 control->flags |= IEEE80211_TXCTL_FIRST_FRAGMENT; 1057 info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
1050 1058
1051 return TX_CONTINUE; 1059 return TX_CONTINUE;
1052} 1060}
@@ -1056,14 +1064,12 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1056 */ 1064 */
1057static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, 1065static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1058 struct sk_buff *skb, 1066 struct sk_buff *skb,
1059 struct net_device *mdev, 1067 struct net_device *mdev)
1060 struct ieee80211_tx_control *control)
1061{ 1068{
1062 struct ieee80211_tx_packet_data *pkt_data; 1069 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1063 struct net_device *dev; 1070 struct net_device *dev;
1064 1071
1065 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1072 dev = dev_get_by_index(&init_net, info->control.ifindex);
1066 dev = dev_get_by_index(&init_net, pkt_data->ifindex);
1067 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { 1073 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) {
1068 dev_put(dev); 1074 dev_put(dev);
1069 dev = NULL; 1075 dev = NULL;
@@ -1071,7 +1077,7 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1071 if (unlikely(!dev)) 1077 if (unlikely(!dev))
1072 return -ENODEV; 1078 return -ENODEV;
1073 /* initialises tx with control */ 1079 /* initialises tx with control */
1074 __ieee80211_tx_prepare(tx, skb, dev, control); 1080 __ieee80211_tx_prepare(tx, skb, dev);
1075 dev_put(dev); 1081 dev_put(dev);
1076 return 0; 1082 return 0;
1077} 1083}
@@ -1079,7 +1085,7 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1079static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, 1085static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1080 struct ieee80211_tx_data *tx) 1086 struct ieee80211_tx_data *tx)
1081{ 1087{
1082 struct ieee80211_tx_control *control = tx->control; 1088 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1083 int ret, i; 1089 int ret, i;
1084 1090
1085 if (!ieee80211_qdisc_installed(local->mdev) && 1091 if (!ieee80211_qdisc_installed(local->mdev) &&
@@ -1090,39 +1096,39 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1090 if (skb) { 1096 if (skb) {
1091 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1097 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1092 "TX to low-level driver", skb); 1098 "TX to low-level driver", skb);
1093 ret = local->ops->tx(local_to_hw(local), skb, control); 1099 ret = local->ops->tx(local_to_hw(local), skb);
1094 if (ret) 1100 if (ret)
1095 return IEEE80211_TX_AGAIN; 1101 return IEEE80211_TX_AGAIN;
1096 local->mdev->trans_start = jiffies; 1102 local->mdev->trans_start = jiffies;
1097 ieee80211_led_tx(local, 1); 1103 ieee80211_led_tx(local, 1);
1098 } 1104 }
1099 if (tx->extra_frag) { 1105 if (tx->extra_frag) {
1100 control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS |
1101 IEEE80211_TXCTL_USE_CTS_PROTECT |
1102 IEEE80211_TXCTL_CLEAR_PS_FILT |
1103 IEEE80211_TXCTL_FIRST_FRAGMENT);
1104 for (i = 0; i < tx->num_extra_frag; i++) { 1106 for (i = 0; i < tx->num_extra_frag; i++) {
1105 if (!tx->extra_frag[i]) 1107 if (!tx->extra_frag[i])
1106 continue; 1108 continue;
1107 if (__ieee80211_queue_stopped(local, control->queue)) 1109 info = IEEE80211_SKB_CB(tx->extra_frag[i]);
1110 info->flags &= ~(IEEE80211_TX_CTL_USE_RTS_CTS |
1111 IEEE80211_TX_CTL_USE_CTS_PROTECT |
1112 IEEE80211_TX_CTL_CLEAR_PS_FILT |
1113 IEEE80211_TX_CTL_FIRST_FRAGMENT);
1114 if (__ieee80211_queue_stopped(local, info->queue))
1108 return IEEE80211_TX_FRAG_AGAIN; 1115 return IEEE80211_TX_FRAG_AGAIN;
1109 if (i == tx->num_extra_frag) { 1116 if (i == tx->num_extra_frag) {
1110 control->tx_rate_idx = tx->last_frag_rate_idx; 1117 info->tx_rate_idx = tx->last_frag_rate_idx;
1111 1118
1112 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) 1119 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG)
1113 control->flags |= 1120 info->flags |=
1114 IEEE80211_TXCTL_RATE_CTRL_PROBE; 1121 IEEE80211_TX_CTL_RATE_CTRL_PROBE;
1115 else 1122 else
1116 control->flags &= 1123 info->flags &=
1117 ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 1124 ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
1118 } 1125 }
1119 1126
1120 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1127 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1121 "TX to low-level driver", 1128 "TX to low-level driver",
1122 tx->extra_frag[i]); 1129 tx->extra_frag[i]);
1123 ret = local->ops->tx(local_to_hw(local), 1130 ret = local->ops->tx(local_to_hw(local),
1124 tx->extra_frag[i], 1131 tx->extra_frag[i]);
1125 control);
1126 if (ret) 1132 if (ret)
1127 return IEEE80211_TX_FRAG_AGAIN; 1133 return IEEE80211_TX_FRAG_AGAIN;
1128 local->mdev->trans_start = jiffies; 1134 local->mdev->trans_start = jiffies;
@@ -1135,17 +1141,18 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1135 return IEEE80211_TX_OK; 1141 return IEEE80211_TX_OK;
1136} 1142}
1137 1143
1138static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, 1144static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
1139 struct ieee80211_tx_control *control)
1140{ 1145{
1141 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1146 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1142 struct sta_info *sta; 1147 struct sta_info *sta;
1143 ieee80211_tx_handler *handler; 1148 ieee80211_tx_handler *handler;
1144 struct ieee80211_tx_data tx; 1149 struct ieee80211_tx_data tx;
1145 ieee80211_tx_result res = TX_DROP, res_prepare; 1150 ieee80211_tx_result res = TX_DROP, res_prepare;
1151 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1146 int ret, i; 1152 int ret, i;
1153 int queue = info->queue;
1147 1154
1148 WARN_ON(__ieee80211_queue_pending(local, control->queue)); 1155 WARN_ON(__ieee80211_queue_pending(local, queue));
1149 1156
1150 if (unlikely(skb->len < 10)) { 1157 if (unlikely(skb->len < 10)) {
1151 dev_kfree_skb(skb); 1158 dev_kfree_skb(skb);
@@ -1155,7 +1162,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1155 rcu_read_lock(); 1162 rcu_read_lock();
1156 1163
1157 /* initialises tx */ 1164 /* initialises tx */
1158 res_prepare = __ieee80211_tx_prepare(&tx, skb, dev, control); 1165 res_prepare = __ieee80211_tx_prepare(&tx, skb, dev);
1159 1166
1160 if (res_prepare == TX_DROP) { 1167 if (res_prepare == TX_DROP) {
1161 dev_kfree_skb(skb); 1168 dev_kfree_skb(skb);
@@ -1165,7 +1172,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1165 1172
1166 sta = tx.sta; 1173 sta = tx.sta;
1167 tx.channel = local->hw.conf.channel; 1174 tx.channel = local->hw.conf.channel;
1168 control->band = tx.channel->band; 1175 info->band = tx.channel->band;
1169 1176
1170 for (handler = ieee80211_tx_handlers; *handler != NULL; 1177 for (handler = ieee80211_tx_handlers; *handler != NULL;
1171 handler++) { 1178 handler++) {
@@ -1174,7 +1181,8 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1174 break; 1181 break;
1175 } 1182 }
1176 1183
1177 skb = tx.skb; /* handlers are allowed to change skb */ 1184 if (WARN_ON(tx.skb != skb))
1185 goto drop;
1178 1186
1179 if (unlikely(res == TX_DROP)) { 1187 if (unlikely(res == TX_DROP)) {
1180 I802_DEBUG_INC(local->tx_handlers_drop); 1188 I802_DEBUG_INC(local->tx_handlers_drop);
@@ -1209,12 +1217,12 @@ retry:
1209 ret = __ieee80211_tx(local, skb, &tx); 1217 ret = __ieee80211_tx(local, skb, &tx);
1210 if (ret) { 1218 if (ret) {
1211 struct ieee80211_tx_stored_packet *store = 1219 struct ieee80211_tx_stored_packet *store =
1212 &local->pending_packet[control->queue]; 1220 &local->pending_packet[info->queue];
1213 1221
1214 if (ret == IEEE80211_TX_FRAG_AGAIN) 1222 if (ret == IEEE80211_TX_FRAG_AGAIN)
1215 skb = NULL; 1223 skb = NULL;
1216 set_bit(IEEE80211_LINK_STATE_PENDING, 1224 set_bit(IEEE80211_LINK_STATE_PENDING,
1217 &local->state[control->queue]); 1225 &local->state[queue]);
1218 smp_mb(); 1226 smp_mb();
1219 /* When the driver gets out of buffers during sending of 1227 /* When the driver gets out of buffers during sending of
1220 * fragments and calls ieee80211_stop_queue, there is 1228 * fragments and calls ieee80211_stop_queue, there is
@@ -1225,13 +1233,11 @@ retry:
1225 * called with IEEE80211_LINK_STATE_PENDING. Prevent this by 1233 * called with IEEE80211_LINK_STATE_PENDING. Prevent this by
1226 * continuing transmitting here when that situation is 1234 * continuing transmitting here when that situation is
1227 * possible to have happened. */ 1235 * possible to have happened. */
1228 if (!__ieee80211_queue_stopped(local, control->queue)) { 1236 if (!__ieee80211_queue_stopped(local, queue)) {
1229 clear_bit(IEEE80211_LINK_STATE_PENDING, 1237 clear_bit(IEEE80211_LINK_STATE_PENDING,
1230 &local->state[control->queue]); 1238 &local->state[queue]);
1231 goto retry; 1239 goto retry;
1232 } 1240 }
1233 memcpy(&store->control, control,
1234 sizeof(struct ieee80211_tx_control));
1235 store->skb = skb; 1241 store->skb = skb;
1236 store->extra_frag = tx.extra_frag; 1242 store->extra_frag = tx.extra_frag;
1237 store->num_extra_frag = tx.num_extra_frag; 1243 store->num_extra_frag = tx.num_extra_frag;
@@ -1258,21 +1264,14 @@ retry:
1258int ieee80211_master_start_xmit(struct sk_buff *skb, 1264int ieee80211_master_start_xmit(struct sk_buff *skb,
1259 struct net_device *dev) 1265 struct net_device *dev)
1260{ 1266{
1261 struct ieee80211_tx_control control; 1267 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1262 struct ieee80211_tx_packet_data *pkt_data;
1263 struct net_device *odev = NULL; 1268 struct net_device *odev = NULL;
1264 struct ieee80211_sub_if_data *osdata; 1269 struct ieee80211_sub_if_data *osdata;
1265 int headroom; 1270 int headroom;
1266 int ret; 1271 int ret;
1267 1272
1268 /* 1273 if (info->control.ifindex)
1269 * copy control out of the skb so other people can use skb->cb 1274 odev = dev_get_by_index(&init_net, info->control.ifindex);
1270 */
1271 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1272 memset(&control, 0, sizeof(struct ieee80211_tx_control));
1273
1274 if (pkt_data->ifindex)
1275 odev = dev_get_by_index(&init_net, pkt_data->ifindex);
1276 if (unlikely(odev && !is_ieee80211_device(odev, dev))) { 1275 if (unlikely(odev && !is_ieee80211_device(odev, dev))) {
1277 dev_put(odev); 1276 dev_put(odev);
1278 odev = NULL; 1277 odev = NULL;
@@ -1285,6 +1284,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1285 dev_kfree_skb(skb); 1284 dev_kfree_skb(skb);
1286 return 0; 1285 return 0;
1287 } 1286 }
1287
1288 osdata = IEEE80211_DEV_TO_SUB_IF(odev); 1288 osdata = IEEE80211_DEV_TO_SUB_IF(odev);
1289 1289
1290 headroom = osdata->local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM; 1290 headroom = osdata->local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM;
@@ -1296,21 +1296,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1296 } 1296 }
1297 } 1297 }
1298 1298
1299 control.vif = &osdata->vif; 1299 info->control.vif = &osdata->vif;
1300 control.type = osdata->vif.type; 1300 ret = ieee80211_tx(odev, skb);
1301 if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS)
1302 control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS;
1303 if (pkt_data->flags & IEEE80211_TXPD_DO_NOT_ENCRYPT)
1304 control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
1305 if (pkt_data->flags & IEEE80211_TXPD_REQUEUE)
1306 control.flags |= IEEE80211_TXCTL_REQUEUE;
1307 if (pkt_data->flags & IEEE80211_TXPD_EAPOL_FRAME)
1308 control.flags |= IEEE80211_TXCTL_EAPOL_FRAME;
1309 if (pkt_data->flags & IEEE80211_TXPD_AMPDU)
1310 control.flags |= IEEE80211_TXCTL_AMPDU;
1311 control.queue = pkt_data->queue;
1312
1313 ret = ieee80211_tx(odev, skb, &control);
1314 dev_put(odev); 1301 dev_put(odev);
1315 1302
1316 return ret; 1303 return ret;
@@ -1320,7 +1307,7 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1320 struct net_device *dev) 1307 struct net_device *dev)
1321{ 1308{
1322 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1309 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1323 struct ieee80211_tx_packet_data *pkt_data; 1310 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1324 struct ieee80211_radiotap_header *prthdr = 1311 struct ieee80211_radiotap_header *prthdr =
1325 (struct ieee80211_radiotap_header *)skb->data; 1312 (struct ieee80211_radiotap_header *)skb->data;
1326 u16 len_rthdr; 1313 u16 len_rthdr;
@@ -1342,14 +1329,12 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1342 1329
1343 skb->dev = local->mdev; 1330 skb->dev = local->mdev;
1344 1331
1345 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1346 memset(pkt_data, 0, sizeof(*pkt_data));
1347 /* needed because we set skb device to master */ 1332 /* needed because we set skb device to master */
1348 pkt_data->ifindex = dev->ifindex; 1333 info->control.ifindex = dev->ifindex;
1349 1334
1350 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; 1335 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
1351 /* Interfaces should always request a status report */ 1336 /* Interfaces should always request a status report */
1352 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; 1337 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1353 1338
1354 /* 1339 /*
1355 * fix up the pointers accounting for the radiotap 1340 * fix up the pointers accounting for the radiotap
@@ -1393,7 +1378,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1393 struct net_device *dev) 1378 struct net_device *dev)
1394{ 1379{
1395 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1380 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1396 struct ieee80211_tx_packet_data *pkt_data; 1381 struct ieee80211_tx_info *info;
1397 struct ieee80211_sub_if_data *sdata; 1382 struct ieee80211_sub_if_data *sdata;
1398 int ret = 1, head_need; 1383 int ret = 1, head_need;
1399 u16 ethertype, hdrlen, meshhdrlen = 0, fc; 1384 u16 ethertype, hdrlen, meshhdrlen = 0, fc;
@@ -1625,14 +1610,14 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1625 nh_pos += hdrlen; 1610 nh_pos += hdrlen;
1626 h_pos += hdrlen; 1611 h_pos += hdrlen;
1627 1612
1628 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1613 info = IEEE80211_SKB_CB(skb);
1629 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 1614 memset(info, 0, sizeof(*info));
1630 pkt_data->ifindex = dev->ifindex; 1615 info->control.ifindex = dev->ifindex;
1631 if (ethertype == ETH_P_PAE) 1616 if (ethertype == ETH_P_PAE)
1632 pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME; 1617 info->flags |= IEEE80211_TX_CTL_EAPOL_FRAME;
1633 1618
1634 /* Interfaces should always request a status report */ 1619 /* Interfaces should always request a status report */
1635 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; 1620 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1636 1621
1637 skb->dev = local->mdev; 1622 skb->dev = local->mdev;
1638 dev->stats.tx_packets++; 1623 dev->stats.tx_packets++;
@@ -1693,7 +1678,6 @@ void ieee80211_tx_pending(unsigned long data)
1693 continue; 1678 continue;
1694 } 1679 }
1695 store = &local->pending_packet[i]; 1680 store = &local->pending_packet[i];
1696 tx.control = &store->control;
1697 tx.extra_frag = store->extra_frag; 1681 tx.extra_frag = store->extra_frag;
1698 tx.num_extra_frag = store->num_extra_frag; 1682 tx.num_extra_frag = store->num_extra_frag;
1699 tx.last_frag_rate_idx = store->last_frag_rate_idx; 1683 tx.last_frag_rate_idx = store->last_frag_rate_idx;
@@ -1786,11 +1770,11 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local,
1786} 1770}
1787 1771
1788struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1772struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1789 struct ieee80211_vif *vif, 1773 struct ieee80211_vif *vif)
1790 struct ieee80211_tx_control *control)
1791{ 1774{
1792 struct ieee80211_local *local = hw_to_local(hw); 1775 struct ieee80211_local *local = hw_to_local(hw);
1793 struct sk_buff *skb; 1776 struct sk_buff *skb;
1777 struct ieee80211_tx_info *info;
1794 struct net_device *bdev; 1778 struct net_device *bdev;
1795 struct ieee80211_sub_if_data *sdata = NULL; 1779 struct ieee80211_sub_if_data *sdata = NULL;
1796 struct ieee80211_if_ap *ap = NULL; 1780 struct ieee80211_if_ap *ap = NULL;
@@ -1896,31 +1880,32 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1896 goto out; 1880 goto out;
1897 } 1881 }
1898 1882
1899 if (control) { 1883 info = IEEE80211_SKB_CB(skb);
1900 control->band = band; 1884
1901 rate_control_get_rate(local->mdev, sband, skb, &rsel); 1885 info->band = band;
1902 if (unlikely(rsel.rate_idx < 0)) { 1886 rate_control_get_rate(local->mdev, sband, skb, &rsel);
1903 if (net_ratelimit()) {
1904 printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
1905 "no rate found\n",
1906 wiphy_name(local->hw.wiphy));
1907 }
1908 dev_kfree_skb(skb);
1909 skb = NULL;
1910 goto out;
1911 }
1912 1887
1913 control->vif = vif; 1888 if (unlikely(rsel.rate_idx < 0)) {
1914 control->tx_rate_idx = rsel.rate_idx; 1889 if (net_ratelimit()) {
1915 if (sdata->bss_conf.use_short_preamble && 1890 printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
1916 sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) 1891 "no rate found\n",
1917 control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 1892 wiphy_name(local->hw.wiphy));
1918 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; 1893 }
1919 control->flags |= IEEE80211_TXCTL_NO_ACK; 1894 dev_kfree_skb(skb);
1920 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 1895 skb = NULL;
1921 control->retry_limit = 1; 1896 goto out;
1922 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT;
1923 } 1897 }
1898
1899 info->control.vif = vif;
1900 info->tx_rate_idx = rsel.rate_idx;
1901 if (sdata->bss_conf.use_short_preamble &&
1902 sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE)
1903 info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
1904 info->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
1905 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1906 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
1907 info->control.retry_limit = 1;
1908 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1924 (*num_beacons)++; 1909 (*num_beacons)++;
1925out: 1910out:
1926 rcu_read_unlock(); 1911 rcu_read_unlock();
@@ -1930,7 +1915,7 @@ EXPORT_SYMBOL(ieee80211_beacon_get);
1930 1915
1931void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1916void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1932 const void *frame, size_t frame_len, 1917 const void *frame, size_t frame_len,
1933 const struct ieee80211_tx_control *frame_txctl, 1918 const struct ieee80211_tx_info *frame_txctl,
1934 struct ieee80211_rts *rts) 1919 struct ieee80211_rts *rts)
1935{ 1920{
1936 const struct ieee80211_hdr *hdr = frame; 1921 const struct ieee80211_hdr *hdr = frame;
@@ -1947,7 +1932,7 @@ EXPORT_SYMBOL(ieee80211_rts_get);
1947 1932
1948void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1933void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1949 const void *frame, size_t frame_len, 1934 const void *frame, size_t frame_len,
1950 const struct ieee80211_tx_control *frame_txctl, 1935 const struct ieee80211_tx_info *frame_txctl,
1951 struct ieee80211_cts *cts) 1936 struct ieee80211_cts *cts)
1952{ 1937{
1953 const struct ieee80211_hdr *hdr = frame; 1938 const struct ieee80211_hdr *hdr = frame;
@@ -1963,8 +1948,7 @@ EXPORT_SYMBOL(ieee80211_ctstoself_get);
1963 1948
1964struct sk_buff * 1949struct sk_buff *
1965ieee80211_get_buffered_bc(struct ieee80211_hw *hw, 1950ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1966 struct ieee80211_vif *vif, 1951 struct ieee80211_vif *vif)
1967 struct ieee80211_tx_control *control)
1968{ 1952{
1969 struct ieee80211_local *local = hw_to_local(hw); 1953 struct ieee80211_local *local = hw_to_local(hw);
1970 struct sk_buff *skb; 1954 struct sk_buff *skb;
@@ -1976,6 +1960,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1976 struct ieee80211_sub_if_data *sdata; 1960 struct ieee80211_sub_if_data *sdata;
1977 struct ieee80211_if_ap *bss = NULL; 1961 struct ieee80211_if_ap *bss = NULL;
1978 struct beacon_data *beacon; 1962 struct beacon_data *beacon;
1963 struct ieee80211_tx_info *info;
1979 1964
1980 sdata = vif_to_sdata(vif); 1965 sdata = vif_to_sdata(vif);
1981 bdev = sdata->dev; 1966 bdev = sdata->dev;
@@ -1995,7 +1980,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1995 1980
1996 if (bss->dtim_count != 0) 1981 if (bss->dtim_count != 0)
1997 return NULL; /* send buffered bc/mc only after DTIM beacon */ 1982 return NULL; /* send buffered bc/mc only after DTIM beacon */
1998 memset(control, 0, sizeof(*control)); 1983
1999 while (1) { 1984 while (1) {
2000 skb = skb_dequeue(&bss->ps_bc_buf); 1985 skb = skb_dequeue(&bss->ps_bc_buf);
2001 if (!skb) 1986 if (!skb)
@@ -2012,21 +1997,26 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2012 cpu_to_le16(IEEE80211_FCTL_MOREDATA); 1997 cpu_to_le16(IEEE80211_FCTL_MOREDATA);
2013 } 1998 }
2014 1999
2015 if (!ieee80211_tx_prepare(&tx, skb, local->mdev, control)) 2000 if (!ieee80211_tx_prepare(&tx, skb, local->mdev))
2016 break; 2001 break;
2017 dev_kfree_skb_any(skb); 2002 dev_kfree_skb_any(skb);
2018 } 2003 }
2004
2005 info = IEEE80211_SKB_CB(skb);
2006
2019 sta = tx.sta; 2007 sta = tx.sta;
2020 tx.flags |= IEEE80211_TX_PS_BUFFERED; 2008 tx.flags |= IEEE80211_TX_PS_BUFFERED;
2021 tx.channel = local->hw.conf.channel; 2009 tx.channel = local->hw.conf.channel;
2022 control->band = tx.channel->band; 2010 info->band = tx.channel->band;
2023 2011
2024 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { 2012 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
2025 res = (*handler)(&tx); 2013 res = (*handler)(&tx);
2026 if (res == TX_DROP || res == TX_QUEUED) 2014 if (res == TX_DROP || res == TX_QUEUED)
2027 break; 2015 break;
2028 } 2016 }
2029 skb = tx.skb; /* handlers are allowed to change skb */ 2017
2018 if (WARN_ON(tx.skb != skb))
2019 return NULL;
2030 2020
2031 if (res == TX_DROP) { 2021 if (res == TX_DROP) {
2032 I802_DEBUG_INC(local->tx_handlers_drop); 2022 I802_DEBUG_INC(local->tx_handlers_drop);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 65a34fddeb00..d9109dee461f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -258,7 +258,7 @@ EXPORT_SYMBOL(ieee80211_generic_frame_duration);
258 258
259__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, 259__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
260 struct ieee80211_vif *vif, size_t frame_len, 260 struct ieee80211_vif *vif, size_t frame_len,
261 const struct ieee80211_tx_control *frame_txctl) 261 const struct ieee80211_tx_info *frame_txctl)
262{ 262{
263 struct ieee80211_local *local = hw_to_local(hw); 263 struct ieee80211_local *local = hw_to_local(hw);
264 struct ieee80211_rate *rate; 264 struct ieee80211_rate *rate;
@@ -272,7 +272,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
272 272
273 short_preamble = sdata->bss_conf.use_short_preamble; 273 short_preamble = sdata->bss_conf.use_short_preamble;
274 274
275 rate = &sband->bitrates[frame_txctl->rts_cts_rate_idx]; 275 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx];
276 276
277 erp = 0; 277 erp = 0;
278 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) 278 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
@@ -295,7 +295,7 @@ EXPORT_SYMBOL(ieee80211_rts_duration);
295__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, 295__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
296 struct ieee80211_vif *vif, 296 struct ieee80211_vif *vif,
297 size_t frame_len, 297 size_t frame_len,
298 const struct ieee80211_tx_control *frame_txctl) 298 const struct ieee80211_tx_info *frame_txctl)
299{ 299{
300 struct ieee80211_local *local = hw_to_local(hw); 300 struct ieee80211_local *local = hw_to_local(hw);
301 struct ieee80211_rate *rate; 301 struct ieee80211_rate *rate;
@@ -309,7 +309,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
309 309
310 short_preamble = sdata->bss_conf.use_short_preamble; 310 short_preamble = sdata->bss_conf.use_short_preamble;
311 311
312 rate = &sband->bitrates[frame_txctl->rts_cts_rate_idx]; 312 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx];
313 erp = 0; 313 erp = 0;
314 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) 314 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
315 erp = rate->flags & IEEE80211_RATE_ERP_G; 315 erp = rate->flags & IEEE80211_RATE_ERP_G;
@@ -317,7 +317,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
317 /* Data frame duration */ 317 /* Data frame duration */
318 dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, 318 dur = ieee80211_frame_duration(local, frame_len, rate->bitrate,
319 erp, short_preamble); 319 erp, short_preamble);
320 if (!(frame_txctl->flags & IEEE80211_TXCTL_NO_ACK)) { 320 if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) {
321 /* ACK duration */ 321 /* ACK duration */
322 dur += ieee80211_frame_duration(local, 10, rate->bitrate, 322 dur += ieee80211_frame_duration(local, 10, rate->bitrate,
323 erp, short_preamble); 323 erp, short_preamble);
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 3cbae42ec504..1e7f03dd8f6b 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -333,11 +333,16 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
333 333
334static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) 334static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
335{ 335{
336 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
337
338 info->control.iv_len = WEP_IV_LEN;
339 info->control.icv_len = WEP_ICV_LEN;
340
336 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { 341 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
342 info->control.hw_key = &tx->key->conf;
337 if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) 343 if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
338 return -1; 344 return -1;
339 } else { 345 } else {
340 tx->control->hw_key = &tx->key->conf;
341 if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) { 346 if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
342 if (!ieee80211_wep_add_iv(tx->local, skb, tx->key)) 347 if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
343 return -1; 348 return -1;
@@ -349,8 +354,6 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
349ieee80211_tx_result 354ieee80211_tx_result
350ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) 355ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx)
351{ 356{
352 tx->control->iv_len = WEP_IV_LEN;
353 tx->control->icv_len = WEP_ICV_LEN;
354 ieee80211_tx_set_protected(tx); 357 ieee80211_tx_set_protected(tx);
355 358
356 if (wep_encrypt_skb(tx, tx->skb) < 0) { 359 if (wep_encrypt_skb(tx, tx->skb) < 0) {
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index c87baf4ce979..477690f4dca7 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -149,8 +149,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
149 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 149 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
150 struct ieee80211_hw *hw = &local->hw; 150 struct ieee80211_hw *hw = &local->hw;
151 struct ieee80211_sched_data *q = qdisc_priv(qd); 151 struct ieee80211_sched_data *q = qdisc_priv(qd);
152 struct ieee80211_tx_packet_data *pkt_data = 152 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
153 (struct ieee80211_tx_packet_data *) skb->cb;
154 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 153 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
155 unsigned short fc = le16_to_cpu(hdr->frame_control); 154 unsigned short fc = le16_to_cpu(hdr->frame_control);
156 struct Qdisc *qdisc; 155 struct Qdisc *qdisc;
@@ -158,8 +157,8 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
158 int err, queue; 157 int err, queue;
159 u8 tid; 158 u8 tid;
160 159
161 if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) { 160 if (info->flags & IEEE80211_TX_CTL_REQUEUE) {
162 queue = pkt_data->queue; 161 queue = info->queue;
163 rcu_read_lock(); 162 rcu_read_lock();
164 sta = sta_info_get(local, hdr->addr1); 163 sta = sta_info_get(local, hdr->addr1);
165 tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 164 tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
@@ -168,9 +167,9 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
168 if ((ampdu_queue < QD_NUM(hw)) && 167 if ((ampdu_queue < QD_NUM(hw)) &&
169 test_bit(ampdu_queue, q->qdisc_pool)) { 168 test_bit(ampdu_queue, q->qdisc_pool)) {
170 queue = ampdu_queue; 169 queue = ampdu_queue;
171 pkt_data->flags |= IEEE80211_TXPD_AMPDU; 170 info->flags |= IEEE80211_TX_CTL_AMPDU;
172 } else { 171 } else {
173 pkt_data->flags &= ~IEEE80211_TXPD_AMPDU; 172 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
174 } 173 }
175 } 174 }
176 rcu_read_unlock(); 175 rcu_read_unlock();
@@ -206,9 +205,9 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
206 if ((ampdu_queue < QD_NUM(hw)) && 205 if ((ampdu_queue < QD_NUM(hw)) &&
207 test_bit(ampdu_queue, q->qdisc_pool)) { 206 test_bit(ampdu_queue, q->qdisc_pool)) {
208 queue = ampdu_queue; 207 queue = ampdu_queue;
209 pkt_data->flags |= IEEE80211_TXPD_AMPDU; 208 info->flags |= IEEE80211_TX_CTL_AMPDU;
210 } else { 209 } else {
211 pkt_data->flags &= ~IEEE80211_TXPD_AMPDU; 210 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
212 } 211 }
213 } 212 }
214 213
@@ -220,7 +219,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
220 err = NET_XMIT_DROP; 219 err = NET_XMIT_DROP;
221 } else { 220 } else {
222 tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 221 tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
223 pkt_data->queue = (unsigned int) queue; 222 info->queue = (unsigned int) queue;
224 qdisc = q->queues[queue]; 223 qdisc = q->queues[queue];
225 err = qdisc->enqueue(skb, qdisc); 224 err = qdisc->enqueue(skb, qdisc);
226 if (err == NET_XMIT_SUCCESS) { 225 if (err == NET_XMIT_SUCCESS) {
@@ -241,13 +240,12 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
241static int wme_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd) 240static int wme_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd)
242{ 241{
243 struct ieee80211_sched_data *q = qdisc_priv(qd); 242 struct ieee80211_sched_data *q = qdisc_priv(qd);
244 struct ieee80211_tx_packet_data *pkt_data = 243 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
245 (struct ieee80211_tx_packet_data *) skb->cb;
246 struct Qdisc *qdisc; 244 struct Qdisc *qdisc;
247 int err; 245 int err;
248 246
249 /* we recorded which queue to use earlier! */ 247 /* we recorded which queue to use earlier! */
250 qdisc = q->queues[pkt_data->queue]; 248 qdisc = q->queues[info->queue];
251 249
252 if ((err = qdisc->ops->requeue(skb, qdisc)) == 0) { 250 if ((err = qdisc->ops->requeue(skb, qdisc)) == 0) {
253 qd->q.qlen++; 251 qd->q.qlen++;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index d7304490d2ec..d6635f6e5618 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -183,15 +183,25 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
183} 183}
184 184
185 185
186static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, 186static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
187 struct sk_buff *skb, int test)
188{ 187{
189 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 188 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
190 struct ieee80211_key *key = tx->key; 189 struct ieee80211_key *key = tx->key;
190 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
191 int hdrlen, len, tailneed; 191 int hdrlen, len, tailneed;
192 u16 fc; 192 u16 fc;
193 u8 *pos; 193 u8 *pos;
194 194
195 info->control.icv_len = TKIP_ICV_LEN;
196 info->control.iv_len = TKIP_IV_LEN;
197
198 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
199 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
200 /* hwaccel - with no need for preallocated room for IV/ICV */
201 info->control.hw_key = &tx->key->conf;
202 return TX_CONTINUE;
203 }
204
195 fc = le16_to_cpu(hdr->frame_control); 205 fc = le16_to_cpu(hdr->frame_control);
196 hdrlen = ieee80211_get_hdrlen(fc); 206 hdrlen = ieee80211_get_hdrlen(fc);
197 len = skb->len - hdrlen; 207 len = skb->len - hdrlen;
@@ -228,7 +238,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
228 0x7f), 238 0x7f),
229 (u8) key->u.tkip.tx.iv16); 239 (u8) key->u.tkip.tx.iv16);
230 240
231 tx->control->hw_key = &tx->key->conf; 241 info->control.hw_key = &tx->key->conf;
232 return 0; 242 return 0;
233 } 243 }
234 244
@@ -246,28 +256,16 @@ ieee80211_tx_result
246ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) 256ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
247{ 257{
248 struct sk_buff *skb = tx->skb; 258 struct sk_buff *skb = tx->skb;
249 int wpa_test = 0, test = 0;
250 259
251 tx->control->icv_len = TKIP_ICV_LEN;
252 tx->control->iv_len = TKIP_IV_LEN;
253 ieee80211_tx_set_protected(tx); 260 ieee80211_tx_set_protected(tx);
254 261
255 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 262 if (tkip_encrypt_skb(tx, skb) < 0)
256 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
257 !wpa_test) {
258 /* hwaccel - with no need for preallocated room for IV/ICV */
259 tx->control->hw_key = &tx->key->conf;
260 return TX_CONTINUE;
261 }
262
263 if (tkip_encrypt_skb(tx, skb, test) < 0)
264 return TX_DROP; 263 return TX_DROP;
265 264
266 if (tx->extra_frag) { 265 if (tx->extra_frag) {
267 int i; 266 int i;
268 for (i = 0; i < tx->num_extra_frag; i++) { 267 for (i = 0; i < tx->num_extra_frag; i++) {
269 if (tkip_encrypt_skb(tx, tx->extra_frag[i], test) 268 if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0)
270 < 0)
271 return TX_DROP; 269 return TX_DROP;
272 } 270 }
273 } 271 }
@@ -429,16 +427,27 @@ static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
429} 427}
430 428
431 429
432static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, 430static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
433 struct sk_buff *skb, int test)
434{ 431{
435 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 432 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
436 struct ieee80211_key *key = tx->key; 433 struct ieee80211_key *key = tx->key;
434 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
437 int hdrlen, len, tailneed; 435 int hdrlen, len, tailneed;
438 u16 fc; 436 u16 fc;
439 u8 *pos, *pn, *b_0, *aad, *scratch; 437 u8 *pos, *pn, *b_0, *aad, *scratch;
440 int i; 438 int i;
441 439
440 info->control.icv_len = CCMP_MIC_LEN;
441 info->control.iv_len = CCMP_HDR_LEN;
442
443 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
444 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
445 /* hwaccel - with no need for preallocated room for CCMP "
446 * header or MIC fields */
447 info->control.hw_key = &tx->key->conf;
448 return TX_CONTINUE;
449 }
450
442 scratch = key->u.ccmp.tx_crypto_buf; 451 scratch = key->u.ccmp.tx_crypto_buf;
443 b_0 = scratch + 3 * AES_BLOCK_LEN; 452 b_0 = scratch + 3 * AES_BLOCK_LEN;
444 aad = scratch + 4 * AES_BLOCK_LEN; 453 aad = scratch + 4 * AES_BLOCK_LEN;
@@ -478,7 +487,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
478 487
479 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { 488 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
480 /* hwaccel - with preallocated room for CCMP header */ 489 /* hwaccel - with preallocated room for CCMP header */
481 tx->control->hw_key = &tx->key->conf; 490 info->control.hw_key = &tx->key->conf;
482 return 0; 491 return 0;
483 } 492 }
484 493
@@ -495,28 +504,16 @@ ieee80211_tx_result
495ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) 504ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
496{ 505{
497 struct sk_buff *skb = tx->skb; 506 struct sk_buff *skb = tx->skb;
498 int test = 0;
499 507
500 tx->control->icv_len = CCMP_MIC_LEN;
501 tx->control->iv_len = CCMP_HDR_LEN;
502 ieee80211_tx_set_protected(tx); 508 ieee80211_tx_set_protected(tx);
503 509
504 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 510 if (ccmp_encrypt_skb(tx, skb) < 0)
505 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
506 /* hwaccel - with no need for preallocated room for CCMP "
507 * header or MIC fields */
508 tx->control->hw_key = &tx->key->conf;
509 return TX_CONTINUE;
510 }
511
512 if (ccmp_encrypt_skb(tx, skb, test) < 0)
513 return TX_DROP; 511 return TX_DROP;
514 512
515 if (tx->extra_frag) { 513 if (tx->extra_frag) {
516 int i; 514 int i;
517 for (i = 0; i < tx->num_extra_frag; i++) { 515 for (i = 0; i < tx->num_extra_frag; i++) {
518 if (ccmp_encrypt_skb(tx, tx->extra_frag[i], test) 516 if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0)
519 < 0)
520 return TX_DROP; 517 return TX_DROP;
521 } 518 }
522 } 519 }