hostapd: add usteer2 patches

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-06-28 16:26:26 +02:00
parent b303909c83
commit 398e17a583
2 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
Index: hostapd-2021-02-20-59e9794c/src/drivers/driver.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/drivers/driver.h
+++ hostapd-2021-02-20-59e9794c/src/drivers/driver.h
@@ -2259,6 +2259,10 @@ struct hostap_sta_driver_data {
u8 tx_mcs;
u8 rx_vht_nss;
u8 tx_vht_nss;
+ u8 rx_hemcs;
+ u8 tx_hemcs;
+ u8 rx_he_nss;
+ u8 tx_he_nss;
};
struct hostapd_sta_add_params {
Index: hostapd-2021-02-20-59e9794c/src/drivers/driver_nl80211.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/drivers/driver_nl80211.c
+++ hostapd-2021-02-20-59e9794c/src/drivers/driver_nl80211.c
@@ -7123,6 +7123,8 @@ static int get_sta_handler(struct nl_msg
[NL80211_RATE_INFO_VHT_MCS] = { .type = NLA_U8 },
[NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
[NL80211_RATE_INFO_VHT_NSS] = { .type = NLA_U8 },
+ [NL80211_RATE_INFO_HE_NSS] = { .type = NLA_U8 },
+ [NL80211_RATE_INFO_HE_MCS] = { .type = NLA_U8 },
};
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -7215,6 +7217,10 @@ static int get_sta_handler(struct nl_msg
nla_get_u8(rate[NL80211_RATE_INFO_VHT_NSS]);
data->flags |= STA_DRV_DATA_TX_VHT_NSS;
}
+ if (rate[NL80211_RATE_INFO_HE_MCS])
+ data->tx_hemcs = nla_get_u8(rate[NL80211_RATE_INFO_HE_MCS]);
+ if (rate[NL80211_RATE_INFO_HE_NSS])
+ data->tx_he_nss = nla_get_u8(rate[NL80211_RATE_INFO_HE_NSS]);
}
if (stats[NL80211_STA_INFO_RX_BITRATE] &&
@@ -7245,11 +7251,16 @@ static int get_sta_handler(struct nl_msg
nla_get_u8(rate[NL80211_RATE_INFO_VHT_NSS]);
data->flags |= STA_DRV_DATA_RX_VHT_NSS;
}
+ if (rate[NL80211_RATE_INFO_HE_MCS])
+ data->rx_hemcs = nla_get_u8(rate[NL80211_RATE_INFO_HE_MCS]);
+ if (rate[NL80211_RATE_INFO_HE_NSS])
+ data->rx_he_nss = nla_get_u8(rate[NL80211_RATE_INFO_HE_NSS]);
}
if (stats[NL80211_STA_INFO_TID_STATS])
get_sta_tid_stats(data, stats[NL80211_STA_INFO_TID_STATS]);
+
return NL_SKIP;
}
Index: hostapd-2021-02-20-59e9794c/src/ap/ubus.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/ubus.c
+++ hostapd-2021-02-20-59e9794c/src/ap/ubus.c
@@ -349,6 +349,36 @@ hostapd_bss_get_clients(struct ubus_cont
blobmsg_add_u32(&b, "tx", sta_driver_data.current_tx_rate * 100);
blobmsg_close_table(&b, r);
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
+
+ r = blobmsg_open_table(&b, "mcs");
+ if (sta_driver_data.rx_hemcs) {
+ blobmsg_add_u32(&b, "he", 1);
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_hemcs);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_hemcs);
+ } else if (sta_driver_data.rx_vhtmcs) {
+ blobmsg_add_u32(&b, "vht", 1);
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_vhtmcs);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_vhtmcs);
+ } else {
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_mcs);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_mcs);
+ }
+ blobmsg_close_table(&b, r);
+
+ r = blobmsg_open_table(&b, "nss");
+ if (sta_driver_data.rx_he_nss) {
+ blobmsg_add_u32(&b, "he", 1);
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_he_nss);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_he_nss);
+ } else if (sta_driver_data.rx_vht_nss) {
+ blobmsg_add_u32(&b, "vht", 1);
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_vht_nss);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_vht_nss);
+ } else {
+ blobmsg_add_u32(&b, "rx", sta_driver_data.rx_mcs);
+ blobmsg_add_u32(&b, "tx", sta_driver_data.tx_mcs);
+ }
+ blobmsg_close_table(&b, r);
}
hostapd_parse_capab_blobmsg(sta);

View File

@@ -0,0 +1,103 @@
Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/ieee802_11.c
+++ hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
@@ -57,6 +57,15 @@
#include "gas_query_ap.h"
+static int
+ewma(int new, int old)
+{
+ #define ALPHA 10
+ 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,
Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.h
+++ hostapd-2021-02-20-59e9794c/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;
};
Index: hostapd-2021-02-20-59e9794c/src/ap/ubus.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/ubus.c
+++ hostapd-2021-02-20-59e9794c/src/ap/ubus.c
@@ -379,6 +379,9 @@ hostapd_bss_get_clients(struct ubus_cont
blobmsg_add_u32(&b, "tx", sta_driver_data.tx_mcs);
}
blobmsg_close_table(&b, r);
+
+ if (sta->signal_mgmt)
+ blobmsg_add_u32(&b, "signal_mgmt", sta->signal_mgmt);
}
hostapd_parse_capab_blobmsg(sta);
@@ -500,6 +503,9 @@ hostapd_bss_get_status(struct ubus_conte
if (hapd->conf->uci_section)
blobmsg_add_string(&b, "uci_section", hapd->conf->uci_section);
+ if (hapd->signal_mgmt)
+ blobmsg_add_u32(&b, "signal_mgmt", hapd->signal_mgmt);
+
ubus_send_reply(ctx, req, b.head);
return 0;
Index: hostapd-2021-02-20-59e9794c/src/ap/hostapd.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/hostapd.h
+++ hostapd-2021-02-20-59e9794c/src/ap/hostapd.h
@@ -446,6 +446,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;
};