[rdkb][common][conf][Add filogic830 onewifi build support]
[Description]
Add filogic830 onewifi build support
[Release-log]
Change-Id: I5db0bc298ecfbc84c4338bf6dac77a15ddd3474e
diff --git a/recipes-ccsp/hal/files/0001-filogic-platform-support.patch b/recipes-ccsp/hal/files/0001-filogic-platform-support.patch
new file mode 100644
index 0000000..4735fde
--- /dev/null
+++ b/recipes-ccsp/hal/files/0001-filogic-platform-support.patch
@@ -0,0 +1,343 @@
+From 26ae462db9f0ad61ff3199412d7a4455259682eb Mon Sep 17 00:00:00 2001
+From: Rex Lu <rex.lu@mediatek.com>
+Date: Wed, 29 May 2024 11:16:08 +0800
+Subject: [PATCH] filogic platform support
+
+---
+ platform/mtk-filogic/platform_filogic.c | 206 ++++++++++++++++++++++++
+ src/Makefile.am | 4 +
+ src/configure.ac | 1 +
+ src/wifi_hal_nl80211_utils.c | 36 ++++-
+ src/wifi_hal_priv.h | 8 +-
+ 5 files changed, 250 insertions(+), 5 deletions(-)
+ create mode 100644 platform/mtk-filogic/platform_filogic.c
+
+diff --git a/platform/mtk-filogic/platform_filogic.c b/platform/mtk-filogic/platform_filogic.c
+new file mode 100644
+index 0000000..0d09599
+--- /dev/null
++++ b/platform/mtk-filogic/platform_filogic.c
+@@ -0,0 +1,206 @@
++#include <stddef.h>
++#include <string.h>
++#include <stdlib.h>
++#include "wifi_hal_priv.h"
++#include "wifi_hal.h"
++
++int platform_pre_init()
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_post_init(wifi_vap_info_map_t *vap_map)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ system("brctl addif brlan0 wifi0");
++ system("brctl addif brlan0 wifi1");
++ system("brctl addif brlan0 wifi2");
++ return 0;
++}
++
++
++int platform_set_radio(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_set_radio_pre_init(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int nvram_get_vap_enable_status(bool *vap_enable, int vap_index)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int nvram_get_current_security_mode(wifi_security_modes_t *security_mode,int vap_index)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_get_keypassphrase_default(char *password, int vap_index)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ /*password is not sensitive,won't grant access to real devices*/
++ strcpy(password,"12345678");
++ return 0;
++}
++
++int platform_get_ssid_default(char *ssid, int vap_index)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ sprintf(ssid,"filogic-onewifi%d",vap_index);
++ return 0;
++}
++
++int platform_get_wps_pin_default(char *pin)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ /* dummy pin value */
++ strcpy(pin,"45276453");
++ return 0;
++}
++
++int platform_wps_event(wifi_wps_event_t data)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_get_country_code_default(char *code)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ strcpy(code,"US");
++ return 0;
++}
++
++int nvram_get_current_password(char *l_password, int vap_index)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ /*password is not sensitive,won't grant access to real devices*/
++ strcpy(l_password,"12345678");
++ return 0;
++}
++
++int nvram_get_current_ssid(char *l_ssid, int vap_index)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ sprintf(l_ssid,"filogic-onewifi%d",vap_index);
++ return 0;
++}
++
++int platform_pre_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_flags_init(int *flags)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_get_aid(void* priv, u16* aid, const u8* addr)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_free_aid(void* priv, u16* aid)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_sync_done(void* priv)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_get_channel_bandwidth(wifi_radio_index_t index, wifi_channelBandwidth_t *channelWidth)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_update_radio_presence(void)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int nvram_get_mgmt_frame_power_control(int vap_index, int* output_dbm)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_set_txpower(void* priv, uint txpower)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++int platform_get_radius_key_default(char *radius_key)
++{
++ wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__);
++ return 0;
++}
++
++INT wifi_setRadioDfsAtBootUpEnable(INT radioIndex, BOOL enabled)
++{
++ return RETURN_OK;
++}
++INT wifi_setApMacAddressControlMode(INT apIndex, INT filterMode)
++{
++ return RETURN_OK;
++}
++INT wifi_setApManagementFramePowerControl(INT wlanIndex, INT ManagementFramePowerControl)
++{
++ return RETURN_OK;
++}
++
++int platform_get_acl_num(int vap_index, uint *acl_count)
++{
++ return 0;
++}
++
++int platform_get_vendor_oui(char *vendor_oui, int vendor_oui_len)
++{
++ return -1;
++}
++
++int platform_set_neighbor_report(uint index, uint add, mac_address_t mac)
++{
++ return 0;
++}
++
++int platform_get_radio_phytemperature(wifi_radio_index_t index,
++ wifi_radioTemperature_t *radioPhyTemperature)
++{
++ return 0;
++}
++
++int wifi_setQamPlus(void *priv)
++{
++ return 0;
++}
++
++int wifi_setApRetrylimit(void *priv)
++{
++ return 0;
++}
+\ No newline at end of file
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 055bb1d..5974ed1 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -104,6 +104,10 @@ librdk_wifihal_la_CPPFLAGS += -I$(top_srcdir)/../platform/raspberry-pi
+ librdk_wifihal_la_SOURCES += ../platform/raspberry-pi/platform_pi.c
+ endif
+
++if MTK_FILOGIC
++librdk_wifihal_la_CPPFLAGS += -I$(top_srcdir)/../platform/mtk-filogic
++librdk_wifihal_la_SOURCES += ../platform/mtk-filogic/platform_filogic.c
++endif
+ include_HEADERS = wifi_hal_rdk.h wifi_hal_rdk_framework.h ieee80211.h ../util_crypto/aes_siv.h
+
+ if ONE_WIFIBUILD
+diff --git a/src/configure.ac b/src/configure.ac
+index f1ca7d2..03c4d97 100644
+--- a/src/configure.ac
++++ b/src/configure.ac
+@@ -52,6 +52,7 @@ AM_CONDITIONAL([SCXER10_PORT], [test "x$SCXER10_PORT" = "xtrue"])
+ AM_CONDITIONAL([SKYSR213_PORT], [test "x$SKYSR213_PORT" = "xtrue"])
+ AM_CONDITIONAL([CMXB7_PORT], [test "x$CMXB7_PORT" = "xtrue"])
+ AM_CONDITIONAL([HAL_IPC], [test "x$HAL_IPC" = "xtrue"])
++AM_CONDITIONAL([MTK_FILOGIC], [test "x$MTK_FILOGIC" = "xtrue"])
+
+ AC_PREFIX_DEFAULT(`pwd`)
+ AC_ENABLE_SHARED
+diff --git a/src/wifi_hal_nl80211_utils.c b/src/wifi_hal_nl80211_utils.c
+index 02251a3..da9dc33 100644
+--- a/src/wifi_hal_nl80211_utils.c
++++ b/src/wifi_hal_nl80211_utils.c
+@@ -285,6 +285,10 @@ wifi_interface_name_idex_map_t interface_index_map[] = {
+ #endif
+
+ // for Intel based platforms
++#ifdef MTK_FILOGIC
++ {0, 0, "wifi0", "brlan0", 0, 0, "private_ssid_2g"},
++ {1, 1, "wifi1", "brlan0", 0, 1, "private_ssid_5g"},
++#endif
+ };
+
+ static radio_interface_mapping_t l_radio_interface_map[] = {
+@@ -331,6 +335,10 @@ static radio_interface_mapping_t l_radio_interface_map[] = {
+ { 0, 0, "radio1", "wlan0"},
+ { 1, 1, "radio2", "wlan1"},
+ #endif
++#ifdef MTK_FILOGIC
++ { 0, 0, "radio1", "wifi0"},
++ { 1, 1, "radio2", "wifi1"},
++#endif
+ };
+
+ const wifi_driver_info_t driver_info = {
+@@ -614,7 +622,33 @@ const wifi_driver_info_t driver_info = {
+ platform_set_neighbor_report,
+ platform_get_radio_phytemperature,
+ #endif
+-
++#ifdef MTK_FILOGIC
++ "filogic",
++ "cfg80211",
++ {"Filogic Wireless Gateway","Filogic","Filogic","Filogic","Model Description","Model URL","267","WPS Access Point","Manufacturer URL"},
++ platform_pre_init,
++ platform_post_init,
++ platform_set_radio,
++ platform_set_radio_pre_init,
++ platform_pre_create_vap,
++ platform_create_vap,
++ platform_get_ssid_default,
++ platform_get_keypassphrase_default,
++ platform_get_radius_key_default,
++ platform_get_wps_pin_default,
++ platform_get_country_code_default,
++ platform_wps_event,
++ platform_flags_init,
++ platform_get_aid,
++ platform_free_aid,
++ platform_sync_done,
++ platform_update_radio_presence,
++ platform_set_txpower,
++ platform_get_acl_num,
++ platform_get_vendor_oui,
++ platform_set_neighbor_report,
++ platform_get_radio_phytemperature,
++#endif
+ };
+
+ static struct wifiCountryEnumStrMap wifi_country_map[] =
+diff --git a/src/wifi_hal_priv.h b/src/wifi_hal_priv.h
+index abdfe12..a1b173b 100644
+--- a/src/wifi_hal_priv.h
++++ b/src/wifi_hal_priv.h
+@@ -177,16 +177,16 @@ extern "C" {
+ #define MAX_CHANNEL_2G 11
+
+ /* 5GHz radio */
+-#define MIN_FREQ_MHZ_5G 5180
+-#define MAX_FREQ_MHZ_5G 5825
++#define MIN_FREQ_MHZ_5G 4920
++#define MAX_FREQ_MHZ_5G 5885
+ #define MIN_CHANNEL_5G 36
+-#define MAX_CHANNEL_5G 165
++#define MAX_CHANNEL_5G 177
+
+ /* 6GHz radio */
+ #define MIN_FREQ_MHZ_6G 5935
+ #define MAX_FREQ_MHZ_6G 7115
+ #define MIN_CHANNEL_6G 1
+-#define MAX_CHANNEL_6G 229
++#define MAX_CHANNEL_6G 233
+
+ #define MAX_WPS_CONN_TIMEOUT 120
+
+--
+2.18.0
+
diff --git a/recipes-ccsp/hal/files/0002-fix-5G-and-6G-connect-fail.patch b/recipes-ccsp/hal/files/0002-fix-5G-and-6G-connect-fail.patch
new file mode 100644
index 0000000..de76551
--- /dev/null
+++ b/recipes-ccsp/hal/files/0002-fix-5G-and-6G-connect-fail.patch
@@ -0,0 +1,341 @@
+From 12d23aa04385369d86468d080b114a82ef8a3b38 Mon Sep 17 00:00:00 2001
+From: Rex Lu <rex.lu@mediatek.com>
+Date: Wed, 29 May 2024 14:08:06 +0800
+Subject: [PATCH] fix 5G and 6G connect fail
+
+---
+ src/wifi_hal_hostapd.c | 20 +++---------------
+ src/wifi_hal_nl80211.c | 39 +++++++++---------------------------
+ src/wifi_hal_nl80211_utils.c | 20 ++++++++++++++++--
+ 3 files changed, 30 insertions(+), 49 deletions(-)
+
+diff --git a/src/wifi_hal_hostapd.c b/src/wifi_hal_hostapd.c
+index 7921406..96f1f56 100644
+--- a/src/wifi_hal_hostapd.c
++++ b/src/wifi_hal_hostapd.c
+@@ -1397,7 +1397,6 @@ int update_hostap_iface(wifi_interface_info_t *interface)
+ */
+ #endif
+
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ iface->drv_flags = radio->driver_data.capa.flags;
+ //iface->drv_flags |= WPA_DRIVER_FLAGS_INACTIVITY_TIMER;
+ iface->drv_flags |= WPA_DRIVER_FLAGS_EAPOL_TX_STATUS;
+@@ -1435,20 +1434,7 @@ int update_hostap_iface(wifi_interface_info_t *interface)
+ iface->extended_capa = radio->driver_data.extended_capa;
+ iface->extended_capa_mask = radio->driver_data.extended_capa_mask;
+ iface->extended_capa_len = radio->driver_data.extended_capa_len;
+-#else
+- iface->drv_flags = WPA_DRIVER_FLAGS_INACTIVITY_TIMER;
+- iface->drv_flags |= WPA_DRIVER_FLAGS_EAPOL_TX_STATUS;
+- iface->drv_flags |= WPA_DRIVER_FLAGS_AP_MLME;
+- iface->drv_flags |= WPA_DRIVER_FLAGS_AP_CSA;
+- // XXX: Such ability should be retrieved during NL80211_CMD_GET_WIPHY
+- if (g_wifi_hal.platform_flags & PLATFORM_FLAGS_PROBE_RESP_OFFLOAD) {
+- iface->drv_flags |= WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD;
+- }
+
+- if (iface->current_mode->vht_capab & VHT_CAP_SUPP_CHAN_WIDTH_160MHZ) {
+- iface->conf->vht_capab |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
+- }
+-#endif // CMXB7_PORT && VNTXER5_PORT
+ if(preassoc_supp_rates) {
+ os_free(preassoc_supp_rates);
+ preassoc_supp_rates = NULL;
+@@ -1669,14 +1655,14 @@ int update_hostap_config_params(wifi_radio_info_t *radio)
+ }
+
+ if (param->variant & WIFI_80211_VARIANT_AX) {
+- if (param->band == WIFI_FREQUENCY_5_BAND) {
++ if (param->band == WIFI_FREQUENCY_5_BAND || param->band == WIFI_FREQUENCY_6_BAND) {
+ iconf->hw_mode = HOSTAPD_MODE_IEEE80211A;
+ iconf->ieee80211ac = 1;
+ } else {
+ iconf->hw_mode = HOSTAPD_MODE_IEEE80211G;
+ }
+ iconf->ieee80211ax = 1;
+- //iconf->ieee80211n = 1;
++ iconf->ieee80211n = 1;
+ //iconf->require_ht = 1;
+ //iconf->require_vht = 1;
+ }
+@@ -1733,7 +1719,7 @@ int update_hostap_config_params(wifi_radio_info_t *radio)
+ }
+ #endif
+ iconf->vht_oper_chwidth = bandwidth;
+-
++ iconf->op_class = param->op_class;
+ //validate_config_params
+ if (hostapd_config_check(iconf, 1) < 0) {
+ pthread_mutex_unlock(&g_wifi_hal.hapd_lock);
+diff --git a/src/wifi_hal_nl80211.c b/src/wifi_hal_nl80211.c
+index dd5da8b..4d27e45 100644
+--- a/src/wifi_hal_nl80211.c
++++ b/src/wifi_hal_nl80211.c
+@@ -57,7 +57,6 @@ struct family_data {
+ int id;
+ };
+
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ struct phy_info_arg {
+ u16 *num_modes;
+ struct hostapd_hw_modes *modes;
+@@ -65,7 +64,6 @@ struct phy_info_arg {
+ int failed;
+ u8 dfs_domain;
+ };
+-#endif
+
+ void prepare_interface_fdset(wifi_hal_priv_t *priv)
+ {
+@@ -2540,7 +2538,6 @@ skip: found = 0;
+ return mode;
+ }
+
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ static void phy_info_iftype_copy(struct hostapd_hw_modes *mode,
+ enum ieee80211_op_mode opmode,
+ struct nlattr **tb, struct nlattr **tb_flags)
+@@ -2548,9 +2545,7 @@ static void phy_info_iftype_copy(struct hostapd_hw_modes *mode,
+ enum nl80211_iftype iftype;
+ size_t len;
+ struct he_capabilities *he_capab = &mode->he_capab[opmode];
+-#ifdef CMXB7_PORT
+ struct eht_capabilities *eht_capab = &mode->eht_capab[opmode];
+-#endif // CMXB7_PORT
+
+ switch (opmode) {
+ case IEEE80211_MODE_INFRA:
+@@ -2623,7 +2618,6 @@ static void phy_info_iftype_copy(struct hostapd_hw_modes *mode,
+ len);
+ }
+
+-#ifdef CMXB7_PORT
+ if (tb[NL80211_BAND_IFTYPE_ATTR_HE_6GHZ_CAPA]) {
+ u16 capa;
+
+@@ -2676,7 +2670,6 @@ static void phy_info_iftype_copy(struct hostapd_hw_modes *mode,
+ nla_data(tb[NL80211_BAND_IFTYPE_ATTR_EHT_CAP_PPE]),
+ len);
+ }
+-#endif // CMXB7_PORT
+ }
+
+ static int wiphy_info_iface_comb_process(wifi_radio_info_t *radio,
+@@ -2835,7 +2828,6 @@ static unsigned int get_akm_suites_info(struct nlattr *tb)
+ return key_mgmt;
+ }
+
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ static void get_iface_akm_suites_info(wifi_radio_info_t *radio,
+ struct nlattr *nl_akms)
+ {
+@@ -2900,7 +2892,6 @@ static void get_iface_akm_suites_info(wifi_radio_info_t *radio,
+ key_mgmt);
+ }
+ }
+-#endif // CMXB7_PORT && VNTXER5_PORT
+
+ static void wiphy_info_feature_flags(wifi_radio_info_t *radio,
+ struct nlattr *tb)
+@@ -3038,12 +3029,12 @@ static void wiphy_info_ext_feature_flags(wifi_radio_info_t *radio,
+ NL80211_EXT_FEATURE_BEACON_RATE_VHT)) {
+ capa->flags |= WPA_DRIVER_FLAGS_BEACON_RATE_VHT;
+ }
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
++
+ if (ext_feature_isset(ext_features, len,
+ NL80211_EXT_FEATURE_BEACON_RATE_HE)) {
+ capa->flags2 |= WPA_DRIVER_FLAGS2_BEACON_RATE_HE;
+ }
+-#endif // CMXB7_PORT
++
+ if (ext_feature_isset(ext_features, len,
+ NL80211_EXT_FEATURE_SET_SCAN_DWELL)) {
+ capa->rrm_flags |= WPA_DRIVER_FLAGS_SUPPORT_SET_SCAN_DWELL;
+@@ -3106,7 +3097,7 @@ static void wiphy_info_ext_feature_flags(wifi_radio_info_t *radio,
+ capa->flags |= WPA_DRIVER_FLAGS_OCE_STA;
+ }
+ #endif /* CONFIG_MBO */
+-#if defined CMXB7_PORT || defined(VNTXER5_PORT)
++
+ if (ext_feature_isset(ext_features, len,
+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER)) {
+ capa->flags |= WPA_DRIVER_FLAGS_FTM_RESPONDER;
+@@ -3172,7 +3163,7 @@ static void wiphy_info_ext_feature_flags(wifi_radio_info_t *radio,
+ NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION)) {
+ capa->flags2 |= WPA_DRIVER_FLAGS2_OCV;
+ }
+-#endif // CMXB7_PORT
++
+ /* XXX: is not present in nl80211_copy.h, maybe needs to be fixed
+ if (ext_feature_isset(ext_features, len,
+ NL80211_EXT_FEATURE_RADAR_BACKGROUND)) {
+@@ -3348,7 +3339,6 @@ static int phy_info_iftype(struct hostapd_hw_modes *mode,
+
+ return NL_OK;
+ }
+-#endif
+
+ static int phy_info_band(wifi_radio_info_t *radio, struct nlattr *nl_band)
+ {
+@@ -3460,9 +3450,7 @@ static int regulatory_domain_set_info_handler(struct nl_msg *msg, void *arg)
+ static int wiphy_dump_handler(struct nl_msg *msg, void *arg)
+ {
+ wifi_radio_info_t *radio;
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ struct wpa_driver_capa *capa;
+-#endif // CMXB7_PORT && VNTXER5_PORT
+ struct nlattr *tb[NL80211_ATTR_MAX + 1];
+ struct genlmsghdr *gnlh;
+ //unsigned int *cmd;
+@@ -3479,14 +3467,12 @@ static int wiphy_dump_handler(struct nl_msg *msg, void *arg)
+
+ nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL);
+
+-#if !defined(VNTXER5_PORT)
+ for (j = 0; j < g_wifi_hal.num_radios; j++)
+ {
+ if (strcmp(g_wifi_hal.radio_info[j].name, nla_get_string(tb[NL80211_ATTR_WIPHY_NAME])) == 0) {
+ return NL_SKIP;
+ }
+ }
+-#endif
+
+ phy_index = nla_get_u32(tb[NL80211_ATTR_WIPHY]);
+ rdk_radio_index = get_rdk_radio_index(phy_index);
+@@ -3525,7 +3511,7 @@ static int wiphy_dump_handler(struct nl_msg *msg, void *arg)
+ if (tb[NL80211_ATTR_WIPHY_NAME]) {
+ strcpy(radio->name, nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
+ }
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
++
+ capa = &radio->driver_data.capa;
+
+ if (tb[NL80211_ATTR_MAX_NUM_SCAN_SSIDS]) {
+@@ -3691,7 +3677,7 @@ static int wiphy_dump_handler(struct nl_msg *msg, void *arg)
+ wifi_hal_info_print("%s:%d: nl80211: wiphy supported key_mgmt 0x%x\n", __func__, __LINE__,
+ capa->key_mgmt);
+ }
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
++
+ if (tb[NL80211_ATTR_IFTYPE_AKM_SUITES]) {
+ struct nlattr *nl_if;
+ int rem_if;
+@@ -3699,7 +3685,7 @@ static int wiphy_dump_handler(struct nl_msg *msg, void *arg)
+ nla_for_each_nested(nl_if, tb[NL80211_ATTR_IFTYPE_AKM_SUITES], rem_if)
+ get_iface_akm_suites_info(radio, nl_if);
+ }
+-#endif // CMXB7_PORT && VNTXER5_PORT
++
+ if (tb[NL80211_ATTR_OFFCHANNEL_TX_OK]) {
+ wifi_hal_info_print("%s:%d: nl80211: Using driver-based off-channel TX\n", __func__, __LINE__);
+ capa->flags |= WPA_DRIVER_FLAGS_OFFCHANNEL_TX;
+@@ -3787,7 +3773,7 @@ static int wiphy_dump_handler(struct nl_msg *msg, void *arg)
+ if (tb[NL80211_ATTR_WIPHY_SELF_MANAGED_REG]) {
+ capa->flags |= WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY;
+ }
+-#endif // CMXB7_PORT && VNTXER5_PORT
++
+ if (tb[NL80211_ATTR_WDEV]) {
+ radio->dev_id = nla_get_u64(tb[NL80211_ATTR_WDEV]);
+ }
+@@ -4024,7 +4010,6 @@ static int interface_info_handler(struct nl_msg *msg, void *arg)
+ return NL_SKIP;
+ }
+
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ static int phy_info_rates_get_hw_features(struct hostapd_hw_modes *mode, struct nlattr *tb)
+ {
+ static struct nla_policy rate_policy[NL80211_BITRATE_ATTR_MAX + 1] = {
+@@ -4067,7 +4052,6 @@ static int phy_info_rates_get_hw_features(struct hostapd_hw_modes *mode, struct
+
+ return NL_OK;
+ }
+-#endif
+
+ static int phy_info_handler(struct nl_msg *msg, void *arg)
+ {
+@@ -4470,7 +4454,6 @@ int init_nl80211()
+ for (i = 0; i < g_wifi_hal.num_radios; i++) {
+ radio = &g_wifi_hal.radio_info[i];
+
+-#ifdef CMXB7_PORT
+ if (radio->driver_data.auth_supported) {
+ radio->driver_data.capa.flags |= WPA_DRIVER_FLAGS_SME;
+ }
+@@ -4518,7 +4501,7 @@ int init_nl80211()
+ if (radio->driver_data.update_ft_ies_supported) {
+ radio->driver_data.capa.flags |= WPA_DRIVER_FLAGS_UPDATE_FT_IES;
+ }
+-#endif
++
+ // initialize the interface map
+ radio->interface_map = hash_map_create();
+
+@@ -8513,7 +8496,6 @@ fail:
+ return ret;
+ }
+
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ static int cw2ecw(unsigned int cw)
+ {
+ int bit;
+@@ -9366,12 +9348,10 @@ static int nl80211_set_regulatory_flags(struct phy_info_arg *results)
+
+ return nl80211_send_and_recv(msg, nl80211_get_reg, results, NULL, NULL);
+ }
+-#endif
+
+ struct hostapd_hw_modes *
+ wifi_drv_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags, u8 *dfs_domain)
+ {
+-#if defined(CMXB7_PORT) || defined(VNTXER5_PORT)
+ struct nl_msg *msg;
+ struct phy_info_arg result = {
+ .num_modes = num_modes,
+@@ -9426,7 +9406,6 @@ wifi_drv_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags, u8 *dfs_dom
+ nl80211_dump_chan_list(modes, *num_modes);
+ return modes;
+ }
+-#endif
+ return NULL;
+ }
+
+diff --git a/src/wifi_hal_nl80211_utils.c b/src/wifi_hal_nl80211_utils.c
+index da9dc33..b524ecd 100644
+--- a/src/wifi_hal_nl80211_utils.c
++++ b/src/wifi_hal_nl80211_utils.c
+@@ -1825,11 +1825,27 @@ int get_op_class_from_radio_params(wifi_radio_operationParam_t *param)
+
+ #if HOSTAPD_VERSION >= 210 //2.10
+ if (param->band == WIFI_FREQUENCY_6_BAND) {
+- int freq, global_op_class = -1;
++ int freq, idx, global_op_class = -1;
+
+ freq = (param->channel == 2) ? 5935 : (5950 + (param->channel * 5));
+ if (is_6ghz_freq(freq)) {
+- global_op_class = 131 + center_idx_to_bw_6ghz(param->channel);
++ switch (param->channelWidth) {
++ case WIFI_CHANNELBANDWIDTH_40MHZ:
++ idx = 1;
++ break;
++ case WIFI_CHANNELBANDWIDTH_80MHZ:
++ idx = 2;
++ break;
++ case WIFI_CHANNELBANDWIDTH_160MHZ:
++ idx = 3;
++ break;
++ case WIFI_CHANNELBANDWIDTH_20MHZ:
++ default:
++ idx = 0;
++ break;
++ }
++
++ global_op_class = 131 + idx;
+ }
+ return global_op_class;
+ }
+--
+2.18.0
+
diff --git a/recipes-ccsp/hal/files/sta-network.patch b/recipes-ccsp/hal/files/sta-network.patch
new file mode 100644
index 0000000..48f3192
--- /dev/null
+++ b/recipes-ccsp/hal/files/sta-network.patch
@@ -0,0 +1,113 @@
+From 68113170930788e52f8fa6089a2882dc28f5693f Mon Sep 17 00:00:00 2001
+From: Simon Chung <simon.c.chung@accenture.com>
+Date: Thu, 2 Sep 2021 15:44:57 +0100
+Subject: [PATCH] sta-network
+
+Change-Id: Idaae3038a352e94d1f2810a8d73b7f77c8e47309
+---
+ wifi_hal.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 91 insertions(+)
+
+diff --git a/wifi_hal.h b/wifi_hal.h
+index 579418e..d284af4 100644
+--- a/wifi_hal.h
++++ b/wifi_hal.h
+@@ -110,4 +110,95 @@
+ * APIs to be deprecated. Not add new function or structure!
+ */
+ #include "wifi_hal_deprecated.h"
++
++/* DRAFT FOR CLIENT API */
++
++
++/* APPROACH 1*/
++typedef enum wifi_sta_network_flags {
++ WIFI_STA_NET_F_OPEN,
++ WIFI_STA_NET_F_PSK1,
++ WIFI_STA_NET_F_PSK2,WIFI_STA_NET_F_PSK_FT,
++ WIFI_STA_NET_F_AES,
++ WIFI_STA_NET_F_TKIP,
++ WIFI_STA_NET_F_4ADDR_MULTI_AP, /* future: easymesh's wds */
++ WIFI_STA_NET_F_OWE, /* future: opportunistic wireless encryption */
++ WIFI_STA_NET_F_SAE, /* future: wpa3 */
++} wifi_sta_network_flags_t;
++typedef enum wifi_sta_multi_ap_flag {
++ WIFI_STA_MULTI_AP_NOT_SUPPORTED,
++ WIFI_STA_MULTI_AP_NONE,
++ WIFI_STA_MULTI_AP_BHAUL_STA,
++} wifi_sta_multi_ap_flag_t;
++
++
++typedef struct wifi_sta_network {
++ int id;
++ char bridge[16]; /* valid for 4addr_multi_ap */
++ char ssid[32];
++ char psk[128];
++ char bssid[6]; /* 00:00:00:00:00:00 means any */
++ size_t ssid_len;
++ size_t psk_len;
++ int multi_ap;
++ char pairwise[64];
++ char proto[64];
++ char key_mgmt[64];
++ unsigned long flags; /* enum wifi_sta_network_flags */
++} wifi_sta_network_t;
++
++typedef struct wifi_sta_network_state {
++ struct wifi_sta_network desired_network;
++ char current_bssid[6]; /* 00:00:00:00:00:00 means disconnected */
++ int last_deauth_reason;
++ int last_disassoc_reason;
++} wifi_sta_network_state_t;
++
++typedef void (*wifi_sta_network_cb)(INT radioIndex, void *ctx);
++INT wifi_setStaNetwork(INT radioIndex, const wifi_sta_network_t *network);
++INT wifi_setStaNetworkSetEventCallback(INT radioIndex, wifi_sta_network_cb *cb, void *ctx);
++INT wifi_getStaNetworkState(INT radioIndex, wifi_sta_network_state_t *state);
++INT wifi_getStaNetworkCapabilities(INT radioIndex, INT *flags);
++
++/* APPROACH 2 */
++typedef struct {
++ CHAR ssid[33];
++ CHAR bssid[17];
++ CHAR passphrase[65];
++} wifi_staNetwork_t;
++
++INT wifi_getSTANetworks(INT apIndex, wifi_sta_network_t **out_staNetworks_array, INT out_array_size, BOOL *out_scan_cur_freq);
++
++INT wifi_setSTANetworks(INT apIndex, wifi_sta_network_t **staNetworks_array, INT array_size, BOOL scan_cur_freq);
++
++INT wifi_delSTANetworks(INT apIndex);
++
++
++/* notdefined approach */
++INT wifi_getSTANumberOfEntries(ULONG *output);
++INT wifi_getSTARadioIndex(INT ssidIndex, INT *radioIndex);
++INT wifi_getSTAName(INT apIndex, CHAR *output_string);
++INT wifi_getSTABSSID(INT ssidIndex, CHAR *output_string);
++INT wifi_getSTASSID(INT ssidIndex, CHAR *output_string);
++INT wifi_getSTAMAC(INT ssidIndex, CHAR *output_string);
++INT wifi_getSTAEnabled(INT ssidIndex, BOOL *enabled);
++INT wifi_setSTAEnabled(INT ssidIndex, BOOL enabled);
++
++typedef struct _wifi_client_associated_dev
++{
++ UCHAR MACAddress[6]; /**< The MAC address of an associated device. */
++ INT NetworkID; /**< Network ID */
++ INT connected; /**< If network is connected */
++ INT reason;
++ INT locally_generated;
++} wifi_client_associated_dev_t;
++
++typedef INT ( * wifi_client_event_callback)(INT apIndex, wifi_client_associated_dev_t *state);
++
++void wifi_client_event_callback_register(wifi_client_event_callback callback_proc);
++INT wifi_getApChannel(INT radioIndex,ULONG *output_ulong); //RDKB
++
++INT wifi_setApChannel(INT radioIndex, ULONG channel); //RDKB //AP only
++
++
+ #endif
+--
+2.28.0
+