1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

wifi: mt76: sdio: move mcu queue size check inside critical section

Even if it is not a real issue at the moment since concurrent access to
mcu message queue is protected by mcu mutex, make the code more robust
and move mcu queue free space check inside queue spinlock critical section.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Lorenzo Bianconi 2024-03-25 17:07:16 +01:00 committed by Felix Fietkau
parent 1ac710a6e8
commit 6d1af9b64c

View file

@ -550,10 +550,7 @@ static int
mt76s_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q, mt76s_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
struct sk_buff *skb, u32 tx_info) struct sk_buff *skb, u32 tx_info)
{ {
int ret = -ENOSPC, len = skb->len, pad; int ret, len = skb->len, pad;
if (q->queued == q->ndesc)
goto error;
pad = round_up(skb->len, 4) - skb->len; pad = round_up(skb->len, 4) - skb->len;
ret = mt76_skb_adjust_pad(skb, pad); ret = mt76_skb_adjust_pad(skb, pad);
@ -562,6 +559,12 @@ mt76s_tx_queue_skb_raw(struct mt76_dev *dev, struct mt76_queue *q,
spin_lock_bh(&q->lock); spin_lock_bh(&q->lock);
if (q->queued == q->ndesc) {
ret = -ENOSPC;
spin_unlock_bh(&q->lock);
goto error;
}
q->entry[q->head].buf_sz = len; q->entry[q->head].buf_sz = len;
q->entry[q->head].skb = skb; q->entry[q->head].skb = skb;