Merge "[RDKB][mt7986][app][Add IPv6 initial service]"
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0030-HAL-refactor-setApDTIMInterval.patch b/recipes-ccsp/hal/hal-wifi-patches/0030-HAL-refactor-setApDTIMInterval.patch
new file mode 100644
index 0000000..1e1609a
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0030-HAL-refactor-setApDTIMInterval.patch
@@ -0,0 +1,44 @@
+From c0c3e7efb51a66544b5b222c352cc6b43bb5368d Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Wed, 27 Jul 2022 17:46:24 +0800
+Subject: [PATCH] HAL: refactor setApDTIMInterval
+
+---
+ source/wifi/wifi_hal.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 1365b11..6596cfc 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -1882,7 +1882,26 @@ INT wifi_setBandSteeringApGroup(char *ApGroup)
+
+ INT wifi_setApDTIMInterval(INT apIndex, INT dtimInterval)
+ {
+- return RETURN_OK;
++ struct params params={0};
++ char config_file[MAX_BUF_SIZE] = {'\0'};
++ char buf[MAX_BUF_SIZE] = {'\0'};
++
++ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++ if (dtimInterval < 1 || dtimInterval > 255) {
++ return RETURN_ERR;
++ WIFI_ENTRY_EXIT_DEBUG("Invalid dtimInterval: %d\n", dtimInterval);
++ }
++
++ params.name = "dtim_period";
++ snprintf(buf, sizeof(buf), "%d", dtimInterval);
++ params.value = buf;
++
++ sprintf(config_file,"%s%d.conf", CONFIG_PREFIX, apIndex);
++ wifi_hostapdWrite(config_file, ¶ms, 1);
++ wifi_hostapdProcessUpdate(apIndex, ¶ms, 1);
++
++ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++ return RETURN_OK;
+ }
+
+ //Check if the driver support the Dfs
+--
+2.18.0
+
diff --git a/recipes-ccsp/hal/hal-wifi-patches/0031-HAL-refactor-set-and-get-Beacon-Rate-function.patch b/recipes-ccsp/hal/hal-wifi-patches/0031-HAL-refactor-set-and-get-Beacon-Rate-function.patch
new file mode 100644
index 0000000..8156eb3
--- /dev/null
+++ b/recipes-ccsp/hal/hal-wifi-patches/0031-HAL-refactor-set-and-get-Beacon-Rate-function.patch
@@ -0,0 +1,81 @@
+From c47c87b8412a219286e6f80cd8234aa506465be3 Mon Sep 17 00:00:00 2001
+From: "Allen.Ye" <allen.ye@mediatek.com>
+Date: Thu, 28 Jul 2022 10:52:36 +0800
+Subject: [PATCH] HAL: refactor set and get Beacon Rate function
+
+---
+ source/wifi/wifi_hal.c | 52 ++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 50 insertions(+), 2 deletions(-)
+
+diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
+index 6596cfc..0e047fc 100644
+--- a/source/wifi/wifi_hal.c
++++ b/source/wifi/wifi_hal.c
+@@ -618,14 +618,62 @@ static int readBandWidth(int radioIndex,char *bw_value)
+ return RETURN_OK;
+ }
+
++// Input must be "1Mbps"; "5.5Mbps"; "6Mbps"; "2Mbps"; "11Mbps"; "12Mbps"; "24Mbps"
+ INT wifi_setApBeaconRate(INT radioIndex,CHAR *beaconRate)
+ {
+- return 0;
++ struct params params={'\0'};
++ char config_file[MAX_BUF_SIZE] = {0};
++ char buf[MAX_BUF_SIZE] = {'\0'};
++
++ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++ if (strlen (beaconRate) < 5)
++ return RETURN_ERR;
++ // Copy the numeric value
++ strncpy(buf, beaconRate, strlen(beaconRate) - 4);
++ buf[strlen(beaconRate) - 4] = '\0';
++
++ params.name = "beacon_rate";
++ // hostapd config unit is 100 kbps. To convert Mbps to 100kbps, the value need to multiply 10.
++ if (strncmp(buf, "5.5", 3) == 0) {
++ snprintf(buf, sizeof(buf), "55");
++ params.value = buf;
++ } else {
++ strcat(buf, "0");
++ params.value = buf;
++ }
++
++ sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, radioIndex);
++ wifi_hostapdWrite(config_file, ¶ms, 1);
++ wifi_hostapdProcessUpdate(radioIndex, ¶ms, 1);
++ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++
++ return RETURN_OK;
+ }
+
+ INT wifi_getApBeaconRate(INT radioIndex, CHAR *beaconRate)
+ {
+- return 0;
++ char config_file[MAX_BUF_SIZE] = {'\0'};
++ char temp_output[MAX_BUF_SIZE] = {'\0'};
++ char buf[MAX_BUF_SIZE] = {'\0'};
++ float rate = 0;
++
++ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
++ if (NULL == beaconRate)
++ return RETURN_ERR;
++
++ sprintf(config_file, "%s%d.conf", CONFIG_PREFIX, radioIndex);
++ wifi_hostapdRead(config_file, "beacon_rate", buf, sizeof(buf));
++ // Hostapd unit is 100kbps. To convert to 100kbps to Mbps, the value need to divide 10.
++ if(strlen(buf) > 0) {
++ rate = atof(buf)/10;
++ snprintf(temp_output, sizeof(temp_output), "%.1fMbps", rate);
++ } else {
++ snprintf(temp_output, sizeof(temp_output), "1Mbps"); // default value
++ }
++ strncpy(beaconRate, temp_output, sizeof(temp_output));
++ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
++
++ return RETURN_OK;
+ }
+
+ INT wifi_setLED(INT radioIndex, BOOL enable)
+--
+2.18.0
+