[rdkb][common][bsp][Refactor and sync wifi from openwrt]

[Description]
ced8594f [MAC80211][WiFi6][Misc][Fix the MT76 WiFi6 Makefile]
7221999e [MAC80211][WiFi7][Misc][Correct the MAC80211 WiFi7 Makefile.]
9d87794a [MAC80211][WiFi7][Misc][Correct the MT76 WiFi7 Makefile.]
ff24e1b2 [openwrt-24][Mac80211][Fix patch conflict with upstream openwrt]
3a6c13e2 [mac80211][misc][fix patch fail due to openwrt update]
05763faa [MAC80211][WiFi7][misc][fix patch failed of wifi-scripts]
f34fd014 [mac80211][misc][fix patch fail due to openwrt update]
f6796660 [openwrt-24][Release][Fix build fail of Wi-Fi7 MT76]
7076d96c [MAC80211][WiFi7][Misc][Fix release build fail because of mt76 version upgradation]
1f748b17 [mac80211][misc][fix patch fail due to openwrt update]
95ba6722 [mac80211][misc][fix patch fail due to openwrt update]
17680d7f [MAC80211][WiFi7][misc][Rename eeprom of eFEM variants]
b97cefa1 [MAC80211][WiFi7][app][Add Griffin support for atenl/iwpriv]
6de718a4 [MAC80211][WiFi7][misc][fix wifi-scripts patch failed]
9f1ace86 [MAC80211][WiFi7][misc][fix hostapd Makefile patch]
e4d0d28e [MAC80211][Misc][Add MT7990 Firmware OpenWrt config]
f3a8a8f7 [MAC80211][Release][Fix build fail of Wi-Fi6 MT76]
dabe8eae [openwrt-24][common][bsp][Fix line ending]
6d438a9d [openwrt-24][common][bsp][Use zstd to compress rootfs debug symbols for unified autobuild]
c268e47e [openwrt][common][bsp][Change SMC ID of wdt nonrst reg of reset-boot-count to 0x570]
c6819fbc [openwrt-24][Release][Update release note for Filogic 880 alpha release]
6897b4de [openwrt-24][common][bsp][Adjust unified autobuild for internal build detection]
fb9b9762 [MAC80211][WiFi6/7][app][Add ext eeprom write back cmd support]
d42b42a3 [openwrt-24][common][bsp][Add kernel6.6 Filogic880 BE19000/BE14000]
3806f047 [MAC80211][misc][Add Bpi-R4 support]
ddbda753 [MAC80211][WiFi7][Misc][Fix build fail because of mt76 version upgradation]
90959b08 [MAC80211][WiFi6][mt76][Rebase mt76 pathes]
728a3362 [MAC80211][WiFi6][mt76][Refactor Qos Map]
b46277b5 [MAC80211][WiFi6][mt76][Fix add ba issue on tid not equal to zero]
c084ee8b [MAC80211][WiFi7][mt76][split mt76 Makefile patch]
bbaec094 [MAC80211][Release][Update Filogic 830/820/630 firmware]
5ce2eece [MAC80211][wifi6][MT76][Fix build fail]
5ac1121f [MAC80211][wifi6][MT76][Fix mt76 version to 2024-07-13]
485f92b1 [MAC80211][WiFi7][misc][synchronize PP bitmap when association]
84db8818 [MAC80211][WiFi6/7][app][Add ATETXNSS in iwpriv wrapper]
cc5a4605 [MAC80211][WiFi7][mt76][fix patch failed of Makefile]

[Release-log]

