aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/ieee80211_i.h86
-rw-r--r--net/mac80211/rx.c163
-rw-r--r--net/mac80211/tx.c244
-rw-r--r--net/mac80211/util.c8
-rw-r--r--net/mac80211/wep.c24
-rw-r--r--net/mac80211/wep.h4
-rw-r--r--net/mac80211/wpa.c80
-rw-r--r--net/mac80211/wpa.h12
8 files changed, 315 insertions, 306 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 7394c9b783b8..d3b5cc57af40 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -142,26 +142,51 @@ typedef unsigned __bitwise__ ieee80211_tx_result;
142#define TX_DROP ((__force ieee80211_tx_result) 1u) 142#define TX_DROP ((__force ieee80211_tx_result) 1u)
143#define TX_QUEUED ((__force ieee80211_tx_result) 2u) 143#define TX_QUEUED ((__force ieee80211_tx_result) 2u)
144 144
145#define IEEE80211_TX_FRAGMENTED BIT(0)
146#define IEEE80211_TX_UNICAST BIT(1)
147#define IEEE80211_TX_PS_BUFFERED BIT(2)
148#define IEEE80211_TX_PROBE_LAST_FRAG BIT(3)
149#define IEEE80211_TX_INJECTED BIT(4)
150
151struct ieee80211_tx_data {
152 struct sk_buff *skb;
153 struct net_device *dev;
154 struct ieee80211_local *local;
155 struct ieee80211_sub_if_data *sdata;
156 struct sta_info *sta;
157 u16 fc, ethertype;
158 struct ieee80211_key *key;
159 unsigned int flags;
160
161 struct ieee80211_tx_control *control;
162 struct ieee80211_channel *channel;
163 struct ieee80211_rate *rate;
164 /* use this rate (if set) for last fragment; rate can
165 * be set to lower rate for the first fragments, e.g.,
166 * when using CTS protection with IEEE 802.11g. */
167 struct ieee80211_rate *last_frag_rate;
168
169 /* Extra fragments (in addition to the first fragment
170 * in skb) */
171 int num_extra_frag;
172 struct sk_buff **extra_frag;
173};
174
175
145typedef unsigned __bitwise__ ieee80211_rx_result; 176typedef unsigned __bitwise__ ieee80211_rx_result;
146#define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 177#define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
147#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 178#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
148#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 179#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
149#define RX_QUEUED ((__force ieee80211_rx_result) 3u) 180#define RX_QUEUED ((__force ieee80211_rx_result) 3u)
150 181
151 182#define IEEE80211_RX_IN_SCAN BIT(0)
152/* flags used in struct ieee80211_txrx_data.flags */
153/* whether the MSDU was fragmented */
154#define IEEE80211_TXRXD_FRAGMENTED BIT(0)
155#define IEEE80211_TXRXD_TXUNICAST BIT(1)
156#define IEEE80211_TXRXD_TXPS_BUFFERED BIT(2)
157#define IEEE80211_TXRXD_TXPROBE_LAST_FRAG BIT(3)
158#define IEEE80211_TXRXD_RXIN_SCAN BIT(4)
159/* frame is destined to interface currently processed (incl. multicast frames) */ 183/* frame is destined to interface currently processed (incl. multicast frames) */
160#define IEEE80211_TXRXD_RXRA_MATCH BIT(5) 184#define IEEE80211_RX_RA_MATCH BIT(1)
161#define IEEE80211_TXRXD_TX_INJECTED BIT(6) 185#define IEEE80211_RX_AMSDU BIT(2)
162#define IEEE80211_TXRXD_RX_AMSDU BIT(7) 186#define IEEE80211_RX_CMNTR_REPORTED BIT(3)
163#define IEEE80211_TXRXD_RX_CMNTR_REPORTED BIT(8) 187#define IEEE80211_RX_FRAGMENTED BIT(4)
164struct ieee80211_txrx_data { 188
189struct ieee80211_rx_data {
165 struct sk_buff *skb; 190 struct sk_buff *skb;
166 struct net_device *dev; 191 struct net_device *dev;
167 struct ieee80211_local *local; 192 struct ieee80211_local *local;
@@ -170,31 +195,14 @@ struct ieee80211_txrx_data {
170 u16 fc, ethertype; 195 u16 fc, ethertype;
171 struct ieee80211_key *key; 196 struct ieee80211_key *key;
172 unsigned int flags; 197 unsigned int flags;
173 union { 198
174 struct { 199 struct ieee80211_rx_status *status;
175 struct ieee80211_tx_control *control; 200 struct ieee80211_rate *rate;
176 struct ieee80211_channel *channel; 201 int sent_ps_buffered;
177 struct ieee80211_rate *rate; 202 int queue;
178 /* use this rate (if set) for last fragment; rate can 203 int load;
179 * be set to lower rate for the first fragments, e.g., 204 u32 tkip_iv32;
180 * when using CTS protection with IEEE 802.11g. */ 205 u16 tkip_iv16;
181 struct ieee80211_rate *last_frag_rate;
182
183 /* Extra fragments (in addition to the first fragment
184 * in skb) */
185 int num_extra_frag;
186 struct sk_buff **extra_frag;
187 } tx;
188 struct {
189 struct ieee80211_rx_status *status;
190 struct ieee80211_rate *rate;
191 int sent_ps_buffered;
192 int queue;
193 int load;
194 u32 tkip_iv32;
195 u16 tkip_iv16;
196 } rx;
197 } u;
198}; 206};
199 207
200/* flags used in struct ieee80211_tx_packet_data.flags */ 208/* flags used in struct ieee80211_tx_packet_data.flags */
@@ -842,7 +850,7 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
842int ieee80211_hw_config(struct ieee80211_local *local); 850int ieee80211_hw_config(struct ieee80211_local *local);
843int ieee80211_if_config(struct net_device *dev); 851int ieee80211_if_config(struct net_device *dev);
844int ieee80211_if_config_beacon(struct net_device *dev); 852int ieee80211_if_config_beacon(struct net_device *dev);
845void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx); 853void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
846int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr); 854int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
847void ieee80211_if_setup(struct net_device *dev); 855void ieee80211_if_setup(struct net_device *dev);
848int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht, 856int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1ff1301ca3df..2e65ca1cd1aa 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -251,7 +251,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
251} 251}
252 252
253 253
254static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx) 254static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
255{ 255{
256 u8 *data = rx->skb->data; 256 u8 *data = rx->skb->data;
257 int tid; 257 int tid;
@@ -262,9 +262,9 @@ static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx)
262 /* frame has qos control */ 262 /* frame has qos control */
263 tid = qc[0] & QOS_CONTROL_TID_MASK; 263 tid = qc[0] & QOS_CONTROL_TID_MASK;
264 if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT) 264 if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
265 rx->flags |= IEEE80211_TXRXD_RX_AMSDU; 265 rx->flags |= IEEE80211_RX_AMSDU;
266 else 266 else
267 rx->flags &= ~IEEE80211_TXRXD_RX_AMSDU; 267 rx->flags &= ~IEEE80211_RX_AMSDU;
268 } else { 268 } else {
269 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) { 269 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
270 /* Separate TID for management frames */ 270 /* Separate TID for management frames */
@@ -280,13 +280,13 @@ static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx)
280 if (rx->sta) 280 if (rx->sta)
281 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]); 281 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
282 282
283 rx->u.rx.queue = tid; 283 rx->queue = tid;
284 /* Set skb->priority to 1d tag if highest order bit of TID is not set. 284 /* Set skb->priority to 1d tag if highest order bit of TID is not set.
285 * For now, set skb->priority to 0 for other cases. */ 285 * For now, set skb->priority to 0 for other cases. */
286 rx->skb->priority = (tid > 7) ? 0 : tid; 286 rx->skb->priority = (tid > 7) ? 0 : tid;
287} 287}
288 288
289static void ieee80211_verify_ip_alignment(struct ieee80211_txrx_data *rx) 289static void ieee80211_verify_ip_alignment(struct ieee80211_rx_data *rx)
290{ 290{
291#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT 291#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
292 int hdrlen; 292 int hdrlen;
@@ -314,7 +314,7 @@ static void ieee80211_verify_ip_alignment(struct ieee80211_txrx_data *rx)
314 * to move the 802.11 header further back in that case. 314 * to move the 802.11 header further back in that case.
315 */ 315 */
316 hdrlen = ieee80211_get_hdrlen(rx->fc); 316 hdrlen = ieee80211_get_hdrlen(rx->fc);
317 if (rx->flags & IEEE80211_TXRXD_RX_AMSDU) 317 if (rx->flags & IEEE80211_RX_AMSDU)
318 hdrlen += ETH_HLEN; 318 hdrlen += ETH_HLEN;
319 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3); 319 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3);
320#endif 320#endif
@@ -357,32 +357,32 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
357/* rx handlers */ 357/* rx handlers */
358 358
359static ieee80211_rx_result 359static ieee80211_rx_result
360ieee80211_rx_h_if_stats(struct ieee80211_txrx_data *rx) 360ieee80211_rx_h_if_stats(struct ieee80211_rx_data *rx)
361{ 361{
362 if (rx->sta) 362 if (rx->sta)
363 rx->sta->channel_use_raw += rx->u.rx.load; 363 rx->sta->channel_use_raw += rx->load;
364 rx->sdata->channel_use_raw += rx->u.rx.load; 364 rx->sdata->channel_use_raw += rx->load;
365 return RX_CONTINUE; 365 return RX_CONTINUE;
366} 366}
367 367
368static ieee80211_rx_result 368static ieee80211_rx_result
369ieee80211_rx_h_passive_scan(struct ieee80211_txrx_data *rx) 369ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
370{ 370{
371 struct ieee80211_local *local = rx->local; 371 struct ieee80211_local *local = rx->local;
372 struct sk_buff *skb = rx->skb; 372 struct sk_buff *skb = rx->skb;
373 373
374 if (unlikely(local->sta_hw_scanning)) 374 if (unlikely(local->sta_hw_scanning))
375 return ieee80211_sta_rx_scan(rx->dev, skb, rx->u.rx.status); 375 return ieee80211_sta_rx_scan(rx->dev, skb, rx->status);
376 376
377 if (unlikely(local->sta_sw_scanning)) { 377 if (unlikely(local->sta_sw_scanning)) {
378 /* drop all the other packets during a software scan anyway */ 378 /* drop all the other packets during a software scan anyway */
379 if (ieee80211_sta_rx_scan(rx->dev, skb, rx->u.rx.status) 379 if (ieee80211_sta_rx_scan(rx->dev, skb, rx->status)
380 != RX_QUEUED) 380 != RX_QUEUED)
381 dev_kfree_skb(skb); 381 dev_kfree_skb(skb);
382 return RX_QUEUED; 382 return RX_QUEUED;
383 } 383 }
384 384
385 if (unlikely(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) { 385 if (unlikely(rx->flags & IEEE80211_RX_IN_SCAN)) {
386 /* scanning finished during invoking of handlers */ 386 /* scanning finished during invoking of handlers */
387 I802_DEBUG_INC(local->rx_handlers_drop_passive_scan); 387 I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
388 return RX_DROP_UNUSABLE; 388 return RX_DROP_UNUSABLE;
@@ -392,7 +392,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_txrx_data *rx)
392} 392}
393 393
394static ieee80211_rx_result 394static ieee80211_rx_result
395ieee80211_rx_mesh_check(struct ieee80211_txrx_data *rx) 395ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
396{ 396{
397 int hdrlen = ieee80211_get_hdrlen(rx->fc); 397 int hdrlen = ieee80211_get_hdrlen(rx->fc);
398 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 398 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
@@ -443,7 +443,7 @@ ieee80211_rx_mesh_check(struct ieee80211_txrx_data *rx)
443 443
444 444
445static ieee80211_rx_result 445static ieee80211_rx_result
446ieee80211_rx_h_check(struct ieee80211_txrx_data *rx) 446ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
447{ 447{
448 struct ieee80211_hdr *hdr; 448 struct ieee80211_hdr *hdr;
449 449
@@ -452,15 +452,15 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
452 /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */ 452 /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */
453 if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) { 453 if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) {
454 if (unlikely(rx->fc & IEEE80211_FCTL_RETRY && 454 if (unlikely(rx->fc & IEEE80211_FCTL_RETRY &&
455 rx->sta->last_seq_ctrl[rx->u.rx.queue] == 455 rx->sta->last_seq_ctrl[rx->queue] ==
456 hdr->seq_ctrl)) { 456 hdr->seq_ctrl)) {
457 if (rx->flags & IEEE80211_TXRXD_RXRA_MATCH) { 457 if (rx->flags & IEEE80211_RX_RA_MATCH) {
458 rx->local->dot11FrameDuplicateCount++; 458 rx->local->dot11FrameDuplicateCount++;
459 rx->sta->num_duplicates++; 459 rx->sta->num_duplicates++;
460 } 460 }
461 return RX_DROP_MONITOR; 461 return RX_DROP_MONITOR;
462 } else 462 } else
463 rx->sta->last_seq_ctrl[rx->u.rx.queue] = hdr->seq_ctrl; 463 rx->sta->last_seq_ctrl[rx->queue] = hdr->seq_ctrl;
464 } 464 }
465 465
466 if (unlikely(rx->skb->len < 16)) { 466 if (unlikely(rx->skb->len < 16)) {
@@ -488,7 +488,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
488 if ((!(rx->fc & IEEE80211_FCTL_FROMDS) && 488 if ((!(rx->fc & IEEE80211_FCTL_FROMDS) &&
489 !(rx->fc & IEEE80211_FCTL_TODS) && 489 !(rx->fc & IEEE80211_FCTL_TODS) &&
490 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) 490 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)
491 || !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) { 491 || !(rx->flags & IEEE80211_RX_RA_MATCH)) {
492 /* Drop IBSS frames and frames for other hosts 492 /* Drop IBSS frames and frames for other hosts
493 * silently. */ 493 * silently. */
494 return RX_DROP_MONITOR; 494 return RX_DROP_MONITOR;
@@ -502,7 +502,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
502 502
503 503
504static ieee80211_rx_result 504static ieee80211_rx_result
505ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx) 505ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
506{ 506{
507 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 507 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
508 int keyidx; 508 int keyidx;
@@ -543,7 +543,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
543 * No point in finding a key and decrypting if the frame is neither 543 * No point in finding a key and decrypting if the frame is neither
544 * addressed to us nor a multicast frame. 544 * addressed to us nor a multicast frame.
545 */ 545 */
546 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 546 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
547 return RX_CONTINUE; 547 return RX_CONTINUE;
548 548
549 if (rx->sta) 549 if (rx->sta)
@@ -561,8 +561,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
561 * we somehow allow the driver to tell us which key 561 * we somehow allow the driver to tell us which key
562 * the hardware used if this flag is set? 562 * the hardware used if this flag is set?
563 */ 563 */
564 if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && 564 if ((rx->status->flag & RX_FLAG_DECRYPTED) &&
565 (rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) 565 (rx->status->flag & RX_FLAG_IV_STRIPPED))
566 return RX_CONTINUE; 566 return RX_CONTINUE;
567 567
568 hdrlen = ieee80211_get_hdrlen(rx->fc); 568 hdrlen = ieee80211_get_hdrlen(rx->fc);
@@ -603,8 +603,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
603 /* Check for weak IVs if possible */ 603 /* Check for weak IVs if possible */
604 if (rx->sta && rx->key->conf.alg == ALG_WEP && 604 if (rx->sta && rx->key->conf.alg == ALG_WEP &&
605 ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 605 ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
606 (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) || 606 (!(rx->status->flag & RX_FLAG_IV_STRIPPED) ||
607 !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) && 607 !(rx->status->flag & RX_FLAG_DECRYPTED)) &&
608 ieee80211_wep_is_weak_iv(rx->skb, rx->key)) 608 ieee80211_wep_is_weak_iv(rx->skb, rx->key))
609 rx->sta->wep_weak_iv_count++; 609 rx->sta->wep_weak_iv_count++;
610 610
@@ -621,7 +621,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
621 } 621 }
622 622
623 /* either the frame has been decrypted or will be dropped */ 623 /* either the frame has been decrypted or will be dropped */
624 rx->u.rx.status->flag |= RX_FLAG_DECRYPTED; 624 rx->status->flag |= RX_FLAG_DECRYPTED;
625 625
626 return result; 626 return result;
627} 627}
@@ -691,7 +691,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
691} 691}
692 692
693static ieee80211_rx_result 693static ieee80211_rx_result
694ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx) 694ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
695{ 695{
696 struct sta_info *sta = rx->sta; 696 struct sta_info *sta = rx->sta;
697 struct net_device *dev = rx->dev; 697 struct net_device *dev = rx->dev;
@@ -720,20 +720,20 @@ ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx)
720 sta->last_rx = jiffies; 720 sta->last_rx = jiffies;
721 } 721 }
722 722
723 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 723 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
724 return RX_CONTINUE; 724 return RX_CONTINUE;
725 725
726 sta->rx_fragments++; 726 sta->rx_fragments++;
727 sta->rx_bytes += rx->skb->len; 727 sta->rx_bytes += rx->skb->len;
728 sta->last_rssi = rx->u.rx.status->ssi; 728 sta->last_rssi = rx->status->ssi;
729 sta->last_signal = rx->u.rx.status->signal; 729 sta->last_signal = rx->status->signal;
730 sta->last_noise = rx->u.rx.status->noise; 730 sta->last_noise = rx->status->noise;
731 731
732 if (!(rx->fc & IEEE80211_FCTL_MOREFRAGS)) { 732 if (!(rx->fc & IEEE80211_FCTL_MOREFRAGS)) {
733 /* Change STA power saving mode only in the end of a frame 733 /* Change STA power saving mode only in the end of a frame
734 * exchange sequence */ 734 * exchange sequence */
735 if ((sta->flags & WLAN_STA_PS) && !(rx->fc & IEEE80211_FCTL_PM)) 735 if ((sta->flags & WLAN_STA_PS) && !(rx->fc & IEEE80211_FCTL_PM))
736 rx->u.rx.sent_ps_buffered += ap_sta_ps_end(dev, sta); 736 rx->sent_ps_buffered += ap_sta_ps_end(dev, sta);
737 else if (!(sta->flags & WLAN_STA_PS) && 737 else if (!(sta->flags & WLAN_STA_PS) &&
738 (rx->fc & IEEE80211_FCTL_PM)) 738 (rx->fc & IEEE80211_FCTL_PM))
739 ap_sta_ps_start(dev, sta); 739 ap_sta_ps_start(dev, sta);
@@ -838,7 +838,7 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata,
838} 838}
839 839
840static ieee80211_rx_result 840static ieee80211_rx_result
841ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx) 841ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
842{ 842{
843 struct ieee80211_hdr *hdr; 843 struct ieee80211_hdr *hdr;
844 u16 sc; 844 u16 sc;
@@ -864,14 +864,14 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
864 if (frag == 0) { 864 if (frag == 0) {
865 /* This is the first fragment of a new frame. */ 865 /* This is the first fragment of a new frame. */
866 entry = ieee80211_reassemble_add(rx->sdata, frag, seq, 866 entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
867 rx->u.rx.queue, &(rx->skb)); 867 rx->queue, &(rx->skb));
868 if (rx->key && rx->key->conf.alg == ALG_CCMP && 868 if (rx->key && rx->key->conf.alg == ALG_CCMP &&
869 (rx->fc & IEEE80211_FCTL_PROTECTED)) { 869 (rx->fc & IEEE80211_FCTL_PROTECTED)) {
870 /* Store CCMP PN so that we can verify that the next 870 /* Store CCMP PN so that we can verify that the next
871 * fragment has a sequential PN value. */ 871 * fragment has a sequential PN value. */
872 entry->ccmp = 1; 872 entry->ccmp = 1;
873 memcpy(entry->last_pn, 873 memcpy(entry->last_pn,
874 rx->key->u.ccmp.rx_pn[rx->u.rx.queue], 874 rx->key->u.ccmp.rx_pn[rx->queue],
875 CCMP_PN_LEN); 875 CCMP_PN_LEN);
876 } 876 }
877 return RX_QUEUED; 877 return RX_QUEUED;
@@ -881,7 +881,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
881 * fragment cache. Add this fragment to the end of the pending entry. 881 * fragment cache. Add this fragment to the end of the pending entry.
882 */ 882 */
883 entry = ieee80211_reassemble_find(rx->sdata, rx->fc, frag, seq, 883 entry = ieee80211_reassemble_find(rx->sdata, rx->fc, frag, seq,
884 rx->u.rx.queue, hdr); 884 rx->queue, hdr);
885 if (!entry) { 885 if (!entry) {
886 I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag); 886 I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag);
887 return RX_DROP_MONITOR; 887 return RX_DROP_MONITOR;
@@ -900,7 +900,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
900 if (pn[i]) 900 if (pn[i])
901 break; 901 break;
902 } 902 }
903 rpn = rx->key->u.ccmp.rx_pn[rx->u.rx.queue]; 903 rpn = rx->key->u.ccmp.rx_pn[rx->queue];
904 if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) { 904 if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) {
905 if (net_ratelimit()) 905 if (net_ratelimit())
906 printk(KERN_DEBUG "%s: defrag: CCMP PN not " 906 printk(KERN_DEBUG "%s: defrag: CCMP PN not "
@@ -941,7 +941,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
941 } 941 }
942 942
943 /* Complete frame has been reassembled - process it now */ 943 /* Complete frame has been reassembled - process it now */
944 rx->flags |= IEEE80211_TXRXD_FRAGMENTED; 944 rx->flags |= IEEE80211_RX_FRAGMENTED;
945 945
946 out: 946 out:
947 if (rx->sta) 947 if (rx->sta)
@@ -954,7 +954,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
954} 954}
955 955
956static ieee80211_rx_result 956static ieee80211_rx_result
957ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx) 957ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
958{ 958{
959 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 959 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
960 struct sk_buff *skb; 960 struct sk_buff *skb;
@@ -964,7 +964,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
964 if (likely(!rx->sta || 964 if (likely(!rx->sta ||
965 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL || 965 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL ||
966 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL || 966 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL ||
967 !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))) 967 !(rx->flags & IEEE80211_RX_RA_MATCH)))
968 return RX_CONTINUE; 968 return RX_CONTINUE;
969 969
970 if ((sdata->vif.type != IEEE80211_IF_TYPE_AP) && 970 if ((sdata->vif.type != IEEE80211_IF_TYPE_AP) &&
@@ -1008,7 +1008,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
1008 if (no_pending_pkts) 1008 if (no_pending_pkts)
1009 sta_info_clear_tim_bit(rx->sta); 1009 sta_info_clear_tim_bit(rx->sta);
1010#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 1010#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
1011 } else if (!rx->u.rx.sent_ps_buffered) { 1011 } else if (!rx->sent_ps_buffered) {
1012 /* 1012 /*
1013 * FIXME: This can be the result of a race condition between 1013 * FIXME: This can be the result of a race condition between
1014 * us expiring a frame and the station polling for it. 1014 * us expiring a frame and the station polling for it.
@@ -1029,7 +1029,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
1029} 1029}
1030 1030
1031static ieee80211_rx_result 1031static ieee80211_rx_result
1032ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx) 1032ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx)
1033{ 1033{
1034 u16 fc = rx->fc; 1034 u16 fc = rx->fc;
1035 u8 *data = rx->skb->data; 1035 u8 *data = rx->skb->data;
@@ -1049,7 +1049,7 @@ ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
1049} 1049}
1050 1050
1051static int 1051static int
1052ieee80211_802_1x_port_control(struct ieee80211_txrx_data *rx) 1052ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
1053{ 1053{
1054 if (unlikely(!rx->sta || !(rx->sta->flags & WLAN_STA_AUTHORIZED))) { 1054 if (unlikely(!rx->sta || !(rx->sta->flags & WLAN_STA_AUTHORIZED))) {
1055#ifdef CONFIG_MAC80211_DEBUG 1055#ifdef CONFIG_MAC80211_DEBUG
@@ -1064,13 +1064,13 @@ ieee80211_802_1x_port_control(struct ieee80211_txrx_data *rx)
1064} 1064}
1065 1065
1066static int 1066static int
1067ieee80211_drop_unencrypted(struct ieee80211_txrx_data *rx) 1067ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx)
1068{ 1068{
1069 /* 1069 /*
1070 * Pass through unencrypted frames if the hardware has 1070 * Pass through unencrypted frames if the hardware has
1071 * decrypted them already. 1071 * decrypted them already.
1072 */ 1072 */
1073 if (rx->u.rx.status->flag & RX_FLAG_DECRYPTED) 1073 if (rx->status->flag & RX_FLAG_DECRYPTED)
1074 return 0; 1074 return 0;
1075 1075
1076 /* Drop unencrypted frames if key is set. */ 1076 /* Drop unencrypted frames if key is set. */
@@ -1087,7 +1087,7 @@ ieee80211_drop_unencrypted(struct ieee80211_txrx_data *rx)
1087} 1087}
1088 1088
1089static int 1089static int
1090ieee80211_data_to_8023(struct ieee80211_txrx_data *rx) 1090ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1091{ 1091{
1092 struct net_device *dev = rx->dev; 1092 struct net_device *dev = rx->dev;
1093 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 1093 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
@@ -1235,7 +1235,7 @@ ieee80211_data_to_8023(struct ieee80211_txrx_data *rx)
1235/* 1235/*
1236 * requires that rx->skb is a frame with ethernet header 1236 * requires that rx->skb is a frame with ethernet header
1237 */ 1237 */
1238static bool ieee80211_frame_allowed(struct ieee80211_txrx_data *rx) 1238static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx)
1239{ 1239{
1240 static const u8 pae_group_addr[ETH_ALEN] 1240 static const u8 pae_group_addr[ETH_ALEN]
1241 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; 1241 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
@@ -1261,7 +1261,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_txrx_data *rx)
1261 * requires that rx->skb is a frame with ethernet header 1261 * requires that rx->skb is a frame with ethernet header
1262 */ 1262 */
1263static void 1263static void
1264ieee80211_deliver_skb(struct ieee80211_txrx_data *rx) 1264ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1265{ 1265{
1266 struct net_device *dev = rx->dev; 1266 struct net_device *dev = rx->dev;
1267 struct ieee80211_local *local = rx->local; 1267 struct ieee80211_local *local = rx->local;
@@ -1275,7 +1275,7 @@ ieee80211_deliver_skb(struct ieee80211_txrx_data *rx)
1275 1275
1276 if (local->bridge_packets && (sdata->vif.type == IEEE80211_IF_TYPE_AP || 1276 if (local->bridge_packets && (sdata->vif.type == IEEE80211_IF_TYPE_AP ||
1277 sdata->vif.type == IEEE80211_IF_TYPE_VLAN) && 1277 sdata->vif.type == IEEE80211_IF_TYPE_VLAN) &&
1278 (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) { 1278 (rx->flags & IEEE80211_RX_RA_MATCH)) {
1279 if (is_multicast_ether_addr(ehdr->h_dest)) { 1279 if (is_multicast_ether_addr(ehdr->h_dest)) {
1280 /* 1280 /*
1281 * send multicast frames both to higher layers in 1281 * send multicast frames both to higher layers in
@@ -1351,7 +1351,7 @@ ieee80211_deliver_skb(struct ieee80211_txrx_data *rx)
1351} 1351}
1352 1352
1353static ieee80211_rx_result 1353static ieee80211_rx_result
1354ieee80211_rx_h_amsdu(struct ieee80211_txrx_data *rx) 1354ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1355{ 1355{
1356 struct net_device *dev = rx->dev; 1356 struct net_device *dev = rx->dev;
1357 struct ieee80211_local *local = rx->local; 1357 struct ieee80211_local *local = rx->local;
@@ -1371,7 +1371,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_txrx_data *rx)
1371 if (unlikely(!WLAN_FC_DATA_PRESENT(fc))) 1371 if (unlikely(!WLAN_FC_DATA_PRESENT(fc)))
1372 return RX_DROP_MONITOR; 1372 return RX_DROP_MONITOR;
1373 1373
1374 if (!(rx->flags & IEEE80211_TXRXD_RX_AMSDU)) 1374 if (!(rx->flags & IEEE80211_RX_AMSDU))
1375 return RX_CONTINUE; 1375 return RX_CONTINUE;
1376 1376
1377 err = ieee80211_data_to_8023(rx); 1377 err = ieee80211_data_to_8023(rx);
@@ -1468,7 +1468,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_txrx_data *rx)
1468} 1468}
1469 1469
1470static ieee80211_rx_result 1470static ieee80211_rx_result
1471ieee80211_rx_h_data(struct ieee80211_txrx_data *rx) 1471ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
1472{ 1472{
1473 struct net_device *dev = rx->dev; 1473 struct net_device *dev = rx->dev;
1474 u16 fc; 1474 u16 fc;
@@ -1499,7 +1499,7 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
1499} 1499}
1500 1500
1501static ieee80211_rx_result 1501static ieee80211_rx_result
1502ieee80211_rx_h_ctrl(struct ieee80211_txrx_data *rx) 1502ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
1503{ 1503{
1504 struct ieee80211_local *local = rx->local; 1504 struct ieee80211_local *local = rx->local;
1505 struct ieee80211_hw *hw = &local->hw; 1505 struct ieee80211_hw *hw = &local->hw;
@@ -1542,11 +1542,11 @@ ieee80211_rx_h_ctrl(struct ieee80211_txrx_data *rx)
1542} 1542}
1543 1543
1544static ieee80211_rx_result 1544static ieee80211_rx_result
1545ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx) 1545ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
1546{ 1546{
1547 struct ieee80211_sub_if_data *sdata; 1547 struct ieee80211_sub_if_data *sdata;
1548 1548
1549 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 1549 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
1550 return RX_DROP_MONITOR; 1550 return RX_DROP_MONITOR;
1551 1551
1552 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 1552 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
@@ -1554,7 +1554,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1554 sdata->vif.type == IEEE80211_IF_TYPE_IBSS || 1554 sdata->vif.type == IEEE80211_IF_TYPE_IBSS ||
1555 sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) && 1555 sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) &&
1556 !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) 1556 !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME))
1557 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status); 1557 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->status);
1558 else 1558 else
1559 return RX_DROP_MONITOR; 1559 return RX_DROP_MONITOR;
1560 1560
@@ -1563,7 +1563,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1563 1563
1564static void ieee80211_rx_michael_mic_report(struct net_device *dev, 1564static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1565 struct ieee80211_hdr *hdr, 1565 struct ieee80211_hdr *hdr,
1566 struct ieee80211_txrx_data *rx) 1566 struct ieee80211_rx_data *rx)
1567{ 1567{
1568 int keyidx, hdrlen; 1568 int keyidx, hdrlen;
1569 DECLARE_MAC_BUF(mac); 1569 DECLARE_MAC_BUF(mac);
@@ -1633,7 +1633,8 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1633 rx->skb = NULL; 1633 rx->skb = NULL;
1634} 1634}
1635 1635
1636static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx) 1636/* TODO: use IEEE80211_RX_FRAGMENTED */
1637static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx)
1637{ 1638{
1638 struct ieee80211_sub_if_data *sdata; 1639 struct ieee80211_sub_if_data *sdata;
1639 struct ieee80211_local *local = rx->local; 1640 struct ieee80211_local *local = rx->local;
@@ -1646,9 +1647,9 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx)
1646 } __attribute__ ((packed)) *rthdr; 1647 } __attribute__ ((packed)) *rthdr;
1647 struct sk_buff *skb = rx->skb, *skb2; 1648 struct sk_buff *skb = rx->skb, *skb2;
1648 struct net_device *prev_dev = NULL; 1649 struct net_device *prev_dev = NULL;
1649 struct ieee80211_rx_status *status = rx->u.rx.status; 1650 struct ieee80211_rx_status *status = rx->status;
1650 1651
1651 if (rx->flags & IEEE80211_TXRXD_RX_CMNTR_REPORTED) 1652 if (rx->flags & IEEE80211_RX_CMNTR_REPORTED)
1652 goto out_free_skb; 1653 goto out_free_skb;
1653 1654
1654 if (skb_headroom(skb) < sizeof(*rthdr) && 1655 if (skb_headroom(skb) < sizeof(*rthdr) &&
@@ -1663,7 +1664,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx)
1663 (1 << IEEE80211_RADIOTAP_RATE) | 1664 (1 << IEEE80211_RADIOTAP_RATE) |
1664 (1 << IEEE80211_RADIOTAP_CHANNEL)); 1665 (1 << IEEE80211_RADIOTAP_CHANNEL));
1665 1666
1666 rthdr->rate = rx->u.rx.rate->bitrate / 5; 1667 rthdr->rate = rx->rate->bitrate / 5;
1667 rthdr->chan_freq = cpu_to_le16(status->freq); 1668 rthdr->chan_freq = cpu_to_le16(status->freq);
1668 1669
1669 if (status->band == IEEE80211_BAND_5GHZ) 1670 if (status->band == IEEE80211_BAND_5GHZ)
@@ -1706,14 +1707,14 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx)
1706 } else 1707 } else
1707 goto out_free_skb; 1708 goto out_free_skb;
1708 1709
1709 rx->flags |= IEEE80211_TXRXD_RX_CMNTR_REPORTED; 1710 rx->flags |= IEEE80211_RX_CMNTR_REPORTED;
1710 return; 1711 return;
1711 1712
1712 out_free_skb: 1713 out_free_skb:
1713 dev_kfree_skb(skb); 1714 dev_kfree_skb(skb);
1714} 1715}
1715 1716
1716typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_txrx_data *); 1717typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *);
1717static ieee80211_rx_handler ieee80211_rx_handlers[] = 1718static ieee80211_rx_handler ieee80211_rx_handlers[] =
1718{ 1719{
1719 ieee80211_rx_h_if_stats, 1720 ieee80211_rx_h_if_stats,
@@ -1737,7 +1738,7 @@ static ieee80211_rx_handler ieee80211_rx_handlers[] =
1737}; 1738};
1738 1739
1739static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, 1740static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
1740 struct ieee80211_txrx_data *rx, 1741 struct ieee80211_rx_data *rx,
1741 struct sk_buff *skb) 1742 struct sk_buff *skb)
1742{ 1743{
1743 ieee80211_rx_handler *handler; 1744 ieee80211_rx_handler *handler;
@@ -1780,7 +1781,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
1780/* main receive path */ 1781/* main receive path */
1781 1782
1782static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, 1783static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1783 u8 *bssid, struct ieee80211_txrx_data *rx, 1784 u8 *bssid, struct ieee80211_rx_data *rx,
1784 struct ieee80211_hdr *hdr) 1785 struct ieee80211_hdr *hdr)
1785{ 1786{
1786 int multicast = is_multicast_ether_addr(hdr->addr1); 1787 int multicast = is_multicast_ether_addr(hdr->addr1);
@@ -1790,15 +1791,15 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1790 if (!bssid) 1791 if (!bssid)
1791 return 0; 1792 return 0;
1792 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1793 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
1793 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1794 if (!(rx->flags & IEEE80211_RX_IN_SCAN))
1794 return 0; 1795 return 0;
1795 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1796 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1796 } else if (!multicast && 1797 } else if (!multicast &&
1797 compare_ether_addr(sdata->dev->dev_addr, 1798 compare_ether_addr(sdata->dev->dev_addr,
1798 hdr->addr1) != 0) { 1799 hdr->addr1) != 0) {
1799 if (!(sdata->dev->flags & IFF_PROMISC)) 1800 if (!(sdata->dev->flags & IFF_PROMISC))
1800 return 0; 1801 return 0;
1801 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1802 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1802 } 1803 }
1803 break; 1804 break;
1804 case IEEE80211_IF_TYPE_IBSS: 1805 case IEEE80211_IF_TYPE_IBSS:
@@ -1808,15 +1809,15 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1808 (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) 1809 (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON)
1809 return 1; 1810 return 1;
1810 else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1811 else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
1811 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1812 if (!(rx->flags & IEEE80211_RX_IN_SCAN))
1812 return 0; 1813 return 0;
1813 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1814 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1814 } else if (!multicast && 1815 } else if (!multicast &&
1815 compare_ether_addr(sdata->dev->dev_addr, 1816 compare_ether_addr(sdata->dev->dev_addr,
1816 hdr->addr1) != 0) { 1817 hdr->addr1) != 0) {
1817 if (!(sdata->dev->flags & IFF_PROMISC)) 1818 if (!(sdata->dev->flags & IFF_PROMISC))
1818 return 0; 1819 return 0;
1819 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1820 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1820 } else if (!rx->sta) 1821 } else if (!rx->sta)
1821 rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, 1822 rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb,
1822 bssid, hdr->addr2); 1823 bssid, hdr->addr2);
@@ -1828,7 +1829,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1828 if (!(sdata->dev->flags & IFF_PROMISC)) 1829 if (!(sdata->dev->flags & IFF_PROMISC))
1829 return 0; 1830 return 0;
1830 1831
1831 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1832 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1832 } 1833 }
1833 break; 1834 break;
1834 case IEEE80211_IF_TYPE_VLAN: 1835 case IEEE80211_IF_TYPE_VLAN:
@@ -1839,12 +1840,12 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1839 return 0; 1840 return 0;
1840 } else if (!ieee80211_bssid_match(bssid, 1841 } else if (!ieee80211_bssid_match(bssid,
1841 sdata->dev->dev_addr)) { 1842 sdata->dev->dev_addr)) {
1842 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1843 if (!(rx->flags & IEEE80211_RX_IN_SCAN))
1843 return 0; 1844 return 0;
1844 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1845 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1845 } 1846 }
1846 if (sdata->dev == sdata->local->mdev && 1847 if (sdata->dev == sdata->local->mdev &&
1847 !(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1848 !(rx->flags & IEEE80211_RX_IN_SCAN))
1848 /* do not receive anything via 1849 /* do not receive anything via
1849 * master device when not scanning */ 1850 * master device when not scanning */
1850 return 0; 1851 return 0;
@@ -1881,7 +1882,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1881 struct ieee80211_local *local = hw_to_local(hw); 1882 struct ieee80211_local *local = hw_to_local(hw);
1882 struct ieee80211_sub_if_data *sdata; 1883 struct ieee80211_sub_if_data *sdata;
1883 struct ieee80211_hdr *hdr; 1884 struct ieee80211_hdr *hdr;
1884 struct ieee80211_txrx_data rx; 1885 struct ieee80211_rx_data rx;
1885 u16 type; 1886 u16 type;
1886 int prepares; 1887 int prepares;
1887 struct ieee80211_sub_if_data *prev = NULL; 1888 struct ieee80211_sub_if_data *prev = NULL;
@@ -1893,9 +1894,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1893 rx.skb = skb; 1894 rx.skb = skb;
1894 rx.local = local; 1895 rx.local = local;
1895 1896
1896 rx.u.rx.status = status; 1897 rx.status = status;
1897 rx.u.rx.load = load; 1898 rx.load = load;
1898 rx.u.rx.rate = rate; 1899 rx.rate = rate;
1899 rx.fc = le16_to_cpu(hdr->frame_control); 1900 rx.fc = le16_to_cpu(hdr->frame_control);
1900 type = rx.fc & IEEE80211_FCTL_FTYPE; 1901 type = rx.fc & IEEE80211_FCTL_FTYPE;
1901 1902
@@ -1914,7 +1915,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1914 } 1915 }
1915 1916
1916 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning)) 1917 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning))
1917 rx.flags |= IEEE80211_TXRXD_RXIN_SCAN; 1918 rx.flags |= IEEE80211_RX_IN_SCAN;
1918 1919
1919 ieee80211_parse_qos(&rx); 1920 ieee80211_parse_qos(&rx);
1920 ieee80211_verify_ip_alignment(&rx); 1921 ieee80211_verify_ip_alignment(&rx);
@@ -1929,7 +1930,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1929 continue; 1930 continue;
1930 1931
1931 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); 1932 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
1932 rx.flags |= IEEE80211_TXRXD_RXRA_MATCH; 1933 rx.flags |= IEEE80211_RX_RA_MATCH;
1933 prepares = prepare_for_handlers(sdata, bssid, &rx, hdr); 1934 prepares = prepare_for_handlers(sdata, bssid, &rx, hdr);
1934 1935
1935 if (!prepares) 1936 if (!prepares)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3b06e0d8f35c..33e314f3aab7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -87,11 +87,11 @@ static inline void ieee80211_dump_frame(const char *ifname, const char *title,
87} 87}
88#endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ 88#endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */
89 89
90static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, 90static u16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
91 int next_frag_len) 91 int next_frag_len)
92{ 92{
93 int rate, mrate, erp, dur, i; 93 int rate, mrate, erp, dur, i;
94 struct ieee80211_rate *txrate = tx->u.tx.rate; 94 struct ieee80211_rate *txrate = tx->rate;
95 struct ieee80211_local *local = tx->local; 95 struct ieee80211_local *local = tx->local;
96 struct ieee80211_supported_band *sband; 96 struct ieee80211_supported_band *sband;
97 97
@@ -234,7 +234,7 @@ static int inline is_ieee80211_device(struct net_device *dev,
234/* tx handlers */ 234/* tx handlers */
235 235
236static ieee80211_tx_result 236static ieee80211_tx_result
237ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx) 237ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
238{ 238{
239#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 239#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
240 struct sk_buff *skb = tx->skb; 240 struct sk_buff *skb = tx->skb;
@@ -242,7 +242,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
242#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 242#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
243 u32 sta_flags; 243 u32 sta_flags;
244 244
245 if (unlikely(tx->flags & IEEE80211_TXRXD_TX_INJECTED)) 245 if (unlikely(tx->flags & IEEE80211_TX_INJECTED))
246 return TX_CONTINUE; 246 return TX_CONTINUE;
247 247
248 if (unlikely(tx->local->sta_sw_scanning) && 248 if (unlikely(tx->local->sta_sw_scanning) &&
@@ -253,12 +253,12 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
253 if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) 253 if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
254 return TX_CONTINUE; 254 return TX_CONTINUE;
255 255
256 if (tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED) 256 if (tx->flags & IEEE80211_TX_PS_BUFFERED)
257 return TX_CONTINUE; 257 return TX_CONTINUE;
258 258
259 sta_flags = tx->sta ? tx->sta->flags : 0; 259 sta_flags = tx->sta ? tx->sta->flags : 0;
260 260
261 if (likely(tx->flags & IEEE80211_TXRXD_TXUNICAST)) { 261 if (likely(tx->flags & IEEE80211_TX_UNICAST)) {
262 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && 262 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) &&
263 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 263 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
264 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 264 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
@@ -288,7 +288,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
288} 288}
289 289
290static ieee80211_tx_result 290static ieee80211_tx_result
291ieee80211_tx_h_sequence(struct ieee80211_txrx_data *tx) 291ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
292{ 292{
293 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 293 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
294 294
@@ -346,7 +346,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
346} 346}
347 347
348static ieee80211_tx_result 348static ieee80211_tx_result
349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) 349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
350{ 350{
351 /* 351 /*
352 * broadcast/multicast frame 352 * broadcast/multicast frame
@@ -383,13 +383,13 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx)
383 } 383 }
384 384
385 /* buffered in hardware */ 385 /* buffered in hardware */
386 tx->u.tx.control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; 386 tx->control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM;
387 387
388 return TX_CONTINUE; 388 return TX_CONTINUE;
389} 389}
390 390
391static ieee80211_tx_result 391static ieee80211_tx_result
392ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) 392ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
393{ 393{
394 struct sta_info *sta = tx->sta; 394 struct sta_info *sta = tx->sta;
395 DECLARE_MAC_BUF(mac); 395 DECLARE_MAC_BUF(mac);
@@ -443,32 +443,32 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
443} 443}
444 444
445static ieee80211_tx_result 445static ieee80211_tx_result
446ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx) 446ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
447{ 447{
448 if (unlikely(tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED)) 448 if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED))
449 return TX_CONTINUE; 449 return TX_CONTINUE;
450 450
451 if (tx->flags & IEEE80211_TXRXD_TXUNICAST) 451 if (tx->flags & IEEE80211_TX_UNICAST)
452 return ieee80211_tx_h_unicast_ps_buf(tx); 452 return ieee80211_tx_h_unicast_ps_buf(tx);
453 else 453 else
454 return ieee80211_tx_h_multicast_ps_buf(tx); 454 return ieee80211_tx_h_multicast_ps_buf(tx);
455} 455}
456 456
457static ieee80211_tx_result 457static ieee80211_tx_result
458ieee80211_tx_h_select_key(struct ieee80211_txrx_data *tx) 458ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
459{ 459{
460 struct ieee80211_key *key; 460 struct ieee80211_key *key;
461 u16 fc = tx->fc; 461 u16 fc = tx->fc;
462 462
463 if (unlikely(tx->u.tx.control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 463 if (unlikely(tx->control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT))
464 tx->key = NULL; 464 tx->key = NULL;
465 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 465 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
466 tx->key = key; 466 tx->key = key;
467 else if ((key = rcu_dereference(tx->sdata->default_key))) 467 else if ((key = rcu_dereference(tx->sdata->default_key)))
468 tx->key = key; 468 tx->key = key;
469 else if (tx->sdata->drop_unencrypted && 469 else if (tx->sdata->drop_unencrypted &&
470 !(tx->u.tx.control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && 470 !(tx->control->flags & IEEE80211_TXCTL_EAPOL_FRAME) &&
471 !(tx->flags & IEEE80211_TXRXD_TX_INJECTED)) { 471 !(tx->flags & IEEE80211_TX_INJECTED)) {
472 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 472 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
473 return TX_DROP; 473 return TX_DROP;
474 } else 474 } else
@@ -497,13 +497,13 @@ ieee80211_tx_h_select_key(struct ieee80211_txrx_data *tx)
497 } 497 }
498 498
499 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 499 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
500 tx->u.tx.control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 500 tx->control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
501 501
502 return TX_CONTINUE; 502 return TX_CONTINUE;
503} 503}
504 504
505static ieee80211_tx_result 505static ieee80211_tx_result
506ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) 506ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
507{ 507{
508 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 508 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
509 size_t hdrlen, per_fragm, num_fragm, payload_len, left; 509 size_t hdrlen, per_fragm, num_fragm, payload_len, left;
@@ -513,7 +513,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
513 u8 *pos; 513 u8 *pos;
514 int frag_threshold = tx->local->fragmentation_threshold; 514 int frag_threshold = tx->local->fragmentation_threshold;
515 515
516 if (!(tx->flags & IEEE80211_TXRXD_FRAGMENTED)) 516 if (!(tx->flags & IEEE80211_TX_FRAGMENTED))
517 return TX_CONTINUE; 517 return TX_CONTINUE;
518 518
519 first = tx->skb; 519 first = tx->skb;
@@ -565,8 +565,8 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
565 } 565 }
566 skb_trim(first, hdrlen + per_fragm); 566 skb_trim(first, hdrlen + per_fragm);
567 567
568 tx->u.tx.num_extra_frag = num_fragm - 1; 568 tx->num_extra_frag = num_fragm - 1;
569 tx->u.tx.extra_frag = frags; 569 tx->extra_frag = frags;
570 570
571 return TX_CONTINUE; 571 return TX_CONTINUE;
572 572
@@ -583,7 +583,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
583} 583}
584 584
585static ieee80211_tx_result 585static ieee80211_tx_result
586ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx) 586ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
587{ 587{
588 if (!tx->key) 588 if (!tx->key)
589 return TX_CONTINUE; 589 return TX_CONTINUE;
@@ -603,56 +603,56 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
603} 603}
604 604
605static ieee80211_tx_result 605static ieee80211_tx_result
606ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) 606ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
607{ 607{
608 struct rate_selection rsel; 608 struct rate_selection rsel;
609 struct ieee80211_supported_band *sband; 609 struct ieee80211_supported_band *sband;
610 610
611 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; 611 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band];
612 612
613 if (likely(!tx->u.tx.rate)) { 613 if (likely(!tx->rate)) {
614 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); 614 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel);
615 tx->u.tx.rate = rsel.rate; 615 tx->rate = rsel.rate;
616 if (unlikely(rsel.probe)) { 616 if (unlikely(rsel.probe)) {
617 tx->u.tx.control->flags |= 617 tx->control->flags |=
618 IEEE80211_TXCTL_RATE_CTRL_PROBE; 618 IEEE80211_TXCTL_RATE_CTRL_PROBE;
619 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 619 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
620 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate; 620 tx->control->alt_retry_rate = tx->rate;
621 tx->u.tx.rate = rsel.probe; 621 tx->rate = rsel.probe;
622 } else 622 } else
623 tx->u.tx.control->alt_retry_rate = NULL; 623 tx->control->alt_retry_rate = NULL;
624 624
625 if (!tx->u.tx.rate) 625 if (!tx->rate)
626 return TX_DROP; 626 return TX_DROP;
627 } else 627 } else
628 tx->u.tx.control->alt_retry_rate = NULL; 628 tx->control->alt_retry_rate = NULL;
629 629
630 if (tx->sdata->bss_conf.use_cts_prot && 630 if (tx->sdata->bss_conf.use_cts_prot &&
631 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { 631 (tx->flags & IEEE80211_TX_FRAGMENTED) && rsel.nonerp) {
632 tx->u.tx.last_frag_rate = tx->u.tx.rate; 632 tx->last_frag_rate = tx->rate;
633 if (rsel.probe) 633 if (rsel.probe)
634 tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 634 tx->flags &= ~IEEE80211_TX_PROBE_LAST_FRAG;
635 else 635 else
636 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 636 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
637 tx->u.tx.rate = rsel.nonerp; 637 tx->rate = rsel.nonerp;
638 tx->u.tx.control->tx_rate = rsel.nonerp; 638 tx->control->tx_rate = rsel.nonerp;
639 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 639 tx->control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
640 } else { 640 } else {
641 tx->u.tx.last_frag_rate = tx->u.tx.rate; 641 tx->last_frag_rate = tx->rate;
642 tx->u.tx.control->tx_rate = tx->u.tx.rate; 642 tx->control->tx_rate = tx->rate;
643 } 643 }
644 tx->u.tx.control->tx_rate = tx->u.tx.rate; 644 tx->control->tx_rate = tx->rate;
645 645
646 return TX_CONTINUE; 646 return TX_CONTINUE;
647} 647}
648 648
649static ieee80211_tx_result 649static ieee80211_tx_result
650ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) 650ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
651{ 651{
652 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 652 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
653 u16 fc = le16_to_cpu(hdr->frame_control); 653 u16 fc = le16_to_cpu(hdr->frame_control);
654 u16 dur; 654 u16 dur;
655 struct ieee80211_tx_control *control = tx->u.tx.control; 655 struct ieee80211_tx_control *control = tx->control;
656 656
657 if (!control->retry_limit) { 657 if (!control->retry_limit) {
658 if (!is_multicast_ether_addr(hdr->addr1)) { 658 if (!is_multicast_ether_addr(hdr->addr1)) {
@@ -674,7 +674,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
674 } 674 }
675 } 675 }
676 676
677 if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) { 677 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
678 /* Do not use multiple retry rates when sending fragmented 678 /* Do not use multiple retry rates when sending fragmented
679 * frames. 679 * frames.
680 * TODO: The last fragment could still use multiple retry 680 * TODO: The last fragment could still use multiple retry
@@ -686,8 +686,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
686 * there are associated non-ERP stations and RTS/CTS is not configured 686 * there are associated non-ERP stations and RTS/CTS is not configured
687 * for the frame. */ 687 * for the frame. */
688 if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && 688 if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) &&
689 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP_G) && 689 (tx->rate->flags & IEEE80211_RATE_ERP_G) &&
690 (tx->flags & IEEE80211_TXRXD_TXUNICAST) && 690 (tx->flags & IEEE80211_TX_UNICAST) &&
691 tx->sdata->bss_conf.use_cts_prot && 691 tx->sdata->bss_conf.use_cts_prot &&
692 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 692 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
693 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 693 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
@@ -696,18 +696,18 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
696 * short preambles at the selected rate and short preambles are 696 * short preambles at the selected rate and short preambles are
697 * available on the network at the current point in time. */ 697 * available on the network at the current point in time. */
698 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 698 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
699 (tx->u.tx.rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) && 699 (tx->rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) &&
700 tx->sdata->bss_conf.use_short_preamble && 700 tx->sdata->bss_conf.use_short_preamble &&
701 (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { 701 (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) {
702 tx->u.tx.control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 702 tx->control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE;
703 } 703 }
704 704
705 /* Setup duration field for the first fragment of the frame. Duration 705 /* Setup duration field for the first fragment of the frame. Duration
706 * for remaining fragments will be updated when they are being sent 706 * for remaining fragments will be updated when they are being sent
707 * to low-level driver in ieee80211_tx(). */ 707 * to low-level driver in ieee80211_tx(). */
708 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1), 708 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1),
709 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) ? 709 (tx->flags & IEEE80211_TX_FRAGMENTED) ?
710 tx->u.tx.extra_frag[0]->len : 0); 710 tx->extra_frag[0]->len : 0);
711 hdr->duration_id = cpu_to_le16(dur); 711 hdr->duration_id = cpu_to_le16(dur);
712 712
713 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 713 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) ||
@@ -723,7 +723,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
723 control->alt_retry_rate = NULL; 723 control->alt_retry_rate = NULL;
724 724
725 /* Use min(data rate, max base rate) as CTS/RTS rate */ 725 /* Use min(data rate, max base rate) as CTS/RTS rate */
726 rate = tx->u.tx.rate; 726 rate = tx->rate;
727 baserate = NULL; 727 baserate = NULL;
728 728
729 for (idx = 0; idx < sband->n_bitrates; idx++) { 729 for (idx = 0; idx < sband->n_bitrates; idx++) {
@@ -745,12 +745,12 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
745 tx->sta->tx_packets++; 745 tx->sta->tx_packets++;
746 tx->sta->tx_fragments++; 746 tx->sta->tx_fragments++;
747 tx->sta->tx_bytes += tx->skb->len; 747 tx->sta->tx_bytes += tx->skb->len;
748 if (tx->u.tx.extra_frag) { 748 if (tx->extra_frag) {
749 int i; 749 int i;
750 tx->sta->tx_fragments += tx->u.tx.num_extra_frag; 750 tx->sta->tx_fragments += tx->num_extra_frag;
751 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 751 for (i = 0; i < tx->num_extra_frag; i++) {
752 tx->sta->tx_bytes += 752 tx->sta->tx_bytes +=
753 tx->u.tx.extra_frag[i]->len; 753 tx->extra_frag[i]->len;
754 } 754 }
755 } 755 }
756 } 756 }
@@ -759,13 +759,13 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
759} 759}
760 760
761static ieee80211_tx_result 761static ieee80211_tx_result
762ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) 762ieee80211_tx_h_load_stats(struct ieee80211_tx_data *tx)
763{ 763{
764 struct ieee80211_local *local = tx->local; 764 struct ieee80211_local *local = tx->local;
765 struct sk_buff *skb = tx->skb; 765 struct sk_buff *skb = tx->skb;
766 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 766 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
767 u32 load = 0, hdrtime; 767 u32 load = 0, hdrtime;
768 struct ieee80211_rate *rate = tx->u.tx.rate; 768 struct ieee80211_rate *rate = tx->rate;
769 769
770 /* TODO: this could be part of tx_status handling, so that the number 770 /* TODO: this could be part of tx_status handling, so that the number
771 * of retries would be known; TX rate should in that case be stored 771 * of retries would be known; TX rate should in that case be stored
@@ -776,8 +776,8 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
776 /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, 776 /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values,
777 * 1 usec = 1/8 * (1080 / 10) = 13.5 */ 777 * 1 usec = 1/8 * (1080 / 10) = 13.5 */
778 778
779 if (tx->u.tx.channel->band == IEEE80211_BAND_5GHZ || 779 if (tx->channel->band == IEEE80211_BAND_5GHZ ||
780 (tx->u.tx.channel->band == IEEE80211_BAND_2GHZ && 780 (tx->channel->band == IEEE80211_BAND_2GHZ &&
781 rate->flags & IEEE80211_RATE_ERP_G)) 781 rate->flags & IEEE80211_RATE_ERP_G))
782 hdrtime = CHAN_UTIL_HDR_SHORT; 782 hdrtime = CHAN_UTIL_HDR_SHORT;
783 else 783 else
@@ -787,20 +787,20 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
787 if (!is_multicast_ether_addr(hdr->addr1)) 787 if (!is_multicast_ether_addr(hdr->addr1))
788 load += hdrtime; 788 load += hdrtime;
789 789
790 if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 790 if (tx->control->flags & IEEE80211_TXCTL_USE_RTS_CTS)
791 load += 2 * hdrtime; 791 load += 2 * hdrtime;
792 else if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 792 else if (tx->control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)
793 load += hdrtime; 793 load += hdrtime;
794 794
795 /* TODO: optimise again */ 795 /* TODO: optimise again */
796 load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate; 796 load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate;
797 797
798 if (tx->u.tx.extra_frag) { 798 if (tx->extra_frag) {
799 int i; 799 int i;
800 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 800 for (i = 0; i < tx->num_extra_frag; i++) {
801 load += 2 * hdrtime; 801 load += 2 * hdrtime;
802 load += tx->u.tx.extra_frag[i]->len * 802 load += tx->extra_frag[i]->len *
803 tx->u.tx.rate->bitrate; 803 tx->rate->bitrate;
804 } 804 }
805 } 805 }
806 806
@@ -815,7 +815,7 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
815} 815}
816 816
817 817
818typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_txrx_data *); 818typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_tx_data *);
819static ieee80211_tx_handler ieee80211_tx_handlers[] = 819static ieee80211_tx_handler ieee80211_tx_handlers[] =
820{ 820{
821 ieee80211_tx_h_check_assoc, 821 ieee80211_tx_h_check_assoc,
@@ -838,7 +838,7 @@ static ieee80211_tx_handler ieee80211_tx_handlers[] =
838 * with Radiotap Header -- only called for monitor mode interface 838 * with Radiotap Header -- only called for monitor mode interface
839 */ 839 */
840static ieee80211_tx_result 840static ieee80211_tx_result
841__ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, 841__ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
842 struct sk_buff *skb) 842 struct sk_buff *skb)
843{ 843{
844 /* 844 /*
@@ -854,13 +854,13 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
854 (struct ieee80211_radiotap_header *) skb->data; 854 (struct ieee80211_radiotap_header *) skb->data;
855 struct ieee80211_supported_band *sband; 855 struct ieee80211_supported_band *sband;
856 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); 856 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len);
857 struct ieee80211_tx_control *control = tx->u.tx.control; 857 struct ieee80211_tx_control *control = tx->control;
858 858
859 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; 859 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band];
860 860
861 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 861 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
862 tx->flags |= IEEE80211_TXRXD_TX_INJECTED; 862 tx->flags |= IEEE80211_TX_INJECTED;
863 tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; 863 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
864 864
865 /* 865 /*
866 * for every radiotap entry that is present 866 * for every radiotap entry that is present
@@ -896,7 +896,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
896 r = &sband->bitrates[i]; 896 r = &sband->bitrates[i];
897 897
898 if (r->bitrate == target_rate) { 898 if (r->bitrate == target_rate) {
899 tx->u.tx.rate = r; 899 tx->rate = r;
900 break; 900 break;
901 } 901 }
902 } 902 }
@@ -934,7 +934,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
934 control->flags &= 934 control->flags &=
935 ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; 935 ~IEEE80211_TXCTL_DO_NOT_ENCRYPT;
936 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 936 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
937 tx->flags |= IEEE80211_TXRXD_FRAGMENTED; 937 tx->flags |= IEEE80211_TX_FRAGMENTED;
938 break; 938 break;
939 939
940 /* 940 /*
@@ -965,7 +965,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
965 * initialises @tx 965 * initialises @tx
966 */ 966 */
967static ieee80211_tx_result 967static ieee80211_tx_result
968__ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, 968__ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
969 struct sk_buff *skb, 969 struct sk_buff *skb,
970 struct net_device *dev, 970 struct net_device *dev,
971 struct ieee80211_tx_control *control) 971 struct ieee80211_tx_control *control)
@@ -981,12 +981,12 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
981 tx->dev = dev; /* use original interface */ 981 tx->dev = dev; /* use original interface */
982 tx->local = local; 982 tx->local = local;
983 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); 983 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev);
984 tx->u.tx.control = control; 984 tx->control = control;
985 /* 985 /*
986 * Set this flag (used below to indicate "automatic fragmentation"), 986 * Set this flag (used below to indicate "automatic fragmentation"),
987 * it will be cleared/left by radiotap as desired. 987 * it will be cleared/left by radiotap as desired.
988 */ 988 */
989 tx->flags |= IEEE80211_TXRXD_FRAGMENTED; 989 tx->flags |= IEEE80211_TX_FRAGMENTED;
990 990
991 /* process and remove the injection radiotap header */ 991 /* process and remove the injection radiotap header */
992 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 992 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1007,20 +1007,20 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1007 tx->fc = le16_to_cpu(hdr->frame_control); 1007 tx->fc = le16_to_cpu(hdr->frame_control);
1008 1008
1009 if (is_multicast_ether_addr(hdr->addr1)) { 1009 if (is_multicast_ether_addr(hdr->addr1)) {
1010 tx->flags &= ~IEEE80211_TXRXD_TXUNICAST; 1010 tx->flags &= ~IEEE80211_TX_UNICAST;
1011 control->flags |= IEEE80211_TXCTL_NO_ACK; 1011 control->flags |= IEEE80211_TXCTL_NO_ACK;
1012 } else { 1012 } else {
1013 tx->flags |= IEEE80211_TXRXD_TXUNICAST; 1013 tx->flags |= IEEE80211_TX_UNICAST;
1014 control->flags &= ~IEEE80211_TXCTL_NO_ACK; 1014 control->flags &= ~IEEE80211_TXCTL_NO_ACK;
1015 } 1015 }
1016 1016
1017 if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) { 1017 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
1018 if ((tx->flags & IEEE80211_TXRXD_TXUNICAST) && 1018 if ((tx->flags & IEEE80211_TX_UNICAST) &&
1019 skb->len + FCS_LEN > local->fragmentation_threshold && 1019 skb->len + FCS_LEN > local->fragmentation_threshold &&
1020 !local->ops->set_frag_threshold) 1020 !local->ops->set_frag_threshold)
1021 tx->flags |= IEEE80211_TXRXD_FRAGMENTED; 1021 tx->flags |= IEEE80211_TX_FRAGMENTED;
1022 else 1022 else
1023 tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; 1023 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
1024 } 1024 }
1025 1025
1026 if (!tx->sta) 1026 if (!tx->sta)
@@ -1043,7 +1043,7 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1043/* 1043/*
1044 * NB: @tx is uninitialised when passed in here 1044 * NB: @tx is uninitialised when passed in here
1045 */ 1045 */
1046static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, 1046static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1047 struct sk_buff *skb, 1047 struct sk_buff *skb,
1048 struct net_device *mdev, 1048 struct net_device *mdev,
1049 struct ieee80211_tx_control *control) 1049 struct ieee80211_tx_control *control)
@@ -1066,9 +1066,9 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1066} 1066}
1067 1067
1068static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, 1068static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1069 struct ieee80211_txrx_data *tx) 1069 struct ieee80211_tx_data *tx)
1070{ 1070{
1071 struct ieee80211_tx_control *control = tx->u.tx.control; 1071 struct ieee80211_tx_control *control = tx->control;
1072 int ret, i; 1072 int ret, i;
1073 1073
1074 if (!ieee80211_qdisc_installed(local->mdev) && 1074 if (!ieee80211_qdisc_installed(local->mdev) &&
@@ -1085,20 +1085,20 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1085 local->mdev->trans_start = jiffies; 1085 local->mdev->trans_start = jiffies;
1086 ieee80211_led_tx(local, 1); 1086 ieee80211_led_tx(local, 1);
1087 } 1087 }
1088 if (tx->u.tx.extra_frag) { 1088 if (tx->extra_frag) {
1089 control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS | 1089 control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS |
1090 IEEE80211_TXCTL_USE_CTS_PROTECT | 1090 IEEE80211_TXCTL_USE_CTS_PROTECT |
1091 IEEE80211_TXCTL_CLEAR_PS_FILT | 1091 IEEE80211_TXCTL_CLEAR_PS_FILT |
1092 IEEE80211_TXCTL_FIRST_FRAGMENT); 1092 IEEE80211_TXCTL_FIRST_FRAGMENT);
1093 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 1093 for (i = 0; i < tx->num_extra_frag; i++) {
1094 if (!tx->u.tx.extra_frag[i]) 1094 if (!tx->extra_frag[i])
1095 continue; 1095 continue;
1096 if (__ieee80211_queue_stopped(local, control->queue)) 1096 if (__ieee80211_queue_stopped(local, control->queue))
1097 return IEEE80211_TX_FRAG_AGAIN; 1097 return IEEE80211_TX_FRAG_AGAIN;
1098 if (i == tx->u.tx.num_extra_frag) { 1098 if (i == tx->num_extra_frag) {
1099 control->tx_rate = tx->u.tx.last_frag_rate; 1099 control->tx_rate = tx->last_frag_rate;
1100 1100
1101 if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG) 1101 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG)
1102 control->flags |= 1102 control->flags |=
1103 IEEE80211_TXCTL_RATE_CTRL_PROBE; 1103 IEEE80211_TXCTL_RATE_CTRL_PROBE;
1104 else 1104 else
@@ -1108,18 +1108,18 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1108 1108
1109 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1109 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1110 "TX to low-level driver", 1110 "TX to low-level driver",
1111 tx->u.tx.extra_frag[i]); 1111 tx->extra_frag[i]);
1112 ret = local->ops->tx(local_to_hw(local), 1112 ret = local->ops->tx(local_to_hw(local),
1113 tx->u.tx.extra_frag[i], 1113 tx->extra_frag[i],
1114 control); 1114 control);
1115 if (ret) 1115 if (ret)
1116 return IEEE80211_TX_FRAG_AGAIN; 1116 return IEEE80211_TX_FRAG_AGAIN;
1117 local->mdev->trans_start = jiffies; 1117 local->mdev->trans_start = jiffies;
1118 ieee80211_led_tx(local, 1); 1118 ieee80211_led_tx(local, 1);
1119 tx->u.tx.extra_frag[i] = NULL; 1119 tx->extra_frag[i] = NULL;
1120 } 1120 }
1121 kfree(tx->u.tx.extra_frag); 1121 kfree(tx->extra_frag);
1122 tx->u.tx.extra_frag = NULL; 1122 tx->extra_frag = NULL;
1123 } 1123 }
1124 return IEEE80211_TX_OK; 1124 return IEEE80211_TX_OK;
1125} 1125}
@@ -1130,7 +1130,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1130 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1130 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1131 struct sta_info *sta; 1131 struct sta_info *sta;
1132 ieee80211_tx_handler *handler; 1132 ieee80211_tx_handler *handler;
1133 struct ieee80211_txrx_data tx; 1133 struct ieee80211_tx_data tx;
1134 ieee80211_tx_result res = TX_DROP, res_prepare; 1134 ieee80211_tx_result res = TX_DROP, res_prepare;
1135 int ret, i; 1135 int ret, i;
1136 1136
@@ -1156,7 +1156,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1156 rcu_read_lock(); 1156 rcu_read_lock();
1157 1157
1158 sta = tx.sta; 1158 sta = tx.sta;
1159 tx.u.tx.channel = local->hw.conf.channel; 1159 tx.channel = local->hw.conf.channel;
1160 1160
1161 for (handler = ieee80211_tx_handlers; *handler != NULL; 1161 for (handler = ieee80211_tx_handlers; *handler != NULL;
1162 handler++) { 1162 handler++) {
@@ -1181,18 +1181,18 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1181 return 0; 1181 return 0;
1182 } 1182 }
1183 1183
1184 if (tx.u.tx.extra_frag) { 1184 if (tx.extra_frag) {
1185 for (i = 0; i < tx.u.tx.num_extra_frag; i++) { 1185 for (i = 0; i < tx.num_extra_frag; i++) {
1186 int next_len, dur; 1186 int next_len, dur;
1187 struct ieee80211_hdr *hdr = 1187 struct ieee80211_hdr *hdr =
1188 (struct ieee80211_hdr *) 1188 (struct ieee80211_hdr *)
1189 tx.u.tx.extra_frag[i]->data; 1189 tx.extra_frag[i]->data;
1190 1190
1191 if (i + 1 < tx.u.tx.num_extra_frag) { 1191 if (i + 1 < tx.num_extra_frag) {
1192 next_len = tx.u.tx.extra_frag[i + 1]->len; 1192 next_len = tx.extra_frag[i + 1]->len;
1193 } else { 1193 } else {
1194 next_len = 0; 1194 next_len = 0;
1195 tx.u.tx.rate = tx.u.tx.last_frag_rate; 1195 tx.rate = tx.last_frag_rate;
1196 } 1196 }
1197 dur = ieee80211_duration(&tx, 0, next_len); 1197 dur = ieee80211_duration(&tx, 0, next_len);
1198 hdr->duration_id = cpu_to_le16(dur); 1198 hdr->duration_id = cpu_to_le16(dur);
@@ -1227,11 +1227,11 @@ retry:
1227 memcpy(&store->control, control, 1227 memcpy(&store->control, control,
1228 sizeof(struct ieee80211_tx_control)); 1228 sizeof(struct ieee80211_tx_control));
1229 store->skb = skb; 1229 store->skb = skb;
1230 store->extra_frag = tx.u.tx.extra_frag; 1230 store->extra_frag = tx.extra_frag;
1231 store->num_extra_frag = tx.u.tx.num_extra_frag; 1231 store->num_extra_frag = tx.num_extra_frag;
1232 store->last_frag_rate = tx.u.tx.last_frag_rate; 1232 store->last_frag_rate = tx.last_frag_rate;
1233 store->last_frag_rate_ctrl_probe = 1233 store->last_frag_rate_ctrl_probe =
1234 !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG); 1234 !!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG);
1235 } 1235 }
1236 rcu_read_unlock(); 1236 rcu_read_unlock();
1237 return 0; 1237 return 0;
@@ -1239,10 +1239,10 @@ retry:
1239 drop: 1239 drop:
1240 if (skb) 1240 if (skb)
1241 dev_kfree_skb(skb); 1241 dev_kfree_skb(skb);
1242 for (i = 0; i < tx.u.tx.num_extra_frag; i++) 1242 for (i = 0; i < tx.num_extra_frag; i++)
1243 if (tx.u.tx.extra_frag[i]) 1243 if (tx.extra_frag[i])
1244 dev_kfree_skb(tx.u.tx.extra_frag[i]); 1244 dev_kfree_skb(tx.extra_frag[i]);
1245 kfree(tx.u.tx.extra_frag); 1245 kfree(tx.extra_frag);
1246 rcu_read_unlock(); 1246 rcu_read_unlock();
1247 return 0; 1247 return 0;
1248} 1248}
@@ -1670,7 +1670,7 @@ void ieee80211_tx_pending(unsigned long data)
1670 struct ieee80211_local *local = (struct ieee80211_local *)data; 1670 struct ieee80211_local *local = (struct ieee80211_local *)data;
1671 struct net_device *dev = local->mdev; 1671 struct net_device *dev = local->mdev;
1672 struct ieee80211_tx_stored_packet *store; 1672 struct ieee80211_tx_stored_packet *store;
1673 struct ieee80211_txrx_data tx; 1673 struct ieee80211_tx_data tx;
1674 int i, ret, reschedule = 0; 1674 int i, ret, reschedule = 0;
1675 1675
1676 netif_tx_lock_bh(dev); 1676 netif_tx_lock_bh(dev);
@@ -1682,13 +1682,13 @@ void ieee80211_tx_pending(unsigned long data)
1682 continue; 1682 continue;
1683 } 1683 }
1684 store = &local->pending_packet[i]; 1684 store = &local->pending_packet[i];
1685 tx.u.tx.control = &store->control; 1685 tx.control = &store->control;
1686 tx.u.tx.extra_frag = store->extra_frag; 1686 tx.extra_frag = store->extra_frag;
1687 tx.u.tx.num_extra_frag = store->num_extra_frag; 1687 tx.num_extra_frag = store->num_extra_frag;
1688 tx.u.tx.last_frag_rate = store->last_frag_rate; 1688 tx.last_frag_rate = store->last_frag_rate;
1689 tx.flags = 0; 1689 tx.flags = 0;
1690 if (store->last_frag_rate_ctrl_probe) 1690 if (store->last_frag_rate_ctrl_probe)
1691 tx.flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 1691 tx.flags |= IEEE80211_TX_PROBE_LAST_FRAG;
1692 ret = __ieee80211_tx(local, store->skb, &tx); 1692 ret = __ieee80211_tx(local, store->skb, &tx);
1693 if (ret) { 1693 if (ret) {
1694 if (ret == IEEE80211_TX_FRAG_AGAIN) 1694 if (ret == IEEE80211_TX_FRAG_AGAIN)
@@ -1943,7 +1943,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1943 struct sk_buff *skb; 1943 struct sk_buff *skb;
1944 struct sta_info *sta; 1944 struct sta_info *sta;
1945 ieee80211_tx_handler *handler; 1945 ieee80211_tx_handler *handler;
1946 struct ieee80211_txrx_data tx; 1946 struct ieee80211_tx_data tx;
1947 ieee80211_tx_result res = TX_DROP; 1947 ieee80211_tx_result res = TX_DROP;
1948 struct net_device *bdev; 1948 struct net_device *bdev;
1949 struct ieee80211_sub_if_data *sdata; 1949 struct ieee80211_sub_if_data *sdata;
@@ -1991,8 +1991,8 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1991 dev_kfree_skb_any(skb); 1991 dev_kfree_skb_any(skb);
1992 } 1992 }
1993 sta = tx.sta; 1993 sta = tx.sta;
1994 tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; 1994 tx.flags |= IEEE80211_TX_PS_BUFFERED;
1995 tx.u.tx.channel = local->hw.conf.channel; 1995 tx.channel = local->hw.conf.channel;
1996 1996
1997 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { 1997 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
1998 res = (*handler)(&tx); 1998 res = (*handler)(&tx);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index b46496fa2e10..57c404f3f6d0 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -165,17 +165,17 @@ int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
165 } 165 }
166} 166}
167 167
168void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx) 168void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx)
169{ 169{
170 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 170 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
171 171
172 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); 172 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
173 if (tx->u.tx.extra_frag) { 173 if (tx->extra_frag) {
174 struct ieee80211_hdr *fhdr; 174 struct ieee80211_hdr *fhdr;
175 int i; 175 int i;
176 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 176 for (i = 0; i < tx->num_extra_frag; i++) {
177 fhdr = (struct ieee80211_hdr *) 177 fhdr = (struct ieee80211_hdr *)
178 tx->u.tx.extra_frag[i]->data; 178 tx->extra_frag[i]->data;
179 fhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); 179 fhdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
180 } 180 }
181 } 181 }
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index a33ef5cfa9ad..affcecd78c10 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -306,14 +306,14 @@ u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key)
306} 306}
307 307
308ieee80211_rx_result 308ieee80211_rx_result
309ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx) 309ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
310{ 310{
311 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && 311 if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA &&
312 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || 312 ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT ||
313 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) 313 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH))
314 return RX_CONTINUE; 314 return RX_CONTINUE;
315 315
316 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { 316 if (!(rx->status->flag & RX_FLAG_DECRYPTED)) {
317 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) { 317 if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) {
318#ifdef CONFIG_MAC80211_DEBUG 318#ifdef CONFIG_MAC80211_DEBUG
319 if (net_ratelimit()) 319 if (net_ratelimit())
@@ -322,7 +322,7 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
322#endif /* CONFIG_MAC80211_DEBUG */ 322#endif /* CONFIG_MAC80211_DEBUG */
323 return RX_DROP_UNUSABLE; 323 return RX_DROP_UNUSABLE;
324 } 324 }
325 } else if (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) { 325 } else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) {
326 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); 326 ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
327 /* remove ICV */ 327 /* remove ICV */
328 skb_trim(rx->skb, rx->skb->len - 4); 328 skb_trim(rx->skb, rx->skb->len - 4);
@@ -331,13 +331,13 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx)
331 return RX_CONTINUE; 331 return RX_CONTINUE;
332} 332}
333 333
334static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb) 334static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
335{ 335{
336 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { 336 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
337 if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) 337 if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
338 return -1; 338 return -1;
339 } else { 339 } else {
340 tx->u.tx.control->key_idx = tx->key->conf.hw_key_idx; 340 tx->control->key_idx = tx->key->conf.hw_key_idx;
341 if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) { 341 if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
342 if (!ieee80211_wep_add_iv(tx->local, skb, tx->key)) 342 if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
343 return -1; 343 return -1;
@@ -347,21 +347,21 @@ static int wep_encrypt_skb(struct ieee80211_txrx_data *tx, struct sk_buff *skb)
347} 347}
348 348
349ieee80211_tx_result 349ieee80211_tx_result
350ieee80211_crypto_wep_encrypt(struct ieee80211_txrx_data *tx) 350ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx)
351{ 351{
352 tx->u.tx.control->iv_len = WEP_IV_LEN; 352 tx->control->iv_len = WEP_IV_LEN;
353 tx->u.tx.control->icv_len = WEP_ICV_LEN; 353 tx->control->icv_len = WEP_ICV_LEN;
354 ieee80211_tx_set_iswep(tx); 354 ieee80211_tx_set_protected(tx);
355 355
356 if (wep_encrypt_skb(tx, tx->skb) < 0) { 356 if (wep_encrypt_skb(tx, tx->skb) < 0) {
357 I802_DEBUG_INC(tx->local->tx_handlers_drop_wep); 357 I802_DEBUG_INC(tx->local->tx_handlers_drop_wep);
358 return TX_DROP; 358 return TX_DROP;
359 } 359 }
360 360
361 if (tx->u.tx.extra_frag) { 361 if (tx->extra_frag) {
362 int i; 362 int i;
363 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 363 for (i = 0; i < tx->num_extra_frag; i++) {
364 if (wep_encrypt_skb(tx, tx->u.tx.extra_frag[i]) < 0) { 364 if (wep_encrypt_skb(tx, tx->extra_frag[i]) < 0) {
365 I802_DEBUG_INC(tx->local-> 365 I802_DEBUG_INC(tx->local->
366 tx_handlers_drop_wep); 366 tx_handlers_drop_wep);
367 return TX_DROP; 367 return TX_DROP;
diff --git a/net/mac80211/wep.h b/net/mac80211/wep.h
index 43aef50cd0d6..9f723938b63f 100644
--- a/net/mac80211/wep.h
+++ b/net/mac80211/wep.h
@@ -29,8 +29,8 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
29u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key); 29u8 * ieee80211_wep_is_weak_iv(struct sk_buff *skb, struct ieee80211_key *key);
30 30
31ieee80211_rx_result 31ieee80211_rx_result
32ieee80211_crypto_wep_decrypt(struct ieee80211_txrx_data *rx); 32ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx);
33ieee80211_tx_result 33ieee80211_tx_result
34ieee80211_crypto_wep_encrypt(struct ieee80211_txrx_data *tx); 34ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx);
35 35
36#endif /* WEP_H */ 36#endif /* WEP_H */
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index b35e51c6ce0c..df0b7341efc8 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -71,7 +71,7 @@ static int ieee80211_get_hdr_info(const struct sk_buff *skb, u8 **sa, u8 **da,
71 71
72 72
73ieee80211_tx_result 73ieee80211_tx_result
74ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx) 74ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx)
75{ 75{
76 u8 *data, *sa, *da, *key, *mic, qos_tid; 76 u8 *data, *sa, *da, *key, *mic, qos_tid;
77 size_t data_len; 77 size_t data_len;
@@ -90,7 +90,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx)
90 return TX_DROP; 90 return TX_DROP;
91 91
92 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 92 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
93 !(tx->flags & IEEE80211_TXRXD_FRAGMENTED) && 93 !(tx->flags & IEEE80211_TX_FRAGMENTED) &&
94 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) && 94 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) &&
95 !wpa_test) { 95 !wpa_test) {
96 /* hwaccel - with no need for preallocated room for Michael MIC 96 /* hwaccel - with no need for preallocated room for Michael MIC
@@ -124,7 +124,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx)
124 124
125 125
126ieee80211_rx_result 126ieee80211_rx_result
127ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx) 127ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
128{ 128{
129 u8 *data, *sa, *da, *key = NULL, qos_tid; 129 u8 *data, *sa, *da, *key = NULL, qos_tid;
130 size_t data_len; 130 size_t data_len;
@@ -139,7 +139,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
139 /* 139 /*
140 * No way to verify the MIC if the hardware stripped it 140 * No way to verify the MIC if the hardware stripped it
141 */ 141 */
142 if (rx->u.rx.status->flag & RX_FLAG_MMIC_STRIPPED) 142 if (rx->status->flag & RX_FLAG_MMIC_STRIPPED)
143 return RX_CONTINUE; 143 return RX_CONTINUE;
144 144
145 if (!rx->key || rx->key->conf.alg != ALG_TKIP || 145 if (!rx->key || rx->key->conf.alg != ALG_TKIP ||
@@ -161,7 +161,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
161 ALG_TKIP_TEMP_AUTH_TX_MIC_KEY]; 161 ALG_TKIP_TEMP_AUTH_TX_MIC_KEY];
162 michael_mic(key, da, sa, qos_tid & 0x0f, data, data_len, mic); 162 michael_mic(key, da, sa, qos_tid & 0x0f, data, data_len, mic);
163 if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) { 163 if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) {
164 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 164 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
165 return RX_DROP_UNUSABLE; 165 return RX_DROP_UNUSABLE;
166 166
167 printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from " 167 printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from "
@@ -176,14 +176,14 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
176 skb_trim(skb, skb->len - MICHAEL_MIC_LEN); 176 skb_trim(skb, skb->len - MICHAEL_MIC_LEN);
177 177
178 /* update IV in key information to be able to detect replays */ 178 /* update IV in key information to be able to detect replays */
179 rx->key->u.tkip.iv32_rx[rx->u.rx.queue] = rx->u.rx.tkip_iv32; 179 rx->key->u.tkip.iv32_rx[rx->queue] = rx->tkip_iv32;
180 rx->key->u.tkip.iv16_rx[rx->u.rx.queue] = rx->u.rx.tkip_iv16; 180 rx->key->u.tkip.iv16_rx[rx->queue] = rx->tkip_iv16;
181 181
182 return RX_CONTINUE; 182 return RX_CONTINUE;
183} 183}
184 184
185 185
186static int tkip_encrypt_skb(struct ieee80211_txrx_data *tx, 186static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
187 struct sk_buff *skb, int test) 187 struct sk_buff *skb, int test)
188{ 188{
189 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 189 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -228,7 +228,7 @@ static int tkip_encrypt_skb(struct ieee80211_txrx_data *tx,
228 0x7f), 228 0x7f),
229 (u8) key->u.tkip.iv16); 229 (u8) key->u.tkip.iv16);
230 230
231 tx->u.tx.control->key_idx = tx->key->conf.hw_key_idx; 231 tx->control->key_idx = tx->key->conf.hw_key_idx;
232 return 0; 232 return 0;
233 } 233 }
234 234
@@ -243,30 +243,30 @@ static int tkip_encrypt_skb(struct ieee80211_txrx_data *tx,
243 243
244 244
245ieee80211_tx_result 245ieee80211_tx_result
246ieee80211_crypto_tkip_encrypt(struct ieee80211_txrx_data *tx) 246ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
247{ 247{
248 struct sk_buff *skb = tx->skb; 248 struct sk_buff *skb = tx->skb;
249 int wpa_test = 0, test = 0; 249 int wpa_test = 0, test = 0;
250 250
251 tx->u.tx.control->icv_len = TKIP_ICV_LEN; 251 tx->control->icv_len = TKIP_ICV_LEN;
252 tx->u.tx.control->iv_len = TKIP_IV_LEN; 252 tx->control->iv_len = TKIP_IV_LEN;
253 ieee80211_tx_set_iswep(tx); 253 ieee80211_tx_set_protected(tx);
254 254
255 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 255 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
256 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) && 256 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
257 !wpa_test) { 257 !wpa_test) {
258 /* hwaccel - with no need for preallocated room for IV/ICV */ 258 /* hwaccel - with no need for preallocated room for IV/ICV */
259 tx->u.tx.control->key_idx = tx->key->conf.hw_key_idx; 259 tx->control->key_idx = tx->key->conf.hw_key_idx;
260 return TX_CONTINUE; 260 return TX_CONTINUE;
261 } 261 }
262 262
263 if (tkip_encrypt_skb(tx, skb, test) < 0) 263 if (tkip_encrypt_skb(tx, skb, test) < 0)
264 return TX_DROP; 264 return TX_DROP;
265 265
266 if (tx->u.tx.extra_frag) { 266 if (tx->extra_frag) {
267 int i; 267 int i;
268 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 268 for (i = 0; i < tx->num_extra_frag; i++) {
269 if (tkip_encrypt_skb(tx, tx->u.tx.extra_frag[i], test) 269 if (tkip_encrypt_skb(tx, tx->extra_frag[i], test)
270 < 0) 270 < 0)
271 return TX_DROP; 271 return TX_DROP;
272 } 272 }
@@ -277,7 +277,7 @@ ieee80211_crypto_tkip_encrypt(struct ieee80211_txrx_data *tx)
277 277
278 278
279ieee80211_rx_result 279ieee80211_rx_result
280ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx) 280ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
281{ 281{
282 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 282 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
283 u16 fc; 283 u16 fc;
@@ -295,8 +295,8 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx)
295 if (!rx->sta || skb->len - hdrlen < 12) 295 if (!rx->sta || skb->len - hdrlen < 12)
296 return RX_DROP_UNUSABLE; 296 return RX_DROP_UNUSABLE;
297 297
298 if (rx->u.rx.status->flag & RX_FLAG_DECRYPTED) { 298 if (rx->status->flag & RX_FLAG_DECRYPTED) {
299 if (rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) { 299 if (rx->status->flag & RX_FLAG_IV_STRIPPED) {
300 /* 300 /*
301 * Hardware took care of all processing, including 301 * Hardware took care of all processing, including
302 * replay protection, and stripped the ICV/IV so 302 * replay protection, and stripped the ICV/IV so
@@ -312,9 +312,9 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx)
312 res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm, 312 res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm,
313 key, skb->data + hdrlen, 313 key, skb->data + hdrlen,
314 skb->len - hdrlen, rx->sta->addr, 314 skb->len - hdrlen, rx->sta->addr,
315 hwaccel, rx->u.rx.queue, 315 hwaccel, rx->queue,
316 &rx->u.rx.tkip_iv32, 316 &rx->tkip_iv32,
317 &rx->u.rx.tkip_iv16); 317 &rx->tkip_iv16);
318 if (res != TKIP_DECRYPT_OK || wpa_test) { 318 if (res != TKIP_DECRYPT_OK || wpa_test) {
319#ifdef CONFIG_MAC80211_DEBUG 319#ifdef CONFIG_MAC80211_DEBUG
320 if (net_ratelimit()) 320 if (net_ratelimit())
@@ -429,7 +429,7 @@ static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
429} 429}
430 430
431 431
432static int ccmp_encrypt_skb(struct ieee80211_txrx_data *tx, 432static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
433 struct sk_buff *skb, int test) 433 struct sk_buff *skb, int test)
434{ 434{
435 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 435 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -478,7 +478,7 @@ static int ccmp_encrypt_skb(struct ieee80211_txrx_data *tx,
478 478
479 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { 479 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
480 /* hwaccel - with preallocated room for CCMP header */ 480 /* hwaccel - with preallocated room for CCMP header */
481 tx->u.tx.control->key_idx = key->conf.hw_key_idx; 481 tx->control->key_idx = key->conf.hw_key_idx;
482 return 0; 482 return 0;
483 } 483 }
484 484
@@ -492,30 +492,30 @@ static int ccmp_encrypt_skb(struct ieee80211_txrx_data *tx,
492 492
493 493
494ieee80211_tx_result 494ieee80211_tx_result
495ieee80211_crypto_ccmp_encrypt(struct ieee80211_txrx_data *tx) 495ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
496{ 496{
497 struct sk_buff *skb = tx->skb; 497 struct sk_buff *skb = tx->skb;
498 int test = 0; 498 int test = 0;
499 499
500 tx->u.tx.control->icv_len = CCMP_MIC_LEN; 500 tx->control->icv_len = CCMP_MIC_LEN;
501 tx->u.tx.control->iv_len = CCMP_HDR_LEN; 501 tx->control->iv_len = CCMP_HDR_LEN;
502 ieee80211_tx_set_iswep(tx); 502 ieee80211_tx_set_protected(tx);
503 503
504 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 504 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
505 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { 505 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
506 /* hwaccel - with no need for preallocated room for CCMP " 506 /* hwaccel - with no need for preallocated room for CCMP "
507 * header or MIC fields */ 507 * header or MIC fields */
508 tx->u.tx.control->key_idx = tx->key->conf.hw_key_idx; 508 tx->control->key_idx = tx->key->conf.hw_key_idx;
509 return TX_CONTINUE; 509 return TX_CONTINUE;
510 } 510 }
511 511
512 if (ccmp_encrypt_skb(tx, skb, test) < 0) 512 if (ccmp_encrypt_skb(tx, skb, test) < 0)
513 return TX_DROP; 513 return TX_DROP;
514 514
515 if (tx->u.tx.extra_frag) { 515 if (tx->extra_frag) {
516 int i; 516 int i;
517 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 517 for (i = 0; i < tx->num_extra_frag; i++) {
518 if (ccmp_encrypt_skb(tx, tx->u.tx.extra_frag[i], test) 518 if (ccmp_encrypt_skb(tx, tx->extra_frag[i], test)
519 < 0) 519 < 0)
520 return TX_DROP; 520 return TX_DROP;
521 } 521 }
@@ -526,7 +526,7 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_txrx_data *tx)
526 526
527 527
528ieee80211_rx_result 528ieee80211_rx_result
529ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx) 529ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
530{ 530{
531 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 531 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
532 u16 fc; 532 u16 fc;
@@ -547,15 +547,15 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx)
547 if (!rx->sta || data_len < 0) 547 if (!rx->sta || data_len < 0)
548 return RX_DROP_UNUSABLE; 548 return RX_DROP_UNUSABLE;
549 549
550 if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && 550 if ((rx->status->flag & RX_FLAG_DECRYPTED) &&
551 (rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) 551 (rx->status->flag & RX_FLAG_IV_STRIPPED))
552 return RX_CONTINUE; 552 return RX_CONTINUE;
553 553
554 (void) ccmp_hdr2pn(pn, skb->data + hdrlen); 554 (void) ccmp_hdr2pn(pn, skb->data + hdrlen);
555 555
556 if (memcmp(pn, key->u.ccmp.rx_pn[rx->u.rx.queue], CCMP_PN_LEN) <= 0) { 556 if (memcmp(pn, key->u.ccmp.rx_pn[rx->queue], CCMP_PN_LEN) <= 0) {
557#ifdef CONFIG_MAC80211_DEBUG 557#ifdef CONFIG_MAC80211_DEBUG
558 u8 *ppn = key->u.ccmp.rx_pn[rx->u.rx.queue]; 558 u8 *ppn = key->u.ccmp.rx_pn[rx->queue];
559 559
560 printk(KERN_DEBUG "%s: CCMP replay detected for RX frame from " 560 printk(KERN_DEBUG "%s: CCMP replay detected for RX frame from "
561 "%s (RX PN %02x%02x%02x%02x%02x%02x <= prev. PN " 561 "%s (RX PN %02x%02x%02x%02x%02x%02x <= prev. PN "
@@ -568,7 +568,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx)
568 return RX_DROP_UNUSABLE; 568 return RX_DROP_UNUSABLE;
569 } 569 }
570 570
571 if (!(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) { 571 if (!(rx->status->flag & RX_FLAG_DECRYPTED)) {
572 /* hardware didn't decrypt/verify MIC */ 572 /* hardware didn't decrypt/verify MIC */
573 u8 *scratch, *b_0, *aad; 573 u8 *scratch, *b_0, *aad;
574 574
@@ -593,7 +593,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx)
593 } 593 }
594 } 594 }
595 595
596 memcpy(key->u.ccmp.rx_pn[rx->u.rx.queue], pn, CCMP_PN_LEN); 596 memcpy(key->u.ccmp.rx_pn[rx->queue], pn, CCMP_PN_LEN);
597 597
598 /* Remove CCMP header and MIC */ 598 /* Remove CCMP header and MIC */
599 skb_trim(skb, skb->len - CCMP_MIC_LEN); 599 skb_trim(skb, skb->len - CCMP_MIC_LEN);
diff --git a/net/mac80211/wpa.h b/net/mac80211/wpa.h
index 16e4dba4aa70..d42d221d8a1d 100644
--- a/net/mac80211/wpa.h
+++ b/net/mac80211/wpa.h
@@ -14,18 +14,18 @@
14#include "ieee80211_i.h" 14#include "ieee80211_i.h"
15 15
16ieee80211_tx_result 16ieee80211_tx_result
17ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx); 17ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx);
18ieee80211_rx_result 18ieee80211_rx_result
19ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx); 19ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx);
20 20
21ieee80211_tx_result 21ieee80211_tx_result
22ieee80211_crypto_tkip_encrypt(struct ieee80211_txrx_data *tx); 22ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx);
23ieee80211_rx_result 23ieee80211_rx_result
24ieee80211_crypto_tkip_decrypt(struct ieee80211_txrx_data *rx); 24ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx);
25 25
26ieee80211_tx_result 26ieee80211_tx_result
27ieee80211_crypto_ccmp_encrypt(struct ieee80211_txrx_data *tx); 27ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
28ieee80211_rx_result 28ieee80211_rx_result
29ieee80211_crypto_ccmp_decrypt(struct ieee80211_txrx_data *rx); 29ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
30 30
31#endif /* WPA_H */ 31#endif /* WPA_H */