Merge "[Refactor and sync wifi from Openwrt]"
diff --git a/recipes-ccsp/hal/files/LICENSE b/recipes-ccsp/hal/files/LICENSE
new file mode 100644
index 0000000..7a4a3ea
--- /dev/null
+++ b/recipes-ccsp/hal/files/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file
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
+
diff --git a/recipes-ccsp/hal/hal-cm-generic_git.bbappend b/recipes-ccsp/hal/hal-cm-generic_git.bbappend
new file mode 100644
index 0000000..feb233c
--- /dev/null
+++ b/recipes-ccsp/hal/hal-cm-generic_git.bbappend
@@ -0,0 +1,5 @@
+do_configure_prepend(){
+        if ! cat ${S}/cm_hal.c | grep -w  "INT cm_hal_snmpv3_kickstart_initialize(snmpv3_kickstart_table_t \*pKickstart_Table)" ; then
+                echo "INT cm_hal_snmpv3_kickstart_initialize(snmpv3_kickstart_table_t *pKickstart_Table) { return RETURN_OK; }" >> ${S}/cm_hal.c
+        fi
+}
diff --git a/recipes-ccsp/hal/hal-dhcpv4c-generic_git.bbappend b/recipes-ccsp/hal/hal-dhcpv4c-generic_git.bbappend
new file mode 100644
index 0000000..32d91a3
--- /dev/null
+++ b/recipes-ccsp/hal/hal-dhcpv4c-generic_git.bbappend
@@ -0,0 +1,11 @@
+SRC_URI += "git://gerrit.mediatek.inc/gateway/rdk-b/rdkb_hal;protocol=https;destsuffix=git/source/dhcpv4c/rdkb_hal"
+
+SRCREV = "${AUTOREV}"
+
+#CFLAGS_append = " -DUDHCPC_SWITCH "
+
+do_configure_prepend(){
+    rm ${S}/dhcpv4c_api.c
+    ln -sf ${S}/rdkb_hal/src/dhcpv4c/dhcpv4c_api.c ${S}/dhcpv4c_api.c
+}
+
diff --git a/recipes-ccsp/hal/hal-ethsw-generic_git.bbappend b/recipes-ccsp/hal/hal-ethsw-generic_git.bbappend
new file mode 100644
index 0000000..c50feee
--- /dev/null
+++ b/recipes-ccsp/hal/hal-ethsw-generic_git.bbappend
@@ -0,0 +1,13 @@
+SRC_URI += "git://gerrit.mediatek.inc/gateway/rdk-b/rdkb_hal;protocol=https;destsuffix=git/source/ethsw/rdkb_hal"
+
+SRCREV = "${AUTOREV}"
+
+CFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'rdkb_wan_manager', ' -DFEATURE_RDKB_WAN_MANAGER ', '', d)}"
+
+do_configure_prepend(){
+   if ${@bb.utils.contains('DISTRO_FEATURES','switch_gsw_mode','true','false',d)}; then
+   ln -sf ${S}/rdkb_hal/src/ethsw/ccsp_hal_ethsw_gsw.c ${S}/ccsp_hal_ethsw.c
+   else
+   ln -sf ${S}/rdkb_hal/src/ethsw/ccsp_hal_ethsw.c ${S}/ccsp_hal_ethsw.c
+   fi
+}
diff --git a/recipes-ccsp/hal/hal-fwupgrade.bb b/recipes-ccsp/hal/hal-fwupgrade.bb
new file mode 100644
index 0000000..c10a5f0
--- /dev/null
+++ b/recipes-ccsp/hal/hal-fwupgrade.bb
@@ -0,0 +1,23 @@
+SUMMARY = "HAL for RDK CCSP components"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://../../LICENSE;md5=175792518e4ac015ab6696d16c4f607e"
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+PROVIDES = "hal-fwupgrade"
+RPROVIDES_${PN} = "hal-fwupgrade"
+
+DEPENDS += "ccsp-common-library halinterface"
+SRC_URI = "git://gerrit.mediatek.inc/gateway/rdk-b/rdkb_hal;protocol=https;name=fwupgradehal \
+           file://LICENSE;subdir=git \
+          "
+
+SRCREV_fwupgradehal = "${AUTOREV}"
+SRCREV_FORMAT = "fwupgradehal"
+
+
+S = "${WORKDIR}/git/src/fwupgrade"
+
+CFLAGS += "-DFEATURE_SUPPORT_RDKLOG"
+CFLAGS_append = " -I=${includedir}/ccsp "
+
+inherit autotools coverity
+
diff --git a/recipes-ccsp/hal/hal-platform-generic_git.bbappend b/recipes-ccsp/hal/hal-platform-generic_git.bbappend
new file mode 100644
index 0000000..be61467
--- /dev/null
+++ b/recipes-ccsp/hal/hal-platform-generic_git.bbappend
@@ -0,0 +1,16 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "git://gerrit.mediatek.inc/gateway/rdk-b/rdkb_hal;protocol=https;destsuffix=git/source/platform/rdkb_hal"
+
+
+SRCREV = "${AUTOREV}"
+
+DEPENDS += "utopia-headers"
+CFLAGS_append = " \
+    -I=${includedir}/utctx \
+"
+
+do_configure_prepend(){
+    rm ${S}/platform_hal.c
+    ln -sf ${S}/rdkb_hal/src/platform/platform_hal.c ${S}/platform_hal.c
+}
\ No newline at end of file
diff --git a/recipes-ccsp/hal/hal-wifi-cfg80211_git.bbappend b/recipes-ccsp/hal/hal-wifi-cfg80211_git.bbappend
new file mode 100644
index 0000000..b9a1361
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-cfg80211_git.bbappend
@@ -0,0 +1,20 @@
+
+BRANCH_MTK_IMPL= "master"
+
+SRC_URI = "${CMF_GITHUB_ROOT}/hal-wifi-cfg80211;protocol=${CMF_GIT_PROTOCOL};branch=${BRANCH_MTK_IMPL};name=wifihal"
+
+FILESEXTRAPATHS_remove := "${THISDIR}/files:"
+FILESEXTRAPATHS_prepend := "${THISDIR}/hal-wifi-patches:"
+
+SRC_URI += "file://*.patch;apply=no"
+
+do_mtk_patches() {
+	cd ${S}/../../
+	if [ ! -e mtk_wifi_patch_applied ]; then
+		for i in ${WORKDIR}/*.patch; do patch -p1 < $i; done
+	fi
+	touch mtk_wifi_patch_applied
+}
+addtask mtk_patches after do_unpack before do_compile
+
+CFLAGS_append = " -DWIFI_HAL_VERSION_3"
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0001-patch-HAL-implement-wifi_setRadioCountryCode-wifi_ge.patch b/recipes-ccsp/hal/hal-wifi-patches/0001-patch-HAL-implement-wifi_setRadioCountryCode-wifi_ge.patch
new file mode 100644
index 0000000..9fc54a1
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0001-patch-HAL-implement-wifi_setRadioCountryCode-wifi_ge.patch
@@ -0,0 +1,69 @@
+From f804c8f10fc057308def2fb70c9c94922b03f161 Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Mon, 11 Jul 2022 17:47:56 +0800
+Subject: [PATCH] [patch] HAL: implement wifi_setRadioCountryCode() &
+ wifi_getRadioCountryCode()
+
+---
+ source/wifi/wifi_hal.c | 37 +++++++++++++++++++++++++++++++++++--
+ 1 file changed, 35 insertions(+), 2 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 51f25c6..23572ac 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -929,9 +929,16 @@ INT wifi_createInitialConfigFiles()
+ // outputs the country code to a max 64 character string
+ INT wifi_getRadioCountryCode(INT radioIndex, CHAR *output_string)
+ {
+-    if (NULL == output_string)
++    char buf[MAX_BUF_SIZE] = {0}, cmd[MAX_CMD_SIZE] = {0}, *value;
++    if(!output_string || !(radioIndex==0 || radioIndex==1))
++        return RETURN_ERR;
++
++    sprintf(cmd,"hostapd_cli -i %s%d status driver | grep country | cut -d '=' -f2", AP_PREFIX, radioIndex);
++    _syscmd(cmd, buf, sizeof(buf));
++    if(strlen(buf) > 0)
++        snprintf(output_string, 64, "%s", buf);
++    else
+         return RETURN_ERR;
+-    snprintf(output_string, 64, "US");
+ 
+     return RETURN_OK;
+ }
+@@ -939,6 +946,32 @@ INT wifi_getRadioCountryCode(INT radioIndex, CHAR *output_string)
+ INT wifi_setRadioCountryCode(INT radioIndex, CHAR *CountryCode)
+ {
+     //Set wifi config. Wait for wifi reset to apply
++    char str[MAX_BUF_SIZE]={'\0'};
++    char cmd[MAX_CMD_SIZE]={'\0'};
++    struct params params;
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    if(NULL == CountryCode || strlen(CountryCode) >= 32 )
++        return RETURN_ERR;
++
++    params.name = "country_code";
++    params.value = CountryCode;
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX, radioIndex);
++    int ret = wifi_hostapdWrite(config_file, &params, 1);
++    if (ret) {
++        WIFI_ENTRY_EXIT_DEBUG("Inside %s: wifi_hostapdWrite() return %d\n"
++                ,__func__, ret);
++    }
++
++    ret = wifi_hostapdProcessUpdate(radioIndex, &params, 1);
++    if (ret) {
++        WIFI_ENTRY_EXIT_DEBUG("Inside %s: wifi_hostapdProcessUpdate() return %d\n"
++                ,__func__, ret);
++    }
++    wifi_reloadAp(radioIndex);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++
+     return RETURN_OK;
+ }
+ 
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0002-patch-HAL-refactor-wifi_getRadioChannel.patch b/recipes-ccsp/hal/hal-wifi-patches/0002-patch-HAL-refactor-wifi_getRadioChannel.patch
new file mode 100644
index 0000000..89e9eef
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0002-patch-HAL-refactor-wifi_getRadioChannel.patch
@@ -0,0 +1,47 @@
+From 22612dd89f434aac2383f0601e3a5d921896eb11 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 23 Feb 2022 11:40:41 +0800
+Subject: [PATCH 02/18] [patch] HAL: refactor wifi_getRadioChannel()
+
+Change-Id: Idf011ea57255837f1cdd1ee62ef3dc9d391090d0
+---
+ source/wifi/wifi_hal.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 14452dd4..19f7508c 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -29,7 +29,7 @@ Copyright (c) 2007        Mike Kershaw
+ Copyright (c) 2008-2009        Luis R. Rodriguez
+ Licensed under the ISC license
+ */
+-
++#define MTK_IMPL
+ #define HAL_NETLINK_IMPL
+ 
+ #include <stdio.h>
+@@ -1593,6 +1593,12 @@ INT wifi_getRadioChannelsInUse(INT radioIndex, CHAR *output_string)	//RDKB
+ //Get the running channel number 
+ INT wifi_getRadioChannel(INT radioIndex,ULONG *output_ulong)	//RDKB
+ {
++#ifdef MTK_IMPL
++    if(!wifi_getApChannel(radioIndex, output_ulong))
++        return RETURN_OK;
++    else
++        return RETURN_ERR;
++#else
+     char cmd[1024] = {0}, buf[5] = {0};
+     char interface_name[50] = {0};
+ 
+@@ -1613,6 +1619,7 @@ INT wifi_getRadioChannel(INT radioIndex,ULONG *output_ulong)	//RDKB
+ 
+     WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+     return RETURN_OK;
++#endif
+ }
+ 
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0003-patch-HAL-implement-wifi_reset.patch b/recipes-ccsp/hal/hal-wifi-patches/0003-patch-HAL-implement-wifi_reset.patch
new file mode 100644
index 0000000..01512c6
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0003-patch-HAL-implement-wifi_reset.patch
@@ -0,0 +1,28 @@
+From 0d63e3eeb35f082a51f03517ad2dcff2609c5a4f Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 23 Feb 2022 14:33:12 +0800
+Subject: [PATCH 03/18] [patch] HAL: implement wifi_reset()
+
+Change-Id: I8e969e2f167c96852c02374b463bf9567de40365
+---
+ source/wifi/wifi_hal.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 19f7508c..be9d4f67 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -848,6 +848,10 @@ INT wifi_init()                            //RDKB
+ INT wifi_reset()
+ {
+     //TODO: resets the wifi subsystem, deletes all APs
++    system("systemctl stop hostapd.service");
++    sleep(2);
++    system("systemctl start hostapd.service");
++    sleep(5);
+     return RETURN_OK;
+ }
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0005-patch-HAL-implement-wifi_down.patch b/recipes-ccsp/hal/hal-wifi-patches/0005-patch-HAL-implement-wifi_down.patch
new file mode 100644
index 0000000..bbab9ce
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0005-patch-HAL-implement-wifi_down.patch
@@ -0,0 +1,26 @@
+From c838f621e562f77ef9e659c317951540410a0741 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 2 Mar 2022 15:43:20 +0800
+Subject: [PATCH 05/18] [patch] HAL: implement wifi_down()
+
+Change-Id: I578a2afd5aa6c9b7fe2ad3c114d62bbfe800ac1c
+---
+ source/wifi/wifi_hal.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index ed26dbff..187de56c 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -877,6 +877,8 @@ INT wifi_reset()
+ INT wifi_down()
+ {
+     //TODO: turns off transmit power for the entire Wifi subsystem, for all radios
++    system("systemctl stop hostapd.service");
++    sleep(2);
+     return RETURN_OK;
+ }
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0006-patch-HAL-implement-wifi_getApSecurityMFPConfig.patch b/recipes-ccsp/hal/hal-wifi-patches/0006-patch-HAL-implement-wifi_getApSecurityMFPConfig.patch
new file mode 100644
index 0000000..1a8a51e
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0006-patch-HAL-implement-wifi_getApSecurityMFPConfig.patch
@@ -0,0 +1,47 @@
+From de6ce6e2bffdd24772903f13161f1784fd739f09 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Fri, 4 Mar 2022 18:02:33 +0800
+Subject: [PATCH 06/18] [patch] HAL: implement wifi_getApSecurityMFPConfig()
+
+Change-Id: I778dfabf00408f75109e122742894acf82fff799
+---
+ source/wifi/wifi_hal.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 187de56c..090db60f 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -6187,6 +6187,29 @@ INT wifi_getApSecurityWpaRekeyInterval(INT apIndex, INT *output_int)
+ //To-do
+ INT wifi_getApSecurityMFPConfig(INT apIndex, CHAR *output_string)
+ {
++    char output[16]={'\0'};
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    if (!output_string)
++        return RETURN_ERR;
++
++    sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex);
++    wifi_hostapdRead(config_file, "ieee80211w", output, sizeof(output));
++
++    if (strlen(output) == 0)
++        snprintf(output_string, 64, "Disabled");
++    else if (strncmp(output, "0", 1) == 0)
++        snprintf(output_string, 64, "Disabled");
++    else if (strncmp(output, "1", 1) == 0)
++        snprintf(output_string, 64, "Optional");
++    else if (strncmp(output, "2", 1) == 0)
++        snprintf(output_string, 64, "Required");
++    else {
++        wifi_dbg_printf("\n[%s]: Unexpected ieee80211w=%s", __func__, output);
++        return RETURN_ERR;
++    }
++
++    wifi_dbg_printf("\n[%s]: ieee80211w is : %s", __func__, output);
+     return RETURN_OK;
+ }
+ INT wifi_setApSecurityMFPConfig(INT apIndex, CHAR *MfpConfig)
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0007-patch-HAL-implement-wifi_setApSecurityMFPConfig.patch b/recipes-ccsp/hal/hal-wifi-patches/0007-patch-HAL-implement-wifi_setApSecurityMFPConfig.patch
new file mode 100644
index 0000000..17dad1f
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0007-patch-HAL-implement-wifi_setApSecurityMFPConfig.patch
@@ -0,0 +1,47 @@
+From a99b5bf7bcae0aa2d2f161cd28ef0f34c52b31ad Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 7 Mar 2022 10:50:32 +0800
+Subject: [PATCH 07/18] [patch] HAL: implement wifi_setApSecurityMFPConfig()
+
+Change-Id: If05c3550c2f9a152cfea2b8323c6c23973a881ca
+---
+ source/wifi/wifi_hal.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 090db60f..4f54626b 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -6214,6 +6214,29 @@ INT wifi_getApSecurityMFPConfig(INT apIndex, CHAR *output_string)
+ }
+ INT wifi_setApSecurityMFPConfig(INT apIndex, CHAR *MfpConfig)
+ {
++    char str[MAX_BUF_SIZE]={'\0'};
++    char cmd[MAX_CMD_SIZE]={'\0'};
++    struct params params;
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    if(NULL == MfpConfig || strlen(MfpConfig) >= 32 )
++        return RETURN_ERR;
++
++    params.name = "ieee80211w";
++    if (strncmp(MfpConfig, "Disabled", strlen("Disabled")) == 0)
++        params.value = "0";
++    else if (strncmp(MfpConfig, "Optional", strlen("Optional")) == 0)
++        params.value = "1";
++    else if (strncmp(MfpConfig, "Required", strlen("Required")) == 0)
++        params.value = "2";
++    else{
++        wifi_dbg_printf("%s: invalid MfpConfig. Input has to be Disabled, Optional or Required \n", __func__);
++        return RETURN_ERR;
++    }
++    sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex);
++    wifi_hostapdWrite(config_file, &params, 1);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n", __func__, __LINE__);
+     return RETURN_OK;
+ }
+ INT wifi_getRadioAutoChannelEnable(INT radioIndex, BOOL *output_bool)
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0008-patch-HAL-implement-ApMaxAssociatedDevice-and-WaterM.patch b/recipes-ccsp/hal/hal-wifi-patches/0008-patch-HAL-implement-ApMaxAssociatedDevice-and-WaterM.patch
new file mode 100644
index 0000000..4891c35
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0008-patch-HAL-implement-ApMaxAssociatedDevice-and-WaterM.patch
@@ -0,0 +1,108 @@
+From 3a8aee661b87ff9bd9f4d8c38334d74b947e75bb Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 7 Mar 2022 17:48:02 +0800
+Subject: [PATCH 08/18] [patch] HAL: implement ApMaxAssociatedDevice() and
+ WaterMarkThreshold()
+
+Change-Id: Ieae8fb5003b01eb4a13471c7f2a2d788dcf981a8
+---
+ source/wifi/wifi_hal.c | 57 +++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 54 insertions(+), 3 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 4f54626b..3ddbc802 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -93,6 +93,7 @@ Licensed under the ISC license
+ 
+ #define MAX_BUF_SIZE 128
+ #define MAX_CMD_SIZE 1024
++#define MAX_ASSOCIATED_STA_NUM 2007
+ 
+ //Uncomment to enable debug logs
+ //#define WIFI_DEBUG
+@@ -4536,14 +4537,60 @@ INT wifi_getApMaxAssociatedDevices(INT apIndex, UINT *output_uint)
+     //get the running status from driver
+     if(!output_uint)
+         return RETURN_ERR;
+-    *output_uint = 5;
++
++    char output[16]={'\0'};
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex);
++    wifi_hostapdRead(config_file, "max_num_sta", output, sizeof(output));
++    if (strlen(output) == 0) *output_uint = MAX_ASSOCIATED_STA_NUM;
++    else {
++        int device_num = atoi(output);
++        if (device_num > MAX_ASSOCIATED_STA_NUM || device_num < 0) {
++            wifi_dbg_printf("\n[%s]: get max_num_sta error: %d", __func__, device_num);
++            return RETURN_ERR;
++        }
++        else {
++            *output_uint = device_num;
++        }
++    }
++
+     return RETURN_OK;
+ }
+ 
+ INT wifi_setApMaxAssociatedDevices(INT apIndex, UINT number)
+ {
+     //store to wifi config, apply instantly
+-    return RETURN_ERR;
++    char str[MAX_BUF_SIZE]={'\0'};
++    char cmd[MAX_CMD_SIZE]={'\0'};
++    struct params params;
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    if (number > MAX_ASSOCIATED_STA_NUM || number < 0) {
++        WIFI_ENTRY_EXIT_DEBUG("%s: Invalid input\n",__func__);
++        return RETURN_ERR;
++    }
++    sprintf(str, "%d", number);
++    params.name = "max_num_sta";
++    params.value = str;
++
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX, apIndex);
++    int ret = wifi_hostapdWrite(config_file, &params, 1);
++    if (ret) {
++        WIFI_ENTRY_EXIT_DEBUG("Inside %s: wifi_hostapdWrite() return %d\n"
++                ,__func__, ret);
++    }
++
++    ret = wifi_hostapdProcessUpdate(apIndex, &params, 1);
++    if (ret) {
++        WIFI_ENTRY_EXIT_DEBUG("Inside %s: wifi_hostapdProcessUpdate() return %d\n"
++                ,__func__, ret);
++    }
++    wifi_reloadAp(apIndex);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++
++    return RETURN_OK;
+ }
+ 
+ //The HighWatermarkThreshold value that is lesser than or equal to MaxAssociatedDevices. Setting this parameter does not actually limit the number of clients that can associate with this access point as that is controlled by MaxAssociatedDevices.	MaxAssociatedDevices or 50. The default value of this parameter should be equal to MaxAssociatedDevices. In case MaxAssociatedDevices is 0 (zero), the default value of this parameter should be 50. A value of 0 means that there is no specific limit and Watermark calculation algorithm should be turned off.
+@@ -4552,13 +4599,17 @@ INT wifi_getApAssociatedDevicesHighWatermarkThreshold(INT apIndex, UINT *output_
+     //get the current threshold
+     if(!output_uint)
+         return RETURN_ERR;
+-    *output_uint = 50;
++    wifi_getApMaxAssociatedDevices(apIndex, output_uint);
++    if (*output_uint == 0)
++        *output_uint = 50;
+     return RETURN_OK;
+ }
+ 
+ INT wifi_setApAssociatedDevicesHighWatermarkThreshold(INT apIndex, UINT Threshold)
+ {
+     //store the config, reset threshold, reset AssociatedDevicesHighWatermarkThresholdReached, reset AssociatedDevicesHighWatermarkDate to current time
++    if (!wifi_setApMaxAssociatedDevices(apIndex, Threshold))
++        return RETURN_OK;
+     return RETURN_ERR;
+ }
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0009-patch-HAL-implement-wifi_getApWmmUapsdEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0009-patch-HAL-implement-wifi_getApWmmUapsdEnable.patch
new file mode 100644
index 0000000..2319aeb
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0009-patch-HAL-implement-wifi_getApWmmUapsdEnable.patch
@@ -0,0 +1,36 @@
+From 5e446b7ed3ee1040ccacc90747f69879fec5f4d6 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 7 Mar 2022 19:11:24 +0800
+Subject: [PATCH 09/18] [patch] HAL: implement wifi_getApWmmUapsdEnable()
+
+Change-Id: I4127956b14d984dc8470d66423f4b7560e48708f
+---
+ source/wifi/wifi_hal.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 3ddbc802..680b4283 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4513,7 +4513,17 @@ INT wifi_getApWmmUapsdEnable(INT apIndex, BOOL *output)
+     //get the running status from driver
+     if(!output)
+         return RETURN_ERR;
+-    *output=TRUE;
++
++    char config_file[MAX_BUF_SIZE] = {0};
++    char buf[16] = {0};
++
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX,apIndex);
++    wifi_hostapdRead(config_file, "uapsd_advertisement_enabled", buf, sizeof(buf));
++    if (strncmp("1",buf,1) == 0)
++        *output = TRUE;
++    else
++        *output = FALSE;
++
+     return RETURN_OK;
+ }
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0010-patch-HAL-implement-wifi_getApWmmEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0010-patch-HAL-implement-wifi_getApWmmEnable.patch
new file mode 100644
index 0000000..a901c8f
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0010-patch-HAL-implement-wifi_getApWmmEnable.patch
@@ -0,0 +1,36 @@
+From 22017539d25420018d654e8f92ae517eacb08335 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 7 Mar 2022 19:12:13 +0800
+Subject: [PATCH 10/18] [patch] HAL: implement wifi_getApWmmEnable()
+
+Change-Id: I5baf1c0402fac4795ff52e58bce8be92b9fbf13d
+---
+ source/wifi/wifi_hal.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 680b4283..4e220ed6 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4496,7 +4496,17 @@ INT wifi_getApWmmEnable(INT apIndex, BOOL *output)
+     //get the running status from driver
+     if(!output)
+         return RETURN_ERR;
+-    *output=TRUE;
++
++    char config_file[MAX_BUF_SIZE] = {0};
++    char buf[16] = {0};
++
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX,apIndex);
++    wifi_hostapdRead(config_file, "wmm_enabled", buf, sizeof(buf));
++    if (strncmp("1",buf,1) == 0)
++        *output = TRUE;
++    else
++        *output = FALSE;
++
+     return RETURN_OK;
+ }
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0011-patch-HAL-implement-wifi_setApWmmEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0011-patch-HAL-implement-wifi_setApWmmEnable.patch
new file mode 100644
index 0000000..7e6d7c8
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0011-patch-HAL-implement-wifi_setApWmmEnable.patch
@@ -0,0 +1,39 @@
+From bd22b8ef61e88e1e379925aecb6224bc3cd43963 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 7 Mar 2022 19:17:56 +0800
+Subject: [PATCH 11/18] [patch] HAL: implement wifi_setApWmmEnable()
+
+Change-Id: Ifee29de1c42ef26528d26996937db7c959d8fd06
+---
+ source/wifi/wifi_hal.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 4e220ed6..62350c1b 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4514,7 +4514,20 @@ INT wifi_getApWmmEnable(INT apIndex, BOOL *output)
+ INT wifi_setApWmmEnable(INT apIndex, BOOL enable)
+ {
+     //Save config and apply instantly.
+-    return RETURN_ERR;
++    char config_file[MAX_BUF_SIZE] = {0};
++    struct params list;
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    list.name = "wmm_enabled";
++    list.value = enable?"1":"0";
++
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX,apIndex);
++    wifi_hostapdWrite(config_file, &list, 1);
++    wifi_hostapdProcessUpdate(apIndex, &list, 1);
++    wifi_reloadAp(apIndex);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++
++    return RETURN_OK;
+ }
+ 
+ //Whether U-APSD support is currently enabled. When enabled, this is indicated in beacon frames. Note: U-APSD can only be enabled if WMM is also enabled.
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0012-patch-HAL-implement-wifi_setApWmmUapsdEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0012-patch-HAL-implement-wifi_setApWmmUapsdEnable.patch
new file mode 100644
index 0000000..bdb7ac5
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0012-patch-HAL-implement-wifi_setApWmmUapsdEnable.patch
@@ -0,0 +1,39 @@
+From 10e72bb7444664bfcd111713bfbfe2701772c8d5 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 7 Mar 2022 19:18:56 +0800
+Subject: [PATCH 12/18] [patch] HAL: implement wifi_setApWmmUapsdEnable()
+
+Change-Id: I9d3d86f06d9b276ca3624e3679356aa6da3ea591
+---
+ source/wifi/wifi_hal.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 62350c1b..cb5c6109 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4554,7 +4554,20 @@ INT wifi_getApWmmUapsdEnable(INT apIndex, BOOL *output)
+ INT wifi_setApWmmUapsdEnable(INT apIndex, BOOL enable)
+ {
+     //save config and apply instantly.
+-    return RETURN_ERR;
++    char config_file[MAX_BUF_SIZE] = {0};
++    struct params list;
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    list.name = "uapsd_advertisement_enabled";
++    list.value = enable?"1":"0";
++
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX,apIndex);
++    wifi_hostapdWrite(config_file, &list, 1);
++    wifi_hostapdProcessUpdate(apIndex, &list, 1);
++    wifi_reloadAp(apIndex);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++
++    return RETURN_OK;
+ }
+ 
+ // Sets the WMM ACK polity on the hardware. AckPolicy false means do not acknowledge, true means acknowledge
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0013-patch-HAL-implement-wifi_getProxyArp.patch b/recipes-ccsp/hal/hal-wifi-patches/0013-patch-HAL-implement-wifi_getProxyArp.patch
new file mode 100644
index 0000000..f687b02
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0013-patch-HAL-implement-wifi_getProxyArp.patch
@@ -0,0 +1,43 @@
+From 3d2602233dc6190f9627fe48beb6ed05b5546783 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Tue, 8 Mar 2022 16:33:44 +0800
+Subject: [PATCH 13/18] [patch] HAL: implement wifi_getProxyArp()
+
+Change-Id: I9e1d04eac09fe7ae1d43600a6c8549feb0ea7858
+---
+ source/wifi/wifi_hal.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index cb5c6109..f10e16ab 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -8957,3 +8957,25 @@ INT wifi_getApAssociatedDevice(INT ap_index, CHAR *output_buf, INT output_buf_si
+      return RETURN_OK;
+ }
+ #endif
++
++INT wifi_getProxyArp(INT apIndex, BOOL *enable)
++{
++    char output[16]={'\0'};
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    if (!enable)
++        return RETURN_ERR;
++
++    sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex);
++    wifi_hostapdRead(config_file, "proxy_arp", output, sizeof(output));
++
++    if (strlen(output) == 0)
++        *enable = FALSE;
++    else if (strncmp(output, "1", 1) == 0)
++        *enable = TRUE;
++    else
++        *enable = FALSE;
++
++    wifi_dbg_printf("\n[%s]: proxy_arp is : %s", __func__, output);
++    return RETURN_OK;
++}
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0014-PATCH-HAL-Specify-MTK-driver.patch b/recipes-ccsp/hal/hal-wifi-patches/0014-PATCH-HAL-Specify-MTK-driver.patch
new file mode 100644
index 0000000..bf00326
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0014-PATCH-HAL-Specify-MTK-driver.patch
@@ -0,0 +1,31 @@
+From cc12618b6c8ba2fb49209f87feadf33f45d766c7 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 16 Mar 2022 15:31:36 +0800
+Subject: [PATCH 14/18] [PATCH] HAL: Specify MTK driver
+
+Change-Id: Icdafb2cca3bbf5cbe5378f656590fc4261aebec0
+---
+ source/wifi/wifi_hal.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index f10e16ab..533226b5 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -65,8 +65,13 @@ Licensed under the ISC license
+ //#define ACL_PREFIX "/tmp/wifi_acl_list" //RDKB convention
+ #define SOCK_PREFIX "/var/run/hostapd/wifi"
+ #define VAP_STATUS_FILE "/tmp/vap-status"
++#ifdef MTK_IMPL
++#define DRIVER_2GHZ "mt7915e"
++#define DRIVER_5GHZ "mt7915e"
++#else
+ #define DRIVER_2GHZ "ath9k"
+ #define DRIVER_5GHZ "ath10k_pci"
++#endif
+ 
+ /*
+    MAX_APS - Number of all AP available in system
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0015-patch-HAL-refactor-wifi_getApMacAddressControlMode.patch b/recipes-ccsp/hal/hal-wifi-patches/0015-patch-HAL-refactor-wifi_getApMacAddressControlMode.patch
new file mode 100644
index 0000000..31fa49c
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0015-patch-HAL-refactor-wifi_getApMacAddressControlMode.patch
@@ -0,0 +1,43 @@
+From 522c439c6253be13a508464bb9e9676a057c09f1 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 14 Mar 2022 19:06:29 +0800
+Subject: [PATCH 15/18] [patch] HAL: refactor wifi_getApMacAddressControlMode()
+
+Change-Id: I612e055e60ef9a48f2f7d719cb9baf486644b5be
+---
+ source/wifi/wifi_hal.c | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 533226b5..05413f5e 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -6736,7 +6736,24 @@ INT wifi_getApMacAddressControlMode(INT apIndex, INT *output_filterMode)
+     //_syscmd(cmd, buf, sizeof(buf));
+     sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex);
+     wifi_hostapdRead(config_file, "macaddr_acl", buf, sizeof(buf));
+-    *output_filterMode = atoi(buf);
++    if(strlen(buf) == 0) {
++        *output_filterMode = 0;
++    }
++    else {
++        int macaddr_acl_mode = atoi(buf);
++        if (macaddr_acl_mode == 1) {
++            *output_filterMode = 1;
++        } else if (macaddr_acl_mode == 0) {
++            wifi_hostapdRead(config_file, "deny_mac_file", buf, sizeof(buf));
++            if (strlen(buf) == 0) {
++                *output_filterMode = 0;
++            } else {
++                *output_filterMode = 2;
++            }
++        } else {
++            return RETURN_ERR;
++        }
++    }
+ 
+     return RETURN_OK;
+ }
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0016-PATCH-HAL-refactor-wifi_setApMacAddressControlMode.patch b/recipes-ccsp/hal/hal-wifi-patches/0016-PATCH-HAL-refactor-wifi_setApMacAddressControlMode.patch
new file mode 100644
index 0000000..98f23c9
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0016-PATCH-HAL-refactor-wifi_setApMacAddressControlMode.patch
@@ -0,0 +1,70 @@
+From 5175e19e0a628baff0aad73d2397e9a23bc3dc7d Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 14 Mar 2022 19:40:08 +0800
+Subject: [PATCH] HAL: refactor wifi_setApMacAddressControlMode()
+
+Change-Id: Ia9bdb3b6ac683a8634bd726b6d472eb133d258d0
+---
+ source/wifi/wifi_hal.c | 31 ++++++++++++++++++++++++++++---
+ 1 file changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 5f5ac68..0ed1e85 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -68,6 +68,7 @@ Licensed under the ISC license
+ #define IF_NAME_SIZE 50
+ #define CONFIG_PREFIX "/nvram/hostapd"
+ #define ACL_PREFIX "/tmp/hostapd-acl"
++#define DENY_PREFIX "/tmp/hostapd-deny"
+ //#define ACL_PREFIX "/tmp/wifi_acl_list" //RDKB convention
+ #define SOCK_PREFIX "/var/run/hostapd/wifi"
+ #define VAP_STATUS_FILE "/tmp/vap-status"
+@@ -4308,17 +4309,41 @@ INT wifi_setApMacAddressControlMode(INT apIndex, INT filterMode)
+     struct params list[2];
+     char buf[MAX_BUF_SIZE] = {0};
+     char config_file[MAX_BUF_SIZE] = {0}, acl_file[MAX_BUF_SIZE] = {0};
++    char deny_file[MAX_BUF_SIZE] = {0};
+ 
+     list[0].name = "macaddr_acl";
+-    sprintf(buf, "%d", filterMode);
+-    list[0].value = buf ;
+ 
+-    if (filterMode == 1 || filterMode == 2) {//TODO: check for filterMode(2)
++    if (filterMode == 0) {
++        sprintf(buf, "%d", 0);
++        list[0].value = buf;
++
++        char cmd[128], rtn[128];
++        snprintf(cmd, sizeof(cmd), "hostapd_cli -i %s%d deny_acl CLEAR", AP_PREFIX, apIndex);
++        _syscmd(cmd, rtn, sizeof(rtn));
++        memset(cmd,0,sizeof(cmd));
++        // Delete deny_mac_file in hostapd configuration
++        snprintf(cmd, sizeof(cmd), "sed -i '/deny_mac_file=/d' %s%d.conf ", CONFIG_PREFIX, apIndex);
++        _syscmd(cmd, rtn, sizeof(rtn));
++    }
++    else if (filterMode == 1) {
++        sprintf(buf, "%d", filterMode);
++        list[0].value = buf;
+         sprintf(acl_file,"%s%d",ACL_PREFIX,apIndex);
+         list[1].name = "accept_mac_file";
+         list[1].value = acl_file;
+         items = 2;
++    } else if (filterMode == 2) {
++        //TODO: deny_mac_file
++        sprintf(buf, "%d", 0);
++        list[0].value = buf;
++        list[1].name = "deny_mac_file";
++        sprintf(deny_file,"%s%d", DENY_PREFIX,apIndex);
++        list[1].value = deny_file;
++        items = 2;
++    } else {
++        return RETURN_ERR;
+     }
++
+     sprintf(config_file,"%s%d.conf",CONFIG_PREFIX,apIndex);
+     wifi_hostapdWrite(config_file, list, items);
+ 
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0017-PATCH-HAL-refactor-wifi_setApSsidAdvertisementEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0017-PATCH-HAL-refactor-wifi_setApSsidAdvertisementEnable.patch
new file mode 100644
index 0000000..055943a
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0017-PATCH-HAL-refactor-wifi_setApSsidAdvertisementEnable.patch
@@ -0,0 +1,26 @@
+From df5ff0159878e1b71cb6c2e223226cf7b5644a3a Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Mon, 14 Mar 2022 20:43:14 +0800
+Subject: [PATCH 17/18] [PATCH] HAL: refactor
+ wifi_setApSsidAdvertisementEnable()
+
+Change-Id: I5d17d443e0763b6728561548117c8a5b047ed882
+---
+ source/wifi/wifi_hal.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 6be09577..e44a9d02 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4481,6 +4481,7 @@ INT wifi_setApSsidAdvertisementEnable(INT apIndex, BOOL enable)
+     wifi_hostapdWrite(config_file, &list, 1);
+     wifi_hostapdProcessUpdate(apIndex, &list, 1);
+     //TODO: call hostapd_cli for dynamic_config_control
++    wifi_reloadAp(apIndex);
+     WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+ 
+     return RETURN_OK;
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0018-patch-HAL-enhance-wifi_getApWpsConfigurationState.patch b/recipes-ccsp/hal/hal-wifi-patches/0018-patch-HAL-enhance-wifi_getApWpsConfigurationState.patch
new file mode 100644
index 0000000..c50a2ac
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0018-patch-HAL-enhance-wifi_getApWpsConfigurationState.patch
@@ -0,0 +1,26 @@
+From 969e24609034a30bb45321e3098ac7ed49d9ca6c Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 23 Feb 2022 11:27:47 +0800
+Subject: [PATCH 18/18] [patch] HAL: enhance wifi_getApWpsConfigurationState()
+
+Change-Id: Ibecd442a3884d6b4f17b623ee5c696d04a7b9754
+---
+ source/wifi/wifi_hal.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index e44a9d02..13af7e36 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -5181,7 +5181,7 @@ INT wifi_getApWpsConfigurationState(INT apIndex, CHAR *output_string)
+     snprintf(cmd, sizeof(cmd), "hostapd_cli -i %s%d get_config | grep wps_state | cut -d'=' -f2", AP_PREFIX, apIndex);
+     _syscmd(cmd, buf, sizeof(buf));
+ 
+-    if(!strcmp(buf, "configured"))
++    if(!strncmp(buf, "configured", 10))
+         snprintf(output_string, 32, "Configured");
+     WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+ 
+-- 
+2.29.2
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0019-patch-HAL-refactor-wifi_getRadioEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0019-patch-HAL-refactor-wifi_getRadioEnable.patch
new file mode 100644
index 0000000..e2a4720
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0019-patch-HAL-refactor-wifi_getRadioEnable.patch
@@ -0,0 +1,38 @@
+From 801018bbcf3427713997b1ead85fec6c9acaf2bb Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 6 Apr 2022 09:20:37 +0800
+Subject: [PATCH] HAL: refactor wifi_getRadioEnable()
+
+---
+ source/wifi/wifi_hal.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 1d07d19..c753d99 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -1025,13 +1025,18 @@ INT wifi_getRadioEnable(INT radioIndex, BOOL *output_bool)      //RDKB
+ 
+     snprintf(interface_path, sizeof(interface_path), "/sys/class/net/%s%d/address", RADIO_PREFIX, radioIndex);
+     fp = fopen(interface_path, "r");
+-    if(fp)
++    if(!fp)
+     {
+-        *output_bool = TRUE;
+-        fclose(fp);
++		return RETURN_OK;
+     }
+     //TODO: check if hostapd with config is running
++	char buf[MAX_BUF_SIZE] = {0}, cmd[MAX_CMD_SIZE] = {0};
++	sprintf(cmd, "hostapd_cli -i %s%d status | grep state | cut -d '=' -f2", AP_PREFIX, radioIndex);
++	_syscmd(cmd, buf, sizeof(buf));
+ 
++	if(!strncmp(buf, "ENABLED", 7))
++		*output_bool = TRUE;
++	fclose(fp);
+     return RETURN_OK;
+ }
+ 
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0020-HAL-add-wifi_getApDenyAclDevics-and-refactor-wifi_ki.patch b/recipes-ccsp/hal/hal-wifi-patches/0020-HAL-add-wifi_getApDenyAclDevics-and-refactor-wifi_ki.patch
new file mode 100644
index 0000000..9990695
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0020-HAL-add-wifi_getApDenyAclDevics-and-refactor-wifi_ki.patch
@@ -0,0 +1,70 @@
+From b0ea47cacafdc1aa512afd04129a23267d7d3533 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 6 Apr 2022 16:34:31 +0800
+Subject: [PATCH 1/2] HAL: add wifi_getApDenyAclDevics() and refactor
+ wifi_kickApAclAssociatedDevices()
+
+According to the description of wifi_kickApAclAssociatedDevice(), wifi_kickApAclAssociatedDevices()
+have to kicks the devices written in the deny mac lsit. But current Implementation
+kicks the devices in the accept list. This commit is created to refactor this API.
+---
+ source/wifi/wifi_hal.c | 26 +++++++++++++++++---------
+ 1 file changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index c753d99..6427a43 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4068,6 +4068,20 @@ INT wifi_getApAclDevices(INT apIndex, CHAR *macArray, UINT buf_size)
+     return RETURN_OK;
+ }
+ 
++INT wifi_getApDenyAclDevices(INT apIndex, CHAR *macArray, UINT buf_size)
++{
++    char cmd[MAX_CMD_SIZE]={'\0'};
++    int ret = 0;
++
++    sprintf(cmd, "hostapd_cli -i %s%d deny_acl SHOW | awk '{print $1}'", AP_PREFIX,apIndex);
++    ret = _syscmd(cmd,macArray,buf_size);
++    if (ret != 0)
++        return RETURN_ERR;
++
++    return RETURN_OK;
++}
++
++
+ // Get the list of stations associated per AP
+ INT wifi_getApDevicesAssociated(INT apIndex, CHAR *macArray, UINT buf_size)
+ {
+@@ -4159,7 +4173,7 @@ INT wifi_kickApAclAssociatedDevices(INT apIndex, BOOL enable)
+     char aclArray[512] = {0}, *acl = NULL;
+     char assocArray[512] = {0}, *asso = NULL;
+ 
+-    wifi_getApAclDevices(apIndex, aclArray, sizeof(aclArray));
++    wifi_getApDenyAclDevices(apIndex, aclArray, sizeof(aclArray));
+     wifi_getApDevicesAssociated(apIndex, assocArray, sizeof(assocArray));
+ 
+     // if there are no devices connected there is nothing to do
+@@ -4176,17 +4190,11 @@ INT wifi_kickApAclAssociatedDevices(INT apIndex, BOOL enable)
+ 
+             acl = strtok(NULL, "\r\n");
+         }
++		wifi_setApMacAddressControlMode(apIndex, 2);
+     }
+     else
+     {
+-        //kick off the MAC which is not in ACL array (allow list)
+-        asso = strtok(assocArray, "\r\n");
+-        while (asso != NULL) {
+-            if (strlen(asso) >= 17 && !strcasestr(aclArray, asso))
+-                wifi_kickApAssociatedDevice(apIndex, asso);
+-
+-            asso = strtok(NULL, "\r\n");
+-        }
++		wifi_setApMacAddressControlMode(apIndex, 0);
+     }
+ 
+ #if 0
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0021-HAL-add-wifi_getRadioStatsEnable.patch b/recipes-ccsp/hal/hal-wifi-patches/0021-HAL-add-wifi_getRadioStatsEnable.patch
new file mode 100644
index 0000000..4f70998
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0021-HAL-add-wifi_getRadioStatsEnable.patch
@@ -0,0 +1,28 @@
+From d8375d65c9a32bef94c44f8ec4fc689aaebc70d5 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Fri, 8 Apr 2022 14:37:43 +0800
+Subject: [PATCH] HAL: add wifi_getRadioStatsEnable()
+
+---
+ source/wifi/wifi_hal.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 2e60367..a70ff15 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -9652,3 +9652,11 @@ INT wifi_getProxyArp(INT apIndex, BOOL *enable)
+     wifi_dbg_printf("\n[%s]: proxy_arp is : %s", __func__, output);
+     return RETURN_OK;
+ }
++
++INT wifi_getRadioStatsEnable(INT radioIndex, BOOL *output_enable)
++{
++    if (NULL == output_enable || !(radioIndex==0 || radioIndex==1))
++        return RETURN_ERR;
++    *output_enable=TRUE;
++    return RETURN_OK;
++}
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0023-HAL-refactor-wifi_setRadioGuardInterval-and-wifi_get.patch b/recipes-ccsp/hal/hal-wifi-patches/0023-HAL-refactor-wifi_setRadioGuardInterval-and-wifi_get.patch
new file mode 100644
index 0000000..c772b95
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0023-HAL-refactor-wifi_setRadioGuardInterval-and-wifi_get.patch
@@ -0,0 +1,35 @@
+From f0445f4769576791d5085f3db54411afacd5f755 Mon Sep 17 00:00:00 2001
+From: "howard.hsu" <howard-yh.hsu@mediatek.com>
+Date: Wed, 13 Apr 2022 19:43:53 +0800
+Subject: [PATCH] HAL: refactor wifi_setRadioGuardInterval() and
+ wifi_getRadioGuardInterval()
+
+---
+ source/wifi/wifi_hal.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index f4ee248..e5b551f 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -2169,7 +2169,7 @@ INT wifi_getRadioGuardInterval(INT radioIndex, CHAR *output_string)	//Tr181
+     //save config and apply instantly
+     if (NULL == output_string)
+         return RETURN_ERR;
+-    snprintf(output_string, 64, (radioIndex == 0) ? "400nsec" : "400nsec");
++    snprintf(output_string, 64, "Auto");
+ 
+     return RETURN_OK;
+ }
+@@ -2178,7 +2178,7 @@ INT wifi_getRadioGuardInterval(INT radioIndex, CHAR *output_string)	//Tr181
+ INT wifi_setRadioGuardInterval(INT radioIndex, CHAR *string)	//Tr181
+ {
+     //Apply setting instantly
+-    return RETURN_ERR;
++    return RETURN_OK;
+ }
+ 
+ //Get the Modulation Coding Scheme index, eg: "-1", "1", "15"
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0024-HAL-refactor-wifi_factoryResetRadio.patch b/recipes-ccsp/hal/hal-wifi-patches/0024-HAL-refactor-wifi_factoryResetRadio.patch
new file mode 100644
index 0000000..953123b
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0024-HAL-refactor-wifi_factoryResetRadio.patch
@@ -0,0 +1,37 @@
+From fe9452e2d7c27c7ae680b32a4db9f92f90d4ca4b Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Thu, 14 Apr 2022 19:10:15 +0800
+Subject: [PATCH] HAL: refactor wifi_factoryResetRadio()
+
+---
+ source/wifi/wifi_hal.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index bfa7b01..8b302d5 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -726,15 +726,17 @@ INT wifi_factoryResetRadios()
+ */
+ INT wifi_factoryResetRadio(int radioIndex) 	//RDKB
+ {
++    system("systemctl stop hostapd.service");
++
+     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
+     if(radioIndex == 0)
+-        system("cp /etc/hostapd-2G.conf /nvram/hostapd0.conf");
++        system("rm /nvram/hostapd0.conf");
+     else if(radioIndex == 1)
+-        system("cp /etc/hostapd-5G.conf /nvram/hostapd1.conf");
++        system("rm /nvram/hostapd1.conf");
+     else
+          return RETURN_ERR;
+ 
+-    system("systemctl restart hostapd.service");
++    system("systemctl start hostapd.service");
+     WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+     return RETURN_OK;
+ }
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0026-HAL-refactor-RadioIEEE80211hEnabled-function.patch b/recipes-ccsp/hal/hal-wifi-patches/0026-HAL-refactor-RadioIEEE80211hEnabled-function.patch
new file mode 100644
index 0000000..3ab8442
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0026-HAL-refactor-RadioIEEE80211hEnabled-function.patch
@@ -0,0 +1,66 @@
+From 3efd6b24e39dd13b0fbbbd97d7be129df438d0de Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Mon, 23 May 2022 15:15:31 +0800
+Subject: [PATCH] HAL: refactor RadioIEEE80211hEnabled function
+
+---
+ source/wifi/wifi_hal.c | 35 ++++++++++++++++++++++++++++++++---
+ 1 file changed, 32 insertions(+), 3 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index ea400bf..af7cb10 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -2260,17 +2260,46 @@ INT wifi_getRadioIEEE80211hSupported(INT radioIndex, BOOL *Supported)  //Tr181
+ //Get 80211h feature enable
+ INT wifi_getRadioIEEE80211hEnabled(INT radioIndex, BOOL *enable) //Tr181
+ {
+-    if (NULL == enable)
++    char cmd[MAX_BUF_SIZE]={'\0'};
++    char buf[MAX_CMD_SIZE]={'\0'};
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    if(enable == NULL)
+         return RETURN_ERR;
+-    *enable = FALSE;
+ 
++    snprintf(cmd, sizeof(cmd),  "hostapd_cli -i %s%d status | grep ieee80211h | cut -d '=' -f2", AP_PREFIX, radioIndex);
++    _syscmd(cmd, buf, sizeof(buf));
++
++    if (strncmp(buf, "1", 1) == 0)
++        *enable = true;
++    else
++        *enable = false;
++
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+     return RETURN_OK;
+ }
+ 
+ //Set 80211h feature enable
+ INT wifi_setRadioIEEE80211hEnabled(INT radioIndex, BOOL enable)  //Tr181
+ {
+-    return RETURN_ERR;
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    struct params params={'\0'};
++    char config_file[MAX_BUF_SIZE] = {0};
++
++    params.name = "ieee80211h";
++
++    if (enable) {
++        params.value = "1";
++    } else {
++        params.value = "0";
++    }
++
++    sprintf(config_file,"%s%d.conf",CONFIG_PREFIX,radioIndex);
++    wifi_hostapdWrite(config_file, &params, 1);
++    
++    wifi_hostapdProcessUpdate(radioIndex, &params, 1);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++    return RETURN_OK;
+ }
+ 
+ //Indicates the Carrier Sense ranges supported by the radio. It is measured in dBm. Refer section A.2.3.2 of CableLabs Wi-Fi MGMT Specification.
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0027-HAL-refactor-wifi_getRadioPossibleChannels.patch b/recipes-ccsp/hal/hal-wifi-patches/0027-HAL-refactor-wifi_getRadioPossibleChannels.patch
new file mode 100644
index 0000000..cdd9880
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0027-HAL-refactor-wifi_getRadioPossibleChannels.patch
@@ -0,0 +1,39 @@
+From 312aae9b294a5cb7448887db34654383839a32da Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Tue, 24 May 2022 13:53:35 +0800
+Subject: [PATCH] HAL: refactor wifi_getRadioPossibleChannels
+
+---
+ source/wifi/wifi_hal.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index f15d2c9..a451b30 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -1571,10 +1571,20 @@ INT wifi_setRadioChannelMode(INT radioIndex, CHAR *channelMode, BOOL gOnlyFlag,
+ //The output_string is a max length 64 octet string that is allocated by the RDKB code.  Implementations must ensure that strings are not longer than this.
+ INT wifi_getRadioPossibleChannels(INT radioIndex, CHAR *output_string)	//RDKB
+ {
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
+     if (NULL == output_string) 
+         return RETURN_ERR;
+-    //TODO:read this from iw phy phyX info |grep MHz
+-    snprintf(output_string, 64, (radioIndex == 0)?"1,2,3,4,5,6,7,8,9,10,11":"36,40,44,48,52,56,60,64,100,104,108,112,116,120,124,128,132,136,140");
++
++    char cmd[MAX_CMD_SIZE] = {0};
++    char buf[MAX_BUF_SIZE] = {0};
++
++    // Parse possible channel number and separate them with commas.
++    snprintf(cmd, sizeof(cmd), "iwlist %s%d channel | grep GHz | tr -s ' ' | cut -d ' ' -f3 | tr '\n' ',' | sed 's/.$//'", AP_PREFIX, radioIndex);
++    _syscmd(cmd,buf,sizeof(buf));
++    snprintf(output_string, 128, "%s", buf);
++
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++    return RETURN_OK;
+ #if 0
+     char IFName[50] ={0};
+     char buf[MAX_BUF_SIZE] = {0};
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0028-HAL-refactor-wifi_acl-function.patch b/recipes-ccsp/hal/hal-wifi-patches/0028-HAL-refactor-wifi_acl-function.patch
new file mode 100644
index 0000000..2b1474a
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0028-HAL-refactor-wifi_acl-function.patch
@@ -0,0 +1,63 @@
+From 4523c7caabe32b1d99ade410f7353371caeb471a Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Thu, 16 Jun 2022 17:29:02 +0800
+Subject: [PATCH] HAL: refactor wifi_acl function
+
+---
+ source/wifi/wifi_hal.c | 31 ++++++++++++++++++++-----------
+ 1 file changed, 20 insertions(+), 11 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 98e5681..5cad1e7 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -4181,10 +4181,20 @@ INT wifi_delApAclDevice(INT apIndex, CHAR *DeviceMacAddress)
+ // outputs the number of devices in the filter list
+ INT wifi_getApAclDeviceNum(INT apIndex, UINT *output_uint)
+ {
+-    if (NULL == output_uint)
++    char cmd[MAX_BUF_SIZE]={0};
++    char buf[MAX_CMD_SIZE]={0};
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    if(output_uint == NULL)
+         return RETURN_ERR;
+-    *output_uint = 0;
+-    return RETURN_ERR;
++
++    snprintf(cmd, sizeof(cmd), "cat %s%d | wc -l | tr -d '\\n'", ACL_PREFIX, apIndex);
++    _syscmd(cmd, buf, sizeof(buf));
++
++    *output_uint = atoi(buf);
++
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++    return RETURN_OK;
+ }
+ 
+ INT apply_rules(INT apIndex, CHAR *client_mac,CHAR *action,CHAR *interface)
+@@ -7722,15 +7732,14 @@ INT wifi_delApAclDevices(INT apIndex)
+     if(_syscmd(cmd,buf,sizeof(buf)))
+         return RETURN_ERR;
+ #endif
+-    char fname[100];
+-    FILE *fp;
++    char cmd[MAX_CMD_SIZE]={0};
++    char buf[MAX_BUF_SIZE]={0};
+ 
+-    snprintf(fname, sizeof(fname), "%s%d", ACL_PREFIX, apIndex);
+-    fp = fopen(fname, "w");
+-    if (!fp) {
+-            return RETURN_ERR;
+-    }
+-    fclose(fp);
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    sprintf(cmd, "rm %s%d 2>&1 && touch %s%d", ACL_PREFIX, apIndex, ACL_PREFIX, apIndex);
++    if(_syscmd(cmd, buf, sizeof(buf)))
++        return RETURN_ERR;
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+ 
+     return RETURN_OK;
+ }
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0029-HAL-refactor-beacon-period-interval-function.patch b/recipes-ccsp/hal/hal-wifi-patches/0029-HAL-refactor-beacon-period-interval-function.patch
new file mode 100644
index 0000000..0a743d9
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0029-HAL-refactor-beacon-period-interval-function.patch
@@ -0,0 +1,82 @@
+From 9018c4fda0ef0dd03d20983311186a1a6788f899 Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Fri, 17 Jun 2022 09:51:36 +0800
+Subject: [PATCH] HAL: refactor beacon period/interval function
+
+---
+ source/wifi/wifi_hal.c | 45 +++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 40 insertions(+), 5 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 5cad1e7..5c12139 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -2344,16 +2344,38 @@ INT wifi_setRadioCarrierSenseThresholdInUse(INT radioIndex, INT threshold)	//P3
+ //Time interval between transmitting beacons (expressed in milliseconds). This parameter is based ondot11BeaconPeriod from [802.11-2012].
+ INT wifi_getRadioBeaconPeriod(INT radioIndex, UINT *output)
+ {
+-    if (NULL == output)
++    char cmd[MAX_BUF_SIZE]={'\0'};
++    char buf[MAX_CMD_SIZE]={'\0'};
++
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    if(output == NULL)
+         return RETURN_ERR;
+-    *output = 100;
+ 
++    snprintf(cmd, sizeof(cmd),  "hostapd_cli -i %s%d status | grep beacon_int | cut -d '=' -f2 | tr -d '\n'", AP_PREFIX, radioIndex);
++    _syscmd(cmd, buf, sizeof(buf));
++    *output = atoi(buf);
++
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
+     return RETURN_OK;
+ }
+  
+ INT wifi_setRadioBeaconPeriod(INT radioIndex, UINT BeaconPeriod)
+ {
+-    return RETURN_ERR;
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    struct params params={'\0'};
++    char buf[MAX_BUF_SIZE] = {'\0'};
++    char config_file[MAX_BUF_SIZE] = {'\0'};
++
++    params.name = "beacon_int";
++    snprintf(buf, sizeof(buf), "%u", BeaconPeriod);
++    params.value = buf;
++
++    sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, radioIndex);
++    wifi_hostapdWrite(config_file, &params, 1);
++    
++    wifi_hostapdProcessUpdate(radioIndex, &params, 1);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++    return RETURN_OK;
+ }
+ 
+ //Comma-separated list of strings. The set of data rates, in Mbps, that have to be supported by all stations that desire to join this BSS. The stations have to be able to receive and transmit at each of the data rates listed inBasicDataTransmitRates. For example, a value of "1,2", indicates that stations support 1 Mbps and 2 Mbps. Most control packets use a data rate in BasicDataTransmitRates.
+@@ -3825,8 +3847,21 @@ INT wifi_setApBeaconType(INT apIndex, CHAR *beaconTypeString)
+ // sets the beacon interval on the hardware for this AP
+ INT wifi_setApBeaconInterval(INT apIndex, INT beaconInterval)
+ {
+-    //save config and apply instantly
+-    return RETURN_ERR;
++    WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++    struct params params={'\0'};
++    char buf[MAX_BUF_SIZE] = {'\0'};
++    char config_file[MAX_BUF_SIZE] = {'\0'};
++
++    params.name = "beacon_int";
++    snprintf(buf, sizeof(buf), "%u", beaconInterval);
++    params.value = buf;
++
++    sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, apIndex);
++    wifi_hostapdWrite(config_file, &params, 1);
++    
++    wifi_hostapdProcessUpdate(apIndex, &params, 1);
++    WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++    return RETURN_OK;
+ }
+ 
+ INT wifi_setDTIMInterval(INT apIndex, INT dtimInterval)
+-- 
+2.18.0
+
diff --git a/recipes-ccsp/hal/halinterface.bbappend b/recipes-ccsp/hal/halinterface.bbappend
new file mode 100644
index 0000000..8f87a99
--- /dev/null
+++ b/recipes-ccsp/hal/halinterface.bbappend
@@ -0,0 +1,14 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI += "file://sta-network.patch;apply=no"
+
+#This is workaround for missing do_patch when RDK uses external sources
+do_filogic_patches() {
+    cd ${S}
+        if [ ! -e patch_applied ]; then
+            patch -p1 < ${WORKDIR}/sta-network.patch
+            touch patch_applied
+        fi
+}
+addtask filogic_patches after do_unpack before do_compile
+
+CFLAGS_append = " -DWIFI_HAL_VERSION_3"
diff --git a/recipes-extended/iptables/files/800-flowoffload_target.patch b/recipes-extended/iptables/files/800-flowoffload_target.patch
new file mode 100644
index 0000000..2f79ee8
--- /dev/null
+++ b/recipes-extended/iptables/files/800-flowoffload_target.patch
@@ -0,0 +1,95 @@
+--- /dev/null
++++ b/extensions/libxt_FLOWOFFLOAD.c
+@@ -0,0 +1,72 @@
++#include <stdio.h>
++#include <xtables.h>
++#include <linux/netfilter/xt_FLOWOFFLOAD.h>
++
++enum {
++    O_HW,
++};
++
++static void offload_help(void)
++{
++	printf(
++"FLOWOFFLOAD target options:\n"
++" --hw				Enable hardware offload\n"
++	);
++}
++
++static const struct xt_option_entry offload_opts[] = {
++	{.name = "hw", .id = O_HW, .type = XTTYPE_NONE},
++	XTOPT_TABLEEND,
++};
++
++static void offload_parse(struct xt_option_call *cb)
++{
++	struct xt_flowoffload_target_info *info = cb->data;
++
++	xtables_option_parse(cb);
++	switch (cb->entry->id) {
++	case O_HW:
++		info->flags |= XT_FLOWOFFLOAD_HW;
++		break;
++	}
++}
++
++static void offload_print(const void *ip, const struct xt_entry_target *target, int numeric)
++{
++	const struct xt_flowoffload_target_info *info =
++		(const struct xt_flowoffload_target_info *)target->data;
++
++	printf(" FLOWOFFLOAD");
++	if (info->flags & XT_FLOWOFFLOAD_HW)
++		printf(" hw");
++}
++
++static void offload_save(const void *ip, const struct xt_entry_target *target)
++{
++	const struct xt_flowoffload_target_info *info =
++		(const struct xt_flowoffload_target_info *)target->data;
++
++	if (info->flags & XT_FLOWOFFLOAD_HW)
++		printf(" --hw");
++}
++
++static struct xtables_target offload_tg_reg[] = {
++	{
++		.family		= NFPROTO_UNSPEC,
++		.name		= "FLOWOFFLOAD",
++		.revision	= 0,
++		.version	= XTABLES_VERSION,
++		.size		= XT_ALIGN(sizeof(struct xt_flowoffload_target_info)),
++		.userspacesize	= sizeof(struct xt_flowoffload_target_info),
++		.help		= offload_help,
++		.print		= offload_print,
++		.save		= offload_save,
++		.x6_parse	= offload_parse,
++		.x6_options	= offload_opts,
++	},
++};
++
++void _init(void)
++{
++	xtables_register_targets(offload_tg_reg, ARRAY_SIZE(offload_tg_reg));
++}
+--- /dev/null
++++ b/include/linux/netfilter/xt_FLOWOFFLOAD.h
+@@ -0,0 +1,17 @@
++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
++#ifndef _XT_FLOWOFFLOAD_H
++#define _XT_FLOWOFFLOAD_H
++
++#include <linux/types.h>
++
++enum {
++	XT_FLOWOFFLOAD_HW	= 1 << 0,
++
++	XT_FLOWOFFLOAD_MASK	= XT_FLOWOFFLOAD_HW
++};
++
++struct xt_flowoffload_target_info {
++	__u32 flags;
++};
++
++#endif /* _XT_FLOWOFFLOAD_H */
diff --git a/recipes-extended/iptables/iptables_%.bbappend b/recipes-extended/iptables/iptables_%.bbappend
new file mode 100644
index 0000000..4434da2
--- /dev/null
+++ b/recipes-extended/iptables/iptables_%.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " file://800-flowoffload_target.patch \
+                 "
\ No newline at end of file
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/filogic_rdkb.cfg b/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/filogic_rdkb.cfg
index 52cbc2d..7df42ea 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/filogic_rdkb.cfg
+++ b/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/filogic_rdkb.cfg
@@ -1 +1,2 @@
 CONFIG_XZ_DEC_ARM=y
+CONFIG_DEVMEM=y
\ No newline at end of file
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/mac80211.cfg b/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/mac80211.cfg
index ece7502..92624f3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/mac80211.cfg
+++ b/recipes-kernel/linux/linux-mediatek-5.4/rdkb_cfg/mac80211.cfg
@@ -3,3 +3,6 @@
 CONFIG_CRYPTO_GCM=y
 CONFIG_CRYPTO_CMAC=y
 CONFIG_RELAY=y
+CONFIG_NETFILTER_INGRESS=y
+CONFIG_NF_FLOW_TABLE=y
+CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD=y
\ No newline at end of file