]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Share usec-to/from-TU conversion macros in a general location
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 16 Jul 2024 06:24:49 +0000 (11:54 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 6 Aug 2024 15:05:18 +0000 (18:05 +0300)
These can be used outside the context of FST and hostapd.c, so move the
macro definitions into a shared header file. In addition, fix the
currently unused US_TO_TU() definition and rename "US" to "USEC".

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/ap/hostapd.c
src/common/defs.h
src/fst/fst_session.c

index 9af5d919611dbe0973844904e734cb7a62ce99b4..6bd4805d54006f607a841be4f214de5dc13d3188 100644 (file)
@@ -400,8 +400,6 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
 #ifdef CONFIG_IEEE80211BE
 #ifdef CONFIG_TESTING_OPTIONS
 
-#define TU_TO_USEC(_val) ((_val) * 1024)
-
 static void hostapd_link_remove_timeout_handler(void *eloop_data,
                                                void *user_ctx)
 {
index 8cca094e8f14ae20611750afd07263df77858ae8..7bce6a64bef77df31d1276a9d885cc94c33b5779 100644 (file)
@@ -532,4 +532,9 @@ enum sae_pwe {
        SAE_PWE_NOT_SET = 4,
 };
 
+#define USEC_80211_TU 1024
+
+#define USEC_TO_TU(m) ((m) / USEC_80211_TU)
+#define TU_TO_USEC(m) ((m) * USEC_80211_TU)
+
 #endif /* DEFS_H */
index 49886ffaaac2758d6d83346c40c93e581be3e85a..f8de9a100fd920200411f8d79d761c241ba32fcc 100644 (file)
 #include "fst/fst_ctrl_defs.h"
 #endif /* CONFIG_FST_TEST */
 
-#define US_80211_TU 1024
-
-#define US_TO_TU(m) ((m) * / US_80211_TU)
-#define TU_TO_US(m) ((m) * US_80211_TU)
-
 #define FST_LLT_SWITCH_IMMEDIATELY 0
 
 #define fst_printf_session(s, level, format, ...) \
@@ -182,7 +177,8 @@ static void fst_session_timeout_handler(void *eloop_data, void *user_ctx)
 static void fst_session_stt_arm(struct fst_session *s)
 {
        /* Action frames sometimes get delayed. Use relaxed timeout (2*) */
-       eloop_register_timeout(0, 2 * TU_TO_US(FST_DEFAULT_SESSION_TIMEOUT_TU),
+       eloop_register_timeout(0,
+                              2 * TU_TO_USEC(FST_DEFAULT_SESSION_TIMEOUT_TU),
                               fst_session_timeout_handler, NULL, s);
        s->stt_armed = true;
 }