Commit 1bb78d38 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76usb: remove MT_RXQ_MAIN queue from mt76u_urb_alloc

Get the RX queue inside mt76u_refill_rx. This will allow to reuse
mt76u_urb_alloc for TX allocations.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent d7d4ea9a
......@@ -283,12 +283,10 @@ mt76u_set_endpoints(struct usb_interface *intf,
}
static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct urb *urb, int nsgs,
gfp_t gfp)
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
int nsgs, gfp_t gfp)
{
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
int sglen = SKB_WITH_OVERHEAD(q->buf_size);
int i;
for (i = 0; i < nsgs; i++) {
......@@ -321,11 +319,12 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct urb *urb, int nsgs,
}
static int
mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
struct urb *urb, int nsgs, gfp_t gfp)
mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
{
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
if (dev->usb.sg_en) {
return mt76u_fill_rx_sg(dev, urb, nsgs, gfp);
return mt76u_fill_rx_sg(dev, q, urb, nsgs, gfp);
} else {
urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
urb->transfer_buffer = page_frag_alloc(&q->rx_page,
......@@ -337,7 +336,6 @@ mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
static int
mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
{
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
struct urb *urb;
urb = usb_alloc_urb(0, GFP_KERNEL);
......@@ -354,7 +352,7 @@ mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
sg_init_table(urb->sg, MT_SG_MAX_SIZE);
}
return mt76u_refill_rx(dev, q, urb, MT_SG_MAX_SIZE, GFP_KERNEL);
return mt76u_refill_rx(dev, urb, MT_SG_MAX_SIZE, GFP_KERNEL);
}
static void mt76u_urb_free(struct urb *urb)
......@@ -521,8 +519,7 @@ static void mt76u_rx_tasklet(unsigned long data)
count = mt76u_process_rx_entry(dev, urb);
if (count > 0) {
err = mt76u_refill_rx(dev, q, urb, count,
GFP_ATOMIC);
err = mt76u_refill_rx(dev, urb, count, GFP_ATOMIC);
if (err < 0)
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