[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
index 9005ab2..d02a55b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
@@ -1103,6 +1103,8 @@
#define IS_GMAC1_MODE ((hnat_priv->gmac_num == 1) ? 1 : 0)
#define IS_HQOS_MODE (qos_toggle == 1)
#define IS_PPPQ_MODE (qos_toggle == 2) /* Per Port Per Queue */
+#define IS_HQOS_DL_MODE (IS_HQOS_MODE && qos_dl_toggle)
+#define IS_HQOS_UL_MODE (IS_HQOS_MODE && qos_ul_toggle)
#define MAX_PPPQ_PORT_NUM 6
#define es(entry) (entry_state[entry->bfib1.state])
@@ -1182,6 +1184,8 @@
struct packet_type *pt, struct net_device *unused);
extern int dbg_cpu_reason;
extern int debug_level;
+extern int qos_dl_toggle;
+extern int qos_ul_toggle;
extern int hook_toggle;
extern int mape_toggle;
extern int qos_toggle;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
index 3822b1a..1857e9b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
@@ -28,6 +28,8 @@
int hook_toggle;
int mape_toggle;
int qos_toggle;
+int qos_dl_toggle = 1;
+int qos_ul_toggle = 1;
unsigned int dbg_cpu_reason_cnt[MAX_CRSN_NUM];
static const char * const entry_state[] = { "INVALID", "UNBIND", "BIND", "FIN" };
@@ -2366,9 +2368,38 @@
.release = single_release,
};
+static void hnat_qos_toggle_usage(void)
+{
+ pr_info("\nHQoS toggle Command Usage:\n");
+ pr_info("Show HQoS mode:\n");
+ pr_info(" cat /sys/kernel/debug/hnat/qos_toggle\n");
+ pr_info("Disable HQoS mode:\n");
+ pr_info(" echo 0 > /sys/kernel/debug/hnat/qos_toggle\n");
+ pr_info("Enable HQoS on bidirection:\n");
+ pr_info(" echo 1 > /sys/kernel/debug/hnat/qos_toggle\n");
+ pr_info("Enable HQoS on uplink only:\n");
+ pr_info(" echo 1 uplink > /sys/kernel/debug/hnat/qos_toggle\n");
+ pr_info("Enable HQoS on downlink only:\n");
+ pr_info(" echo 1 downlink > /sys/kernel/debug/hnat/qos_toggle\n");
+ pr_info("Enable Per-port-per-queue mode:\n");
+ pr_info(" echo 2 > /sys/kernel/debug/hnat/qos_toggle\n");
+ pr_info("Show HQoS toggle usage:\n");
+ pr_info(" echo 3 > /sys/kernel/debug/hnat/qos_toggle\n\n");
+}
+
static int hnat_qos_toggle_read(struct seq_file *m, void *private)
{
- pr_info("value=%d, HQoS is %s now!\n", qos_toggle, (qos_toggle) ? "enabled" : "disabled");
+ if (qos_toggle == 0) {
+ pr_info("HQoS is disabled now!\n");
+ } else if (qos_toggle == 1) {
+ pr_info("HQoS is enabled now!\n");
+ pr_info("HQoS uplink is %s now!\n",
+ qos_ul_toggle ? "enabled" : "disabled");
+ pr_info("HQoS downlink is %s now!\n",
+ qos_dl_toggle ? "enabled" : "disabled");
+ } else if (qos_toggle == 2) {
+ pr_info("Per-port-per-queue mode is enabled!\n");
+ }
return 0;
}
@@ -2446,24 +2477,63 @@
static ssize_t hnat_qos_toggle_write(struct file *file, const char __user *buffer,
size_t count, loff_t *data)
{
- char buf[8];
+ char buf[32], tmp[32];
int len = count;
+ char *p_buf = NULL, *p_token = NULL;
- if ((len > 8) || copy_from_user(buf, buffer, len))
+ if (len >= sizeof(buf))
+ return -EFAULT;
+
+ if (copy_from_user(buf, buffer, len))
return -EFAULT;
+ buf[len] = '\0';
+
if (buf[0] == '0') {
- pr_info("HQoS is going to be disabled !\n");
+ pr_info("HQoS is going to be disabled!\n");
qos_toggle = 0;
+ qos_dl_toggle = 0;
+ qos_ul_toggle = 0;
hnat_qos_disable();
} else if (buf[0] == '1') {
- pr_info("HQoS mode is going to be enabled !\n");
+ p_buf = buf;
+ p_token = strsep(&p_buf, " \t");
+ if (p_buf) {
+ memcpy(tmp, p_buf, strlen(p_buf));
+ tmp[len] = '\0';
+ if (!strncmp(tmp, "uplink", 6)) {
+ qos_dl_toggle = 0;
+ qos_ul_toggle = 1;
+ } else if (!strncmp(tmp, "downlink", 8)) {
+ qos_ul_toggle = 0;
+ qos_dl_toggle = 1;
+ } else {
+ pr_info("Direction should be uplink or downlink.\n");
+ hnat_qos_toggle_usage();
+ return len;
+ }
+ } else {
+ qos_ul_toggle = 1;
+ qos_dl_toggle = 1;
+ }
+ pr_info("HQoS mode is going to be enabled!\n");
+ pr_info("HQoS uplink is going to be %s!\n",
+ qos_ul_toggle ? "enabled" : "disabled");
+ pr_info("HQoS downlink is going to be %s!\n",
+ qos_dl_toggle ? "enabled" : "disabled");
qos_toggle = 1;
} else if (buf[0] == '2') {
- pr_info("Per-port-per-queue mode is going to be enabled !\n");
+ pr_info("Per-port-per-queue mode is going to be enabled!\n");
pr_info("PPPQ use qid 0~5 (scheduler 0).\n");
qos_toggle = 2;
+ qos_dl_toggle = 0;
+ qos_ul_toggle = 0;
hnat_qos_pppq_enable();
+ } else if (buf[0] == '3') {
+ hnat_qos_toggle_usage();
+ } else {
+ pr_info("Input error!\n");
+ hnat_qos_toggle_usage();
}
return len;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 0de1740..0939f07 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -1445,7 +1445,11 @@
hnat_priv->data->version == MTK_HNAT_V5) ?
skb->mark & 0x7f : skb->mark & 0xf;
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
- entry.ipv4_hnapt.tport_id = 1;
+ if ((IS_WAN(dev) && IS_HQOS_UL_MODE) ||
+ (IS_LAN(dev) && IS_HQOS_DL_MODE))
+ entry.ipv4_hnapt.tport_id = 1;
+ else
+ entry.ipv4_hnapt.tport_id = 0;
#else
entry.ipv4_hnapt.iblk2.fqos = 1;
#endif
@@ -1605,7 +1609,11 @@
entry.ipv4_hnapt.iblk2.fqos = 0;
else
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
- entry.ipv4_hnapt.tport_id = 1;
+ if ((IS_WAN(dev) && IS_HQOS_UL_MODE) ||
+ (IS_LAN(dev) && IS_HQOS_DL_MODE))
+ entry.ipv4_hnapt.tport_id = 1;
+ else
+ entry.ipv4_hnapt.tport_id = 0;
#else
entry.ipv4_hnapt.iblk2.fqos =
(!IS_PPPQ_MODE || (IS_PPPQ_MODE &&
@@ -1645,7 +1653,11 @@
entry.ipv6_5t_route.iblk2.fqos = 0;
else
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
- entry.ipv6_5t_route.tport_id = 1;
+ if ((IS_WAN(dev) && IS_HQOS_UL_MODE) ||
+ (IS_LAN(dev) && IS_HQOS_DL_MODE))
+ entry.ipv6_5t_route.tport_id = 1;
+ else
+ entry.ipv6_5t_route.tport_id = 0;
#else
entry.ipv6_5t_route.iblk2.fqos =
(!IS_PPPQ_MODE || (IS_PPPQ_MODE &&
@@ -1773,7 +1785,7 @@
entry->ipv4_hnapt.winfo.bssid = skb_hnat_bss_id(skb);
entry->ipv4_hnapt.winfo.wcid = skb_hnat_wc_id(skb);
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
- entry->ipv4_hnapt.tport_id = (IS_HQOS_MODE) ? 1 : 0;
+ entry->ipv4_hnapt.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
entry->ipv4_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
entry->ipv4_hnapt.iblk2.winfoi = 1;
entry->ipv4_hnapt.winfo_pao.usr_info =
@@ -1831,7 +1843,7 @@
entry->ipv6_hnapt.winfo_pao.is_sp = skb_hnat_is_sp(skb);
entry->ipv6_hnapt.winfo_pao.hf = skb_hnat_hf(skb);
entry->ipv6_hnapt.winfo_pao.amsdu = skb_hnat_amsdu(skb);
- entry->ipv6_hnapt.tport_id = (IS_HQOS_MODE) ? 1 : 0;
+ entry->ipv6_hnapt.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
#endif
} else {
entry->ipv6_5t_route.iblk2.fqos = 0;
@@ -1843,7 +1855,7 @@
entry->ipv6_5t_route.winfo.bssid = skb_hnat_bss_id(skb);
entry->ipv6_5t_route.winfo.wcid = skb_hnat_wc_id(skb);
#if defined(CONFIG_MEDIATEK_NETSYS_V3)
- entry->ipv6_5t_route.tport_id = (IS_HQOS_MODE) ? 1 : 0;
+ entry->ipv6_5t_route.tport_id = IS_HQOS_DL_MODE ? 1 : 0;
entry->ipv6_5t_route.iblk2.rxid = skb_hnat_rx_id(skb);
entry->ipv6_5t_route.iblk2.winfoi = 1;
entry->ipv6_5t_route.winfo_pao.usr_info =
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9993-add-wed.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9993-add-wed.patch
index b09682f..b3ecebe 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9993-add-wed.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9993-add-wed.patch
@@ -843,7 +843,7 @@
memcpy(&hwe->data, &entry->data, sizeof(hwe->data));
wmb();
hwe->ib1 = entry->ib1;
-@@ -362,32 +519,198 @@ int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
+@@ -362,32 +519,201 @@ int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
dma_wmb();
mtk_ppe_cache_clear(ppe);
@@ -937,6 +937,9 @@
+
+ spin_lock_bh(&ppe_lock);
+
++ if (hash >= MTK_PPE_ENTRIES)
++ goto out;
++
+ if (FIELD_GET(MTK_FOE_IB1_STATE, hwe->ib1) == MTK_FOE_STATE_BIND)
+ goto out;
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8011-ovs-add-multicast-to-unicast-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8011-ovs-add-multicast-to-unicast-support.patch
index d0764d2..b3dd782 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8011-ovs-add-multicast-to-unicast-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8011-ovs-add-multicast-to-unicast-support.patch
@@ -1,5 +1,5 @@
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
-index 9e8a5c4..16f5187 100644
+index 9e8a5c4..9104255 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -919,6 +919,10 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
@@ -13,21 +13,24 @@
if (likely(vport)) {
u16 mru = OVS_CB(skb)->mru;
-@@ -933,7 +937,28 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
+@@ -933,7 +937,31 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
if (likely(!mru ||
(skb->len <= mru + vport->dev->hard_header_len))) {
- ovs_vport_send(vport, skb, ovs_key_mac_proto(key));
-+ if (is_ipv4_multicast(skb) && !is_igmp(skb)) {
++ if (is_multicast_addr(skb) && !is_igmp_mld(skb)) {
+ mdb = vport->mdb;
+ spin_lock(&mdb->tbl_lock);
+ list_for_each_entry(table, &mdb->list_head, mdb_node) {
-+ if (table->group_addr.u.ip4 == key->ipv4.addr.dst) {
++ if ((key->eth.type == htons(ETH_P_IP) &&
++ table->group_addr.u.ip4 == key->ipv4.addr.dst) ||
++ (key->eth.type == htons(ETH_P_IPV6) &&
++ ipv6_addr_equal(&table->group_addr.u.ip6, &key->ipv6.addr.dst))) {
+ list_for_each_entry(entry, &table->entry_list, entry_node) {
+ skb_cpy = skb_copy(skb, GFP_ATOMIC);
+ if (!skb_cpy) {
+ kfree_skb(skb);
-+ pr_err("%s(): error\n", __func__);
++ pr_err("%s(): skb copy error\n", __func__);
+ spin_unlock(&mdb->tbl_lock);
+ return;
+ }
@@ -44,96 +47,95 @@
struct net *net = read_pnet(&dp->net);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
-index 4f097bd..e6be550 100644
+index 4f097bd..2f39f07 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
-@@ -11,6 +11,7 @@
+@@ -11,6 +11,9 @@
#include <linux/if_vlan.h>
#include <linux/in.h>
#include <linux/ip.h>
+#include <linux/igmp.h>
++#include <net/mld.h>
++#include <linux/icmpv6.h>
#include <linux/jhash.h>
#include <linux/delay.h>
#include <linux/time.h>
-@@ -530,6 +531,166 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
+@@ -530,6 +533,262 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
return err;
}
-+static int ovs_ip4_multicast_add_group(__be32 _group_addr,
-+ const u8 *entry_addr,
-+ struct vport *input_vport)
++static int ovs_multicast_add_group(struct ip_addr *_group_addr,
++ const u8 *entry_addr,
++ struct vport *input_vport)
+{
+ struct multicast_data_base *mdb;
+ struct multicast_table *table;
+ struct multicast_table_entry *entry;
-+
-+ if (ipv4_is_local_multicast(_group_addr))
-+ return 0;
++ int err;
+
+ mdb = input_vport->mdb;
+ spin_lock(&mdb->tbl_lock);
+ list_for_each_entry(table, &mdb->list_head, mdb_node) {
-+ if (table->group_addr.u.ip4 == _group_addr) {
++ if (!memcmp(&table->group_addr.u, &_group_addr->u, sizeof(struct ip_addr))) {
+ list_for_each_entry(entry, &table->entry_list, entry_node) {
-+ if (!memcmp(entry->eth_addr, entry_addr, ETH_ALEN)) {
-+ spin_unlock(&mdb->tbl_lock);
-+ return 0;
-+ }
++ if (ether_addr_equal(entry->eth_addr, entry_addr))
++ goto out;
+ }
++
+ entry = kzalloc(sizeof(struct multicast_table_entry), GFP_ATOMIC);
+ if (!entry) {
-+ spin_unlock(&mdb->tbl_lock);
-+ return -ENOMEM;
++ err = -ENOMEM;
++ goto err;
+ }
+
+ memcpy(entry->eth_addr, entry_addr, ETH_ALEN);
+ list_add(&entry->entry_node, &table->entry_list);
-+ spin_unlock(&mdb->tbl_lock);
-+ return 0;
++ goto out;
+ }
+ }
+
+ table = kzalloc(sizeof(struct multicast_table), GFP_ATOMIC);
+ if (!table) {
-+ spin_unlock(&mdb->tbl_lock);
-+ return -ENOMEM;
++ err = -ENOMEM;
++ goto err;
+ }
+
+ INIT_LIST_HEAD(&table->entry_list);
+ entry = kzalloc(sizeof(struct multicast_table_entry), GFP_ATOMIC);
+ if (!entry) {
+ kfree(table);
-+ spin_unlock(&mdb->tbl_lock);
-+ return -ENOMEM;
++ err = -ENOMEM;
++ goto err;
+ }
+
+ memcpy(entry->eth_addr, entry_addr, ETH_ALEN);
+ list_add(&entry->entry_node, &table->entry_list);
+
-+ table->group_addr.u.ip4 = _group_addr;
++ table->group_addr.u = _group_addr->u;
+ list_add(&table->mdb_node, &mdb->list_head);
+
++out:
++ err = 0;
++err:
+ spin_unlock(&mdb->tbl_lock);
-+ return 0;
++ return err;
+}
+
-+static int ovs_ip4_multicast_leave_group(__be32 _group_addr,
-+ const u8 *entry_addr,
-+ struct vport *input_vport)
++static int ovs_multicast_leave_group(struct ip_addr *_group_addr,
++ const u8 *entry_addr,
++ struct vport *input_vport)
+{
+ struct multicast_data_base *mdb;
+ struct multicast_table *table, *table_tmp;
+ struct multicast_table_entry *entry, *entry_tmp;
-+
-+ if (ipv4_is_local_multicast(_group_addr))
-+ return 0;
++ int err;
+
+ mdb = input_vport->mdb;
+ spin_lock(&mdb->tbl_lock);
+ list_for_each_entry_safe(table, table_tmp, &mdb->list_head, mdb_node) {
-+ if (table->group_addr.u.ip4 == _group_addr) {
++ if (!memcmp(&table->group_addr.u, &_group_addr->u, sizeof(struct ip_addr))) {
+ list_for_each_entry_safe(entry, entry_tmp, &table->entry_list, entry_node) {
-+ if (!memcmp(entry->eth_addr, entry_addr, ETH_ALEN)) {
++ if (ether_addr_equal(entry->eth_addr, entry_addr)) {
+ list_del(&entry->entry_node);
+ kfree(entry);
+
@@ -141,23 +143,26 @@
+ list_del(&table->mdb_node);
+ kfree(table);
+ }
-+ spin_unlock(&mdb->tbl_lock);
-+ return 0;
++
++ goto out;
+ }
+ }
+ }
+ }
++
++out:
++ err = 0;
+ spin_unlock(&mdb->tbl_lock);
-+ return 0;
++ return err;
+}
+
+static int ovs_multicast_ipv4_rcv(struct sk_buff *skb, struct vport *input_vport)
+{
+ struct ethhdr *eth_hdr;
+ const u8 *dl_src;
-+ __be32 group_addr;
++ struct ip_addr group_addr = {0};
+ struct iphdr *ip_header;
-+ struct igmphdr *igmp_hdr;
++ struct igmphdr *igmp_header;
+ int i;
+ struct igmpv3_report *igmpv3_hdr;
+ u16 group_num;
@@ -168,71 +173,167 @@
+ int err;
+
+ err = ip_mc_check_igmp(skb);
-+ if (err < 0)
++ if (err)
+ return 0;
+
+ eth_hdr = skb_eth_hdr(skb);
+ dl_src = eth_hdr->h_source;
-+ ip_header = (struct iphdr *)(skb->data + 14);
-+ igmp_hdr = (struct igmphdr *)((u8 *)ip_header + ip_header->ihl * 4);
++ ip_header = ip_hdr(skb);
++ igmp_header = igmp_hdr(skb);
+
-+ switch (igmp_hdr->type) {
++ switch (igmp_header->type) {
+ case IGMP_HOST_MEMBERSHIP_REPORT:
+ case IGMPV2_HOST_MEMBERSHIP_REPORT:
-+ group_addr = igmp_hdr->group;
-+ ovs_ip4_multicast_add_group(group_addr, dl_src, input_vport);
++ group_addr.u.ip4 = igmp_header->group;
++ if (ipv4_is_local_multicast(group_addr.u.ip4))
++ return 0;
++ ovs_multicast_add_group(&group_addr, dl_src, input_vport);
+ break;
+ case IGMP_HOST_LEAVE_MESSAGE:
-+ group_addr = igmp_hdr->group;
-+ ovs_ip4_multicast_leave_group(group_addr, dl_src, input_vport);
++ group_addr.u.ip4 = igmp_header->group;
++ if (ipv4_is_local_multicast(group_addr.u.ip4))
++ return 0;
++ ovs_multicast_leave_group(&group_addr, dl_src, input_vport);
+ break;
+ case IGMPV3_HOST_MEMBERSHIP_REPORT:
-+ igmpv3_hdr = (struct igmpv3_report *)igmp_hdr;
++ igmpv3_hdr = (struct igmpv3_report *)igmp_header;
+ group_num = ntohs(igmpv3_hdr->ngrec);
+ grec = igmpv3_hdr->grec;
-+ //group_num = ntohs(*(u16 *)(igmp_hdr + 6));
-+ //group = igmp_hdr + 8;
++
+ for (i = 0; i < group_num; i++) {
+ group_type = grec->grec_type;
+ aux_data_len = grec->grec_auxwords;
+ num_of_source = ntohs(grec->grec_nsrcs);
-+ group_addr = grec->grec_mca;
++ group_addr.u.ip4 = grec->grec_mca;
++ if (ipv4_is_local_multicast(group_addr.u.ip4))
++ return 0;
+
+ if (group_type == IGMPV3_MODE_IS_EXCLUDE ||
+ group_type == IGMPV3_CHANGE_TO_EXCLUDE ||
+ group_type == IGMPV3_ALLOW_NEW_SOURCES)
-+ ovs_ip4_multicast_add_group(group_addr, dl_src, input_vport);
++ ovs_multicast_add_group(&group_addr, dl_src, input_vport);
+
+ if (group_type == IGMPV3_MODE_IS_INCLUDE ||
+ group_type == IGMPV3_CHANGE_TO_INCLUDE ||
+ group_type == IGMPV3_BLOCK_OLD_SOURCES)
+ if (num_of_source == 0)
-+ ovs_ip4_multicast_leave_group(group_addr, dl_src, input_vport);
++ ovs_multicast_leave_group(&group_addr, dl_src, input_vport);
+
+ grec += (8 + (num_of_source * 4) + aux_data_len);
+ }
+ break;
++ case IGMP_HOST_MEMBERSHIP_QUERY:
++ break;
++ default:
++ pr_warning("%s(): error packet type 0x%x\n", __func__, igmp_header->type);
++ break;
++ }
++ return 0;
++}
++
++static int ovs_multicast_ipv6_rcv(struct sk_buff *skb, struct vport *input_vport)
++{
++ const u8 *dl_src;
++ struct mld_msg *mld_hdr;
++ struct ip_addr group_addr = {0};
++ struct icmp6hdr *icmpv6_hdr;
++ u16 group_num;
++ struct mld2_grec *grec;
++ u8 group_type;
++ u8 aux_data_len;
++ u16 num_of_source;
++ int i;
++ int err;
++
++ err = ipv6_mc_check_mld(skb);
++ if (err)
++ return err;
++
++ mld_hdr = (struct mld_msg *)skb_transport_header(skb);
++ dl_src = skb_eth_hdr(skb)->h_source;
++
++ switch (mld_hdr->mld_type) {
++ case ICMPV6_MGM_REPORT:
++ group_addr.u.ip6 = mld_hdr->mld_mca;
++ if (ipv6_addr_is_ll_all_nodes(&group_addr.u.ip6))
++ return 0;
++ ovs_multicast_add_group(&group_addr, dl_src, input_vport);
++ break;
++ case ICMPV6_MGM_REDUCTION:
++ group_addr.u.ip6 = mld_hdr->mld_mca;
++ if (ipv6_addr_is_ll_all_nodes(&group_addr.u.ip6))
++ return 0;
++ ovs_multicast_leave_group(&group_addr, dl_src, input_vport);
++ break;
++ case ICMPV6_MLD2_REPORT:
++ icmpv6_hdr = icmp6_hdr(skb);
++ group_num = ntohs(icmpv6_hdr->icmp6_dataun.un_data16[1]);
++ grec = (struct mld2_grec *)(skb_transport_header(skb) + sizeof(struct icmp6hdr));
++
++ for (i = 0; i < group_num; i++) {
++ group_type = grec->grec_type;
++ aux_data_len = grec->grec_auxwords;
++ num_of_source = ntohs(grec->grec_nsrcs);
++ group_addr.u.ip6 = grec->grec_mca;
++ if (ipv6_addr_is_ll_all_nodes(&group_addr.u.ip6))
++ return 0;
++
++ if (group_type == MLD2_MODE_IS_EXCLUDE ||
++ group_type == MLD2_CHANGE_TO_EXCLUDE ||
++ group_type == MLD2_ALLOW_NEW_SOURCES)
++ ovs_multicast_add_group(&group_addr, dl_src, input_vport);
++ else if ((group_type == MLD2_MODE_IS_INCLUDE ||
++ group_type == MLD2_CHANGE_TO_INCLUDE ||
++ group_type == MLD2_BLOCK_OLD_SOURCES) &&
++ num_of_source == 0)
++ ovs_multicast_leave_group(&group_addr, dl_src, input_vport);
++
++ grec += (4 + (num_of_source + 1) * sizeof(struct in6_addr) + aux_data_len);
++ }
++ break;
++ case ICMPV6_MGM_QUERY:
++ break;
+ default:
-+ pr_warning("%s(): error pkt\n", __func__);
++ pr_warning("%s(): error packet type 0x%x\n", __func__, mld_hdr->mld_type);
+ break;
+ }
++
+ return 0;
+}
+
++static int ovs_multicast_rcv(struct sk_buff *skb, struct vport *input_vport)
++{
++ int ret = 0;
++
++ if (!skb)
++ return -EINVAL;
++
++ switch (skb->protocol) {
++ case htons(ETH_P_IP):
++ ret = ovs_multicast_ipv4_rcv(skb, input_vport);
++ break;
++ case htons(ETH_P_IPV6):
++ ret = ovs_multicast_ipv6_rcv(skb, input_vport);
++ break;
++ }
++
++ return ret;
++}
++
static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
{
struct ovs_header *ovs_header = info->userhdr;
-@@ -604,6 +765,9 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
+@@ -604,6 +863,9 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
OVS_CB(packet)->input_vport = input_vport;
sf_acts = rcu_dereference(flow->sf_acts);
-+ if (is_igmp(packet))
-+ ovs_multicast_ipv4_rcv(packet, input_vport);
++ if (is_multicast_addr(packet))
++ ovs_multicast_rcv(packet, input_vport);
+
local_bh_disable();
err = ovs_execute_actions(dp, packet, sf_acts, &flow->key);
local_bh_enable();
-@@ -2183,6 +2347,9 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
+@@ -2183,6 +2445,9 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
struct datapath *dp;
struct vport *vport;
unsigned int new_headroom;
@@ -242,7 +343,7 @@
int err;
reply = ovs_vport_cmd_alloc_info();
-@@ -2210,6 +2377,22 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
+@@ -2210,6 +2475,22 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
if (netdev_get_fwd_headroom(vport->dev) == dp->max_headroom)
update_headroom = true;
@@ -266,36 +367,43 @@
ovs_dp_detach_port(vport);
diff --git a/net/openvswitch/datapath.h b/net/openvswitch/datapath.h
-index 81e85dd..520532e 100644
+index 81e85dd..6830d3b 100644
--- a/net/openvswitch/datapath.h
+++ b/net/openvswitch/datapath.h
-@@ -215,6 +215,31 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
+@@ -215,6 +215,38 @@ static inline struct datapath *get_dp(struct net *net, int dp_ifindex)
return dp;
}
-+#define IGMP_PROTOCOL_OFFSET 23
-+/* support ipv4 for now */
-+static inline bool is_ipv4_multicast(struct sk_buff *skb)
++static inline bool is_multicast_addr(struct sk_buff *skb)
+{
-+ struct ethhdr *eth_hdr = skb_eth_hdr(skb);
++ struct ethhdr *eth_hdr;
+
-+ return eth_hdr->h_dest[0] == 0x01 && skb->protocol == htons(ETH_P_IP);
++ if (!skb)
++ return 0;
++
++ eth_hdr = skb_eth_hdr(skb);
++
++ return (eth_hdr->h_dest[0] == 0x01 && skb->protocol == htons(ETH_P_IP)) ||
++ (eth_hdr->h_dest[0] == 0x33 && skb->protocol == htons(ETH_P_IPV6));
+}
+
-+static inline bool is_igmp(struct sk_buff *skb)
++static inline bool is_igmp_mld(struct sk_buff *skb)
+{
+ struct ethhdr *eth_hdr;
++ int err = 0;
+
+ if (!skb)
-+ return 0;
++ return err;
+
+ eth_hdr = skb_eth_hdr(skb);
+
-+ if (eth_hdr->h_dest[0] == 0x01 &&
-+ skb->protocol == htons(ETH_P_IP))
-+ return (*(skb->data + IGMP_PROTOCOL_OFFSET) == IPPROTO_IGMP);
-+ else
-+ return 0;
++ if (skb->protocol == htons(ETH_P_IP)) {
++ err = ip_hdr(skb)->protocol == IPPROTO_IGMP;
++ } else if (skb->protocol == htons(ETH_P_IPV6)) {
++ err = !ipv6_mc_check_mld(skb);
++ }
++
++ return err;
+}
+
extern struct notifier_block ovs_dp_device_notifier;
diff --git a/recipes-wifi/hostapd/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch b/recipes-wifi/hostapd/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch
index be54e06..be526be 100644
--- a/recipes-wifi/hostapd/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch
+++ b/recipes-wifi/hostapd/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch
@@ -1,30 +1,44 @@
-From 166ba374624b2aed360427f087c20b8f511fb2e0 Mon Sep 17 00:00:00 2001
+From 17051f7a8b2193e24556e357f3f1665d67a79330 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 30 May 2022 16:31:34 +0800
-Subject: [PATCH 99912/99916] Support new hostapd configuration, edcca_enable
- and edcca_compensation
+Subject: [PATCH] Support new hostapd configuration, edcca_enable and
+ edcca_compensation and implement edcca related handlers.
---
- hostapd/config_file.c | 20 +++++++++++++++
- src/ap/ap_config.c | 3 +++
- src/ap/ap_config.h | 10 ++++++++
- src/ap/ap_drv_ops.c | 9 +++++++
- src/ap/ap_drv_ops.h | 2 +-
- src/ap/hostapd.c | 3 +++
- src/drivers/driver.h | 2 ++
- src/drivers/driver_nl80211.c | 42 +++++++++++++++++++++++++++++++
- src/drivers/driver_nl80211.h | 1 +
- src/drivers/driver_nl80211_capa.c | 7 ++++++
- 10 files changed, 98 insertions(+), 1 deletion(-)
+ hostapd/config_file.c | 32 ++++++
+ hostapd/ctrl_iface.c | 125 ++++++++++++++++++++++
+ src/ap/ap_config.c | 4 +
+ src/ap/ap_config.h | 29 ++++++
+ src/ap/ap_drv_ops.c | 24 +++++
+ src/ap/ap_drv_ops.h | 5 +-
+ src/ap/hostapd.c | 7 ++
+ src/common/mtk_vendor.h | 19 ++--
+ src/drivers/driver.h | 4 +
+ src/drivers/driver_nl80211.c | 165 ++++++++++++++++++++++++++++++
+ src/drivers/driver_nl80211.h | 1 +
+ src/drivers/driver_nl80211_capa.c | 7 ++
+ 12 files changed, 415 insertions(+), 7 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index eda9db021..8a21c9698 100644
+index eda9db0..0ee8952 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4753,6 +4753,26 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4753,6 +4753,38 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "eht_mu_beamformer") == 0) {
conf->eht_phy_capab.mu_beamformer = atoi(pos);
#endif /* CONFIG_IEEE80211BE */
++ } else if (os_strcmp(buf, "edcca_threshold") == 0) {
++ if (hostapd_parse_intlist(&conf->edcca_threshold, pos) ||
++ conf->edcca_threshold[0] < EDCCA_MIN_CONFIG_THRES ||
++ conf->edcca_threshold[0] > EDCCA_MAX_CONFIG_THRES ||
++ conf->edcca_threshold[1] < EDCCA_MIN_CONFIG_THRES ||
++ conf->edcca_threshold[1] > EDCCA_MAX_CONFIG_THRES ||
++ conf->edcca_threshold[2] < EDCCA_MIN_CONFIG_THRES ||
++ conf->edcca_threshold[2] > EDCCA_MAX_CONFIG_THRES) {
++ wpa_printf(MSG_ERROR, "Line %d: invalid edcca threshold",
++ line);
++ return 1;
++ }
+ } else if (os_strcmp(buf, "edcca_enable") == 0) {
+ int mode = atoi(pos);
+ if (mode < EDCCA_MODE_FORCE_DISABLE || mode > EDCCA_MODE_AUTO) {
@@ -37,7 +51,7 @@
+ } else if (os_strcmp(buf, "edcca_compensation") == 0) {
+ int val = atoi(pos);
+ if (val < EDCCA_MIN_COMPENSATION ||
-+ val > EDCCA_MAX_COMPENSATION) {
++ val > EDCCA_MAX_COMPENSATION) {
+ wpa_printf(MSG_ERROR, "Line %d: Invalid compensation"
+ " value %d; allowed value %d ~ %d.",
+ line, val, EDCCA_MIN_COMPENSATION,
@@ -48,8 +62,158 @@
} else {
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
+diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
+index bb8c74f..9c70d54 100644
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -598,6 +598,19 @@ static const char * pbc_status_str(enum pbc_status status)
+ }
+
+
++static const char * edcca_mode_str(enum edcca_mode status)
++{
++ switch (status) {
++ case EDCCA_MODE_FORCE_DISABLE:
++ return "Force Disable";
++ case EDCCA_MODE_AUTO:
++ return "Auto";
++ default:
++ return "Unknown";
++ }
++}
++
++
+ static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
+ char *buf, size_t buflen)
+ {
+@@ -3322,6 +3335,112 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
+ #endif /* ANDROID */
+
+
++static int
++hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
++ char *buf, size_t buflen)
++{
++ char *pos, *config, *value;
++ config = cmd;
++ pos = os_strchr(config, ' ');
++ if (pos == NULL)
++ return -1;
++ *pos++ = '\0';
++
++ if(pos == NULL)
++ return -1;
++ value = pos;
++
++ if (os_strcmp(config, "enable") == 0) {
++ int mode = atoi(value);
++ if (mode < EDCCA_MODE_FORCE_DISABLE || mode > EDCCA_MODE_AUTO) {
++ wpa_printf(MSG_ERROR, "Invalid value for edcca enable");
++ return -1;
++ }
++ hapd->iconf->edcca_enable = (u8) mode;
++ if (hostapd_drv_configure_edcca_enable(hapd) != 0)
++ return -1;
++ } else if (os_strcmp(config, "compensation") == 0) {
++ int compensation = atoi(value);
++ if (compensation < EDCCA_MIN_COMPENSATION ||
++ compensation > EDCCA_MAX_COMPENSATION) {
++ wpa_printf(MSG_ERROR, "Invalid value for edcca compensation");
++ return -1;
++ }
++ hapd->iconf->edcca_compensation = (s8) compensation;
++ if (hostapd_drv_configure_edcca_enable(hapd) != 0)
++ return -1;
++ } else if (os_strcmp(config, "threshold") == 0) {
++ char *thres_value;
++ thres_value = os_strchr(value, ':');
++ if (thres_value == NULL)
++ return -1;
++ *thres_value++ = '\0';
++
++ if(thres_value == NULL)
++ return -1;
++ int bw_idx= atoi(value);
++ int threshold = atoi(thres_value);
++
++ if (bw_idx < EDCCA_BW_20 || bw_idx > EDCCA_BW_80) {
++ wpa_printf(MSG_ERROR,
++ "Unsupported Bandwidth idx %d for SET_EDCCA",
++ bw_idx);
++ return -1;
++ }
++ if (threshold < EDCCA_MIN_CONFIG_THRES ||
++ threshold > EDCCA_MAX_CONFIG_THRES) {
++ wpa_printf(MSG_ERROR,
++ "Unsupported threshold %d for SET_EDCCA",
++ threshold);
++ return -1;
++ }
++
++ int threshold_arr[EDCCA_MAX_BW_NUM];
++ /* 0x7f means keep the origival value in firmware */
++ os_memset(threshold_arr, 0x7f, sizeof(threshold_arr));
++ threshold_arr[bw_idx] = threshold;
++
++ if (hostapd_drv_configure_edcca_threshold(hapd, threshold_arr) != 0)
++ return -1;
++ } else {
++ wpa_printf(MSG_ERROR,
++ "Unsupported parameter %s for SET_EDCCA", config);
++ return -1;
++ }
++ return os_snprintf(buf, buflen, "OK\n");
++}
++
++
++static int
++hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
++ size_t buflen)
++{
++ char *pos, *end;
++
++ pos = buf;
++ end = buf + buflen;
++ u8 value[EDCCA_MAX_BW_NUM] = {0};
++
++ if (os_strcmp(cmd, "enable") == 0) {
++ return os_snprintf(pos, end - pos, "Enable: %s\n",
++ edcca_mode_str(hapd->iconf->edcca_enable));
++ } else if (os_strcmp(cmd, "compensation") == 0) {
++ return os_snprintf(pos, end - pos, "Compensation: %d\n",
++ hapd->iconf->edcca_compensation);
++ } else if (os_strcmp(cmd, "threshold") == 0) {
++ if (hostapd_drv_get_edcca(hapd, EDCCA_CTRL_GET_THRES, &value) != 0)
++ return -1;
++ return os_snprintf(pos, end - pos,
++ "Threshold BW20: 0x%x, BW40: 0x%x, BW80: 0x%x\n",
++ value[0], value[1], value[2]);
++ } else {
++ wpa_printf(MSG_ERROR,
++ "Unsupported parameter %s for GET_EDCCA", cmd);
++ return -1;
++ }
++}
++
++
+ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ char *buf, char *reply,
+ int reply_size,
+@@ -3868,6 +3987,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply,
+ reply_size);
+ #endif /* ANDROID */
++ } else if (os_strncmp(buf, "SET_EDCCA ", 10) == 0) {
++ reply_len = hostapd_ctrl_iface_set_edcca(hapd, buf+10, reply,
++ reply_size);
++ } else if (os_strncmp(buf, "GET_EDCCA ", 10) == 0) {
++ reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
++ reply_size);
+ } else {
+ os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
+ reply_len = 16;
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 4a20eb4e1..373879f79 100644
+index 4a20eb4..344585a 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -294,6 +294,9 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -62,16 +226,25 @@
return conf;
}
+@@ -1007,6 +1010,7 @@ void hostapd_config_free(struct hostapd_config *conf)
+ #ifdef CONFIG_ACS
+ os_free(conf->acs_chan_bias);
+ #endif /* CONFIG_ACS */
++ os_free(conf->edcca_threshold);
+ wpabuf_free(conf->lci);
+ wpabuf_free(conf->civic);
+
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3f68e76d5..3ac2ae070 100644
+index 3f68e76..775c567 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1153,8 +1153,18 @@ struct hostapd_config {
+@@ -1153,8 +1153,37 @@ struct hostapd_config {
#define CH_SWITCH_EHT_ENABLED BIT(0)
#define CH_SWITCH_EHT_DISABLED BIT(1)
unsigned int ch_switch_eht_config;
+ u8 edcca_enable;
+ s8 edcca_compensation;
++ int *edcca_threshold;
};
+enum edcca_mode {
@@ -79,99 +252,173 @@
+ EDCCA_MODE_AUTO = 1,
+};
+
++enum edcca_bw_id {
++ EDCCA_BW_20 = 0,
++ EDCCA_BW_40,
++ EDCCA_BW_80,
++ EDCCA_MAX_BW_NUM,
++};
++
++enum mtk_vendor_attr_edcca_ctrl_mode {
++ EDCCA_CTRL_SET_EN = 0,
++ EDCCA_CTRL_SET_THRES,
++ EDCCA_CTRL_GET_EN,
++ EDCCA_CTRL_GET_THRES,
++ EDCCA_CTRL_NUM,
++};
++
+#define EDCCA_DEFAULT_COMPENSATION -6
+#define EDCCA_MIN_COMPENSATION -126
+#define EDCCA_MAX_COMPENSATION 126
++#define EDCCA_MIN_CONFIG_THRES -126
++#define EDCCA_MAX_CONFIG_THRES 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 0c7aee276..5d2d79c38 100644
+index 0c7aee2..25e967d 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1015,3 +1015,12 @@ int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable)
+@@ -1015,3 +1015,27 @@ int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable)
return 0;
return hapd->driver->dpp_listen(hapd->drv_priv, enable);
}
+
-+int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd)
++int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd)
+{
-+ if (!hapd->driver || !hapd->driver->configure_edcca_threshold)
++ if (!hapd->driver || !hapd->driver->configure_edcca_enable)
+ return 0;
-+ return hapd->driver->configure_edcca_threshold(hapd->drv_priv,
++ return hapd->driver->configure_edcca_enable(hapd->drv_priv,
+ hapd->iconf->edcca_enable,
+ hapd->iconf->edcca_compensation);
+}
++
++int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
++ const int *threshold)
++{
++ if (!hapd->driver || !hapd->driver->configure_edcca_threshold)
++ return 0;
++ return hapd->driver->configure_edcca_threshold(hapd->drv_priv, threshold);
++}
++
++int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
++{
++ if (!hapd->driver || !hapd->driver->get_edcca)
++ return 0;
++ return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
++}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index b4fb766ee..f8fef1929 100644
+index b4fb766..70a99f4 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -138,7 +138,7 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd);
+@@ -138,7 +138,10 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd);
int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
u16 reason_code, const u8 *ie, size_t ielen);
int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
-
-+int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd);
++int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
++int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
++ const int *threshold);
++int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 0dd8c13b7..6babb036a 100644
+index 0dd8c13..d05f948 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2295,6 +2295,9 @@ dfs_offload:
+@@ -2295,6 +2295,13 @@ dfs_offload:
}
#endif /* CONFIG_MESH */
-+ if (hostapd_drv_configure_edcca_threshold(hapd) < 0)
++ if (hostapd_drv_configure_edcca_enable(hapd) < 0)
+ goto fail;
+
++ if (hostapd_drv_configure_edcca_threshold(hapd,
++ hapd->iconf->edcca_threshold) < 0)
++ goto fail;
++
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
+diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
+index 528387f..7056126 100644
+--- a/src/common/mtk_vendor.h
++++ b/src/common/mtk_vendor.h
+@@ -29,14 +29,21 @@ enum mtk_vendor_attr_edcca_ctrl {
+ NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1
+ };
+
+-enum mtk_vendor_attr_edcca_ctrl_mode {
+- EDCCA_CTRL_SET_EN = 0,
+- EDCCA_CTRL_SET_THERS,
+- EDCCA_CTRL_GET_EN,
+- EDCCA_CTRL_GET_THERS,
+- EDCCA_CTRL_NUM,
++enum mtk_vendor_attr_edcca_dump {
++ MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0,
++
++ MTK_VENDOR_ATTR_EDCCA_DUMP_MODE,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_MAX =
++ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1
+ };
+
++
+ static struct nla_policy edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = {
+ [MTK_VENDOR_ATTR_EDCCA_CTRL_MODE] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] = { .type = NLA_U8 },
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 1d2b1b265..575448a93 100644
+index 1d2b1b2..3559974 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -4676,6 +4676,8 @@ struct wpa_driver_ops {
+@@ -4676,6 +4676,10 @@ struct wpa_driver_ops {
const u8 *match, size_t match_len,
bool multicast);
#endif /* CONFIG_TESTING_OPTIONS */
-+ int (*configure_edcca_threshold)(void *priv, const u8 edcca_enable,
++ int (*configure_edcca_enable)(void *priv, const u8 edcca_enable,
+ const s8 edcca_compensation);
++ int (*configure_edcca_threshold)(void *priv, const int *threshold);
++ int (*get_edcca)(void *priv, const u8 mode, u8 *value);
};
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 5eba0ea1b..76680dfd3 100644
+index 5eba0ea..9c2782c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -35,6 +35,7 @@
+@@ -35,6 +35,8 @@
#include "radiotap_iter.h"
#include "rfkill.h"
#include "driver_nl80211.h"
+#include "common/mtk_vendor.h"
++#include "ap/ap_config.h"
#ifndef NETLINK_CAP_ACK
-@@ -12368,6 +12369,45 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
+@@ -12368,6 +12370,165 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
#endif /* CONFIG_TESTING_OPTIONS */
-+static int nl80211_configure_edcca_threshold(void *priv,
-+ const u8 edcca_enable,
-+ const s8 edcca_compensation)
++static int nl80211_configure_edcca_enable(void *priv,
++ const u8 edcca_enable,
++ const s8 edcca_compensation)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ /* Prepare nl80211 cmd */
+ struct nl_msg *msg;
+ struct nlattr *data;
+ int ret;
+
+ if (!drv->mtk_edcca_vendor_cmd_avail) {
+ wpa_printf(MSG_INFO,
-+ "nl80211: Driver does not support setting EDCCA threshold");
++ "nl80211: Driver does not support setting EDCCA enable");
+ return 0;
+ }
+
@@ -191,7 +438,128 @@
+ nla_nest_end(msg, data);
+ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
+ if (ret) {
++ wpa_printf(MSG_ERROR, "Failed to configure EDCCA enable. ret=%d (%s) ",
++ ret, strerror(-ret));
++ }
++ return ret;
++}
++
++static int nl80211_configure_edcca_threshold(void *priv, const int *threshold)
++{
++ struct i802_bss *bss = priv;
++ struct wpa_driver_nl80211_data *drv = bss->drv;
++ struct nl_msg *msg;
++ struct nlattr *data;
++ int ret;
++
++ if (!drv->mtk_edcca_vendor_cmd_avail) {
++ wpa_printf(MSG_INFO,
++ "nl80211: Driver does not support setting EDCCA threshold");
++ return 0;
++ }
++
++ if (!threshold) {
++ wpa_printf(MSG_INFO,
++ "nl80211: Input EDCCA threshold is empty!");
++ return 0;
++ }
++
++ if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD,
++ MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL) ||
++ !(data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA)) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_MODE, EDCCA_CTRL_SET_THRES) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL, threshold[0] & 0xff) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL, threshold[1] & 0xff) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL, threshold[2] & 0xff)) {
++ wpa_printf (MSG_ERROR, "Prepare nl80211 msg fail");
++ nlmsg_free(msg);
++ return -ENOBUFS;
++ }
++ nla_nest_end(msg, data);
++ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
++ if (ret) {
++ wpa_printf(MSG_ERROR, "Failed to configure EDCCA threshold. ret=%d (%s) ",
++ ret, strerror(-ret));
++ }
++ return ret;
++}
++
++
++static int edcca_info_handler(struct nl_msg *msg, void *arg)
++{
++ u8 *info = (u8*) arg;
++ struct nlattr *tb[NL80211_ATTR_MAX + 1];
++ struct nlattr *tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_MAX + 1];
++ struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
++ struct nlattr *nl_vend, *attr;
++
++ nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
++ genlmsg_attrlen(gnlh, 0), NULL);
++
++ nl_vend = tb[NL80211_ATTR_VENDOR_DATA];
++ if (!nl_vend)
++ return NL_SKIP;
++
++ nla_parse(tb_vendor, MTK_VENDOR_ATTR_EDCCA_DUMP_MAX,
++ nla_data(nl_vend), nla_len(nl_vend), NULL);
++
++ attr = tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL];
++ if (!attr) {
++ wpa_printf(MSG_ERROR, "nl80211: MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL");
++ return NL_SKIP;
++ }
++
++ *info++ = nla_get_u8(attr);
++
++ attr = tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL];
++ if (!attr) {
++ wpa_printf(MSG_ERROR, "nl80211: MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL");
++ return NL_SKIP;
++ }
++
++ *info++ = nla_get_u8(attr);
++
++ attr = tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL];
++ if (!attr) {
++ wpa_printf(MSG_ERROR, "nl80211: MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL");
++ return NL_SKIP;
++ }
++
++ *info = nla_get_u8(attr);
++ return NL_SKIP;
++}
++
++
++static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
++{
++ struct i802_bss *bss = priv;
++ struct wpa_driver_nl80211_data *drv = bss->drv;
++ struct nl_msg *msg;
++ struct nlattr *data;
++ int ret;
++
++ if (!drv->mtk_edcca_vendor_cmd_avail) {
++ wpa_printf(MSG_INFO,
++ "nl80211: Driver does not support setting EDCCA threshold");
++ return 0;
++ }
++
++ if (!(msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_VENDOR)) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD,
++ MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL) ||
++ !(data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA | NLA_F_NESTED)) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_MODE, mode)) {
++ wpa_printf (MSG_ERROR, "Prepare nl80211 msg fail");
++ nlmsg_free(msg);
++ return -ENOBUFS;
++ }
++ nla_nest_end(msg, data);
++ ret = send_and_recv_msgs(drv, msg, edcca_info_handler, value, NULL, NULL);
++ if (ret) {
-+ wpa_printf(MSG_ERROR, "Failed to configure EDCCA. ret=%d (%s) ",
++ wpa_printf(MSG_ERROR, "Failed to get EDCCA configuration. ret=%d (%s)",
+ ret, strerror(-ret));
+ }
+ return ret;
@@ -200,15 +568,17 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -12514,4 +12554,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12514,4 +12675,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.register_frame = testing_nl80211_register_frame,
.radio_disable = testing_nl80211_radio_disable,
#endif /* CONFIG_TESTING_OPTIONS */
+/* Need ifdef CONFIG_DRIVER_NL80211_MTK */
++ .configure_edcca_enable = nl80211_configure_edcca_enable,
+ .configure_edcca_threshold = nl80211_configure_edcca_threshold,
++ .get_edcca = nl80211_get_edcca,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 6e40d5556..13e5d248c 100644
+index 6e40d55..13e5d24 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -181,6 +181,7 @@ struct wpa_driver_nl80211_data {
@@ -220,7 +590,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 7ede0d030..732ae292d 100644
+index 7ede0d0..732ae29 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -18,6 +18,7 @@
@@ -245,5 +615,5 @@
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches/99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch b/recipes-wifi/hostapd/files/patches/99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch
deleted file mode 100644
index e8e96d6..0000000
--- a/recipes-wifi/hostapd/files/patches/99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 64344c416f8d394552aeaa44f2b1cea4c9815141 Mon Sep 17 00:00:00 2001
-From: Howard Hsu <howard-yh.hsu@mediatek.com>
-Date: Fri, 24 Jun 2022 22:32:40 +0800
-Subject: [PATCH 99913/99916] Add hostapd command handler for SET_EDCCA,
- GET_EDCCA and APPLY_EDCCA
-
----
- hostapd/ctrl_iface.c | 99 ++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 99 insertions(+)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index bb8c74fd3..b3e61ff3d 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -598,6 +598,19 @@ static const char * pbc_status_str(enum pbc_status status)
- }
-
-
-+static const char * edcca_mode_str(enum edcca_mode status)
-+{
-+ switch (status) {
-+ case EDCCA_MODE_FORCE_DISABLE:
-+ return "Force Disable";
-+ case EDCCA_MODE_AUTO:
-+ return "Auto";
-+ default:
-+ return "Unknown";
-+ }
-+}
-+
-+
- static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
- char *buf, size_t buflen)
- {
-@@ -3322,6 +3335,85 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
- #endif /* ANDROID */
-
-
-+static int
-+hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
-+ char *buf, size_t buflen)
-+{
-+ char *pos, *config, *value;
-+ config = cmd;
-+ pos = os_strchr(config, ' ');
-+ if (pos == NULL)
-+ return -1;
-+ *pos++ = '\0';
-+
-+ if(pos == NULL)
-+ return -1;
-+ value = pos;
-+
-+ if (os_strcmp(config, "enable") == 0) {
-+ int mode = atoi(value);
-+ if (mode < EDCCA_MODE_FORCE_DISABLE || mode > EDCCA_MODE_AUTO) {
-+ wpa_printf(MSG_ERROR, "Invalid value for edcca enable");
-+ return -1;
-+ }
-+ hapd->iconf->edcca_enable = (u8) mode;
-+ } else if (os_strcmp(config, "compensation") == 0) {
-+ int compensation = atoi(value);
-+ if (compensation < EDCCA_MIN_COMPENSATION ||
-+ compensation > EDCCA_MAX_COMPENSATION) {
-+ wpa_printf(MSG_ERROR, "Invalid value for edcca compensation");
-+ return -1;
-+ }
-+ hapd->iconf->edcca_compensation = (s8) compensation;
-+ } else {
-+ wpa_printf(MSG_ERROR,
-+ "Unsupported parameter %s for SET_EDCCA", config);
-+ return -1;
-+ }
-+ return os_snprintf(buf, buflen, "OK\n");
-+}
-+
-+
-+static int
-+hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *buf,
-+ size_t buflen)
-+{
-+ int ret;
-+ char *pos, *end;
-+
-+ pos = buf;
-+ end = buf + buflen;
-+
-+ ret = os_snprintf(pos, end - pos, "EDCCA Mode: %s\n",
-+ edcca_mode_str(hapd->iconf->edcca_enable));
-+
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+
-+ ret = os_snprintf(pos, end - pos, "EDCCA compensation %d\n",
-+ hapd->iconf->edcca_compensation);
-+
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+
-+ return pos - buf;
-+}
-+
-+
-+static int
-+hostapd_ctrl_iface_apply_edcca(struct hostapd_data *hapd, char *buf,
-+ size_t buflen)
-+{
-+ if(hostapd_drv_configure_edcca_threshold(hapd) == 0) {
-+ return os_snprintf(buf, buflen, "OK\n");
-+ } else {
-+ return -1;
-+ }
-+}
-+
-+
- static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- char *buf, char *reply,
- int reply_size,
-@@ -3868,6 +3960,13 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply,
- reply_size);
- #endif /* ANDROID */
-+ } else if (os_strncmp(buf, "SET_EDCCA ", 10) == 0) {
-+ reply_len = hostapd_ctrl_iface_set_edcca(hapd, buf+10, reply,
-+ reply_size);
-+ } else if (os_strncmp(buf, "GET_EDCCA", 9) == 0) {
-+ reply_len = hostapd_ctrl_iface_get_edcca(hapd, reply, reply_size);
-+ } else if (os_strncmp(buf, "APPLY_EDCCA", 11) == 0) {
-+ reply_len = hostapd_ctrl_iface_apply_edcca(hapd, reply, reply_size);
- } else {
- os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
- reply_len = 16;
---
-2.25.1
-
diff --git a/recipes-wifi/hostapd/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch b/recipes-wifi/hostapd/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch
index f255d50..054dd47 100644
--- a/recipes-wifi/hostapd/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch
+++ b/recipes-wifi/hostapd/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch
@@ -1,7 +1,7 @@
-From eb5eaa8daca8108be818aa5dc0021cc4b7f1f051 Mon Sep 17 00:00:00 2001
+From d5c58b339c448a6d1d476205b68d434d7bf8e472 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Tue, 9 Aug 2022 10:23:44 -0700
-Subject: [PATCH 99914/99916] Add hostapd HEMU SET/GET control
+Subject: [PATCH 1/6] Add hostapd HEMU SET/GET control
---
hostapd/config_file.c | 9 +++
@@ -20,10 +20,10 @@
13 files changed, 251 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 8a21c9698..0be53044a 100644
+index c99e76d..afe0f0c 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3659,6 +3659,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -3698,6 +3698,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
bss->unsol_bcast_probe_resp_interval = val;
@@ -40,10 +40,10 @@
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index b3e61ff3d..60c1fb44e 100644
+index 9c70d54..5f71aee 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3414,6 +3414,63 @@ hostapd_ctrl_iface_apply_edcca(struct hostapd_data *hapd, char *buf,
+@@ -3441,6 +3441,63 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
}
@@ -107,10 +107,10 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -3967,6 +4024,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- reply_len = hostapd_ctrl_iface_get_edcca(hapd, reply, reply_size);
- } else if (os_strncmp(buf, "APPLY_EDCCA", 11) == 0) {
- reply_len = hostapd_ctrl_iface_apply_edcca(hapd, reply, reply_size);
+@@ -3993,6 +4050,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ } else if (os_strncmp(buf, "GET_EDCCA ", 10) == 0) {
+ reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
+ reply_size);
+ } else if (os_strncmp(buf, "SET_HEMU ", 9) == 0) {
+ reply_len = hostapd_ctrl_iface_set_hemu(hapd, buf+9, reply,
+ reply_size);
@@ -120,7 +120,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index db2125805..0d364773b 100644
+index db21258..0d36477 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1380,6 +1380,20 @@ static int hostapd_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc,
@@ -156,7 +156,7 @@
{ "dpp_qr_code", hostapd_cli_cmd_dpp_qr_code, NULL,
"report a scanned DPP URI from a QR Code" },
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 373879f79..8ce4d9a16 100644
+index 344585a..0e1f192 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -280,6 +280,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -168,7 +168,7 @@
/* The third octet of the country string uses an ASCII space character
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3ac2ae070..4462f29b7 100644
+index 775c567..41b8c68 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1114,6 +1114,7 @@ struct hostapd_config {
@@ -180,12 +180,12 @@
/* VHT enable/disable config from CHAN_SWITCH */
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 5d2d79c38..55452323d 100644
+index 25e967d..4598737 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1024,3 +1024,17 @@ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd)
- hapd->iconf->edcca_enable,
- hapd->iconf->edcca_compensation);
+@@ -1039,3 +1039,17 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
+ return 0;
+ return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
}
+
+int hostapd_drv_hemu_ctrl(struct hostapd_data *hapd)
@@ -202,25 +202,25 @@
+ return hapd->driver->hemu_dump(hapd->drv_priv, hemu_onoff);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index f8fef1929..5bcb2251a 100644
+index 70a99f4..bca39c5 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -139,6 +139,8 @@ int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
- u16 reason_code, const u8 *ie, size_t ielen);
- int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
- int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd);
+@@ -142,6 +142,8 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
+ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
+ const int *threshold);
+ 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);
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 6babb036a..0f3691ba3 100644
+index d05f948..921769d 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2297,6 +2297,8 @@ dfs_offload:
-
- if (hostapd_drv_configure_edcca_threshold(hapd) < 0)
+@@ -2301,6 +2301,8 @@ dfs_offload:
+ if (hostapd_drv_configure_edcca_threshold(hapd,
+ hapd->iconf->edcca_threshold) < 0)
goto fail;
+ if (hostapd_drv_hemu_ctrl(hapd) < 0)
+ goto fail;
@@ -228,7 +228,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 528387fa5..5c8f1792e 100644
+index 7056126..69a46df 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -10,6 +10,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -240,7 +240,7 @@
MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
};
-@@ -167,6 +169,19 @@ enum mtk_vendor_attr_rfeature_ctrl {
+@@ -174,6 +176,19 @@ enum mtk_vendor_attr_rfeature_ctrl {
NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL - 1
};
@@ -261,7 +261,7 @@
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 575448a93..88b371d61 100644
+index 3559974..4cd7505 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1623,6 +1623,11 @@ struct wpa_driver_ap_params {
@@ -276,10 +276,10 @@
};
struct wpa_driver_mesh_bss_params {
-@@ -4678,6 +4683,14 @@ struct wpa_driver_ops {
- #endif /* CONFIG_TESTING_OPTIONS */
- int (*configure_edcca_threshold)(void *priv, const u8 edcca_enable,
+@@ -4680,6 +4685,14 @@ struct wpa_driver_ops {
const s8 edcca_compensation);
+ int (*configure_edcca_threshold)(void *priv, const int *threshold);
+ int (*get_edcca)(void *priv, const u8 mode, u8 *value);
+
+ /**
+ * hemu_ctrl - ctrl on off for UL/DL MURU
@@ -292,10 +292,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 76680dfd3..b06de0687 100644
+index 5fe1d33..ef0ca18 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12303,6 +12303,114 @@ fail:
+@@ -12304,6 +12304,114 @@ fail:
}
@@ -410,7 +410,7 @@
#ifdef CONFIG_DPP
static int nl80211_dpp_listen(void *priv, bool enable)
{
-@@ -12547,6 +12655,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12668,6 +12776,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.update_connect_params = nl80211_update_connection_params,
.send_external_auth_status = nl80211_send_external_auth_status,
.set_4addr_mode = nl80211_set_4addr_mode,
@@ -420,7 +420,7 @@
.dpp_listen = nl80211_dpp_listen,
#endif /* CONFIG_DPP */
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 13e5d248c..57f02497e 100644
+index 13e5d24..57f0249 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -182,6 +182,7 @@ struct wpa_driver_nl80211_data {
@@ -432,7 +432,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 732ae292d..cc146d9fc 100644
+index 732ae29..cc146d9 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1056,6 +1056,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -446,5 +446,5 @@
}
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch b/recipes-wifi/hostapd/files/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
index bdc20dd..c853b08 100644
--- a/recipes-wifi/hostapd/files/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
+++ b/recipes-wifi/hostapd/files/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
diff --git a/recipes-wifi/hostapd/files/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch b/recipes-wifi/hostapd/files/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
index c9ea6b5..eadaa63 100644
--- a/recipes-wifi/hostapd/files/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
+++ b/recipes-wifi/hostapd/files/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,
diff --git a/recipes-wifi/hostapd/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch b/recipes-wifi/hostapd/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
index c1f276c..796dc3f 100644
--- a/recipes-wifi/hostapd/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
+++ b/recipes-wifi/hostapd/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
@@ -1,7 +1,7 @@
-From 15784701fb4b10ac058ae41763c5d4bda15366f0 Mon Sep 17 00:00:00 2001
+From 32816f9bf56aeff95ddfe4a735028bee0d552f4d Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Wed, 21 Sep 2022 15:14:11 -0700
-Subject: [PATCH 99917/99920] add hostapd AMPDU and AMSDU control command
+Subject: [PATCH 4/6] add hostapd AMPDU and AMSDU control command
---
hostapd/config_file.c | 18 ++++
@@ -20,10 +20,10 @@
13 files changed, 297 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 9b79be1..310f97d 100644
+index 6b3b88d..9660543 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4789,6 +4789,24 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4843,6 +4843,24 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "ibf_enable") == 0) { /*ibf setting is per device*/
int val = atoi(pos);
conf->ibf_enable = !!val;
@@ -49,10 +49,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index a010e7f..0c40175 100644
+index c881d37..e51488e 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3495,6 +3495,48 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
+@@ -3522,6 +3522,48 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
}
@@ -101,7 +101,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4055,6 +4097,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4081,6 +4123,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_hemu(hapd, reply, reply_size);
} else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
reply_len = hostapd_ctrl_iface_get_ibf(hapd, reply, reply_size);
@@ -138,7 +138,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 14b21cb..910231b 100644
+index 7a96cb8..3ce8217 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -299,6 +299,8 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -151,11 +151,11 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 2a74e09..01b051d 100644
+index 44a0e7e..3e73236 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1158,6 +1158,8 @@ struct hostapd_config {
- s8 edcca_compensation;
+@@ -1159,6 +1159,8 @@ struct hostapd_config {
+ int *edcca_threshold;
u8 three_wire_enable;
u8 ibf_enable;
+ u8 ampdu;
@@ -164,10 +164,10 @@
enum three_wire_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 0b9b410..be6dcb8 100644
+index 60ae825..5d07272 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1062,4 +1062,25 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
+@@ -1077,4 +1077,25 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
if (!hapd->driver || !hapd->driver->ibf_dump)
return 0;
return hapd->driver->ibf_dump(hapd->drv_priv, ibf_enable);
@@ -196,10 +196,10 @@
+ return hapd->driver->aggregation_dump(hapd->drv_priv, aggr);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index da82382..4084901 100644
+index ab9aedc..4c1c201 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -144,6 +144,9 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff);
+@@ -147,6 +147,9 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff);
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable);
@@ -210,10 +210,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index f095fe4..5fc998e 100644
+index e44b73d..60bd6f3 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2303,6 +2303,10 @@ dfs_offload:
+@@ -2307,6 +2307,10 @@ dfs_offload:
goto fail;
if (hostapd_drv_ibf_ctrl(hapd) < 0)
goto fail;
@@ -225,10 +225,10 @@
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 d6d04de..5568dab 100644
+index 4050cf8..d78e538 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
-@@ -170,6 +170,24 @@ enum mtk_vendor_attr_wireless_ctrl {
+@@ -177,6 +177,24 @@ enum mtk_vendor_attr_wireless_ctrl {
NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1
};
@@ -254,10 +254,10 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index dab37f9..3286429 100644
+index 71ded61..57f3be6 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -4718,6 +4718,17 @@ struct wpa_driver_ops {
+@@ -4720,6 +4720,17 @@ struct wpa_driver_ops {
*
*/
int (*ibf_dump)(void *priv, u8 *ibf_enable);
@@ -276,10 +276,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 1c065d4..a06ac58 100644
+index 00f9231..07dac13 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12655,6 +12655,163 @@ fail:
+@@ -12776,6 +12776,163 @@ fail:
return -ENOBUFS;
}
@@ -443,7 +443,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -12807,4 +12964,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12930,4 +13087,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.three_wire_ctrl = nl80211_enable_three_wire,
.ibf_ctrl = nl80211_ibf_enable,
.ibf_dump = nl80211_ibf_dump,
diff --git a/recipes-wifi/hostapd/files/patches/patches.inc b/recipes-wifi/hostapd/files/patches/patches.inc
index 78475be..ee712d1 100644
--- a/recipes-wifi/hostapd/files/patches/patches.inc
+++ b/recipes-wifi/hostapd/files/patches/patches.inc
@@ -66,7 +66,6 @@
file://99910-hostapd-mtk-hostapd-add-support-for-runtime-set-in-band-discove.patch \
file://99911-hostapd-mtk-Add-mtk_vendor.h.patch \
file://99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch \
- file://99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch \
file://99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch \
file://99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch \
file://99916-hostapd-mtk-Add-hostapd-iBF-control.patch \
diff --git a/recipes-wifi/linux-mt76/files/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch b/recipes-wifi/linux-mt76/files/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch
index 97002bb..d1c487a 100644
--- a/recipes-wifi/linux-mt76/files/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1120-mt76-mt7915-add-vendor-subcmd-EDCCA-ctrl.patch
@@ -1,18 +1,19 @@
-From b3325580c9d1f3503582323e0787de7f28d49b58 Mon Sep 17 00:00:00 2001
+From a7682d61851c686f78273df7a9926203c8e17ee9 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Fri, 24 Jun 2022 11:15:45 +0800
-Subject: [PATCH 1120/1128] mt76: mt7915: add vendor subcmd EDCCA ctrl
+Subject: [PATCH] mt76: mt7915: add vendor subcmd EDCCA ctrl
+ enable/threshold/compensation
-Change-Id: I92dabf8be9c5a7ecec78f35325bc5645af8d15ab
+Change-Id: I06a3f94d5e444be894200e2b6588d76ed38d09d0
---
- mt76_connac_mcu.h | 1 +
- mt7915/main.c | 3 +++
- mt7915/mcu.c | 38 ++++++++++++++++++++++++++++
- mt7915/mcu.h | 13 ++++++++++
- mt7915/mt7915.h | 2 ++
- mt7915/vendor.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++
- mt7915/vendor.h | 19 ++++++++++++++
- 7 files changed, 139 insertions(+)
+ mt76_connac_mcu.h | 1 +
+ mt7915/main.c | 3 ++
+ mt7915/mcu.c | 72 +++++++++++++++++++++++++
+ mt7915/mcu.h | 21 ++++++++
+ mt7915/mt7915.h | 3 +-
+ mt7915/vendor.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++
+ mt7915/vendor.h | 33 ++++++++++++
+ 7 files changed, 266 insertions(+), 1 deletion(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
index a31b85f0..bceb6799 100644
@@ -41,16 +42,15 @@
ret = mt7915_set_channel(phy);
if (ret)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index e03ec9e3..8fc40c5a 100644
+index e03ec9e3..67304c84 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -4282,3 +4282,41 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
+@@ -4282,3 +4282,75 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
return 0;
}
+
-+int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value,
-+ s8 compensation)
++int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation)
+{
+ static const u8 ch_band[] = {
+ [NL80211_BAND_2GHZ] = 0,
@@ -70,27 +70,62 @@
+ .band_idx = phy->band_idx,
+ .cmd_idx = mode,
+ .record_in_fw = false,
-+ .region = dev->mt76.region,
+ .thres_compensation = compensation,
+ };
+
-+ if (ch_band[chandef->chan->band] != 2)
-+ return 0;
++ if (ch_band[chandef->chan->band] == 2 && dev->mt76.region == NL80211_DFS_FCC)
++ req.region = dev->mt76.region;
+
+ if (mode == EDCCA_CTRL_SET_EN) {
-+ if (!value)
-+ req.setting[0] = EDCCA_MODE_AUTO;
-+ else
-+ req.setting[0] = value[0];
++ req.setting[0] = (!value)? EDCCA_MODE_AUTO: value[0];
++ } else if (mode == EDCCA_CTRL_SET_THERS) {
++ req.setting[0] = value[0];
++ req.setting[1] = value[1];
++ req.setting[2] = value[2];
++ } else {
++ return -EINVAL;
+ }
+
+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(EDCCA), &req, sizeof(req), true);
+}
++
++
++int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value)
++{
++ struct mt7915_dev *dev = phy->dev;
++ struct {
++ u8 band_idx;
++ u8 cmd_idx;
++ u8 setting[3];
++ bool record_in_fw;
++ u8 region;
++ s8 thres_compensation;
++ } __packed req = {
++ .band_idx = phy->band_idx,
++ .cmd_idx = mode,
++ .record_in_fw = false,
++ };
++ struct sk_buff *skb;
++ int ret;
++ struct mt7915_mcu_edcca_info *res;
++
++ ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(EDCCA), &req, sizeof(req),
++ true, &skb);
++ if (ret)
++ return ret;
++
++ res = (struct mt7915_mcu_edcca_info *)skb->data;
++ *value++ = res->info[0];
++ *value++ = res->info[1];
++ *value = res->info[2];
++
++ return 0;
++}
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 0a79fe04..2ca2c005 100644
+index 0a79fe04..b608cb6a 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
-@@ -836,6 +836,19 @@ enum {
+@@ -836,6 +836,27 @@ enum {
MURU_DL_INIT,
MURU_UL_INIT,
};
@@ -107,27 +142,36 @@
+ EDCCA_MODE_FORCE_DISABLE,
+ EDCCA_MODE_AUTO,
+};
++
++struct mt7915_mcu_edcca_info {
++ u8 cmd_idx;
++ u8 band_idx;
++ u8 info[3];
++ u8 fginit;
++ u8 rsv[2];
++};
#endif
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 5023cfcb..1cfa6f03 100644
+index 5023cfcb..2b56692d 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -747,6 +747,8 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
+@@ -747,7 +747,8 @@ void mt7915_vendor_amnt_fill_rx(struct mt7915_phy *phy, struct sk_buff *skb);
int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
struct ieee80211_sta *sta);
#endif
-+int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value,
-+ s8 compensation);
-
+-
++int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
++int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
+
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 77d71e48..5a28a554 100644
+index 77d71e48..cd5c3b83 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -62,6 +62,17 @@ phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = {
+@@ -62,6 +62,24 @@ phy_capa_dump_policy[NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP] = {
[MTK_VENDOR_ATTR_PHY_CAPA_DUMP_MAX_SUPPORTED_STA] = { .type = NLA_U16 },
};
@@ -141,11 +185,18 @@
+ [MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE] = { .type = NLA_S8 },
+};
+
++static const struct nla_policy
++edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = {
++ [MTK_VENDOR_ATTR_EDCCA_DUMP_MODE] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL] = { .type = NLA_U8 },
++ [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL] = { .type = NLA_U8 },
++};
+
struct csi_null_tone {
u8 start;
u8 end;
-@@ -1015,6 +1026,47 @@ mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+@@ -1015,6 +1033,110 @@ mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
return len;
}
@@ -160,6 +211,7 @@
+ int err;
+ u8 edcca_mode;
+ s8 edcca_compensation;
++ u8 edcca_value[EDCCA_THRES_NUM] = {0};
+
+ err = nla_parse(tb, MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, data, data_len,
+ edcca_ctrl_policy, NULL);
@@ -171,7 +223,6 @@
+
+ edcca_mode = nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]);
+ if (edcca_mode == EDCCA_CTRL_SET_EN) {
-+ u8 edcca_value[3] = {0};
+ if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] ||
+ !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE]) {
+ return -EINVAL;
@@ -182,18 +233,81 @@
+ nla_get_s8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE]);
+
+ err = mt7915_mcu_set_edcca(phy, edcca_mode, edcca_value,
-+ edcca_compensation);
++ edcca_compensation);
+ if (err)
+ return err;
++ } else if (edcca_mode == EDCCA_CTRL_SET_THERS) {
++ if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] ||
++ !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL] ||
++ !tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL]) {
++ return -EINVAL;
++ }
++ edcca_value[0] =
++ nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL]);
++ edcca_value[1] =
++ nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL]);
++ edcca_value[2] =
++ nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL]);
++ err = mt7915_mcu_set_edcca(phy, edcca_mode, edcca_value,
++ edcca_compensation);
++ if (err)
++ return err;
++ } else {
++ return -EINVAL;
+ }
++
+ return 0;
+}
+
++static int
++mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
++ struct sk_buff *skb, const void *data, int data_len,
++ unsigned long *storage)
++{
++ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
++ struct mt7915_phy *phy = mt7915_hw_phy(hw);
++ struct mt7915_dev *dev = phy->dev;
++ struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL];
++ void *a;
++ int len = EDCCA_THRES_NUM;
++ int err;
++ u8 edcca_mode;
++ s8 value[EDCCA_THRES_NUM];
++
++ if (*storage == 1)
++ return -ENOENT;
++ *storage = 1;
++
++ err = nla_parse(tb, MTK_VENDOR_ATTR_EDCCA_CTRL_MAX, data, data_len,
++ edcca_ctrl_policy, NULL);
++ if (err)
++ return err;
++
++ if (!tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE])
++ return -EINVAL;
++
++ edcca_mode = nla_get_u8(tb[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE]);
++ if (edcca_mode == EDCCA_CTRL_GET_EN || edcca_mode == EDCCA_CTRL_GET_THERS) {
++ err = mt7915_mcu_get_edcca(phy, edcca_mode, value);
++ } else {
++ return -EINVAL;
++ }
++
++ if (err)
++ return err;
++
++ if (nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL, value[0]) ||
++ nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL, value[1]) ||
++ nla_put_u8(skb, MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL, value[2]))
++ return -ENOMEM;
++
++ return len;
++}
+
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
.info = {
-@@ -1083,6 +1135,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1083,6 +1205,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.dumpit = mt7915_vendor_phy_capa_ctrl_dump,
.policy = phy_capa_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_PHY_CAPA_CTRL_MAX,
@@ -206,22 +320,31 @@
+ .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
+ WIPHY_VENDOR_CMD_NEED_RUNNING,
+ .doit = mt7915_vendor_edcca_ctrl,
++ .dumpit = mt7915_vendor_edcca_ctrl_dump,
+ .policy = edcca_ctrl_policy,
+ .maxattr = MTK_VENDOR_ATTR_EDCCA_CTRL_MAX,
}
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 719b851f..83c41bc1 100644
+index 719b851f..72319717 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
-@@ -10,8 +10,27 @@ enum mtk_nl80211_vendor_subcmds {
+@@ -2,6 +2,7 @@
+ #define __MT7915_VENDOR_H
+
+ #define MTK_NL80211_VENDOR_ID 0x0ce7
++#define EDCCA_THRES_NUM 3
+
+ enum mtk_nl80211_vendor_subcmds {
+ MTK_NL80211_VENDOR_SUBCMD_AMNT_CTRL = 0xae,
+@@ -10,6 +11,38 @@ enum mtk_nl80211_vendor_subcmds {
MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL = 0xc4,
MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5,
MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
+ MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
- };
-
++};
++
+
+enum mtk_vendor_attr_edcca_ctrl {
+ MTK_VENDOR_ATTR_EDCCA_THRESHOLD_INVALID = 0,
@@ -239,10 +362,21 @@
+ NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1
+};
+
++enum mtk_vendor_attr_edcca_dump {
++ MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0,
+
++ MTK_VENDOR_ATTR_EDCCA_DUMP_MODE,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_MAX =
++ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1
+ };
+
enum mtk_capi_control_changed {
- CAPI_RFEATURE_CHANGED = BIT(16),
- CAPI_WIRELESS_CHANGED = BIT(17),
--
2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/1121-mt76-mt7915-implement-bin-file-mode.patch b/recipes-wifi/linux-mt76/files/patches/1121-mt76-mt7915-implement-bin-file-mode.patch
index def5acf..db53404 100644
--- a/recipes-wifi/linux-mt76/files/patches/1121-mt76-mt7915-implement-bin-file-mode.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1121-mt76-mt7915-implement-bin-file-mode.patch
@@ -1,4 +1,4 @@
-From b42c0050ce6061473569362d2884ffabae54e404 Mon Sep 17 00:00:00 2001
+From f7cb9b3ad2c0207db231a16d04beea22be1ef798 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 7 Jul 2022 11:09:59 +0800
Subject: [PATCH 1121/1128] mt76: mt7915: implement bin file mode
@@ -6,14 +6,16 @@
Change-Id: I2a726341541a11cbecdb210b33a8e79aefbd6cf3
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
- eeprom.c | 18 +++++++++++++++++
- mt76.h | 1 +
- mt7915/eeprom.c | 53 +++++++++++++++++++++++++++++++++++++++----------
- mt7915/mt7915.h | 10 ++++++++++
- 4 files changed, 71 insertions(+), 11 deletions(-)
+ eeprom.c | 18 +++++++++++++++
+ mt76.h | 1 +
+ mt7915/eeprom.c | 52 ++++++++++++++++++++------------------------
+ mt7915/eeprom.h | 44 +++++++++++++++++++++++++++++++++++++
+ mt7915/mt7915.h | 17 ++++++++++++---
+ mt7915/mtk_debugfs.c | 36 ++++++++++++++++++++++++++++++
+ 6 files changed, 136 insertions(+), 32 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index 4c50bfe6..baca86fd 100644
+index e083964..5b9faf7 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -104,6 +104,24 @@ out_put_node:
@@ -42,7 +44,7 @@
mt76_eeprom_override(struct mt76_phy *phy)
{
diff --git a/mt76.h b/mt76.h
-index 0a9552b5..e29f490e 100644
+index 0a9552b..e29f490 100644
--- a/mt76.h
+++ b/mt76.h
@@ -1010,6 +1010,7 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
@@ -54,55 +56,44 @@
struct mt76_queue *
mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index 0f5862e3..0ae8d1b4 100644
+index 0f5862e..4d2d9ca 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
-@@ -46,26 +46,36 @@ static char *mt7915_eeprom_name(struct mt7915_dev *dev)
- {
- switch (mt76_chip(&dev->mt76)) {
- case 0x7915:
+@@ -42,33 +42,6 @@ static int mt7915_check_eeprom(struct mt7915_dev *dev)
+ }
+ }
+
+-static char *mt7915_eeprom_name(struct mt7915_dev *dev)
+-{
+- switch (mt76_chip(&dev->mt76)) {
+- case 0x7915:
- return dev->dbdc_support ?
- MT7915_EEPROM_DEFAULT_DBDC : MT7915_EEPROM_DEFAULT;
-+ if (dev->bin_file_mode)
-+ return dev->dbdc_support ?
-+ MT7915_BIN_FILE_DBDC : MT7915_BIN_FILE;
-+ else
-+ return dev->dbdc_support ?
-+ MT7915_EEPROM_DEFAULT_DBDC : MT7915_EEPROM_DEFAULT;
- case 0x7986:
- switch (mt7915_check_adie(dev, true)) {
- case MT7976_ONE_ADIE_DBDC:
+- case 0x7986:
+- switch (mt7915_check_adie(dev, true)) {
+- case MT7976_ONE_ADIE_DBDC:
- return MT7986_EEPROM_MT7976_DEFAULT_DBDC;
-+ return dev->bin_file_mode ?
-+ MT7986_BIN_FILE_MT7976_DBDC : MT7986_EEPROM_MT7976_DEFAULT_DBDC;
- case MT7975_ONE_ADIE:
+- case MT7975_ONE_ADIE:
- return MT7986_EEPROM_MT7975_DEFAULT;
-+ return dev->bin_file_mode ?
-+ MT7986_BIN_FILE_MT7975 : MT7986_EEPROM_MT7975_DEFAULT;
- case MT7976_ONE_ADIE:
+- case MT7976_ONE_ADIE:
- return MT7986_EEPROM_MT7976_DEFAULT;
-+ return dev->bin_file_mode ?
-+ MT7986_BIN_FILE_MT7976 : MT7986_EEPROM_MT7976_DEFAULT;
- case MT7975_DUAL_ADIE:
+- case MT7975_DUAL_ADIE:
- return MT7986_EEPROM_MT7975_DUAL_DEFAULT;
-+ return dev->bin_file_mode ?
-+ MT7986_BIN_FILE_MT7975_DUAL : MT7986_EEPROM_MT7975_DUAL_DEFAULT;
- case MT7976_DUAL_ADIE:
+- case MT7976_DUAL_ADIE:
- return MT7986_EEPROM_MT7976_DUAL_DEFAULT;
-+ return dev->bin_file_mode ?
-+ MT7986_BIN_FILE_MT7976_DUAL : MT7986_EEPROM_MT7976_DUAL_DEFAULT;
- default:
- break;
- }
- return NULL;
- default:
+- default:
+- break;
+- }
+- return NULL;
+- default:
- return MT7916_EEPROM_DEFAULT;
-+ return dev->bin_file_mode ?
-+ MT7916_BIN_FILE : MT7916_EEPROM_DEFAULT;
- }
- }
-
-@@ -81,7 +91,10 @@ mt7915_eeprom_load_default(struct mt7915_dev *dev)
+- }
+-}
+-
+ static int
+ mt7915_eeprom_load_default(struct mt7915_dev *dev)
+ {
+@@ -81,7 +54,10 @@ mt7915_eeprom_load_default(struct mt7915_dev *dev)
return ret;
if (!fw || !fw->data) {
@@ -114,7 +105,23 @@
ret = -EINVAL;
goto out;
}
+@@ -106,6 +82,7 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
+
+ if (ret) {
+ dev->flash_mode = true;
++ dev->eeprom_mode = FLASH_MODE;
+ } else {
+ u8 free_block_num;
+ u32 block_num, i;
+@@ -121,6 +98,7 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
+ for (i = 0; i < block_num; i++)
+ mt7915_mcu_get_eeprom(dev,
+ i * MT7915_EEPROM_BLOCK_SIZE);
++ dev->eeprom_mode = EFUSE_MODE;
+ }
-@@ -224,12 +237,30 @@ int mt7915_eeprom_init(struct mt7915_dev *dev)
+
+ return mt7915_check_eeprom(dev);
+@@ -224,12 +202,28 @@ int mt7915_eeprom_init(struct mt7915_dev *dev)
{
int ret;
@@ -124,10 +131,11 @@
+ if (dev->bin_file_mode) {
+ dev->mt76.eeprom.size = mt7915_eeprom_size(dev);
+ dev->mt76.eeprom.data = devm_kzalloc(dev->mt76.dev, dev->mt76.eeprom.size,
-+ GFP_KERNEL);
++ GFP_KERNEL);
+ if (!dev->mt76.eeprom.data)
+ return -ENOMEM;
+ ret = mt7915_eeprom_load_default(dev);
++ dev->eeprom_mode = BIN_FILE_MODE;
+ } else {
+ ret = mt7915_eeprom_load(dev);
+ }
@@ -136,28 +144,98 @@
if (ret != -EINVAL)
return ret;
-- dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n");
-+ if (dev->bin_file_mode) {
-+ dev_warn(dev->mt76.dev, "bin file load fail, use default bin\n");
-+ dev->bin_file_mode = false;
-+ } else {
-+ dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n");
-+ }
+ dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n");
++ dev->bin_file_mode = false;
++ dev->eeprom_mode = DEFAULT_BIN_MODE;
+
ret = mt7915_eeprom_load_default(dev);
if (ret)
return ret;
+diff --git a/mt7915/eeprom.h b/mt7915/eeprom.h
+index fdae347..f228926 100644
+--- a/mt7915/eeprom.h
++++ b/mt7915/eeprom.h
+@@ -108,6 +108,13 @@ enum mt7915_sku_rate_group {
+ MAX_SKU_RATE_GROUP_NUM,
+ };
+
++enum mt7915_eeprom_mode {
++ DEFAULT_BIN_MODE,
++ EFUSE_MODE,
++ FLASH_MODE,
++ BIN_FILE_MODE,
++};
++
+ static inline int
+ mt7915_get_channel_group_5g(int channel, bool is_7976)
+ {
+@@ -184,6 +191,43 @@ mt7915_get_cal_group_size(struct mt7915_dev *dev)
+ }
+ }
+
++static inline char *mt7915_eeprom_name(struct mt7915_dev *dev)
++{
++ switch (mt76_chip(&dev->mt76)) {
++ case 0x7915:
++ if (dev->bin_file_mode)
++ return dev->dbdc_support ?
++ MT7915_BIN_FILE_DBDC : MT7915_BIN_FILE;
++ else
++ return dev->dbdc_support ?
++ MT7915_EEPROM_DEFAULT_DBDC : MT7915_EEPROM_DEFAULT;
++ case 0x7986:
++ switch (mt7915_check_adie(dev, true)) {
++ case MT7976_ONE_ADIE_DBDC:
++ return dev->bin_file_mode ?
++ MT7986_BIN_FILE_MT7976_DBDC : MT7986_EEPROM_MT7976_DEFAULT_DBDC;
++ case MT7975_ONE_ADIE:
++ return dev->bin_file_mode ?
++ MT7986_BIN_FILE_MT7975 : MT7986_EEPROM_MT7975_DEFAULT;
++ case MT7976_ONE_ADIE:
++ return dev->bin_file_mode ?
++ MT7986_BIN_FILE_MT7976 : MT7986_EEPROM_MT7976_DEFAULT;
++ case MT7975_DUAL_ADIE:
++ return dev->bin_file_mode ?
++ MT7986_BIN_FILE_MT7975_DUAL : MT7986_EEPROM_MT7975_DUAL_DEFAULT;
++ case MT7976_DUAL_ADIE:
++ return dev->bin_file_mode ?
++ MT7986_BIN_FILE_MT7976_DUAL : MT7986_EEPROM_MT7976_DUAL_DEFAULT;
++ default:
++ break;
++ }
++ return NULL;
++ default:
++ return dev->bin_file_mode ?
++ MT7916_BIN_FILE : MT7916_EEPROM_DEFAULT;
++ }
++}
++
+ extern const u8 mt7915_sku_group_len[MAX_SKU_RATE_GROUP_NUM];
+
+ #endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 1cfa6f03..15db02c4 100644
+index 1cfa6f0..9b72f41 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -51,6 +51,15 @@
+@@ -42,15 +42,24 @@
+ #define MT7986_ROM_PATCH "mediatek/mt7986_rom_patch.bin"
+ #define MT7986_ROM_PATCH_MT7975 "mediatek/mt7986_rom_patch_mt7975.bin"
+
+-#define MT7915_EEPROM_DEFAULT "mediatek/mt7915_eeprom.bin"
+-#define MT7915_EEPROM_DEFAULT_DBDC "mediatek/mt7915_eeprom_dbdc.bin"
+-#define MT7916_EEPROM_DEFAULT "mediatek/mt7916_eeprom.bin"
++#define MT7915_EEPROM_DEFAULT "mediatek/mt7915_eeprom.bin"
++#define MT7915_EEPROM_DEFAULT_DBDC "mediatek/mt7915_eeprom_dbdc.bin"
++#define MT7916_EEPROM_DEFAULT "mediatek/mt7916_eeprom.bin"
+ #define MT7986_EEPROM_MT7975_DEFAULT "mediatek/mt7986_eeprom_mt7975.bin"
+ #define MT7986_EEPROM_MT7975_DUAL_DEFAULT "mediatek/mt7986_eeprom_mt7975_dual.bin"
+ #define MT7986_EEPROM_MT7976_DEFAULT "mediatek/mt7986_eeprom_mt7976.bin"
#define MT7986_EEPROM_MT7976_DEFAULT_DBDC "mediatek/mt7986_eeprom_mt7976_dbdc.bin"
#define MT7986_EEPROM_MT7976_DUAL_DEFAULT "mediatek/mt7986_eeprom_mt7976_dual.bin"
-+#define MT7915_BIN_FILE "mediatek/mt7915_binfile.bin"
-+#define MT7915_BIN_FILE_DBDC "mediatek/mt7915_binfile_dbdc.bin"
-+#define MT7916_BIN_FILE "mediatek/mt7916_binfile.bin"
++#define MT7915_BIN_FILE "mediatek/mt7915_binfile.bin"
++#define MT7915_BIN_FILE_DBDC "mediatek/mt7915_binfile_dbdc.bin"
++#define MT7916_BIN_FILE "mediatek/mt7916_binfile.bin"
+#define MT7986_BIN_FILE_MT7975 "mediatek/mt7986_binfile_mt7975.bin"
+#define MT7986_BIN_FILE_MT7975_DUAL "mediatek/mt7986_binfile_mt7975_dual.bin"
+#define MT7986_BIN_FILE_MT7976 "mediatek/mt7986_binfile_mt7976.bin"
@@ -167,14 +245,76 @@
#define MT7915_EEPROM_SIZE 3584
#define MT7916_EEPROM_SIZE 4096
-@@ -395,6 +404,7 @@ struct mt7915_dev {
+@@ -395,6 +404,8 @@ struct mt7915_dev {
bool dbdc_support;
bool flash_mode;
+ bool bin_file_mode;
++ u8 eeprom_mode;
bool muru_debug;
bool ibf;
+diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
+index 9de5b0f..36cb6f0 100644
+--- a/mt7915/mtk_debugfs.c
++++ b/mt7915/mtk_debugfs.c
+@@ -3,6 +3,7 @@
+ #include "mt7915_debug.h"
+ #include "mac.h"
+ #include "mcu.h"
++#include "eeprom.h"
+
+ #ifdef MTK_DEBUG
+ #define LWTBL_IDX2BASE_ID GENMASK(14, 8)
+@@ -2893,6 +2894,39 @@ mt7915_wa_debug(void *data, u64 val)
+ DEFINE_DEBUGFS_ATTRIBUTE(fops_wa_debug, NULL, mt7915_wa_debug,
+ "0x%llx\n");
+
++static int mt7915_show_eeprom_mode(struct seq_file *s, void *data)
++{
++ struct mt7915_dev *dev = dev_get_drvdata(s->private);
++ struct mt76_dev *mdev = &dev->mt76;
++ char *mtd_name = mdev->test_mtd.name;
++ u32 mtd_offset = mdev->test_mtd.offset;
++
++ seq_printf(s, "Current eeprom mode:\n");
++
++ switch (dev->eeprom_mode) {
++ case DEFAULT_BIN_MODE:
++ seq_printf(s, " default bin mode\n filename = %s\n", mt7915_eeprom_name(dev));
++ break;
++ case EFUSE_MODE:
++ seq_printf(s, " efuse mode\n");
++ break;
++ case FLASH_MODE:
++ if (mtd_name)
++ seq_printf(s, " flash mode\n mtd name = %s\n flash offset = 0x%x\n",
++ mtd_name, mtd_offset);
++ else
++ seq_printf(s, " flash mode\n");
++ break;
++ case BIN_FILE_MODE:
++ seq_printf(s, " bin file mode\n filename = %s\n", mt7915_eeprom_name(dev));
++ break;
++ default:
++ break;
++ }
++
++ return 0;
++}
++
+ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
+ {
+ struct mt7915_dev *dev = phy->dev;
+@@ -2973,6 +3007,8 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
+ debugfs_create_devm_seqfile(dev->mt76.dev, "fw_version", dir,
+ mt7915_dump_version);
+
++ debugfs_create_devm_seqfile(dev->mt76.dev, "eeprom_mode", dir,
++ mt7915_show_eeprom_mode);
+ return 0;
+ }
+ #endif
--
2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/1122-mt76-mt7915-initialize-wcid.patch b/recipes-wifi/linux-mt76/files/patches/1122-mt76-mt7915-initialize-wcid.patch
index a71c142..f0e0d3c 100644
--- a/recipes-wifi/linux-mt76/files/patches/1122-mt76-mt7915-initialize-wcid.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1122-mt76-mt7915-initialize-wcid.patch
@@ -1,4 +1,4 @@
-From 60c9370658471d7e5813edd312fa4ad1cb15e613 Mon Sep 17 00:00:00 2001
+From 202e4428abd4d55ee3bb1b3e692a257269ec68c3 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Tue, 12 Jul 2022 13:56:07 +0800
Subject: [PATCH 1122/1128] mt76 mt7915 initialize wcid
@@ -9,7 +9,7 @@
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 9af86163..acc9871b 100644
+index 9af8616..acc9871 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -999,7 +999,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
diff --git a/recipes-wifi/linux-mt76/files/patches/1123-mt76-HEMU-Add-dump-support.patch b/recipes-wifi/linux-mt76/files/patches/1123-mt76-HEMU-Add-dump-support.patch
index 1be72f3..dd3830e 100644
--- a/recipes-wifi/linux-mt76/files/patches/1123-mt76-HEMU-Add-dump-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1123-mt76-HEMU-Add-dump-support.patch
@@ -1,4 +1,4 @@
-From f57bad3523d617ebb4b1357e9e1bf28c23421fde Mon Sep 17 00:00:00 2001
+From 32c6671d000c26212b3c6894467392a7b2061f92 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Thu, 11 Aug 2022 18:09:45 -0700
Subject: [PATCH 1123/1128] mt76: HEMU: Add dump support
@@ -10,7 +10,7 @@
2 files changed, 27 insertions(+)
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 5a28a554..7acb3304 100644
+index 5a28a55..7acb330 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -37,6 +37,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
@@ -61,7 +61,7 @@
.maxattr = MTK_VENDOR_ATTR_HEMU_CTRL_MAX,
},
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 83c41bc1..57f52f3a 100644
+index 83c41bc..57f52f3 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -58,6 +58,7 @@ enum mtk_vendor_attr_hemu_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch b/recipes-wifi/linux-mt76/files/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch
index a7811a0..7d42880 100644
--- a/recipes-wifi/linux-mt76/files/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1124-mt76-mt7915-add-vendor-subcmd-three-wire-PTA-ctrl.patch
@@ -1,8 +1,7 @@
-From 6d6786706421d191e6320d4476024dcf4a2a6e27 Mon Sep 17 00:00:00 2001
+From 5f2097d8515e59239f365b2a9f73e7f6e580149d Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 28 Oct 2022 10:15:56 +0800
-Subject: [PATCH 1124/1128] mt76: mt7915: add vendor subcmd three wire (PTA)
- ctrl
+Subject: [PATCH] mt76: mt7915: add vendor subcmd three wire (PTA) ctrl
Change-Id: Ic1044698f294455594a0c6254f55326fdab90580
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -11,9 +10,9 @@
mt7915/mcu.c | 50 ++++++++++++++++++++++-------------------------
mt7915/mcu.h | 29 +++++++++++++++++++++++++++
mt7915/mt7915.h | 1 +
- mt7915/vendor.c | 42 ++++++++++++++++++++++++++++++++++++++-
- mt7915/vendor.h | 12 ++++++++++++
- 6 files changed, 107 insertions(+), 29 deletions(-)
+ mt7915/vendor.c | 44 ++++++++++++++++++++++++++++++++++++++++-
+ mt7915/vendor.h | 14 +++++++++++++
+ 6 files changed, 111 insertions(+), 29 deletions(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
index bceb6799..86a8688e 100644
@@ -29,7 +28,7 @@
MCU_EXT_CMD_CSI_CTRL = 0xc2,
MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 8fc40c5a..39c8e2c2 100644
+index a6c84c2f..3caa5996 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3964,37 +3964,33 @@ void mt7915_mcu_set_dynalgo(struct mt7915_phy *phy, u8 enable)
@@ -94,7 +93,7 @@
void mt7915_mcu_set_bypass_smthint(struct mt7915_phy *phy, u8 val)
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 2ca2c005..b2e4032f 100644
+index b608cb6a..2172d491 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -625,6 +625,35 @@ struct mt7915_mcu_rdd_ipi_scan {
@@ -134,7 +133,7 @@
#define OFDMA_DL BIT(0)
#define OFDMA_UL BIT(1)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 15db02c4..7c7c4882 100644
+index d979950f..28a2f684 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -749,6 +749,7 @@ void mt7915_mcu_set_mimo(struct mt7915_phy *phy, u8 direction);
@@ -146,7 +145,7 @@
void mt7915_vendor_register(struct mt7915_phy *phy);
int mt7915_mcu_set_csi(struct mt7915_phy *phy, u8 mode,
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7acb3304..7f67c0d3 100644
+index b95a1582..84e088c9 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -40,6 +40,11 @@ hemu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_HEMU_CTRL] = {
@@ -161,7 +160,7 @@
static const struct nla_policy
rfeature_ctrl_policy[NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL] = {
[MTK_VENDOR_ATTR_RFEATURE_CTRL_HE_GI] = {.type = NLA_U8 },
-@@ -964,7 +969,7 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
+@@ -971,7 +976,7 @@ static int mt7915_vendor_wireless_ctrl(struct wiphy *wiphy,
mt7915_set_wireless_vif, &val32);
} else if (tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]) {
val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT]);
@@ -170,10 +169,18 @@
mt7915_mcu_set_bypass_smthint(phy, val8); /* Cert bypass smooth interpolation */
}
-@@ -1091,6 +1096,30 @@ static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy,
+@@ -1117,6 +1122,7 @@ static int mt7915_vendor_edcca_ctrl(struct wiphy *wiphy,
return 0;
}
++
+ static int
+ mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+ struct sk_buff *skb, const void *data, int data_len,
+@@ -1164,6 +1170,31 @@ mt7915_vendor_edcca_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
+ return len;
+ }
+
+static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data,
@@ -198,11 +205,12 @@
+ return mt7915_mcu_set_cfg(phy, CFGINFO_3WIRE_EN_CFG, three_wire_mode);
+}
+
-
++
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
-@@ -1172,6 +1201,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
- .doit = mt7915_vendor_edcca_ctrl,
+ .info = {
+@@ -1245,6 +1276,17 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+ .dumpit = mt7915_vendor_edcca_ctrl_dump,
.policy = edcca_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_EDCCA_CTRL_MAX,
+ },
@@ -220,10 +228,10 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 57f52f3a..e0c5fd94 100644
+index c19ffe72..d96e5c23 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
-@@ -11,6 +11,7 @@ enum mtk_nl80211_vendor_subcmds {
+@@ -12,6 +12,7 @@ enum mtk_nl80211_vendor_subcmds {
MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5,
MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
@@ -231,10 +239,18 @@
};
-@@ -30,6 +31,17 @@ enum mtk_vendor_attr_edcca_ctrl {
+@@ -31,6 +32,7 @@ enum mtk_vendor_attr_edcca_ctrl {
NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1
};
++
+ enum mtk_vendor_attr_edcca_dump {
+ MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0,
+
+@@ -45,6 +47,18 @@ enum mtk_vendor_attr_edcca_dump {
+ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1
+ };
+
+enum mtk_vendor_attr_3wire_ctrl {
+ MTK_VENDOR_ATTR_3WIRE_CTRL_UNSPEC,
+
@@ -246,9 +262,10 @@
+ NUM_MTK_VENDOR_ATTRS_3WIRE_CTRL - 1
+};
+
-
++
enum mtk_capi_control_changed {
CAPI_RFEATURE_CHANGED = BIT(16),
+ CAPI_WIRELESS_CHANGED = BIT(17),
--
2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/1125-mt76-add-ibf-control-vendor-cmd.patch b/recipes-wifi/linux-mt76/files/patches/1125-mt76-add-ibf-control-vendor-cmd.patch
index 0045198..b5be350 100644
--- a/recipes-wifi/linux-mt76/files/patches/1125-mt76-add-ibf-control-vendor-cmd.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1125-mt76-add-ibf-control-vendor-cmd.patch
@@ -1,20 +1,20 @@
-From d8381a4d6847fcfeb96bbfd0fbb6bcbfd9a4bd61 Mon Sep 17 00:00:00 2001
+From 6de06b0f652673f2db19060161dcc94d47ff4ce3 Mon Sep 17 00:00:00 2001
From: mtk27835 <shurong.wen@mediatek.com>
Date: Wed, 7 Sep 2022 14:01:29 -0700
-Subject: [PATCH 1125/1128] mt76: add ibf control vendor cmd
+Subject: [PATCH] mt76: add ibf control vendor cmd
Signed-off-by: mtk27835 <shurong.wen@mediatek.com>
---
- mt7915/vendor.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
- mt7915/vendor.h | 25 +++++++++++++++++-
- 2 files changed, 94 insertions(+), 1 deletion(-)
+ mt7915/vendor.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
+ mt7915/vendor.h | 25 ++++++++++++++++-
+ 2 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index 7f67c0d3..cbbb0843 100644
+index 84e088c9..648d2dfb 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
-@@ -78,6 +78,16 @@ edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = {
- [MTK_VENDOR_ATTR_EDCCA_CTRL_COMPENSATE] = { .type = NLA_S8 },
+@@ -86,6 +86,17 @@ edcca_dump_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP] = {
+ [MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL] = { .type = NLA_U8 },
};
+static const struct nla_policy
@@ -27,10 +27,11 @@
+ [MTK_VENDOR_ATTR_IBF_DUMP_ENABLE] = { .type = NLA_U8 },
+};
+
-
++
struct csi_null_tone {
u8 start;
-@@ -1120,6 +1130,54 @@ static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
+ u8 end;
+@@ -1194,6 +1205,54 @@ static int mt7915_vendor_3wire_ctrl(struct wiphy *wiphy,
return mt7915_mcu_set_cfg(phy, CFGINFO_3WIRE_EN_CFG, three_wire_mode);
}
@@ -85,7 +86,7 @@
static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
{
-@@ -1212,6 +1270,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
+@@ -1287,6 +1346,18 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
.doit = mt7915_vendor_3wire_ctrl,
.policy = three_wire_ctrl_policy,
.maxattr = MTK_VENDOR_ATTR_3WIRE_CTRL_MAX,
@@ -105,10 +106,10 @@
};
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index e0c5fd94..5aac5595 100644
+index d96e5c23..949c8853 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
-@@ -11,7 +11,8 @@ enum mtk_nl80211_vendor_subcmds {
+@@ -12,7 +12,8 @@ enum mtk_nl80211_vendor_subcmds {
MTK_NL80211_VENDOR_SUBCMD_HEMU_CTRL = 0xc5,
MTK_NL80211_VENDOR_SUBCMD_PHY_CAPA_CTRL = 0xc6,
MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
@@ -118,7 +119,7 @@
};
-@@ -206,4 +207,26 @@ enum mtk_vendor_attr_phy_capa_dump {
+@@ -222,4 +223,26 @@ enum mtk_vendor_attr_phy_capa_dump {
NUM_MTK_VENDOR_ATTRS_PHY_CAPA_DUMP - 1
};
diff --git a/recipes-wifi/linux-mt76/files/patches/1126-mt76-mt7915-add-AMPDU-AMSDU-OnOff-ctonrol.patch b/recipes-wifi/linux-mt76/files/patches/1126-mt76-mt7915-add-AMPDU-AMSDU-OnOff-ctonrol.patch
index e9f90e1..bbeca19 100644
--- a/recipes-wifi/linux-mt76/files/patches/1126-mt76-mt7915-add-AMPDU-AMSDU-OnOff-ctonrol.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1126-mt76-mt7915-add-AMPDU-AMSDU-OnOff-ctonrol.patch
@@ -1,4 +1,4 @@
-From e5184f1fcbbeba3543d267190e886b1fb68cc757 Mon Sep 17 00:00:00 2001
+From 6545cf953298db275cb7373c797be2b6ae2e0d81 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Wed, 21 Sep 2022 13:55:15 -0700
Subject: [PATCH 1126/1128] mt76: mt7915: add AMPDU/AMSDU OnOff ctonrol
@@ -12,7 +12,7 @@
4 files changed, 83 insertions(+)
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index acc9871b..5a809c2c 100644
+index acc9871..5a809c2 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -2020,6 +2020,34 @@ static void mt7915_mac_severe_check(struct mt7915_phy *phy)
@@ -51,10 +51,10 @@
void mt7915_capi_sta_rc_work(void *data, struct ieee80211_sta *sta)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 7c7c4882..c43661f5 100644
+index 98c35d2..4cdcb63 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -737,6 +737,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -738,6 +738,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
bool pci, int *irq);
#ifdef CONFIG_MTK_VENDOR
@@ -64,7 +64,7 @@
void mt7915_set_wireless_vif(void *data, u8 *mac, struct ieee80211_vif *vif);
void mt7915_mcu_set_rfeature_starec(void *data, struct mt7915_dev *dev,
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
-index cbbb0843..d73fdd4c 100644
+index cbbb084..d73fdd4 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -30,10 +30,18 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
@@ -137,7 +137,7 @@
.maxattr = MTK_VENDOR_ATTR_WIRELESS_CTRL_MAX,
},
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
-index 5aac5595..53abb100 100644
+index 5aac559..53abb10 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -58,6 +58,8 @@ enum mtk_vendor_attr_wireless_ctrl {
diff --git a/recipes-wifi/linux-mt76/files/patches/1127-mt76-mt7915-add-E3-re-bonding-for-low-yield-rate-iss.patch b/recipes-wifi/linux-mt76/files/patches/1127-mt76-mt7915-add-E3-re-bonding-for-low-yield-rate-iss.patch
index 5dd02c4..9780db3 100644
--- a/recipes-wifi/linux-mt76/files/patches/1127-mt76-mt7915-add-E3-re-bonding-for-low-yield-rate-iss.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1127-mt76-mt7915-add-E3-re-bonding-for-low-yield-rate-iss.patch
@@ -1,4 +1,4 @@
-From d3bae8d8ba808b52ee9090e7e2a09e3750ab8465 Mon Sep 17 00:00:00 2001
+From ba976379e903eb0a26276037718d5679ae95051a Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Thu, 13 Oct 2022 13:22:05 +0800
Subject: [PATCH 1127/1128] mt76: mt7915: add E3 re-bonding for low yield rate
@@ -12,19 +12,19 @@
3 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index 0ae8d1b4..0c3e43b0 100644
+index 4d2d9ca..b3d2bbc 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
-@@ -133,7 +133,7 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
+@@ -97,7 +97,7 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
MT7915_EEPROM_BLOCK_SIZE);
for (i = 0; i < block_num; i++)
mt7915_mcu_get_eeprom(dev,
- i * MT7915_EEPROM_BLOCK_SIZE);
+ i * MT7915_EEPROM_BLOCK_SIZE, NULL);
+ dev->eeprom_mode = EFUSE_MODE;
}
- return mt7915_check_eeprom(dev);
-@@ -233,6 +233,29 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
+@@ -198,6 +198,29 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
dev->chainshift = hweight8(dev->mphy.chainmask);
}
@@ -54,7 +54,7 @@
int mt7915_eeprom_init(struct mt7915_dev *dev)
{
int ret;
-@@ -266,6 +289,8 @@ int mt7915_eeprom_init(struct mt7915_dev *dev)
+@@ -229,6 +252,8 @@ int mt7915_eeprom_init(struct mt7915_dev *dev)
return ret;
}
@@ -64,7 +64,7 @@
if (ret)
return ret;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 39c8e2c2..fad35595 100644
+index 39c8e2c..fad3559 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2779,7 +2779,7 @@ int mt7915_mcu_set_eeprom(struct mt7915_dev *dev, bool flash_mode)
@@ -95,10 +95,10 @@
return 0;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index c43661f5..527ec9ea 100644
+index 4cdcb63..dbd634a 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -559,6 +559,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
+@@ -560,6 +560,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
@@ -106,7 +106,7 @@
int mt7915_eeprom_init(struct mt7915_dev *dev);
void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
struct mt7915_phy *phy);
-@@ -612,7 +613,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
+@@ -613,7 +614,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
struct ieee80211_sta *sta,
void *data, u32 field);
int mt7915_mcu_set_eeprom(struct mt7915_dev *dev, bool flash_mode);
diff --git a/recipes-wifi/linux-mt76/files/patches/1128-mt76-support-on-off-SW-ACI-through-debugfs.patch b/recipes-wifi/linux-mt76/files/patches/1128-mt76-support-on-off-SW-ACI-through-debugfs.patch
index 208e243..94cf85c 100644
--- a/recipes-wifi/linux-mt76/files/patches/1128-mt76-support-on-off-SW-ACI-through-debugfs.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1128-mt76-support-on-off-SW-ACI-through-debugfs.patch
@@ -1,4 +1,4 @@
-From adc0119417e143af9b9775a9fa4590101070fb5b Mon Sep 17 00:00:00 2001
+From 03db7df14e4b8fcf9cf69725ee3baf74656293dc Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 14 Oct 2022 11:15:13 +0800
Subject: [PATCH 1128/1128] mt76: support on off SW ACI through debugfs
@@ -11,7 +11,7 @@
2 files changed, 22 insertions(+)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 86a8688e..a368b65b 100644
+index 86a8688..a368b65 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1164,6 +1164,7 @@ enum {
@@ -23,12 +23,12 @@
MCU_EXT_CMD_IPI_HIST_SCAN = 0xc5,
};
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 9de5b0f6..c5e04728 100644
+index 36cb6f0..facdd69 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
-@@ -2893,6 +2893,25 @@ mt7915_wa_debug(void *data, u64 val)
- DEFINE_DEBUGFS_ATTRIBUTE(fops_wa_debug, NULL, mt7915_wa_debug,
- "0x%llx\n");
+@@ -2927,6 +2927,25 @@ static int mt7915_show_eeprom_mode(struct seq_file *s, void *data)
+ return 0;
+ }
+static int
+mt7915_sw_aci_set(void *data, u64 val)
@@ -52,10 +52,10 @@
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
{
struct mt7915_dev *dev = phy->dev;
-@@ -2973,6 +2992,8 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
- debugfs_create_devm_seqfile(dev->mt76.dev, "fw_version", dir,
- mt7915_dump_version);
+@@ -3009,6 +3028,8 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
+ debugfs_create_devm_seqfile(dev->mt76.dev, "eeprom_mode", dir,
+ mt7915_show_eeprom_mode);
+ debugfs_create_file("sw_aci", 0600, dir, dev,
+ &fops_sw_aci);
return 0;
diff --git a/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch b/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
index d12e62f..5f853a4 100644
--- a/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
@@ -1,4 +1,4 @@
-From 3eac6f7492dee323a01408cacaa85e7bc55ea1d0 Mon Sep 17 00:00:00 2001
+From 457a54d92f80cb1a24cbde87e7bf2b49a65d4321 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Sun, 12 Jun 2022 16:38:45 +0800
Subject: [PATCH 3001/3011] mt76 add wed tx support
@@ -12,7 +12,7 @@
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/mt76_connac.h b/mt76_connac.h
-index 0915eb57..9a468878 100644
+index 0915eb5..9a46887 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -116,6 +116,7 @@ struct mt76_connac_sta_key_conf {
@@ -24,7 +24,7 @@
struct mt76_connac_fw_txp {
__le16 flags;
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 5a809c2c..20e5b705 100644
+index 5a809c2..20e5b70 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -858,9 +858,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
@@ -65,7 +65,7 @@
static void
diff --git a/mt7915/main.c b/mt7915/main.c
-index 2b4e122b..f9b2c1ef 100644
+index 2b4e122..f9b2c1e 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1466,14 +1466,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
@@ -86,7 +86,7 @@
ctx->dev = NULL;
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 63b66e40..f76f8967 100644
+index 63b66e4..f76f896 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -10,7 +10,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch b/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch
index 8132783..2443604 100644
--- a/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3002-mt76-mt7915-add-wed-tx-wds-support-on-mt7986.patch
@@ -1,4 +1,4 @@
-From 2f1191e48c32e21c71c78f25961bc54baf579656 Mon Sep 17 00:00:00 2001
+From ad8a906f3ee37375a9f2ad9b57d0eeaff90c8f14 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Sat, 10 Sep 2022 17:09:21 +0800
Subject: [PATCH 3002/3011] mt76: mt7915: add-wed-tx-wds-support-on-mt7986
@@ -16,7 +16,7 @@
8 files changed, 76 insertions(+), 5 deletions(-)
diff --git a/mac80211.c b/mac80211.c
-index b378231c..c84c9ef0 100644
+index b378231..c84c9ef 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -1363,7 +1363,10 @@ void __mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif,
@@ -32,7 +32,7 @@
}
EXPORT_SYMBOL_GPL(__mt76_sta_remove);
diff --git a/mt76.h b/mt76.h
-index e29f490e..b86c8355 100644
+index e29f490..b86c835 100644
--- a/mt76.h
+++ b/mt76.h
@@ -454,6 +454,7 @@ struct mt76_driver_ops {
@@ -52,7 +52,7 @@
u64 vif_mask;
diff --git a/mt7915/init.c b/mt7915/init.c
-index 69465dd0..039a5b01 100644
+index 69465dd..039a5b0 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -719,6 +719,15 @@ mt7915_init_hardware(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -72,7 +72,7 @@
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
if (idx)
diff --git a/mt7915/main.c b/mt7915/main.c
-index f9b2c1ef..c0617860 100644
+index f9b2c1e..c061786 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -660,6 +660,24 @@ mt7915_channel_switch_beacon(struct ieee80211_hw *hw,
@@ -150,7 +150,7 @@
ctx->dev = NULL;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index fad35595..eb9343ca 100644
+index fad3559..eb9343c 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2279,6 +2279,7 @@ mt7915_mcu_init_rx_airtime(struct mt7915_dev *dev)
@@ -180,7 +180,7 @@
ret = mt7915_mcu_set_mwds(dev, 1);
if (ret)
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b2e4032f..42d5e39f 100644
+index b2e4032..42d5e39 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -270,6 +270,7 @@ enum {
@@ -192,7 +192,7 @@
enum mcu_mmps_mode {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index f76f8967..e45cd2d5 100644
+index f76f896..e45cd2d 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -646,6 +646,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -213,7 +213,7 @@
struct mt7915_dev *dev;
struct mt76_dev *mdev;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 527ec9ea..ba12a2d2 100644
+index dbd634a..06b98b7 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -18,6 +18,9 @@
@@ -226,7 +226,7 @@
#define MT7915_WATCHDOG_TIME (HZ / 10)
#define MT7915_RESET_TIMEOUT (30 * HZ)
-@@ -718,6 +721,7 @@ void mt7915_tx_token_put(struct mt7915_dev *dev);
+@@ -719,6 +722,7 @@ void mt7915_tx_token_put(struct mt7915_dev *dev);
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
struct sk_buff *skb);
bool mt7915_rx_check(struct mt76_dev *mdev, void *data, int len);
diff --git a/recipes-wifi/linux-mt76/files/patches/3003-mt76-add-wed-rx-support.patch b/recipes-wifi/linux-mt76/files/patches/3003-mt76-add-wed-rx-support.patch
index 3e775fd..0cb1c16 100644
--- a/recipes-wifi/linux-mt76/files/patches/3003-mt76-add-wed-rx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3003-mt76-add-wed-rx-support.patch
@@ -1,4 +1,4 @@
-From 30ccfabd2dccb876067ca6ca666a862a9c693bdc Mon Sep 17 00:00:00 2001
+From bc9cac100bb95aa89b6ded079f1065fbb739c90c Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Tue, 5 Jul 2022 19:42:55 +0800
Subject: [PATCH 3003/3011] mt76 add wed rx support
@@ -28,7 +28,7 @@
20 files changed, 448 insertions(+), 67 deletions(-)
diff --git a/dma.c b/dma.c
-index 82b4da26..a8739eb4 100644
+index 82b4da2..a8739eb 100644
--- a/dma.c
+++ b/dma.c
@@ -98,6 +98,63 @@ mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t)
@@ -479,7 +479,7 @@
}
EXPORT_SYMBOL_GPL(mt76_dma_cleanup);
diff --git a/dma.h b/dma.h
-index fdf786f9..90370d12 100644
+index fdf786f..90370d1 100644
--- a/dma.h
+++ b/dma.h
@@ -16,6 +16,16 @@
@@ -500,7 +500,7 @@
#define MT_RX_INFO_LEN 4
#define MT_FCE_INFO_LEN 4
diff --git a/mac80211.c b/mac80211.c
-index c84c9ef0..32961b60 100644
+index c84c9ef..32961b6 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -603,11 +603,14 @@ mt76_alloc_device(struct device *pdev, unsigned int size,
@@ -531,7 +531,7 @@
mt76_rx_complete(dev, &frames, napi);
diff --git a/mt76.h b/mt76.h
-index b86c8355..627bcbf9 100644
+index b86c835..627bcbf 100644
--- a/mt76.h
+++ b/mt76.h
@@ -20,6 +20,8 @@
@@ -629,7 +629,7 @@
static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
{
diff --git a/mt7603/dma.c b/mt7603/dma.c
-index 590cff9d..2ff71c53 100644
+index 590cff9..2ff71c5 100644
--- a/mt7603/dma.c
+++ b/mt7603/dma.c
@@ -69,7 +69,7 @@ free:
@@ -642,7 +642,7 @@
struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7603/mt7603.h b/mt7603/mt7603.h
-index 0fd46d90..f2ce22ae 100644
+index 0fd46d9..f2ce22a 100644
--- a/mt7603/mt7603.h
+++ b/mt7603/mt7603.h
@@ -244,7 +244,7 @@ int mt7603_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -655,7 +655,7 @@
void mt7603_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
int mt7603_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
diff --git a/mt7615/mac.c b/mt7615/mac.c
-index 305bf182..4aed123b 100644
+index 305bf18..4aed123 100644
--- a/mt7615/mac.c
+++ b/mt7615/mac.c
@@ -1666,7 +1666,7 @@ bool mt7615_rx_check(struct mt76_dev *mdev, void *data, int len)
@@ -668,7 +668,7 @@
struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7615/mt7615.h b/mt7615/mt7615.h
-index 1080d202..91b30373 100644
+index 1080d20..91b3037 100644
--- a/mt7615/mt7615.h
+++ b/mt7615/mt7615.h
@@ -514,7 +514,7 @@ void mt7615_tx_worker(struct mt76_worker *w);
@@ -681,7 +681,7 @@
int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta);
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index afdd42ff..1b01ef26 100644
+index afdd42f..1b01ef2 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -1192,6 +1192,7 @@ int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
@@ -729,7 +729,7 @@
}
EXPORT_SYMBOL_GPL(mt76_connac_mcu_add_key);
diff --git a/mt76x02.h b/mt76x02.h
-index 849c2644..49112ab6 100644
+index 849c264..49112ab 100644
--- a/mt76x02.h
+++ b/mt76x02.h
@@ -187,7 +187,7 @@ int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val);
@@ -742,7 +742,7 @@
irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance);
void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
diff --git a/mt76x02_txrx.c b/mt76x02_txrx.c
-index 3a313075..5d6c8f71 100644
+index 3a31307..5d6c8f7 100644
--- a/mt76x02_txrx.c
+++ b/mt76x02_txrx.c
@@ -33,7 +33,7 @@ void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
@@ -755,7 +755,7 @@
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
void *rxwi = skb->data;
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 9a57ad8f..6f6550f5 100644
+index 9a57ad8..6f6550f 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -365,7 +365,8 @@ static int mt7915_dma_enable(struct mt7915_dev *dev)
@@ -811,7 +811,7 @@
ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_BAND1],
MT_RXQ_ID(MT_RXQ_BAND1),
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 20e5b705..eac49465 100644
+index 20e5b70..eac4946 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -247,7 +247,7 @@ void mt7915_mac_enable_rtscts(struct mt7915_dev *dev,
@@ -951,7 +951,7 @@
return;
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index eb9343ca..c11e575a 100644
+index eb9343c..c11e575 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1653,6 +1653,7 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif,
@@ -972,7 +972,7 @@
MCU_EXT_CMD(STA_REC_UPDATE), true);
}
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index e45cd2d5..1e22ec98 100644
+index e45cd2d..1e22ec9 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -44,6 +44,7 @@ static const u32 mt7915_reg[] = {
@@ -1064,7 +1064,7 @@
return 0;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index ba12a2d2..acc345a2 100644
+index 06b98b7..6952825 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -81,6 +81,7 @@
@@ -1075,7 +1075,7 @@
struct mt7915_vif;
struct mt7915_sta;
-@@ -559,7 +560,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
+@@ -560,7 +561,9 @@ void mt7915_wfsys_reset(struct mt7915_dev *dev);
irqreturn_t mt7915_irq_handler(int irq, void *dev_instance);
u64 __mt7915_get_tsf(struct ieee80211_hw *hw, struct mt7915_vif *mvif);
u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
@@ -1086,7 +1086,7 @@
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
void mt7915_eeprom_rebonding(struct mt7915_dev *dev);
-@@ -719,7 +722,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+@@ -720,7 +723,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
struct mt76_tx_info *tx_info);
void mt7915_tx_token_put(struct mt7915_dev *dev);
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
@@ -1096,7 +1096,7 @@
bool mt7915_wed_wds_check(struct mt76_dev *mdev, struct ieee80211_sta *sta);
void mt7915_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 9b6266c1..faaac08c 100644
+index 9b6266c..faaac08 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -43,6 +43,7 @@ enum reg_rev {
@@ -1130,7 +1130,7 @@
#define MT_INT_SOURCE_CSR __REG(INT_SOURCE_CSR)
#define MT_INT_MASK_CSR __REG(INT_MASK_CSR)
diff --git a/mt7921/mac.c b/mt7921/mac.c
-index 7b15193c..ea6dd953 100644
+index 7b15193..ea6dd95 100644
--- a/mt7921/mac.c
+++ b/mt7921/mac.c
@@ -692,7 +692,7 @@ bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len)
@@ -1143,7 +1143,7 @@
struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
__le32 *rxd = (__le32 *)skb->data;
diff --git a/mt7921/mt7921.h b/mt7921/mt7921.h
-index d9d78f6b..0c9924a5 100644
+index d9d78f6..0c9924a 100644
--- a/mt7921/mt7921.h
+++ b/mt7921/mt7921.h
@@ -422,7 +422,7 @@ void mt7921_tx_worker(struct mt76_worker *w);
@@ -1156,7 +1156,7 @@
void mt7921_stats_work(struct work_struct *work);
void mt7921_set_stream_he_caps(struct mt7921_phy *phy);
diff --git a/tx.c b/tx.c
-index 8b33186b..b812d067 100644
+index 8b33186..b812d06 100644
--- a/tx.c
+++ b/tx.c
@@ -778,3 +778,37 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake)
diff --git a/recipes-wifi/linux-mt76/files/patches/3004-mt76-add-fill-receive-path-to-report-wed-idx.patch b/recipes-wifi/linux-mt76/files/patches/3004-mt76-add-fill-receive-path-to-report-wed-idx.patch
index 30791ea..8b29384 100644
--- a/recipes-wifi/linux-mt76/files/patches/3004-mt76-add-fill-receive-path-to-report-wed-idx.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3004-mt76-add-fill-receive-path-to-report-wed-idx.patch
@@ -1,4 +1,4 @@
-From d9b8f90612abf82f99013762ec38113a4463de6d Mon Sep 17 00:00:00 2001
+From 5adc8023e3287208bb2ea04a20d0724b6264842d Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Thu, 19 May 2022 13:44:42 +0800
Subject: [PATCH 3004/3011] mt76: add fill receive path to report wed idx
@@ -9,7 +9,7 @@
1 file changed, 19 insertions(+)
diff --git a/mt7915/main.c b/mt7915/main.c
-index c0617860..84b90010 100644
+index c061786..84b9001 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1521,6 +1521,24 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
diff --git a/recipes-wifi/linux-mt76/files/patches/3005-mt76-add-ser-spport-when-wed-on.patch b/recipes-wifi/linux-mt76/files/patches/3005-mt76-add-ser-spport-when-wed-on.patch
index 3fc96e6..62ee299 100644
--- a/recipes-wifi/linux-mt76/files/patches/3005-mt76-add-ser-spport-when-wed-on.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3005-mt76-add-ser-spport-when-wed-on.patch
@@ -1,4 +1,4 @@
-From cfa2b02b3cbc63ccf936d0620c36ed5a5c841cb7 Mon Sep 17 00:00:00 2001
+From 5362658103f2059a16ad626ab2f075b9279877e5 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Thu, 28 Jul 2022 11:16:15 +0800
Subject: [PATCH 3005/3011] mt76 add ser spport when wed on
@@ -15,7 +15,7 @@
7 files changed, 76 insertions(+), 15 deletions(-)
diff --git a/dma.c b/dma.c
-index a8739eb4..d63b02f5 100644
+index a8739eb..d63b02f 100644
--- a/dma.c
+++ b/dma.c
@@ -169,7 +169,7 @@ mt76_free_pending_txwi(struct mt76_dev *dev)
@@ -109,7 +109,7 @@
if (!q->rx_head)
return;
diff --git a/dma.h b/dma.h
-index 90370d12..083cbca4 100644
+index 90370d1..083cbca 100644
--- a/dma.h
+++ b/dma.h
@@ -58,5 +58,5 @@ enum mt76_mcu_evt_type {
@@ -120,7 +120,7 @@
+int mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q, bool reset);
#endif
diff --git a/mt76.h b/mt76.h
-index 627bcbf9..f22e96e0 100644
+index 627bcbf..f22e96e 100644
--- a/mt76.h
+++ b/mt76.h
@@ -1375,6 +1375,7 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
@@ -132,7 +132,7 @@
struct napi_struct *napi);
void mt76_rx_poll_complete(struct mt76_dev *dev, enum mt76_rxq_id q,
diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 6f6550f5..8edfa465 100644
+index 6f6550f..8edfa46 100644
--- a/mt7915/dma.c
+++ b/mt7915/dma.c
@@ -553,6 +553,7 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -203,7 +203,7 @@
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index eac49465..cbdabea0 100644
+index eac4946..cbdabea 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -948,6 +948,8 @@ void mt7915_wed_release_rx_buf(struct mtk_wed_device *wed)
@@ -248,7 +248,7 @@
if (ext_phy)
ieee80211_stop_queues(ext_phy->hw);
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 1e22ec98..60b7886c 100644
+index 1e22ec9..60b7886 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -666,6 +666,8 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
@@ -261,10 +261,10 @@
if (mtk_wed_device_attach(wed))
return 0;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index acc345a2..55fe6343 100644
+index 6952825..36d1d86 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -563,6 +563,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
+@@ -564,6 +564,7 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id);
u32 mt7915_wed_init_rx_buf(struct mtk_wed_device *wed,
int pkt_num);
void mt7915_wed_release_rx_buf(struct mtk_wed_device *wed);
diff --git a/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch b/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch
index 3941f41..f80fc8c 100644
--- a/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch
@@ -1,4 +1,4 @@
-From 209aeac176b9760b9de5889cb67f674900864633 Mon Sep 17 00:00:00 2001
+From ca3fdfbb27f8d7c4c57164276e0220a7825fa61c Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <Yi-Chia.Hsieh@mediatek.com>
Date: Fri, 5 Aug 2022 13:58:11 -0700
Subject: [PATCH 3006/3011] mt76: mt7915: add statistic for H/W Rx Path
@@ -13,7 +13,7 @@
5 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/mt76.h b/mt76.h
-index f22e96e0..8011d4ca 100644
+index f22e96e..8011d4c 100644
--- a/mt76.h
+++ b/mt76.h
@@ -278,6 +278,10 @@ struct mt76_sta_stats {
@@ -28,7 +28,7 @@
enum mt76_wcid_flags {
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index cbdabea0..f1d15d85 100644
+index cbdabea..f1d15d8 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -972,6 +972,31 @@ void mt7915_wed_trigger_ser(struct mtk_wed_device *wed)
@@ -64,7 +64,7 @@
mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
{
diff --git a/mt7915/main.c b/mt7915/main.c
-index 84b90010..4ac5259d 100644
+index 84b9001..4ac5259 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1054,7 +1054,8 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
@@ -91,7 +91,7 @@
sinfo->ack_signal = (s8)msta->ack_signal;
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 60b7886c..f3144d15 100644
+index 60b7886..f3144d1 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -9,6 +9,7 @@
@@ -133,10 +133,10 @@
#else
return 0;
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 55fe6343..40161cf6 100644
+index 36d1d86..7165273 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -564,6 +564,8 @@ u32 mt7915_wed_init_rx_buf(struct mtk_wed_device *wed,
+@@ -565,6 +565,8 @@ u32 mt7915_wed_init_rx_buf(struct mtk_wed_device *wed,
int pkt_num);
void mt7915_wed_release_rx_buf(struct mtk_wed_device *wed);
void mt7915_wed_trigger_ser(struct mtk_wed_device *wed);
diff --git a/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch b/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch
index 9e0bb9f..16d9e8f 100644
--- a/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3007-mt76-mt7915-enable-red-per-band-token-drop-for-HW-Pa.patch
@@ -1,8 +1,7 @@
-From 3abad81e25879921c6b6a0403880f7a83f1e6503 Mon Sep 17 00:00:00 2001
+From 8a932d446bb0da8b7aa4cc7ea8ed541e002cf015 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Fri, 2 Sep 2022 14:40:40 +0800
-Subject: [PATCH 3007/3011] mt76: mt7915: enable red per-band token drop for HW
- Path
+Subject: [PATCH] mt76: mt7915: enable red per-band token drop for HW Path
Limit the number of token used by each band. If a band uses too many token,
it may hurt the throughput of the other band. The SW path can solve this
@@ -12,11 +11,11 @@
---
mt7915/mcu.c | 53 +++++++++++++++++++++++++++++++++++++++----------
mt7915/mcu.h | 1 +
- mt7915/mt7915.h | 2 +-
- 3 files changed, 45 insertions(+), 11 deletions(-)
+ mt7915/mt7915.h | 3 ++-
+ 3 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index c11e575a..ad2d6a39 100644
+index 16349c58..2ef353b2 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -2320,8 +2320,13 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev)
@@ -110,7 +109,7 @@
int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 42d5e39f..3e892358 100644
+index 4ae8d532..14a0972b 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -271,6 +271,7 @@ enum {
@@ -122,18 +121,18 @@
enum mcu_mmps_mode {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 40161cf6..d93c394c 100644
+index 46670de4..d8765041 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -773,6 +773,7 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
+@@ -773,13 +773,14 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
#endif
- int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value,
- s8 compensation);
+ int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
+ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
+int mt7915_mcu_set_red(struct mt7915_dev *dev, bool enabled);
-
++
int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
-@@ -780,7 +781,6 @@ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool w
+
#ifdef MTK_DEBUG
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
int mt7915_dbg_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3, bool wait_resp);
diff --git a/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-update-mt7916-trinfo-when-hw-path-enable.patch b/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-update-mt7916-trinfo-when-hw-path-enable.patch
index b4f0889..52f3e79 100644
--- a/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-update-mt7916-trinfo-when-hw-path-enable.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3008-mt76-mt7915-update-mt7916-trinfo-when-hw-path-enable.patch
@@ -1,4 +1,4 @@
-From a80ea5a70e2353d61feadcdcd6d590b31a6d0eaf Mon Sep 17 00:00:00 2001
+From 2723beedc39c16ab67c7008779ebed4cf210e7ef Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 22 Sep 2022 09:54:53 +0800
Subject: [PATCH 3008/3011] mt76: mt7915: update mt7916 trinfo when hw path
@@ -10,7 +10,7 @@
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/mt7915/mt7915_debug.h b/mt7915/mt7915_debug.h
-index ecdc02ab..0a1ee808 100644
+index ecdc02a..0a1ee80 100644
--- a/mt7915/mt7915_debug.h
+++ b/mt7915/mt7915_debug.h
@@ -133,6 +133,8 @@ enum dbg_reg_rev {
@@ -57,10 +57,10 @@
#define MT_DBG_INT_SOURCE_CSR __DBG_REG(dev, DBG_INT_SOURCE_CSR)
#define MT_DBG_INT_MASK_CSR __DBG_REG(dev, DBG_INT_MASK_CSR)
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index c5e04728..41bd0ff1 100644
+index facdd69..f25f9c6 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
-@@ -855,12 +855,22 @@ mt7986_show_host_dma_info(struct seq_file *s, struct mt7915_dev *dev)
+@@ -856,12 +856,22 @@ mt7986_show_host_dma_info(struct seq_file *s, struct mt7915_dev *dev)
"Name", "Base", "Cnt", "CIDX", "DIDX", "QCnt");
dump_dma_tx_ring_info(s, dev, "T16:FWDL", MT_DBG_TX_RING_CTRL(0));
dump_dma_tx_ring_info(s, dev, "T17:Cmd(H2WM)", MT_DBG_TX_RING_CTRL(1));
diff --git a/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-find-rx-token-by-physical-address.patch b/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-find-rx-token-by-physical-address.patch
index 7c2bb77..872c4bc 100644
--- a/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-find-rx-token-by-physical-address.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3009-mt76-mt7915-find-rx-token-by-physical-address.patch
@@ -1,4 +1,4 @@
-From 70c17335911119c353fdf709d8ce1688509c02d0 Mon Sep 17 00:00:00 2001
+From 3a759e4352a6aebba5c39993c9042d37e25677e8 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Tue, 27 Sep 2022 16:34:26 +0800
Subject: [PATCH 3009/3011] mt76: mt7915: find rx token by physical address
@@ -12,7 +12,7 @@
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/dma.c b/dma.c
-index d63b02f5..a7a4538a 100644
+index d63b02f..a7a4538 100644
--- a/dma.c
+++ b/dma.c
@@ -380,11 +380,28 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
diff --git a/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-drop-scatter-and-gather-frame.patch b/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-drop-scatter-and-gather-frame.patch
index 1b985cf..ef6e990 100644
--- a/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-drop-scatter-and-gather-frame.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3010-mt76-mt7915-drop-scatter-and-gather-frame.patch
@@ -1,4 +1,4 @@
-From b584c123edfe2965d753d4fc7e77c1ec08f147ea Mon Sep 17 00:00:00 2001
+From 50d41085e1f54e1cb308bd615052aaf5e317c8c5 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 28 Sep 2022 18:52:54 +0800
Subject: [PATCH 3010/3011] mt76: mt7915: drop scatter and gather frame
@@ -14,7 +14,7 @@
3 files changed, 11 insertions(+)
diff --git a/dma.c b/dma.c
-index a7a4538a..c106ae42 100644
+index a7a4538..c106ae4 100644
--- a/dma.c
+++ b/dma.c
@@ -419,6 +419,15 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx,
@@ -34,7 +34,7 @@
buf_addr = e->dma_addr[0];
e->buf = NULL;
diff --git a/dma.h b/dma.h
-index 083cbca4..221fcc8e 100644
+index 083cbca..221fcc8 100644
--- a/dma.h
+++ b/dma.h
@@ -21,6 +21,7 @@
@@ -46,7 +46,7 @@
#define MT_DMA_PPE_CPU_REASON GENMASK(15, 11)
#define MT_DMA_PPE_ENTRY GENMASK(30, 16)
diff --git a/mt76.h b/mt76.h
-index 8011d4ca..9b225510 100644
+index 8011d4c..9b22551 100644
--- a/mt76.h
+++ b/mt76.h
@@ -32,6 +32,7 @@
diff --git a/recipes-wifi/linux-mt76/files/patches/3011-mt76-HW-ATF-support-for-mt7986.patch b/recipes-wifi/linux-mt76/files/patches/3011-mt76-HW-ATF-support-for-mt7986.patch
index d812562..86b01bb 100644
--- a/recipes-wifi/linux-mt76/files/patches/3011-mt76-HW-ATF-support-for-mt7986.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3011-mt76-HW-ATF-support-for-mt7986.patch
@@ -1,4 +1,4 @@
-From 966aa1887615c19ceb9d7675cd46c9c550847128 Mon Sep 17 00:00:00 2001
+From 49dd3f3791d2b28bc28225d09c6455722d96489d Mon Sep 17 00:00:00 2001
From: Lian Chen <lian.chen@mediatek.com>
Date: Mon, 7 Nov 2022 14:47:44 +0800
Subject: [PATCH 3011/3011] mt76: HW ATF support for mt7986
@@ -16,7 +16,7 @@
mode change 100644 => 100755 mt7915/init.c
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index a368b65b..2cb498f3 100644
+index a368b65..2cb498f 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1122,6 +1122,7 @@ enum {
@@ -36,7 +36,7 @@
MCU_EXT_CMD_EFUSE_FREE_BLOCK = 0x4f,
MCU_EXT_CMD_TX_POWER_FEATURE_CTRL = 0x58,
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 21407030..85468cd2 100644
+index 2140703..85468cd 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -12,6 +12,10 @@
@@ -468,7 +468,7 @@
diff --git a/mt7915/init.c b/mt7915/init.c
old mode 100644
new mode 100755
-index 039a5b01..5a7fdb51
+index 039a5b0..5a7fdb5
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -473,10 +473,46 @@ mt7915_mac_init_band(struct mt7915_dev *dev, u8 band)
@@ -529,7 +529,7 @@
int mt7915_txbf_init(struct mt7915_dev *dev)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 4ac5259d..6c910cf5 100644
+index 4ac5259..6c910cf 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -195,6 +195,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
@@ -577,7 +577,7 @@
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index ad2d6a39..4728d849 100644
+index ad2d6a3..4728d84 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -3323,6 +3323,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
@@ -753,7 +753,7 @@
{
struct {
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index d93c394c..e5e861b8 100644
+index 8567415..872b0e7 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -131,6 +131,58 @@ struct mt7915_twt_flow {
@@ -823,7 +823,7 @@
};
struct mt7915_vif_cap {
-@@ -466,6 +519,8 @@ struct mt7915_dev {
+@@ -467,6 +520,8 @@ struct mt7915_dev {
} dbg;
const struct mt7915_dbg_reg_desc *dbg_reg;
#endif
@@ -832,7 +832,7 @@
};
enum {
-@@ -498,6 +553,15 @@ enum mt7915_rdd_cmd {
+@@ -499,6 +554,15 @@ enum mt7915_rdd_cmd {
RDD_IRQ_OFF,
};
@@ -848,7 +848,7 @@
static inline struct mt7915_phy *
mt7915_hw_phy(struct ieee80211_hw *hw)
{
-@@ -629,6 +693,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
+@@ -630,6 +694,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
u8 en);
int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band);
@@ -860,10 +860,10 @@
int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy);
int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 41bd0ff1..12251d91 100644
+index f25f9c6..c638d29 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
-@@ -1300,7 +1300,6 @@ static EMPTY_QUEUE_INFO_T ple_txcmd_queue_empty_info[] = {
+@@ -1301,7 +1301,6 @@ static EMPTY_QUEUE_INFO_T ple_txcmd_queue_empty_info[] = {
};
@@ -871,7 +871,7 @@
static char* sta_ctrl_reg[] = {"ENABLE", "DISABLE", "PAUSE"};
static u32 chip_show_sta_acq_info(struct seq_file *s, struct mt7915_dev *dev, u32 *ple_stat,
u32 *sta_pause, u32 *dis_sta_map,
-@@ -1454,6 +1453,138 @@ static void chip_get_sta_pause(struct mt7915_dev *dev, u32 *sta_pause)
+@@ -1455,6 +1454,138 @@ static void chip_get_sta_pause(struct mt7915_dev *dev, u32 *sta_pause)
}
}
diff --git a/recipes-wifi/wpa-supplicant/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch b/recipes-wifi/wpa-supplicant/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch
index be54e06..be526be 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches/99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch
@@ -1,30 +1,44 @@
-From 166ba374624b2aed360427f087c20b8f511fb2e0 Mon Sep 17 00:00:00 2001
+From 17051f7a8b2193e24556e357f3f1665d67a79330 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 30 May 2022 16:31:34 +0800
-Subject: [PATCH 99912/99916] Support new hostapd configuration, edcca_enable
- and edcca_compensation
+Subject: [PATCH] Support new hostapd configuration, edcca_enable and
+ edcca_compensation and implement edcca related handlers.
---
- hostapd/config_file.c | 20 +++++++++++++++
- src/ap/ap_config.c | 3 +++
- src/ap/ap_config.h | 10 ++++++++
- src/ap/ap_drv_ops.c | 9 +++++++
- src/ap/ap_drv_ops.h | 2 +-
- src/ap/hostapd.c | 3 +++
- src/drivers/driver.h | 2 ++
- src/drivers/driver_nl80211.c | 42 +++++++++++++++++++++++++++++++
- src/drivers/driver_nl80211.h | 1 +
- src/drivers/driver_nl80211_capa.c | 7 ++++++
- 10 files changed, 98 insertions(+), 1 deletion(-)
+ hostapd/config_file.c | 32 ++++++
+ hostapd/ctrl_iface.c | 125 ++++++++++++++++++++++
+ src/ap/ap_config.c | 4 +
+ src/ap/ap_config.h | 29 ++++++
+ src/ap/ap_drv_ops.c | 24 +++++
+ src/ap/ap_drv_ops.h | 5 +-
+ src/ap/hostapd.c | 7 ++
+ src/common/mtk_vendor.h | 19 ++--
+ src/drivers/driver.h | 4 +
+ src/drivers/driver_nl80211.c | 165 ++++++++++++++++++++++++++++++
+ src/drivers/driver_nl80211.h | 1 +
+ src/drivers/driver_nl80211_capa.c | 7 ++
+ 12 files changed, 415 insertions(+), 7 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index eda9db021..8a21c9698 100644
+index eda9db0..0ee8952 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4753,6 +4753,26 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4753,6 +4753,38 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "eht_mu_beamformer") == 0) {
conf->eht_phy_capab.mu_beamformer = atoi(pos);
#endif /* CONFIG_IEEE80211BE */
++ } else if (os_strcmp(buf, "edcca_threshold") == 0) {
++ if (hostapd_parse_intlist(&conf->edcca_threshold, pos) ||
++ conf->edcca_threshold[0] < EDCCA_MIN_CONFIG_THRES ||
++ conf->edcca_threshold[0] > EDCCA_MAX_CONFIG_THRES ||
++ conf->edcca_threshold[1] < EDCCA_MIN_CONFIG_THRES ||
++ conf->edcca_threshold[1] > EDCCA_MAX_CONFIG_THRES ||
++ conf->edcca_threshold[2] < EDCCA_MIN_CONFIG_THRES ||
++ conf->edcca_threshold[2] > EDCCA_MAX_CONFIG_THRES) {
++ wpa_printf(MSG_ERROR, "Line %d: invalid edcca threshold",
++ line);
++ return 1;
++ }
+ } else if (os_strcmp(buf, "edcca_enable") == 0) {
+ int mode = atoi(pos);
+ if (mode < EDCCA_MODE_FORCE_DISABLE || mode > EDCCA_MODE_AUTO) {
@@ -37,7 +51,7 @@
+ } else if (os_strcmp(buf, "edcca_compensation") == 0) {
+ int val = atoi(pos);
+ if (val < EDCCA_MIN_COMPENSATION ||
-+ val > EDCCA_MAX_COMPENSATION) {
++ val > EDCCA_MAX_COMPENSATION) {
+ wpa_printf(MSG_ERROR, "Line %d: Invalid compensation"
+ " value %d; allowed value %d ~ %d.",
+ line, val, EDCCA_MIN_COMPENSATION,
@@ -48,8 +62,158 @@
} else {
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
+diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
+index bb8c74f..9c70d54 100644
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -598,6 +598,19 @@ static const char * pbc_status_str(enum pbc_status status)
+ }
+
+
++static const char * edcca_mode_str(enum edcca_mode status)
++{
++ switch (status) {
++ case EDCCA_MODE_FORCE_DISABLE:
++ return "Force Disable";
++ case EDCCA_MODE_AUTO:
++ return "Auto";
++ default:
++ return "Unknown";
++ }
++}
++
++
+ static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
+ char *buf, size_t buflen)
+ {
+@@ -3322,6 +3335,112 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
+ #endif /* ANDROID */
+
+
++static int
++hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
++ char *buf, size_t buflen)
++{
++ char *pos, *config, *value;
++ config = cmd;
++ pos = os_strchr(config, ' ');
++ if (pos == NULL)
++ return -1;
++ *pos++ = '\0';
++
++ if(pos == NULL)
++ return -1;
++ value = pos;
++
++ if (os_strcmp(config, "enable") == 0) {
++ int mode = atoi(value);
++ if (mode < EDCCA_MODE_FORCE_DISABLE || mode > EDCCA_MODE_AUTO) {
++ wpa_printf(MSG_ERROR, "Invalid value for edcca enable");
++ return -1;
++ }
++ hapd->iconf->edcca_enable = (u8) mode;
++ if (hostapd_drv_configure_edcca_enable(hapd) != 0)
++ return -1;
++ } else if (os_strcmp(config, "compensation") == 0) {
++ int compensation = atoi(value);
++ if (compensation < EDCCA_MIN_COMPENSATION ||
++ compensation > EDCCA_MAX_COMPENSATION) {
++ wpa_printf(MSG_ERROR, "Invalid value for edcca compensation");
++ return -1;
++ }
++ hapd->iconf->edcca_compensation = (s8) compensation;
++ if (hostapd_drv_configure_edcca_enable(hapd) != 0)
++ return -1;
++ } else if (os_strcmp(config, "threshold") == 0) {
++ char *thres_value;
++ thres_value = os_strchr(value, ':');
++ if (thres_value == NULL)
++ return -1;
++ *thres_value++ = '\0';
++
++ if(thres_value == NULL)
++ return -1;
++ int bw_idx= atoi(value);
++ int threshold = atoi(thres_value);
++
++ if (bw_idx < EDCCA_BW_20 || bw_idx > EDCCA_BW_80) {
++ wpa_printf(MSG_ERROR,
++ "Unsupported Bandwidth idx %d for SET_EDCCA",
++ bw_idx);
++ return -1;
++ }
++ if (threshold < EDCCA_MIN_CONFIG_THRES ||
++ threshold > EDCCA_MAX_CONFIG_THRES) {
++ wpa_printf(MSG_ERROR,
++ "Unsupported threshold %d for SET_EDCCA",
++ threshold);
++ return -1;
++ }
++
++ int threshold_arr[EDCCA_MAX_BW_NUM];
++ /* 0x7f means keep the origival value in firmware */
++ os_memset(threshold_arr, 0x7f, sizeof(threshold_arr));
++ threshold_arr[bw_idx] = threshold;
++
++ if (hostapd_drv_configure_edcca_threshold(hapd, threshold_arr) != 0)
++ return -1;
++ } else {
++ wpa_printf(MSG_ERROR,
++ "Unsupported parameter %s for SET_EDCCA", config);
++ return -1;
++ }
++ return os_snprintf(buf, buflen, "OK\n");
++}
++
++
++static int
++hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
++ size_t buflen)
++{
++ char *pos, *end;
++
++ pos = buf;
++ end = buf + buflen;
++ u8 value[EDCCA_MAX_BW_NUM] = {0};
++
++ if (os_strcmp(cmd, "enable") == 0) {
++ return os_snprintf(pos, end - pos, "Enable: %s\n",
++ edcca_mode_str(hapd->iconf->edcca_enable));
++ } else if (os_strcmp(cmd, "compensation") == 0) {
++ return os_snprintf(pos, end - pos, "Compensation: %d\n",
++ hapd->iconf->edcca_compensation);
++ } else if (os_strcmp(cmd, "threshold") == 0) {
++ if (hostapd_drv_get_edcca(hapd, EDCCA_CTRL_GET_THRES, &value) != 0)
++ return -1;
++ return os_snprintf(pos, end - pos,
++ "Threshold BW20: 0x%x, BW40: 0x%x, BW80: 0x%x\n",
++ value[0], value[1], value[2]);
++ } else {
++ wpa_printf(MSG_ERROR,
++ "Unsupported parameter %s for GET_EDCCA", cmd);
++ return -1;
++ }
++}
++
++
+ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ char *buf, char *reply,
+ int reply_size,
+@@ -3868,6 +3987,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply,
+ reply_size);
+ #endif /* ANDROID */
++ } else if (os_strncmp(buf, "SET_EDCCA ", 10) == 0) {
++ reply_len = hostapd_ctrl_iface_set_edcca(hapd, buf+10, reply,
++ reply_size);
++ } else if (os_strncmp(buf, "GET_EDCCA ", 10) == 0) {
++ reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
++ reply_size);
+ } else {
+ os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
+ reply_len = 16;
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 4a20eb4e1..373879f79 100644
+index 4a20eb4..344585a 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -294,6 +294,9 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -62,16 +226,25 @@
return conf;
}
+@@ -1007,6 +1010,7 @@ void hostapd_config_free(struct hostapd_config *conf)
+ #ifdef CONFIG_ACS
+ os_free(conf->acs_chan_bias);
+ #endif /* CONFIG_ACS */
++ os_free(conf->edcca_threshold);
+ wpabuf_free(conf->lci);
+ wpabuf_free(conf->civic);
+
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3f68e76d5..3ac2ae070 100644
+index 3f68e76..775c567 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1153,8 +1153,18 @@ struct hostapd_config {
+@@ -1153,8 +1153,37 @@ struct hostapd_config {
#define CH_SWITCH_EHT_ENABLED BIT(0)
#define CH_SWITCH_EHT_DISABLED BIT(1)
unsigned int ch_switch_eht_config;
+ u8 edcca_enable;
+ s8 edcca_compensation;
++ int *edcca_threshold;
};
+enum edcca_mode {
@@ -79,99 +252,173 @@
+ EDCCA_MODE_AUTO = 1,
+};
+
++enum edcca_bw_id {
++ EDCCA_BW_20 = 0,
++ EDCCA_BW_40,
++ EDCCA_BW_80,
++ EDCCA_MAX_BW_NUM,
++};
++
++enum mtk_vendor_attr_edcca_ctrl_mode {
++ EDCCA_CTRL_SET_EN = 0,
++ EDCCA_CTRL_SET_THRES,
++ EDCCA_CTRL_GET_EN,
++ EDCCA_CTRL_GET_THRES,
++ EDCCA_CTRL_NUM,
++};
++
+#define EDCCA_DEFAULT_COMPENSATION -6
+#define EDCCA_MIN_COMPENSATION -126
+#define EDCCA_MAX_COMPENSATION 126
++#define EDCCA_MIN_CONFIG_THRES -126
++#define EDCCA_MAX_CONFIG_THRES 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 0c7aee276..5d2d79c38 100644
+index 0c7aee2..25e967d 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1015,3 +1015,12 @@ int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable)
+@@ -1015,3 +1015,27 @@ int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable)
return 0;
return hapd->driver->dpp_listen(hapd->drv_priv, enable);
}
+
-+int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd)
++int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd)
+{
-+ if (!hapd->driver || !hapd->driver->configure_edcca_threshold)
++ if (!hapd->driver || !hapd->driver->configure_edcca_enable)
+ return 0;
-+ return hapd->driver->configure_edcca_threshold(hapd->drv_priv,
++ return hapd->driver->configure_edcca_enable(hapd->drv_priv,
+ hapd->iconf->edcca_enable,
+ hapd->iconf->edcca_compensation);
+}
++
++int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
++ const int *threshold)
++{
++ if (!hapd->driver || !hapd->driver->configure_edcca_threshold)
++ return 0;
++ return hapd->driver->configure_edcca_threshold(hapd->drv_priv, threshold);
++}
++
++int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
++{
++ if (!hapd->driver || !hapd->driver->get_edcca)
++ return 0;
++ return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
++}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index b4fb766ee..f8fef1929 100644
+index b4fb766..70a99f4 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -138,7 +138,7 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd);
+@@ -138,7 +138,10 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd);
int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
u16 reason_code, const u8 *ie, size_t ielen);
int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
-
-+int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd);
++int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
++int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
++ const int *threshold);
++int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 0dd8c13b7..6babb036a 100644
+index 0dd8c13..d05f948 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2295,6 +2295,9 @@ dfs_offload:
+@@ -2295,6 +2295,13 @@ dfs_offload:
}
#endif /* CONFIG_MESH */
-+ if (hostapd_drv_configure_edcca_threshold(hapd) < 0)
++ if (hostapd_drv_configure_edcca_enable(hapd) < 0)
+ goto fail;
+
++ if (hostapd_drv_configure_edcca_threshold(hapd,
++ hapd->iconf->edcca_threshold) < 0)
++ goto fail;
++
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
+diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
+index 528387f..7056126 100644
+--- a/src/common/mtk_vendor.h
++++ b/src/common/mtk_vendor.h
+@@ -29,14 +29,21 @@ enum mtk_vendor_attr_edcca_ctrl {
+ NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL - 1
+ };
+
+-enum mtk_vendor_attr_edcca_ctrl_mode {
+- EDCCA_CTRL_SET_EN = 0,
+- EDCCA_CTRL_SET_THERS,
+- EDCCA_CTRL_GET_EN,
+- EDCCA_CTRL_GET_THERS,
+- EDCCA_CTRL_NUM,
++enum mtk_vendor_attr_edcca_dump {
++ MTK_VENDOR_ATTR_EDCCA_DUMP_UNSPEC = 0,
++
++ MTK_VENDOR_ATTR_EDCCA_DUMP_MODE,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL,
++
++ /* keep last */
++ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP,
++ MTK_VENDOR_ATTR_EDCCA_DUMP_MAX =
++ NUM_MTK_VENDOR_ATTRS_EDCCA_DUMP - 1
+ };
+
++
+ static struct nla_policy edcca_ctrl_policy[NUM_MTK_VENDOR_ATTRS_EDCCA_CTRL] = {
+ [MTK_VENDOR_ATTR_EDCCA_CTRL_MODE] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] = { .type = NLA_U8 },
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 1d2b1b265..575448a93 100644
+index 1d2b1b2..3559974 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -4676,6 +4676,8 @@ struct wpa_driver_ops {
+@@ -4676,6 +4676,10 @@ struct wpa_driver_ops {
const u8 *match, size_t match_len,
bool multicast);
#endif /* CONFIG_TESTING_OPTIONS */
-+ int (*configure_edcca_threshold)(void *priv, const u8 edcca_enable,
++ int (*configure_edcca_enable)(void *priv, const u8 edcca_enable,
+ const s8 edcca_compensation);
++ int (*configure_edcca_threshold)(void *priv, const int *threshold);
++ int (*get_edcca)(void *priv, const u8 mode, u8 *value);
};
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 5eba0ea1b..76680dfd3 100644
+index 5eba0ea..9c2782c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -35,6 +35,7 @@
+@@ -35,6 +35,8 @@
#include "radiotap_iter.h"
#include "rfkill.h"
#include "driver_nl80211.h"
+#include "common/mtk_vendor.h"
++#include "ap/ap_config.h"
#ifndef NETLINK_CAP_ACK
-@@ -12368,6 +12369,45 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
+@@ -12368,6 +12370,165 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
#endif /* CONFIG_TESTING_OPTIONS */
-+static int nl80211_configure_edcca_threshold(void *priv,
-+ const u8 edcca_enable,
-+ const s8 edcca_compensation)
++static int nl80211_configure_edcca_enable(void *priv,
++ const u8 edcca_enable,
++ const s8 edcca_compensation)
+{
+ struct i802_bss *bss = priv;
+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ /* Prepare nl80211 cmd */
+ struct nl_msg *msg;
+ struct nlattr *data;
+ int ret;
+
+ if (!drv->mtk_edcca_vendor_cmd_avail) {
+ wpa_printf(MSG_INFO,
-+ "nl80211: Driver does not support setting EDCCA threshold");
++ "nl80211: Driver does not support setting EDCCA enable");
+ return 0;
+ }
+
@@ -191,7 +438,128 @@
+ nla_nest_end(msg, data);
+ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
+ if (ret) {
++ wpa_printf(MSG_ERROR, "Failed to configure EDCCA enable. ret=%d (%s) ",
++ ret, strerror(-ret));
++ }
++ return ret;
++}
++
++static int nl80211_configure_edcca_threshold(void *priv, const int *threshold)
++{
++ struct i802_bss *bss = priv;
++ struct wpa_driver_nl80211_data *drv = bss->drv;
++ struct nl_msg *msg;
++ struct nlattr *data;
++ int ret;
++
++ if (!drv->mtk_edcca_vendor_cmd_avail) {
++ wpa_printf(MSG_INFO,
++ "nl80211: Driver does not support setting EDCCA threshold");
++ return 0;
++ }
++
++ if (!threshold) {
++ wpa_printf(MSG_INFO,
++ "nl80211: Input EDCCA threshold is empty!");
++ return 0;
++ }
++
++ if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD,
++ MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL) ||
++ !(data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA)) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_MODE, EDCCA_CTRL_SET_THRES) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL, threshold[0] & 0xff) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_SEC40_VAL, threshold[1] & 0xff) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_SEC80_VAL, threshold[2] & 0xff)) {
++ wpa_printf (MSG_ERROR, "Prepare nl80211 msg fail");
++ nlmsg_free(msg);
++ return -ENOBUFS;
++ }
++ nla_nest_end(msg, data);
++ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
++ if (ret) {
++ wpa_printf(MSG_ERROR, "Failed to configure EDCCA threshold. ret=%d (%s) ",
++ ret, strerror(-ret));
++ }
++ return ret;
++}
++
++
++static int edcca_info_handler(struct nl_msg *msg, void *arg)
++{
++ u8 *info = (u8*) arg;
++ struct nlattr *tb[NL80211_ATTR_MAX + 1];
++ struct nlattr *tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_MAX + 1];
++ struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
++ struct nlattr *nl_vend, *attr;
++
++ nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
++ genlmsg_attrlen(gnlh, 0), NULL);
++
++ nl_vend = tb[NL80211_ATTR_VENDOR_DATA];
++ if (!nl_vend)
++ return NL_SKIP;
++
++ nla_parse(tb_vendor, MTK_VENDOR_ATTR_EDCCA_DUMP_MAX,
++ nla_data(nl_vend), nla_len(nl_vend), NULL);
++
++ attr = tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL];
++ if (!attr) {
++ wpa_printf(MSG_ERROR, "nl80211: MTK_VENDOR_ATTR_EDCCA_DUMP_PRI20_VAL");
++ return NL_SKIP;
++ }
++
++ *info++ = nla_get_u8(attr);
++
++ attr = tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL];
++ if (!attr) {
++ wpa_printf(MSG_ERROR, "nl80211: MTK_VENDOR_ATTR_EDCCA_DUMP_SEC40_VAL");
++ return NL_SKIP;
++ }
++
++ *info++ = nla_get_u8(attr);
++
++ attr = tb_vendor[MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL];
++ if (!attr) {
++ wpa_printf(MSG_ERROR, "nl80211: MTK_VENDOR_ATTR_EDCCA_DUMP_SEC80_VAL");
++ return NL_SKIP;
++ }
++
++ *info = nla_get_u8(attr);
++ return NL_SKIP;
++}
++
++
++static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
++{
++ struct i802_bss *bss = priv;
++ struct wpa_driver_nl80211_data *drv = bss->drv;
++ struct nl_msg *msg;
++ struct nlattr *data;
++ int ret;
++
++ if (!drv->mtk_edcca_vendor_cmd_avail) {
++ wpa_printf(MSG_INFO,
++ "nl80211: Driver does not support setting EDCCA threshold");
++ return 0;
++ }
++
++ if (!(msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_VENDOR)) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
++ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD,
++ MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL) ||
++ !(data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA | NLA_F_NESTED)) ||
++ nla_put_u8(msg, MTK_VENDOR_ATTR_EDCCA_CTRL_MODE, mode)) {
++ wpa_printf (MSG_ERROR, "Prepare nl80211 msg fail");
++ nlmsg_free(msg);
++ return -ENOBUFS;
++ }
++ nla_nest_end(msg, data);
++ ret = send_and_recv_msgs(drv, msg, edcca_info_handler, value, NULL, NULL);
++ if (ret) {
-+ wpa_printf(MSG_ERROR, "Failed to configure EDCCA. ret=%d (%s) ",
++ wpa_printf(MSG_ERROR, "Failed to get EDCCA configuration. ret=%d (%s)",
+ ret, strerror(-ret));
+ }
+ return ret;
@@ -200,15 +568,17 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -12514,4 +12554,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12514,4 +12675,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.register_frame = testing_nl80211_register_frame,
.radio_disable = testing_nl80211_radio_disable,
#endif /* CONFIG_TESTING_OPTIONS */
+/* Need ifdef CONFIG_DRIVER_NL80211_MTK */
++ .configure_edcca_enable = nl80211_configure_edcca_enable,
+ .configure_edcca_threshold = nl80211_configure_edcca_threshold,
++ .get_edcca = nl80211_get_edcca,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 6e40d5556..13e5d248c 100644
+index 6e40d55..13e5d24 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -181,6 +181,7 @@ struct wpa_driver_nl80211_data {
@@ -220,7 +590,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 7ede0d030..732ae292d 100644
+index 7ede0d0..732ae29 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -18,6 +18,7 @@
@@ -245,5 +615,5 @@
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches/99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch b/recipes-wifi/wpa-supplicant/files/patches/99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch
deleted file mode 100644
index e8e96d6..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches/99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 64344c416f8d394552aeaa44f2b1cea4c9815141 Mon Sep 17 00:00:00 2001
-From: Howard Hsu <howard-yh.hsu@mediatek.com>
-Date: Fri, 24 Jun 2022 22:32:40 +0800
-Subject: [PATCH 99913/99916] Add hostapd command handler for SET_EDCCA,
- GET_EDCCA and APPLY_EDCCA
-
----
- hostapd/ctrl_iface.c | 99 ++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 99 insertions(+)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index bb8c74fd3..b3e61ff3d 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -598,6 +598,19 @@ static const char * pbc_status_str(enum pbc_status status)
- }
-
-
-+static const char * edcca_mode_str(enum edcca_mode status)
-+{
-+ switch (status) {
-+ case EDCCA_MODE_FORCE_DISABLE:
-+ return "Force Disable";
-+ case EDCCA_MODE_AUTO:
-+ return "Auto";
-+ default:
-+ return "Unknown";
-+ }
-+}
-+
-+
- static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
- char *buf, size_t buflen)
- {
-@@ -3322,6 +3335,85 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
- #endif /* ANDROID */
-
-
-+static int
-+hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
-+ char *buf, size_t buflen)
-+{
-+ char *pos, *config, *value;
-+ config = cmd;
-+ pos = os_strchr(config, ' ');
-+ if (pos == NULL)
-+ return -1;
-+ *pos++ = '\0';
-+
-+ if(pos == NULL)
-+ return -1;
-+ value = pos;
-+
-+ if (os_strcmp(config, "enable") == 0) {
-+ int mode = atoi(value);
-+ if (mode < EDCCA_MODE_FORCE_DISABLE || mode > EDCCA_MODE_AUTO) {
-+ wpa_printf(MSG_ERROR, "Invalid value for edcca enable");
-+ return -1;
-+ }
-+ hapd->iconf->edcca_enable = (u8) mode;
-+ } else if (os_strcmp(config, "compensation") == 0) {
-+ int compensation = atoi(value);
-+ if (compensation < EDCCA_MIN_COMPENSATION ||
-+ compensation > EDCCA_MAX_COMPENSATION) {
-+ wpa_printf(MSG_ERROR, "Invalid value for edcca compensation");
-+ return -1;
-+ }
-+ hapd->iconf->edcca_compensation = (s8) compensation;
-+ } else {
-+ wpa_printf(MSG_ERROR,
-+ "Unsupported parameter %s for SET_EDCCA", config);
-+ return -1;
-+ }
-+ return os_snprintf(buf, buflen, "OK\n");
-+}
-+
-+
-+static int
-+hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *buf,
-+ size_t buflen)
-+{
-+ int ret;
-+ char *pos, *end;
-+
-+ pos = buf;
-+ end = buf + buflen;
-+
-+ ret = os_snprintf(pos, end - pos, "EDCCA Mode: %s\n",
-+ edcca_mode_str(hapd->iconf->edcca_enable));
-+
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+
-+ ret = os_snprintf(pos, end - pos, "EDCCA compensation %d\n",
-+ hapd->iconf->edcca_compensation);
-+
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+
-+ return pos - buf;
-+}
-+
-+
-+static int
-+hostapd_ctrl_iface_apply_edcca(struct hostapd_data *hapd, char *buf,
-+ size_t buflen)
-+{
-+ if(hostapd_drv_configure_edcca_threshold(hapd) == 0) {
-+ return os_snprintf(buf, buflen, "OK\n");
-+ } else {
-+ return -1;
-+ }
-+}
-+
-+
- static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- char *buf, char *reply,
- int reply_size,
-@@ -3868,6 +3960,13 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply,
- reply_size);
- #endif /* ANDROID */
-+ } else if (os_strncmp(buf, "SET_EDCCA ", 10) == 0) {
-+ reply_len = hostapd_ctrl_iface_set_edcca(hapd, buf+10, reply,
-+ reply_size);
-+ } else if (os_strncmp(buf, "GET_EDCCA", 9) == 0) {
-+ reply_len = hostapd_ctrl_iface_get_edcca(hapd, reply, reply_size);
-+ } else if (os_strncmp(buf, "APPLY_EDCCA", 11) == 0) {
-+ reply_len = hostapd_ctrl_iface_apply_edcca(hapd, reply, reply_size);
- } else {
- os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
- reply_len = 16;
---
-2.25.1
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch b/recipes-wifi/wpa-supplicant/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch
index f255d50..054dd47 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches/99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch
@@ -1,7 +1,7 @@
-From eb5eaa8daca8108be818aa5dc0021cc4b7f1f051 Mon Sep 17 00:00:00 2001
+From d5c58b339c448a6d1d476205b68d434d7bf8e472 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Tue, 9 Aug 2022 10:23:44 -0700
-Subject: [PATCH 99914/99916] Add hostapd HEMU SET/GET control
+Subject: [PATCH 1/6] Add hostapd HEMU SET/GET control
---
hostapd/config_file.c | 9 +++
@@ -20,10 +20,10 @@
13 files changed, 251 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 8a21c9698..0be53044a 100644
+index c99e76d..afe0f0c 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3659,6 +3659,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -3698,6 +3698,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
bss->unsol_bcast_probe_resp_interval = val;
@@ -40,10 +40,10 @@
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index b3e61ff3d..60c1fb44e 100644
+index 9c70d54..5f71aee 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3414,6 +3414,63 @@ hostapd_ctrl_iface_apply_edcca(struct hostapd_data *hapd, char *buf,
+@@ -3441,6 +3441,63 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
}
@@ -107,10 +107,10 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -3967,6 +4024,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- reply_len = hostapd_ctrl_iface_get_edcca(hapd, reply, reply_size);
- } else if (os_strncmp(buf, "APPLY_EDCCA", 11) == 0) {
- reply_len = hostapd_ctrl_iface_apply_edcca(hapd, reply, reply_size);
+@@ -3993,6 +4050,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ } else if (os_strncmp(buf, "GET_EDCCA ", 10) == 0) {
+ reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
+ reply_size);
+ } else if (os_strncmp(buf, "SET_HEMU ", 9) == 0) {
+ reply_len = hostapd_ctrl_iface_set_hemu(hapd, buf+9, reply,
+ reply_size);
@@ -120,7 +120,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index db2125805..0d364773b 100644
+index db21258..0d36477 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1380,6 +1380,20 @@ static int hostapd_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc,
@@ -156,7 +156,7 @@
{ "dpp_qr_code", hostapd_cli_cmd_dpp_qr_code, NULL,
"report a scanned DPP URI from a QR Code" },
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 373879f79..8ce4d9a16 100644
+index 344585a..0e1f192 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -280,6 +280,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -168,7 +168,7 @@
/* The third octet of the country string uses an ASCII space character
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3ac2ae070..4462f29b7 100644
+index 775c567..41b8c68 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1114,6 +1114,7 @@ struct hostapd_config {
@@ -180,12 +180,12 @@
/* VHT enable/disable config from CHAN_SWITCH */
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 5d2d79c38..55452323d 100644
+index 25e967d..4598737 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1024,3 +1024,17 @@ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd)
- hapd->iconf->edcca_enable,
- hapd->iconf->edcca_compensation);
+@@ -1039,3 +1039,17 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
+ return 0;
+ return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
}
+
+int hostapd_drv_hemu_ctrl(struct hostapd_data *hapd)
@@ -202,25 +202,25 @@
+ return hapd->driver->hemu_dump(hapd->drv_priv, hemu_onoff);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index f8fef1929..5bcb2251a 100644
+index 70a99f4..bca39c5 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -139,6 +139,8 @@ int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
- u16 reason_code, const u8 *ie, size_t ielen);
- int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
- int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd);
+@@ -142,6 +142,8 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
+ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
+ const int *threshold);
+ 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);
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 6babb036a..0f3691ba3 100644
+index d05f948..921769d 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2297,6 +2297,8 @@ dfs_offload:
-
- if (hostapd_drv_configure_edcca_threshold(hapd) < 0)
+@@ -2301,6 +2301,8 @@ dfs_offload:
+ if (hostapd_drv_configure_edcca_threshold(hapd,
+ hapd->iconf->edcca_threshold) < 0)
goto fail;
+ if (hostapd_drv_hemu_ctrl(hapd) < 0)
+ goto fail;
@@ -228,7 +228,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 528387fa5..5c8f1792e 100644
+index 7056126..69a46df 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -10,6 +10,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -240,7 +240,7 @@
MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
};
-@@ -167,6 +169,19 @@ enum mtk_vendor_attr_rfeature_ctrl {
+@@ -174,6 +176,19 @@ enum mtk_vendor_attr_rfeature_ctrl {
NUM_MTK_VENDOR_ATTRS_RFEATURE_CTRL - 1
};
@@ -261,7 +261,7 @@
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 575448a93..88b371d61 100644
+index 3559974..4cd7505 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1623,6 +1623,11 @@ struct wpa_driver_ap_params {
@@ -276,10 +276,10 @@
};
struct wpa_driver_mesh_bss_params {
-@@ -4678,6 +4683,14 @@ struct wpa_driver_ops {
- #endif /* CONFIG_TESTING_OPTIONS */
- int (*configure_edcca_threshold)(void *priv, const u8 edcca_enable,
+@@ -4680,6 +4685,14 @@ struct wpa_driver_ops {
const s8 edcca_compensation);
+ int (*configure_edcca_threshold)(void *priv, const int *threshold);
+ int (*get_edcca)(void *priv, const u8 mode, u8 *value);
+
+ /**
+ * hemu_ctrl - ctrl on off for UL/DL MURU
@@ -292,10 +292,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 76680dfd3..b06de0687 100644
+index 5fe1d33..ef0ca18 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12303,6 +12303,114 @@ fail:
+@@ -12304,6 +12304,114 @@ fail:
}
@@ -410,7 +410,7 @@
#ifdef CONFIG_DPP
static int nl80211_dpp_listen(void *priv, bool enable)
{
-@@ -12547,6 +12655,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12668,6 +12776,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.update_connect_params = nl80211_update_connection_params,
.send_external_auth_status = nl80211_send_external_auth_status,
.set_4addr_mode = nl80211_set_4addr_mode,
@@ -420,7 +420,7 @@
.dpp_listen = nl80211_dpp_listen,
#endif /* CONFIG_DPP */
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 13e5d248c..57f02497e 100644
+index 13e5d24..57f0249 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -182,6 +182,7 @@ struct wpa_driver_nl80211_data {
@@ -432,7 +432,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 732ae292d..cc146d9fc 100644
+index 732ae29..cc146d9 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1056,6 +1056,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -446,5 +446,5 @@
}
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch b/recipes-wifi/wpa-supplicant/files/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
index bdc20dd..c853b08 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
+++ b/recipes-wifi/wpa-supplicant/files/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
diff --git a/recipes-wifi/wpa-supplicant/files/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch b/recipes-wifi/wpa-supplicant/files/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
index c9ea6b5..eadaa63 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/99916-hostapd-mtk-Add-hostapd-iBF-control.patch
+++ b/recipes-wifi/wpa-supplicant/files/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,
diff --git a/recipes-wifi/wpa-supplicant/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch b/recipes-wifi/wpa-supplicant/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
index c1f276c..796dc3f 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
@@ -1,7 +1,7 @@
-From 15784701fb4b10ac058ae41763c5d4bda15366f0 Mon Sep 17 00:00:00 2001
+From 32816f9bf56aeff95ddfe4a735028bee0d552f4d Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Wed, 21 Sep 2022 15:14:11 -0700
-Subject: [PATCH 99917/99920] add hostapd AMPDU and AMSDU control command
+Subject: [PATCH 4/6] add hostapd AMPDU and AMSDU control command
---
hostapd/config_file.c | 18 ++++
@@ -20,10 +20,10 @@
13 files changed, 297 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 9b79be1..310f97d 100644
+index 6b3b88d..9660543 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4789,6 +4789,24 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4843,6 +4843,24 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "ibf_enable") == 0) { /*ibf setting is per device*/
int val = atoi(pos);
conf->ibf_enable = !!val;
@@ -49,10 +49,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index a010e7f..0c40175 100644
+index c881d37..e51488e 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3495,6 +3495,48 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
+@@ -3522,6 +3522,48 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
}
@@ -101,7 +101,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4055,6 +4097,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4081,6 +4123,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_hemu(hapd, reply, reply_size);
} else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
reply_len = hostapd_ctrl_iface_get_ibf(hapd, reply, reply_size);
@@ -138,7 +138,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 14b21cb..910231b 100644
+index 7a96cb8..3ce8217 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -299,6 +299,8 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -151,11 +151,11 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 2a74e09..01b051d 100644
+index 44a0e7e..3e73236 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1158,6 +1158,8 @@ struct hostapd_config {
- s8 edcca_compensation;
+@@ -1159,6 +1159,8 @@ struct hostapd_config {
+ int *edcca_threshold;
u8 three_wire_enable;
u8 ibf_enable;
+ u8 ampdu;
@@ -164,10 +164,10 @@
enum three_wire_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 0b9b410..be6dcb8 100644
+index 60ae825..5d07272 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
-@@ -1062,4 +1062,25 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
+@@ -1077,4 +1077,25 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
if (!hapd->driver || !hapd->driver->ibf_dump)
return 0;
return hapd->driver->ibf_dump(hapd->drv_priv, ibf_enable);
@@ -196,10 +196,10 @@
+ return hapd->driver->aggregation_dump(hapd->drv_priv, aggr);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index da82382..4084901 100644
+index ab9aedc..4c1c201 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
-@@ -144,6 +144,9 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff);
+@@ -147,6 +147,9 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff);
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable);
@@ -210,10 +210,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index f095fe4..5fc998e 100644
+index e44b73d..60bd6f3 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2303,6 +2303,10 @@ dfs_offload:
+@@ -2307,6 +2307,10 @@ dfs_offload:
goto fail;
if (hostapd_drv_ibf_ctrl(hapd) < 0)
goto fail;
@@ -225,10 +225,10 @@
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 d6d04de..5568dab 100644
+index 4050cf8..d78e538 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
-@@ -170,6 +170,24 @@ enum mtk_vendor_attr_wireless_ctrl {
+@@ -177,6 +177,24 @@ enum mtk_vendor_attr_wireless_ctrl {
NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL - 1
};
@@ -254,10 +254,10 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index dab37f9..3286429 100644
+index 71ded61..57f3be6 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -4718,6 +4718,17 @@ struct wpa_driver_ops {
+@@ -4720,6 +4720,17 @@ struct wpa_driver_ops {
*
*/
int (*ibf_dump)(void *priv, u8 *ibf_enable);
@@ -276,10 +276,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 1c065d4..a06ac58 100644
+index 00f9231..07dac13 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12655,6 +12655,163 @@ fail:
+@@ -12776,6 +12776,163 @@ fail:
return -ENOBUFS;
}
@@ -443,7 +443,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -12807,4 +12964,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12930,4 +13087,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.three_wire_ctrl = nl80211_enable_three_wire,
.ibf_ctrl = nl80211_ibf_enable,
.ibf_dump = nl80211_ibf_dump,
diff --git a/recipes-wifi/wpa-supplicant/files/patches/patches.inc b/recipes-wifi/wpa-supplicant/files/patches/patches.inc
index 78475be..ee712d1 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/patches.inc
+++ b/recipes-wifi/wpa-supplicant/files/patches/patches.inc
@@ -66,7 +66,6 @@
file://99910-hostapd-mtk-hostapd-add-support-for-runtime-set-in-band-discove.patch \
file://99911-hostapd-mtk-Add-mtk_vendor.h.patch \
file://99912-hostapd-mtk-Support-new-hostapd-configuration-edcca_enable-and-.patch \
- file://99913-hostapd-mtk-Add-hostapd-command-handler-for-SET_EDCCA-GET_EDCCA.patch \
file://99914-hostapd-mtk-Add-hostapd-HEMU-SET-GET-control.patch \
file://99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch \
file://99916-hostapd-mtk-Add-hostapd-iBF-control.patch \