Skip to contentSkip to conversation

wifi: iwlwifi: fix iwlmld-test link failure

PATCH In review Arnd Bergmann 2 participants 2 messages May 23, 2025 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: iwlwifi: fix iwlmld-test link failure

From: Arnd Bergmann <[email protected]>

If the driver is built-in but the test is in a loadable module, the symbols are not exported, resulting in a link failure:

ERROR: modpost: "iwl_get_cmd_string" [drivers/net/wireless/intel/iwlwifi/mld/tests/iwlmld-tests.ko] undefined!
ERROR: modpost: "__iwl_dbg" [drivers/net/wireless/intel/iwlwifi/mld/tests/iwlmld-tests.ko] undefined!

Enable CONFIG_IWLWIFI_OPMODE_MODULAR in this configuration, to make those symbols visible.

Fixes d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
---
 drivers/net/wireless/intel/iwlwifi/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/Kconfig +1 -0
index 82f577da1a8b..153a8368b412 100644
@@ -97,6 +97,7 @@ config IWLWIFI_OPMODE_MODULAR
 	default y if IWLDVM=m
 	default y if IWLMVM=m
 	default y if IWLMLD=m
+	default y if IWLWIFI_KUNIT_TESTS=m
 
 comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM or IWLMLD"
 	depends on IWLDVM=n && IWLMVM=n && IWLMLD=n
Signature · 1 line
2.39.5
Reviewed-by Miriam Rachel Korenblit on v1 1/1
#1 lore raw
Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

If the driver is built-in but the test is in a loadable module, the symbols are not exported, resulting in a link failure:

ERROR: modpost: "iwl_get_cmd_string" [drivers/net/wireless/intel/iwlwifi/mld/tests/iwlmld-tests.ko] undefined!
ERROR: modpost: "__iwl_dbg" [drivers/net/wireless/intel/iwlwifi/mld/tests/iwlmld-tests.ko] undefined!

Enable CONFIG_IWLWIFI_OPMODE_MODULAR in this configuration, to make those symbols visible.

Hah, thanks. We were just debating exactly this fix, but I think if CONFIG_INET is _also_ turned off, we still have another link issue, so what we have now is actually the below (maybe the Fixes: is wrong then though)

commit 800fe085168e073910d8a0b758df0399d3c38323

Author: Benjamin Berg <[email protected]>
Date:   Mon May 12 14:04:33 2025 +0200

[BUGFIX] wifi: iwlwifi: ensure iwl_average_neg_dbm is available for kunit

The function was not compiled if CONFIG_INET was not enabled. Change it to always be compiled in. Also update the IWLWIFI_OPMODE_MODULAR check so that the symbol is exported even if only the kunit tests are build as a module.

Change-Id I02014d338de26768533cd07225780563393b4591
Fixes 1f52f7f0abe2 ("wifi: iwlwifi: move dBm averaging function into utils")
drivers/net/wireless/intel/iwlwifi/Kconfig +1 -0
index b2fb1dee59c0..e4a3fe2eaf57 100644
@@ -105,6 +105,7 @@ config IWLWIFI_OPMODE_MODULAR
 	default y if IWLMVM=m
 	default y if IWLXVT=m
 	default y if IWLMLD=m
+	default y if IWLWIFI_KUNIT_TESTS=m
 
 comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM or IWLMLD"
 	depends on IWLDVM=n && IWLMVM=n && IWLMLD=n
drivers/net/wireless/intel/iwlwifi/iwl-utils.c +1 -2
index 9edb8f512058..0049a8ca60f3 100644
@@ -82,6 +82,7 @@ int iwl_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,
 	return 0;
 }
 IWL_EXPORT_SYMBOL(iwl_tx_tso_segment);
+#endif /* CONFIG_INET */
 
 static u32 iwl_div_by_db(u32 value, u8 db)
 {
@@ -193,5 +194,3 @@ s8 iwl_average_neg_dbm(const u8 *neg_dbm_values, u8 len)
 	return clamp(average_magnitude - i, -128, 0);
 }
 IWL_EXPORT_SYMBOL(iwl_average_neg_dbm);
-
-#endif /* CONFIG_INET */