Files
wlan-ap/feeds/ipq95xx/hostapd/patches/999-ssi_signal.patch
John Crispin aa245da361 ipq9574: add wifi hot-reload
Signed-off-by: John Crispin <john@phrozen.org>
2023-09-29 13:22:13 +02:00

76 lines
1.9 KiB
Diff

--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -57,6 +57,17 @@
#include "gas_query_ap.h"
+static int
+ewma(int new, int old)
+{
+ #define ALPHA 10
+ if (!old)
+ return new;
+ if (new >= 0)
+ return old;
+ return ((ALPHA * new) + ((100 - ALPHA) * old)) / 100;
+}
+
#ifdef CONFIG_FILS
static struct wpabuf *
prepare_auth_resp_fils(struct hostapd_data *hapd,
@@ -5873,7 +5882,7 @@ static int robust_action_frame(u8 catego
static int handle_action(struct hostapd_data *hapd,
const struct ieee80211_mgmt *mgmt, size_t len,
- unsigned int freq)
+ unsigned int freq, int ssi_signal)
{
struct sta_info *sta;
u8 *action __maybe_unused;
@@ -5930,6 +5939,7 @@ static int handle_action(struct hostapd_
sta->last_seq_ctrl = seq_ctrl;
sta->last_subtype = WLAN_FC_STYPE_ACTION;
+ sta->signal_mgmt = ewma(ssi_signal, sta->signal_mgmt);;
}
switch (mgmt->u.action.category) {
@@ -6109,6 +6119,8 @@ int ieee802_11_mgmt(struct hostapd_data
unsigned int freq;
int ssi_signal = fi ? fi->ssi_signal : 0;
+ hapd->signal_mgmt = ewma(ssi_signal, hapd->signal_mgmt);;
+
if (len < 24)
return 0;
@@ -6208,7 +6220,7 @@ int ieee802_11_mgmt(struct hostapd_data
break;
case WLAN_FC_STYPE_ACTION:
wpa_printf(MSG_DEBUG, "mgmt::action");
- ret = handle_action(hapd, mgmt, len, freq);
+ ret = handle_action(hapd, mgmt, len, freq, ssi_signal);
break;
default:
hostapd_logger(hapd, mgmt->sa, HOSTAPD_MODULE_IEEE80211,
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -331,6 +331,7 @@ struct sta_info {
#ifdef CONFIG_PASN
struct pasn_data *pasn;
#endif /* CONFIG_PASN */
+ int signal_mgmt;
};
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -451,6 +451,7 @@ struct hostapd_data {
#ifdef CONFIG_CTRL_IFACE_UDP
unsigned char ctrl_iface_cookie[CTRL_IFACE_COOKIE_LEN];
#endif /* CONFIG_CTRL_IFACE_UDP */
+ int signal_mgmt;
};