From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 1/9] mt76: usb: fix use of q->head and q->tail
Date: Mon, 31 Aug 2020 14:25:50 +0200 [thread overview]
Message-ID: <20200831122558.1388-1-nbd@nbd.name> (raw)
Their use is reversed compared to DMA. The order for DMA makes more sense,
so let's use that
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/wireless/mediatek/mt76/usb.c | 30 ++++++++++++------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index dcab5993763a..36e6cc3535fa 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -497,8 +497,8 @@ mt76u_get_next_rx_entry(struct mt76_queue *q)
spin_lock_irqsave(&q->lock, flags);
if (q->queued > 0) {
- urb = q->entry[q->head].urb;
- q->head = (q->head + 1) % q->ndesc;
+ urb = q->entry[q->tail].urb;
+ q->tail = (q->tail + 1) % q->ndesc;
q->queued--;
}
spin_unlock_irqrestore(&q->lock, flags);
@@ -622,10 +622,10 @@ static void mt76u_complete_rx(struct urb *urb)
}
spin_lock_irqsave(&q->lock, flags);
- if (WARN_ONCE(q->entry[q->tail].urb != urb, "rx urb mismatch"))
+ if (WARN_ONCE(q->entry[q->head].urb != urb, "rx urb mismatch"))
goto out;
- q->tail = (q->tail + 1) % q->ndesc;
+ q->head = (q->head + 1) % q->ndesc;
q->queued++;
tasklet_schedule(&dev->usb.rx_tasklet);
out:
@@ -808,17 +808,17 @@ static void mt76u_tx_tasklet(unsigned long data)
q = sq->q;
while (q->queued > n_dequeued) {
- if (!q->entry[q->head].done)
+ if (!q->entry[q->tail].done)
break;
- if (q->entry[q->head].schedule) {
- q->entry[q->head].schedule = false;
+ if (q->entry[q->tail].schedule) {
+ q->entry[q->tail].schedule = false;
n_sw_dequeued++;
}
- entry = q->entry[q->head];
- q->entry[q->head].done = false;
- q->head = (q->head + 1) % q->ndesc;
+ entry = q->entry[q->tail];
+ q->entry[q->tail].done = false;
+ q->tail = (q->tail + 1) % q->ndesc;
n_dequeued++;
dev->drv->tx_complete_skb(dev, i, &entry);
@@ -913,7 +913,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
struct mt76_tx_info tx_info = {
.skb = skb,
};
- u16 idx = q->tail;
+ u16 idx = q->head;
int err;
if (q->queued == q->ndesc)
@@ -932,7 +932,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
q->entry[idx].urb, mt76u_complete_tx,
&q->entry[idx]);
- q->tail = (q->tail + 1) % q->ndesc;
+ q->head = (q->head + 1) % q->ndesc;
q->entry[idx].skb = tx_info.skb;
q->queued++;
@@ -944,7 +944,7 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
struct urb *urb;
int err;
- while (q->first != q->tail) {
+ while (q->first != q->head) {
urb = q->entry[q->first].urb;
trace_submit_urb(dev, urb);
@@ -1071,8 +1071,8 @@ void mt76u_stop_tx(struct mt76_dev *dev)
/* Assure we are in sync with killed tasklet. */
spin_lock_bh(&q->lock);
while (q->queued) {
- entry = q->entry[q->head];
- q->head = (q->head + 1) % q->ndesc;
+ entry = q->entry[q->tail];
+ q->tail = (q->tail + 1) % q->ndesc;
q->queued--;
dev->drv->tx_complete_skb(dev, i, &entry);
--
2.28.0
next reply other threads:[~2020-08-31 12:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 12:25 Felix Fietkau [this message]
2020-08-31 12:25 ` [PATCH 2/9] mt76: sdio: fix use of q->head and q->tail Felix Fietkau
2020-08-31 12:25 ` [PATCH 3/9] mt76: unify queue tx cleanup code Felix Fietkau
2020-08-31 12:25 ` [PATCH 4/9] mt76: remove qid argument to drv->tx_complete_skb Felix Fietkau
2020-08-31 12:25 ` [PATCH 5/9] mt76: remove swq from struct mt76_sw_queue Felix Fietkau
2020-08-31 12:25 ` [PATCH 6/9] mt76: rely on AQL for burst size limits on tx queueing Felix Fietkau
2020-08-31 13:11 ` Toke Høiland-Jørgensen
2020-08-31 12:25 ` [PATCH 7/9] mt76: remove struct mt76_sw_queue Felix Fietkau
2020-08-31 12:25 ` [PATCH 8/9] mt76: mt7603: tune tx ring size Felix Fietkau
2020-08-31 12:25 ` [PATCH 9/9] mt76: mt76x02: " Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200831122558.1388-1-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).