[][MAC80211][hostapd][Add mtk vendor subcmd EDCCA control]
[Description]
Add vendor command to control EDCCA enable/threshold/compensation.
Support three configuration into hostapd configuration file.
1. edcca_enable=0
2. edcca_compensation=5
3. edcca_threhols=xx yy zz
The config "edcca_enable" is used to config the opeation mode of EDCCA.
The value 0 means force disable and 1 means auto mode.
The config "edcca_compensation" is used to adjust the EDCCA threshold.
Please noted that compensate value is only applied for 6g band
interface.
The config "edcca_threshold" is used to config EDCCA threhsold when
interface up.
hostapd_cli command usage:
hostapd_cli -i <interface> raw SET_EDCCA [mode|compensation|threshold]
[value]
* This command is used to configure EDCCA mode, compensatation or
* threshold.
hostapd_cli -i <interface> raw GET_EDCCA [mode|compensation|threshold]
* This command is used to check current EDCCA configuration in hostapd.
[Release-log]
N/A
Change-Id: Iefe6e82a35fb22ad8c1a87bf50bc6ad60d61fa32
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6756359
diff --git a/autobuild_mac80211_release/package/network/services/hostapd/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch b/autobuild_mac80211_release/package/network/services/hostapd/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
index c9ea6b5..eadaa63 100644
--- a/autobuild_mac80211_release/package/network/services/hostapd/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
+++ b/autobuild_mac80211_release/package/network/services/hostapd/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
@@ -1,7 +1,7 @@
-From e80a9ee61fc2f7a2e9de1cae3b81ee7be0e8a80b Mon Sep 17 00:00:00 2001
+From 1632fa308f5269dab803f94389026ae57d99375d Mon Sep 17 00:00:00 2001
From: mtk27835 <shurong.wen@mediatek.com>
Date: Wed, 7 Sep 2022 14:41:51 -0700
-Subject: [PATCH 99916/99920] Add hostapd iBF control
+Subject: [PATCH 3/6] Add hostapd iBF control
Signed-off-by: mtk27835 <shurong.wen@mediatek.com>
---
@@ -21,10 +21,10 @@
13 files changed, 224 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 0bf8b6c..9b79be1 100644
+index a4875ee..6b3b88d 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4786,6 +4786,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4840,6 +4840,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
u8 en = atoi(pos);
conf->three_wire_enable = en;
@@ -35,10 +35,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 60c1fb4..a010e7f 100644
+index 5f71aee..c881d37 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3471,6 +3471,30 @@ hostapd_ctrl_iface_get_hemu(struct hostapd_data *hapd, char *buf,
+@@ -3498,6 +3498,30 @@ hostapd_ctrl_iface_get_hemu(struct hostapd_data *hapd, char *buf,
}
@@ -69,7 +69,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4029,6 +4053,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4055,6 +4079,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_size);
} else if (os_strncmp(buf, "GET_HEMU", 8) == 0) {
reply_len = hostapd_ctrl_iface_get_hemu(hapd, reply, reply_size);
@@ -106,7 +106,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 2d72009..14b21cb 100644
+index 9249a6b..7a96cb8 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -298,6 +298,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -118,30 +118,30 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 8b9e887..2a74e09 100644
+index 71cf515..44a0e7e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1157,6 +1157,7 @@ struct hostapd_config {
- u8 edcca_enable;
+@@ -1158,6 +1158,7 @@ struct hostapd_config {
s8 edcca_compensation;
+ int *edcca_threshold;
u8 three_wire_enable;
+ u8 ibf_enable;
};
enum three_wire_mode {
-@@ -1179,6 +1180,7 @@ enum edcca_mode {
- #define EDCCA_DEFAULT_COMPENSATION -6
- #define EDCCA_MIN_COMPENSATION -126
- #define EDCCA_MAX_COMPENSATION 126
+@@ -1198,6 +1199,7 @@ enum mtk_vendor_attr_edcca_ctrl_mode {
+ #define EDCCA_MIN_CONFIG_THRES -126
+ #define EDCCA_MAX_CONFIG_THRES 0
+
+#define IBF_DEFAULT_ENABLE 0
static inline enum oper_chan_width
hostapd_get_oper_chwidth(struct hostapd_config *conf)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 77d5f89..0b9b410 100644
+index a1d83e4..60ae825 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1049,3 +1049,17 @@ int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd)
+@@ -1064,3 +1064,17 @@ int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd)
}
return hapd->driver->three_wire_ctrl(hapd->drv_priv, hapd->iconf->three_wire_enable);
}
@@ -161,10 +161,10 @@
+}
\ No newline at end of file
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 0a8bf0c..da82382 100644
+index 5ba6297..ab9aedc 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -142,6 +142,8 @@ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd);
+@@ -145,6 +145,8 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
int hostapd_drv_hemu_ctrl(struct hostapd_data *hapd);
int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff);
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
@@ -174,10 +174,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 32b75dc..f095fe4 100644
+index f9dabdf..e44b73d 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2301,6 +2301,8 @@ dfs_offload:
+@@ -2305,6 +2305,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_three_wire_ctrl(hapd) < 0)
goto fail;
@@ -187,7 +187,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 99a4d7f..d6d04de 100644
+index ee5a4f4..4050cf8 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -13,7 +13,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -200,7 +200,7 @@
};
enum mtk_vendor_attr_edcca_ctrl {
-@@ -197,6 +198,38 @@ enum mtk_vendor_attr_hemu_ctrl {
+@@ -204,6 +205,38 @@ enum mtk_vendor_attr_hemu_ctrl {
NUM_MTK_VENDOR_ATTRS_HEMU_CTRL - 1
};
@@ -240,7 +240,7 @@
#define CSI_MAX_COUNT 256
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index e725433..dab37f9 100644
+index 9ca19af..71ded61 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1628,6 +1628,11 @@ struct wpa_driver_ap_params {
@@ -255,7 +255,7 @@
};
struct wpa_driver_mesh_bss_params {
-@@ -4699,6 +4704,20 @@ struct wpa_driver_ops {
+@@ -4701,6 +4706,20 @@ struct wpa_driver_ops {
*
*/
int (*three_wire_ctrl)(void *priv, u8 three_wire_enable);
@@ -277,10 +277,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 03babd8..1c065d4 100644
+index ec7b174..00f9231 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12549,6 +12549,112 @@ static int nl80211_enable_three_wire(void *priv, const u8 three_wire_enable)
+@@ -12670,6 +12670,112 @@ static int nl80211_enable_three_wire(void *priv, const u8 three_wire_enable)
return ret;
}
@@ -393,9 +393,9 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -12699,4 +12805,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
- /* Need ifdef CONFIG_DRIVER_NL80211_MTK */
+@@ -12822,4 +12928,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.configure_edcca_threshold = nl80211_configure_edcca_threshold,
+ .get_edcca = nl80211_get_edcca,
.three_wire_ctrl = nl80211_enable_three_wire,
+ .ibf_ctrl = nl80211_ibf_enable,
+ .ibf_dump = nl80211_ibf_dump,