mt76: mt7915: reset token when mac_reset happens
Reset buffering token in mt7915_mac_reset_work() to avoid possible leakege, which leads to Tx stop after mac reset. Tested-by: Bo Jiao <bo.jiao@mediatek.com> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
2a0145003a
commit
f285dfb985
|
@ -672,28 +672,12 @@ int mt7915_register_device(struct mt7915_dev *dev)
|
||||||
|
|
||||||
void mt7915_unregister_device(struct mt7915_dev *dev)
|
void mt7915_unregister_device(struct mt7915_dev *dev)
|
||||||
{
|
{
|
||||||
struct mt76_txwi_cache *txwi;
|
|
||||||
int id;
|
|
||||||
|
|
||||||
mt7915_unregister_ext_phy(dev);
|
mt7915_unregister_ext_phy(dev);
|
||||||
mt76_unregister_device(&dev->mt76);
|
mt76_unregister_device(&dev->mt76);
|
||||||
mt7915_mcu_exit(dev);
|
mt7915_mcu_exit(dev);
|
||||||
mt7915_dma_cleanup(dev);
|
mt7915_dma_cleanup(dev);
|
||||||
|
|
||||||
spin_lock_bh(&dev->token_lock);
|
mt7915_tx_token_put(dev);
|
||||||
idr_for_each_entry(&dev->token, txwi, id) {
|
|
||||||
mt7915_txp_skb_unmap(&dev->mt76, txwi);
|
|
||||||
if (txwi->skb) {
|
|
||||||
struct ieee80211_hw *hw;
|
|
||||||
|
|
||||||
hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb);
|
|
||||||
ieee80211_free_txskb(hw, txwi->skb);
|
|
||||||
}
|
|
||||||
mt76_put_txwi(&dev->mt76, txwi);
|
|
||||||
dev->token_count--;
|
|
||||||
}
|
|
||||||
spin_unlock_bh(&dev->token_lock);
|
|
||||||
idr_destroy(&dev->token);
|
|
||||||
|
|
||||||
mt76_free_device(&dev->mt76);
|
mt76_free_device(&dev->mt76);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1493,6 +1493,27 @@ mt7915_dma_reset(struct mt7915_phy *phy)
|
||||||
MT_WFDMA1_GLO_CFG_TX_DMA_EN | MT_WFDMA1_GLO_CFG_RX_DMA_EN);
|
MT_WFDMA1_GLO_CFG_TX_DMA_EN | MT_WFDMA1_GLO_CFG_RX_DMA_EN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mt7915_tx_token_put(struct mt7915_dev *dev)
|
||||||
|
{
|
||||||
|
struct mt76_txwi_cache *txwi;
|
||||||
|
int id;
|
||||||
|
|
||||||
|
spin_lock_bh(&dev->token_lock);
|
||||||
|
idr_for_each_entry(&dev->token, txwi, id) {
|
||||||
|
mt7915_txp_skb_unmap(&dev->mt76, txwi);
|
||||||
|
if (txwi->skb) {
|
||||||
|
struct ieee80211_hw *hw;
|
||||||
|
|
||||||
|
hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb);
|
||||||
|
ieee80211_free_txskb(hw, txwi->skb);
|
||||||
|
}
|
||||||
|
mt76_put_txwi(&dev->mt76, txwi);
|
||||||
|
dev->token_count--;
|
||||||
|
}
|
||||||
|
spin_unlock_bh(&dev->token_lock);
|
||||||
|
idr_destroy(&dev->token);
|
||||||
|
}
|
||||||
|
|
||||||
/* system error recovery */
|
/* system error recovery */
|
||||||
void mt7915_mac_reset_work(struct work_struct *work)
|
void mt7915_mac_reset_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
|
@ -1533,6 +1554,9 @@ void mt7915_mac_reset_work(struct work_struct *work)
|
||||||
|
|
||||||
mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_STOPPED);
|
mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_STOPPED);
|
||||||
|
|
||||||
|
mt7915_tx_token_put(dev);
|
||||||
|
idr_init(&dev->token);
|
||||||
|
|
||||||
if (mt7915_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) {
|
if (mt7915_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) {
|
||||||
mt7915_dma_reset(&dev->phy);
|
mt7915_dma_reset(&dev->phy);
|
||||||
|
|
||||||
|
|
|
@ -470,6 +470,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
|
||||||
struct ieee80211_sta *sta,
|
struct ieee80211_sta *sta,
|
||||||
struct mt76_tx_info *tx_info);
|
struct mt76_tx_info *tx_info);
|
||||||
void mt7915_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e);
|
void mt7915_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e);
|
||||||
|
void mt7915_tx_token_put(struct mt7915_dev *dev);
|
||||||
int mt7915_init_tx_queues(struct mt7915_phy *phy, int idx, int n_desc);
|
int mt7915_init_tx_queues(struct mt7915_phy *phy, int idx, int n_desc);
|
||||||
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
|
void mt7915_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
|
||||||
struct sk_buff *skb);
|
struct sk_buff *skb);
|
||||||
|
|
Loading…
Reference in New Issue