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.c113
1 files changed, 67 insertions, 46 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e76facc69e95..5f827a6b0d8d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -159,7 +159,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
159 /* Time needed to transmit ACK 159 /* Time needed to transmit ACK
160 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up 160 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
161 * to closest integer */ 161 * to closest integer */
162 dur = ieee80211_frame_duration(local, 10, rate, erp, 162 dur = ieee80211_frame_duration(sband->band, 10, rate, erp,
163 tx->sdata->vif.bss_conf.use_short_preamble); 163 tx->sdata->vif.bss_conf.use_short_preamble);
164 164
165 if (next_frag_len) { 165 if (next_frag_len) {
@@ -167,7 +167,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
167 * transmit next fragment plus ACK and 2 x SIFS. */ 167 * transmit next fragment plus ACK and 2 x SIFS. */
168 dur *= 2; /* ACK + SIFS */ 168 dur *= 2; /* ACK + SIFS */
169 /* next fragment */ 169 /* next fragment */
170 dur += ieee80211_frame_duration(local, next_frag_len, 170 dur += ieee80211_frame_duration(sband->band, next_frag_len,
171 txrate->bitrate, erp, 171 txrate->bitrate, erp,
172 tx->sdata->vif.bss_conf.use_short_preamble); 172 tx->sdata->vif.bss_conf.use_short_preamble);
173 } 173 }
@@ -230,9 +230,9 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
230 * changed via debugfs, user needs to reassociate manually to have 230 * changed via debugfs, user needs to reassociate manually to have
231 * everything in sync. 231 * everything in sync.
232 */ 232 */
233 if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) 233 if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) &&
234 && (ifmgd->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) 234 (ifmgd->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) &&
235 && skb_get_queue_mapping(tx->skb) == 0) 235 skb_get_queue_mapping(tx->skb) == IEEE80211_AC_VO)
236 return TX_CONTINUE; 236 return TX_CONTINUE;
237 237
238 if (local->hw.conf.flags & IEEE80211_CONF_PS) { 238 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
@@ -306,7 +306,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
306 } 306 }
307 } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP && 307 } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP &&
308 ieee80211_is_data(hdr->frame_control) && 308 ieee80211_is_data(hdr->frame_control) &&
309 !atomic_read(&tx->sdata->u.ap.num_sta_authorized))) { 309 !atomic_read(&tx->sdata->u.ap.num_mcast_sta))) {
310 /* 310 /*
311 * No associated STAs - no need to send multicast 311 * No associated STAs - no need to send multicast
312 * frames. 312 * frames.
@@ -400,6 +400,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
400 return TX_CONTINUE; 400 return TX_CONTINUE;
401 401
402 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM; 402 info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM;
403 if (tx->local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)
404 info->hw_queue = tx->sdata->vif.cab_queue;
403 405
404 /* device releases frame after DTIM beacon */ 406 /* device releases frame after DTIM beacon */
405 if (!(tx->local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING)) 407 if (!(tx->local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING))
@@ -411,9 +413,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
411 413
412 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { 414 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) {
413#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 415#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
414 if (net_ratelimit()) 416 net_dbg_ratelimited("%s: BC TX buffer full - dropping the oldest frame\n",
415 printk(KERN_DEBUG "%s: BC TX buffer full - dropping the oldest frame\n", 417 tx->sdata->name);
416 tx->sdata->name);
417#endif 418#endif
418 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); 419 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
419 } else 420 } else
@@ -474,10 +475,8 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
474 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { 475 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) {
475 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); 476 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]);
476#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 477#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
477 if (net_ratelimit()) 478 net_dbg_ratelimited("%s: STA %pM TX buffer for AC %d full - dropping oldest frame\n",
478 printk(KERN_DEBUG "%s: STA %pM TX buffer for " 479 tx->sdata->name, sta->sta.addr, ac);
479 "AC %d full - dropping oldest frame\n",
480 tx->sdata->name, sta->sta.addr, ac);
481#endif 480#endif
482 dev_kfree_skb(old); 481 dev_kfree_skb(old);
483 } else 482 } else
@@ -1118,8 +1117,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1118 1117
1119 /* reset session timer */ 1118 /* reset session timer */
1120 if (reset_agg_timer && tid_tx->timeout) 1119 if (reset_agg_timer && tid_tx->timeout)
1121 mod_timer(&tid_tx->session_timer, 1120 tid_tx->last_tx = jiffies;
1122 TU_TO_EXP_TIME(tid_tx->timeout));
1123 1121
1124 return queued; 1122 return queued;
1125} 1123}
@@ -1216,11 +1214,19 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local,
1216 bool txpending) 1214 bool txpending)
1217{ 1215{
1218 struct sk_buff *skb, *tmp; 1216 struct sk_buff *skb, *tmp;
1219 struct ieee80211_tx_info *info;
1220 unsigned long flags; 1217 unsigned long flags;
1221 1218
1222 skb_queue_walk_safe(skbs, skb, tmp) { 1219 skb_queue_walk_safe(skbs, skb, tmp) {
1223 int q = skb_get_queue_mapping(skb); 1220 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1221 int q = info->hw_queue;
1222
1223#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1224 if (WARN_ON_ONCE(q >= local->hw.queues)) {
1225 __skb_unlink(skb, skbs);
1226 dev_kfree_skb(skb);
1227 continue;
1228 }
1229#endif
1224 1230
1225 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 1231 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
1226 if (local->queue_stop_reasons[q] || 1232 if (local->queue_stop_reasons[q] ||
@@ -1242,7 +1248,6 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local,
1242 } 1248 }
1243 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 1249 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
1244 1250
1245 info = IEEE80211_SKB_CB(skb);
1246 info->control.vif = vif; 1251 info->control.vif = vif;
1247 info->control.sta = sta; 1252 info->control.sta = sta;
1248 1253
@@ -1285,8 +1290,16 @@ static bool __ieee80211_tx(struct ieee80211_local *local,
1285 1290
1286 switch (sdata->vif.type) { 1291 switch (sdata->vif.type) {
1287 case NL80211_IFTYPE_MONITOR: 1292 case NL80211_IFTYPE_MONITOR:
1288 sdata = NULL; 1293 sdata = rcu_dereference(local->monitor_sdata);
1289 vif = NULL; 1294 if (sdata) {
1295 vif = &sdata->vif;
1296 info->hw_queue =
1297 vif->hw_queue[skb_get_queue_mapping(skb)];
1298 } else if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) {
1299 dev_kfree_skb(skb);
1300 return true;
1301 } else
1302 vif = NULL;
1290 break; 1303 break;
1291 case NL80211_IFTYPE_AP_VLAN: 1304 case NL80211_IFTYPE_AP_VLAN:
1292 sdata = container_of(sdata->bss, 1305 sdata = container_of(sdata->bss,
@@ -1401,6 +1414,12 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1401 tx.channel = local->hw.conf.channel; 1414 tx.channel = local->hw.conf.channel;
1402 info->band = tx.channel->band; 1415 info->band = tx.channel->band;
1403 1416
1417 /* set up hw_queue value early */
1418 if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) ||
1419 !(local->hw.flags & IEEE80211_HW_QUEUE_CONTROL))
1420 info->hw_queue =
1421 sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
1422
1404 if (!invoke_tx_handlers(&tx)) 1423 if (!invoke_tx_handlers(&tx))
1405 result = __ieee80211_tx(local, &tx.skbs, led_len, 1424 result = __ieee80211_tx(local, &tx.skbs, led_len,
1406 tx.sta, txpending); 1425 tx.sta, txpending);
@@ -1469,12 +1488,12 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
1469 1488
1470 if (ieee80211_vif_is_mesh(&sdata->vif) && 1489 if (ieee80211_vif_is_mesh(&sdata->vif) &&
1471 ieee80211_is_data(hdr->frame_control) && 1490 ieee80211_is_data(hdr->frame_control) &&
1472 !is_multicast_ether_addr(hdr->addr1)) 1491 !is_multicast_ether_addr(hdr->addr1) &&
1473 if (mesh_nexthop_resolve(skb, sdata)) { 1492 mesh_nexthop_resolve(skb, sdata)) {
1474 /* skb queued: don't free */ 1493 /* skb queued: don't free */
1475 rcu_read_unlock(); 1494 rcu_read_unlock();
1476 return; 1495 return;
1477 } 1496 }
1478 1497
1479 ieee80211_set_qos_hdr(sdata, skb); 1498 ieee80211_set_qos_hdr(sdata, skb);
1480 ieee80211_tx(sdata, skb, false); 1499 ieee80211_tx(sdata, skb, false);
@@ -1643,7 +1662,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1643 skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) { 1662 skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) {
1644 u8 *payload = (u8 *)hdr + hdrlen; 1663 u8 *payload = (u8 *)hdr + hdrlen;
1645 1664
1646 if (compare_ether_addr(payload, rfc1042_header) == 0) 1665 if (ether_addr_equal(payload, rfc1042_header))
1647 skb->protocol = cpu_to_be16((payload[6] << 8) | 1666 skb->protocol = cpu_to_be16((payload[6] << 8) |
1648 payload[7]); 1667 payload[7]);
1649 } 1668 }
@@ -1676,7 +1695,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1676 tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN || 1695 tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1677 tmp_sdata->vif.type == NL80211_IFTYPE_WDS) 1696 tmp_sdata->vif.type == NL80211_IFTYPE_WDS)
1678 continue; 1697 continue;
1679 if (compare_ether_addr(tmp_sdata->vif.addr, hdr->addr2) == 0) { 1698 if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
1680 sdata = tmp_sdata; 1699 sdata = tmp_sdata;
1681 break; 1700 break;
1682 } 1701 }
@@ -1793,9 +1812,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1793 * is being proxied by a portal (i.e. portal address 1812 * is being proxied by a portal (i.e. portal address
1794 * differs from proxied address) 1813 * differs from proxied address)
1795 */ 1814 */
1796 if (compare_ether_addr(sdata->vif.addr, 1815 if (ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN) &&
1797 skb->data + ETH_ALEN) == 0 && 1816 !(mppath && !ether_addr_equal(mppath->mpp, skb->data))) {
1798 !(mppath && compare_ether_addr(mppath->mpp, skb->data))) {
1799 hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, 1817 hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc,
1800 skb->data, skb->data + ETH_ALEN); 1818 skb->data, skb->data + ETH_ALEN);
1801 rcu_read_unlock(); 1819 rcu_read_unlock();
@@ -1930,7 +1948,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1930 wme_sta = true; 1948 wme_sta = true;
1931 1949
1932 /* receiver and we are QoS enabled, use a QoS type frame */ 1950 /* receiver and we are QoS enabled, use a QoS type frame */
1933 if (wme_sta && local->hw.queues >= 4) { 1951 if (wme_sta && local->hw.queues >= IEEE80211_NUM_ACS) {
1934 fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); 1952 fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
1935 hdrlen += 2; 1953 hdrlen += 2;
1936 } 1954 }
@@ -1942,12 +1960,10 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1942 if (unlikely(!ieee80211_vif_is_mesh(&sdata->vif) && 1960 if (unlikely(!ieee80211_vif_is_mesh(&sdata->vif) &&
1943 !is_multicast_ether_addr(hdr.addr1) && !authorized && 1961 !is_multicast_ether_addr(hdr.addr1) && !authorized &&
1944 (cpu_to_be16(ethertype) != sdata->control_port_protocol || 1962 (cpu_to_be16(ethertype) != sdata->control_port_protocol ||
1945 compare_ether_addr(sdata->vif.addr, skb->data + ETH_ALEN)))) { 1963 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) {
1946#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1964#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1947 if (net_ratelimit()) 1965 net_dbg_ratelimited("%s: dropped frame to %pM (unauthorized port)\n",
1948 printk(KERN_DEBUG "%s: dropped frame to %pM" 1966 dev->name, hdr.addr1);
1949 " (unauthorized port)\n", dev->name,
1950 hdr.addr1);
1951#endif 1967#endif
1952 1968
1953 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); 1969 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
@@ -2171,7 +2187,6 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
2171void ieee80211_tx_pending(unsigned long data) 2187void ieee80211_tx_pending(unsigned long data)
2172{ 2188{
2173 struct ieee80211_local *local = (struct ieee80211_local *)data; 2189 struct ieee80211_local *local = (struct ieee80211_local *)data;
2174 struct ieee80211_sub_if_data *sdata;
2175 unsigned long flags; 2190 unsigned long flags;
2176 int i; 2191 int i;
2177 bool txok; 2192 bool txok;
@@ -2208,8 +2223,7 @@ void ieee80211_tx_pending(unsigned long data)
2208 } 2223 }
2209 2224
2210 if (skb_queue_empty(&local->pending[i])) 2225 if (skb_queue_empty(&local->pending[i]))
2211 list_for_each_entry_rcu(sdata, &local->interfaces, list) 2226 ieee80211_propagate_queue_wake(local, i);
2212 netif_wake_subqueue(sdata->dev, i);
2213 } 2227 }
2214 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 2228 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
2215 2229
@@ -2375,6 +2389,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2375 IEEE80211_STYPE_BEACON); 2389 IEEE80211_STYPE_BEACON);
2376 } else if (ieee80211_vif_is_mesh(&sdata->vif)) { 2390 } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
2377 struct ieee80211_mgmt *mgmt; 2391 struct ieee80211_mgmt *mgmt;
2392 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
2378 u8 *pos; 2393 u8 *pos;
2379 int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) + 2394 int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) +
2380 sizeof(mgmt->u.beacon); 2395 sizeof(mgmt->u.beacon);
@@ -2384,6 +2399,10 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2384 goto out; 2399 goto out;
2385#endif 2400#endif
2386 2401
2402 if (ifmsh->sync_ops)
2403 ifmsh->sync_ops->adjust_tbtt(
2404 sdata);
2405
2387 skb = dev_alloc_skb(local->tx_headroom + 2406 skb = dev_alloc_skb(local->tx_headroom +
2388 hdr_len + 2407 hdr_len +
2389 2 + /* NULL SSID */ 2408 2 + /* NULL SSID */
@@ -2391,7 +2410,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2391 2 + 3 + /* DS params */ 2410 2 + 3 + /* DS params */
2392 2 + (IEEE80211_MAX_SUPP_RATES - 8) + 2411 2 + (IEEE80211_MAX_SUPP_RATES - 8) +
2393 2 + sizeof(struct ieee80211_ht_cap) + 2412 2 + sizeof(struct ieee80211_ht_cap) +
2394 2 + sizeof(struct ieee80211_ht_info) + 2413 2 + sizeof(struct ieee80211_ht_operation) +
2395 2 + sdata->u.mesh.mesh_id_len + 2414 2 + sdata->u.mesh.mesh_id_len +
2396 2 + sizeof(struct ieee80211_meshconf_ie) + 2415 2 + sizeof(struct ieee80211_meshconf_ie) +
2397 sdata->u.mesh.ie_len); 2416 sdata->u.mesh.ie_len);
@@ -2415,12 +2434,12 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
2415 *pos++ = WLAN_EID_SSID; 2434 *pos++ = WLAN_EID_SSID;
2416 *pos++ = 0x0; 2435 *pos++ = 0x0;
2417 2436
2418 if (ieee80211_add_srates_ie(&sdata->vif, skb) || 2437 if (ieee80211_add_srates_ie(&sdata->vif, skb, true) ||
2419 mesh_add_ds_params_ie(skb, sdata) || 2438 mesh_add_ds_params_ie(skb, sdata) ||
2420 ieee80211_add_ext_srates_ie(&sdata->vif, skb) || 2439 ieee80211_add_ext_srates_ie(&sdata->vif, skb, true) ||
2421 mesh_add_rsn_ie(skb, sdata) || 2440 mesh_add_rsn_ie(skb, sdata) ||
2422 mesh_add_ht_cap_ie(skb, sdata) || 2441 mesh_add_ht_cap_ie(skb, sdata) ||
2423 mesh_add_ht_info_ie(skb, sdata) || 2442 mesh_add_ht_oper_ie(skb, sdata) ||
2424 mesh_add_meshid_ie(skb, sdata) || 2443 mesh_add_meshid_ie(skb, sdata) ||
2425 mesh_add_meshconf_ie(skb, sdata) || 2444 mesh_add_meshconf_ie(skb, sdata) ||
2426 mesh_add_vendor_ies(skb, sdata)) { 2445 mesh_add_vendor_ies(skb, sdata)) {
@@ -2604,7 +2623,7 @@ struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2604 pos = skb_put(skb, ie_ssid_len); 2623 pos = skb_put(skb, ie_ssid_len);
2605 *pos++ = WLAN_EID_SSID; 2624 *pos++ = WLAN_EID_SSID;
2606 *pos++ = ssid_len; 2625 *pos++ = ssid_len;
2607 if (ssid) 2626 if (ssid_len)
2608 memcpy(pos, ssid, ssid_len); 2627 memcpy(pos, ssid, ssid_len);
2609 pos += ssid_len; 2628 pos += ssid_len;
2610 2629
@@ -2711,11 +2730,13 @@ EXPORT_SYMBOL(ieee80211_get_buffered_bc);
2711void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 2730void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
2712 struct sk_buff *skb, int tid) 2731 struct sk_buff *skb, int tid)
2713{ 2732{
2733 int ac = ieee802_1d_to_ac[tid];
2734
2714 skb_set_mac_header(skb, 0); 2735 skb_set_mac_header(skb, 0);
2715 skb_set_network_header(skb, 0); 2736 skb_set_network_header(skb, 0);
2716 skb_set_transport_header(skb, 0); 2737 skb_set_transport_header(skb, 0);
2717 2738
2718 skb_set_queue_mapping(skb, ieee802_1d_to_ac[tid]); 2739 skb_set_queue_mapping(skb, ac);
2719 skb->priority = tid; 2740 skb->priority = tid;
2720 2741
2721 /* 2742 /*