]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mac80211: add an option to fake ieee80211_connection_loss
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Mon, 7 Oct 2024 12:00:56 +0000 (15:00 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 Oct 2024 14:43:33 +0000 (16:43 +0200)
This allows faking this function in KUnit tests.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241007144851.3b42e7547c65.I3bcbd51bec9ccfc7c08739450ec778722549c007@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index 714f780cc0f5336bf1987594fd890e24e0f9b911..480b664151c922b8d4643fc5fc83bd6ff4834786 100644 (file)
@@ -31,6 +31,8 @@
 #include "led.h"
 #include "fils_aead.h"
 
+#include <kunit/static_stub.h>
+
 #define IEEE80211_AUTH_TIMEOUT         (HZ / 5)
 #define IEEE80211_AUTH_TIMEOUT_LONG    (HZ / 2)
 #define IEEE80211_AUTH_TIMEOUT_SHORT   (HZ / 10)
@@ -4182,8 +4184,13 @@ EXPORT_SYMBOL(ieee80211_beacon_loss);
 
 void ieee80211_connection_loss(struct ieee80211_vif *vif)
 {
-       struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-       struct ieee80211_hw *hw = &sdata->local->hw;
+       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_hw *hw;
+
+       KUNIT_STATIC_STUB_REDIRECT(ieee80211_connection_loss, vif);
+
+       sdata = vif_to_sdata(vif);
+       hw = &sdata->local->hw;
 
        trace_api_connection_loss(sdata);