diff mbox series

[v2] mt76: mt7921: set MT76_RESET during mac reset

Message ID f201e2d43858d022eb149a7cc29c82ea0361d328.1622210344.git.lorenzo@kernel.org (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series [v2] mt76: mt7921: set MT76_RESET during mac reset | expand

Commit Message

Lorenzo Bianconi May 28, 2021, 2 p.m. UTC
Set MT76_RESET during mt7921_mac_reset in order to avoid packet
transmissions. Move tx scheduling at the end of reset routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
Changes since v1:
- move tx scheduling at the end of reset routine
---
 .../net/wireless/mediatek/mt76/mt7921/mac.c   | 20 ++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

Comments

Lorenzo Bianconi May 28, 2021, 2:48 p.m. UTC | #1
> Set MT76_RESET during mt7921_mac_reset in order to avoid packet
> transmissions. Move tx scheduling at the end of reset routine.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>

Hi Felix,

please drop this patch, I need to fix an issue.

Regards,
Lorenzo

> ---
> Changes since v1:
> - move tx scheduling at the end of reset routine
> ---
>  .../net/wireless/mediatek/mt76/mt7921/mac.c   | 20 ++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
> index 4d1050ae9f39..baaca4eb715e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
> @@ -1255,6 +1255,7 @@ mt7921_mac_reset(struct mt7921_dev *dev)
>  	mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
>  	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
>  
> +	set_bit(MT76_RESET, &dev->mphy.state);
>  	set_bit(MT76_MCU_RESET, &dev->mphy.state);
>  	wake_up(&dev->mt76.mcu.wait);
>  	skb_queue_purge(&dev->mt76.mcu.res_q);
> @@ -1274,17 +1275,13 @@ mt7921_mac_reset(struct mt7921_dev *dev)
>  	if (err)
>  		return err;
>  
> +	clear_bit(MT76_MCU_RESET, &dev->mphy.state);
> +
>  	mt76_for_each_q_rx(&dev->mt76, i) {
>  		napi_enable(&dev->mt76.napi[i]);
>  		napi_schedule(&dev->mt76.napi[i]);
>  	}
>  
> -	napi_enable(&dev->mt76.tx_napi);
> -	napi_schedule(&dev->mt76.tx_napi);
> -	mt76_worker_enable(&dev->mt76.tx_worker);
> -
> -	clear_bit(MT76_MCU_RESET, &dev->mphy.state);
> -
>  	mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA,
>  		MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
>  		MT_INT_MCU_CMD);
> @@ -1302,7 +1299,16 @@ mt7921_mac_reset(struct mt7921_dev *dev)
>  	if (err)
>  		return err;
>  
> -	return __mt7921_start(&dev->phy);
> +	err = __mt7921_start(&dev->phy);
> +	if (err)
> +		return err;
> +
> +	clear_bit(MT76_RESET, &dev->mphy.state);
> +	napi_enable(&dev->mt76.tx_napi);
> +	napi_schedule(&dev->mt76.tx_napi);
> +	mt76_worker_enable(&dev->mt76.tx_worker);
> +
> +	return 0;
>  }
>  
>  /* system error recovery */
> -- 
> 2.31.1
>
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 4d1050ae9f39..baaca4eb715e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -1255,6 +1255,7 @@  mt7921_mac_reset(struct mt7921_dev *dev)
 	mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
 
+	set_bit(MT76_RESET, &dev->mphy.state);
 	set_bit(MT76_MCU_RESET, &dev->mphy.state);
 	wake_up(&dev->mt76.mcu.wait);
 	skb_queue_purge(&dev->mt76.mcu.res_q);
@@ -1274,17 +1275,13 @@  mt7921_mac_reset(struct mt7921_dev *dev)
 	if (err)
 		return err;
 
+	clear_bit(MT76_MCU_RESET, &dev->mphy.state);
+
 	mt76_for_each_q_rx(&dev->mt76, i) {
 		napi_enable(&dev->mt76.napi[i]);
 		napi_schedule(&dev->mt76.napi[i]);
 	}
 
-	napi_enable(&dev->mt76.tx_napi);
-	napi_schedule(&dev->mt76.tx_napi);
-	mt76_worker_enable(&dev->mt76.tx_worker);
-
-	clear_bit(MT76_MCU_RESET, &dev->mphy.state);
-
 	mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA,
 		MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
 		MT_INT_MCU_CMD);
@@ -1302,7 +1299,16 @@  mt7921_mac_reset(struct mt7921_dev *dev)
 	if (err)
 		return err;
 
-	return __mt7921_start(&dev->phy);
+	err = __mt7921_start(&dev->phy);
+	if (err)
+		return err;
+
+	clear_bit(MT76_RESET, &dev->mphy.state);
+	napi_enable(&dev->mt76.tx_napi);
+	napi_schedule(&dev->mt76.tx_napi);
+	mt76_worker_enable(&dev->mt76.tx_worker);
+
+	return 0;
 }
 
 /* system error recovery */