From 5af7e1e7d810ce3be82da705801ddbf081e4cc3d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 28 Feb 2022 10:29:35 +0100 Subject: [PATCH] ucode: add tool to read out the max clients an AP can handle per phy Fixes: WIFI-7197 Signed-off-by: John Crispin --- .../files/usr/share/ucentral/wifi_max_user.uc | 16 +++++++++++ feeds/ucentral/ucode/patches/0001-fixes.patch | 27 ++++++++++++++----- 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 feeds/ucentral/ucentral-schema/files/usr/share/ucentral/wifi_max_user.uc diff --git a/feeds/ucentral/ucentral-schema/files/usr/share/ucentral/wifi_max_user.uc b/feeds/ucentral/ucentral-schema/files/usr/share/ucentral/wifi_max_user.uc new file mode 100644 index 000000000..15bd96415 --- /dev/null +++ b/feeds/ucentral/ucentral-schema/files/usr/share/ucentral/wifi_max_user.uc @@ -0,0 +1,16 @@ +#!/usr/bin/ucode -R + +let nl = require("nl80211"); +let def = nl.const; + +function phy_get() { + let res = nl.request(def.NL80211_CMD_GET_WIPHY, def.NLM_F_DUMP, { split_wiphy_dump: true }); + + if (res === false) + warn("Unable to lookup phys: " + nl.error() + "\n"); + + return res; +} + +let phys = phy_get(); +printf("%d\n", phys[0].max_ap_assoc); diff --git a/feeds/ucentral/ucode/patches/0001-fixes.patch b/feeds/ucentral/ucode/patches/0001-fixes.patch index a64d90d68..a75e68aee 100644 --- a/feeds/ucentral/ucode/patches/0001-fixes.patch +++ b/feeds/ucentral/ucode/patches/0001-fixes.patch @@ -1,15 +1,15 @@ -From 1c89014c7c0e68e1eeb851ea538fb67a57988dd4 Mon Sep 17 00:00:00 2001 +From eac420899717e2d23f6d13304bd67278a7e91730 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 20 Jan 2022 10:48:35 +0100 Subject: [PATCH 1/2] fixes --- - lib/nl80211.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++---- + lib/nl80211.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++---- lib/rtnl.c | 1 + - 2 files changed, 69 insertions(+), 5 deletions(-) + 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/lib/nl80211.c b/lib/nl80211.c -index fc24fb8..e308ebc 100644 +index fc24fb8..1d0871a 100644 --- a/lib/nl80211.c +++ b/lib/nl80211.c @@ -45,6 +45,8 @@ limitations under the License. @@ -132,7 +132,7 @@ index fc24fb8..e308ebc 100644 .attrs = { { NL80211_STA_INFO_INACTIVE_TIME, "inactive_time", DT_U32, 0, NULL }, { NL80211_STA_INFO_RX_BYTES, "rx_bytes", DT_U32, 0, NULL }, -@@ -724,15 +783,16 @@ static const uc_nl_nested_spec_t nl80211_sta_info_nla = { +@@ -724,21 +783,22 @@ static const uc_nl_nested_spec_t nl80211_sta_info_nla = { { NL80211_STA_INFO_NONPEER_PM, "nonpeer_pm", DT_U32, 0, NULL }, { NL80211_STA_INFO_CHAIN_SIGNAL, "chain_signal", DT_S8, DF_MULTIPLE|DF_AUTOIDX, NULL }, { NL80211_STA_INFO_CHAIN_SIGNAL_AVG, "chain_signal_avg", DT_S8, DF_MULTIPLE|DF_AUTOIDX, NULL }, @@ -152,7 +152,22 @@ index fc24fb8..e308ebc 100644 } }; -@@ -1044,6 +1104,9 @@ uc_nl_parse_attrs(struct nl_msg *msg, char *base, const uc_nl_attr_spec_t *attrs + static const uc_nl_nested_spec_t nl80211_msg = { + .headsize = 0, +- .nattrs = 124, ++ .nattrs = 125, + .attrs = { + { NL80211_ATTR_4ADDR, "4addr", DT_U8, 0, NULL }, + { NL80211_ATTR_AIRTIME_WEIGHT, "airtime_weight", DT_U16, 0, NULL }, +@@ -864,6 +924,7 @@ static const uc_nl_nested_spec_t nl80211_msg = { + { NL80211_ATTR_WPA_VERSIONS, "wpa_versions", DT_U32, 0, NULL }, + { NL80211_ATTR_SUPPORTED_IFTYPES, "supported_iftypes", DT_NESTED, 0, &nl80211_ifcomb_limit_types_nla }, + { NL80211_ATTR_SOFTWARE_IFTYPES, "software_iftypes", DT_NESTED, 0, &nl80211_ifcomb_limit_types_nla }, ++ { NL80211_ATTR_MAX_AP_ASSOC_STA, "max_ap_assoc", DT_U16, 0, NULL }, + } + }; + +@@ -1044,6 +1105,9 @@ uc_nl_parse_attrs(struct nl_msg *msg, char *base, const uc_nl_attr_spec_t *attrs bool exists; for (i = 0; i < nattrs; i++) {