git: 04fd1598bc92 - stable/13 - iwlwifi: add FreeBSD specific debugging

From: Bjoern A. Zeeb <>
Date: Wed, 21 Sep 2022 14:01:33 UTC
The branch stable/13 has been updated by bz:


commit 04fd1598bc923607ead9ab10fe7e83d6c18d5f4c
Author:     Bjoern A. Zeeb <>
AuthorDate: 2022-08-17 16:11:47 +0000
Commit:     Bjoern A. Zeeb <>
CommitDate: 2022-09-21 11:46:46 +0000

    iwlwifi: add FreeBSD specific debugging
    "Invalid TXQ id" and "Queue <n> is stuck <x> <y>" are two errors seen
    more commonly by FreeBSD users.  Try to gather some extra data the
    "easy way" adding more error logging for these situations in the hope
    to find a clue or at least do more targetd debugging in the future.
    Note that for one of the errors the Linux Intel driver has a TODO to
    print register data.  If that will show up in future versions of the
    driver this may also help.
    Sponsored by:   The FreeBSD Foundation
    (cherry picked from commit e674ddec0b4138274539587fe9336b577ff1242a)
 sys/contrib/dev/iwlwifi/mvm/tx.c   |  5 +++++
 sys/contrib/dev/iwlwifi/queue/tx.c | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/sys/contrib/dev/iwlwifi/mvm/tx.c b/sys/contrib/dev/iwlwifi/mvm/tx.c
index 8125bb76f59e..303d9b1e5a02 100644
--- a/sys/contrib/dev/iwlwifi/mvm/tx.c
+++ b/sys/contrib/dev/iwlwifi/mvm/tx.c
@@ -1139,6 +1139,11 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
 	if (WARN_ONCE(txq_id == IWL_MVM_INVALID_QUEUE, "Invalid TXQ id")) {
+#if defined(__FreeBSD__)
+		IWL_ERR(mvm, "fc %#06x sta_id %u tid %u txq_id %u mvm %p "
+		    "skb %p { len %u } info %p sta %p\n", fc, mvmsta->sta_id,
+		    tid, txq_id, mvm, skb, skb->len, info, sta);
 		iwl_trans_free_tx_cmd(mvm->trans, dev_cmd);
 		return -1;
diff --git a/sys/contrib/dev/iwlwifi/queue/tx.c b/sys/contrib/dev/iwlwifi/queue/tx.c
index 3f6bda96bfb5..eb290a4fd06a 100644
--- a/sys/contrib/dev/iwlwifi/queue/tx.c
+++ b/sys/contrib/dev/iwlwifi/queue/tx.c
@@ -988,6 +988,19 @@ void iwl_txq_log_scd_error(struct iwl_trans *trans, struct iwl_txq *txq)
 	if (trans->trans_cfg->use_tfh) {
 		IWL_ERR(trans, "Queue %d is stuck %d %d\n", txq_id,
 			txq->read_ptr, txq->write_ptr);
+#if defined(__FreeBSD__)
+		/*
+		 * Dump some more queue and timer information to rule
+		 * out a LinuxKPI issues and gather some extra data.
+		 */
+		IWL_ERR(trans, "  need_update %d frozen %d ampdu %d "
+		   "now %ju stuck_timer.expires %ju "
+		   "frozen_expiry_remainder %ju wd_timeout %ju\n",
+		    txq->need_update, txq->frozen, txq->ampdu,
+		    (uintmax_t)jiffies, (uintmax_t)txq->stuck_timer.expires,
+		    (uintmax_t)txq->frozen_expiry_remainder,
+		    (uintmax_t)txq->wd_timeout);
 		/* TODO: access new SCD registers and dump them */