[][MAC80211][wifi6][mt76][Fix incorrect per-band token counting]

[Description]
Add missing per-phy token decrement during processing abnormal evens,
like SER or other unexpected mac reset.

[Release-log]
N/A

Change-Id: I3929af76bed060e91273fa7dffb76d84bd30e33e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8939460
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch
index 04f4bae..ee848e6 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/0013-wifi-mt76-mt7915-limit-per-band-token-count.patch
@@ -1,25 +1,15 @@
-From 6c1136f7cdafe9cd4a6517afa60227f5ffa86b0a Mon Sep 17 00:00:00 2001
+From ef9b267adeee3803ae8ee3073d2ebcbd3e1c95f9 Mon Sep 17 00:00:00 2001
 From: Peter Chiu <chui-hao.chiu@mediatek.com>
 Date: Mon, 29 Jan 2024 15:33:24 +0800
-Subject: [PATCH 13/14] wifi: mt76: mt7915: limit per-band token count
+Subject: [PATCH] wifi: mt76: mt7915: limit per-band token count
 
 Add a threshold for per-band token count to prevent a band from interfering
 with the other band.
 
 Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
----
- mt76.h           |  8 +++++++-
- mt7915/init.c    |  3 +++
- mt7915/mac.c     |  3 ++-
- mt7921/pci_mac.c |  2 +-
- mt7925/pci_mac.c |  2 +-
- mt7996/init.c    |  5 +++++
- mt7996/mac.c     |  3 ++-
- tx.c             | 20 ++++++++++++++++++--
- 8 files changed, 39 insertions(+), 7 deletions(-)
 
 diff --git a/mt76.h b/mt76.h
-index ee14425..b83456b 100644
+index ee14425d..b83456b4 100644
 --- a/mt76.h
 +++ b/mt76.h
 @@ -407,6 +407,8 @@ struct mt76_txwi_cache {
@@ -58,8 +48,21 @@
  void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
  struct mt76_txwi_cache *mt76_rx_token_release(struct mt76_dev *dev, int token);
  int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr,
+diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
+index 630c6402..a92c261d 100644
+--- a/mt76_connac_mac.c
++++ b/mt76_connac_mac.c
+@@ -1178,6 +1178,8 @@ void mt76_connac2_tx_token_put(struct mt76_dev *dev)
+ 	idr_for_each_entry(&dev->token, txwi, id) {
+ 		mt76_connac2_txwi_free(dev, txwi, NULL, NULL);
+ 		dev->token_count--;
++		if (dev->num_phy > 1 && dev->phys[txwi->phy_idx])
++			dev->phys[txwi->phy_idx]->tokens--;
+ 	}
+ 	spin_unlock_bh(&dev->token_lock);
+ 	idr_destroy(&dev->token);
 diff --git a/mt7915/init.c b/mt7915/init.c
-index f81a2f2..3ec9eab 100644
+index f81a2f2f..3ec9eab7 100644
 --- a/mt7915/init.c
 +++ b/mt7915/init.c
 @@ -1225,6 +1225,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
@@ -80,7 +83,7 @@
  	ret = mt7915_init_debugfs(&dev->phy);
  	if (ret)
 diff --git a/mt7915/mac.c b/mt7915/mac.c
-index a5d0b09..4604a68 100644
+index a5d0b096..4604a682 100644
 --- a/mt7915/mac.c
 +++ b/mt7915/mac.c
 @@ -738,6 +738,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -101,7 +104,7 @@
  		return id;
  
 diff --git a/mt7921/pci_mac.c b/mt7921/pci_mac.c
-index 031ba9a..4c69c55 100644
+index 031ba9aa..4c69c55c 100644
 --- a/mt7921/pci_mac.c
 +++ b/mt7921/pci_mac.c
 @@ -27,7 +27,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -114,7 +117,7 @@
  		return id;
  
 diff --git a/mt7925/pci_mac.c b/mt7925/pci_mac.c
-index 9fca887..f1d615c 100644
+index 9fca8879..f1d615c0 100644
 --- a/mt7925/pci_mac.c
 +++ b/mt7925/pci_mac.c
 @@ -27,7 +27,7 @@ int mt7925e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -127,7 +130,7 @@
  		return id;
  
 diff --git a/mt7996/init.c b/mt7996/init.c
-index 9aa97e4..7549a10 100644
+index 9aa97e4a..7549a108 100644
 --- a/mt7996/init.c
 +++ b/mt7996/init.c
 @@ -634,6 +634,8 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
@@ -157,7 +160,7 @@
  	if (ret)
  		goto error;
 diff --git a/mt7996/mac.c b/mt7996/mac.c
-index bc7111a..aa19120 100644
+index bc7111a7..aa19120b 100644
 --- a/mt7996/mac.c
 +++ b/mt7996/mac.c
 @@ -922,6 +922,7 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
@@ -178,7 +181,7 @@
  		return id;
  
 diff --git a/tx.c b/tx.c
-index ab42f69..0fdf7d8 100644
+index ab42f69b..0fdf7d83 100644
 --- a/tx.c
 +++ b/tx.c
 @@ -825,16 +825,30 @@ void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)