aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c95
1 files changed, 43 insertions, 52 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e453212fa17f..acf712ffb5e6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -140,6 +140,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
140 if (r->flags & IEEE80211_RATE_MANDATORY_A) 140 if (r->flags & IEEE80211_RATE_MANDATORY_A)
141 mrate = r->bitrate; 141 mrate = r->bitrate;
142 break; 142 break;
143 case IEEE80211_BAND_60GHZ:
144 /* TODO, for now fall through */
143 case IEEE80211_NUM_BANDS: 145 case IEEE80211_NUM_BANDS:
144 WARN_ON(1); 146 WARN_ON(1);
145 break; 147 break;
@@ -175,12 +177,6 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
175 return cpu_to_le16(dur); 177 return cpu_to_le16(dur);
176} 178}
177 179
178static inline int is_ieee80211_device(struct ieee80211_local *local,
179 struct net_device *dev)
180{
181 return local == wdev_priv(dev->ieee80211_ptr);
182}
183
184/* tx handlers */ 180/* tx handlers */
185static ieee80211_tx_result debug_noinline 181static ieee80211_tx_result debug_noinline
186ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) 182ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
@@ -297,10 +293,10 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
297 if (unlikely(!assoc && 293 if (unlikely(!assoc &&
298 ieee80211_is_data(hdr->frame_control))) { 294 ieee80211_is_data(hdr->frame_control))) {
299#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 295#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
300 printk(KERN_DEBUG "%s: dropped data frame to not " 296 sdata_info(tx->sdata,
301 "associated station %pM\n", 297 "dropped data frame to not associated station %pM\n",
302 tx->sdata->name, hdr->addr1); 298 hdr->addr1);
303#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 299#endif
304 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); 300 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
305 return TX_DROP; 301 return TX_DROP;
306 } 302 }
@@ -367,10 +363,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
367 rcu_read_unlock(); 363 rcu_read_unlock();
368 364
369 local->total_ps_buffered = total; 365 local->total_ps_buffered = total;
370#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 366 ps_dbg_hw(&local->hw, "PS buffers full - purged %d frames\n", purged);
371 wiphy_debug(local->hw.wiphy, "PS buffers full - purged %d frames\n",
372 purged);
373#endif
374} 367}
375 368
376static ieee80211_tx_result 369static ieee80211_tx_result
@@ -412,10 +405,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
412 purge_old_ps_buffers(tx->local); 405 purge_old_ps_buffers(tx->local);
413 406
414 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { 407 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) {
415#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 408 ps_dbg(tx->sdata,
416 net_dbg_ratelimited("%s: BC TX buffer full - dropping the oldest frame\n", 409 "BC TX buffer full - dropping the oldest frame\n");
417 tx->sdata->name);
418#endif
419 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); 410 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
420 } else 411 } else
421 tx->local->total_ps_buffered++; 412 tx->local->total_ps_buffered++;
@@ -466,18 +457,15 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
466 return TX_CONTINUE; 457 return TX_CONTINUE;
467 } 458 }
468 459
469#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 460 ps_dbg(sta->sdata, "STA %pM aid %d: PS buffer for AC %d\n",
470 printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n",
471 sta->sta.addr, sta->sta.aid, ac); 461 sta->sta.addr, sta->sta.aid, ac);
472#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
473 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) 462 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
474 purge_old_ps_buffers(tx->local); 463 purge_old_ps_buffers(tx->local);
475 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { 464 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) {
476 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); 465 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]);
477#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 466 ps_dbg(tx->sdata,
478 net_dbg_ratelimited("%s: STA %pM TX buffer for AC %d full - dropping oldest frame\n", 467 "STA %pM TX buffer for AC %d full - dropping oldest frame\n",
479 tx->sdata->name, sta->sta.addr, ac); 468 sta->sta.addr, ac);
480#endif
481 dev_kfree_skb(old); 469 dev_kfree_skb(old);
482 } else 470 } else
483 tx->local->total_ps_buffered++; 471 tx->local->total_ps_buffered++;
@@ -499,14 +487,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
499 sta_info_recalc_tim(sta); 487 sta_info_recalc_tim(sta);
500 488
501 return TX_QUEUED; 489 return TX_QUEUED;
490 } else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) {
491 ps_dbg(tx->sdata,
492 "STA %pM in PS mode, but polling/in SP -> send frame\n",
493 sta->sta.addr);
502 } 494 }
503#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
504 else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) {
505 printk(KERN_DEBUG
506 "%s: STA %pM in PS mode, but polling/in SP -> send frame\n",
507 tx->sdata->name, sta->sta.addr);
508 }
509#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
510 495
511 return TX_CONTINUE; 496 return TX_CONTINUE;
512} 497}
@@ -538,7 +523,7 @@ ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx)
538static ieee80211_tx_result debug_noinline 523static ieee80211_tx_result debug_noinline
539ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) 524ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
540{ 525{
541 struct ieee80211_key *key = NULL; 526 struct ieee80211_key *key;
542 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 527 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
543 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 528 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
544 529
@@ -557,16 +542,23 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
557 else if (!is_multicast_ether_addr(hdr->addr1) && 542 else if (!is_multicast_ether_addr(hdr->addr1) &&
558 (key = rcu_dereference(tx->sdata->default_unicast_key))) 543 (key = rcu_dereference(tx->sdata->default_unicast_key)))
559 tx->key = key; 544 tx->key = key;
560 else if (tx->sdata->drop_unencrypted && 545 else if (info->flags & IEEE80211_TX_CTL_INJECTED)
561 (tx->skb->protocol != tx->sdata->control_port_protocol) && 546 tx->key = NULL;
562 !(info->flags & IEEE80211_TX_CTL_INJECTED) && 547 else if (!tx->sdata->drop_unencrypted)
563 (!ieee80211_is_robust_mgmt_frame(hdr) || 548 tx->key = NULL;
564 (ieee80211_is_action(hdr->frame_control) && 549 else if (tx->skb->protocol == tx->sdata->control_port_protocol)
565 tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))) { 550 tx->key = NULL;
551 else if (ieee80211_is_robust_mgmt_frame(hdr) &&
552 !(ieee80211_is_action(hdr->frame_control) &&
553 tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))
554 tx->key = NULL;
555 else if (ieee80211_is_mgmt(hdr->frame_control) &&
556 !ieee80211_is_robust_mgmt_frame(hdr))
557 tx->key = NULL;
558 else {
566 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 559 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
567 return TX_DROP; 560 return TX_DROP;
568 } else 561 }
569 tx->key = NULL;
570 562
571 if (tx->key) { 563 if (tx->key) {
572 bool skip_hw = false; 564 bool skip_hw = false;
@@ -974,8 +966,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
974 info->control.rates[1].idx = -1; 966 info->control.rates[1].idx = -1;
975 info->control.rates[2].idx = -1; 967 info->control.rates[2].idx = -1;
976 info->control.rates[3].idx = -1; 968 info->control.rates[3].idx = -1;
977 info->control.rates[4].idx = -1; 969 BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 4);
978 BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5);
979 info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; 970 info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
980 } else { 971 } else {
981 hdr->frame_control &= ~morefrags; 972 hdr->frame_control &= ~morefrags;
@@ -1310,11 +1301,8 @@ static bool __ieee80211_tx(struct ieee80211_local *local,
1310 break; 1301 break;
1311 } 1302 }
1312 1303
1313 if (local->ops->tx_frags) 1304 result = ieee80211_tx_frags(local, vif, pubsta, skbs,
1314 drv_tx_frags(local, vif, pubsta, skbs); 1305 txpending);
1315 else
1316 result = ieee80211_tx_frags(local, vif, pubsta, skbs,
1317 txpending);
1318 1306
1319 ieee80211_tpt_led_trig_tx(local, fc, led_len); 1307 ieee80211_tpt_led_trig_tx(local, fc, led_len);
1320 ieee80211_led_tx(local, 1); 1308 ieee80211_led_tx(local, 1);
@@ -1836,6 +1824,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1836 /* RA TA mDA mSA AE:DA SA */ 1824 /* RA TA mDA mSA AE:DA SA */
1837 mesh_da = mppath->mpp; 1825 mesh_da = mppath->mpp;
1838 is_mesh_mcast = 0; 1826 is_mesh_mcast = 0;
1827 } else if (mpath) {
1828 mesh_da = mpath->dst;
1829 is_mesh_mcast = 0;
1839 } else { 1830 } else {
1840 /* DA TA mSA AE:SA */ 1831 /* DA TA mSA AE:SA */
1841 mesh_da = bcast; 1832 mesh_da = bcast;
@@ -1965,7 +1956,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1965 (cpu_to_be16(ethertype) != sdata->control_port_protocol || 1956 (cpu_to_be16(ethertype) != sdata->control_port_protocol ||
1966 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { 1957 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) {
1967#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1958#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1968 net_dbg_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", 1959 net_info_ratelimited("%s: dropped frame to %pM (unauthorized port)\n",
1969 dev->name, hdr.addr1); 1960 dev->name, hdr.addr1);
1970#endif 1961#endif
1971 1962
@@ -2437,9 +2428,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2437 *pos++ = WLAN_EID_SSID; 2428 *pos++ = WLAN_EID_SSID;
2438 *pos++ = 0x0; 2429 *pos++ = 0x0;
2439 2430
2440 if (ieee80211_add_srates_ie(&sdata->vif, skb, true) || 2431 if (ieee80211_add_srates_ie(sdata, skb, true) ||
2441 mesh_add_ds_params_ie(skb, sdata) || 2432 mesh_add_ds_params_ie(skb, sdata) ||
2442 ieee80211_add_ext_srates_ie(&sdata->vif, skb, true) || 2433 ieee80211_add_ext_srates_ie(sdata, skb, true) ||
2443 mesh_add_rsn_ie(skb, sdata) || 2434 mesh_add_rsn_ie(skb, sdata) ||
2444 mesh_add_ht_cap_ie(skb, sdata) || 2435 mesh_add_ht_cap_ie(skb, sdata) ||
2445 mesh_add_ht_oper_ie(skb, sdata) || 2436 mesh_add_ht_oper_ie(skb, sdata) ||
@@ -2733,7 +2724,7 @@ EXPORT_SYMBOL(ieee80211_get_buffered_bc);
2733void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 2724void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
2734 struct sk_buff *skb, int tid) 2725 struct sk_buff *skb, int tid)
2735{ 2726{
2736 int ac = ieee802_1d_to_ac[tid]; 2727 int ac = ieee802_1d_to_ac[tid & 7];
2737 2728
2738 skb_set_mac_header(skb, 0); 2729 skb_set_mac_header(skb, 0);
2739 skb_set_network_header(skb, 0); 2730 skb_set_network_header(skb, 0);