diff options
author | Sujuan Chen <sujuan.chen@mediatek.com> | 2022-11-12 16:40:34 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2022-12-01 17:29:14 +0100 |
commit | 2666bece0905a3e8ccb792602dbc76a63aaafe4b (patch) | |
tree | b2d936c2d2b53028580583f4ae664c78dd996396 /drivers/net/wireless/mediatek/mt76/tx.c | |
parent | wifi: mt76: mt7921: fix wrong power after multiple SAR set (diff) | |
download | linux-2666bece0905a3e8ccb792602dbc76a63aaafe4b.tar.xz linux-2666bece0905a3e8ccb792602dbc76a63aaafe4b.zip |
wifi: mt76: introduce rxwi and rx token utility routines
This is a preliminary patch to introduce WED RX support for mt7915.
Tested-by: Daniel Golle <daniel@makrotopia.org>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/tx.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c index 6c054850363f..24568b98ed9d 100644 --- a/drivers/net/wireless/mediatek/mt76/tx.c +++ b/drivers/net/wireless/mediatek/mt76/tx.c @@ -756,6 +756,23 @@ int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi) } EXPORT_SYMBOL_GPL(mt76_token_consume); +int mt76_rx_token_consume(struct mt76_dev *dev, void *ptr, + struct mt76_txwi_cache *t, dma_addr_t phys) +{ + int token; + + spin_lock_bh(&dev->rx_token_lock); + token = idr_alloc(&dev->rx_token, t, 0, dev->rx_token_size, + GFP_ATOMIC); + spin_unlock_bh(&dev->rx_token_lock); + + t->ptr = ptr; + t->dma_addr = phys; + + return token; +} +EXPORT_SYMBOL_GPL(mt76_rx_token_consume); + struct mt76_txwi_cache * mt76_token_release(struct mt76_dev *dev, int token, bool *wake) { @@ -784,3 +801,16 @@ mt76_token_release(struct mt76_dev *dev, int token, bool *wake) return txwi; } EXPORT_SYMBOL_GPL(mt76_token_release); + +struct mt76_txwi_cache * +mt76_rx_token_release(struct mt76_dev *dev, int token) +{ + struct mt76_txwi_cache *t; + + spin_lock_bh(&dev->rx_token_lock); + t = idr_remove(&dev->rx_token, token); + spin_unlock_bh(&dev->rx_token_lock); + + return t; +} +EXPORT_SYMBOL_GPL(mt76_rx_token_release); |