wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/q05-003-hostapd-Add-UNII-band-into-sta_info-from-hostapd.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

165 lines
4.4 KiB
Diff

From 582ec6a160fda52817d8c4ddeb0cd430eaa5db8e Mon Sep 17 00:00:00 2001
From: saleemuddin shaik <quic_saleemud@quicinc.com>
Date: Tue, 7 Mar 2023 16:54:31 +0530
Subject: [PATCH] hostapd: Add UNII band into sta_info from hostapd
whitespace cleanup and tab alignment made proper.
Signed-off-by: saleemuddin shaik <quic_saleemud@quicinc.com>
---
src/ap/ctrl_iface_ap.c | 128 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 128 insertions(+)
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 1579ce4..f713c77 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -28,6 +28,19 @@
#ifdef CONFIG_CTRL_IFACE_MIB
+typedef enum {
+ BAND_UNII_1 = 1,
+ BAND_UNII_2A,
+ BAND_UNII_2C,
+ BAND_UNII_3,
+ BAND_UNII_4,
+ BAND_UNII_ALL_5G,
+ BAND_UNII_ALL_6G,
+ BAND_UNII_5,
+} band_info_t;
+
+static unsigned int uniibands[8] = {0};
+
static size_t hostapd_write_ht_mcs_bitmask(char *buf, size_t buflen,
size_t curr_len, const u8 *mcs_set)
{
@@ -232,6 +245,45 @@ static const char * hw_mode_str(enum hostapd_hw_mode mode)
return "unknown";
}
+unsigned int operclass_to_uniimask(unsigned int operclass)
+{
+ if ((operclass >= 115) && (operclass <= 117)) {
+ return BAND_UNII_1;
+ } else if ((operclass >= 118) && (operclass <= 120)) {
+ return BAND_UNII_2A;
+ } else if ((operclass >= 121) && (operclass <= 123)) {
+ return BAND_UNII_2C;
+ } else if (operclass == 124) {
+ return BAND_UNII_3;
+ } else if ((operclass >= 125) && (operclass <= 127)) {
+ return BAND_UNII_4;
+ } else if ((operclass >= 128) && (operclass <= 130)) {
+ return BAND_UNII_ALL_5G;
+ } else if ((operclass >= 131) && (operclass <= 135)) {
+ return BAND_UNII_ALL_6G;
+ } else if (operclass == 136) {
+ return BAND_UNII_5;
+ }
+
+ return 0;
+}
+
+void check_and_add_uniibands(band_info_t uniiband)
+{
+ uint8_t i = 0;
+
+ while (i < 8) {
+ if (uniibands[i] == uniiband) {
+ return;
+ }
+ else if (uniibands[i] == 0) {
+ uniibands[i] = uniiband;
+ return;
+ }
+ i++;
+ }
+}
+
static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
struct sta_info *sta,
@@ -360,6 +412,81 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
sta->supp_op_classes + 1,
sta->supp_op_classes[0]);
len += os_snprintf(buf + len, buflen - len, "\n");
+
+ u8 *op_classes = sta->supp_op_classes + 1;
+
+ while (*op_classes != 0) {
+ uint8_t uniiband = operclass_to_uniimask(*op_classes);
+ switch(uniiband) {
+ case BAND_UNII_1:
+ case BAND_UNII_2A:
+ case BAND_UNII_2C:
+ case BAND_UNII_3:
+ case BAND_UNII_4:
+ case BAND_UNII_ALL_5G:
+ case BAND_UNII_ALL_6G:
+ case BAND_UNII_5:
+ check_and_add_uniibands(uniiband);
+ default:
+ break;
+ }
+ op_classes++;
+ }
+
+ len += os_snprintf(buf + len, buflen - len, "uniibands supported: \n");
+ for (int i=0; (i < 8) && (uniibands[i] != 0); i++) {
+ switch(uniibands[i]) {
+ case BAND_UNII_1:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_1\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_2A:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_2A\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_2C:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_2C\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_3:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_3\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_4:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_4\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_ALL_5G:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_1 UNII_2A "
+ "UNII_2C UNII_3 UNII_4\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_ALL_6G:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_5 UNII_6 UNII_7 UNII_8\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ case BAND_UNII_5:
+ ret = os_snprintf(buf + len, buflen - len, "\tUNII_5\n");
+ if (os_snprintf_error(buflen - len, ret))
+ return len;
+ len += ret;
+ break;
+ }
+ }
}
if (sta->power_capab) {