[][mac80211][mt76][Fix backports6.1 build fail]

[Description]
Fix backports6.1 build fail
- Remove redundant ieee80211_tx_status_ext in patch#0005.
- Use backports 6.1 structures in patch#3009.
- Use backports 5.15 structures in patch#9999.

[Release-log]

Change-Id: I08b94d56c8d3e9aea068b5feea84c56fe627a454
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7444189
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/0005-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/0005-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
index 07733c3..703a3bb 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/0005-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/0005-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
@@ -1,4 +1,4 @@
-From 80765449e32eba36051daeb29824cc011aecd85d Mon Sep 17 00:00:00 2001
+From e04f540b9f4ec973e0d1af2832463f771aefe2c8 Mon Sep 17 00:00:00 2001
 From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
 Date: Fri, 24 Mar 2023 18:01:27 +0800
 Subject: [PATCH] wifi: mt76: fix incorrect HE TX GI report
@@ -9,12 +9,12 @@
 ---
  mt76.h          |   4 ++
  mt7915/init.c   |   4 ++
- mt7915/mac.c    |  60 ++++++++++------
- mt7915/main.c   |   7 ++
- mt7915/mcu.c    | 183 ++++++++++++++++++++++++++++++++++++++++++++++++
- mt7915/mcu.h    |  58 +++++++++++++++
+ mt7915/mac.c    |  60 ++++++++++++------
+ mt7915/main.c   |   7 +++
+ mt7915/mcu.c    | 161 ++++++++++++++++++++++++++++++++++++++++++++++++
+ mt7915/mcu.h    |  58 +++++++++++++++++
  mt7915/mt7915.h |   6 ++
- 7 files changed, 302 insertions(+), 20 deletions(-)
+ 7 files changed, 280 insertions(+), 20 deletions(-)
 
 diff --git a/mt76.h b/mt76.h
 index 183b0fc5..11d49363 100644
@@ -217,10 +217,10 @@
  
  static void mt7915_tx(struct ieee80211_hw *hw,
 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 2a5ad033..512a9d5f 100644
+index 2a5ad033..5ee2ee2b 100644
 --- a/mt7915/mcu.c
 +++ b/mt7915/mcu.c
-@@ -3752,6 +3752,189 @@ out:
+@@ -3752,6 +3752,167 @@ out:
  	return ret;
  }
  
