From nobody Fri Jun 5 12:10:09 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gX0cf2X7Dz6gy7b for ; Fri, 05 Jun 2026 12:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gX0cf1GNzz44kd for ; Fri, 05 Jun 2026 12:10:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780661410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YdBiXEcNwOfLP8/iy7aM8bSociOFE7CoDPnQPCy7tLk=; b=xC9MA+J3Z/6iisSiNolPuaSRFS6MCQGNUd/nYP29taE2ktn0PeJKxA9qTxMjgO6ysBmm9N HCXUIPYyU9ZOEy/Dz6DozEorYHNeB2orJnq4GFMJ/zBI6AU06tFmSISnIDvcXwosPpIivI UAVE7OKABsZ0bgqzbs8zhJJM9P0qKMhXA5DlJLP9ATd9hLHO7D5IGs+dygp1/4opkDX74a 25OzDwk8DA0GWHMyAaxmvAqnlyZik45JGpSKAJRAhipiiGYVVapZrGfw9q47FfVkBGARJZ eMeLOAJo6ITCULMAQBP9+DiSoKnowNi/UZnHt9fvTuitLGKL/Ch693dPciHbhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780661410; a=rsa-sha256; cv=none; b=KyhLnDimVceWwzK2NzKp06CR8MFKnMz0M9qXyqpiC/7MPqPRrpVsYtXyykyyvJTspJKdJT DPxOwwer4t+D6nFkyT+ftY1TALXjMLME+4iiN32rNaLuYDQKAcOgdQkkDz3MV6mDyBiIId K/leIDfJYJsPlasV/D1IeshVISLCEUiSHkcAiI/GgF/8/HBSZlqtRiSofS5SkHA2K2sgaC iXdv7JoWz7Q1z+YybNY0vBUI/OYL30mYziTwlzKxz//79s8mxXVNLzmzPL5qHGgvZMwpca GtcG1/GShsF7oC7CnnRO2lGLkjL37k/0/dh2EZHpqOQQgUQ7BAdaF7JbDHlMTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780661410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YdBiXEcNwOfLP8/iy7aM8bSociOFE7CoDPnQPCy7tLk=; b=tt4tmvnDMzljiaueyoRll/UEtgNlvLwlUj4oColyhdOhvMunkcadZC4QXJSgo3kfItlZr3 0biZpBKJnqy/SXZX6MdgK1Y7oG0Rl2GtISpAMHrn7nlpJD/J1x0UvOTrZICJe/k0Kyv8jm 9JtaLYLcvCD9xEwJXyb6dITX2sPy+in4d2maWlwvgm2mafSLfJl/vNbe9luCZG4ve7L3Iz vWp9MWWCKrRxSvPpNTI5A4ovLwf74MFSRgNwXnFtu59+qup8PdTCs+CQU4cb5aHW+lR2Ny 4Ow/tgKc+gaRwFLCvClE0yPgkRMCdgUU80EBOnpD2+sTajiRi47vhckd3tZk3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gX0cd70JYzD0j for ; Fri, 05 Jun 2026 12:10:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 235ff by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 05 Jun 2026 12:10:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 259efa730c3d - main - LinuxKPI: 802.11: make *addba* work better List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 259efa730c3d5c52d6ef0faa1d57d66eea5afa8e Auto-Submitted: auto-generated Date: Fri, 05 Jun 2026 12:10:09 +0000 Message-Id: <6a22bca1.235ff.5277b1ac@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=259efa730c3d5c52d6ef0faa1d57d66eea5afa8e commit 259efa730c3d5c52d6ef0faa1d57d66eea5afa8e Author: Bjoern A. Zeeb AuthorDate: 2026-04-27 00:48:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-06-05 12:09:23 +0000 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 --- sys/compat/linuxkpi/common/src/linux_80211.c | 79 ++++++++++++++++++++++------ sys/compat/linuxkpi/common/src/linux_80211.h | 12 ++++- 2 files changed, 74 insertions(+), 17 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 774bcc531ad3..11c37f9529de 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -891,8 +891,7 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], } else { ltxq->txq.ac = ieee80211e_up_to_ac[tid & 7]; } - ltxq->seen_dequeue = false; - ltxq->stopped = false; + ltxq->flags = 0; ltxq->txq.vif = vif; ltxq->txq.tid = tid; ltxq->txq.sta = sta; @@ -2179,7 +2178,7 @@ lkpi_wake_tx_queues(struct ieee80211_hw *hw, struct ieee80211_sta *sta, continue; ltxq = TXQ_TO_LTXQ(sta->txq[tid]); - if (dequeue_seen && !ltxq->seen_dequeue) + if (dequeue_seen && (ltxq->flags & LKPI_TXQ_SEEN_DEQUEUE) == 0) continue; 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) continue; ltxq = TXQ_TO_LTXQ(sta->txq[tid]); - ic_printf(ic, " tid %d ltxq %p seen_dequeue %d stopped %d skb_queue_len %u\n", - tid, ltxq, ltxq->seen_dequeue, ltxq->stopped, skb_queue_len(<xq->skbq)); + ic_printf(ic, " tid %d ltxq %p flags %b skb_queue_len %u\n", + tid, ltxq, ltxq->flags, LKPI_TXQ_FLAGS_BITS, skb_queue_len(<xq->skbq)); } } 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.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); error = lkpi_80211_mo_ampdu_action(hw, vif, ¶ms); wiphy_unlock(hw->wiphy); - IEEE80211_LOCK(ic); - if (error != 0) { + if (error == IEEE80211_AMPDU_TX_START_IMMEDIATE) { + 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", __func__, error, ni, tap); 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)); } @@ -6171,17 +6182,27 @@ lkpi_ic_addba_response(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap params.amsdu = false; } - IEEE80211_UNLOCK(ic); + /* We are called all they way up from ieee80211_input* without lock. */ wiphy_lock(hw->wiphy); error = lkpi_80211_mo_ampdu_action(hw, vif, ¶ms); wiphy_unlock(hw->wiphy); - IEEE80211_LOCK(ic); if (error != 0) { ic_printf(ic, "%s: mo_ampdu_action returned %d. ni %p tap %p\n", __func__, error, ni, tap); 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;"); 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 lkpi_hw *lhw; + struct lkpi_sta *lsta; + struct ieee80211_sta *sta; ic = ni->ni_ic; lhw = ic->ic_softc; + lsta = ni->ni_drv_data; + sta = LSTA_TO_STA(lsta); TRACEOK("ADDBA RESP TIMEO tid %u", tap->txa_tid); 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); } @@ -8592,14 +8639,14 @@ linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *hw, IMPROVE("wiphy_lock? or assert?"); skb = NULL; 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; lvif = VIF_TO_LVIF(ltxq->txq.vif); if (lvif->hw_queue_stopped[ltxq->txq.ac]) { - ltxq->stopped = true; + ltxq->flags |= LKPI_TXQ_STOPPED; goto stopped; } @@ -9102,10 +9149,10 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) continue; ltxq = TXQ_TO_LTXQ(sta->txq[tid]); - if (!ltxq->stopped) + if ((ltxq->flags & LKPI_TXQ_STOPPED) == 0) continue; - ltxq->stopped = false; + ltxq->flags &= ~LKPI_TXQ_STOPPED; if (!skb_queue_empty(<xq->skbq)) 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; if (ltxq->txq_generation == lhw->txq_generation[ac]) goto out; + if ((ltxq->flags & (LKPI_TXQ_STOPPED|LKPI_TXQ_STOPPED_BA)) != 0) + goto out; IMPROVE("check AIRTIME_FAIRNESS"); diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index f33075b354d2..063be4251ccc 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -150,12 +150,20 @@ struct lkpi_radiotap_rx_hdr { 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 { TAILQ_ENTRY(lkpi_txq) txq_entry; struct mtx ltxq_mtx; - bool seen_dequeue; - bool stopped; + enum lkpi_txq_flags flags; + uint32_t txq_generation; struct sk_buff_head skbq; uint64_t frms_enqueued;