git: 07f6575585bf - main - LinuxKPI: 802.11: turn on debugfs for iwlwifi and rtw88

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Tue, 07 Jan 2025 18:07:43 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=07f6575585bf69ae48dffe87c4578057ae4782d8

commit 07f6575585bf69ae48dffe87c4578057ae4782d8
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-12-28 09:52:45 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-01-07 18:07:09 +0000

    LinuxKPI: 802.11: turn on debugfs for iwlwifi and rtw88
    
    Make iwlwifi compile with debugfs after the last updates and turn it on
    for both iwlwifi and rtw88 in order to be able to get at least some
    useful information on driver/firwmare state.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      10 days
---
 sys/compat/linuxkpi/common/include/net/mac80211.h | 4 ++++
 sys/contrib/dev/iwlwifi/mvm/debugfs-vif.c         | 2 ++
 sys/modules/iwlwifi/Makefile                      | 2 +-
 sys/modules/rtw88/Makefile                        | 5 ++++-
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index 3aa383554e93..fe36f1adf28a 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -737,6 +737,7 @@ struct ieee80211_sta_agg {
 };
 
 struct ieee80211_link_sta {
+	struct ieee80211_sta			*sta;
 	uint8_t					addr[ETH_ALEN];
 	uint8_t					link_id;
 	uint32_t				supp_rates[NUM_NL80211_BANDS];
@@ -1121,6 +1122,9 @@ struct ieee80211_ops {
 
 /* #ifdef CONFIG_MAC80211_DEBUGFS */	/* Do not change depending on compile-time option. */
 	void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);
+	void (*vif_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *);
+	void (*link_sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, struct dentry *);
+	void (*link_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct dentry *);
 /* #endif */
 };
 
diff --git a/sys/contrib/dev/iwlwifi/mvm/debugfs-vif.c b/sys/contrib/dev/iwlwifi/mvm/debugfs-vif.c
index aa5058955323..0b3bc62f39a7 100644
--- a/sys/contrib/dev/iwlwifi/mvm/debugfs-vif.c
+++ b/sys/contrib/dev/iwlwifi/mvm/debugfs-vif.c
@@ -888,10 +888,12 @@ void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 {
 	struct dentry *dbgfs_dir = vif->debugfs_dir;
+#if defined(__linux__)
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	char buf[3 * 3 + 11 + (NL80211_WIPHY_NAME_MAXLEN + 1) +
 		 (7 + IFNAMSIZ + 1) + 6 + 1];
 	char name[7 + IFNAMSIZ + 1];
+#endif
 
 	/* this will happen in monitor mode */
 	if (!dbgfs_dir)
diff --git a/sys/modules/iwlwifi/Makefile b/sys/modules/iwlwifi/Makefile
index a8176383a13c..c41a1a1757c1 100644
--- a/sys/modules/iwlwifi/Makefile
+++ b/sys/modules/iwlwifi/Makefile
@@ -3,7 +3,7 @@ DEVIWLWIFIDIR=	${SRCTOP}/sys/contrib/dev/iwlwifi
 .PATH: ${DEVIWLWIFIDIR}
 
 WITH_CONFIG_PM=	0
-WITH_DEBUGFS=	0
+WITH_DEBUGFS=	1
 
 KMOD=	if_iwlwifi
 
diff --git a/sys/modules/rtw88/Makefile b/sys/modules/rtw88/Makefile
index 19e77b271c37..486197d8c952 100644
--- a/sys/modules/rtw88/Makefile
+++ b/sys/modules/rtw88/Makefile
@@ -3,6 +3,7 @@ DEVRTW88DIR=	${SRCTOP}/sys/contrib/dev/rtw88
 .PATH: ${DEVRTW88DIR}
 
 WITH_CONFIG_PM=	0
+WITH_DEBUGFS=	1
 
 KMOD=	if_rtw88
 
@@ -39,6 +40,8 @@ CFLAGS+=	-DLINUXKPI_VERSION=60800
 CFLAGS+=	-I${DEVRTW88DIR}
 CFLAGS+=	${LINUXKPI_INCLUDES}
 CFLAGS+=	-DCONFIG_RTW88_DEBUG
-#CFLAGS+=	-DCONFIG_RTW88_DEBUGFS
+.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0
+CFLAGS+=	-DCONFIG_RTW88_DEBUGFS
+.endif
 
 .include <bsd.kmod.mk>