diff mbox series

[v2] mt76: mt7921s: fix missing fc type/sub-type for 802.11 pkts

Message ID 41839f21510756e08919ae7930212817e37f40f0.1644370695.git.deren.wu@mediatek.com (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series [v2] mt76: mt7921s: fix missing fc type/sub-type for 802.11 pkts | expand

Commit Message

Deren Wu Feb. 9, 2022, 1:40 a.m. UTC
From: Deren Wu <deren.wu@mediatek.com>

For non-mmio devices, should set fc values to proper txwi config

Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support")
Tested-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Leon Yen <Leon.Yen@mediatek.com>
Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
---
v2: remove is_mmio which is just used once
---
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 12 +++++++++---
 drivers/net/wireless/mediatek/mt76/mt7921/mac.h |  3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)

Comments

Lorenzo Bianconi Feb. 9, 2022, 9:50 a.m. UTC | #1
> From: Deren Wu <deren.wu@mediatek.com>
> 
> For non-mmio devices, should set fc values to proper txwi config
> 
> Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support")
> Tested-by: Sean Wang <sean.wang@mediatek.com>
> Co-developed-by: Leon Yen <Leon.Yen@mediatek.com>
> Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
> Signed-off-by: Deren Wu <deren.wu@mediatek.com>

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
> v2: remove is_mmio which is just used once
> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 12 +++++++++---
>  drivers/net/wireless/mediatek/mt76/mt7921/mac.h |  3 +++
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
> index d17558349a17..f0ebee670131 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
> @@ -912,9 +912,15 @@ mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi,
>  		txwi[3] |= cpu_to_le32(val);
>  	}
>  
> -	val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
> -	      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
> -	txwi[7] |= cpu_to_le32(val);
> +	if (mt76_is_mmio(&dev->mt76)) {
> +		val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
> +		      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
> +		txwi[7] |= cpu_to_le32(val);
> +	} else {
> +		val = FIELD_PREP(MT_TXD8_L_TYPE, fc_type) |
> +		      FIELD_PREP(MT_TXD8_L_SUB_TYPE, fc_stype);
> +		txwi[8] |= cpu_to_le32(val);
> +	}
>  }
>  
>  void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi,
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.h b/drivers/net/wireless/mediatek/mt76/mt7921/mac.h
> index 544a1c33126a..12e1cf8abe6e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.h
> @@ -284,6 +284,9 @@ enum tx_mcu_port_q_idx {
>  #define MT_TXD7_HW_AMSDU		BIT(10)
>  #define MT_TXD7_TX_TIME			GENMASK(9, 0)
>  
> +#define MT_TXD8_L_TYPE			GENMASK(5, 4)
> +#define MT_TXD8_L_SUB_TYPE		GENMASK(3, 0)
> +
>  #define MT_TX_RATE_STBC			BIT(13)
>  #define MT_TX_RATE_NSS			GENMASK(12, 10)
>  #define MT_TX_RATE_MODE			GENMASK(9, 6)
> -- 
> 2.18.0
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index d17558349a17..f0ebee670131 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -912,9 +912,15 @@  mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi,
 		txwi[3] |= cpu_to_le32(val);
 	}
 
-	val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
-	      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
-	txwi[7] |= cpu_to_le32(val);
+	if (mt76_is_mmio(&dev->mt76)) {
+		val = FIELD_PREP(MT_TXD7_TYPE, fc_type) |
+		      FIELD_PREP(MT_TXD7_SUB_TYPE, fc_stype);
+		txwi[7] |= cpu_to_le32(val);
+	} else {
+		val = FIELD_PREP(MT_TXD8_L_TYPE, fc_type) |
+		      FIELD_PREP(MT_TXD8_L_SUB_TYPE, fc_stype);
+		txwi[8] |= cpu_to_le32(val);
+	}
 }
 
 void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.h b/drivers/net/wireless/mediatek/mt76/mt7921/mac.h
index 544a1c33126a..12e1cf8abe6e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.h
@@ -284,6 +284,9 @@  enum tx_mcu_port_q_idx {
 #define MT_TXD7_HW_AMSDU		BIT(10)
 #define MT_TXD7_TX_TIME			GENMASK(9, 0)
 
+#define MT_TXD8_L_TYPE			GENMASK(5, 4)
+#define MT_TXD8_L_SUB_TYPE		GENMASK(3, 0)
+
 #define MT_TX_RATE_STBC			BIT(13)
 #define MT_TX_RATE_NSS			GENMASK(12, 10)
 #define MT_TX_RATE_MODE			GENMASK(9, 6)