LinuxKPI: 802.11: make *addba* work better
Fill in more details for lkpi_ic_addba_request(), lkpi_ic_addba_response(), and lkpi_ic_addba_response_timeout(). Migrate the ltxq flags seen_dequeue and stopped to a bitfield and add %b support to log messages. This seemed the better approach after needing an additional stop field for BA while we have to hold packets from being transmitted. Sponsored by: The FreeBSD Foundation MFC after: 3 days
This commit is contained in:
@@ -891,8 +891,7 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN],
|
|||||||
} else {
|
} else {
|
||||||
ltxq->txq.ac = ieee80211e_up_to_ac[tid & 7];
|
ltxq->txq.ac = ieee80211e_up_to_ac[tid & 7];
|
||||||
}
|
}
|
||||||
ltxq->seen_dequeue = false;
|
ltxq->flags = 0;
|
||||||
ltxq->stopped = false;
|
|
||||||
ltxq->txq.vif = vif;
|
ltxq->txq.vif = vif;
|
||||||
ltxq->txq.tid = tid;
|
ltxq->txq.tid = tid;
|
||||||
ltxq->txq.sta = sta;
|
ltxq->txq.sta = sta;
|
||||||
@@ -2179,7 +2178,7 @@ lkpi_wake_tx_queues(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
|
ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
|
||||||
if (dequeue_seen && !ltxq->seen_dequeue)
|
if (dequeue_seen && (ltxq->flags & LKPI_TXQ_SEEN_DEQUEUE) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LKPI_80211_LTXQ_LOCK(ltxq);
|
LKPI_80211_LTXQ_LOCK(ltxq);
|
||||||
@@ -5793,8 +5792,8 @@ lkpi_80211_txq_tx_one(struct lkpi_sta *lsta, struct mbuf *m)
|
|||||||
if (sta->txq[tid] == NULL)
|
if (sta->txq[tid] == NULL)
|
||||||
continue;
|
continue;
|
||||||
ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
|
ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
|
||||||
ic_printf(ic, " tid %d ltxq %p seen_dequeue %d stopped %d skb_queue_len %u\n",
|
ic_printf(ic, " tid %d ltxq %p flags %b skb_queue_len %u\n",
|
||||||
tid, ltxq, ltxq->seen_dequeue, ltxq->stopped, skb_queue_len(<xq->skbq));
|
tid, ltxq, ltxq->flags, LKPI_TXQ_FLAGS_BITS, skb_queue_len(<xq->skbq));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ieee80211_free_node(ni);
|
ieee80211_free_node(ni);
|
||||||
@@ -6091,17 +6090,29 @@ lkpi_ic_addba_request(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap,
|
|||||||
params.tid = tap->txa_tid;
|
params.tid = tap->txa_tid;
|
||||||
params.amsdu = false;
|
params.amsdu = false;
|
||||||
|
|
||||||
IEEE80211_UNLOCK(ic);
|
/* We get called from if_transmit all the way up unlocked in net80211. */
|
||||||
|
IEEE80211_UNLOCK_ASSERT(ic);
|
||||||
wiphy_lock(hw->wiphy);
|
wiphy_lock(hw->wiphy);
|
||||||
error = lkpi_80211_mo_ampdu_action(hw, vif, ¶ms);
|
error = lkpi_80211_mo_ampdu_action(hw, vif, ¶ms);
|
||||||
wiphy_unlock(hw->wiphy);
|
wiphy_unlock(hw->wiphy);
|
||||||
IEEE80211_LOCK(ic);
|
if (error == IEEE80211_AMPDU_TX_START_IMMEDIATE) {
|
||||||
if (error != 0) {
|
ic_printf(ic, "%s: mo_ampdu_action returned AMPDU_TX_START_IMMEDIATE. "
|
||||||
|
"ni %p tap %p\n", __func__, ni, tap);
|
||||||
|
} else if (error != 0) {
|
||||||
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
|
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
|
||||||
__func__, error, ni, tap);
|
__func__, error, ni, tap);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sta->txq[tap->txa_tid] != NULL) {
|
||||||
|
struct lkpi_txq *ltxq;
|
||||||
|
|
||||||
|
ltxq = TXQ_TO_LTXQ(sta->txq[tap->txa_tid]);
|
||||||
|
TRACEOK("ADDBA REQ ltxq tid %u flags %b qlen %d", tap->txa_tid,
|
||||||
|
ltxq->flags, LKPI_TXQ_FLAGS_BITS, skb_queue_len(<xq->skbq));
|
||||||
|
ltxq->flags |= LKPI_TXQ_STOPPED_BA;
|
||||||
|
}
|
||||||
|
|
||||||
return (lhw->ic_addba_request(ni, tap, dialogtoken, baparamset, batimeout));
|
return (lhw->ic_addba_request(ni, tap, dialogtoken, baparamset, batimeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6171,17 +6182,27 @@ lkpi_ic_addba_response(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap
|
|||||||
params.amsdu = false;
|
params.amsdu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEEE80211_UNLOCK(ic);
|
/* We are called all they way up from ieee80211_input* without lock. */
|
||||||
wiphy_lock(hw->wiphy);
|
wiphy_lock(hw->wiphy);
|
||||||
error = lkpi_80211_mo_ampdu_action(hw, vif, ¶ms);
|
error = lkpi_80211_mo_ampdu_action(hw, vif, ¶ms);
|
||||||
wiphy_unlock(hw->wiphy);
|
wiphy_unlock(hw->wiphy);
|
||||||
IEEE80211_LOCK(ic);
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
|
ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n",
|
||||||
__func__, error, ni, tap);
|
__func__, error, ni, tap);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sta->txq[tap->txa_tid] != NULL) {
|
||||||
|
struct lkpi_txq *ltxq;
|
||||||
|
|
||||||
|
ltxq = TXQ_TO_LTXQ(sta->txq[tap->txa_tid]);
|
||||||
|
TRACEOK("ADDBA RESP ltxq tid %u flags %b qlen %d", tap->txa_tid,
|
||||||
|
ltxq->flags, LKPI_TXQ_FLAGS_BITS, skb_queue_len(<xq->skbq));
|
||||||
|
ltxq->flags &= ~LKPI_TXQ_STOPPED_BA;
|
||||||
|
|
||||||
|
lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tap->txa_tid], true);
|
||||||
|
}
|
||||||
|
|
||||||
IMPROVE_HT("who unleashes the TXQ? and when?, do we need to ni->ni_txseqs[tid] = tap->txa_start & 0xfff;");
|
IMPROVE_HT("who unleashes the TXQ? and when?, do we need to ni->ni_txseqs[tid] = tap->txa_start & 0xfff;");
|
||||||
|
|
||||||
return (lhw->ic_addba_response(ni, tap, status, baparamset, batimeout));
|
return (lhw->ic_addba_response(ni, tap, status, baparamset, batimeout));
|
||||||
@@ -6252,14 +6273,40 @@ lkpi_ic_addba_response_timeout(struct ieee80211_node *ni, struct ieee80211_tx_am
|
|||||||
{
|
{
|
||||||
struct ieee80211com *ic;
|
struct ieee80211com *ic;
|
||||||
struct lkpi_hw *lhw;
|
struct lkpi_hw *lhw;
|
||||||
|
struct lkpi_sta *lsta;
|
||||||
|
struct ieee80211_sta *sta;
|
||||||
|
|
||||||
ic = ni->ni_ic;
|
ic = ni->ni_ic;
|
||||||
lhw = ic->ic_softc;
|
lhw = ic->ic_softc;
|
||||||
|
lsta = ni->ni_drv_data;
|
||||||
|
sta = LSTA_TO_STA(lsta);
|
||||||
|
|
||||||
TRACEOK("ADDBA RESP TIMEO tid %u", tap->txa_tid);
|
TRACEOK("ADDBA RESP TIMEO tid %u", tap->txa_tid);
|
||||||
|
|
||||||
IMPROVE_HT();
|
IMPROVE_HT();
|
||||||
|
|
||||||
|
if (!lsta->added_to_drv) {
|
||||||
|
ic_printf(ic, "%s: lsta %p ni %p, sta %p not added to firmware\n",
|
||||||
|
__func__, lsta, ni, sta);
|
||||||
|
goto n80211;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We need to re-enable the txq and get packets out. */
|
||||||
|
if (sta->txq[tap->txa_tid] != NULL) {
|
||||||
|
struct lkpi_txq *ltxq;
|
||||||
|
struct ieee80211_hw *hw;
|
||||||
|
|
||||||
|
ltxq = TXQ_TO_LTXQ(sta->txq[tap->txa_tid]);
|
||||||
|
TRACEOK("ADDBA RESP TIMEO ltxq tid %u flags %b qlen %d",
|
||||||
|
tap->txa_tid, ltxq->flags, LKPI_TXQ_FLAGS_BITS,
|
||||||
|
skb_queue_len(<xq->skbq));
|
||||||
|
ltxq->flags &= ~LKPI_TXQ_STOPPED_BA;
|
||||||
|
|
||||||
|
hw = LHW_TO_HW(lhw);
|
||||||
|
lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tap->txa_tid], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
n80211:
|
||||||
lhw->ic_addba_response_timeout(ni, tap);
|
lhw->ic_addba_response_timeout(ni, tap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8592,14 +8639,14 @@ linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *hw,
|
|||||||
IMPROVE("wiphy_lock? or assert?");
|
IMPROVE("wiphy_lock? or assert?");
|
||||||
skb = NULL;
|
skb = NULL;
|
||||||
ltxq = TXQ_TO_LTXQ(txq);
|
ltxq = TXQ_TO_LTXQ(txq);
|
||||||
ltxq->seen_dequeue = true;
|
ltxq->flags |= LKPI_TXQ_SEEN_DEQUEUE;
|
||||||
|
|
||||||
if (ltxq->stopped)
|
if ((ltxq->flags & (LKPI_TXQ_STOPPED|LKPI_TXQ_STOPPED_BA)) != 0)
|
||||||
goto stopped;
|
goto stopped;
|
||||||
|
|
||||||
lvif = VIF_TO_LVIF(ltxq->txq.vif);
|
lvif = VIF_TO_LVIF(ltxq->txq.vif);
|
||||||
if (lvif->hw_queue_stopped[ltxq->txq.ac]) {
|
if (lvif->hw_queue_stopped[ltxq->txq.ac]) {
|
||||||
ltxq->stopped = true;
|
ltxq->flags |= LKPI_TXQ_STOPPED;
|
||||||
goto stopped;
|
goto stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9102,10 +9149,10 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
|
ltxq = TXQ_TO_LTXQ(sta->txq[tid]);
|
||||||
if (!ltxq->stopped)
|
if ((ltxq->flags & LKPI_TXQ_STOPPED) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ltxq->stopped = false;
|
ltxq->flags &= ~LKPI_TXQ_STOPPED;
|
||||||
|
|
||||||
if (!skb_queue_empty(<xq->skbq))
|
if (!skb_queue_empty(<xq->skbq))
|
||||||
lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid], false);
|
lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid], false);
|
||||||
@@ -9245,6 +9292,8 @@ linuxkpi_ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac)
|
|||||||
goto out;
|
goto out;
|
||||||
if (ltxq->txq_generation == lhw->txq_generation[ac])
|
if (ltxq->txq_generation == lhw->txq_generation[ac])
|
||||||
goto out;
|
goto out;
|
||||||
|
if ((ltxq->flags & (LKPI_TXQ_STOPPED|LKPI_TXQ_STOPPED_BA)) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
IMPROVE("check AIRTIME_FAIRNESS");
|
IMPROVE("check AIRTIME_FAIRNESS");
|
||||||
|
|
||||||
|
|||||||
@@ -150,12 +150,20 @@ struct lkpi_radiotap_rx_hdr {
|
|||||||
|
|
||||||
struct lkpi_hw;
|
struct lkpi_hw;
|
||||||
|
|
||||||
|
enum lkpi_txq_flags {
|
||||||
|
LKPI_TXQ_SEEN_DEQUEUE = 0x01,
|
||||||
|
LKPI_TXQ_STOPPED = 0x02,
|
||||||
|
LKPI_TXQ_STOPPED_BA = 0x04,
|
||||||
|
};
|
||||||
|
#define LKPI_TXQ_FLAGS_BITS \
|
||||||
|
"\010\1SEEN_DEQUEUE\2STOPPED\3STOPPED_BA"
|
||||||
|
|
||||||
struct lkpi_txq {
|
struct lkpi_txq {
|
||||||
TAILQ_ENTRY(lkpi_txq) txq_entry;
|
TAILQ_ENTRY(lkpi_txq) txq_entry;
|
||||||
|
|
||||||
struct mtx ltxq_mtx;
|
struct mtx ltxq_mtx;
|
||||||
bool seen_dequeue;
|
enum lkpi_txq_flags flags;
|
||||||
bool stopped;
|
|
||||||
uint32_t txq_generation;
|
uint32_t txq_generation;
|
||||||
struct sk_buff_head skbq;
|
struct sk_buff_head skbq;
|
||||||
uint64_t frms_enqueued;
|
uint64_t frms_enqueued;
|
||||||
|
|||||||
Reference in New Issue
Block a user