[rdkb][common][bsp][Refactor and sync wifi from openwrt]
[Description]
5d19c26 [MAC80211][Rebase Patches][Fix MT7986_dev Build Fail]
bb39a33 [MAC80211][Rebase Patches][Align mt76 patches number rules]
08b5ca8 [MAC80211][core][mt76][Add fixes for recently discovered security issues]
7de3103 [MAC80211][mt76][Add eeprom comparison before writting efuse]
d2eff50 [MAC80211][rebase patches][Filogic 880 alpha release preparation update]
4879bdc [mac80211][mt76][Fix Performance Issue with Octoscope]
[Release-log]
Change-Id: Ie4bf8c0a1ee4ca1e0d31f0c3b25df795de66a8f1
diff --git a/recipes-wifi/linux-mt76/files/patches/3010-wifi-mt76-mt7915-get-tx-retries-from-tx-free-done-ev.patch b/recipes-wifi/linux-mt76/files/patches/3010-wifi-mt76-mt7915-get-tx-retries-from-tx-free-done-ev.patch
new file mode 100644
index 0000000..7019e23
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/3010-wifi-mt76-mt7915-get-tx-retries-from-tx-free-done-ev.patch
@@ -0,0 +1,102 @@
+From 938c5fde676b5904488193aef069582df4d176f0 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Tue, 17 Jan 2023 21:15:00 +0800
+Subject: [PATCH 3010/3012] wifi: mt76: mt7915: get tx retries from tx free
+ done event for sw path
+
+---
+ mt7915/mac.c | 14 +++++++++++---
+ mt7915/mac.h | 5 ++++-
+ mt7915/main.c | 6 +++---
+ 3 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index 175498b1..180c1ae3 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -1005,6 +1005,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+ struct mt76_dev *mdev = &dev->mt76;
+ struct mt76_txwi_cache *txwi;
+ struct ieee80211_sta *sta = NULL;
++ struct mt76_wcid *wcid = NULL;
+ LIST_HEAD(free_list);
+ void *end = data + len;
+ bool v3, wake = false;
+@@ -1019,7 +1020,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+ v3 = (FIELD_GET(MT_TX_FREE_VER, txd) == 0x4);
+
+ for (cur_info = tx_info; count < total; cur_info++) {
+- u32 msdu, info;
++ u32 msdu, info, retries = 0;
+ u8 i;
+
+ if (WARN_ON_ONCE((void *)cur_info >= end))
+@@ -1032,7 +1033,6 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+ info = le32_to_cpu(*cur_info);
+ if (info & MT_TX_FREE_PAIR) {
+ struct mt7915_sta *msta;
+- struct mt76_wcid *wcid = NULL;
+ u16 idx;
+
+ idx = FIELD_GET(MT_TX_FREE_WLAN_ID, info);
+@@ -1049,7 +1049,15 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+ continue;
+ }
+
+- if (v3 && (info & MT_TX_FREE_MPDU_HEADER))
++ if (v3 && (info & MT_TX_FREE_MPDU_HEADER_V3))
++ retries = u32_get_bits(info, MT_TX_FREE_TX_COUNT_V3) - 1;
++ else if (!v3 && (info & MT_TX_FREE_MPDU_HEADER))
++ retries = u32_get_bits(info, MT_TX_FREE_TX_COUNT) - 1;
++
++ if (!mtk_wed_device_active(&mdev->mmio.wed) && wcid)
++ wcid->stats.tx_retries += retries;
++
++ if (v3 && (info & MT_TX_FREE_MPDU_HEADER_V3))
+ continue;
+
+ for (i = 0; i < 1 + v3; i++) {
+diff --git a/mt7915/mac.h b/mt7915/mac.h
+index 6fa9c79f..afadc512 100644
+--- a/mt7915/mac.h
++++ b/mt7915/mac.h
+@@ -36,8 +36,11 @@ enum rx_pkt_type {
+ #define MT_TX_FREE_LATENCY GENMASK(12, 0)
+ /* 0: success, others: dropped */
+ #define MT_TX_FREE_MSDU_ID GENMASK(30, 16)
++#define MT_TX_FREE_TX_COUNT GENMASK(12, 0)
++#define MT_TX_FREE_TX_COUNT_V3 GENMASK(27, 24)
+ #define MT_TX_FREE_PAIR BIT(31)
+-#define MT_TX_FREE_MPDU_HEADER BIT(30)
++#define MT_TX_FREE_MPDU_HEADER BIT(15)
++#define MT_TX_FREE_MPDU_HEADER_V3 BIT(30)
+ #define MT_TX_FREE_MSDU_ID_V3 GENMASK(14, 0)
+
+ /* will support this field in further revision */
+diff --git a/mt7915/main.c b/mt7915/main.c
+index e7c3bc04..cef6249c 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -1103,9 +1103,6 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
+ sinfo->tx_bytes = msta->wcid.stats.tx_bytes;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64);
+
+- sinfo->tx_retries = msta->wcid.stats.tx_retries;
+- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
+-
+ if (mtk_wed_get_rx_capa(&phy->dev->mt76.mmio.wed)) {
+ sinfo->rx_bytes = msta->wcid.stats.rx_bytes;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64);
+@@ -1115,6 +1112,9 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
+ }
+ }
+
++ sinfo->tx_retries = msta->wcid.stats.tx_retries;
++ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
++
+ if (!mt7915_mcu_get_tx_stat_wa(phy->dev, msta->wcid.idx)) {
+ sinfo->tx_packets = msta->wcid.stats.tx_packets;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
+--
+2.39.0
+