Commit 279ade99 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76usb: move mt76u_buf->done to queue entry

mt76_queue_entry has alreay one bool variable, adding new one will
not increase it's size. Removing ->done filed from mt76u_buf will
allow to use urb directly in mt76usb code.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 26031b39
...@@ -91,7 +91,6 @@ struct mt76_tx_info { ...@@ -91,7 +91,6 @@ struct mt76_tx_info {
struct mt76u_buf { struct mt76u_buf {
struct urb *urb; struct urb *urb;
bool done;
}; };
struct mt76_queue_entry { struct mt76_queue_entry {
...@@ -105,6 +104,7 @@ struct mt76_queue_entry { ...@@ -105,6 +104,7 @@ struct mt76_queue_entry {
}; };
enum mt76_txq_id qid; enum mt76_txq_id qid;
bool schedule; bool schedule;
bool done;
}; };
struct mt76_queue_regs { struct mt76_queue_regs {
......
...@@ -615,7 +615,6 @@ static void mt76u_tx_tasklet(unsigned long data) ...@@ -615,7 +615,6 @@ static void mt76u_tx_tasklet(unsigned long data)
struct mt76_dev *dev = (struct mt76_dev *)data; struct mt76_dev *dev = (struct mt76_dev *)data;
struct mt76_queue_entry entry; struct mt76_queue_entry entry;
struct mt76_sw_queue *sq; struct mt76_sw_queue *sq;
struct mt76u_buf *buf;
struct mt76_queue *q; struct mt76_queue *q;
bool wake; bool wake;
int i; int i;
...@@ -626,8 +625,7 @@ static void mt76u_tx_tasklet(unsigned long data) ...@@ -626,8 +625,7 @@ static void mt76u_tx_tasklet(unsigned long data)
spin_lock_bh(&q->lock); spin_lock_bh(&q->lock);
while (true) { while (true) {
buf = &q->entry[q->head].ubuf; if (!q->entry[q->head].done || !q->queued)
if (!buf->done || !q->queued)
break; break;
if (q->entry[q->head].schedule) { if (q->entry[q->head].schedule) {
...@@ -693,11 +691,11 @@ static void mt76u_tx_status_data(struct work_struct *work) ...@@ -693,11 +691,11 @@ static void mt76u_tx_status_data(struct work_struct *work)
static void mt76u_complete_tx(struct urb *urb) static void mt76u_complete_tx(struct urb *urb)
{ {
struct mt76_dev *dev = dev_get_drvdata(&urb->dev->dev); struct mt76_dev *dev = dev_get_drvdata(&urb->dev->dev);
struct mt76u_buf *buf = urb->context; struct mt76_queue_entry *e = urb->context;
if (mt76u_urb_error(urb)) if (mt76u_urb_error(urb))
dev_err(dev->dev, "tx urb failed: %d\n", urb->status); dev_err(dev->dev, "tx urb failed: %d\n", urb->status);
buf->done = true; e->done = true;
tasklet_schedule(&dev->usb.tx_tasklet); tasklet_schedule(&dev->usb.tx_tasklet);
} }
...@@ -738,15 +736,14 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid, ...@@ -738,15 +736,14 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
if (err < 0) if (err < 0)
return err; return err;
q->entry[idx].done = false;
buf = &q->entry[idx].ubuf; buf = &q->entry[idx].ubuf;
err = mt76u_tx_setup_buffers(dev, skb, buf->urb); err = mt76u_tx_setup_buffers(dev, skb, buf->urb);
if (err < 0) if (err < 0)
return err; return err;
buf->done = false;
mt76u_fill_bulk_urb(dev, USB_DIR_OUT, q2ep(q->hw_idx), mt76u_fill_bulk_urb(dev, USB_DIR_OUT, q2ep(q->hw_idx),
buf, mt76u_complete_tx, buf); buf, mt76u_complete_tx, &q->entry[idx]);
q->tail = (q->tail + 1) % q->ndesc; q->tail = (q->tail + 1) % q->ndesc;
q->entry[idx].skb = skb; q->entry[idx].skb = skb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment