Commit 2fe6a556 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt76u: use mt76_queue as mt76u_complete_rx context

In order to reuse mt76u_complete_rx for both data and mcu rx queue, rely
on mt76_queue as urb context in mt76u_complete_rx. Moreover set usb rx
endoint according to rx queue in mt76u_submit_rx_buf. This is a
preliminary patch to add mt7663u support
Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent ab221b20
...@@ -506,8 +506,8 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb, ...@@ -506,8 +506,8 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb,
static void mt76u_complete_rx(struct urb *urb) static void mt76u_complete_rx(struct urb *urb)
{ {
struct mt76_dev *dev = urb->context; struct mt76_dev *dev = dev_get_drvdata(&urb->dev->dev);
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; struct mt76_queue *q = urb->context;
unsigned long flags; unsigned long flags;
trace_rx_urb(dev, urb); trace_rx_urb(dev, urb);
...@@ -537,10 +537,13 @@ static void mt76u_complete_rx(struct urb *urb) ...@@ -537,10 +537,13 @@ static void mt76u_complete_rx(struct urb *urb)
} }
static int static int
mt76u_submit_rx_buf(struct mt76_dev *dev, struct urb *urb) mt76u_submit_rx_buf(struct mt76_dev *dev, enum mt76_rxq_id qid,
struct urb *urb)
{ {
mt76u_fill_bulk_urb(dev, USB_DIR_IN, MT_EP_IN_PKT_RX, urb, int ep = qid == MT_RXQ_MAIN ? MT_EP_IN_PKT_RX : MT_EP_IN_CMD_RESP;
mt76u_complete_rx, dev);
mt76u_fill_bulk_urb(dev, USB_DIR_IN, ep, urb,
mt76u_complete_rx, &dev->q_rx[qid]);
trace_submit_urb(dev, urb); trace_submit_urb(dev, urb);
return usb_submit_urb(urb, GFP_ATOMIC); return usb_submit_urb(urb, GFP_ATOMIC);
...@@ -564,7 +567,7 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q) ...@@ -564,7 +567,7 @@ mt76u_process_rx_queue(struct mt76_dev *dev, struct mt76_queue *q)
if (err < 0) if (err < 0)
break; break;
} }
mt76u_submit_rx_buf(dev, urb); mt76u_submit_rx_buf(dev, qid, urb);
} }
if (qid == MT_RXQ_MAIN) if (qid == MT_RXQ_MAIN)
mt76_rx_poll_complete(dev, MT_RXQ_MAIN, NULL); mt76_rx_poll_complete(dev, MT_RXQ_MAIN, NULL);
...@@ -588,7 +591,7 @@ static int mt76u_submit_rx_buffers(struct mt76_dev *dev) ...@@ -588,7 +591,7 @@ static int mt76u_submit_rx_buffers(struct mt76_dev *dev)
spin_lock_irqsave(&q->lock, flags); spin_lock_irqsave(&q->lock, flags);
for (i = 0; i < q->ndesc; i++) { for (i = 0; i < q->ndesc; i++) {
err = mt76u_submit_rx_buf(dev, q->entry[i].urb); err = mt76u_submit_rx_buf(dev, MT_RXQ_MAIN, q->entry[i].urb);
if (err < 0) if (err < 0)
break; break;
} }
......
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