mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 21:36:52 +00:00
mt76x2_dma: initialize rx buf_offset in mt76x2_dma_init()
Move rx buf_offset initialization in mt76x2_dma_init() since
mt76x2_dma_cleanup() is called just in mt76pci_remove(). This allows to use
MT_RX_HEADROOM greater than mt76x2_rxwi size.
Move sanity checks on mt76x2_{t,r}xwi size in mt76x2_dma_init() as well
Signed-off-by: Lorenzo Bianconi <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
7630ee71e3
commit
88395adf18
+7
-6
@@ -272,6 +272,10 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)
|
||||
};
|
||||
int ret;
|
||||
int i;
|
||||
struct mt76_txwi_cache __maybe_unused *t;
|
||||
|
||||
BUILD_BUG_ON(sizeof(t->txwi) < sizeof(struct mt76x2_txwi));
|
||||
BUILD_BUG_ON(sizeof(struct mt76x2_rxwi) > MT_RX_HEADROOM);
|
||||
|
||||
mt76_dma_init(&dev->mt76);
|
||||
|
||||
@@ -303,6 +307,9 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev->q_rx.buf_offset = MT_RX_HEADROOM - sizeof(struct mt76x2_rxwi);
|
||||
dev->mcu.q_rx.buf_offset = MT_RX_HEADROOM - sizeof(struct mt76x2_rxwi);
|
||||
|
||||
ret = mt76x2_init_rx_queue(dev, &dev->mcu.q_rx, 1, MT_MCU_RING_SIZE,
|
||||
MT_RX_BUF_SIZE);
|
||||
if (ret)
|
||||
@@ -321,14 +328,8 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)
|
||||
|
||||
void mt76x2_dma_cleanup(struct mt76x2_dev *dev)
|
||||
{
|
||||
struct mt76_txwi_cache __maybe_unused *t;
|
||||
int i;
|
||||
|
||||
BUILD_BUG_ON(sizeof(t->txwi) < sizeof(struct mt76x2_txwi));
|
||||
BUILD_BUG_ON(MT_RX_HEADROOM < sizeof(struct mt76x2_rxwi));
|
||||
dev->q_rx.buf_offset = MT_RX_HEADROOM - sizeof(struct mt76x2_rxwi);
|
||||
dev->mcu.q_rx.buf_offset = MT_RX_HEADROOM - sizeof(struct mt76x2_rxwi);
|
||||
|
||||
tasklet_kill(&dev->tx_tasklet);
|
||||
tasklet_kill(&dev->rx_tasklet);
|
||||
for (i = 0; i < ARRAY_SIZE(dev->mt76.q_tx); i++)
|
||||
|
||||
Reference in New Issue
Block a user