Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "mac80211: Add TXQ scheduling API"

This reverts commit e937b8da5a591f141fe41aa48a2e898df9888c95.

Turns out that a new driver (mt76) is coming in through
Kalle's tree, and will conflict with this. It also has some
conflicting requirements, so we'll revisit this later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+283 -194
+2
drivers/net/wireless/ath/ath10k/core.c
··· 2574 2574 2575 2575 mutex_init(&ar->conf_mutex); 2576 2576 spin_lock_init(&ar->data_lock); 2577 + spin_lock_init(&ar->txqs_lock); 2577 2578 2579 + INIT_LIST_HEAD(&ar->txqs); 2578 2580 INIT_LIST_HEAD(&ar->peers); 2579 2581 init_waitqueue_head(&ar->peer_mapping_wq); 2580 2582 init_waitqueue_head(&ar->htt.empty_tx_wq);
+4
drivers/net/wireless/ath/ath10k/core.h
··· 347 347 }; 348 348 349 349 struct ath10k_txq { 350 + struct list_head list; 350 351 unsigned long num_fw_queued; 351 352 unsigned long num_push_allowed; 352 353 }; ··· 895 894 896 895 /* protects shared structure data */ 897 896 spinlock_t data_lock; 897 + /* protects: ar->txqs, artxq->list */ 898 + spinlock_t txqs_lock; 898 899 900 + struct list_head txqs; 899 901 struct list_head arvifs; 900 902 struct list_head peers; 901 903 struct ath10k_peer *peer_map[ATH10K_MAX_NUM_PEER_IDS];
+39 -16
drivers/net/wireless/ath/ath10k/mac.c
··· 3830 3830 return; 3831 3831 3832 3832 artxq = (void *)txq->drv_priv; 3833 + INIT_LIST_HEAD(&artxq->list); 3833 3834 } 3834 3835 3835 3836 static void ath10k_mac_txq_unref(struct ath10k *ar, struct ieee80211_txq *txq) 3836 3837 { 3838 + struct ath10k_txq *artxq; 3837 3839 struct ath10k_skb_cb *cb; 3838 3840 struct sk_buff *msdu; 3839 3841 int msdu_id; 3840 3842 3841 3843 if (!txq) 3842 3844 return; 3845 + 3846 + artxq = (void *)txq->drv_priv; 3847 + spin_lock_bh(&ar->txqs_lock); 3848 + if (!list_empty(&artxq->list)) 3849 + list_del_init(&artxq->list); 3850 + spin_unlock_bh(&ar->txqs_lock); 3843 3851 3844 3852 spin_lock_bh(&ar->htt.tx_lock); 3845 3853 idr_for_each_entry(&ar->htt.pending_tx, msdu, msdu_id) { ··· 3978 3970 void ath10k_mac_tx_push_pending(struct ath10k *ar) 3979 3971 { 3980 3972 struct ieee80211_hw *hw = ar->hw; 3981 - struct ieee80211_txq *txq, *first = NULL; 3973 + struct ieee80211_txq *txq; 3974 + struct ath10k_txq *artxq; 3975 + struct ath10k_txq *last; 3982 3976 int ret; 3983 3977 int max; 3984 3978 3985 3979 if (ar->htt.num_pending_tx >= (ar->htt.max_num_pending_tx / 2)) 3986 3980 return; 3987 3981 3982 + spin_lock_bh(&ar->txqs_lock); 3988 3983 rcu_read_lock(); 3989 3984 3990 - txq = ieee80211_next_txq(hw); 3991 - while (txq) { 3985 + last = list_last_entry(&ar->txqs, struct ath10k_txq, list); 3986 + while (!list_empty(&ar->txqs)) { 3987 + artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list); 3988 + txq = container_of((void *)artxq, struct ieee80211_txq, 3989 + drv_priv); 3992 3990 3993 3991 /* Prevent aggressive sta/tid taking over tx queue */ 3994 3992 max = 16; ··· 4005 3991 break; 4006 3992 } 4007 3993 3994 + list_del_init(&artxq->list); 4008 3995 if (ret != -ENOENT) 4009 - ieee80211_schedule_txq(hw, txq); 3996 + list_add_tail(&artxq->list, &ar->txqs); 4010 3997 4011 3998 ath10k_htt_tx_txq_update(hw, txq); 4012 3999 4013 - if (first == txq || (ret < 0 && ret != -ENOENT)) 4000 + if (artxq == last || (ret < 0 && ret != -ENOENT)) 4014 4001 break; 4015 - 4016 - if (!first) 4017 - first = txq; 4018 - 4019 - txq = ieee80211_next_txq(hw); 4020 4002 } 4021 4003 4022 4004 rcu_read_unlock(); 4005 + spin_unlock_bh(&ar->txqs_lock); 4023 4006 } 4024 4007 4025 4008 /************/ ··· 4250 4239 } 4251 4240 } 4252 4241 4253 - static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw) 4242 + static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, 4243 + struct ieee80211_txq *txq) 4254 4244 { 4255 - struct ieee80211_txq *txq; 4245 + struct ath10k *ar = hw->priv; 4246 + struct ath10k_txq *artxq = (void *)txq->drv_priv; 4247 + struct ieee80211_txq *f_txq; 4248 + struct ath10k_txq *f_artxq; 4256 4249 int ret = 0; 4257 4250 int max = 16; 4258 4251 4259 - txq = ieee80211_next_txq(hw); 4252 + spin_lock_bh(&ar->txqs_lock); 4253 + if (list_empty(&artxq->list)) 4254 + list_add_tail(&artxq->list, &ar->txqs); 4260 4255 4261 - while (ath10k_mac_tx_can_push(hw, txq) && max--) { 4262 - ret = ath10k_mac_tx_push_txq(hw, txq); 4256 + f_artxq = list_first_entry(&ar->txqs, struct ath10k_txq, list); 4257 + f_txq = container_of((void *)f_artxq, struct ieee80211_txq, drv_priv); 4258 + list_del_init(&f_artxq->list); 4259 + 4260 + while (ath10k_mac_tx_can_push(hw, f_txq) && max--) { 4261 + ret = ath10k_mac_tx_push_txq(hw, f_txq); 4263 4262 if (ret) 4264 4263 break; 4265 4264 } 4266 4265 if (ret != -ENOENT) 4267 - ieee80211_schedule_txq(hw, txq); 4266 + list_add_tail(&f_artxq->list, &ar->txqs); 4267 + spin_unlock_bh(&ar->txqs_lock); 4268 4268 4269 + ath10k_htt_tx_txq_update(hw, f_txq); 4269 4270 ath10k_htt_tx_txq_update(hw, txq); 4270 4271 } 4271 4272
+7 -2
drivers/net/wireless/ath/ath9k/ath9k.h
··· 246 246 s8 bar_index; 247 247 bool active; 248 248 bool clear_ps_filter; 249 + bool has_queued; 249 250 }; 251 + 252 + void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid); 253 + void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid); 250 254 251 255 struct ath_node { 252 256 struct ath_softc *sc; ··· 591 587 void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq); 592 588 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); 593 589 void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an); 594 - void ath_txq_schedule(struct ath_softc *sc); 590 + void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq); 591 + void ath_txq_schedule_all(struct ath_softc *sc); 595 592 int ath_tx_init(struct ath_softc *sc, int nbufs); 596 593 int ath_txq_update(struct ath_softc *sc, int qnum, 597 594 struct ath9k_tx_queue_info *q); ··· 618 613 u16 tids, int nframes, 619 614 enum ieee80211_frame_release_type reason, 620 615 bool more_data); 621 - void ath9k_wake_tx_queue(struct ieee80211_hw *hw); 616 + void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue); 622 617 623 618 /********/ 624 619 /* VIFs */
+1 -1
drivers/net/wireless/ath/ath9k/main.c
··· 266 266 } 267 267 work: 268 268 ath_restart_work(sc); 269 - ath_txq_schedule(sc); 269 + ath_txq_schedule_all(sc); 270 270 } 271 271 272 272 sc->gtt_cnt = 0;
+2
drivers/net/wireless/ath/ath9k/recv.c
··· 1057 1057 if (!!(sc->airtime_flags & AIRTIME_USE_RX)) { 1058 1058 spin_lock_bh(&acq->lock); 1059 1059 an->airtime_deficit[acno] -= airtime; 1060 + if (an->airtime_deficit[acno] <= 0) 1061 + __ath_tx_queue_tid(sc, ATH_AN_2_TID(an, tidno)); 1060 1062 spin_unlock_bh(&acq->lock); 1061 1063 } 1062 1064 ath_debug_airtime(sc, an, airtime, 0);
+181 -71
drivers/net/wireless/ath/ath9k/xmit.c
··· 112 112 ath_tx_status(hw, skb); 113 113 } 114 114 115 - void ath9k_wake_tx_queue(struct ieee80211_hw *hw) 115 + void __ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 116 + { 117 + struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv; 118 + struct ath_chanctx *ctx = avp->chanctx; 119 + struct ath_acq *acq; 120 + struct list_head *tid_list; 121 + u8 acno = TID_TO_WME_AC(tid->tidno); 122 + 123 + if (!ctx || !list_empty(&tid->list)) 124 + return; 125 + 126 + 127 + acq = &ctx->acq[acno]; 128 + if ((sc->airtime_flags & AIRTIME_USE_NEW_QUEUES) && 129 + tid->an->airtime_deficit[acno] > 0) 130 + tid_list = &acq->acq_new; 131 + else 132 + tid_list = &acq->acq_old; 133 + 134 + list_add_tail(&tid->list, tid_list); 135 + } 136 + 137 + void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid) 138 + { 139 + struct ath_vif *avp = (struct ath_vif *) tid->an->vif->drv_priv; 140 + struct ath_chanctx *ctx = avp->chanctx; 141 + struct ath_acq *acq; 142 + 143 + if (!ctx || !list_empty(&tid->list)) 144 + return; 145 + 146 + acq = &ctx->acq[TID_TO_WME_AC(tid->tidno)]; 147 + spin_lock_bh(&acq->lock); 148 + __ath_tx_queue_tid(sc, tid); 149 + spin_unlock_bh(&acq->lock); 150 + } 151 + 152 + 153 + void ath9k_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *queue) 116 154 { 117 155 struct ath_softc *sc = hw->priv; 156 + struct ath_common *common = ath9k_hw_common(sc->sc_ah); 157 + struct ath_atx_tid *tid = (struct ath_atx_tid *) queue->drv_priv; 158 + struct ath_txq *txq = tid->txq; 118 159 119 - ath_txq_schedule(sc); 160 + ath_dbg(common, QUEUE, "Waking TX queue: %pM (%d)\n", 161 + queue->sta ? queue->sta->addr : queue->vif->addr, 162 + tid->tidno); 163 + 164 + ath_txq_lock(sc, txq); 165 + 166 + tid->has_queued = true; 167 + ath_tx_queue_tid(sc, tid); 168 + ath_txq_schedule(sc, txq); 169 + 170 + ath_txq_unlock(sc, txq); 120 171 } 121 172 122 173 static struct ath_frame_info *get_frame_info(struct sk_buff *skb) ··· 230 179 struct ath_frame_info *fi; 231 180 int q; 232 181 233 - skb = ieee80211_tx_dequeue(hw, txq); 234 - if (!skb) 182 + if (!tid->has_queued) 235 183 return NULL; 184 + 185 + skb = ieee80211_tx_dequeue(hw, txq); 186 + if (!skb) { 187 + tid->has_queued = false; 188 + return NULL; 189 + } 236 190 237 191 if (ath_tx_prepare(hw, skb, &txctl)) { 238 192 ieee80211_free_txskb(hw, skb); ··· 253 197 254 198 return skb; 255 199 } 200 + 201 + 202 + static bool ath_tid_has_buffered(struct ath_atx_tid *tid) 203 + { 204 + return !skb_queue_empty(&tid->retry_q) || tid->has_queued; 205 + } 256 206 257 207 static struct sk_buff *ath_tid_dequeue(struct ath_atx_tid *tid) 258 208 { ··· 671 609 672 610 skb_queue_splice_tail(&bf_pending, &tid->retry_q); 673 611 if (!an->sleeping) { 674 - struct ieee80211_txq *queue = container_of( 675 - (void *)tid, struct ieee80211_txq, drv_priv); 676 - 677 - ieee80211_schedule_txq(sc->hw, queue); 612 + ath_tx_queue_tid(sc, tid); 678 613 679 614 if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY)) 680 615 tid->clear_ps_filter = true; ··· 719 660 720 661 spin_lock_bh(&acq->lock); 721 662 an->airtime_deficit[q] -= airtime; 663 + if (an->airtime_deficit[q] <= 0) 664 + __ath_tx_queue_tid(sc, tid); 722 665 spin_unlock_bh(&acq->lock); 723 666 } 724 667 ath_debug_airtime(sc, an, 0, airtime); ··· 770 709 } else 771 710 ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok); 772 711 712 + if (!flush) 713 + ath_txq_schedule(sc, txq); 773 714 } 774 715 775 716 static bool ath_lookup_legacy(struct ath_buf *bf) ··· 1506 1443 } while (1); 1507 1444 } 1508 1445 1509 - static int ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, 1510 - struct ath_atx_tid *tid) 1446 + static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, 1447 + struct ath_atx_tid *tid) 1511 1448 { 1512 1449 struct ath_buf *bf; 1513 1450 struct ieee80211_tx_info *tx_info; ··· 1515 1452 int aggr_len = 0; 1516 1453 bool aggr; 1517 1454 1455 + if (!ath_tid_has_buffered(tid)) 1456 + return false; 1457 + 1518 1458 INIT_LIST_HEAD(&bf_q); 1519 1459 1520 1460 bf = ath_tx_get_tid_subframe(sc, txq, tid); 1521 1461 if (!bf) 1522 - return -ENOENT; 1462 + return false; 1523 1463 1524 1464 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); 1525 1465 aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU); 1526 1466 if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) || 1527 1467 (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { 1528 1468 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu); 1529 - return -ENOBUFS; 1469 + return false; 1530 1470 } 1531 1471 1532 1472 ath_set_rates(tid->an->vif, tid->an->sta, bf); ··· 1539 1473 ath_tx_form_burst(sc, txq, tid, &bf_q, bf); 1540 1474 1541 1475 if (list_empty(&bf_q)) 1542 - return -ENOENT; 1476 + return false; 1543 1477 1544 1478 if (tid->clear_ps_filter || tid->an->no_ps_filter) { 1545 1479 tid->clear_ps_filter = false; ··· 1548 1482 1549 1483 ath_tx_fill_desc(sc, bf, txq, aggr_len); 1550 1484 ath_tx_txqaddbuf(sc, txq, &bf_q, false); 1551 - return 0; 1485 + return true; 1552 1486 } 1553 1487 1554 1488 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, ··· 1611 1545 { 1612 1546 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1613 1547 struct ath_atx_tid *tid; 1614 - struct ieee80211_txq *queue; 1615 - int tidno; 1616 - 1617 - ath_dbg(common, XMIT, "%s called\n", __func__); 1618 - 1619 - for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { 1620 - tid = ath_node_to_tid(an, tidno); 1621 - queue = container_of((void *)tid, 1622 - struct ieee80211_txq, drv_priv); 1623 - 1624 - if (!skb_queue_empty(&tid->retry_q)) 1625 - ieee80211_sta_set_buffered(sta, tid->tidno, true); 1626 - 1627 - } 1628 - } 1629 - 1630 - void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) 1631 - { 1632 - struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1633 - struct ieee80211_txq *queue; 1634 - struct ath_atx_tid *tid; 1635 1548 struct ath_txq *txq; 1636 1549 int tidno; 1637 - bool sched, wake = false; 1638 1550 1639 1551 ath_dbg(common, XMIT, "%s called\n", __func__); 1640 1552 1641 1553 for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { 1642 1554 tid = ath_node_to_tid(an, tidno); 1643 1555 txq = tid->txq; 1644 - queue = container_of((void *)tid, 1645 - struct ieee80211_txq, drv_priv); 1556 + 1557 + ath_txq_lock(sc, txq); 1558 + 1559 + if (list_empty(&tid->list)) { 1560 + ath_txq_unlock(sc, txq); 1561 + continue; 1562 + } 1563 + 1564 + if (!skb_queue_empty(&tid->retry_q)) 1565 + ieee80211_sta_set_buffered(sta, tid->tidno, true); 1566 + 1567 + list_del_init(&tid->list); 1568 + 1569 + ath_txq_unlock(sc, txq); 1570 + } 1571 + } 1572 + 1573 + void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) 1574 + { 1575 + struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1576 + struct ath_atx_tid *tid; 1577 + struct ath_txq *txq; 1578 + int tidno; 1579 + 1580 + ath_dbg(common, XMIT, "%s called\n", __func__); 1581 + 1582 + for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) { 1583 + tid = ath_node_to_tid(an, tidno); 1584 + txq = tid->txq; 1646 1585 1647 1586 ath_txq_lock(sc, txq); 1648 1587 tid->clear_ps_filter = true; 1649 - sched = !skb_queue_empty(&tid->retry_q); 1650 - ath_txq_unlock(sc, txq); 1651 - 1652 - if (sched && ieee80211_schedule_txq(sc->hw, queue)) 1653 - wake = true; 1588 + if (ath_tid_has_buffered(tid)) { 1589 + ath_tx_queue_tid(sc, tid); 1590 + ath_txq_schedule(sc, txq); 1591 + } 1592 + ath_txq_unlock_complete(sc, txq); 1654 1593 } 1655 - if (wake) 1656 - ath_txq_schedule(sc); 1657 1594 } 1658 1595 1659 1596 void ath9k_release_buffered_frames(struct ieee80211_hw *hw, ··· 1948 1879 /* For each acq entry, for each tid, try to schedule packets 1949 1880 * for transmit until ampdu_depth has reached min Q depth. 1950 1881 */ 1951 - void ath_txq_schedule(struct ath_softc *sc) 1882 + void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) 1952 1883 { 1953 - struct ieee80211_hw *hw = sc->hw; 1954 1884 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1955 - struct ieee80211_txq *queue; 1956 1885 struct ath_atx_tid *tid; 1957 - struct ath_txq *txq; 1958 - int ret = 0; 1886 + struct list_head *tid_list; 1887 + struct ath_acq *acq; 1888 + bool active = AIRTIME_ACTIVE(sc->airtime_flags); 1889 + 1890 + if (txq->mac80211_qnum < 0) 1891 + return; 1959 1892 1960 1893 if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) 1961 1894 return; 1962 1895 1963 - queue = ieee80211_next_txq(hw); 1964 - if (!queue) 1965 - return; 1966 - 1967 - tid = (struct ath_atx_tid *)queue->drv_priv; 1968 - txq = tid->txq; 1969 - 1970 - ath_txq_lock(sc, txq); 1971 - if (txq->mac80211_qnum < 0) 1972 - goto out; 1973 - 1974 1896 spin_lock_bh(&sc->chan_lock); 1975 1897 rcu_read_lock(); 1898 + acq = &sc->cur_chan->acq[txq->mac80211_qnum]; 1976 1899 1977 - if (!sc->cur_chan->stopped) 1978 - ret = ath_tx_sched_aggr(sc, txq, tid); 1900 + if (sc->cur_chan->stopped) 1901 + goto out; 1979 1902 1980 - rcu_read_unlock(); 1981 - spin_unlock_bh(&sc->chan_lock); 1903 + begin: 1904 + tid_list = &acq->acq_new; 1905 + if (list_empty(tid_list)) { 1906 + tid_list = &acq->acq_old; 1907 + if (list_empty(tid_list)) 1908 + goto out; 1909 + } 1910 + tid = list_first_entry(tid_list, struct ath_atx_tid, list); 1911 + 1912 + if (active && tid->an->airtime_deficit[txq->mac80211_qnum] <= 0) { 1913 + spin_lock_bh(&acq->lock); 1914 + tid->an->airtime_deficit[txq->mac80211_qnum] += ATH_AIRTIME_QUANTUM; 1915 + list_move_tail(&tid->list, &acq->acq_old); 1916 + spin_unlock_bh(&acq->lock); 1917 + goto begin; 1918 + } 1919 + 1920 + if (!ath_tid_has_buffered(tid)) { 1921 + spin_lock_bh(&acq->lock); 1922 + if ((tid_list == &acq->acq_new) && !list_empty(&acq->acq_old)) 1923 + list_move_tail(&tid->list, &acq->acq_old); 1924 + else { 1925 + list_del_init(&tid->list); 1926 + } 1927 + spin_unlock_bh(&acq->lock); 1928 + goto begin; 1929 + } 1930 + 1931 + 1932 + /* 1933 + * If we succeed in scheduling something, immediately restart to make 1934 + * sure we keep the HW busy. 1935 + */ 1936 + if(ath_tx_sched_aggr(sc, txq, tid)) { 1937 + if (!active) { 1938 + spin_lock_bh(&acq->lock); 1939 + list_move_tail(&tid->list, &acq->acq_old); 1940 + spin_unlock_bh(&acq->lock); 1941 + } 1942 + goto begin; 1943 + } 1982 1944 1983 1945 out: 1946 + rcu_read_unlock(); 1947 + spin_unlock_bh(&sc->chan_lock); 1948 + } 1984 1949 1985 - if (ret != -ENOENT) 1986 - ieee80211_schedule_txq(hw, queue); 1950 + void ath_txq_schedule_all(struct ath_softc *sc) 1951 + { 1952 + struct ath_txq *txq; 1953 + int i; 1987 1954 1988 - ath_txq_unlock(sc, txq); 1955 + for (i = 0; i < IEEE80211_NUM_ACS; i++) { 1956 + txq = sc->tx.txq_map[i]; 1957 + 1958 + spin_lock_bh(&txq->axq_lock); 1959 + ath_txq_schedule(sc, txq); 1960 + spin_unlock_bh(&txq->axq_lock); 1961 + } 1989 1962 } 1990 1963 1991 1964 /***********/ ··· 2645 2534 2646 2535 if (list_empty(&txq->axq_q)) { 2647 2536 txq->axq_link = NULL; 2537 + ath_txq_schedule(sc, txq); 2648 2538 break; 2649 2539 } 2650 2540 bf = list_first_entry(&txq->axq_q, struct ath_buf, list); ··· 2697 2585 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); 2698 2586 } 2699 2587 ath_txq_unlock_complete(sc, txq); 2700 - ath_txq_schedule(sc); 2701 2588 } 2702 2589 2703 2590 void ath_tx_tasklet(struct ath_softc *sc) ··· 2711 2600 ath_tx_processq(sc, &sc->tx.txq[i]); 2712 2601 } 2713 2602 rcu_read_unlock(); 2714 - ath_txq_schedule(sc); 2715 2603 } 2716 2604 2717 2605 void ath_tx_edma_tasklet(struct ath_softc *sc) ··· 2796 2686 ath_txq_unlock_complete(sc, txq); 2797 2687 } 2798 2688 rcu_read_unlock(); 2799 - ath_txq_schedule(sc); 2800 2689 } 2801 2690 2802 2691 /*****************/ ··· 2875 2766 tid->baw_head = tid->baw_tail = 0; 2876 2767 tid->active = false; 2877 2768 tid->clear_ps_filter = true; 2769 + tid->has_queued = false; 2878 2770 __skb_queue_head_init(&tid->retry_q); 2879 2771 INIT_LIST_HEAD(&tid->list); 2880 2772 acno = TID_TO_WME_AC(tidno);
+6 -31
include/net/mac80211.h
··· 105 105 * The driver is expected to initialize its private per-queue data for stations 106 106 * and interfaces in the .add_interface and .sta_add ops. 107 107 * 108 - * The driver can't access the queue directly. To obtain the next queue to pull 109 - * frames from, the driver calls ieee80211_next_txq(). To dequeue a frame from a 110 - * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a 111 - * queue, it calls the .wake_tx_queue driver op. The driver is expected to 112 - * re-schedule the txq using ieee80211_schedule_txq() if it is still active 113 - * after the driver has finished pulling packets from it. 108 + * The driver can't access the queue directly. To dequeue a frame, it calls 109 + * ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a queue, it 110 + * calls the .wake_tx_queue driver op. 114 111 * 115 112 * For AP powersave TIM handling, the driver only needs to indicate if it has 116 113 * buffered packets in the driver specific data structures by calling ··· 3731 3734 struct ieee80211_vif *vif, 3732 3735 struct ieee80211_tdls_ch_sw_params *params); 3733 3736 3734 - void (*wake_tx_queue)(struct ieee80211_hw *hw); 3737 + void (*wake_tx_queue)(struct ieee80211_hw *hw, 3738 + struct ieee80211_txq *txq); 3735 3739 void (*sync_rx_queues)(struct ieee80211_hw *hw); 3736 3740 3737 3741 int (*start_nan)(struct ieee80211_hw *hw, ··· 5883 5885 * ieee80211_tx_dequeue - dequeue a packet from a software tx queue 5884 5886 * 5885 5887 * @hw: pointer as obtained from ieee80211_alloc_hw() 5886 - * @txq: pointer obtained from ieee80211_next_txq() 5888 + * @txq: pointer obtained from station or virtual interface 5887 5889 * 5888 5890 * Returns the skb if successful, %NULL if no frame was available. 5889 5891 */ 5890 5892 struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw, 5891 5893 struct ieee80211_txq *txq); 5892 - 5893 - /** 5894 - * ieee80211_schedule_txq - add txq to scheduling loop 5895 - * 5896 - * @hw: pointer as obtained from ieee80211_alloc_hw() 5897 - * @txq: pointer obtained from station or virtual interface 5898 - * 5899 - * Returns %true if the txq was actually added to the scheduling, 5900 - * %false otherwise. 5901 - */ 5902 - bool ieee80211_schedule_txq(struct ieee80211_hw *hw, 5903 - struct ieee80211_txq *txq); 5904 - 5905 - /** 5906 - * ieee80211_next_txq - get next tx queue to pull packets from 5907 - * 5908 - * @hw: pointer as obtained from ieee80211_alloc_hw() 5909 - * 5910 - * Returns the next txq if successful, %NULL if no queue is eligible. If a txq 5911 - * is returned, it will have been removed from the scheduler queue and needs to 5912 - * be re-scheduled with ieee80211_schedule_txq() to continue to be active. 5913 - */ 5914 - struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw); 5915 5894 5916 5895 /** 5917 5896 * ieee80211_txq_get_depth - get pending frame/byte count of given txq
+1 -5
net/mac80211/agg-tx.c
··· 226 226 clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags); 227 227 228 228 clear_bit(IEEE80211_TXQ_STOP, &txqi->flags); 229 - 230 - if (!ieee80211_schedule_txq(&sta->sdata->local->hw, txq)) 231 - return; 232 - 233 229 local_bh_disable(); 234 230 rcu_read_lock(); 235 - drv_wake_tx_queue(sta->sdata->local); 231 + drv_wake_tx_queue(sta->sdata->local, txqi); 236 232 rcu_read_unlock(); 237 233 local_bh_enable(); 238 234 }
+9 -3
net/mac80211/driver-ops.h
··· 1158 1158 trace_drv_return_void(local); 1159 1159 } 1160 1160 1161 - static inline void drv_wake_tx_queue(struct ieee80211_local *local) 1161 + static inline void drv_wake_tx_queue(struct ieee80211_local *local, 1162 + struct txq_info *txq) 1162 1163 { 1163 - trace_drv_wake_tx_queue(local); 1164 - local->ops->wake_tx_queue(&local->hw); 1164 + struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); 1165 + 1166 + if (!check_sdata_in_driver(sdata)) 1167 + return; 1168 + 1169 + trace_drv_wake_tx_queue(local, sdata, txq); 1170 + local->ops->wake_tx_queue(&local->hw, &txq->txq); 1165 1171 } 1166 1172 1167 1173 static inline int drv_start_nan(struct ieee80211_local *local,
-5
net/mac80211/ieee80211_i.h
··· 832 832 struct codel_vars def_cvars; 833 833 struct codel_stats cstats; 834 834 struct sk_buff_head frags; 835 - struct list_head schedule_order; 836 835 unsigned long flags; 837 836 838 837 /* keep last! */ ··· 1121 1122 struct fq fq; 1122 1123 struct codel_vars *cvars; 1123 1124 struct codel_params cparams; 1124 - 1125 - /* protects active_txqs and txqi->schedule_order */ 1126 - spinlock_t active_txq_lock; 1127 - struct list_head active_txqs; 1128 1125 1129 1126 const struct ieee80211_ops *ops; 1130 1127
-3
net/mac80211/main.c
··· 619 619 spin_lock_init(&local->rx_path_lock); 620 620 spin_lock_init(&local->queue_stop_reason_lock); 621 621 622 - INIT_LIST_HEAD(&local->active_txqs); 623 - spin_lock_init(&local->active_txq_lock); 624 - 625 622 INIT_LIST_HEAD(&local->chanctx_list); 626 623 mutex_init(&local->chanctx_mtx); 627 624
+1 -6
net/mac80211/sta_info.c
··· 1237 1237 drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta); 1238 1238 1239 1239 if (sta->sta.txq[0]) { 1240 - bool wake = false; 1241 - 1242 1240 for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) { 1243 1241 if (!txq_has_queue(sta->sta.txq[i])) 1244 1242 continue; 1245 1243 1246 - if (ieee80211_schedule_txq(&local->hw, sta->sta.txq[i])) 1247 - wake = true; 1244 + drv_wake_tx_queue(local, to_txq_info(sta->sta.txq[i])); 1248 1245 } 1249 - if (wake) 1250 - drv_wake_tx_queue(local); 1251 1246 } 1252 1247 1253 1248 skb_queue_head_init(&pending);
+29 -3
net/mac80211/trace.h
··· 2550 2550 ) 2551 2551 ); 2552 2552 2553 - DEFINE_EVENT(local_only_evt, drv_wake_tx_queue, 2554 - TP_PROTO(struct ieee80211_local *local), 2555 - TP_ARGS(local) 2553 + TRACE_EVENT(drv_wake_tx_queue, 2554 + TP_PROTO(struct ieee80211_local *local, 2555 + struct ieee80211_sub_if_data *sdata, 2556 + struct txq_info *txq), 2557 + 2558 + TP_ARGS(local, sdata, txq), 2559 + 2560 + TP_STRUCT__entry( 2561 + LOCAL_ENTRY 2562 + VIF_ENTRY 2563 + STA_ENTRY 2564 + __field(u8, ac) 2565 + __field(u8, tid) 2566 + ), 2567 + 2568 + TP_fast_assign( 2569 + struct ieee80211_sta *sta = txq->txq.sta; 2570 + 2571 + LOCAL_ASSIGN; 2572 + VIF_ASSIGN; 2573 + STA_ASSIGN; 2574 + __entry->ac = txq->txq.ac; 2575 + __entry->tid = txq->txq.tid; 2576 + ), 2577 + 2578 + TP_printk( 2579 + LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " ac:%d tid:%d", 2580 + LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->ac, __entry->tid 2581 + ) 2556 2582 ); 2557 2583 2558 2584 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
+1 -48
net/mac80211/tx.c
··· 1439 1439 codel_vars_init(&txqi->def_cvars); 1440 1440 codel_stats_init(&txqi->cstats); 1441 1441 __skb_queue_head_init(&txqi->frags); 1442 - INIT_LIST_HEAD(&txqi->schedule_order); 1443 1442 1444 1443 txqi->txq.vif = &sdata->vif; 1445 1444 ··· 1462 1463 1463 1464 fq_tin_reset(fq, tin, fq_skb_free_func); 1464 1465 ieee80211_purge_tx_queue(&local->hw, &txqi->frags); 1465 - list_del_init(&txqi->schedule_order); 1466 1466 } 1467 1467 1468 1468 int ieee80211_txq_setup_flows(struct ieee80211_local *local) ··· 1558 1560 ieee80211_txq_enqueue(local, txqi, skb); 1559 1561 spin_unlock_bh(&fq->lock); 1560 1562 1561 - if (ieee80211_schedule_txq(&local->hw, &txqi->txq)) 1562 - drv_wake_tx_queue(local); 1563 + drv_wake_tx_queue(local, txqi); 1563 1564 1564 1565 return true; 1565 1566 } ··· 3552 3555 return skb; 3553 3556 } 3554 3557 EXPORT_SYMBOL(ieee80211_tx_dequeue); 3555 - 3556 - bool ieee80211_schedule_txq(struct ieee80211_hw *hw, 3557 - struct ieee80211_txq *txq) 3558 - { 3559 - struct ieee80211_local *local = hw_to_local(hw); 3560 - struct txq_info *txqi = to_txq_info(txq); 3561 - bool ret = false; 3562 - 3563 - spin_lock_bh(&local->active_txq_lock); 3564 - 3565 - if (list_empty(&txqi->schedule_order)) { 3566 - list_add_tail(&txqi->schedule_order, &local->active_txqs); 3567 - ret = true; 3568 - } 3569 - 3570 - spin_unlock_bh(&local->active_txq_lock); 3571 - 3572 - return ret; 3573 - } 3574 - EXPORT_SYMBOL(ieee80211_schedule_txq); 3575 - 3576 - struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw) 3577 - { 3578 - struct ieee80211_local *local = hw_to_local(hw); 3579 - struct txq_info *txqi = NULL; 3580 - 3581 - spin_lock_bh(&local->active_txq_lock); 3582 - 3583 - if (list_empty(&local->active_txqs)) 3584 - goto out; 3585 - 3586 - txqi = list_first_entry(&local->active_txqs, 3587 - struct txq_info, schedule_order); 3588 - list_del_init(&txqi->schedule_order); 3589 - 3590 - out: 3591 - spin_unlock_bh(&local->active_txq_lock); 3592 - 3593 - if (!txqi) 3594 - return NULL; 3595 - 3596 - return &txqi->txq; 3597 - } 3598 - EXPORT_SYMBOL(ieee80211_next_txq); 3599 3558 3600 3559 void __ieee80211_subif_start_xmit(struct sk_buff *skb, 3601 3560 struct net_device *dev,