blob: 9614726de14d87b321590c73bd7c303526d311c3 [file] [log] [blame]
From a87dd56b40faca3bc78a626a5bdb3c45b9723b20 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Tue, 2 Aug 2022 10:03:46 +0800
Subject: [PATCH] HAL: refactor set Fragmentation Threshold function
---
source/wifi/wifi_hal.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
index 556c73f..e49f22f 100644
--- a/source/wifi/wifi_hal.c
+++ b/source/wifi/wifi_hal.c
@@ -3623,17 +3623,22 @@ INT wifi_setRadioObssCoexistenceEnable(INT apIndex, BOOL enable)
//P3 // sets the fragmentation threshold in bytes for the radio used by this ap
INT wifi_setRadioFragmentationThreshold(INT apIndex, UINT threshold)
{
- char cmd[64];
- char buf[512];
- //save config and apply instantly
+ char config_file[MAX_BUF_SIZE] = {'\0'};
+ char buf[MAX_BUF_SIZE] = {'\0'};
+ struct params list;
- //zqiu:TODO: save config
- if (threshold > 0) {
- snprintf(cmd, sizeof(cmd), "iwconfig %s%d frag %d", AP_PREFIX, apIndex, threshold);
- } else {
- snprintf(cmd, sizeof(cmd), "iwconfig %s%d frag off", AP_PREFIX, apIndex );
- }
- _syscmd(cmd,buf, sizeof(buf));
+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
+ if (threshold < 256 || threshold > 2346 )
+ return RETURN_ERR;
+ list.name = "fragm_threshold";
+ snprintf(buf, sizeof(buf), "%d", threshold);
+ list.value = buf;
+
+ snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, apIndex);
+ wifi_hostapdWrite(config_file, &list, 1);
+ wifi_hostapdProcessUpdate(apIndex, &list, 1);
+
+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
return RETURN_OK;
}
--
2.18.0