| @@ -853,8 +853,7 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) · 852 unmodified lines |
| 853 | tid = *qc & IEEE80211_QOS_CTL_TID_MASK; | 853 | tid = *qc & IEEE80211_QOS_CTL_TID_MASK; |
| 854 | tx->sta->tx_stats.msdu[tid]++; | 854 | tx->sta->tx_stats.msdu[tid]++; |
| 855 | | 855 | |
| 856 | if (!tx->sta->sta.txq[0]) | 856 | hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); |
| 857 | hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); | | |
| 858 | | 857 | |
| 859 | return TX_CONTINUE; | 858 | return TX_CONTINUE; |
| 860 | } | 859 | } |
| @@ -1404,6 +1403,7 @@ void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata, · 543 unmodified lines |
| 1404 | fq_flow_init(&txqi->def_flow); | 1403 | fq_flow_init(&txqi->def_flow); |
| 1405 | codel_vars_init(&txqi->def_cvars); | 1404 | codel_vars_init(&txqi->def_cvars); |
| 1406 | codel_stats_init(&txqi->cstats); | 1405 | codel_stats_init(&txqi->cstats); |
| | 1406 | __skb_queue_head_init(&txqi->frags); |
| 1407 | | 1407 | |
| 1408 | txqi->txq.vif = &sdata->vif; | 1408 | txqi->txq.vif = &sdata->vif; |
| 1409 | | 1409 | |
| @@ -1426,6 +1426,7 @@ void ieee80211_txq_purge(struct ieee80211_local *local, · 16 unmodified lines |
| 1426 | struct fq_tin *tin = &txqi->tin; | 1426 | struct fq_tin *tin = &txqi->tin; |
| 1427 | | 1427 | |
| 1428 | fq_tin_reset(fq, tin, fq_skb_free_func); | 1428 | fq_tin_reset(fq, tin, fq_skb_free_func); |
| | 1429 | ieee80211_purge_tx_queue(&local->hw, &txqi->frags); |
| 1429 | } | 1430 | } |
| 1430 | | 1431 | |
| 1431 | int ieee80211_txq_setup_flows(struct ieee80211_local *local) | 1432 | int ieee80211_txq_setup_flows(struct ieee80211_local *local) |
| @@ -1495,6 +1496,47 @@ void ieee80211_txq_teardown_flows(struct ieee80211_local *local) · 63 unmodified lines |
| 1495 | spin_unlock_bh(&fq->lock); | 1496 | spin_unlock_bh(&fq->lock); |
| 1496 | } | 1497 | } |
| 1497 | | 1498 | |
| | 1499 | static bool ieee80211_queue_skb(struct ieee80211_local *local, |
| | 1500 | struct ieee80211_sub_if_data *sdata, |
| | 1501 | struct sta_info *sta, |
| | 1502 | struct sk_buff *skb) |
| | 1503 | { |
| | 1504 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| | 1505 | struct fq *fq = &local->fq; |
| | 1506 | struct ieee80211_vif *vif; |
| | 1507 | struct txq_info *txqi; |
| | 1508 | struct ieee80211_sta *pubsta; |
| | 1509 | |
| | 1510 | if (!local->ops->wake_tx_queue || |
| | 1511 | sdata->vif.type == NL80211_IFTYPE_MONITOR) |
| | 1512 | return false; |
| | 1513 | |
| | 1514 | if (sta && sta->uploaded) |
| | 1515 | pubsta = &sta->sta; |
| | 1516 | else |
| | 1517 | pubsta = NULL; |
| | 1518 | |
| | 1519 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
| | 1520 | sdata = container_of(sdata->bss, |
| | 1521 | struct ieee80211_sub_if_data, u.ap); |
| | 1522 | |
| | 1523 | vif = &sdata->vif; |
| | 1524 | txqi = ieee80211_get_txq(local, vif, pubsta, skb); |
| | 1525 | |
| | 1526 | if (!txqi) |
| | 1527 | return false; |
| | 1528 | |
| | 1529 | info->control.vif = vif; |
| | 1530 | |
| | 1531 | spin_lock_bh(&fq->lock); |
| | 1532 | ieee80211_txq_enqueue(local, txqi, skb); |
| | 1533 | spin_unlock_bh(&fq->lock); |
| | 1534 | |
| | 1535 | drv_wake_tx_queue(local, txqi); |
| | 1536 | |
| | 1537 | return true; |
| | 1538 | } |
| | 1539 | |
| 1498 | static bool ieee80211_tx_frags(struct ieee80211_local *local, | 1540 | static bool ieee80211_tx_frags(struct ieee80211_local *local, |
| 1499 | struct ieee80211_vif *vif, | 1541 | struct ieee80211_vif *vif, |
| 1500 | struct ieee80211_sta *sta, | 1542 | struct ieee80211_sta *sta, |
| @@ -1502,9 +1544,7 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, · 1 unmodified line |
| 1502 | bool txpending) | 1544 | bool txpending) |
| 1503 | { | 1545 | { |
| 1504 | struct ieee80211_tx_control control = {}; | 1546 | struct ieee80211_tx_control control = {}; |
| 1505 | struct fq *fq = &local->fq; | | |
| 1506 | struct sk_buff *skb, *tmp; | 1547 | struct sk_buff *skb, *tmp; |
| 1507 | struct txq_info *txqi; | | |
| 1508 | unsigned long flags; | 1548 | unsigned long flags; |
| 1509 | | 1549 | |
| 1510 | skb_queue_walk_safe(skbs, skb, tmp) { | 1550 | skb_queue_walk_safe(skbs, skb, tmp) { |
| @@ -1519,21 +1559,6 @@ static bool ieee80211_tx_frags(struct ieee80211_local *local, · 8 unmodified lines |
| 1519 | } | 1559 | } |
| 1520 | #endif | 1560 | #endif |
| 1521 | | 1561 | |
| 1522 | txqi = ieee80211_get_txq(local, vif, sta, skb); | | |
| 1523 | if (txqi) { | | |
| 1524 | info->control.vif = vif; | | |
| 1525 | | | |
| 1526 | __skb_unlink(skb, skbs); | | |
| 1527 | | | |
| 1528 | spin_lock_bh(&fq->lock); | | |
| 1529 | ieee80211_txq_enqueue(local, txqi, skb); | | |
| 1530 | spin_unlock_bh(&fq->lock); | | |
| 1531 | | | |
| 1532 | drv_wake_tx_queue(local, txqi); | | |
| 1533 | | | |
| 1534 | continue; | | |
| 1535 | } | | |
| 1536 | | | |
| 1537 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); | 1562 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
| 1538 | if (local->queue_stop_reasons[q] || | 1563 | if (local->queue_stop_reasons[q] || |
| 1539 | (!txpending && !skb_queue_empty(&local->pending[q]))) { | 1564 | (!txpending && !skb_queue_empty(&local->pending[q]))) { |
| @@ -1654,10 +1679,13 @@ static bool __ieee80211_tx(struct ieee80211_local *local, · 114 unmodified lines |
| 1654 | /* | 1679 | /* |
| 1655 | * Invoke TX handlers, return 0 on success and non-zero if the | 1680 | * Invoke TX handlers, return 0 on success and non-zero if the |
| 1656 | * frame was dropped or queued. | 1681 | * frame was dropped or queued. |
| | 1682 | * |
| | 1683 | * The handlers are split into an early and late part. The latter is everything |
| | 1684 | * that can be sensitive to reordering, and will be deferred to after packets |
| | 1685 | * are dequeued from the intermediate queues (when they are enabled). |
| 1657 | */ | 1686 | */ |
| 1658 | static int invoke_tx_handlers(struct ieee80211_tx_data *tx) | 1687 | static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx) |
| 1659 | { | 1688 | { |
| 1660 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | | |
| 1661 | ieee80211_tx_result res = TX_DROP; | 1689 | ieee80211_tx_result res = TX_DROP; |
| 1662 | | 1690 | |
| 1663 | #define CALL_TXH(txh) \ | 1691 | #define CALL_TXH(txh) \ |
| @@ -1675,6 +1703,31 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) · 11 unmodified lines |
| 1675 | if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) | 1703 | if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) |
| 1676 | CALL_TXH(ieee80211_tx_h_rate_ctrl); | 1704 | CALL_TXH(ieee80211_tx_h_rate_ctrl); |
| 1677 | | 1705 | |
| | 1706 | txh_done: |
| | 1707 | if (unlikely(res == TX_DROP)) { |
| | 1708 | I802_DEBUG_INC(tx->local->tx_handlers_drop); |
| | 1709 | if (tx->skb) |
| | 1710 | ieee80211_free_txskb(&tx->local->hw, tx->skb); |
| | 1711 | else |
| | 1712 | ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs); |
| | 1713 | return -1; |
| | 1714 | } else if (unlikely(res == TX_QUEUED)) { |
| | 1715 | I802_DEBUG_INC(tx->local->tx_handlers_queued); |
| | 1716 | return -1; |
| | 1717 | } |
| | 1718 | |
| | 1719 | return 0; |
| | 1720 | } |
| | 1721 | |
| | 1722 | /* |
| | 1723 | * Late handlers can be called while the sta lock is held. Handlers that can |
| | 1724 | * cause packets to be generated will cause deadlock! |
| | 1725 | */ |
| | 1726 | static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) |
| | 1727 | { |
| | 1728 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
| | 1729 | ieee80211_tx_result res = TX_CONTINUE; |
| | 1730 | |
| 1678 | if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { | 1731 | if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { |
| 1679 | __skb_queue_tail(&tx->skbs, tx->skb); | 1732 | __skb_queue_tail(&tx->skbs, tx->skb); |
| 1680 | tx->skb = NULL; | 1733 | tx->skb = NULL; |
| @@ -1707,6 +1760,15 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) · 26 unmodified lines |
| 1707 | return 0; | 1760 | return 0; |
| 1708 | } | 1761 | } |
| 1709 | | 1762 | |
| | 1763 | static int invoke_tx_handlers(struct ieee80211_tx_data *tx) |
| | 1764 | { |
| | 1765 | int r = invoke_tx_handlers_early(tx); |
| | 1766 | |
| | 1767 | if (r) |
| | 1768 | return r; |
| | 1769 | return invoke_tx_handlers_late(tx); |
| | 1770 | } |
| | 1771 | |
| 1710 | bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, | 1772 | bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, |
| 1711 | struct ieee80211_vif *vif, struct sk_buff *skb, | 1773 | struct ieee80211_vif *vif, struct sk_buff *skb, |
| 1712 | int band, struct ieee80211_sta **sta) | 1774 | int band, struct ieee80211_sta **sta) |
| @@ -1781,7 +1843,13 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, · 68 unmodified lines |
| 1781 | info->hw_queue = | 1843 | info->hw_queue = |
| 1782 | sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; | 1844 | sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; |
| 1783 | | 1845 | |
| 1784 | if (!invoke_tx_handlers(&tx)) | 1846 | if (invoke_tx_handlers_early(&tx)) |
| | 1847 | return false; |
| | 1848 | |
| | 1849 | if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb)) |
| | 1850 | return true; |
| | 1851 | |
| | 1852 | if (!invoke_tx_handlers_late(&tx)) |
| 1785 | result = __ieee80211_tx(local, &tx.skbs, led_len, | 1853 | result = __ieee80211_tx(local, &tx.skbs, led_len, |
| 1786 | tx.sta, txpending); | 1854 | tx.sta, txpending); |
| 1787 | | 1855 | |
| @@ -3125,8 +3193,71 @@ out: · 1337 unmodified lines |
| 3125 | return ret; | 3193 | return ret; |
| 3126 | } | 3194 | } |
| 3127 | | 3195 | |
| | 3196 | /* |
| | 3197 | * Can be called while the sta lock is held. Anything that can cause packets to |
| | 3198 | * be generated will cause deadlock! |
| | 3199 | */ |
| | 3200 | static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata, |
| | 3201 | struct sta_info *sta, u8 pn_offs, |
| | 3202 | struct ieee80211_key *key, |
| | 3203 | struct sk_buff *skb) |
| | 3204 | { |
| | 3205 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
| | 3206 | struct ieee80211_hdr *hdr = (void *)skb->data; |
| | 3207 | u8 tid = IEEE80211_NUM_TIDS; |
| | 3208 | |
| | 3209 | if (key) |
| | 3210 | info->control.hw_key = &key->conf; |
| | 3211 | |
| | 3212 | ieee80211_tx_stats(skb->dev, skb->len); |
| | 3213 | |
| | 3214 | if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { |
| | 3215 | tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; |
| | 3216 | *ieee80211_get_qos_ctl(hdr) = tid; |
| | 3217 | hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); |
| | 3218 | } else { |
| | 3219 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
| | 3220 | hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number); |
| | 3221 | sdata->sequence_number += 0x10; |
| | 3222 | } |
| | 3223 | |
| | 3224 | if (skb_shinfo(skb)->gso_size) |
| | 3225 | sta->tx_stats.msdu[tid] += |
| | 3226 | DIV_ROUND_UP(skb->len, skb_shinfo(skb)->gso_size); |
| | 3227 | else |
| | 3228 | sta->tx_stats.msdu[tid]++; |
| | 3229 | |
| | 3230 | info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; |
| | 3231 | |
| | 3232 | /* statistics normally done by ieee80211_tx_h_stats (but that |
| | 3233 | * has to consider fragmentation, so is more complex) |
| | 3234 | */ |
| | 3235 | sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; |
| | 3236 | sta->tx_stats.packets[skb_get_queue_mapping(skb)]++; |
| | 3237 | |
| | 3238 | if (pn_offs) { |
| | 3239 | u64 pn; |
| | 3240 | u8 *crypto_hdr = skb->data + pn_offs; |
| | 3241 | |
| | 3242 | switch (key->conf.cipher) { |
| | 3243 | case WLAN_CIPHER_SUITE_CCMP: |
| | 3244 | case WLAN_CIPHER_SUITE_CCMP_256: |
| | 3245 | case WLAN_CIPHER_SUITE_GCMP: |
| | 3246 | case WLAN_CIPHER_SUITE_GCMP_256: |
| | 3247 | pn = atomic64_inc_return(&key->conf.tx_pn); |
| | 3248 | crypto_hdr[0] = pn; |
| | 3249 | crypto_hdr[1] = pn >> 8; |
| | 3250 | crypto_hdr[4] = pn >> 16; |
| | 3251 | crypto_hdr[5] = pn >> 24; |
| | 3252 | crypto_hdr[6] = pn >> 32; |
| | 3253 | crypto_hdr[7] = pn >> 40; |
| | 3254 | break; |
| | 3255 | } |
| | 3256 | } |
| | 3257 | } |
| | 3258 | |
| 3128 | static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | 3259 | static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, |
| 3129 | struct net_device *dev, struct sta_info *sta, | 3260 | struct sta_info *sta, |
| 3130 | struct ieee80211_fast_tx *fast_tx, | 3261 | struct ieee80211_fast_tx *fast_tx, |
| 3131 | struct sk_buff *skb) | 3262 | struct sk_buff *skb) |
| 3132 | { | 3263 | { |
| @@ -3177,8 +3308,6 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 44 unmodified lines |
| 3177 | return true; | 3308 | return true; |
| 3178 | } | 3309 | } |
| 3179 | | 3310 | |
| 3180 | ieee80211_tx_stats(dev, skb->len + extra_head); | | |
| 3181 | | | |
| 3182 | if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && | 3311 | if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) && |
| 3183 | ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) | 3312 | ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb)) |
| 3184 | return true; | 3313 | return true; |
| @@ -3207,24 +3336,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 22 unmodified lines |
| 3207 | info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | | 3336 | info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT | |
| 3208 | IEEE80211_TX_CTL_DONTFRAG | | 3337 | IEEE80211_TX_CTL_DONTFRAG | |
| 3209 | (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); | 3338 | (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); |
| 3210 | | 3339 | info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT; |
| 3211 | if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { | | |
| 3212 | *ieee80211_get_qos_ctl(hdr) = tid; | | |
| 3213 | if (!sta->sta.txq[0]) | | |
| 3214 | hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); | | |
| 3215 | } else { | | |
| 3216 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | | |
| 3217 | hdr->seq_ctrl = cpu_to_le16(sdata->sequence_number); | | |
| 3218 | sdata->sequence_number += 0x10; | | |
| 3219 | } | | |
| 3220 | | | |
| 3221 | if (skb_shinfo(skb)->gso_size) | | |
| 3222 | sta->tx_stats.msdu[tid] += | | |
| 3223 | DIV_ROUND_UP(skb->len, skb_shinfo(skb)->gso_size); | | |
| 3224 | else | | |
| 3225 | sta->tx_stats.msdu[tid]++; | | |
| 3226 | | | |
| 3227 | info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; | | |
| 3228 | | 3340 | |
| 3229 | __skb_queue_head_init(&tx.skbs); | 3341 | __skb_queue_head_init(&tx.skbs); |
| 3230 | | 3342 | |
| @@ -3234,9 +3346,6 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 3 unmodified lines |
| 3234 | tx.sta = sta; | 3346 | tx.sta = sta; |
| 3235 | tx.key = fast_tx->key; | 3347 | tx.key = fast_tx->key; |
| 3236 | | 3348 | |
| 3237 | if (fast_tx->key) | | |
| 3238 | info->control.hw_key = &fast_tx->key->conf; | | |
| 3239 | | | |
| 3240 | if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { | 3349 | if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { |
| 3241 | tx.skb = skb; | 3350 | tx.skb = skb; |
| 3242 | r = ieee80211_tx_h_rate_ctrl(&tx); | 3351 | r = ieee80211_tx_h_rate_ctrl(&tx); |
| @@ -3250,31 +3359,11 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 7 unmodified lines |
| 3250 | } | 3359 | } |
| 3251 | } | 3360 | } |
| 3252 | | 3361 | |
| 3253 | /* statistics normally done by ieee80211_tx_h_stats (but that | 3362 | if (ieee80211_queue_skb(local, sdata, sta, skb)) |
| 3254 | * has to consider fragmentation, so is more complex) | 3363 | return true; |
| 3255 | */ | | |
| 3256 | sta->tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len; | | |
| 3257 | sta->tx_stats.packets[skb_get_queue_mapping(skb)]++; | | |
| 3258 | | 3364 | |
| 3259 | if (fast_tx->pn_offs) { | 3365 | ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs, |
| 3260 | u64 pn; | 3366 | fast_tx->key, skb); |
| 3261 | u8 *crypto_hdr = skb->data + fast_tx->pn_offs; | | |
| 3262 | | | |
| 3263 | switch (fast_tx->key->conf.cipher) { | | |
| 3264 | case WLAN_CIPHER_SUITE_CCMP: | | |
| 3265 | case WLAN_CIPHER_SUITE_CCMP_256: | | |
| 3266 | case WLAN_CIPHER_SUITE_GCMP: | | |
| 3267 | case WLAN_CIPHER_SUITE_GCMP_256: | | |
| 3268 | pn = atomic64_inc_return(&fast_tx->key->conf.tx_pn); | | |
| 3269 | crypto_hdr[0] = pn; | | |
| 3270 | crypto_hdr[1] = pn >> 8; | | |
| 3271 | crypto_hdr[4] = pn >> 16; | | |
| 3272 | crypto_hdr[5] = pn >> 24; | | |
| 3273 | crypto_hdr[6] = pn >> 32; | | |
| 3274 | crypto_hdr[7] = pn >> 40; | | |
| 3275 | break; | | |
| 3276 | } | | |
| 3277 | } | | |
| 3278 | | 3367 | |
| 3279 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | 3368 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
| 3280 | sdata = container_of(sdata->bss, | 3369 | sdata = container_of(sdata->bss, |
| @@ -3294,12 +3383,21 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 13 unmodified lines |
| 3294 | struct sk_buff *skb = NULL; | 3383 | struct sk_buff *skb = NULL; |
| 3295 | struct fq *fq = &local->fq; | 3384 | struct fq *fq = &local->fq; |
| 3296 | struct fq_tin *tin = &txqi->tin; | 3385 | struct fq_tin *tin = &txqi->tin; |
| | 3386 | struct ieee80211_tx_info *info; |
| | 3387 | struct ieee80211_tx_data tx; |
| | 3388 | ieee80211_tx_result r; |
| 3297 | | 3389 | |
| 3298 | spin_lock_bh(&fq->lock); | 3390 | spin_lock_bh(&fq->lock); |
| 3299 | | 3391 | |
| 3300 | if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags)) | 3392 | if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags)) |
| 3301 | goto out; | 3393 | goto out; |
| 3302 | | 3394 | |
| | 3395 | /* Make sure fragments stay together. */ |
| | 3396 | skb = __skb_dequeue(&txqi->frags); |
| | 3397 | if (skb) |
| | 3398 | goto out; |
| | 3399 | |
| | 3400 | begin: |
| 3303 | skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func); | 3401 | skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func); |
| 3304 | if (!skb) | 3402 | if (!skb) |
| 3305 | goto out; | 3403 | goto out; |
| @@ -3307,16 +3405,46 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, · 1 unmodified line |
| 3307 | ieee80211_set_skb_vif(skb, txqi); | 3405 | ieee80211_set_skb_vif(skb, txqi); |
| 3308 | | 3406 | |
| 3309 | hdr = (struct ieee80211_hdr *)skb->data; | 3407 | hdr = (struct ieee80211_hdr *)skb->data; |
| 3310 | if (txq->sta && ieee80211_is_data_qos(hdr->frame_control)) { | 3408 | info = IEEE80211_SKB_CB(skb); |
| | 3409 | |
| | 3410 | memset(&tx, 0, sizeof(tx)); |
| | 3411 | __skb_queue_head_init(&tx.skbs); |
| | 3412 | tx.local = local; |
| | 3413 | tx.skb = skb; |
| | 3414 | tx.sdata = vif_to_sdata(info->control.vif); |
| | 3415 | |
| | 3416 | if (txq->sta) |
| | 3417 | tx.sta = container_of(txq->sta, struct sta_info, sta); |
| | 3418 | |
| | 3419 | /* |
| | 3420 | * The key can be removed while the packet was queued, so need to call |
| | 3421 | * this here to get the current key. |
| | 3422 | */ |
| | 3423 | r = ieee80211_tx_h_select_key(&tx); |
| | 3424 | if (r != TX_CONTINUE) { |
| | 3425 | ieee80211_free_txskb(&local->hw, skb); |
| | 3426 | goto begin; |
| | 3427 | } |
| | 3428 | |
| | 3429 | if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) { |
| 3311 | struct sta_info *sta = container_of(txq->sta, struct sta_info, | 3430 | struct sta_info *sta = container_of(txq->sta, struct sta_info, |
| 3312 | sta); | 3431 | sta); |
| 3313 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 3432 | u8 pn_offs = 0; |
| 3314 | | 3433 | |
| 3315 | hdr->seq_ctrl = ieee80211_tx_next_seq(sta, txq->tid); | 3434 | if (tx.key && |
| 3316 | if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags)) | 3435 | (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) |
| 3317 | info->flags |= IEEE80211_TX_CTL_AMPDU; | 3436 | pn_offs = ieee80211_hdrlen(hdr->frame_control); |
| 3318 | else | 3437 | |
| 3319 | info->flags &= ~IEEE80211_TX_CTL_AMPDU; | 3438 | ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs, |
| | 3439 | tx.key, skb); |
| | 3440 | } else { |
| | 3441 | if (invoke_tx_handlers_late(&tx)) |
| | 3442 | goto begin; |
| | 3443 | |
| | 3444 | skb = __skb_dequeue(&tx.skbs); |
| | 3445 | |
| | 3446 | if (!skb_queue_empty(&tx.skbs)) |
| | 3447 | skb_queue_splice_tail(&tx.skbs, &txqi->frags); |
| 3320 | } | 3448 | } |
| 3321 | | 3449 | |
| 3322 | out: | 3450 | out: |
| @@ -3354,7 +3482,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, · 31 unmodified lines |
| 3354 | fast_tx = rcu_dereference(sta->fast_tx); | 3482 | fast_tx = rcu_dereference(sta->fast_tx); |
| 3355 | | 3483 | |
| 3356 | if (fast_tx && | 3484 | if (fast_tx && |
| 3357 | ieee80211_xmit_fast(sdata, dev, sta, fast_tx, skb)) | 3485 | ieee80211_xmit_fast(sdata, sta, fast_tx, skb)) |
| 3358 | goto out; | 3486 | goto out; |
| 3359 | } | 3487 | } |
| 3360 | | 3488 | |