diff options
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 187 |
1 files changed, 94 insertions, 93 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index c413d4836afe..20d683641b42 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -38,43 +38,6 @@ | |||
38 | 38 | ||
39 | /* misc utils */ | 39 | /* misc utils */ |
40 | 40 | ||
41 | #ifdef CONFIG_MAC80211_LOWTX_FRAME_DUMP | ||
42 | static void ieee80211_dump_frame(const char *ifname, const char *title, | ||
43 | const struct sk_buff *skb) | ||
44 | { | ||
45 | const struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
46 | unsigned int hdrlen; | ||
47 | DECLARE_MAC_BUF(mac); | ||
48 | |||
49 | printk(KERN_DEBUG "%s: %s (len=%d)", ifname, title, skb->len); | ||
50 | if (skb->len < 4) { | ||
51 | printk("\n"); | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
56 | if (hdrlen > skb->len) | ||
57 | hdrlen = skb->len; | ||
58 | if (hdrlen >= 4) | ||
59 | printk(" FC=0x%04x DUR=0x%04x", | ||
60 | le16_to_cpu(hdr->frame_control), le16_to_cpu(hdr->duration_id)); | ||
61 | if (hdrlen >= 10) | ||
62 | printk(" A1=%s", print_mac(mac, hdr->addr1)); | ||
63 | if (hdrlen >= 16) | ||
64 | printk(" A2=%s", print_mac(mac, hdr->addr2)); | ||
65 | if (hdrlen >= 24) | ||
66 | printk(" A3=%s", print_mac(mac, hdr->addr3)); | ||
67 | if (hdrlen >= 30) | ||
68 | printk(" A4=%s", print_mac(mac, hdr->addr4)); | ||
69 | printk("\n"); | ||
70 | } | ||
71 | #else /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ | ||
72 | static inline void ieee80211_dump_frame(const char *ifname, const char *title, | ||
73 | struct sk_buff *skb) | ||
74 | { | ||
75 | } | ||
76 | #endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ | ||
77 | |||
78 | static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | 41 | static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, |
79 | int next_frag_len) | 42 | int next_frag_len) |
80 | { | 43 | { |
@@ -111,7 +74,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
111 | hdr = (struct ieee80211_hdr *)tx->skb->data; | 74 | hdr = (struct ieee80211_hdr *)tx->skb->data; |
112 | if (ieee80211_is_ctl(hdr->frame_control)) { | 75 | if (ieee80211_is_ctl(hdr->frame_control)) { |
113 | /* TODO: These control frames are not currently sent by | 76 | /* TODO: These control frames are not currently sent by |
114 | * 80211.o, but should they be implemented, this function | 77 | * mac80211, but should they be implemented, this function |
115 | * needs to be updated to support duration field calculation. | 78 | * needs to be updated to support duration field calculation. |
116 | * | 79 | * |
117 | * RTS: time needed to transmit pending data/mgmt frame plus | 80 | * RTS: time needed to transmit pending data/mgmt frame plus |
@@ -153,7 +116,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
153 | if (r->bitrate > txrate->bitrate) | 116 | if (r->bitrate > txrate->bitrate) |
154 | break; | 117 | break; |
155 | 118 | ||
156 | if (tx->sdata->basic_rates & BIT(i)) | 119 | if (tx->sdata->bss_conf.basic_rates & BIT(i)) |
157 | rate = r->bitrate; | 120 | rate = r->bitrate; |
158 | 121 | ||
159 | switch (sband->band) { | 122 | switch (sband->band) { |
@@ -222,11 +185,11 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
222 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) | 185 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) |
223 | return TX_CONTINUE; | 186 | return TX_CONTINUE; |
224 | 187 | ||
225 | if (unlikely(tx->local->sta_sw_scanning) && | 188 | if (unlikely(tx->local->sw_scanning) && |
226 | !ieee80211_is_probe_req(hdr->frame_control)) | 189 | !ieee80211_is_probe_req(hdr->frame_control)) |
227 | return TX_DROP; | 190 | return TX_DROP; |
228 | 191 | ||
229 | if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) | 192 | if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) |
230 | return TX_CONTINUE; | 193 | return TX_CONTINUE; |
231 | 194 | ||
232 | if (tx->flags & IEEE80211_TX_PS_BUFFERED) | 195 | if (tx->flags & IEEE80211_TX_PS_BUFFERED) |
@@ -236,7 +199,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
236 | 199 | ||
237 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { | 200 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { |
238 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && | 201 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && |
239 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 202 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && |
240 | ieee80211_is_data(hdr->frame_control))) { | 203 | ieee80211_is_data(hdr->frame_control))) { |
241 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 204 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
242 | DECLARE_MAC_BUF(mac); | 205 | DECLARE_MAC_BUF(mac); |
@@ -250,7 +213,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
250 | } else { | 213 | } else { |
251 | if (unlikely(ieee80211_is_data(hdr->frame_control) && | 214 | if (unlikely(ieee80211_is_data(hdr->frame_control) && |
252 | tx->local->num_sta == 0 && | 215 | tx->local->num_sta == 0 && |
253 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS)) { | 216 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC)) { |
254 | /* | 217 | /* |
255 | * No associated STAs - no need to send multicast | 218 | * No associated STAs - no need to send multicast |
256 | * frames. | 219 | * frames. |
@@ -281,7 +244,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
281 | 244 | ||
282 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | 245 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
283 | struct ieee80211_if_ap *ap; | 246 | struct ieee80211_if_ap *ap; |
284 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP) | 247 | if (sdata->vif.type != NL80211_IFTYPE_AP) |
285 | continue; | 248 | continue; |
286 | ap = &sdata->u.ap; | 249 | ap = &sdata->u.ap; |
287 | skb = skb_dequeue(&ap->ps_bc_buf); | 250 | skb = skb_dequeue(&ap->ps_bc_buf); |
@@ -381,7 +344,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
381 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 344 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
382 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " | 345 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " |
383 | "before %d)\n", | 346 | "before %d)\n", |
384 | print_mac(mac, sta->addr), sta->aid, | 347 | print_mac(mac, sta->sta.addr), sta->sta.aid, |
385 | skb_queue_len(&sta->ps_tx_buf)); | 348 | skb_queue_len(&sta->ps_tx_buf)); |
386 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 349 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
387 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 350 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
@@ -392,7 +355,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
392 | if (net_ratelimit()) { | 355 | if (net_ratelimit()) { |
393 | printk(KERN_DEBUG "%s: STA %s TX " | 356 | printk(KERN_DEBUG "%s: STA %s TX " |
394 | "buffer full - dropping oldest frame\n", | 357 | "buffer full - dropping oldest frame\n", |
395 | tx->dev->name, print_mac(mac, sta->addr)); | 358 | tx->dev->name, print_mac(mac, sta->sta.addr)); |
396 | } | 359 | } |
397 | #endif | 360 | #endif |
398 | dev_kfree_skb(old); | 361 | dev_kfree_skb(old); |
@@ -411,7 +374,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
411 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { | 374 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { |
412 | printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " | 375 | printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " |
413 | "set -> send frame\n", tx->dev->name, | 376 | "set -> send frame\n", tx->dev->name, |
414 | print_mac(mac, sta->addr)); | 377 | print_mac(mac, sta->sta.addr)); |
415 | } | 378 | } |
416 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 379 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
417 | clear_sta_flags(sta, WLAN_STA_PSPOLL); | 380 | clear_sta_flags(sta, WLAN_STA_PSPOLL); |
@@ -485,6 +448,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
485 | 448 | ||
486 | if (likely(tx->rate_idx < 0)) { | 449 | if (likely(tx->rate_idx < 0)) { |
487 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); | 450 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); |
451 | if (tx->sta) | ||
452 | tx->sta->last_txrate_idx = rsel.rate_idx; | ||
488 | tx->rate_idx = rsel.rate_idx; | 453 | tx->rate_idx = rsel.rate_idx; |
489 | if (unlikely(rsel.probe_idx >= 0)) { | 454 | if (unlikely(rsel.probe_idx >= 0)) { |
490 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 455 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
@@ -528,7 +493,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
528 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 493 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
529 | 494 | ||
530 | if (tx->sta) | 495 | if (tx->sta) |
531 | info->control.aid = tx->sta->aid; | 496 | info->control.sta = &tx->sta->sta; |
532 | 497 | ||
533 | if (!info->control.retry_limit) { | 498 | if (!info->control.retry_limit) { |
534 | if (!is_multicast_ether_addr(hdr->addr1)) { | 499 | if (!is_multicast_ether_addr(hdr->addr1)) { |
@@ -594,7 +559,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
594 | for (idx = 0; idx < sband->n_bitrates; idx++) { | 559 | for (idx = 0; idx < sband->n_bitrates; idx++) { |
595 | if (sband->bitrates[idx].bitrate > rate->bitrate) | 560 | if (sband->bitrates[idx].bitrate > rate->bitrate) |
596 | continue; | 561 | continue; |
597 | if (tx->sdata->basic_rates & BIT(idx) && | 562 | if (tx->sdata->bss_conf.basic_rates & BIT(idx) && |
598 | (baserate < 0 || | 563 | (baserate < 0 || |
599 | (sband->bitrates[baserate].bitrate | 564 | (sband->bitrates[baserate].bitrate |
600 | < sband->bitrates[idx].bitrate))) | 565 | < sband->bitrates[idx].bitrate))) |
@@ -608,7 +573,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
608 | } | 573 | } |
609 | 574 | ||
610 | if (tx->sta) | 575 | if (tx->sta) |
611 | info->control.aid = tx->sta->aid; | 576 | info->control.sta = &tx->sta->sta; |
612 | 577 | ||
613 | return TX_CONTINUE; | 578 | return TX_CONTINUE; |
614 | } | 579 | } |
@@ -622,7 +587,14 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
622 | u8 *qc; | 587 | u8 *qc; |
623 | int tid; | 588 | int tid; |
624 | 589 | ||
625 | /* only for injected frames */ | 590 | /* |
591 | * Packet injection may want to control the sequence | ||
592 | * number, if we have no matching interface then we | ||
593 | * neither assign one ourselves nor ask the driver to. | ||
594 | */ | ||
595 | if (unlikely(!info->control.vif)) | ||
596 | return TX_CONTINUE; | ||
597 | |||
626 | if (unlikely(ieee80211_is_ctl(hdr->frame_control))) | 598 | if (unlikely(ieee80211_is_ctl(hdr->frame_control))) |
627 | return TX_CONTINUE; | 599 | return TX_CONTINUE; |
628 | 600 | ||
@@ -847,7 +819,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
847 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 819 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
848 | 820 | ||
849 | skb->do_not_encrypt = 1; | 821 | skb->do_not_encrypt = 1; |
850 | info->flags |= IEEE80211_TX_CTL_INJECTED; | ||
851 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; | 822 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; |
852 | 823 | ||
853 | /* | 824 | /* |
@@ -979,7 +950,7 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
979 | 950 | ||
980 | /* process and remove the injection radiotap header */ | 951 | /* process and remove the injection radiotap header */ |
981 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 952 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
982 | if (unlikely(sdata->vif.type == IEEE80211_IF_TYPE_MNTR)) { | 953 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) { |
983 | if (__ieee80211_parse_tx_radiotap(tx, skb) == TX_DROP) | 954 | if (__ieee80211_parse_tx_radiotap(tx, skb) == TX_DROP) |
984 | return TX_DROP; | 955 | return TX_DROP; |
985 | 956 | ||
@@ -1060,8 +1031,6 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1060 | return IEEE80211_TX_AGAIN; | 1031 | return IEEE80211_TX_AGAIN; |
1061 | info = IEEE80211_SKB_CB(skb); | 1032 | info = IEEE80211_SKB_CB(skb); |
1062 | 1033 | ||
1063 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | ||
1064 | "TX to low-level driver", skb); | ||
1065 | ret = local->ops->tx(local_to_hw(local), skb); | 1034 | ret = local->ops->tx(local_to_hw(local), skb); |
1066 | if (ret) | 1035 | if (ret) |
1067 | return IEEE80211_TX_AGAIN; | 1036 | return IEEE80211_TX_AGAIN; |
@@ -1091,9 +1060,6 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1091 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 1060 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
1092 | } | 1061 | } |
1093 | 1062 | ||
1094 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | ||
1095 | "TX to low-level driver", | ||
1096 | tx->extra_frag[i]); | ||
1097 | ret = local->ops->tx(local_to_hw(local), | 1063 | ret = local->ops->tx(local_to_hw(local), |
1098 | tx->extra_frag[i]); | 1064 | tx->extra_frag[i]); |
1099 | if (ret) | 1065 | if (ret) |
@@ -1298,6 +1264,11 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1298 | struct ieee80211_sub_if_data *osdata; | 1264 | struct ieee80211_sub_if_data *osdata; |
1299 | int headroom; | 1265 | int headroom; |
1300 | bool may_encrypt; | 1266 | bool may_encrypt; |
1267 | enum { | ||
1268 | NOT_MONITOR, | ||
1269 | FOUND_SDATA, | ||
1270 | UNKNOWN_ADDRESS, | ||
1271 | } monitor_iface = NOT_MONITOR; | ||
1301 | int ret; | 1272 | int ret; |
1302 | 1273 | ||
1303 | if (skb->iif) | 1274 | if (skb->iif) |
@@ -1330,9 +1301,53 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1330 | if (mesh_nexthop_lookup(skb, osdata)) | 1301 | if (mesh_nexthop_lookup(skb, osdata)) |
1331 | return 0; | 1302 | return 0; |
1332 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) | 1303 | if (memcmp(odev->dev_addr, hdr->addr4, ETH_ALEN) != 0) |
1333 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.sta, | 1304 | IEEE80211_IFSTA_MESH_CTR_INC(&osdata->u.mesh, |
1334 | fwded_frames); | 1305 | fwded_frames); |
1335 | } | 1306 | } |
1307 | } else if (unlikely(osdata->vif.type == NL80211_IFTYPE_MONITOR)) { | ||
1308 | struct ieee80211_sub_if_data *sdata; | ||
1309 | struct ieee80211_local *local = osdata->local; | ||
1310 | struct ieee80211_hdr *hdr; | ||
1311 | int hdrlen; | ||
1312 | u16 len_rthdr; | ||
1313 | |||
1314 | info->flags |= IEEE80211_TX_CTL_INJECTED; | ||
1315 | monitor_iface = UNKNOWN_ADDRESS; | ||
1316 | |||
1317 | len_rthdr = ieee80211_get_radiotap_len(skb->data); | ||
1318 | hdr = (struct ieee80211_hdr *)skb->data + len_rthdr; | ||
1319 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | ||
1320 | |||
1321 | /* check the header is complete in the frame */ | ||
1322 | if (likely(skb->len >= len_rthdr + hdrlen)) { | ||
1323 | /* | ||
1324 | * We process outgoing injected frames that have a | ||
1325 | * local address we handle as though they are our | ||
1326 | * own frames. | ||
1327 | * This code here isn't entirely correct, the local | ||
1328 | * MAC address is not necessarily enough to find | ||
1329 | * the interface to use; for that proper VLAN/WDS | ||
1330 | * support we will need a different mechanism. | ||
1331 | */ | ||
1332 | |||
1333 | rcu_read_lock(); | ||
1334 | list_for_each_entry_rcu(sdata, &local->interfaces, | ||
1335 | list) { | ||
1336 | if (!netif_running(sdata->dev)) | ||
1337 | continue; | ||
1338 | if (compare_ether_addr(sdata->dev->dev_addr, | ||
1339 | hdr->addr2)) { | ||
1340 | dev_hold(sdata->dev); | ||
1341 | dev_put(odev); | ||
1342 | osdata = sdata; | ||
1343 | odev = osdata->dev; | ||
1344 | skb->iif = sdata->dev->ifindex; | ||
1345 | monitor_iface = FOUND_SDATA; | ||
1346 | break; | ||
1347 | } | ||
1348 | } | ||
1349 | rcu_read_unlock(); | ||
1350 | } | ||
1336 | } | 1351 | } |
1337 | 1352 | ||
1338 | may_encrypt = !skb->do_not_encrypt; | 1353 | may_encrypt = !skb->do_not_encrypt; |
@@ -1349,7 +1364,12 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1349 | return 0; | 1364 | return 0; |
1350 | } | 1365 | } |
1351 | 1366 | ||
1352 | info->control.vif = &osdata->vif; | 1367 | if (osdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
1368 | osdata = container_of(osdata->bss, | ||
1369 | struct ieee80211_sub_if_data, | ||
1370 | u.ap); | ||
1371 | if (likely(monitor_iface != UNKNOWN_ADDRESS)) | ||
1372 | info->control.vif = &osdata->vif; | ||
1353 | ret = ieee80211_tx(odev, skb); | 1373 | ret = ieee80211_tx(odev, skb); |
1354 | dev_put(odev); | 1374 | dev_put(odev); |
1355 | 1375 | ||
@@ -1457,8 +1477,8 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1457 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); | 1477 | fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); |
1458 | 1478 | ||
1459 | switch (sdata->vif.type) { | 1479 | switch (sdata->vif.type) { |
1460 | case IEEE80211_IF_TYPE_AP: | 1480 | case NL80211_IFTYPE_AP: |
1461 | case IEEE80211_IF_TYPE_VLAN: | 1481 | case NL80211_IFTYPE_AP_VLAN: |
1462 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); | 1482 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); |
1463 | /* DA BSSID SA */ | 1483 | /* DA BSSID SA */ |
1464 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1484 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
@@ -1466,7 +1486,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1466 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); | 1486 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); |
1467 | hdrlen = 24; | 1487 | hdrlen = 24; |
1468 | break; | 1488 | break; |
1469 | case IEEE80211_IF_TYPE_WDS: | 1489 | case NL80211_IFTYPE_WDS: |
1470 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1490 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1471 | /* RA TA DA SA */ | 1491 | /* RA TA DA SA */ |
1472 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); | 1492 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); |
@@ -1476,16 +1496,16 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1476 | hdrlen = 30; | 1496 | hdrlen = 30; |
1477 | break; | 1497 | break; |
1478 | #ifdef CONFIG_MAC80211_MESH | 1498 | #ifdef CONFIG_MAC80211_MESH |
1479 | case IEEE80211_IF_TYPE_MESH_POINT: | 1499 | case NL80211_IFTYPE_MESH_POINT: |
1480 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1500 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1481 | /* RA TA DA SA */ | 1501 | /* RA TA DA SA */ |
1482 | memset(hdr.addr1, 0, ETH_ALEN); | 1502 | memset(hdr.addr1, 0, ETH_ALEN); |
1483 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1503 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); |
1484 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1504 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1485 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1505 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1486 | if (!sdata->u.sta.mshcfg.dot11MeshTTL) { | 1506 | if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { |
1487 | /* Do not send frames with mesh_ttl == 0 */ | 1507 | /* Do not send frames with mesh_ttl == 0 */ |
1488 | sdata->u.sta.mshstats.dropped_frames_ttl++; | 1508 | sdata->u.mesh.mshstats.dropped_frames_ttl++; |
1489 | ret = 0; | 1509 | ret = 0; |
1490 | goto fail; | 1510 | goto fail; |
1491 | } | 1511 | } |
@@ -1493,7 +1513,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1493 | hdrlen = 30; | 1513 | hdrlen = 30; |
1494 | break; | 1514 | break; |
1495 | #endif | 1515 | #endif |
1496 | case IEEE80211_IF_TYPE_STA: | 1516 | case NL80211_IFTYPE_STATION: |
1497 | fc |= cpu_to_le16(IEEE80211_FCTL_TODS); | 1517 | fc |= cpu_to_le16(IEEE80211_FCTL_TODS); |
1498 | /* BSSID SA DA */ | 1518 | /* BSSID SA DA */ |
1499 | memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN); | 1519 | memcpy(hdr.addr1, sdata->u.sta.bssid, ETH_ALEN); |
@@ -1501,7 +1521,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1501 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1521 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1502 | hdrlen = 24; | 1522 | hdrlen = 24; |
1503 | break; | 1523 | break; |
1504 | case IEEE80211_IF_TYPE_IBSS: | 1524 | case NL80211_IFTYPE_ADHOC: |
1505 | /* DA SA BSSID */ | 1525 | /* DA SA BSSID */ |
1506 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1526 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
1507 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 1527 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); |
@@ -1580,19 +1600,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1580 | nh_pos -= skip_header_bytes; | 1600 | nh_pos -= skip_header_bytes; |
1581 | h_pos -= skip_header_bytes; | 1601 | h_pos -= skip_header_bytes; |
1582 | 1602 | ||
1583 | /* TODO: implement support for fragments so that there is no need to | ||
1584 | * reallocate and copy payload; it might be enough to support one | ||
1585 | * extra fragment that would be copied in the beginning of the frame | ||
1586 | * data.. anyway, it would be nice to include this into skb structure | ||
1587 | * somehow | ||
1588 | * | ||
1589 | * There are few options for this: | ||
1590 | * use skb->cb as an extra space for 802.11 header | ||
1591 | * allocate new buffer if not enough headroom | ||
1592 | * make sure that there is enough headroom in every skb by increasing | ||
1593 | * build in headroom in __dev_alloc_skb() (linux/skbuff.h) and | ||
1594 | * alloc_skb() (net/core/skbuff.c) | ||
1595 | */ | ||
1596 | head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); | 1603 | head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); |
1597 | 1604 | ||
1598 | /* | 1605 | /* |
@@ -1815,10 +1822,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1815 | struct rate_selection rsel; | 1822 | struct rate_selection rsel; |
1816 | struct beacon_data *beacon; | 1823 | struct beacon_data *beacon; |
1817 | struct ieee80211_supported_band *sband; | 1824 | struct ieee80211_supported_band *sband; |
1818 | struct ieee80211_mgmt *mgmt; | ||
1819 | int *num_beacons; | ||
1820 | enum ieee80211_band band = local->hw.conf.channel->band; | 1825 | enum ieee80211_band band = local->hw.conf.channel->band; |
1821 | u8 *pos; | ||
1822 | 1826 | ||
1823 | sband = local->hw.wiphy->bands[band]; | 1827 | sband = local->hw.wiphy->bands[band]; |
1824 | 1828 | ||
@@ -1827,7 +1831,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1827 | sdata = vif_to_sdata(vif); | 1831 | sdata = vif_to_sdata(vif); |
1828 | bdev = sdata->dev; | 1832 | bdev = sdata->dev; |
1829 | 1833 | ||
1830 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 1834 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
1831 | ap = &sdata->u.ap; | 1835 | ap = &sdata->u.ap; |
1832 | beacon = rcu_dereference(ap->beacon); | 1836 | beacon = rcu_dereference(ap->beacon); |
1833 | if (ap && beacon) { | 1837 | if (ap && beacon) { |
@@ -1865,11 +1869,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1865 | if (beacon->tail) | 1869 | if (beacon->tail) |
1866 | memcpy(skb_put(skb, beacon->tail_len), | 1870 | memcpy(skb_put(skb, beacon->tail_len), |
1867 | beacon->tail, beacon->tail_len); | 1871 | beacon->tail, beacon->tail_len); |
1868 | |||
1869 | num_beacons = &ap->num_beacons; | ||
1870 | } else | 1872 | } else |
1871 | goto out; | 1873 | goto out; |
1872 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 1874 | } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
1873 | struct ieee80211_hdr *hdr; | 1875 | struct ieee80211_hdr *hdr; |
1874 | ifsta = &sdata->u.sta; | 1876 | ifsta = &sdata->u.sta; |
1875 | 1877 | ||
@@ -1884,8 +1886,10 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1884 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1886 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1885 | IEEE80211_STYPE_BEACON); | 1887 | IEEE80211_STYPE_BEACON); |
1886 | 1888 | ||
1887 | num_beacons = &ifsta->num_beacons; | ||
1888 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { | 1889 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
1890 | struct ieee80211_mgmt *mgmt; | ||
1891 | u8 *pos; | ||
1892 | |||
1889 | /* headroom, head length, tail length and maximum TIM length */ | 1893 | /* headroom, head length, tail length and maximum TIM length */ |
1890 | skb = dev_alloc_skb(local->tx_headroom + 400); | 1894 | skb = dev_alloc_skb(local->tx_headroom + 400); |
1891 | if (!skb) | 1895 | if (!skb) |
@@ -1909,8 +1913,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1909 | *pos++ = 0x0; | 1913 | *pos++ = 0x0; |
1910 | 1914 | ||
1911 | mesh_mgmt_ies_add(skb, sdata); | 1915 | mesh_mgmt_ies_add(skb, sdata); |
1912 | |||
1913 | num_beacons = &sdata->u.sta.num_beacons; | ||
1914 | } else { | 1916 | } else { |
1915 | WARN_ON(1); | 1917 | WARN_ON(1); |
1916 | goto out; | 1918 | goto out; |
@@ -1947,7 +1949,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1947 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | 1949 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; |
1948 | info->control.retry_limit = 1; | 1950 | info->control.retry_limit = 1; |
1949 | 1951 | ||
1950 | (*num_beacons)++; | ||
1951 | out: | 1952 | out: |
1952 | rcu_read_unlock(); | 1953 | rcu_read_unlock(); |
1953 | return skb; | 1954 | return skb; |
@@ -2009,7 +2010,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2009 | rcu_read_lock(); | 2010 | rcu_read_lock(); |
2010 | beacon = rcu_dereference(bss->beacon); | 2011 | beacon = rcu_dereference(bss->beacon); |
2011 | 2012 | ||
2012 | if (sdata->vif.type != IEEE80211_IF_TYPE_AP || !beacon || !beacon->head) | 2013 | if (sdata->vif.type != NL80211_IFTYPE_AP || !beacon || !beacon->head) |
2013 | goto out; | 2014 | goto out; |
2014 | 2015 | ||
2015 | if (bss->dtim_count != 0) | 2016 | if (bss->dtim_count != 0) |