mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: move token utilities in mt76 common module
Move token management in mt76 common module since it is shared between mt7615, mt7915 and mt7921 drivers Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
ade1f5aad4
commit
8d5c456be1
+1
-5
@@ -1465,11 +1465,7 @@ mt7615_mac_tx_free_token(struct mt7615_dev *dev, u16 token)
|
||||
u8 wcid;
|
||||
|
||||
trace_mac_tx_free(dev, token);
|
||||
|
||||
spin_lock_bh(&mdev->token_lock);
|
||||
txwi = idr_remove(&mdev->token, token);
|
||||
spin_unlock_bh(&mdev->token_lock);
|
||||
|
||||
txwi = mt76_token_put(mdev, token);
|
||||
if (!txwi)
|
||||
return;
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
|
||||
.survey_flags = SURVEY_INFO_TIME_TX |
|
||||
SURVEY_INFO_TIME_RX |
|
||||
SURVEY_INFO_TIME_BSS_RX,
|
||||
.token_size = MT7615_TOKEN_SIZE,
|
||||
.tx_prepare_skb = mt7615_tx_prepare_skb,
|
||||
.tx_complete_skb = mt7615_tx_complete_skb,
|
||||
.rx_skb = mt7615_queue_rx_skb,
|
||||
|
||||
+1
-2
@@ -40,8 +40,7 @@ static int mt7615_init_hardware(struct mt7615_dev *dev)
|
||||
mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
|
||||
|
||||
INIT_WORK(&dev->mcu_work, mt7615_pci_init_work);
|
||||
spin_lock_init(&dev->mt76.token_lock);
|
||||
idr_init(&dev->mt76.token);
|
||||
mt76_token_init(&dev->mt76);
|
||||
|
||||
ret = mt7615_eeprom_init(dev, addr);
|
||||
if (ret < 0)
|
||||
|
||||
+2
-6
@@ -37,9 +37,7 @@ void mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e)
|
||||
token = le16_to_cpu(txp->hw.msdu_id[0]) &
|
||||
~MT_MSDU_ID_VALID;
|
||||
|
||||
spin_lock_bh(&mdev->token_lock);
|
||||
t = idr_remove(&mdev->token, token);
|
||||
spin_unlock_bh(&mdev->token_lock);
|
||||
t = mt76_token_put(mdev, token);
|
||||
e->skb = t ? t->skb : NULL;
|
||||
}
|
||||
|
||||
@@ -161,9 +159,7 @@ int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
|
||||
t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
|
||||
t->skb = tx_info->skb;
|
||||
|
||||
spin_lock_bh(&mdev->token_lock);
|
||||
id = idr_alloc(&mdev->token, t, 0, MT7615_TOKEN_SIZE, GFP_ATOMIC);
|
||||
spin_unlock_bh(&mdev->token_lock);
|
||||
id = mt76_token_get(mdev, &t);
|
||||
if (id < 0)
|
||||
return id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user