aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-05-15 06:55:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:48:11 -0400
commite039fa4a4195ac4ee895e6f3d1334beed63256fe (patch)
treecfd0762d73df96b73052378be7b157c4ac6e7035 /net
parente24549485f859be6518929bb1c9c0257d79f033d (diff)
mac80211: move TX info into skb->cb
This patch converts mac80211 and all drivers to have transmit information and status in skb->cb rather than allocating extra memory for it and copying all the data around. To make it fit, a union is used where only data that is necessary for all steps is kept outside of the union. A number of fixes were done by Ivo, as well as the rt2x00 part of this patch. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/ieee80211_i.h18
-rw-r--r--net/mac80211/main.c128
-rw-r--r--net/mac80211/mlme.c30
-rw-r--r--net/mac80211/rate.h8
-rw-r--r--net/mac80211/rc80211_pid.h4
-rw-r--r--net/mac80211/rc80211_pid_algo.c18
-rw-r--r--net/mac80211/rc80211_pid_debugfs.c8
-rw-r--r--net/mac80211/rx.c10
-rw-r--r--net/mac80211/sta_info.c6
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/mac80211/tx.c310
-rw-r--r--net/mac80211/util.c10
-rw-r--r--net/mac80211/wep.c9
-rw-r--r--net/mac80211/wme.c22
-rw-r--r--net/mac80211/wpa.c65
15 files changed, 285 insertions, 363 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index a4cccd1b7d53..79a65b3ee02b 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2,6 +2,7 @@
2 * Copyright 2002-2005, Instant802 Networks, Inc. 2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005, Devicescape Software, Inc. 3 * Copyright 2005, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -147,7 +148,6 @@ typedef unsigned __bitwise__ ieee80211_tx_result;
147#define IEEE80211_TX_UNICAST BIT(1) 148#define IEEE80211_TX_UNICAST BIT(1)
148#define IEEE80211_TX_PS_BUFFERED BIT(2) 149#define IEEE80211_TX_PS_BUFFERED BIT(2)
149#define IEEE80211_TX_PROBE_LAST_FRAG BIT(3) 150#define IEEE80211_TX_PROBE_LAST_FRAG BIT(3)
150#define IEEE80211_TX_INJECTED BIT(4)
151 151
152struct ieee80211_tx_data { 152struct ieee80211_tx_data {
153 struct sk_buff *skb; 153 struct sk_buff *skb;
@@ -157,7 +157,6 @@ struct ieee80211_tx_data {
157 struct sta_info *sta; 157 struct sta_info *sta;
158 struct ieee80211_key *key; 158 struct ieee80211_key *key;
159 159
160 struct ieee80211_tx_control *control;
161 struct ieee80211_channel *channel; 160 struct ieee80211_channel *channel;
162 s8 rate_idx; 161 s8 rate_idx;
163 /* use this rate (if set) for last fragment; rate can 162 /* use this rate (if set) for last fragment; rate can
@@ -207,22 +206,7 @@ struct ieee80211_rx_data {
207 u16 tkip_iv16; 206 u16 tkip_iv16;
208}; 207};
209 208
210/* flags used in struct ieee80211_tx_packet_data.flags */
211#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)
212#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
213#define IEEE80211_TXPD_REQUEUE BIT(2)
214#define IEEE80211_TXPD_EAPOL_FRAME BIT(3)
215#define IEEE80211_TXPD_AMPDU BIT(4)
216/* Stored in sk_buff->cb */
217struct ieee80211_tx_packet_data {
218 int ifindex;
219 unsigned long jiffies;
220 unsigned int flags;
221 u8 queue;
222};
223
224struct ieee80211_tx_stored_packet { 209struct ieee80211_tx_stored_packet {
225 struct ieee80211_tx_control control;
226 struct sk_buff *skb; 210 struct sk_buff *skb;
227 struct sk_buff **extra_frag; 211 struct sk_buff **extra_frag;
228 s8 last_frag_rate_idx; 212 s8 last_frag_rate_idx;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 9761d9bd5a79..8f1ff7ef1667 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -971,8 +971,7 @@ void ieee80211_if_setup(struct net_device *dev)
971/* everything else */ 971/* everything else */
972 972
973static int __ieee80211_if_config(struct net_device *dev, 973static int __ieee80211_if_config(struct net_device *dev,
974 struct sk_buff *beacon, 974 struct sk_buff *beacon)
975 struct ieee80211_tx_control *control)
976{ 975{
977 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 976 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
978 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 977 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
@@ -990,13 +989,11 @@ static int __ieee80211_if_config(struct net_device *dev,
990 conf.ssid_len = sdata->u.sta.ssid_len; 989 conf.ssid_len = sdata->u.sta.ssid_len;
991 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { 990 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
992 conf.beacon = beacon; 991 conf.beacon = beacon;
993 conf.beacon_control = control;
994 ieee80211_start_mesh(dev); 992 ieee80211_start_mesh(dev);
995 } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { 993 } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
996 conf.ssid = sdata->u.ap.ssid; 994 conf.ssid = sdata->u.ap.ssid;
997 conf.ssid_len = sdata->u.ap.ssid_len; 995 conf.ssid_len = sdata->u.ap.ssid_len;
998 conf.beacon = beacon; 996 conf.beacon = beacon;
999 conf.beacon_control = control;
1000 } 997 }
1001 return local->ops->config_interface(local_to_hw(local), 998 return local->ops->config_interface(local_to_hw(local),
1002 &sdata->vif, &conf); 999 &sdata->vif, &conf);
@@ -1009,23 +1006,21 @@ int ieee80211_if_config(struct net_device *dev)
1009 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT && 1006 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT &&
1010 (local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) 1007 (local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
1011 return ieee80211_if_config_beacon(dev); 1008 return ieee80211_if_config_beacon(dev);
1012 return __ieee80211_if_config(dev, NULL, NULL); 1009 return __ieee80211_if_config(dev, NULL);
1013} 1010}
1014 1011
1015int ieee80211_if_config_beacon(struct net_device *dev) 1012int ieee80211_if_config_beacon(struct net_device *dev)
1016{ 1013{
1017 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1014 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1018 struct ieee80211_tx_control control;
1019 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1015 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1020 struct sk_buff *skb; 1016 struct sk_buff *skb;
1021 1017
1022 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) 1018 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
1023 return 0; 1019 return 0;
1024 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, 1020 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif);
1025 &control);
1026 if (!skb) 1021 if (!skb)
1027 return -ENOMEM; 1022 return -ENOMEM;
1028 return __ieee80211_if_config(dev, skb, &control); 1023 return __ieee80211_if_config(dev, skb);
1029} 1024}
1030 1025
1031int ieee80211_hw_config(struct ieee80211_local *local) 1026int ieee80211_hw_config(struct ieee80211_local *local)
@@ -1180,38 +1175,20 @@ void ieee80211_reset_erp_info(struct net_device *dev)
1180} 1175}
1181 1176
1182void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, 1177void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1183 struct sk_buff *skb, 1178 struct sk_buff *skb)
1184 struct ieee80211_tx_status *status)
1185{ 1179{
1186 struct ieee80211_local *local = hw_to_local(hw); 1180 struct ieee80211_local *local = hw_to_local(hw);
1187 struct ieee80211_tx_status *saved; 1181 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1188 int tmp; 1182 int tmp;
1189 1183
1190 skb->dev = local->mdev; 1184 skb->dev = local->mdev;
1191 saved = kmalloc(sizeof(struct ieee80211_tx_status), GFP_ATOMIC);
1192 if (unlikely(!saved)) {
1193 if (net_ratelimit())
1194 printk(KERN_WARNING "%s: Not enough memory, "
1195 "dropping tx status", skb->dev->name);
1196 /* should be dev_kfree_skb_irq, but due to this function being
1197 * named _irqsafe instead of just _irq we can't be sure that
1198 * people won't call it from non-irq contexts */
1199 dev_kfree_skb_any(skb);
1200 return;
1201 }
1202 memcpy(saved, status, sizeof(struct ieee80211_tx_status));
1203 /* copy pointer to saved status into skb->cb for use by tasklet */
1204 memcpy(skb->cb, &saved, sizeof(saved));
1205
1206 skb->pkt_type = IEEE80211_TX_STATUS_MSG; 1185 skb->pkt_type = IEEE80211_TX_STATUS_MSG;
1207 skb_queue_tail(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS ? 1186 skb_queue_tail(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS ?
1208 &local->skb_queue : &local->skb_queue_unreliable, skb); 1187 &local->skb_queue : &local->skb_queue_unreliable, skb);
1209 tmp = skb_queue_len(&local->skb_queue) + 1188 tmp = skb_queue_len(&local->skb_queue) +
1210 skb_queue_len(&local->skb_queue_unreliable); 1189 skb_queue_len(&local->skb_queue_unreliable);
1211 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && 1190 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT &&
1212 (skb = skb_dequeue(&local->skb_queue_unreliable))) { 1191 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
1213 memcpy(&saved, skb->cb, sizeof(saved));
1214 kfree(saved);
1215 dev_kfree_skb_irq(skb); 1192 dev_kfree_skb_irq(skb);
1216 tmp--; 1193 tmp--;
1217 I802_DEBUG_INC(local->tx_status_drop); 1194 I802_DEBUG_INC(local->tx_status_drop);
@@ -1225,7 +1202,6 @@ static void ieee80211_tasklet_handler(unsigned long data)
1225 struct ieee80211_local *local = (struct ieee80211_local *) data; 1202 struct ieee80211_local *local = (struct ieee80211_local *) data;
1226 struct sk_buff *skb; 1203 struct sk_buff *skb;
1227 struct ieee80211_rx_status rx_status; 1204 struct ieee80211_rx_status rx_status;
1228 struct ieee80211_tx_status *tx_status;
1229 struct ieee80211_ra_tid *ra_tid; 1205 struct ieee80211_ra_tid *ra_tid;
1230 1206
1231 while ((skb = skb_dequeue(&local->skb_queue)) || 1207 while ((skb = skb_dequeue(&local->skb_queue)) ||
@@ -1240,12 +1216,8 @@ static void ieee80211_tasklet_handler(unsigned long data)
1240 __ieee80211_rx(local_to_hw(local), skb, &rx_status); 1216 __ieee80211_rx(local_to_hw(local), skb, &rx_status);
1241 break; 1217 break;
1242 case IEEE80211_TX_STATUS_MSG: 1218 case IEEE80211_TX_STATUS_MSG:
1243 /* get pointer to saved status out of skb->cb */
1244 memcpy(&tx_status, skb->cb, sizeof(tx_status));
1245 skb->pkt_type = 0; 1219 skb->pkt_type = 0;
1246 ieee80211_tx_status(local_to_hw(local), 1220 ieee80211_tx_status(local_to_hw(local), skb);
1247 skb, tx_status);
1248 kfree(tx_status);
1249 break; 1221 break;
1250 case IEEE80211_DELBA_MSG: 1222 case IEEE80211_DELBA_MSG:
1251 ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 1223 ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
@@ -1274,24 +1246,15 @@ static void ieee80211_tasklet_handler(unsigned long data)
1274 * Also, tx_packet_data in cb is restored from tx_control. */ 1246 * Also, tx_packet_data in cb is restored from tx_control. */
1275static void ieee80211_remove_tx_extra(struct ieee80211_local *local, 1247static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
1276 struct ieee80211_key *key, 1248 struct ieee80211_key *key,
1277 struct sk_buff *skb, 1249 struct sk_buff *skb)
1278 struct ieee80211_tx_control *control)
1279{ 1250{
1280 int hdrlen, iv_len, mic_len; 1251 int hdrlen, iv_len, mic_len;
1281 struct ieee80211_tx_packet_data *pkt_data; 1252 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1282 1253
1283 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1254 info->flags &= IEEE80211_TX_CTL_REQ_TX_STATUS |
1284 pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; 1255 IEEE80211_TX_CTL_DO_NOT_ENCRYPT |
1285 pkt_data->flags = 0; 1256 IEEE80211_TX_CTL_REQUEUE |
1286 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) 1257 IEEE80211_TX_CTL_EAPOL_FRAME;
1287 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
1288 if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)
1289 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
1290 if (control->flags & IEEE80211_TXCTL_REQUEUE)
1291 pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
1292 if (control->flags & IEEE80211_TXCTL_EAPOL_FRAME)
1293 pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME;
1294 pkt_data->queue = control->queue;
1295 1258
1296 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1259 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
1297 1260
@@ -1338,9 +1301,10 @@ no_key:
1338 1301
1339static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, 1302static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1340 struct sta_info *sta, 1303 struct sta_info *sta,
1341 struct sk_buff *skb, 1304 struct sk_buff *skb)
1342 struct ieee80211_tx_status *status)
1343{ 1305{
1306 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1307
1344 sta->tx_filtered_count++; 1308 sta->tx_filtered_count++;
1345 1309
1346 /* 1310 /*
@@ -1382,18 +1346,16 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1382 */ 1346 */
1383 if (test_sta_flags(sta, WLAN_STA_PS) && 1347 if (test_sta_flags(sta, WLAN_STA_PS) &&
1384 skb_queue_len(&sta->tx_filtered) < STA_MAX_TX_BUFFER) { 1348 skb_queue_len(&sta->tx_filtered) < STA_MAX_TX_BUFFER) {
1385 ieee80211_remove_tx_extra(local, sta->key, skb, 1349 ieee80211_remove_tx_extra(local, sta->key, skb);
1386 &status->control);
1387 skb_queue_tail(&sta->tx_filtered, skb); 1350 skb_queue_tail(&sta->tx_filtered, skb);
1388 return; 1351 return;
1389 } 1352 }
1390 1353
1391 if (!test_sta_flags(sta, WLAN_STA_PS) && 1354 if (!test_sta_flags(sta, WLAN_STA_PS) &&
1392 !(status->control.flags & IEEE80211_TXCTL_REQUEUE)) { 1355 !(info->flags & IEEE80211_TX_CTL_REQUEUE)) {
1393 /* Software retry the packet once */ 1356 /* Software retry the packet once */
1394 status->control.flags |= IEEE80211_TXCTL_REQUEUE; 1357 info->flags |= IEEE80211_TX_CTL_REQUEUE;
1395 ieee80211_remove_tx_extra(local, sta->key, skb, 1358 ieee80211_remove_tx_extra(local, sta->key, skb);
1396 &status->control);
1397 dev_queue_xmit(skb); 1359 dev_queue_xmit(skb);
1398 return; 1360 return;
1399 } 1361 }
@@ -1407,28 +1369,20 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
1407 dev_kfree_skb(skb); 1369 dev_kfree_skb(skb);
1408} 1370}
1409 1371
1410void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, 1372void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
1411 struct ieee80211_tx_status *status)
1412{ 1373{
1413 struct sk_buff *skb2; 1374 struct sk_buff *skb2;
1414 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1375 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1415 struct ieee80211_local *local = hw_to_local(hw); 1376 struct ieee80211_local *local = hw_to_local(hw);
1377 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1416 u16 frag, type; 1378 u16 frag, type;
1417 struct ieee80211_tx_status_rtap_hdr *rthdr; 1379 struct ieee80211_tx_status_rtap_hdr *rthdr;
1418 struct ieee80211_sub_if_data *sdata; 1380 struct ieee80211_sub_if_data *sdata;
1419 struct net_device *prev_dev = NULL; 1381 struct net_device *prev_dev = NULL;
1420 1382
1421 if (!status) {
1422 printk(KERN_ERR
1423 "%s: ieee80211_tx_status called with NULL status\n",
1424 wiphy_name(local->hw.wiphy));
1425 dev_kfree_skb(skb);
1426 return;
1427 }
1428
1429 rcu_read_lock(); 1383 rcu_read_lock();
1430 1384
1431 if (status->excessive_retries) { 1385 if (info->status.excessive_retries) {
1432 struct sta_info *sta; 1386 struct sta_info *sta;
1433 sta = sta_info_get(local, hdr->addr1); 1387 sta = sta_info_get(local, hdr->addr1);
1434 if (sta) { 1388 if (sta) {
@@ -1437,27 +1391,23 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
1437 * The STA is in power save mode, so assume 1391 * The STA is in power save mode, so assume
1438 * that this TX packet failed because of that. 1392 * that this TX packet failed because of that.
1439 */ 1393 */
1440 status->excessive_retries = 0; 1394 ieee80211_handle_filtered_frame(local, sta, skb);
1441 status->flags |= IEEE80211_TX_STATUS_TX_FILTERED;
1442 ieee80211_handle_filtered_frame(local, sta,
1443 skb, status);
1444 rcu_read_unlock(); 1395 rcu_read_unlock();
1445 return; 1396 return;
1446 } 1397 }
1447 } 1398 }
1448 } 1399 }
1449 1400
1450 if (status->flags & IEEE80211_TX_STATUS_TX_FILTERED) { 1401 if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
1451 struct sta_info *sta; 1402 struct sta_info *sta;
1452 sta = sta_info_get(local, hdr->addr1); 1403 sta = sta_info_get(local, hdr->addr1);
1453 if (sta) { 1404 if (sta) {
1454 ieee80211_handle_filtered_frame(local, sta, skb, 1405 ieee80211_handle_filtered_frame(local, sta, skb);
1455 status);
1456 rcu_read_unlock(); 1406 rcu_read_unlock();
1457 return; 1407 return;
1458 } 1408 }
1459 } else 1409 } else
1460 rate_control_tx_status(local->mdev, skb, status); 1410 rate_control_tx_status(local->mdev, skb);
1461 1411
1462 rcu_read_unlock(); 1412 rcu_read_unlock();
1463 1413
@@ -1471,14 +1421,14 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
1471 frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; 1421 frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
1472 type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE; 1422 type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE;
1473 1423
1474 if (status->flags & IEEE80211_TX_STATUS_ACK) { 1424 if (info->flags & IEEE80211_TX_STAT_ACK) {
1475 if (frag == 0) { 1425 if (frag == 0) {
1476 local->dot11TransmittedFrameCount++; 1426 local->dot11TransmittedFrameCount++;
1477 if (is_multicast_ether_addr(hdr->addr1)) 1427 if (is_multicast_ether_addr(hdr->addr1))
1478 local->dot11MulticastTransmittedFrameCount++; 1428 local->dot11MulticastTransmittedFrameCount++;
1479 if (status->retry_count > 0) 1429 if (info->status.retry_count > 0)
1480 local->dot11RetryCount++; 1430 local->dot11RetryCount++;
1481 if (status->retry_count > 1) 1431 if (info->status.retry_count > 1)
1482 local->dot11MultipleRetryCount++; 1432 local->dot11MultipleRetryCount++;
1483 } 1433 }
1484 1434
@@ -1524,17 +1474,17 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
1524 cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | 1474 cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) |
1525 (1 << IEEE80211_RADIOTAP_DATA_RETRIES)); 1475 (1 << IEEE80211_RADIOTAP_DATA_RETRIES));
1526 1476
1527 if (!(status->flags & IEEE80211_TX_STATUS_ACK) && 1477 if (!(info->flags & IEEE80211_TX_STAT_ACK) &&
1528 !is_multicast_ether_addr(hdr->addr1)) 1478 !is_multicast_ether_addr(hdr->addr1))
1529 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); 1479 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL);
1530 1480
1531 if ((status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) && 1481 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) &&
1532 (status->control.flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) 1482 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT))
1533 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); 1483 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS);
1534 else if (status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) 1484 else if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
1535 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); 1485 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS);
1536 1486
1537 rthdr->data_retries = status->retry_count; 1487 rthdr->data_retries = info->status.retry_count;
1538 1488
1539 /* XXX: is this sufficient for BPF? */ 1489 /* XXX: is this sufficient for BPF? */
1540 skb_set_mac_header(skb, 0); 1490 skb_set_mac_header(skb, 0);
@@ -1895,7 +1845,9 @@ static int __init ieee80211_init(void)
1895 struct sk_buff *skb; 1845 struct sk_buff *skb;
1896 int ret; 1846 int ret;
1897 1847
1898 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); 1848 BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
1849 BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
1850 IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
1899 1851
1900 ret = rc80211_pid_init(); 1852 ret = rc80211_pid_init();
1901 if (ret) 1853 if (ret)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 604149369dc9..9a264379d7b1 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -578,7 +578,7 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
578 int encrypt) 578 int encrypt)
579{ 579{
580 struct ieee80211_sub_if_data *sdata; 580 struct ieee80211_sub_if_data *sdata;
581 struct ieee80211_tx_packet_data *pkt_data; 581 struct ieee80211_tx_info *info;
582 582
583 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 583 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
584 skb->dev = sdata->local->mdev; 584 skb->dev = sdata->local->mdev;
@@ -586,11 +586,11 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
586 skb_set_network_header(skb, 0); 586 skb_set_network_header(skb, 0);
587 skb_set_transport_header(skb, 0); 587 skb_set_transport_header(skb, 0);
588 588
589 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 589 info = IEEE80211_SKB_CB(skb);
590 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 590 memset(info, 0, sizeof(struct ieee80211_tx_info));
591 pkt_data->ifindex = sdata->dev->ifindex; 591 info->control.ifindex = sdata->dev->ifindex;
592 if (!encrypt) 592 if (!encrypt)
593 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; 593 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
594 594
595 dev_queue_xmit(skb); 595 dev_queue_xmit(skb);
596} 596}
@@ -2314,7 +2314,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2314 int res, rates, i, j; 2314 int res, rates, i, j;
2315 struct sk_buff *skb; 2315 struct sk_buff *skb;
2316 struct ieee80211_mgmt *mgmt; 2316 struct ieee80211_mgmt *mgmt;
2317 struct ieee80211_tx_control control; 2317 struct ieee80211_tx_info *control;
2318 struct rate_selection ratesel; 2318 struct rate_selection ratesel;
2319 u8 *pos; 2319 u8 *pos;
2320 struct ieee80211_sub_if_data *sdata; 2320 struct ieee80211_sub_if_data *sdata;
@@ -2404,21 +2404,22 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2404 memcpy(pos, &bss->supp_rates[8], rates); 2404 memcpy(pos, &bss->supp_rates[8], rates);
2405 } 2405 }
2406 2406
2407 memset(&control, 0, sizeof(control)); 2407 control = IEEE80211_SKB_CB(skb);
2408
2408 rate_control_get_rate(dev, sband, skb, &ratesel); 2409 rate_control_get_rate(dev, sband, skb, &ratesel);
2409 if (ratesel.rate_idx < 0) { 2410 if (ratesel.rate_idx < 0) {
2410 printk(KERN_DEBUG "%s: Failed to determine TX rate " 2411 printk(KERN_DEBUG "%s: Failed to determine TX rate "
2411 "for IBSS beacon\n", dev->name); 2412 "for IBSS beacon\n", dev->name);
2412 break; 2413 break;
2413 } 2414 }
2414 control.vif = &sdata->vif; 2415 control->control.vif = &sdata->vif;
2415 control.tx_rate_idx = ratesel.rate_idx; 2416 control->tx_rate_idx = ratesel.rate_idx;
2416 if (sdata->bss_conf.use_short_preamble && 2417 if (sdata->bss_conf.use_short_preamble &&
2417 sband->bitrates[ratesel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) 2418 sband->bitrates[ratesel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE)
2418 control.flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 2419 control->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
2419 control.antenna_sel_tx = local->hw.conf.antenna_sel_tx; 2420 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
2420 control.flags |= IEEE80211_TXCTL_NO_ACK; 2421 control->flags |= IEEE80211_TX_CTL_NO_ACK;
2421 control.retry_limit = 1; 2422 control->control.retry_limit = 1;
2422 2423
2423 ifsta->probe_resp = skb_copy(skb, GFP_ATOMIC); 2424 ifsta->probe_resp = skb_copy(skb, GFP_ATOMIC);
2424 if (ifsta->probe_resp) { 2425 if (ifsta->probe_resp) {
@@ -2433,8 +2434,7 @@ static int ieee80211_sta_join_ibss(struct net_device *dev,
2433 } 2434 }
2434 2435
2435 if (local->ops->beacon_update && 2436 if (local->ops->beacon_update &&
2436 local->ops->beacon_update(local_to_hw(local), 2437 local->ops->beacon_update(local_to_hw(local), skb) == 0) {
2437 skb, &control) == 0) {
2438 printk(KERN_DEBUG "%s: Configured IBSS beacon " 2438 printk(KERN_DEBUG "%s: Configured IBSS beacon "
2439 "template\n", dev->name); 2439 "template\n", dev->name);
2440 skb = NULL; 2440 skb = NULL;
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index a29148dcca99..0ed9c8a2f56f 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -34,8 +34,7 @@ struct rate_control_ops {
34 struct module *module; 34 struct module *module;
35 const char *name; 35 const char *name;
36 void (*tx_status)(void *priv, struct net_device *dev, 36 void (*tx_status)(void *priv, struct net_device *dev,
37 struct sk_buff *skb, 37 struct sk_buff *skb);
38 struct ieee80211_tx_status *status);
39 void (*get_rate)(void *priv, struct net_device *dev, 38 void (*get_rate)(void *priv, struct net_device *dev,
40 struct ieee80211_supported_band *band, 39 struct ieee80211_supported_band *band,
41 struct sk_buff *skb, 40 struct sk_buff *skb,
@@ -77,13 +76,12 @@ struct rate_control_ref *rate_control_get(struct rate_control_ref *ref);
77void rate_control_put(struct rate_control_ref *ref); 76void rate_control_put(struct rate_control_ref *ref);
78 77
79static inline void rate_control_tx_status(struct net_device *dev, 78static inline void rate_control_tx_status(struct net_device *dev,
80 struct sk_buff *skb, 79 struct sk_buff *skb)
81 struct ieee80211_tx_status *status)
82{ 80{
83 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 81 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
84 struct rate_control_ref *ref = local->rate_ctrl; 82 struct rate_control_ref *ref = local->rate_ctrl;
85 83
86 ref->ops->tx_status(ref->priv, dev, skb, status); 84 ref->ops->tx_status(ref->priv, dev, skb);
87} 85}
88 86
89 87
diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h
index 04afc13ed825..2078803d3581 100644
--- a/net/mac80211/rc80211_pid.h
+++ b/net/mac80211/rc80211_pid.h
@@ -61,7 +61,7 @@ enum rc_pid_event_type {
61union rc_pid_event_data { 61union rc_pid_event_data {
62 /* RC_PID_EVENT_TX_STATUS */ 62 /* RC_PID_EVENT_TX_STATUS */
63 struct { 63 struct {
64 struct ieee80211_tx_status tx_status; 64 struct ieee80211_tx_info tx_status;
65 }; 65 };
66 /* RC_PID_EVENT_TYPE_RATE_CHANGE */ 66 /* RC_PID_EVENT_TYPE_RATE_CHANGE */
67 /* RC_PID_EVENT_TYPE_TX_RATE */ 67 /* RC_PID_EVENT_TYPE_TX_RATE */
@@ -158,7 +158,7 @@ struct rc_pid_debugfs_entries {
158}; 158};
159 159
160void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, 160void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf,
161 struct ieee80211_tx_status *stat); 161 struct ieee80211_tx_info *stat);
162 162
163void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf, 163void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf,
164 int index, int rate); 164 int index, int rate);
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c
index 14cde36f5070..e8945413e4a2 100644
--- a/net/mac80211/rc80211_pid_algo.c
+++ b/net/mac80211/rc80211_pid_algo.c
@@ -237,8 +237,7 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
237} 237}
238 238
239static void rate_control_pid_tx_status(void *priv, struct net_device *dev, 239static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
240 struct sk_buff *skb, 240 struct sk_buff *skb)
241 struct ieee80211_tx_status *status)
242{ 241{
243 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 242 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
244 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 243 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -248,6 +247,7 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
248 struct rc_pid_sta_info *spinfo; 247 struct rc_pid_sta_info *spinfo;
249 unsigned long period; 248 unsigned long period;
250 struct ieee80211_supported_band *sband; 249 struct ieee80211_supported_band *sband;
250 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
251 251
252 rcu_read_lock(); 252 rcu_read_lock();
253 253
@@ -266,28 +266,28 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
266 266
267 /* Ignore all frames that were sent with a different rate than the rate 267 /* Ignore all frames that were sent with a different rate than the rate
268 * we currently advise mac80211 to use. */ 268 * we currently advise mac80211 to use. */
269 if (status->control.tx_rate_idx != sta->txrate_idx) 269 if (info->tx_rate_idx != sta->txrate_idx)
270 goto unlock; 270 goto unlock;
271 271
272 spinfo = sta->rate_ctrl_priv; 272 spinfo = sta->rate_ctrl_priv;
273 spinfo->tx_num_xmit++; 273 spinfo->tx_num_xmit++;
274 274
275#ifdef CONFIG_MAC80211_DEBUGFS 275#ifdef CONFIG_MAC80211_DEBUGFS
276 rate_control_pid_event_tx_status(&spinfo->events, status); 276 rate_control_pid_event_tx_status(&spinfo->events, info);
277#endif 277#endif
278 278
279 /* We count frames that totally failed to be transmitted as two bad 279 /* We count frames that totally failed to be transmitted as two bad
280 * frames, those that made it out but had some retries as one good and 280 * frames, those that made it out but had some retries as one good and
281 * one bad frame. */ 281 * one bad frame. */
282 if (status->excessive_retries) { 282 if (info->status.excessive_retries) {
283 spinfo->tx_num_failed += 2; 283 spinfo->tx_num_failed += 2;
284 spinfo->tx_num_xmit++; 284 spinfo->tx_num_xmit++;
285 } else if (status->retry_count) { 285 } else if (info->status.retry_count) {
286 spinfo->tx_num_failed++; 286 spinfo->tx_num_failed++;
287 spinfo->tx_num_xmit++; 287 spinfo->tx_num_xmit++;
288 } 288 }
289 289
290 if (status->excessive_retries) { 290 if (info->status.excessive_retries) {
291 sta->tx_retry_failed++; 291 sta->tx_retry_failed++;
292 sta->tx_num_consecutive_failures++; 292 sta->tx_num_consecutive_failures++;
293 sta->tx_num_mpdu_fail++; 293 sta->tx_num_mpdu_fail++;
@@ -295,8 +295,8 @@ static void rate_control_pid_tx_status(void *priv, struct net_device *dev,
295 sta->tx_num_consecutive_failures = 0; 295 sta->tx_num_consecutive_failures = 0;
296 sta->tx_num_mpdu_ok++; 296 sta->tx_num_mpdu_ok++;
297 } 297 }
298 sta->tx_retry_count += status->retry_count; 298 sta->tx_retry_count += info->status.retry_count;
299 sta->tx_num_mpdu_fail += status->retry_count; 299 sta->tx_num_mpdu_fail += info->status.retry_count;
300 300
301 /* Update PID controller state. */ 301 /* Update PID controller state. */
302 period = (HZ * pinfo->sampling_period + 500) / 1000; 302 period = (HZ * pinfo->sampling_period + 500) / 1000;
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c
index ff5c380f3c13..8121d3bc6835 100644
--- a/net/mac80211/rc80211_pid_debugfs.c
+++ b/net/mac80211/rc80211_pid_debugfs.c
@@ -39,11 +39,11 @@ static void rate_control_pid_event(struct rc_pid_event_buffer *buf,
39} 39}
40 40
41void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, 41void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf,
42 struct ieee80211_tx_status *stat) 42 struct ieee80211_tx_info *stat)
43{ 43{
44 union rc_pid_event_data evd; 44 union rc_pid_event_data evd;
45 45
46 memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_status)); 46 memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_info));
47 rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd); 47 rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd);
48} 48}
49 49
@@ -167,8 +167,8 @@ static ssize_t rate_control_pid_events_read(struct file *file, char __user *buf,
167 switch (ev->type) { 167 switch (ev->type) {
168 case RC_PID_EVENT_TYPE_TX_STATUS: 168 case RC_PID_EVENT_TYPE_TX_STATUS:
169 p += snprintf(pb + p, length - p, "tx_status %u %u", 169 p += snprintf(pb + p, length - p, "tx_status %u %u",
170 ev->data.tx_status.excessive_retries, 170 ev->data.tx_status.status.excessive_retries,
171 ev->data.tx_status.retry_count); 171 ev->data.tx_status.status.retry_count);
172 break; 172 break;
173 case RC_PID_EVENT_TYPE_RATE_CHANGE: 173 case RC_PID_EVENT_TYPE_RATE_CHANGE:
174 p += snprintf(pb + p, length - p, "rate_change %d %d", 174 p += snprintf(pb + p, length - p, "rate_change %d %d",
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index fa68305fd59e..cf0de3b0fe24 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -714,7 +714,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
714 struct sk_buff *skb; 714 struct sk_buff *skb;
715 int sent = 0; 715 int sent = 0;
716 struct ieee80211_sub_if_data *sdata; 716 struct ieee80211_sub_if_data *sdata;
717 struct ieee80211_tx_packet_data *pkt_data; 717 struct ieee80211_tx_info *info;
718 DECLARE_MAC_BUF(mac); 718 DECLARE_MAC_BUF(mac);
719 719
720 sdata = sta->sdata; 720 sdata = sta->sdata;
@@ -734,13 +734,13 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
734 734
735 /* Send all buffered frames to the station */ 735 /* Send all buffered frames to the station */
736 while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { 736 while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) {
737 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 737 info = IEEE80211_SKB_CB(skb);
738 sent++; 738 sent++;
739 pkt_data->flags |= IEEE80211_TXPD_REQUEUE; 739 info->flags |= IEEE80211_TX_CTL_REQUEUE;
740 dev_queue_xmit(skb); 740 dev_queue_xmit(skb);
741 } 741 }
742 while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { 742 while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) {
743 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 743 info = IEEE80211_SKB_CB(skb);
744 local->total_ps_buffered--; 744 local->total_ps_buffered--;
745 sent++; 745 sent++;
746#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 746#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
@@ -748,7 +748,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
748 "since STA not sleeping anymore\n", dev->name, 748 "since STA not sleeping anymore\n", dev->name,
749 print_mac(mac, sta->addr), sta->aid); 749 print_mac(mac, sta->addr), sta->aid);
750#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 750#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
751 pkt_data->flags |= IEEE80211_TXPD_REQUEUE; 751 info->flags |= IEEE80211_TX_CTL_REQUEUE;
752 dev_queue_xmit(skb); 752 dev_queue_xmit(skb);
753 } 753 }
754 754
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index baf5e4746884..ef3149324d54 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -511,20 +511,20 @@ static inline int sta_info_buffer_expired(struct ieee80211_local *local,
511 struct sta_info *sta, 511 struct sta_info *sta,
512 struct sk_buff *skb) 512 struct sk_buff *skb)
513{ 513{
514 struct ieee80211_tx_packet_data *pkt_data; 514 struct ieee80211_tx_info *info;
515 int timeout; 515 int timeout;
516 516
517 if (!skb) 517 if (!skb)
518 return 0; 518 return 0;
519 519
520 pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; 520 info = IEEE80211_SKB_CB(skb);
521 521
522 /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ 522 /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */
523 timeout = (sta->listen_interval * local->hw.conf.beacon_int * 32 / 523 timeout = (sta->listen_interval * local->hw.conf.beacon_int * 32 /
524 15625) * HZ; 524 15625) * HZ;
525 if (timeout < STA_TX_BUFFER_EXPIRE) 525 if (timeout < STA_TX_BUFFER_EXPIRE)
526 timeout = STA_TX_BUFFER_EXPIRE; 526 timeout = STA_TX_BUFFER_EXPIRE;
527 return time_after(jiffies, pkt_data->jiffies + timeout); 527 return time_after(jiffies, info->control.jiffies + timeout);
528} 528}
529 529
530 530
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index e89cc1655547..f592290e42b9 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -32,7 +32,7 @@
32 * @WLAN_STA_WDS: Station is one of our WDS peers. 32 * @WLAN_STA_WDS: Station is one of our WDS peers.
33 * @WLAN_STA_PSPOLL: Station has just PS-polled us. 33 * @WLAN_STA_PSPOLL: Station has just PS-polled us.
34 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the 34 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
35 * IEEE80211_TXCTL_CLEAR_PS_FILT control flag) when the next 35 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
36 * frame to this station is transmitted. 36 * frame to this station is transmitted.
37 */ 37 */
38enum ieee80211_sta_info_flags { 38enum ieee80211_sta_info_flags {
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 666158f02a89..ac9a4af7ad42 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -238,12 +238,12 @@ static ieee80211_tx_result
238ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) 238ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
239{ 239{
240#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 240#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
241 struct sk_buff *skb = tx->skb; 241 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
242 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
243#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 242#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
243 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
244 u32 sta_flags; 244 u32 sta_flags;
245 245
246 if (unlikely(tx->flags & IEEE80211_TX_INJECTED)) 246 if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
247 return TX_CONTINUE; 247 return TX_CONTINUE;
248 248
249 if (unlikely(tx->local->sta_sw_scanning) && 249 if (unlikely(tx->local->sta_sw_scanning) &&
@@ -348,6 +348,8 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
348static ieee80211_tx_result 348static ieee80211_tx_result
349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) 349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
350{ 350{
351 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
352
351 /* 353 /*
352 * broadcast/multicast frame 354 * broadcast/multicast frame
353 * 355 *
@@ -383,7 +385,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
383 } 385 }
384 386
385 /* buffered in hardware */ 387 /* buffered in hardware */
386 tx->control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; 388 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM;
387 389
388 return TX_CONTINUE; 390 return TX_CONTINUE;
389} 391}
@@ -392,6 +394,7 @@ static ieee80211_tx_result
392ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) 394ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
393{ 395{
394 struct sta_info *sta = tx->sta; 396 struct sta_info *sta = tx->sta;
397 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
395 u32 staflags; 398 u32 staflags;
396 DECLARE_MAC_BUF(mac); 399 DECLARE_MAC_BUF(mac);
397 400
@@ -404,7 +407,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
404 407
405 if (unlikely((staflags & WLAN_STA_PS) && 408 if (unlikely((staflags & WLAN_STA_PS) &&
406 !(staflags & WLAN_STA_PSPOLL))) { 409 !(staflags & WLAN_STA_PSPOLL))) {
407 struct ieee80211_tx_packet_data *pkt_data;
408#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 410#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
409 printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " 411 printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries "
410 "before %d)\n", 412 "before %d)\n",
@@ -428,8 +430,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
428 if (skb_queue_empty(&sta->ps_tx_buf)) 430 if (skb_queue_empty(&sta->ps_tx_buf))
429 sta_info_set_tim_bit(sta); 431 sta_info_set_tim_bit(sta);
430 432
431 pkt_data = (struct ieee80211_tx_packet_data *)tx->skb->cb; 433 info->control.jiffies = jiffies;
432 pkt_data->jiffies = jiffies;
433 skb_queue_tail(&sta->ps_tx_buf, tx->skb); 434 skb_queue_tail(&sta->ps_tx_buf, tx->skb);
434 return TX_QUEUED; 435 return TX_QUEUED;
435 } 436 }
@@ -461,17 +462,18 @@ static ieee80211_tx_result
461ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) 462ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
462{ 463{
463 struct ieee80211_key *key; 464 struct ieee80211_key *key;
465 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
464 u16 fc = tx->fc; 466 u16 fc = tx->fc;
465 467
466 if (unlikely(tx->control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 468 if (unlikely(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT))
467 tx->key = NULL; 469 tx->key = NULL;
468 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 470 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
469 tx->key = key; 471 tx->key = key;
470 else if ((key = rcu_dereference(tx->sdata->default_key))) 472 else if ((key = rcu_dereference(tx->sdata->default_key)))
471 tx->key = key; 473 tx->key = key;
472 else if (tx->sdata->drop_unencrypted && 474 else if (tx->sdata->drop_unencrypted &&
473 !(tx->control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && 475 !(info->flags & IEEE80211_TX_CTL_EAPOL_FRAME) &&
474 !(tx->flags & IEEE80211_TX_INJECTED)) { 476 !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
475 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 477 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
476 return TX_DROP; 478 return TX_DROP;
477 } else 479 } else
@@ -500,7 +502,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
500 } 502 }
501 503
502 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 504 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
503 tx->control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 505 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
504 506
505 return TX_CONTINUE; 507 return TX_CONTINUE;
506} 508}
@@ -510,6 +512,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
510{ 512{
511 struct rate_selection rsel; 513 struct rate_selection rsel;
512 struct ieee80211_supported_band *sband; 514 struct ieee80211_supported_band *sband;
515 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
513 516
514 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 517 sband = tx->local->hw.wiphy->bands[tx->channel->band];
515 518
@@ -517,18 +520,17 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
517 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); 520 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel);
518 tx->rate_idx = rsel.rate_idx; 521 tx->rate_idx = rsel.rate_idx;
519 if (unlikely(rsel.probe_idx >= 0)) { 522 if (unlikely(rsel.probe_idx >= 0)) {
520 tx->control->flags |= 523 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
521 IEEE80211_TXCTL_RATE_CTRL_PROBE;
522 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; 524 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
523 tx->control->alt_retry_rate_idx = tx->rate_idx; 525 info->control.alt_retry_rate_idx = tx->rate_idx;
524 tx->rate_idx = rsel.probe_idx; 526 tx->rate_idx = rsel.probe_idx;
525 } else 527 } else
526 tx->control->alt_retry_rate_idx = -1; 528 info->control.alt_retry_rate_idx = -1;
527 529
528 if (unlikely(tx->rate_idx < 0)) 530 if (unlikely(tx->rate_idx < 0))
529 return TX_DROP; 531 return TX_DROP;
530 } else 532 } else
531 tx->control->alt_retry_rate_idx = -1; 533 info->control.alt_retry_rate_idx = -1;
532 534
533 if (tx->sdata->bss_conf.use_cts_prot && 535 if (tx->sdata->bss_conf.use_cts_prot &&
534 (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { 536 (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) {
@@ -538,13 +540,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
538 else 540 else
539 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; 541 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
540 tx->rate_idx = rsel.nonerp_idx; 542 tx->rate_idx = rsel.nonerp_idx;
541 tx->control->tx_rate_idx = rsel.nonerp_idx; 543 info->tx_rate_idx = rsel.nonerp_idx;
542 tx->control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 544 info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
543 } else { 545 } else {
544 tx->last_frag_rate_idx = tx->rate_idx; 546 tx->last_frag_rate_idx = tx->rate_idx;
545 tx->control->tx_rate_idx = tx->rate_idx; 547 info->tx_rate_idx = tx->rate_idx;
546 } 548 }
547 tx->control->tx_rate_idx = tx->rate_idx; 549 info->tx_rate_idx = tx->rate_idx;
548 550
549 return TX_CONTINUE; 551 return TX_CONTINUE;
550} 552}
@@ -555,28 +557,32 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
555 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 557 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
556 u16 fc = le16_to_cpu(hdr->frame_control); 558 u16 fc = le16_to_cpu(hdr->frame_control);
557 u16 dur; 559 u16 dur;
558 struct ieee80211_tx_control *control = tx->control; 560 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
559 struct ieee80211_supported_band *sband; 561 struct ieee80211_supported_band *sband;
560 562
561 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 563 sband = tx->local->hw.wiphy->bands[tx->channel->band];
562 564
563 if (!control->retry_limit) { 565 if (tx->sta)
566 info->control.aid = tx->sta->aid;
567
568 if (!info->control.retry_limit) {
564 if (!is_multicast_ether_addr(hdr->addr1)) { 569 if (!is_multicast_ether_addr(hdr->addr1)) {
565 if (tx->skb->len + FCS_LEN > tx->local->rts_threshold 570 int len = min_t(int, tx->skb->len + FCS_LEN,
571 tx->local->fragmentation_threshold);
572 if (len > tx->local->rts_threshold
566 && tx->local->rts_threshold < 573 && tx->local->rts_threshold <
567 IEEE80211_MAX_RTS_THRESHOLD) { 574 IEEE80211_MAX_RTS_THRESHOLD) {
568 control->flags |= 575 info->flags |= IEEE80211_TX_CTL_USE_RTS_CTS;
569 IEEE80211_TXCTL_USE_RTS_CTS; 576 info->flags |=
570 control->flags |= 577 IEEE80211_TX_CTL_LONG_RETRY_LIMIT;
571 IEEE80211_TXCTL_LONG_RETRY_LIMIT; 578 info->control.retry_limit =
572 control->retry_limit =
573 tx->local->long_retry_limit; 579 tx->local->long_retry_limit;
574 } else { 580 } else {
575 control->retry_limit = 581 info->control.retry_limit =
576 tx->local->short_retry_limit; 582 tx->local->short_retry_limit;
577 } 583 }
578 } else { 584 } else {
579 control->retry_limit = 1; 585 info->control.retry_limit = 1;
580 } 586 }
581 } 587 }
582 588
@@ -585,7 +591,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
585 * frames. 591 * frames.
586 * TODO: The last fragment could still use multiple retry 592 * TODO: The last fragment could still use multiple retry
587 * rates. */ 593 * rates. */
588 control->alt_retry_rate_idx = -1; 594 info->control.alt_retry_rate_idx = -1;
589 } 595 }
590 596
591 /* Use CTS protection for unicast frames sent using extended rates if 597 /* Use CTS protection for unicast frames sent using extended rates if
@@ -595,8 +601,8 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
595 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && 601 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) &&
596 (tx->flags & IEEE80211_TX_UNICAST) && 602 (tx->flags & IEEE80211_TX_UNICAST) &&
597 tx->sdata->bss_conf.use_cts_prot && 603 tx->sdata->bss_conf.use_cts_prot &&
598 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 604 !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS))
599 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 605 info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT;
600 606
601 /* Transmit data frames using short preambles if the driver supports 607 /* Transmit data frames using short preambles if the driver supports
602 * short preambles at the selected rate and short preambles are 608 * short preambles at the selected rate and short preambles are
@@ -605,7 +611,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
605 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && 611 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) &&
606 tx->sdata->bss_conf.use_short_preamble && 612 tx->sdata->bss_conf.use_short_preamble &&
607 (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { 613 (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) {
608 tx->control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 614 info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
609 } 615 }
610 616
611 /* Setup duration field for the first fragment of the frame. Duration 617 /* Setup duration field for the first fragment of the frame. Duration
@@ -616,8 +622,8 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
616 tx->extra_frag[0]->len : 0); 622 tx->extra_frag[0]->len : 0);
617 hdr->duration_id = cpu_to_le16(dur); 623 hdr->duration_id = cpu_to_le16(dur);
618 624
619 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 625 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) ||
620 (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { 626 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) {
621 struct ieee80211_supported_band *sband; 627 struct ieee80211_supported_band *sband;
622 struct ieee80211_rate *rate; 628 struct ieee80211_rate *rate;
623 s8 baserate = -1; 629 s8 baserate = -1;
@@ -626,7 +632,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
626 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 632 sband = tx->local->hw.wiphy->bands[tx->channel->band];
627 633
628 /* Do not use multiple retry rates when using RTS/CTS */ 634 /* Do not use multiple retry rates when using RTS/CTS */
629 control->alt_retry_rate_idx = -1; 635 info->control.alt_retry_rate_idx = -1;
630 636
631 /* Use min(data rate, max base rate) as CTS/RTS rate */ 637 /* Use min(data rate, max base rate) as CTS/RTS rate */
632 rate = &sband->bitrates[tx->rate_idx]; 638 rate = &sband->bitrates[tx->rate_idx];
@@ -642,13 +648,13 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
642 } 648 }
643 649
644 if (baserate >= 0) 650 if (baserate >= 0)
645 control->rts_cts_rate_idx = baserate; 651 info->control.rts_cts_rate_idx = baserate;
646 else 652 else
647 control->rts_cts_rate_idx = 0; 653 info->control.rts_cts_rate_idx = 0;
648 } 654 }
649 655
650 if (tx->sta) 656 if (tx->sta)
651 control->aid = tx->sta->aid; 657 info->control.aid = tx->sta->aid;
652 658
653 return TX_CONTINUE; 659 return TX_CONTINUE;
654} 660}
@@ -762,6 +768,7 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
762 u32 load = 0, hdrtime; 768 u32 load = 0, hdrtime;
763 struct ieee80211_rate *rate; 769 struct ieee80211_rate *rate;
764 struct ieee80211_supported_band *sband; 770 struct ieee80211_supported_band *sband;
771 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
765 772
766 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 773 sband = tx->local->hw.wiphy->bands[tx->channel->band];
767 rate = &sband->bitrates[tx->rate_idx]; 774 rate = &sband->bitrates[tx->rate_idx];
@@ -786,9 +793,9 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
786 if (!is_multicast_ether_addr(hdr->addr1)) 793 if (!is_multicast_ether_addr(hdr->addr1))
787 load += hdrtime; 794 load += hdrtime;
788 795
789 if (tx->control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 796 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)
790 load += 2 * hdrtime; 797 load += 2 * hdrtime;
791 else if (tx->control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 798 else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)
792 load += hdrtime; 799 load += hdrtime;
793 800
794 /* TODO: optimise again */ 801 /* TODO: optimise again */
@@ -839,6 +846,7 @@ static ieee80211_tx_handler ieee80211_tx_handlers[] =
839 ieee80211_tx_h_rate_ctrl, 846 ieee80211_tx_h_rate_ctrl,
840 ieee80211_tx_h_misc, 847 ieee80211_tx_h_misc,
841 ieee80211_tx_h_fragment, 848 ieee80211_tx_h_fragment,
849 /* handlers after fragment must be aware of tx info fragmentation! */
842 ieee80211_tx_h_encrypt, 850 ieee80211_tx_h_encrypt,
843 ieee80211_tx_h_stats, 851 ieee80211_tx_h_stats,
844 NULL 852 NULL
@@ -867,12 +875,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
867 (struct ieee80211_radiotap_header *) skb->data; 875 (struct ieee80211_radiotap_header *) skb->data;
868 struct ieee80211_supported_band *sband; 876 struct ieee80211_supported_band *sband;
869 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); 877 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len);
870 struct ieee80211_tx_control *control = tx->control; 878 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
871 879
872 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 880 sband = tx->local->hw.wiphy->bands[tx->channel->band];
873 881
874 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 882 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
875 tx->flags |= IEEE80211_TX_INJECTED; 883 info->flags |= IEEE80211_TX_CTL_INJECTED;
876 tx->flags &= ~IEEE80211_TX_FRAGMENTED; 884 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
877 885
878 /* 886 /*
@@ -920,7 +928,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
920 * radiotap uses 0 for 1st ant, mac80211 is 1 for 928 * radiotap uses 0 for 1st ant, mac80211 is 1 for
921 * 1st ant 929 * 1st ant
922 */ 930 */
923 control->antenna_sel_tx = (*iterator.this_arg) + 1; 931 info->antenna_sel_tx = (*iterator.this_arg) + 1;
924 break; 932 break;
925 933
926#if 0 934#if 0
@@ -944,8 +952,8 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
944 skb_trim(skb, skb->len - FCS_LEN); 952 skb_trim(skb, skb->len - FCS_LEN);
945 } 953 }
946 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) 954 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
947 control->flags &= 955 info->flags &=
948 ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; 956 ~IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
949 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 957 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
950 tx->flags |= IEEE80211_TX_FRAGMENTED; 958 tx->flags |= IEEE80211_TX_FRAGMENTED;
951 break; 959 break;
@@ -980,12 +988,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
980static ieee80211_tx_result 988static ieee80211_tx_result
981__ieee80211_tx_prepare(struct ieee80211_tx_data *tx, 989__ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
982 struct sk_buff *skb, 990 struct sk_buff *skb,
983 struct net_device *dev, 991 struct net_device *dev)
984 struct ieee80211_tx_control *control)
985{ 992{
986 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 993 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
987 struct ieee80211_hdr *hdr; 994 struct ieee80211_hdr *hdr;
988 struct ieee80211_sub_if_data *sdata; 995 struct ieee80211_sub_if_data *sdata;
996 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
989 997
990 int hdrlen; 998 int hdrlen;
991 999
@@ -994,7 +1002,7 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
994 tx->dev = dev; /* use original interface */ 1002 tx->dev = dev; /* use original interface */
995 tx->local = local; 1003 tx->local = local;
996 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1004 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev);
997 tx->control = control; 1005 tx->channel = local->hw.conf.channel;
998 /* 1006 /*
999 * Set this flag (used below to indicate "automatic fragmentation"), 1007 * Set this flag (used below to indicate "automatic fragmentation"),
1000 * it will be cleared/left by radiotap as desired. 1008 * it will be cleared/left by radiotap as desired.
@@ -1021,10 +1029,10 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1021 1029
1022 if (is_multicast_ether_addr(hdr->addr1)) { 1030 if (is_multicast_ether_addr(hdr->addr1)) {
1023 tx->flags &= ~IEEE80211_TX_UNICAST; 1031 tx->flags &= ~IEEE80211_TX_UNICAST;
1024 control->flags |= IEEE80211_TXCTL_NO_ACK; 1032 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1025 } else { 1033 } else {
1026 tx->flags |= IEEE80211_TX_UNICAST; 1034 tx->flags |= IEEE80211_TX_UNICAST;
1027 control->flags &= ~IEEE80211_TXCTL_NO_ACK; 1035 info->flags &= ~IEEE80211_TX_CTL_NO_ACK;
1028 } 1036 }
1029 1037
1030 if (tx->flags & IEEE80211_TX_FRAGMENTED) { 1038 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
@@ -1037,16 +1045,16 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1037 } 1045 }
1038 1046
1039 if (!tx->sta) 1047 if (!tx->sta)
1040 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; 1048 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1041 else if (test_and_clear_sta_flags(tx->sta, WLAN_STA_CLEAR_PS_FILT)) 1049 else if (test_and_clear_sta_flags(tx->sta, WLAN_STA_CLEAR_PS_FILT))
1042 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; 1050 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1043 1051
1044 hdrlen = ieee80211_get_hdrlen(tx->fc); 1052 hdrlen = ieee80211_get_hdrlen(tx->fc);
1045 if (skb->len > hdrlen + sizeof(rfc1042_header) + 2) { 1053 if (skb->len > hdrlen + sizeof(rfc1042_header) + 2) {
1046 u8 *pos = &skb->data[hdrlen + sizeof(rfc1042_header)]; 1054 u8 *pos = &skb->data[hdrlen + sizeof(rfc1042_header)];
1047 tx->ethertype = (pos[0] << 8) | pos[1]; 1055 tx->ethertype = (pos[0] << 8) | pos[1];
1048 } 1056 }
1049 control->flags |= IEEE80211_TXCTL_FIRST_FRAGMENT; 1057 info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
1050 1058
1051 return TX_CONTINUE; 1059 return TX_CONTINUE;
1052} 1060}
@@ -1056,14 +1064,12 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1056 */ 1064 */
1057static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, 1065static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1058 struct sk_buff *skb, 1066 struct sk_buff *skb,
1059 struct net_device *mdev, 1067 struct net_device *mdev)
1060 struct ieee80211_tx_control *control)
1061{ 1068{
1062 struct ieee80211_tx_packet_data *pkt_data; 1069 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1063 struct net_device *dev; 1070 struct net_device *dev;
1064 1071
1065 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1072 dev = dev_get_by_index(&init_net, info->control.ifindex);
1066 dev = dev_get_by_index(&init_net, pkt_data->ifindex);
1067 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { 1073 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) {
1068 dev_put(dev); 1074 dev_put(dev);
1069 dev = NULL; 1075 dev = NULL;
@@ -1071,7 +1077,7 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1071 if (unlikely(!dev)) 1077 if (unlikely(!dev))
1072 return -ENODEV; 1078 return -ENODEV;
1073 /* initialises tx with control */ 1079 /* initialises tx with control */
1074 __ieee80211_tx_prepare(tx, skb, dev, control); 1080 __ieee80211_tx_prepare(tx, skb, dev);
1075 dev_put(dev); 1081 dev_put(dev);
1076 return 0; 1082 return 0;
1077} 1083}
@@ -1079,7 +1085,7 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1079static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, 1085static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1080 struct ieee80211_tx_data *tx) 1086 struct ieee80211_tx_data *tx)
1081{ 1087{
1082 struct ieee80211_tx_control *control = tx->control; 1088 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1083 int ret, i; 1089 int ret, i;
1084 1090
1085 if (!ieee80211_qdisc_installed(local->mdev) && 1091 if (!ieee80211_qdisc_installed(local->mdev) &&
@@ -1090,39 +1096,39 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1090 if (skb) { 1096 if (skb) {
1091 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1097 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1092 "TX to low-level driver", skb); 1098 "TX to low-level driver", skb);
1093 ret = local->ops->tx(local_to_hw(local), skb, control); 1099 ret = local->ops->tx(local_to_hw(local), skb);
1094 if (ret) 1100 if (ret)
1095 return IEEE80211_TX_AGAIN; 1101 return IEEE80211_TX_AGAIN;
1096 local->mdev->trans_start = jiffies; 1102 local->mdev->trans_start = jiffies;
1097 ieee80211_led_tx(local, 1); 1103 ieee80211_led_tx(local, 1);
1098 } 1104 }
1099 if (tx->extra_frag) { 1105 if (tx->extra_frag) {
1100 control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS |
1101 IEEE80211_TXCTL_USE_CTS_PROTECT |
1102 IEEE80211_TXCTL_CLEAR_PS_FILT |
1103 IEEE80211_TXCTL_FIRST_FRAGMENT);
1104 for (i = 0; i < tx->num_extra_frag; i++) { 1106 for (i = 0; i < tx->num_extra_frag; i++) {
1105 if (!tx->extra_frag[i]) 1107 if (!tx->extra_frag[i])
1106 continue; 1108 continue;
1107 if (__ieee80211_queue_stopped(local, control->queue)) 1109 info = IEEE80211_SKB_CB(tx->extra_frag[i]);
1110 info->flags &= ~(IEEE80211_TX_CTL_USE_RTS_CTS |
1111 IEEE80211_TX_CTL_USE_CTS_PROTECT |
1112 IEEE80211_TX_CTL_CLEAR_PS_FILT |
1113 IEEE80211_TX_CTL_FIRST_FRAGMENT);
1114 if (__ieee80211_queue_stopped(local, info->queue))
1108 return IEEE80211_TX_FRAG_AGAIN; 1115 return IEEE80211_TX_FRAG_AGAIN;
1109 if (i == tx->num_extra_frag) { 1116 if (i == tx->num_extra_frag) {
1110 control->tx_rate_idx = tx->last_frag_rate_idx; 1117 info->tx_rate_idx = tx->last_frag_rate_idx;
1111 1118
1112 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) 1119 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG)
1113 control->flags |= 1120 info->flags |=
1114 IEEE80211_TXCTL_RATE_CTRL_PROBE; 1121 IEEE80211_TX_CTL_RATE_CTRL_PROBE;
1115 else 1122 else
1116 control->flags &= 1123 info->flags &=
1117 ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 1124 ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
1118 } 1125 }
1119 1126
1120 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1127 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1121 "TX to low-level driver", 1128 "TX to low-level driver",
1122 tx->extra_frag[i]); 1129 tx->extra_frag[i]);
1123 ret = local->ops->tx(local_to_hw(local), 1130 ret = local->ops->tx(local_to_hw(local),
1124 tx->extra_frag[i], 1131 tx->extra_frag[i]);
1125 control);
1126 if (ret) 1132 if (ret)
1127 return IEEE80211_TX_FRAG_AGAIN; 1133 return IEEE80211_TX_FRAG_AGAIN;
1128 local->mdev->trans_start = jiffies; 1134 local->mdev->trans_start = jiffies;
@@ -1135,17 +1141,18 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1135 return IEEE80211_TX_OK; 1141 return IEEE80211_TX_OK;
1136} 1142}
1137 1143
1138static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, 1144static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
1139 struct ieee80211_tx_control *control)
1140{ 1145{
1141 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1146 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1142 struct sta_info *sta; 1147 struct sta_info *sta;
1143 ieee80211_tx_handler *handler; 1148 ieee80211_tx_handler *handler;
1144 struct ieee80211_tx_data tx; 1149 struct ieee80211_tx_data tx;
1145 ieee80211_tx_result res = TX_DROP, res_prepare; 1150 ieee80211_tx_result res = TX_DROP, res_prepare;
1151 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1146 int ret, i; 1152 int ret, i;
1153 int queue = info->queue;
1147 1154
1148 WARN_ON(__ieee80211_queue_pending(local, control->queue)); 1155 WARN_ON(__ieee80211_queue_pending(local, queue));
1149 1156
1150 if (unlikely(skb->len < 10)) { 1157 if (unlikely(skb->len < 10)) {
1151 dev_kfree_skb(skb); 1158 dev_kfree_skb(skb);
@@ -1155,7 +1162,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1155 rcu_read_lock(); 1162 rcu_read_lock();
1156 1163
1157 /* initialises tx */ 1164 /* initialises tx */
1158 res_prepare = __ieee80211_tx_prepare(&tx, skb, dev, control); 1165 res_prepare = __ieee80211_tx_prepare(&tx, skb, dev);
1159 1166
1160 if (res_prepare == TX_DROP) { 1167 if (res_prepare == TX_DROP) {
1161 dev_kfree_skb(skb); 1168 dev_kfree_skb(skb);
@@ -1165,7 +1172,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1165 1172
1166 sta = tx.sta; 1173 sta = tx.sta;
1167 tx.channel = local->hw.conf.channel; 1174 tx.channel = local->hw.conf.channel;
1168 control->band = tx.channel->band; 1175 info->band = tx.channel->band;
1169 1176
1170 for (handler = ieee80211_tx_handlers; *handler != NULL; 1177 for (handler = ieee80211_tx_handlers; *handler != NULL;
1171 handler++) { 1178 handler++) {
@@ -1174,7 +1181,8 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1174 break; 1181 break;
1175 } 1182 }
1176 1183
1177 skb = tx.skb; /* handlers are allowed to change skb */ 1184 if (WARN_ON(tx.skb != skb))
1185 goto drop;
1178 1186
1179 if (unlikely(res == TX_DROP)) { 1187 if (unlikely(res == TX_DROP)) {
1180 I802_DEBUG_INC(local->tx_handlers_drop); 1188 I802_DEBUG_INC(local->tx_handlers_drop);
@@ -1209,12 +1217,12 @@ retry:
1209 ret = __ieee80211_tx(local, skb, &tx); 1217 ret = __ieee80211_tx(local, skb, &tx);
1210 if (ret) { 1218 if (ret) {
1211 struct ieee80211_tx_stored_packet *store = 1219 struct ieee80211_tx_stored_packet *store =
1212 &local->pending_packet[control->queue]; 1220 &local->pending_packet[info->queue];
1213 1221
1214 if (ret == IEEE80211_TX_FRAG_AGAIN) 1222 if (ret == IEEE80211_TX_FRAG_AGAIN)
1215 skb = NULL; 1223 skb = NULL;
1216 set_bit(IEEE80211_LINK_STATE_PENDING, 1224 set_bit(IEEE80211_LINK_STATE_PENDING,
1217 &local->state[control->queue]); 1225 &local->state[queue]);
1218 smp_mb(); 1226 smp_mb();
1219 /* When the driver gets out of buffers during sending of 1227 /* When the driver gets out of buffers during sending of
1220 * fragments and calls ieee80211_stop_queue, there is 1228 * fragments and calls ieee80211_stop_queue, there is
@@ -1225,13 +1233,11 @@ retry:
1225 * called with IEEE80211_LINK_STATE_PENDING. Prevent this by 1233 * called with IEEE80211_LINK_STATE_PENDING. Prevent this by
1226 * continuing transmitting here when that situation is 1234 * continuing transmitting here when that situation is
1227 * possible to have happened. */ 1235 * possible to have happened. */
1228 if (!__ieee80211_queue_stopped(local, control->queue)) { 1236 if (!__ieee80211_queue_stopped(local, queue)) {
1229 clear_bit(IEEE80211_LINK_STATE_PENDING, 1237 clear_bit(IEEE80211_LINK_STATE_PENDING,
1230 &local->state[control->queue]); 1238 &local->state[queue]);
1231 goto retry; 1239 goto retry;
1232 } 1240 }
1233 memcpy(&store->control, control,
1234 sizeof(struct ieee80211_tx_control));
1235 store->skb = skb; 1241 store->skb = skb;
1236 store->extra_frag = tx.extra_frag; 1242 store->extra_frag = tx.extra_frag;
1237 store->num_extra_frag = tx.num_extra_frag; 1243 store->num_extra_frag = tx.num_extra_frag;
@@ -1258,21 +1264,14 @@ retry:
1258int ieee80211_master_start_xmit(struct sk_buff *skb, 1264int ieee80211_master_start_xmit(struct sk_buff *skb,
1259 struct net_device *dev) 1265 struct net_device *dev)
1260{ 1266{
1261 struct ieee80211_tx_control control; 1267 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1262 struct ieee80211_tx_packet_data *pkt_data;
1263 struct net_device *odev = NULL; 1268 struct net_device *odev = NULL;
1264 struct ieee80211_sub_if_data *osdata; 1269 struct ieee80211_sub_if_data *osdata;
1265 int headroom; 1270 int headroom;
1266 int ret; 1271 int ret;
1267 1272
1268 /* 1273 if (info->control.ifindex)
1269 * copy control out of the skb so other people can use skb->cb 1274 odev = dev_get_by_index(&init_net, info->control.ifindex);
1270 */
1271 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1272 memset(&control, 0, sizeof(struct ieee80211_tx_control));
1273
1274 if (pkt_data->ifindex)
1275 odev = dev_get_by_index(&init_net, pkt_data->ifindex);
1276 if (unlikely(odev && !is_ieee80211_device(odev, dev))) { 1275 if (unlikely(odev && !is_ieee80211_device(odev, dev))) {
1277 dev_put(odev); 1276 dev_put(odev);
1278 odev = NULL; 1277 odev = NULL;
@@ -1285,6 +1284,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1285 dev_kfree_skb(skb); 1284 dev_kfree_skb(skb);
1286 return 0; 1285 return 0;
1287 } 1286 }
1287
1288 osdata = IEEE80211_DEV_TO_SUB_IF(odev); 1288 osdata = IEEE80211_DEV_TO_SUB_IF(odev);
1289 1289
1290 headroom = osdata->local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM; 1290 headroom = osdata->local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM;
@@ -1296,21 +1296,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1296 } 1296 }
1297 } 1297 }
1298 1298
1299 control.vif = &osdata->vif; 1299 info->control.vif = &osdata->vif;
1300 control.type = osdata->vif.type; 1300 ret = ieee80211_tx(odev, skb);
1301 if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS)
1302 control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS;
1303 if (pkt_data->flags & IEEE80211_TXPD_DO_NOT_ENCRYPT)
1304 control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
1305 if (pkt_data->flags & IEEE80211_TXPD_REQUEUE)
1306 control.flags |= IEEE80211_TXCTL_REQUEUE;
1307 if (pkt_data->flags & IEEE80211_TXPD_EAPOL_FRAME)
1308 control.flags |= IEEE80211_TXCTL_EAPOL_FRAME;
1309 if (pkt_data->flags & IEEE80211_TXPD_AMPDU)
1310 control.flags |= IEEE80211_TXCTL_AMPDU;
1311 control.queue = pkt_data->queue;
1312
1313 ret = ieee80211_tx(odev, skb, &control);
1314 dev_put(odev); 1301 dev_put(odev);
1315 1302
1316 return ret; 1303 return ret;
@@ -1320,7 +1307,7 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1320 struct net_device *dev) 1307 struct net_device *dev)
1321{ 1308{
1322 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1309 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1323 struct ieee80211_tx_packet_data *pkt_data; 1310 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1324 struct ieee80211_radiotap_header *prthdr = 1311 struct ieee80211_radiotap_header *prthdr =
1325 (struct ieee80211_radiotap_header *)skb->data; 1312 (struct ieee80211_radiotap_header *)skb->data;
1326 u16 len_rthdr; 1313 u16 len_rthdr;
@@ -1342,14 +1329,12 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1342 1329
1343 skb->dev = local->mdev; 1330 skb->dev = local->mdev;
1344 1331
1345 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
1346 memset(pkt_data, 0, sizeof(*pkt_data));
1347 /* needed because we set skb device to master */ 1332 /* needed because we set skb device to master */
1348 pkt_data->ifindex = dev->ifindex; 1333 info->control.ifindex = dev->ifindex;
1349 1334
1350 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; 1335 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
1351 /* Interfaces should always request a status report */ 1336 /* Interfaces should always request a status report */
1352 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; 1337 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1353 1338
1354 /* 1339 /*
1355 * fix up the pointers accounting for the radiotap 1340 * fix up the pointers accounting for the radiotap
@@ -1393,7 +1378,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1393 struct net_device *dev) 1378 struct net_device *dev)
1394{ 1379{
1395 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1380 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1396 struct ieee80211_tx_packet_data *pkt_data; 1381 struct ieee80211_tx_info *info;
1397 struct ieee80211_sub_if_data *sdata; 1382 struct ieee80211_sub_if_data *sdata;
1398 int ret = 1, head_need; 1383 int ret = 1, head_need;
1399 u16 ethertype, hdrlen, meshhdrlen = 0, fc; 1384 u16 ethertype, hdrlen, meshhdrlen = 0, fc;
@@ -1625,14 +1610,14 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1625 nh_pos += hdrlen; 1610 nh_pos += hdrlen;
1626 h_pos += hdrlen; 1611 h_pos += hdrlen;
1627 1612
1628 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; 1613 info = IEEE80211_SKB_CB(skb);
1629 memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); 1614 memset(info, 0, sizeof(*info));
1630 pkt_data->ifindex = dev->ifindex; 1615 info->control.ifindex = dev->ifindex;
1631 if (ethertype == ETH_P_PAE) 1616 if (ethertype == ETH_P_PAE)
1632 pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME; 1617 info->flags |= IEEE80211_TX_CTL_EAPOL_FRAME;
1633 1618
1634 /* Interfaces should always request a status report */ 1619 /* Interfaces should always request a status report */
1635 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; 1620 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1636 1621
1637 skb->dev = local->mdev; 1622 skb->dev = local->mdev;
1638 dev->stats.tx_packets++; 1623 dev->stats.tx_packets++;
@@ -1693,7 +1678,6 @@ void ieee80211_tx_pending(unsigned long data)
1693 continue; 1678 continue;
1694 } 1679 }
1695 store = &local->pending_packet[i]; 1680 store = &local->pending_packet[i];
1696 tx.control = &store->control;
1697 tx.extra_frag = store->extra_frag; 1681 tx.extra_frag = store->extra_frag;
1698 tx.num_extra_frag = store->num_extra_frag; 1682 tx.num_extra_frag = store->num_extra_frag;
1699 tx.last_frag_rate_idx = store->last_frag_rate_idx; 1683 tx.last_frag_rate_idx = store->last_frag_rate_idx;
@@ -1786,11 +1770,11 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local,
1786} 1770}
1787 1771
1788struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, 1772struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1789 struct ieee80211_vif *vif, 1773 struct ieee80211_vif *vif)
1790 struct ieee80211_tx_control *control)
1791{ 1774{
1792 struct ieee80211_local *local = hw_to_local(hw); 1775 struct ieee80211_local *local = hw_to_local(hw);
1793 struct sk_buff *skb; 1776 struct sk_buff *skb;
1777 struct ieee80211_tx_info *info;
1794 struct net_device *bdev; 1778 struct net_device *bdev;
1795 struct ieee80211_sub_if_data *sdata = NULL; 1779 struct ieee80211_sub_if_data *sdata = NULL;
1796 struct ieee80211_if_ap *ap = NULL; 1780 struct ieee80211_if_ap *ap = NULL;
@@ -1896,31 +1880,32 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1896 goto out; 1880 goto out;
1897 } 1881 }
1898 1882
1899 if (control) { 1883 info = IEEE80211_SKB_CB(skb);
1900 control->band = band; 1884
1901 rate_control_get_rate(local->mdev, sband, skb, &rsel); 1885 info->band = band;
1902 if (unlikely(rsel.rate_idx < 0)) { 1886 rate_control_get_rate(local->mdev, sband, skb, &rsel);
1903 if (net_ratelimit()) {
1904 printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
1905 "no rate found\n",
1906 wiphy_name(local->hw.wiphy));
1907 }
1908 dev_kfree_skb(skb);
1909 skb = NULL;
1910 goto out;
1911 }
1912 1887
1913 control->vif = vif; 1888 if (unlikely(rsel.rate_idx < 0)) {
1914 control->tx_rate_idx = rsel.rate_idx; 1889 if (net_ratelimit()) {
1915 if (sdata->bss_conf.use_short_preamble && 1890 printk(KERN_DEBUG "%s: ieee80211_beacon_get: "
1916 sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) 1891 "no rate found\n",
1917 control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 1892 wiphy_name(local->hw.wiphy));
1918 control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; 1893 }
1919 control->flags |= IEEE80211_TXCTL_NO_ACK; 1894 dev_kfree_skb(skb);
1920 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 1895 skb = NULL;
1921 control->retry_limit = 1; 1896 goto out;
1922 control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT;
1923 } 1897 }
1898
1899 info->control.vif = vif;
1900 info->tx_rate_idx = rsel.rate_idx;
1901 if (sdata->bss_conf.use_short_preamble &&
1902 sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE)
1903 info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
1904 info->antenna_sel_tx = local->hw.conf.antenna_sel_tx;
1905 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1906 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
1907 info->control.retry_limit = 1;
1908 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1924 (*num_beacons)++; 1909 (*num_beacons)++;
1925out: 1910out:
1926 rcu_read_unlock(); 1911 rcu_read_unlock();
@@ -1930,7 +1915,7 @@ EXPORT_SYMBOL(ieee80211_beacon_get);
1930 1915
1931void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1916void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1932 const void *frame, size_t frame_len, 1917 const void *frame, size_t frame_len,
1933 const struct ieee80211_tx_control *frame_txctl, 1918 const struct ieee80211_tx_info *frame_txctl,
1934 struct ieee80211_rts *rts) 1919 struct ieee80211_rts *rts)
1935{ 1920{
1936 const struct ieee80211_hdr *hdr = frame; 1921 const struct ieee80211_hdr *hdr = frame;
@@ -1947,7 +1932,7 @@ EXPORT_SYMBOL(ieee80211_rts_get);
1947 1932
1948void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1933void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1949 const void *frame, size_t frame_len, 1934 const void *frame, size_t frame_len,
1950 const struct ieee80211_tx_control *frame_txctl, 1935 const struct ieee80211_tx_info *frame_txctl,
1951 struct ieee80211_cts *cts) 1936 struct ieee80211_cts *cts)
1952{ 1937{
1953 const struct ieee80211_hdr *hdr = frame; 1938 const struct ieee80211_hdr *hdr = frame;
@@ -1963,8 +1948,7 @@ EXPORT_SYMBOL(ieee80211_ctstoself_get);
1963 1948
1964struct sk_buff * 1949struct sk_buff *
1965ieee80211_get_buffered_bc(struct ieee80211_hw *hw, 1950ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1966 struct ieee80211_vif *vif, 1951 struct ieee80211_vif *vif)
1967 struct ieee80211_tx_control *control)
1968{ 1952{
1969 struct ieee80211_local *local = hw_to_local(hw); 1953 struct ieee80211_local *local = hw_to_local(hw);
1970 struct sk_buff *skb; 1954 struct sk_buff *skb;
@@ -1976,6 +1960,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1976 struct ieee80211_sub_if_data *sdata; 1960 struct ieee80211_sub_if_data *sdata;
1977 struct ieee80211_if_ap *bss = NULL; 1961 struct ieee80211_if_ap *bss = NULL;
1978 struct beacon_data *beacon; 1962 struct beacon_data *beacon;
1963 struct ieee80211_tx_info *info;
1979 1964
1980 sdata = vif_to_sdata(vif); 1965 sdata = vif_to_sdata(vif);
1981 bdev = sdata->dev; 1966 bdev = sdata->dev;
@@ -1995,7 +1980,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1995 1980
1996 if (bss->dtim_count != 0) 1981 if (bss->dtim_count != 0)
1997 return NULL; /* send buffered bc/mc only after DTIM beacon */ 1982 return NULL; /* send buffered bc/mc only after DTIM beacon */
1998 memset(control, 0, sizeof(*control)); 1983
1999 while (1) { 1984 while (1) {
2000 skb = skb_dequeue(&bss->ps_bc_buf); 1985 skb = skb_dequeue(&bss->ps_bc_buf);
2001 if (!skb) 1986 if (!skb)
@@ -2012,21 +1997,26 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2012 cpu_to_le16(IEEE80211_FCTL_MOREDATA); 1997 cpu_to_le16(IEEE80211_FCTL_MOREDATA);
2013 } 1998 }
2014 1999
2015 if (!ieee80211_tx_prepare(&tx, skb, local->mdev, control)) 2000 if (!ieee80211_tx_prepare(&tx, skb, local->mdev))
2016 break; 2001 break;
2017 dev_kfree_skb_any(skb); 2002 dev_kfree_skb_any(skb);
2018 } 2003 }
2004
2005 info = IEEE80211_SKB_CB(skb);
2006
2019 sta = tx.sta; 2007 sta = tx.sta;
2020 tx.flags |= IEEE80211_TX_PS_BUFFERED; 2008 tx.flags |= IEEE80211_TX_PS_BUFFERED;
2021 tx.channel = local->hw.conf.channel; 2009 tx.channel = local->hw.conf.channel;
2022 control->band = tx.channel->band; 2010 info->band = tx.channel->band;
2023 2011
2024 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { 2012 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
2025 res = (*handler)(&tx); 2013 res = (*handler)(&tx);
2026 if (res == TX_DROP || res == TX_QUEUED) 2014 if (res == TX_DROP || res == TX_QUEUED)
2027 break; 2015 break;
2028 } 2016 }
2029 skb = tx.skb; /* handlers are allowed to change skb */ 2017
2018 if (WARN_ON(tx.skb != skb))
2019 return NULL;
2030 2020
2031 if (res == TX_DROP) { 2021 if (res == TX_DROP) {
2032 I802_DEBUG_INC(local->tx_handlers_drop); 2022 I802_DEBUG_INC(local->tx_handlers_drop);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 65a34fddeb00..d9109dee461f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -258,7 +258,7 @@ EXPORT_SYMBOL(ieee80211_generic_frame_duration);
258 258
259__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, 259__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
260 struct ieee80211_vif *vif, size_t frame_len, 260 struct ieee80211_vif *vif, size_t frame_len,
261 const struct ieee80211_tx_control *frame_txctl) 261 const struct ieee80211_tx_info *frame_txctl)
262{ 262{
263 struct ieee80211_local *local = hw_to_local(hw); 263 struct ieee80211_local *local = hw_to_local(hw);
264 struct ieee80211_rate *rate; 264 struct ieee80211_rate *rate;
@@ -272,7 +272,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
272 272
273 short_preamble = sdata->bss_conf.use_short_preamble; 273 short_preamble = sdata->bss_conf.use_short_preamble;
274 274
275 rate = &sband->bitrates[frame_txctl->rts_cts_rate_idx]; 275 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx];
276 276
277 erp = 0; 277 erp = 0;
278 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) 278 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
@@ -295,7 +295,7 @@ EXPORT_SYMBOL(ieee80211_rts_duration);
295__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, 295__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
296 struct ieee80211_vif *vif, 296 struct ieee80211_vif *vif,
297 size_t frame_len, 297 size_t frame_len,
298 const struct ieee80211_tx_control *frame_txctl) 298 const struct ieee80211_tx_info *frame_txctl)
299{ 299{
300 struct ieee80211_local *local = hw_to_local(hw); 300 struct ieee80211_local *local = hw_to_local(hw);
301 struct ieee80211_rate *rate; 301 struct ieee80211_rate *rate;
@@ -309,7 +309,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
309 309
310 short_preamble = sdata->bss_conf.use_short_preamble; 310 short_preamble = sdata->bss_conf.use_short_preamble;
311 311
312 rate = &sband->bitrates[frame_txctl->rts_cts_rate_idx]; 312 rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx];
313 erp = 0; 313 erp = 0;
314 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) 314 if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
315 erp = rate->flags & IEEE80211_RATE_ERP_G; 315 erp = rate->flags & IEEE80211_RATE_ERP_G;
@@ -317,7 +317,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
317 /* Data frame duration */ 317 /* Data frame duration */
318 dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, 318 dur = ieee80211_frame_duration(local, frame_len, rate->bitrate,
319 erp, short_preamble); 319 erp, short_preamble);
320 if (!(frame_txctl->flags & IEEE80211_TXCTL_NO_ACK)) { 320 if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) {
321 /* ACK duration */ 321 /* ACK duration */
322 dur += ieee80211_frame_duration(local, 10, rate->bitrate, 322 dur += ieee80211_frame_duration(local, 10, rate->bitrate,
323 erp, short_preamble); 323 erp, short_preamble);
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 3cbae42ec504..1e7f03dd8f6b 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -333,11 +333,16 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
333 333
334static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) 334static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
335{ 335{
336 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
337
338 info->control.iv_len = WEP_IV_LEN;
339 info->control.icv_len = WEP_ICV_LEN;
340
336 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { 341 if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
342 info->control.hw_key = &tx->key->conf;
337 if (ieee80211_wep_encrypt(tx->local, skb, tx->key)) 343 if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
338 return -1; 344 return -1;
339 } else { 345 } else {
340 tx->control->hw_key = &tx->key->conf;
341 if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) { 346 if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
342 if (!ieee80211_wep_add_iv(tx->local, skb, tx->key)) 347 if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
343 return -1; 348 return -1;
@@ -349,8 +354,6 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
349ieee80211_tx_result 354ieee80211_tx_result
350ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) 355ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx)
351{ 356{
352 tx->control->iv_len = WEP_IV_LEN;
353 tx->control->icv_len = WEP_ICV_LEN;
354 ieee80211_tx_set_protected(tx); 357 ieee80211_tx_set_protected(tx);
355 358
356 if (wep_encrypt_skb(tx, tx->skb) < 0) { 359 if (wep_encrypt_skb(tx, tx->skb) < 0) {
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index c87baf4ce979..477690f4dca7 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -149,8 +149,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
149 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 149 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
150 struct ieee80211_hw *hw = &local->hw; 150 struct ieee80211_hw *hw = &local->hw;
151 struct ieee80211_sched_data *q = qdisc_priv(qd); 151 struct ieee80211_sched_data *q = qdisc_priv(qd);
152 struct ieee80211_tx_packet_data *pkt_data = 152 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
153 (struct ieee80211_tx_packet_data *) skb->cb;
154 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 153 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
155 unsigned short fc = le16_to_cpu(hdr->frame_control); 154 unsigned short fc = le16_to_cpu(hdr->frame_control);
156 struct Qdisc *qdisc; 155 struct Qdisc *qdisc;
@@ -158,8 +157,8 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
158 int err, queue; 157 int err, queue;
159 u8 tid; 158 u8 tid;
160 159
161 if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) { 160 if (info->flags & IEEE80211_TX_CTL_REQUEUE) {
162 queue = pkt_data->queue; 161 queue = info->queue;
163 rcu_read_lock(); 162 rcu_read_lock();
164 sta = sta_info_get(local, hdr->addr1); 163 sta = sta_info_get(local, hdr->addr1);
165 tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 164 tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
@@ -168,9 +167,9 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
168 if ((ampdu_queue < QD_NUM(hw)) && 167 if ((ampdu_queue < QD_NUM(hw)) &&
169 test_bit(ampdu_queue, q->qdisc_pool)) { 168 test_bit(ampdu_queue, q->qdisc_pool)) {
170 queue = ampdu_queue; 169 queue = ampdu_queue;
171 pkt_data->flags |= IEEE80211_TXPD_AMPDU; 170 info->flags |= IEEE80211_TX_CTL_AMPDU;
172 } else { 171 } else {
173 pkt_data->flags &= ~IEEE80211_TXPD_AMPDU; 172 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
174 } 173 }
175 } 174 }
176 rcu_read_unlock(); 175 rcu_read_unlock();
@@ -206,9 +205,9 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
206 if ((ampdu_queue < QD_NUM(hw)) && 205 if ((ampdu_queue < QD_NUM(hw)) &&
207 test_bit(ampdu_queue, q->qdisc_pool)) { 206 test_bit(ampdu_queue, q->qdisc_pool)) {
208 queue = ampdu_queue; 207 queue = ampdu_queue;
209 pkt_data->flags |= IEEE80211_TXPD_AMPDU; 208 info->flags |= IEEE80211_TX_CTL_AMPDU;
210 } else { 209 } else {
211 pkt_data->flags &= ~IEEE80211_TXPD_AMPDU; 210 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
212 } 211 }
213 } 212 }
214 213
@@ -220,7 +219,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
220 err = NET_XMIT_DROP; 219 err = NET_XMIT_DROP;
221 } else { 220 } else {
222 tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 221 tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
223 pkt_data->queue = (unsigned int) queue; 222 info->queue = (unsigned int) queue;
224 qdisc = q->queues[queue]; 223 qdisc = q->queues[queue];
225 err = qdisc->enqueue(skb, qdisc); 224 err = qdisc->enqueue(skb, qdisc);
226 if (err == NET_XMIT_SUCCESS) { 225 if (err == NET_XMIT_SUCCESS) {
@@ -241,13 +240,12 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
241static int wme_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd) 240static int wme_qdiscop_requeue(struct sk_buff *skb, struct Qdisc* qd)
242{ 241{
243 struct ieee80211_sched_data *q = qdisc_priv(qd); 242 struct ieee80211_sched_data *q = qdisc_priv(qd);
244 struct ieee80211_tx_packet_data *pkt_data = 243 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
245 (struct ieee80211_tx_packet_data *) skb->cb;
246 struct Qdisc *qdisc; 244 struct Qdisc *qdisc;
247 int err; 245 int err;
248 246
249 /* we recorded which queue to use earlier! */ 247 /* we recorded which queue to use earlier! */
250 qdisc = q->queues[pkt_data->queue]; 248 qdisc = q->queues[info->queue];
251 249
252 if ((err = qdisc->ops->requeue(skb, qdisc)) == 0) { 250 if ((err = qdisc->ops->requeue(skb, qdisc)) == 0) {
253 qd->q.qlen++; 251 qd->q.qlen++;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index d7304490d2ec..d6635f6e5618 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -183,15 +183,25 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
183} 183}
184 184
185 185
186static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, 186static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
187 struct sk_buff *skb, int test)
188{ 187{
189 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 188 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
190 struct ieee80211_key *key = tx->key; 189 struct ieee80211_key *key = tx->key;
190 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
191 int hdrlen, len, tailneed; 191 int hdrlen, len, tailneed;
192 u16 fc; 192 u16 fc;
193 u8 *pos; 193 u8 *pos;
194 194
195 info->control.icv_len = TKIP_ICV_LEN;
196 info->control.iv_len = TKIP_IV_LEN;
197
198 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
199 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
200 /* hwaccel - with no need for preallocated room for IV/ICV */
201 info->control.hw_key = &tx->key->conf;
202 return TX_CONTINUE;
203 }
204
195 fc = le16_to_cpu(hdr->frame_control); 205 fc = le16_to_cpu(hdr->frame_control);
196 hdrlen = ieee80211_get_hdrlen(fc); 206 hdrlen = ieee80211_get_hdrlen(fc);
197 len = skb->len - hdrlen; 207 len = skb->len - hdrlen;
@@ -228,7 +238,7 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx,
228 0x7f), 238 0x7f),
229 (u8) key->u.tkip.tx.iv16); 239 (u8) key->u.tkip.tx.iv16);
230 240
231 tx->control->hw_key = &tx->key->conf; 241 info->control.hw_key = &tx->key->conf;
232 return 0; 242 return 0;
233 } 243 }
234 244
@@ -246,28 +256,16 @@ ieee80211_tx_result
246ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) 256ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx)
247{ 257{
248 struct sk_buff *skb = tx->skb; 258 struct sk_buff *skb = tx->skb;
249 int wpa_test = 0, test = 0;
250 259
251 tx->control->icv_len = TKIP_ICV_LEN;
252 tx->control->iv_len = TKIP_IV_LEN;
253 ieee80211_tx_set_protected(tx); 260 ieee80211_tx_set_protected(tx);
254 261
255 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 262 if (tkip_encrypt_skb(tx, skb) < 0)
256 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
257 !wpa_test) {
258 /* hwaccel - with no need for preallocated room for IV/ICV */
259 tx->control->hw_key = &tx->key->conf;
260 return TX_CONTINUE;
261 }
262
263 if (tkip_encrypt_skb(tx, skb, test) < 0)
264 return TX_DROP; 263 return TX_DROP;
265 264
266 if (tx->extra_frag) { 265 if (tx->extra_frag) {
267 int i; 266 int i;
268 for (i = 0; i < tx->num_extra_frag; i++) { 267 for (i = 0; i < tx->num_extra_frag; i++) {
269 if (tkip_encrypt_skb(tx, tx->extra_frag[i], test) 268 if (tkip_encrypt_skb(tx, tx->extra_frag[i]) < 0)
270 < 0)
271 return TX_DROP; 269 return TX_DROP;
272 } 270 }
273 } 271 }
@@ -429,16 +427,27 @@ static inline int ccmp_hdr2pn(u8 *pn, u8 *hdr)
429} 427}
430 428
431 429
432static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, 430static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
433 struct sk_buff *skb, int test)
434{ 431{
435 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 432 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
436 struct ieee80211_key *key = tx->key; 433 struct ieee80211_key *key = tx->key;
434 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
437 int hdrlen, len, tailneed; 435 int hdrlen, len, tailneed;
438 u16 fc; 436 u16 fc;
439 u8 *pos, *pn, *b_0, *aad, *scratch; 437 u8 *pos, *pn, *b_0, *aad, *scratch;
440 int i; 438 int i;
441 439
440 info->control.icv_len = CCMP_MIC_LEN;
441 info->control.iv_len = CCMP_HDR_LEN;
442
443 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
444 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
445 /* hwaccel - with no need for preallocated room for CCMP "
446 * header or MIC fields */
447 info->control.hw_key = &tx->key->conf;
448 return TX_CONTINUE;
449 }
450
442 scratch = key->u.ccmp.tx_crypto_buf; 451 scratch = key->u.ccmp.tx_crypto_buf;
443 b_0 = scratch + 3 * AES_BLOCK_LEN; 452 b_0 = scratch + 3 * AES_BLOCK_LEN;
444 aad = scratch + 4 * AES_BLOCK_LEN; 453 aad = scratch + 4 * AES_BLOCK_LEN;
@@ -478,7 +487,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx,
478 487
479 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { 488 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
480 /* hwaccel - with preallocated room for CCMP header */ 489 /* hwaccel - with preallocated room for CCMP header */
481 tx->control->hw_key = &tx->key->conf; 490 info->control.hw_key = &tx->key->conf;
482 return 0; 491 return 0;
483 } 492 }
484 493
@@ -495,28 +504,16 @@ ieee80211_tx_result
495ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) 504ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx)
496{ 505{
497 struct sk_buff *skb = tx->skb; 506 struct sk_buff *skb = tx->skb;
498 int test = 0;
499 507
500 tx->control->icv_len = CCMP_MIC_LEN;
501 tx->control->iv_len = CCMP_HDR_LEN;
502 ieee80211_tx_set_protected(tx); 508 ieee80211_tx_set_protected(tx);
503 509
504 if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && 510 if (ccmp_encrypt_skb(tx, skb) < 0)
505 !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
506 /* hwaccel - with no need for preallocated room for CCMP "
507 * header or MIC fields */
508 tx->control->hw_key = &tx->key->conf;
509 return TX_CONTINUE;
510 }
511
512 if (ccmp_encrypt_skb(tx, skb, test) < 0)
513 return TX_DROP; 511 return TX_DROP;
514 512
515 if (tx->extra_frag) { 513 if (tx->extra_frag) {
516 int i; 514 int i;
517 for (i = 0; i < tx->num_extra_frag; i++) { 515 for (i = 0; i < tx->num_extra_frag; i++) {
518 if (ccmp_encrypt_skb(tx, tx->extra_frag[i], test) 516 if (ccmp_encrypt_skb(tx, tx->extra_frag[i]) < 0)
519 < 0)
520 return TX_DROP; 517 return TX_DROP;
521 } 518 }
522 } 519 }