@@ -282,7 +282,6 @@
 +
 +int mt7915_mcu_get_tx_rate_v1(struct mt7915_phy *phy, u16 wcidx)
 +{
-+	struct ieee80211_tx_status status = {};
 +	struct mt7915_mcu_ra_info_v1 *rate;
 +	struct mt7915_dev *dev = phy->dev;
 +	struct mt76_phy *mphy = phy->mt76;
@@ -323,16 +322,6 @@
 +
 +	ret = mt7915_mcu_parse_tx_gi(mphy->dev, rate->mode, rate->gi,
 +                                     rate->bw, &wcid->rate);
-+	if (ret)
-+		goto unlock;
-+
-+	status.sta = wcid_to_sta(wcid);
-+	if (!status.sta) {
-+		ret = -EINVAL;
-+		goto unlock;
-+	}
-+	status.rate = &wcid->rate;
-+	ieee80211_tx_status_ext(mphy->hw, &status);
 +unlock:
 +	rcu_read_unlock();
 +out:
@@ -343,7 +332,6 @@
 +
 +int mt7915_mcu_get_tx_rate_v2(struct mt7915_phy *phy, u16 wcidx)
 +{
-+	struct ieee80211_tx_status status = {};
 +	struct mt7915_mcu_ra_info_v2 *rate;
 +	struct mt7915_dev *dev = phy->dev;
 +	struct mt76_phy *mphy = phy->mt76;
@@ -381,16 +369,6 @@
 +
 +	ret = mt7915_mcu_parse_tx_gi(mphy->dev, rate->mode, rate->gi,
 +                                     rate->bw, &wcid->rate);
-+	if (ret)
-+		goto unlock;
-+
-+	status.sta = wcid_to_sta(wcid);
-+	if (!status.sta) {
-+		ret = -EINVAL;
-+		goto unlock;
-+	}
-+	status.rate = &wcid->rate;
-+	ieee80211_tx_status_ext(mphy->hw, &status);
 +unlock:
 +	rcu_read_unlock();
 +out:
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/3009-wifi-mt76-mt7915-enable-PPDU-TxS-to-host-when-wed-en.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/3009-wifi-mt76-mt7915-enable-PPDU-TxS-to-host-when-wed-en.patch
index ffb0cac..54dff6d 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/3009-wifi-mt76-mt7915-enable-PPDU-TxS-to-host-when-wed-en.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/3009-wifi-mt76-mt7915-enable-PPDU-TxS-to-host-when-wed-en.patch
@@ -1,19 +1,18 @@
-From c7800e4fd168a7b2eba45098ba3bc2bb3772859c Mon Sep 17 00:00:00 2001
+From 769ca30484c3c8a3e84b11d27cf71b77cdb65c0f Mon Sep 17 00:00:00 2001
 From: Peter Chiu <chui-hao.chiu@mediatek.com>
 Date: Wed, 18 Jan 2023 11:50:38 +0800
-Subject: [PATCH 3009/3013] wifi: mt76: mt7915: enable PPDU-TxS to host when
- wed enable
+Subject: [PATCH] wifi: mt76: mt7915: enable PPDU-TxS to host when wed enable
 
 Calculate tx bytes and tx retries from PPDU-TxS
 ---
  mt76_connac_mac.c |  2 --
  mt7915/init.c     |  6 ++++++
  mt7915/mmio.c     | 21 ---------------------
- tx.c              | 14 ++++++++++++++
- 4 files changed, 20 insertions(+), 23 deletions(-)
+ tx.c              | 21 +++++++++++++++++++++
+ 4 files changed, 27 insertions(+), 23 deletions(-)
 
 diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index abcb9a2..5a5861a 100644
+index abcb9a27..5a5861a8 100644
 --- a/mt76_connac_mac.c
 +++ b/mt76_connac_mac.c
 @@ -490,8 +490,6 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
@@ -26,7 +25,7 @@
  			wcid->stats.tx_packets++;
  	}
 diff --git a/mt7915/init.c b/mt7915/init.c
-index 21286a6..6f309d0 100644
+index 21286a6d..6f309d0d 100644
 --- a/mt7915/init.c
 +++ b/mt7915/init.c
 @@ -503,6 +503,12 @@ mt7915_mac_init_band(struct mt7915_dev *dev, u8 band)
@@ -43,7 +42,7 @@
  
  static void
 diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index fc9aadb..65ee2af 100644
+index fc9aadb1..65ee2afa 100644
 --- a/mt7915/mmio.c
 +++ b/mt7915/mmio.c
 @@ -551,7 +551,6 @@ static u32 mt7915_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
@@ -94,7 +93,7 @@
  
  static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
 diff --git a/tx.c b/tx.c
-index a72b777..c3c7eb5 100644
+index 25683c1f..823c8680 100644
 --- a/tx.c
 +++ b/tx.c
 @@ -120,6 +120,7 @@ mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid,
@@ -117,23 +116,25 @@
  	if (!(info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS |
  			     IEEE80211_TX_CTL_RATE_CTRL_PROBE)))
  		return MT_PACKET_ID_NO_SKB;
