Skip to content

Commit

Permalink
mt76: remove irqsave/restore in locking for tx status fifo
Browse files Browse the repository at this point in the history
Use a separate lock and spin_trylock to avoid disabling interrupts.
Should improve performance and latency

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Mar 13, 2019
1 parent 2dc63b0 commit 312f6fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions mt76x02.h
Expand Up @@ -79,6 +79,7 @@ struct mt76x02_dev {

u8 txdone_seq;
DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);
spinlock_t txstatus_fifo_lock;

struct sk_buff *rx_head;

Expand Down
7 changes: 4 additions & 3 deletions mt76x02_mac.c
Expand Up @@ -729,7 +729,6 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
{
struct mt76x02_tx_status stat = {};
unsigned long flags;
u8 update = 1;
bool ret;

Expand All @@ -739,9 +738,11 @@ void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq)
trace_mac_txstat_poll(dev);

while (!irq || !kfifo_is_full(&dev->txstatus_fifo)) {
spin_lock_irqsave(&dev->mt76.mmio.irq_lock, flags);
if (!spin_trylock(&dev->txstatus_fifo_lock))
break;

ret = mt76x02_mac_load_tx_status(dev, &stat);
spin_unlock_irqrestore(&dev->mt76.mmio.irq_lock, flags);
spin_unlock(&dev->txstatus_fifo_lock);

if (!ret)
break;
Expand Down
1 change: 1 addition & 0 deletions mt76x02_mmio.c
Expand Up @@ -233,6 +233,7 @@ int mt76x02_dma_init(struct mt76x02_dev *dev)
tasklet_init(&dev->pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet,
(unsigned long)dev);

spin_lock_init(&dev->txstatus_fifo_lock);
kfifo_init(&dev->txstatus_fifo, status_fifo, fifo_size);

mt76_dma_attach(&dev->mt76);
Expand Down

0 comments on commit 312f6fc

Please sign in to comment.