From nobody Fri Oct 16 03:54:19 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 4j5WK81LNSz6vpGN for ; Fri, 16 Oct 2026 03:54:20 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j5WK76Stlz4rcf for ; Fri, 16 Oct 2026 03:54:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792122859; 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=Syn4lAnTWD/QhY7cujgsu5cPcu1x3sWQ1kF/ls8f7gc=; b=DWzzqn1hIzF7KPF0qXFKYWoySb8Jj7NoGyTxcjbLFeergNp1t1kC9OGSF81FRjG+Yd7xSm Tad1PIG0QOsevsoPfVEMwYEUoW4BMFsOfuhnfVXQmXTNmK5UTOY4EwcQhWMChAJARhfp7t 4NNHryrFHatdsQIFUusuR9rHcMvP6eZBqKnwHo2vHzjCv+1IQ8tY540JZlACwMDLHy1+qu j7Os1Zih5oj+f1sHOfAAvoU4dOE0GqUYkfxv7GENHCRK8UOr3+y03JaLrT27URDvqYIYKj WRdQqPw4gUA6Xb3HXma0p0AoMFUSvaKd/V1/Xz0K/y/h3NQ5nFZhhXgQO4qGZg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792122859; b=qjPuEX5lPq9Jx++sl4+WkXZYeQJ8e67kTf3l1Vx3Yi1p5zHfepgp29cNqAgSM7bWF7emYr 40CCO+uXwCAj5ySthvBkKKs1sZKti5G73xqaMfgXetHaJdBc6HKUlAnjufRBMMuz9I3Q2i gnGMoqD6aOomLApGhG/v65xzjSsqUxqAaj3XsyuzS1C8E/nDRCuPCtxNWMpYW1GPOY0MDM vYML9KZcUSPisYqALxfG9yEPN4abIxsfxkQx5e5IJtaUgt2Ma1/2Z29+QJmBSvLQOQbGL5 26VpgNL+YqW6mrUISUEiGteUkAhno+4deYrn5aOsWom1NiF8QgB73z0jrlyqdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792122859; 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=Syn4lAnTWD/QhY7cujgsu5cPcu1x3sWQ1kF/ls8f7gc=; b=sGMgMJd6VzA2NDP9IG7/eXkmIS0i1DTd92StprqmGIeCuSf5bGcty4YhvHqmyyMMzNsA8X jxNV11O1o/BKK2Bs2Pf1C3/lKUbAfrkf52+GMhDPeqbH9YYtEXIkE0uzAlqTva1JySLuq5 sm5gjG+3XP9pTaBe8o2BVukRwKsk+m5dU21mqjaomGu+Bv185eTh5IungG1n/njFfFg2T+ rtpUIYb7vt7D+C4B5RNbo/EkKs1FFGLOSZghT6hN+MsMG36TfxpZVqHVrb8OBSQCruca9Y Dy2Vj9jj0Q89GUqkVbTVQQif3/vjtABSUVQy2UJGmwVPKfJricYrMUf8j87SIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j5WK75WqHz13G0 for ; Fri, 16 Oct 2026 03:54:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 388a5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Oct 2026 03:54:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 0a12ff65b964 - main - iwm: add iwm_enable_ac_txq(); use it for command queue setup List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository 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: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a12ff65b9647a6e31471e5d27a8692b4adb6803 Auto-Submitted: auto-generated Date: Fri, 16 Oct 2026 03:54:19 +0000 Message-Id: <6ad19feb.388a5.5a45539b@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=0a12ff65b9647a6e31471e5d27a8692b4adb6803 commit 0a12ff65b9647a6e31471e5d27a8692b4adb6803 Author: Adrian Chadd AuthorDate: 2026-10-16 03:53:55 +0000 Commit: Adrian Chadd CommitDate: 2026-10-16 03:53:58 +0000 iwm: add iwm_enable_ac_txq(); use it for command queue setup Port iwm_enable_ac_txq() from OpenBSD. It's effictively the command FIFO path in the existing iwm_enable_txq(). The OpenBSD driver does a bunch of TX aggregation queue setup in iwm_enable_txq() which isn't relevant here just quite yet and it doesn't currently hurt to leave the existing one here whilst I figure out the next steps. Locally tested: * 3160, 7260, 8260, 9260 - STA mode Obtained from: OpenBSD a6e25c727a2214219715b51ba6af2221d7e0d674 Differential Revision: https://reviews.freebsd.org/D60696 --- sys/dev/iwm/if_iwm.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-- sys/dev/iwm/if_iwm_sta.c | 13 +++++++----- sys/dev/iwm/if_iwm_util.h | 1 + 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index fef762024c6f..5d911475b6e1 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -1701,6 +1701,55 @@ iwm_nic_init(struct iwm_softc *sc) return 0; } +int +iwm_enable_ac_txq(struct iwm_softc *sc, int qid, int fifo) +{ + int err; + + if (!sc->cmd_hold_nic_awake) { + device_printf(sc->sc_dev, "%s: NIC not awake\n", __func__); + return (ENXIO); + } + + IWM_WRITE(sc, IWM_HBUS_TARG_WRPTR, qid << 8 | 0); + + iwm_write_prph(sc, IWM_SCD_QUEUE_STATUS_BITS(qid), + (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) + | (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); + + err = iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, (1 << qid)); + if (err) { + return err; + } + + iwm_write_prph(sc, IWM_SCD_QUEUE_RDPTR(qid), 0); + + iwm_write_mem32(sc, + sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0); + + /* Set scheduler window size and frame limit. */ + iwm_write_mem32(sc, + sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid) + + sizeof(uint32_t), + ((IWM_FRAME_LIMIT << IWM_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) & + IWM_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) | + ((IWM_FRAME_LIMIT + << IWM_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & + IWM_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK)); + + iwm_write_prph(sc, IWM_SCD_QUEUE_STATUS_BITS(qid), + (1 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) | + (fifo << IWM_SCD_QUEUE_STTS_REG_POS_TXF) | + (1 << IWM_SCD_QUEUE_STTS_REG_POS_WSL) | + IWM_SCD_QUEUE_STTS_REG_MSK); + + if (qid == sc->cmdqid) + iwm_write_prph(sc, IWM_SCD_EN_CTRL, + iwm_read_prph(sc, IWM_SCD_EN_CTRL) | (1 << qid)); + + return 0; +} + int iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo) { @@ -1841,8 +1890,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t scd_base_addr) iwm_nic_unlock(sc); /* enable command channel */ - error = iwm_enable_txq(sc, 0 /* unused */, sc->cmdqid, - IWM_TX_FIFO_CMD); + error = iwm_enable_ac_txq(sc, sc->cmdqid, IWM_TX_FIFO_CMD); if (error) return error; diff --git a/sys/dev/iwm/if_iwm_sta.c b/sys/dev/iwm/if_iwm_sta.c index 1c2725d33f90..902e33a8cc3a 100644 --- a/sys/dev/iwm/if_iwm_sta.c +++ b/sys/dev/iwm/if_iwm_sta.c @@ -365,18 +365,21 @@ iwm_add_aux_sta(struct iwm_softc *sc) * + non-DQA calls iwm_enable_ac_txq(), which does similar stuff to * command setup but not the command scheduler */ - if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_DQA_SUPPORT)) + if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_DQA_SUPPORT)) { qid = IWM_DQA_AUX_QUEUE; - else + ret = iwm_enable_txq(sc, IWM_AUX_STA_ID, qid, + IWM_TX_FIFO_MCAST); + } else { qid = IWM_AUX_QUEUE; + ret = iwm_enable_ac_txq(sc, qid, IWM_TX_FIFO_MCAST); + } + if (ret) + return ret; sc->sc_aux_sta.sta_id = IWM_AUX_STA_ID; sc->sc_aux_sta.tfd_queue_msk = (1 << qid); /* Map Aux queue to fifo - needs to happen before adding Aux station */ - ret = iwm_enable_txq(sc, IWM_AUX_STA_ID, qid, IWM_TX_FIFO_MCAST); - if (ret) - return ret; ret = iwm_add_int_sta_common(sc, &sc->sc_aux_sta, NULL, IWM_MAC_INDEX_AUX, 0); diff --git a/sys/dev/iwm/if_iwm_util.h b/sys/dev/iwm/if_iwm_util.h index 3512b3bcf8d3..861bcfe95462 100644 --- a/sys/dev/iwm/if_iwm_util.h +++ b/sys/dev/iwm/if_iwm_util.h @@ -125,6 +125,7 @@ extern int iwm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, extern boolean_t iwm_rx_diversity_allowed(struct iwm_softc *sc); extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx); +extern int iwm_enable_ac_txq(struct iwm_softc *sc, int qid, int fifo); extern int iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo); extern int iwm_flush_tx_path(struct iwm_softc *sc, uint32_t tfd_msk, uint32_t flags);