[][MAC80211][hostapd][update op_class when AP channel switch]

[Description]
Add op_class update when AP channel switch

[Release-log]
N/A

Change-Id: Ib71d9db401e2985242fadae5c09f982533944e29
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7920953
diff --git a/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0041-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch b/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0041-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch
new file mode 100644
index 0000000..891aaf5
--- /dev/null
+++ b/autobuild_mac80211_release/package/network/services/hostapd_new/patches/mtk-0041-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch
@@ -0,0 +1,37 @@
+From 393ff8090403f0e1c1e5f4e570d6c30962d4ded5 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Wed, 23 Aug 2023 17:44:50 +0800
+Subject: [PATCH 300/302] hostapd: mtk: update op_class when AP channel
+ switching
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/drv_callbacks.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
+index 694056b..d420a63 100644
+--- a/src/ap/drv_callbacks.c
++++ b/src/ap/drv_callbacks.c
+@@ -873,7 +873,7 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
+ {
+ #ifdef NEED_AP_MLME
+ 	int channel, chwidth, is_dfs0, is_dfs;
+-	u8 seg0_idx = 0, seg1_idx = 0;
++	u8 seg0_idx = 0, seg1_idx = 0, op_class, chan_no;
+ 	size_t i;
+ 
+ 	hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+@@ -995,6 +995,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
+ 		hapd->iconf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+ 
+ 	hapd->iconf->secondary_channel = offset;
++	ieee80211_freq_to_channel_ext(freq, offset, chwidth,
++				      &op_class, &chan_no);
++	hapd->iconf->op_class = op_class;
+ 	hostapd_set_oper_chwidth(hapd->iconf, chwidth);
+ 	hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
+ 	hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
+-- 
+2.25.1
+