Change-Id: I06704c04c4b5571af4ffd189d636c1fc9f0567fd
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0133-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0133-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch
new file mode 100644
index 0000000..819ecfb
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0133-mtk-mt76-mt7996-add-mlo-related-debugfs-knob.patch
@@ -0,0 +1,190 @@
+From 4f2f27ccf6133c9f51f798a872387aa15337b923 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Mon, 27 May 2024 19:06:04 +0800
+Subject: [PATCH 133/223] mtk: mt76: mt7996: add mlo related debugfs knob
+
+Add the following debugfs knob
+Per-bss link info
+	- /sys/kernel/debug/ieee80211/phy0/<interface>/mt76_link_info
+Per-station link info
+	- /sys/kernel/debug/ieee80211/phy0/<interface>/stations/<mac address>/mt76_link_info
+
+Add TX MSDU failed, retried counts, and PER to mt76_links_info DebugFS knob.
+Remove MSDU statistics from link_sta_info DebugFS knob, since MSDUs are MLD-wise, instead of link-wise, handled.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
+---
+ mt7996/debugfs.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++-
+ mt7996/main.c    |   1 +
+ mt7996/mt7996.h  |   1 +
+ 3 files changed, 119 insertions(+), 1 deletion(-)
+
+diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
+index 9a62dfda..bafbcda1 100644
+--- a/mt7996/debugfs.c
++++ b/mt7996/debugfs.c
+@@ -1330,11 +1330,128 @@ mt7996_queues_show(struct seq_file *s, void *data)
+ 
+ DEFINE_SHOW_ATTRIBUTE(mt7996_queues);
+ 
++static int
++mt7996_sta_links_info_show(struct seq_file *s, void *data)
++{
++	struct ieee80211_sta *sta = s->private;
++	struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++	u64 tx_cnt = 0, tx_fails = 0, tx_retries = 0, rx_cnt = 0;
++	struct mt7996_dev *dev = msta->vif->dev;
++	unsigned long valid_links;
++	u8 link_id;
++
++	seq_printf(s, "primary link, link ID = %d\n", msta->pri_link);
++	seq_printf(s, "secondary link, link ID = %d\n", msta->sec_link);
++	seq_printf(s, "valid links = 0x%x\n", sta->valid_links);
++
++	mutex_lock(&dev->mt76.mutex);
++	valid_links = sta->valid_links ?: BIT(0);
++	for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++		struct mt7996_link_sta *mlink =
++			mlink_dereference_protected(msta, link_id);
++		struct mt76_wcid *wcid;
++
++		if (!mlink)
++			continue;
++
++		wcid = &mlink->wcid;
++
++		tx_cnt += wcid->stats.tx_packets;
++		tx_fails += wcid->stats.tx_packets_failed;
++		tx_retries += wcid->stats.tx_packets_retried;
++		rx_cnt += wcid->stats.rx_packets;
++
++		seq_printf(s, "link%d: wcid=%d, phy=%d, link_valid=%d\n",
++			    wcid->link_id, wcid->idx, wcid->phy_idx, wcid->link_valid);
++	}
++	mutex_unlock(&dev->mt76.mutex);
++
++	/* PER may be imprecise, because MSDU total and failed counts
++	 * are updated at different times.
++	 */
++	seq_printf(s, "TX MSDU Count: %llu\n", tx_cnt);
++	seq_printf(s, "TX MSDU Fails: %llu (PER: %llu.%llu%%)\n", tx_fails,
++		   tx_cnt ? tx_fails * 1000 / tx_cnt / 10 : 0,
++		   tx_cnt ? tx_fails * 1000 / tx_cnt % 10 : 0);
++	seq_printf(s, "TX MSDU Retries: %llu\n", tx_retries);
++	seq_printf(s, "RX MSDU Count: %llu\n", rx_cnt);
++
++	return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_sta_links_info);
++
+ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ 			    struct ieee80211_sta *sta, struct dentry *dir)
+ {
+ 	debugfs_create_file("fixed_rate", 0600, dir, sta, &fops_fixed_rate);
+ 	debugfs_create_file("hw-queues", 0400, dir, sta, &mt7996_queues_fops);
++	debugfs_create_file("mt76_links_info", 0400, dir, sta,
++			    &mt7996_sta_links_info_fops);
++}
++
++static int
++mt7996_vif_links_info_show(struct seq_file *s, void *data)
++{
++	struct ieee80211_vif *vif = s->private;
++	struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++	struct mt7996_dev *dev = mvif->dev;
++	struct mt7996_bss_conf *mconf;
++	struct mt7996_link_sta *mlink;
++	unsigned long valid_links;
++	u8 link_id, i;
++
++	static const char* width_to_bw[] = {
++		[NL80211_CHAN_WIDTH_40] = "40",
++		[NL80211_CHAN_WIDTH_80] = "80",
++		[NL80211_CHAN_WIDTH_80P80] = "80+80",
++		[NL80211_CHAN_WIDTH_160] = "160",
++		[NL80211_CHAN_WIDTH_5] = "5",
++		[NL80211_CHAN_WIDTH_10] = "10",
++		[NL80211_CHAN_WIDTH_20] = "20",
++		[NL80211_CHAN_WIDTH_20_NOHT] = "20_NOHT",
++		[NL80211_CHAN_WIDTH_320] = "320",
++	};
++
++	seq_printf(s, "master link id = %d\n", mvif->master_link_id);
++	seq_printf(s, "group mld id = %d\n", mvif->group_mld_id);
++	seq_printf(s, "mld remap id = %d\n", mvif->mld_remap_id);
++
++	seq_printf(s, "valid links = 0x%x\n", vif->valid_links);
++	for (i = 0; i < __MT_MAX_BAND; i++)
++		seq_printf(s, "band%d_link_id = %d\n", i, mvif->band_to_link[i]);
++
++	mutex_lock(&dev->mt76.mutex);
++	valid_links = vif->valid_links ?: BIT(0);
++	for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++		mconf = mconf_dereference_protected(mvif, link_id);
++		mlink = mlink_dereference_protected(&mvif->sta, link_id);
++
++		if (!mconf || !mlink)
++			continue;
++
++		seq_printf(s, "- link[%02d]: bss_idx = %d, wcid = %d\n",
++			   mconf->link_id, mconf->mt76.idx, mlink->wcid.idx);
++		seq_printf(s, "            omac_idx = %d, own_mld_id=%d\n",
++			   mconf->mt76.omac_idx, mconf->own_mld_id);
++
++		if (!mconf->phy->chanctx)
++			continue;
++
++		seq_printf(s, "            band_idx=%d, channel=%d, bw%s\n",
++			   mconf->mt76.band_idx,
++			   mconf->phy->chanctx->chandef.chan->hw_value,
++			   width_to_bw[mconf->phy->chanctx->chandef.width]);
++	}
++	mutex_unlock(&dev->mt76.mutex);
++
++	return 0;
++}
++DEFINE_SHOW_ATTRIBUTE(mt7996_vif_links_info);
++
++void mt7996_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
++{
++	debugfs_create_file("mt76_links_info", 0400, vif->debugfs_dir, vif,
++			    &mt7996_vif_links_info_fops);
+ }
+ 
+ static void
+@@ -1473,7 +1590,6 @@ mt7996_link_sta_info_show(struct seq_file *file, void *data)
+ 	seq_printf(file, "Statistics:\n");
+ 	seq_printf(file, "\tTX:\n");
+ 	seq_printf(file, "\t\tBytes: %llu\n", stats->tx_bytes);
+-	seq_printf(file, "\t\tMSDU Count: %u\n", stats->tx_packets);
+ 	seq_printf(file, "\t\tMPDU Count: %u\n", stats->tx_mpdus);
+ 	seq_printf(file, "\t\tMPDU Fails: %u (PER: %u.%u%%)\n", stats->tx_failed,
+ 		   stats->tx_mpdus ? stats->tx_failed * 1000 / stats->tx_mpdus / 10 : 0,
+diff --git a/mt7996/main.c b/mt7996/main.c
+index f67e1b5d..915a9f4f 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -2845,6 +2845,7 @@ const struct ieee80211_ops mt7996_ops = {
+ 	.sta_add_debugfs = mt7996_sta_add_debugfs,
+ 	.link_sta_add_debugfs = mt7996_link_sta_add_debugfs,
+ 	// .link_add_debugfs = mt7996_link_add_debugfs,
++	.vif_add_debugfs = mt7996_vif_add_debugfs,
+ #endif
+ 	.set_radar_background = mt7996_set_radar_background,
+ #ifdef CONFIG_NET_MEDIATEK_SOC_WED
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 9f58a793..984ae79e 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -1251,6 +1251,7 @@ int mt7996_mcu_set_eml_omn(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u
+ #ifdef CONFIG_MAC80211_DEBUGFS
+ void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ 			    struct ieee80211_sta *sta, struct dentry *dir);
++void mt7996_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
+ void mt7996_link_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ 				 struct ieee80211_link_sta *link_sta,
+ 				 struct dentry *dir);
+-- 
+2.45.2
+