git: 0cb3b9229876 - main - LinuxKPI: 802.11: add print masks for tx status flags

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sun, 14 Jun 2026 22:32:24 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=0cb3b9229876a2a83d217779cf5ecd09eb153fc3

commit 0cb3b9229876a2a83d217779cf5ecd09eb153fc3
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-06-10 11:50:03 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-06-14 22:31:37 +0000

    LinuxKPI: 802.11: add print masks for tx status flags
    
    Add print masks for tx status flags and use them in the TX tracing
    in order to more easily debug TX problems.
    
    As a result it was easier to determine that some dirver like the mt7921
    (or mt76) do not always zero the status bits of the tx status information
    (it is a union with the control bits passed on TX) and thus we get bogus
    values back (rather than having flags in a different place than we thought).
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/include/linux/ieee80211.h | 11 +++++++++++
 sys/compat/linuxkpi/common/src/linux_80211.c         |  8 ++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
index b8f29560f200..dede010c57de 100644
--- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h
+++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h
@@ -466,9 +466,20 @@ enum ieee80211_tx_info_flags {
 	IEEE80211_TX_CTL_STBC			= BIT(20),
 } __packed;
 
+#define	IEEE80211_TX_INFO_FLAGS						\
+    "\010\1CTL_AMPDU\2CTL_ASSIGN_SEQ\3CTL_NO_ACK\4CTL_SEND_AFTER_DTIM"	\
+    "\5CTL_TX_OFFCHAN\6CTL_REQ_TX_STATUS"				\
+    "\7STATUS_EOSP\10STAT_ACK\11STAT_AMPDU\12STAT_AMPDU_NO_BACK"	\
+    "\13STAT_TX_FILTERED\14STAT_NOACK_TRANSMITTED"			\
+    "\15CTL_FIRST_FRAGMENT\16INTFL_DONT_ENCRYPT\17CTL_NO_CCK_RATE"	\
+    "\20CTL_INJECTED\21CTL_HW_80211_ENCAP\22CTL_USE_MINRATE"		\
+    "\23CTL_RATE_CTRL_PROBE\24CTL_LDPC\25CTL_STBC"
+
 enum ieee80211_tx_status_flags {
 	IEEE80211_TX_STATUS_ACK_SIGNAL_VALID	= BIT(0),
 };
+#define	IEEE80211_TX_STATUS_FLAGS					\
+    "\010\1ACK_SIGNAL_VALID"
 
 enum ieee80211_tx_control_flags {
 	/* XXX TODO .. right shift numbers */
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 11f76c3ff5a5..280c8dbe176c 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -8804,13 +8804,13 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 
 #ifdef LINUXKPI_DEBUG_80211
 	if (linuxkpi_debug_80211 & D80211_TRACE_TX)
-		printf("TX-STATUS: %s: hw %p skb %p status %d : flags %#x "
+		printf("TX-STATUS: %s: hw %p skb %p status %d : flags %b "
 		    "band %u hw_queue %u tx_time_est %d : "
 		    "rates [ %u %u %#x, %u %u %#x, %u %u %#x, %u %u %#x ] "
 		    "ack_signal %u ampdu_ack_len %u ampdu_len %u antenna %u "
-		    "tx_time %u flags %#x "
+		    "tx_time %u flags %b "
 		    "status_driver_data [ %p %p ]\n",
-		    __func__, hw, skb, status, info->flags,
+		    __func__, hw, skb, status, info->flags, IEEE80211_TX_INFO_FLAGS,
 		    info->band, info->hw_queue, info->tx_time_est,
 		    info->status.rates[0].idx, info->status.rates[0].count,
 		    info->status.rates[0].flags,
@@ -8822,7 +8822,7 @@ linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 		    info->status.rates[3].flags,
 		    info->status.ack_signal, info->status.ampdu_ack_len,
 		    info->status.ampdu_len, info->status.antenna,
-		    info->status.tx_time, info->status.flags,
+		    info->status.tx_time, info->status.flags, IEEE80211_TX_STATUS_FLAGS,
 		    info->status.status_driver_data[0],
 		    info->status.status_driver_data[1]);
 #endif