aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-08-28 17:01:54 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:49 -0400
commitbadffb725c86cc2d46f7cb3f520f58f1c863b56c (patch)
tree41a49288c79274a76e515ff6c4674a370bb6943d /net
parente8bf96495cd67090b4900ddaf8e8672a17ec39fa (diff)
[MAC80211]: Remove bitfields from struct ieee80211_txrx_data
mac80211, remove bitfields from struct ieee80211_txrx_data Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Michael Wu <flamingice@sourmilk.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/ieee80211_i.h20
-rw-r--r--net/mac80211/rx.c52
-rw-r--r--net/mac80211/tx.c61
-rw-r--r--net/mac80211/wpa.c6
4 files changed, 78 insertions, 61 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a2b018bae180..9888611660b7 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -113,6 +113,15 @@ typedef enum {
113 TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED 113 TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
114} ieee80211_txrx_result; 114} ieee80211_txrx_result;
115 115
116/* flags used in struct ieee80211_txrx_data.flags */
117/* whether the MSDU was fragmented */
118#define IEEE80211_TXRXD_FRAGMENTED BIT(0)
119#define IEEE80211_TXRXD_TXUNICAST BIT(1)
120#define IEEE80211_TXRXD_TXPS_BUFFERED BIT(2)
121#define IEEE80211_TXRXD_TXPROBE_LAST_FRAG BIT(3)
122#define IEEE80211_TXRXD_RXIN_SCAN BIT(4)
123/* frame is destined to interface currently processed (incl. multicast frames) */
124#define IEEE80211_TXRXD_RXRA_MATCH BIT(5)
116struct ieee80211_txrx_data { 125struct ieee80211_txrx_data {
117 struct sk_buff *skb; 126 struct sk_buff *skb;
118 struct net_device *dev; 127 struct net_device *dev;
@@ -121,13 +130,10 @@ struct ieee80211_txrx_data {
121 struct sta_info *sta; 130 struct sta_info *sta;
122 u16 fc, ethertype; 131 u16 fc, ethertype;
123 struct ieee80211_key *key; 132 struct ieee80211_key *key;
124 unsigned int fragmented:1; /* whether the MSDU was fragmented */ 133 unsigned int flags;
125 union { 134 union {
126 struct { 135 struct {
127 struct ieee80211_tx_control *control; 136 struct ieee80211_tx_control *control;
128 unsigned int unicast:1;
129 unsigned int ps_buffered:1;
130 unsigned int probe_last_frag:1;
131 struct ieee80211_hw_mode *mode; 137 struct ieee80211_hw_mode *mode;
132 struct ieee80211_rate *rate; 138 struct ieee80211_rate *rate;
133 /* use this rate (if set) for last fragment; rate can 139 /* use this rate (if set) for last fragment; rate can
@@ -147,10 +153,6 @@ struct ieee80211_txrx_data {
147 int sent_ps_buffered; 153 int sent_ps_buffered;
148 int queue; 154 int queue;
149 int load; 155 int load;
150 unsigned int in_scan:1;
151 /* frame is destined to interface currently processed
152 * (including multicast frames) */
153 unsigned int ra_match:1;
154 } rx; 156 } rx;
155 } u; 157 } u;
156}; 158};
@@ -176,7 +178,7 @@ struct ieee80211_tx_stored_packet {
176 int last_frag_rateidx; 178 int last_frag_rateidx;
177 int last_frag_hwrate; 179 int last_frag_hwrate;
178 struct ieee80211_rate *last_frag_rate; 180 struct ieee80211_rate *last_frag_rate;
179 unsigned int last_frag_rate_ctrl_probe:1; 181 unsigned int last_frag_rate_ctrl_probe;
180}; 182};
181 183
182typedef ieee80211_txrx_result (*ieee80211_tx_handler) 184typedef ieee80211_txrx_result (*ieee80211_tx_handler)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 441383ced931..af94fb597415 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -221,7 +221,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_txrx_data *rx)
221 return TXRX_QUEUED; 221 return TXRX_QUEUED;
222 } 222 }
223 223
224 if (unlikely(rx->u.rx.in_scan)) { 224 if (unlikely(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) {
225 /* scanning finished during invoking of handlers */ 225 /* scanning finished during invoking of handlers */
226 I802_DEBUG_INC(local->rx_handlers_drop_passive_scan); 226 I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
227 return TXRX_DROP; 227 return TXRX_DROP;
@@ -241,7 +241,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
241 if (unlikely(rx->fc & IEEE80211_FCTL_RETRY && 241 if (unlikely(rx->fc & IEEE80211_FCTL_RETRY &&
242 rx->sta->last_seq_ctrl[rx->u.rx.queue] == 242 rx->sta->last_seq_ctrl[rx->u.rx.queue] ==
243 hdr->seq_ctrl)) { 243 hdr->seq_ctrl)) {
244 if (rx->u.rx.ra_match) { 244 if (rx->flags & IEEE80211_TXRXD_RXRA_MATCH) {
245 rx->local->dot11FrameDuplicateCount++; 245 rx->local->dot11FrameDuplicateCount++;
246 rx->sta->num_duplicates++; 246 rx->sta->num_duplicates++;
247 } 247 }
@@ -259,7 +259,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
259 return TXRX_DROP; 259 return TXRX_DROP;
260 } 260 }
261 261
262 if (!rx->u.rx.ra_match) 262 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
263 rx->skb->pkt_type = PACKET_OTHERHOST; 263 rx->skb->pkt_type = PACKET_OTHERHOST;
264 else if (compare_ether_addr(rx->dev->dev_addr, hdr->addr1) == 0) 264 else if (compare_ether_addr(rx->dev->dev_addr, hdr->addr1) == 0)
265 rx->skb->pkt_type = PACKET_HOST; 265 rx->skb->pkt_type = PACKET_HOST;
@@ -287,7 +287,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
287 if ((!(rx->fc & IEEE80211_FCTL_FROMDS) && 287 if ((!(rx->fc & IEEE80211_FCTL_FROMDS) &&
288 !(rx->fc & IEEE80211_FCTL_TODS) && 288 !(rx->fc & IEEE80211_FCTL_TODS) &&
289 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) 289 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)
290 || !rx->u.rx.ra_match) { 290 || !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
291 /* Drop IBSS frames and frames for other hosts 291 /* Drop IBSS frames and frames for other hosts
292 * silently. */ 292 * silently. */
293 return TXRX_DROP; 293 return TXRX_DROP;
@@ -338,7 +338,7 @@ ieee80211_rx_h_load_key(struct ieee80211_txrx_data *rx)
338 * No point in finding a key if the frame is neither 338 * No point in finding a key if the frame is neither
339 * addressed to us nor a multicast frame. 339 * addressed to us nor a multicast frame.
340 */ 340 */
341 if (!rx->u.rx.ra_match) 341 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
342 return TXRX_CONTINUE; 342 return TXRX_CONTINUE;
343 343
344 if (!is_multicast_ether_addr(hdr->addr1) && rx->sta && rx->sta->key) { 344 if (!is_multicast_ether_addr(hdr->addr1) && rx->sta && rx->sta->key) {
@@ -480,7 +480,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx)
480 sta->last_rx = jiffies; 480 sta->last_rx = jiffies;
481 } 481 }
482 482
483 if (!rx->u.rx.ra_match) 483 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
484 return TXRX_CONTINUE; 484 return TXRX_CONTINUE;
485 485
486 sta->rx_fragments++; 486 sta->rx_fragments++;
@@ -522,7 +522,8 @@ ieee80211_rx_h_wep_weak_iv_detection(struct ieee80211_txrx_data *rx)
522{ 522{
523 if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) || 523 if (!rx->sta || !(rx->fc & IEEE80211_FCTL_PROTECTED) ||
524 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || 524 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
525 !rx->key || rx->key->alg != ALG_WEP || !rx->u.rx.ra_match) 525 !rx->key || rx->key->alg != ALG_WEP ||
526 !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
526 return TXRX_CONTINUE; 527 return TXRX_CONTINUE;
527 528
528 /* Check for weak IVs, if hwaccel did not remove IV from the frame */ 529 /* Check for weak IVs, if hwaccel did not remove IV from the frame */
@@ -755,7 +756,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
755 } 756 }
756 757
757 /* Complete frame has been reassembled - process it now */ 758 /* Complete frame has been reassembled - process it now */
758 rx->fragmented = 1; 759 rx->flags |= IEEE80211_TXRXD_FRAGMENTED;
759 760
760 out: 761 out:
761 if (rx->sta) 762 if (rx->sta)
@@ -776,7 +777,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
776 if (likely(!rx->sta || 777 if (likely(!rx->sta ||
777 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL || 778 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL ||
778 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL || 779 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL ||
779 !rx->u.rx.ra_match)) 780 !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)))
780 return TXRX_CONTINUE; 781 return TXRX_CONTINUE;
781 782
782 skb = skb_dequeue(&rx->sta->tx_filtered); 783 skb = skb_dequeue(&rx->sta->tx_filtered);
@@ -860,7 +861,8 @@ static ieee80211_txrx_result
860ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx) 861ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx)
861{ 862{
862 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) && 863 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) &&
863 rx->sdata->type != IEEE80211_IF_TYPE_STA && rx->u.rx.ra_match) { 864 rx->sdata->type != IEEE80211_IF_TYPE_STA &&
865 (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
864 /* Pass both encrypted and unencrypted EAPOL frames to user 866 /* Pass both encrypted and unencrypted EAPOL frames to user
865 * space for processing. */ 867 * space for processing. */
866 if (!rx->local->apdev) 868 if (!rx->local->apdev)
@@ -1053,7 +1055,8 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
1053 sdata->stats.rx_bytes += skb->len; 1055 sdata->stats.rx_bytes += skb->len;
1054 1056
1055 if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP 1057 if (local->bridge_packets && (sdata->type == IEEE80211_IF_TYPE_AP
1056 || sdata->type == IEEE80211_IF_TYPE_VLAN) && rx->u.rx.ra_match) { 1058 || sdata->type == IEEE80211_IF_TYPE_VLAN) &&
1059 (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) {
1057 if (is_multicast_ether_addr(skb->data)) { 1060 if (is_multicast_ether_addr(skb->data)) {
1058 /* send multicast frames both to higher layers in 1061 /* send multicast frames both to higher layers in
1059 * local net stack and back to the wireless media */ 1062 * local net stack and back to the wireless media */
@@ -1104,7 +1107,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1104{ 1107{
1105 struct ieee80211_sub_if_data *sdata; 1108 struct ieee80211_sub_if_data *sdata;
1106 1109
1107 if (!rx->u.rx.ra_match) 1110 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
1108 return TXRX_DROP; 1111 return TXRX_DROP;
1109 1112
1110 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 1113 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
@@ -1279,30 +1282,30 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1279 if (!bssid) 1282 if (!bssid)
1280 return 0; 1283 return 0;
1281 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1284 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
1282 if (!rx->u.rx.in_scan) 1285 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
1283 return 0; 1286 return 0;
1284 rx->u.rx.ra_match = 0; 1287 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
1285 } else if (!multicast && 1288 } else if (!multicast &&
1286 compare_ether_addr(sdata->dev->dev_addr, 1289 compare_ether_addr(sdata->dev->dev_addr,
1287 hdr->addr1) != 0) { 1290 hdr->addr1) != 0) {
1288 if (!sdata->promisc) 1291 if (!sdata->promisc)
1289 return 0; 1292 return 0;
1290 rx->u.rx.ra_match = 0; 1293 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
1291 } 1294 }
1292 break; 1295 break;
1293 case IEEE80211_IF_TYPE_IBSS: 1296 case IEEE80211_IF_TYPE_IBSS:
1294 if (!bssid) 1297 if (!bssid)
1295 return 0; 1298 return 0;
1296 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1299 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
1297 if (!rx->u.rx.in_scan) 1300 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
1298 return 0; 1301 return 0;
1299 rx->u.rx.ra_match = 0; 1302 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
1300 } else if (!multicast && 1303 } else if (!multicast &&
1301 compare_ether_addr(sdata->dev->dev_addr, 1304 compare_ether_addr(sdata->dev->dev_addr,
1302 hdr->addr1) != 0) { 1305 hdr->addr1) != 0) {
1303 if (!sdata->promisc) 1306 if (!sdata->promisc)
1304 return 0; 1307 return 0;
1305 rx->u.rx.ra_match = 0; 1308 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
1306 } else if (!rx->sta) 1309 } else if (!rx->sta)
1307 rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, 1310 rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb,
1308 bssid, hdr->addr2); 1311 bssid, hdr->addr2);
@@ -1314,11 +1317,12 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1314 return 0; 1317 return 0;
1315 } else if (!ieee80211_bssid_match(bssid, 1318 } else if (!ieee80211_bssid_match(bssid,
1316 sdata->dev->dev_addr)) { 1319 sdata->dev->dev_addr)) {
1317 if (!rx->u.rx.in_scan) 1320 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
1318 return 0; 1321 return 0;
1319 rx->u.rx.ra_match = 0; 1322 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH;
1320 } 1323 }
1321 if (sdata->dev == sdata->local->mdev && !rx->u.rx.in_scan) 1324 if (sdata->dev == sdata->local->mdev &&
1325 !(rx->flags & IEEE80211_TXRXD_RXIN_SCAN))
1322 /* do not receive anything via 1326 /* do not receive anything via
1323 * master device when not scanning */ 1327 * master device when not scanning */
1324 return 0; 1328 return 0;
@@ -1384,7 +1388,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1384 } 1388 }
1385 1389
1386 if (unlikely(local->sta_scanning)) 1390 if (unlikely(local->sta_scanning))
1387 rx.u.rx.in_scan = 1; 1391 rx.flags |= IEEE80211_TXRXD_RXIN_SCAN;
1388 1392
1389 if (__ieee80211_invoke_rx_handlers(local, local->rx_pre_handlers, &rx, 1393 if (__ieee80211_invoke_rx_handlers(local, local->rx_pre_handlers, &rx,
1390 sta) != TXRX_CONTINUE) 1394 sta) != TXRX_CONTINUE)
@@ -1394,7 +1398,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1394 skb_push(skb, radiotap_len); 1398 skb_push(skb, radiotap_len);
1395 if (sta && !sta->assoc_ap && !(sta->flags & WLAN_STA_WDS) && 1399 if (sta && !sta->assoc_ap && !(sta->flags & WLAN_STA_WDS) &&
1396 !local->iff_promiscs && !is_multicast_ether_addr(hdr->addr1)) { 1400 !local->iff_promiscs && !is_multicast_ether_addr(hdr->addr1)) {
1397 rx.u.rx.ra_match = 1; 1401 rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
1398 ieee80211_invoke_rx_handlers(local, local->rx_handlers, &rx, 1402 ieee80211_invoke_rx_handlers(local, local->rx_handlers, &rx,
1399 rx.sta); 1403 rx.sta);
1400 sta_info_put(sta); 1404 sta_info_put(sta);
@@ -1405,7 +1409,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1405 1409
1406 read_lock(&local->sub_if_lock); 1410 read_lock(&local->sub_if_lock);
1407 list_for_each_entry(sdata, &local->sub_if_list, list) { 1411 list_for_each_entry(sdata, &local->sub_if_list, list) {
1408 rx.u.rx.ra_match = 1; 1412 rx.flags |= IEEE80211_TXRXD_RXRA_MATCH;
1409 1413
1410 if (!netif_running(sdata->dev)) 1414 if (!netif_running(sdata->dev))
1411 continue; 1415 continue;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index eb4d9eab0f3f..01e7a734f867 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -223,12 +223,12 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
223 (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) 223 (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ))
224 return TXRX_DROP; 224 return TXRX_DROP;
225 225
226 if (tx->u.tx.ps_buffered) 226 if (tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED)
227 return TXRX_CONTINUE; 227 return TXRX_CONTINUE;
228 228
229 sta_flags = tx->sta ? tx->sta->flags : 0; 229 sta_flags = tx->sta ? tx->sta->flags : 0;
230 230
231 if (likely(tx->u.tx.unicast)) { 231 if (likely(tx->flags & IEEE80211_TXRXD_TXUNICAST)) {
232 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && 232 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) &&
233 tx->sdata->type != IEEE80211_IF_TYPE_IBSS && 233 tx->sdata->type != IEEE80211_IF_TYPE_IBSS &&
234 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 234 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
@@ -410,10 +410,10 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
410static ieee80211_txrx_result 410static ieee80211_txrx_result
411ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx) 411ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx)
412{ 412{
413 if (unlikely(tx->u.tx.ps_buffered)) 413 if (unlikely(tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED))
414 return TXRX_CONTINUE; 414 return TXRX_CONTINUE;
415 415
416 if (tx->u.tx.unicast) 416 if (tx->flags & IEEE80211_TXRXD_TXUNICAST)
417 return ieee80211_tx_h_unicast_ps_buf(tx); 417 return ieee80211_tx_h_unicast_ps_buf(tx);
418 else 418 else
419 return ieee80211_tx_h_multicast_ps_buf(tx); 419 return ieee80211_tx_h_multicast_ps_buf(tx);
@@ -467,7 +467,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
467 u8 *pos; 467 u8 *pos;
468 int frag_threshold = tx->local->fragmentation_threshold; 468 int frag_threshold = tx->local->fragmentation_threshold;
469 469
470 if (!tx->fragmented) 470 if (!(tx->flags & IEEE80211_TXRXD_FRAGMENTED))
471 return TXRX_CONTINUE; 471 return TXRX_CONTINUE;
472 472
473 first = tx->skb; 473 first = tx->skb;
@@ -604,7 +604,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
604 &extra); 604 &extra);
605 if (unlikely(extra.probe != NULL)) { 605 if (unlikely(extra.probe != NULL)) {
606 tx->u.tx.control->flags |= IEEE80211_TXCTL_RATE_CTRL_PROBE; 606 tx->u.tx.control->flags |= IEEE80211_TXCTL_RATE_CTRL_PROBE;
607 tx->u.tx.probe_last_frag = 1; 607 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
608 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val; 608 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val;
609 tx->u.tx.rate = extra.probe; 609 tx->u.tx.rate = extra.probe;
610 } else { 610 } else {
@@ -613,11 +613,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
613 if (!tx->u.tx.rate) 613 if (!tx->u.tx.rate)
614 return TXRX_DROP; 614 return TXRX_DROP;
615 if (tx->u.tx.mode->mode == MODE_IEEE80211G && 615 if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
616 tx->sdata->use_protection && tx->fragmented && 616 tx->sdata->use_protection &&
617 extra.nonerp) { 617 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) {
618 tx->u.tx.last_frag_rate = tx->u.tx.rate; 618 tx->u.tx.last_frag_rate = tx->u.tx.rate;
619 tx->u.tx.probe_last_frag = extra.probe ? 1 : 0; 619 if (extra.probe)
620 620 tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
621 else
622 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
621 tx->u.tx.rate = extra.nonerp; 623 tx->u.tx.rate = extra.nonerp;
622 tx->u.tx.control->rate = extra.nonerp; 624 tx->u.tx.control->rate = extra.nonerp;
623 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 625 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
@@ -654,7 +656,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
654 control->retry_limit = 1; 656 control->retry_limit = 1;
655 } 657 }
656 658
657 if (tx->fragmented) { 659 if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) {
658 /* Do not use multiple retry rates when sending fragmented 660 /* Do not use multiple retry rates when sending fragmented
659 * frames. 661 * frames.
660 * TODO: The last fragment could still use multiple retry 662 * TODO: The last fragment could still use multiple retry
@@ -667,7 +669,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
667 * for the frame. */ 669 * for the frame. */
668 if (mode->mode == MODE_IEEE80211G && 670 if (mode->mode == MODE_IEEE80211G &&
669 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && 671 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) &&
670 tx->u.tx.unicast && tx->sdata->use_protection && 672 (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
673 tx->sdata->use_protection &&
671 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 674 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
672 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 675 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
673 676
@@ -685,8 +688,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
685 * for remaining fragments will be updated when they are being sent 688 * for remaining fragments will be updated when they are being sent
686 * to low-level driver in ieee80211_tx(). */ 689 * to low-level driver in ieee80211_tx(). */
687 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1), 690 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1),
688 tx->fragmented ? tx->u.tx.extra_frag[0]->len : 691 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) ?
689 0); 692 tx->u.tx.extra_frag[0]->len : 0);
690 hdr->duration_id = cpu_to_le16(dur); 693 hdr->duration_id = cpu_to_le16(dur);
691 694
692 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 695 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) ||
@@ -976,15 +979,20 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
976 } 979 }
977 980
978 tx->u.tx.control = control; 981 tx->u.tx.control = control;
979 tx->u.tx.unicast = !is_multicast_ether_addr(hdr->addr1); 982 if (is_multicast_ether_addr(hdr->addr1)) {
980 if (is_multicast_ether_addr(hdr->addr1)) 983 tx->flags &= ~IEEE80211_TXRXD_TXUNICAST;
981 control->flags |= IEEE80211_TXCTL_NO_ACK; 984 control->flags |= IEEE80211_TXCTL_NO_ACK;
982 else 985 } else {
986 tx->flags |= IEEE80211_TXRXD_TXUNICAST;
983 control->flags &= ~IEEE80211_TXCTL_NO_ACK; 987 control->flags &= ~IEEE80211_TXCTL_NO_ACK;
984 tx->fragmented = local->fragmentation_threshold < 988 }
985 IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast && 989 if (local->fragmentation_threshold < IEEE80211_MAX_FRAG_THRESHOLD &&
986 skb->len + FCS_LEN > local->fragmentation_threshold && 990 (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
987 (!local->ops->set_frag_threshold); 991 skb->len + FCS_LEN > local->fragmentation_threshold &&
992 !local->ops->set_frag_threshold)
993 tx->flags |= IEEE80211_TXRXD_FRAGMENTED;
994 else
995 tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED;
988 if (!tx->sta) 996 if (!tx->sta)
989 control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; 997 control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK;
990 else if (tx->sta->clear_dst_mask) { 998 else if (tx->sta->clear_dst_mask) {
@@ -1055,7 +1063,7 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1055 if (i == tx->u.tx.num_extra_frag) { 1063 if (i == tx->u.tx.num_extra_frag) {
1056 control->tx_rate = tx->u.tx.last_frag_hwrate; 1064 control->tx_rate = tx->u.tx.last_frag_hwrate;
1057 control->rate = tx->u.tx.last_frag_rate; 1065 control->rate = tx->u.tx.last_frag_rate;
1058 if (tx->u.tx.probe_last_frag) 1066 if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG)
1059 control->flags |= 1067 control->flags |=
1060 IEEE80211_TXCTL_RATE_CTRL_PROBE; 1068 IEEE80211_TXCTL_RATE_CTRL_PROBE;
1061 else 1069 else
@@ -1186,7 +1194,8 @@ retry:
1186 store->num_extra_frag = tx.u.tx.num_extra_frag; 1194 store->num_extra_frag = tx.u.tx.num_extra_frag;
1187 store->last_frag_hwrate = tx.u.tx.last_frag_hwrate; 1195 store->last_frag_hwrate = tx.u.tx.last_frag_hwrate;
1188 store->last_frag_rate = tx.u.tx.last_frag_rate; 1196 store->last_frag_rate = tx.u.tx.last_frag_rate;
1189 store->last_frag_rate_ctrl_probe = tx.u.tx.probe_last_frag; 1197 store->last_frag_rate_ctrl_probe =
1198 !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG);
1190 } 1199 }
1191 return 0; 1200 return 0;
1192 1201
@@ -1613,7 +1622,9 @@ void ieee80211_tx_pending(unsigned long data)
1613 tx.u.tx.num_extra_frag = store->num_extra_frag; 1622 tx.u.tx.num_extra_frag = store->num_extra_frag;
1614 tx.u.tx.last_frag_hwrate = store->last_frag_hwrate; 1623 tx.u.tx.last_frag_hwrate = store->last_frag_hwrate;
1615 tx.u.tx.last_frag_rate = store->last_frag_rate; 1624 tx.u.tx.last_frag_rate = store->last_frag_rate;
1616 tx.u.tx.probe_last_frag = store->last_frag_rate_ctrl_probe; 1625 tx.flags = 0;
1626 if (store->last_frag_rate_ctrl_probe)
1627 tx.flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
1617 ret = __ieee80211_tx(local, store->skb, &tx); 1628 ret = __ieee80211_tx(local, store->skb, &tx);
1618 if (ret) { 1629 if (ret) {
1619 if (ret == IEEE80211_TX_FRAG_AGAIN) 1630 if (ret == IEEE80211_TX_FRAG_AGAIN)
@@ -1859,7 +1870,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id,
1859 dev_kfree_skb_any(skb); 1870 dev_kfree_skb_any(skb);
1860 } 1871 }
1861 sta = tx.sta; 1872 sta = tx.sta;
1862 tx.u.tx.ps_buffered = 1; 1873 tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED;
1863 1874
1864 for (handler = local->tx_handlers; *handler != NULL; handler++) { 1875 for (handler = local->tx_handlers; *handler != NULL; handler++) {
1865 res = (*handler)(&tx); 1876 res = (*handler)(&tx);
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 742b5585d1b7..1142b42b5fe9 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -90,7 +90,7 @@ ieee80211_tx_h_michael_mic_add(struct ieee80211_txrx_data *tx)
90 return TXRX_DROP; 90 return TXRX_DROP;
91 91
92 if (!tx->key->force_sw_encrypt && 92 if (!tx->key->force_sw_encrypt &&
93 !tx->fragmented && 93 !(tx->flags & IEEE80211_TXRXD_FRAGMENTED) &&
94 !(tx->local->hw.flags & IEEE80211_HW_TKIP_INCLUDE_MMIC) && 94 !(tx->local->hw.flags & IEEE80211_HW_TKIP_INCLUDE_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
@@ -154,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
154 /* Need to verify Michael MIC sometimes in software even when 154 /* Need to verify Michael MIC sometimes in software even when
155 * hwaccel is used. Atheros ar5212: fragmented frames and QoS 155 * hwaccel is used. Atheros ar5212: fragmented frames and QoS
156 * frames. */ 156 * frames. */
157 if (!rx->fragmented && !wpa_test) 157 if (!(rx->flags & IEEE80211_TXRXD_FRAGMENTED) && !wpa_test)
158 goto remove_mic; 158 goto remove_mic;
159 } 159 }
160 160
@@ -173,7 +173,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_txrx_data *rx)
173 ALG_TKIP_TEMP_AUTH_TX_MIC_KEY]; 173 ALG_TKIP_TEMP_AUTH_TX_MIC_KEY];
174 michael_mic(key, da, sa, qos_tid & 0x0f, data, data_len, mic); 174 michael_mic(key, da, sa, qos_tid & 0x0f, data, data_len, mic);
175 if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) { 175 if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0 || wpa_test) {
176 if (!rx->u.rx.ra_match) 176 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))
177 return TXRX_DROP; 177 return TXRX_DROP;
178 178
179 printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from " 179 printk(KERN_DEBUG "%s: invalid Michael MIC in data frame from "