-@@ -230,6 +236,7 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid,
- void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *skb,
- 			    struct list_head *free_list)
- {
-+	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- 	struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
- 	struct ieee80211_tx_status status = {
- 		.skb = skb,
-@@ -262,6 +269,13 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *
+@@ -260,8 +266,23 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *
+ #endif
+ 
  	if (cb->pktid < MT_PACKET_ID_FIRST) {
++		struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++		struct ieee80211_rate_status rs = {};
++
  		hw = mt76_tx_status_get_hw(dev, skb);
  		status.sta = wcid_to_sta(wcid);
 +		if (mtk_wed_device_active(&dev->mmio.wed) &&
 +		    (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
-+			if (status.sta) {
-+				info->status.rates[0].idx = -1;
-+				status.rate = &wcid->rate;
++			info->status.rates[0].idx = -1;
++
++			if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
++				rs.rate_idx = wcid->rate;
++				status.rates = &rs;
++				status.n_rates = 1;
++			} else {
++				status.n_rates = 0;
 +			}
 +		}
  		ieee80211_tx_status_ext(hw, &status);
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
index 996550a..f299d08 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
@@ -1,4 +1,4 @@
-From b63834891daa4a1bf052c6d67cd9c6fa3e67cbfa Mon Sep 17 00:00:00 2001
+From b423b5a658598085c00e78e6a3bfbe2c7671c147 Mon Sep 17 00:00:00 2001
 From: Evelyn Tsai <evelyn.tsai@mediatek.com>
 Date: Wed, 5 Apr 2023 08:29:19 +0800
 Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
@@ -18,11 +18,11 @@
  mt7915/main.c     |  10 +--
  mt7915/mcu.c      | 166 +++++++++++++++++++++++-----------------------
  mt7915/testmode.c |   8 +--
- tx.c              |  11 +--
- 15 files changed, 168 insertions(+), 178 deletions(-)
+ tx.c              |  26 ++------
+ 15 files changed, 172 insertions(+), 189 deletions(-)
 
 diff --git a/dma.c b/dma.c
-index 7c147c1..2169682 100644
+index 7c147c19..2169682c 100644
 --- a/dma.c
 +++ b/dma.c
 @@ -992,7 +992,7 @@ mt76_dma_init(struct mt76_dev *dev,
@@ -35,10 +35,10 @@
  		napi_enable(&dev->napi[i]);
  	}
 diff --git a/mac80211.c b/mac80211.c
-index 4dc7627..4c88710 100644
+index 7e663a5c..8ac14486 100644
 --- a/mac80211.c
 +++ b/mac80211.c
-@@ -1517,7 +1517,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
+@@ -1518,7 +1518,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);
  static void
  __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
  {
@@ -47,7 +47,7 @@
  		ieee80211_csa_finish(vif);
  }
  
-@@ -1539,7 +1539,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
+@@ -1540,7 +1540,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif)
  {
  	struct mt76_dev *dev = priv;
  
@@ -57,7 +57,7 @@
  
  	dev->csa_complete |= ieee80211_beacon_cntdwn_is_complete(vif);
 diff --git a/mt7615/dma.c b/mt7615/dma.c
-index f191443..ec729db 100644
+index f1914431..ec729dbe 100644
 --- a/mt7615/dma.c
 +++ b/mt7615/dma.c
 @@ -281,8 +281,8 @@ int mt7615_dma_init(struct mt7615_dev *dev)
@@ -72,10 +72,10 @@
  
  	mt76_poll(dev, MT_WPDMA_GLO_CFG,
 diff --git a/mt7615/main.c b/mt7615/main.c
-index ab4c1b4..8fb5b25 100644
+index dadb13f2..2c61c368 100644
 --- a/mt7615/main.c
 +++ b/mt7615/main.c
-@@ -474,7 +474,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
+@@ -473,7 +473,7 @@ static int mt7615_config(struct ieee80211_hw *hw, u32 changed)
  
  static int
  mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -84,7 +84,7 @@
  	       const struct ieee80211_tx_queue_params *params)
  {
  	struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
-@@ -556,7 +556,7 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw,
+@@ -555,7 +555,7 @@ static void mt7615_configure_filter(struct ieee80211_hw *hw,
  static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
  				    struct ieee80211_vif *vif,
  				    struct ieee80211_bss_conf *info,
@@ -93,7 +93,7 @@
  {
  	struct mt7615_dev *dev = mt7615_hw_dev(hw);
  	struct mt7615_phy *phy = mt7615_hw_phy(hw);
-@@ -599,7 +599,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
+@@ -598,7 +598,7 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
  	}
  
  	if (changed & BSS_CHANGED_ASSOC)
@@ -103,7 +103,7 @@
  	mt7615_mutex_release(dev);
  }
 diff --git a/mt7615/mcu.c b/mt7615/mcu.c
-index 4593b2e..39e81d2 100644
+index 4593b2e1..39e81d26 100644
 --- a/mt7615/mcu.c
 +++ b/mt7615/mcu.c
 @@ -353,7 +353,7 @@ out:
@@ -143,7 +143,7 @@
  		.bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
  	};
 diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index d406013..703ca73 100644
+index d4060136..703ca736 100644
 --- a/mt76_connac_mcu.c
 +++ b/mt76_connac_mcu.c
 @@ -197,7 +197,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
@@ -484,7 +484,7 @@
  	return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD(OFFLOAD), true);
  }
 diff --git a/mt76x02_mac.c b/mt76x02_mac.c
-index d3f7447..87ea3db 100644
+index d3f74473..87ea3db1 100644
 --- a/mt76x02_mac.c
 +++ b/mt76x02_mac.c
 @@ -404,7 +404,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
@@ -509,7 +509,7 @@
  		if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
  			ba_size = 0;
 diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 079629a..dcd773c 100644
+index 079629a3..dcd773c7 100644
 --- a/mt7915/debugfs.c
 +++ b/mt7915/debugfs.c
 @@ -1911,8 +1911,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
@@ -524,7 +524,7 @@
  	field = RATE_PARAM_FIXED;
  
 diff --git a/mt7915/dma.c b/mt7915/dma.c
-index 60138f5..b30e418 100644
+index 4d9ab064..a8d581d1 100644
 --- a/mt7915/dma.c
 +++ b/mt7915/dma.c
 @@ -590,8 +590,8 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
@@ -539,7 +539,7 @@
  
  	mt7915_dma_enable(dev, false);
 diff --git a/mt7915/init.c b/mt7915/init.c
-index 6f309d0..0ca7e9f 100644
+index 6f309d0d..0ca7e9f5 100644
 --- a/mt7915/init.c
 +++ b/mt7915/init.c
 @@ -1162,8 +1162,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
@@ -553,7 +553,7 @@
  
  		if (band == NL80211_BAND_6GHZ) {
 diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 7690cc3..d31f235 100644
+index 596faf00..583bb554 100644
 --- a/mt7915/mac.c
 +++ b/mt7915/mac.c
 @@ -882,7 +882,7 @@ mt7915_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
@@ -566,10 +566,10 @@
  
  	tid = le32_get_bits(txwi[1], MT_TXD1_TID);
 diff --git a/mt7915/main.c b/mt7915/main.c
-index 7cc3a99..04c7b99 100644
+index 712f77fc..c51dcd30 100644
 --- a/mt7915/main.c
 +++ b/mt7915/main.c
-@@ -531,7 +531,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
+@@ -530,7 +530,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
  
  static int
  mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -578,7 +578,7 @@
  	       const struct ieee80211_tx_queue_params *params)
  {
  	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
-@@ -626,7 +626,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
+@@ -625,7 +625,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
  static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
  				    struct ieee80211_vif *vif,
  				    struct ieee80211_bss_conf *info,
@@ -587,7 +587,7 @@
  {
  	struct mt7915_phy *phy = mt7915_hw_phy(hw);
  	struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -646,7 +646,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
+@@ -645,7 +645,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
  	}
  
  	if (changed & BSS_CHANGED_ASSOC)
@@ -596,7 +596,7 @@
  
  	if (changed & BSS_CHANGED_ERP_CTS_PROT)
  		mt7915_mac_enable_rtscts(dev, vif, info->use_cts_prot);
-@@ -1242,10 +1242,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
+@@ -1241,10 +1241,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
  {
  	struct mt7915_phy *phy = mt7915_hw_phy(hw);
  	struct mt7915_dev *dev = mt7915_hw_dev(hw);
@@ -610,7 +610,7 @@
  
  	mutex_lock(&dev->mt76.mutex);
 diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 083034e..136dbae 100644
+index 062e8aca..bbd3ce47 100644
 --- a/mt7915/mcu.c
 +++ b/mt7915/mcu.c
 @@ -64,7 +64,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
@@ -1130,7 +1130,7 @@
  					len = sku_len[SKU_HE_RU242] * 4;
  				}
 diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index f3b9392..95d3a6d 100644
+index b99bed54..8b9813b4 100644
 --- a/mt7915/testmode.c
 +++ b/mt7915/testmode.c
 @@ -397,12 +397,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
@@ -1151,7 +1151,7 @@
  	sta->wme = 1;
  
 diff --git a/tx.c b/tx.c
-index c3c7eb5..57f10f4 100644
+index 823c8680..607f494a 100644
 --- a/tx.c
 +++ b/tx.c
 @@ -60,20 +60,15 @@ mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list)
@@ -1178,6 +1178,39 @@
  		}
  
  		hw = mt76_tx_status_get_hw(dev, skb);
+@@ -236,6 +231,7 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid,
+ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *skb,
+ 			    struct list_head *free_list)
+ {
++	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ 	struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb);
+ 	struct ieee80211_tx_status status = {
+ 		.skb = skb,
+@@ -266,21 +262,13 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *
+ #endif
+ 
+ 	if (cb->pktid < MT_PACKET_ID_FIRST) {
+-		struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+-		struct ieee80211_rate_status rs = {};
+-
+ 		hw = mt76_tx_status_get_hw(dev, skb);
+ 		status.sta = wcid_to_sta(wcid);
+ 		if (mtk_wed_device_active(&dev->mmio.wed) &&
+ 		    (info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)) {
+-			info->status.rates[0].idx = -1;
+-
+-			if (status.sta && (wcid->rate.flags || wcid->rate.legacy)) {
+-				rs.rate_idx = wcid->rate;
+-				status.rates = &rs;
+-				status.n_rates = 1;
+-			} else {
+-				status.n_rates = 0;
++			if (status.sta) {
++				info->status.rates[0].idx = -1;
++				status.rate = &wcid->rate;
+ 			}
+ 		}
+ 		ieee80211_tx_status_ext(hw, &status);
 -- 
 2.18.0