Skip to content

Commit

Permalink
mt76: connac: fw_own rely on all packet memory all being free
Browse files Browse the repository at this point in the history
If the device is MMIO-based, we must ensure all TxD/TxP on the host
memory all being consumed by the device prior to safely switching to
fw_own state.

Fixes: ec7bd7b ("mt76: connac: check wake refcount in mcu_fw_pmctrl")
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
moore-bros authored and nbd168 committed Jun 19, 2021
1 parent 2c80c02 commit 4bfa291
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt76_connac.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ mt76_connac_pm_unref(struct mt76_connac_pm *pm)
static inline bool
mt76_connac_skip_fw_pmctrl(struct mt76_phy *phy, struct mt76_connac_pm *pm)
{
struct mt76_dev *dev = phy->dev;
bool ret;

if (dev->token_count)
return true;

spin_lock_bh(&pm->wake.lock);
ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state);
spin_unlock_bh(&pm->wake.lock);
Expand Down

0 comments on commit 4bfa291

Please sign in to comment.