2021-05-28 14:22:50

by Lorenzo Bianconi

[permalink] [raw]
Subject: [PATCH v2] mt76: mt7921: set MT76_RESET during mac reset

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 <[email protected]>
---
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


2021-05-28 14:50:02

by Lorenzo Bianconi

[permalink] [raw]
Subject: Re: [PATCH v2] mt76: mt7921: set MT76_RESET during mac reset

> 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 <[email protected]>

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
>


Attachments:
(No filename) (2.12 kB)
signature.asc (235.00 B)
Download all attachments