[][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/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch b/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
index bdc20dd..c853b08 100644
--- a/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
+++ b/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
@@ -1,7 +1,7 @@
-From dac510add166575a332b46013346707bb1c2c2b0 Mon Sep 17 00:00:00 2001
+From f080902be233f0c28d205f62f737edabdb6b6aaa Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 2 Sep 2022 01:03:23 +0800
-Subject: [PATCH 99915/99920] Add three wire PTA ctrl hostapd vendor command
+Subject: [PATCH 2/6] Add three wire PTA ctrl hostapd vendor command
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -19,10 +19,10 @@
11 files changed, 93 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 0be5304..0bf8b6c 100644
+index afe0f0c..a4875ee 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4782,6 +4782,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4836,6 +4836,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
conf->edcca_compensation = (s8) val;
@@ -34,7 +34,7 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 8ce4d9a..2d72009 100644
+index 0e1f192..9249a6b 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -297,6 +297,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -46,13 +46,13 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 4462f29..8b9e887 100644
+index 41b8c68..71cf515 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1156,6 +1156,19 @@ struct hostapd_config {
- unsigned int ch_switch_eht_config;
+@@ -1157,6 +1157,19 @@ struct hostapd_config {
u8 edcca_enable;
s8 edcca_compensation;
+ int *edcca_threshold;
+ u8 three_wire_enable;
+};
+
@@ -70,10 +70,10 @@
enum edcca_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 5545232..77d5f89 100644
+index 4598737..a1d83e4 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1038,3 +1038,14 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff)
+@@ -1053,3 +1053,14 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff)
return 0;
return hapd->driver->hemu_dump(hapd->drv_priv, hemu_onoff);
}
@@ -89,11 +89,11 @@
+ return hapd->driver->three_wire_ctrl(hapd->drv_priv, hapd->iconf->three_wire_enable);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 5bcb225..0a8bf0c 100644
+index bca39c5..5ba6297 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -141,6 +141,7 @@ int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
- int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd);
+@@ -144,6 +144,7 @@ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
+ 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);
@@ -101,10 +101,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 0f3691b..32b75dc 100644
+index 921769d..f9dabdf 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2299,6 +2299,8 @@ dfs_offload:
+@@ -2303,6 +2303,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_hemu_ctrl(hapd) < 0)
goto fail;
@@ -114,7 +114,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 5c8f179..99a4d7f 100644
+index 69a46df..ee5a4f4 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -13,6 +13,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -125,7 +125,7 @@
};
enum mtk_vendor_attr_edcca_ctrl {
-@@ -48,6 +49,21 @@ static struct nla_policy edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = {
+@@ -55,6 +56,21 @@ static struct nla_policy edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = {
[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE] = { .type = NLA_U8 },
};
@@ -148,10 +148,10 @@
MTK_VENDOR_ATTR_CSI_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 88b371d..e725433 100644
+index 4cd7505..9ca19af 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -4691,6 +4691,14 @@ struct wpa_driver_ops {
+@@ -4693,6 +4693,14 @@ struct wpa_driver_ops {
*/
int (*hemu_ctrl)(void *priv, u8 hemu_onoff);
int (*hemu_dump)(void *priv, u8 *hemu_onoff);
@@ -167,10 +167,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b06de06..03babd8 100644
+index ef0ca18..ec7b174 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12516,6 +12516,38 @@ static int nl80211_configure_edcca_threshold(void *priv,
+@@ -12637,6 +12637,38 @@ static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
return ret;
}
@@ -209,10 +209,10 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -12666,4 +12698,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
- #endif /* CONFIG_TESTING_OPTIONS */
- /* Need ifdef CONFIG_DRIVER_NL80211_MTK */
+@@ -12789,4 +12821,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+ .configure_edcca_enable = nl80211_configure_edcca_enable,
.configure_edcca_threshold = nl80211_configure_edcca_threshold,
+ .get_edcca = nl80211_get_edcca,
+ .three_wire_ctrl = nl80211_enable_three_wire,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h