Commit 85d2955e authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76usb: allocate urb and sg as linear data

Alloc sg table at the end of urb structure. This will increase
cache usage.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 7524c63f
...@@ -336,19 +336,19 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp) ...@@ -336,19 +336,19 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
static int static int
mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e) mt76u_urb_alloc(struct mt76_dev *dev, struct mt76_queue_entry *e)
{ {
struct urb *urb; unsigned int size = sizeof(struct urb);
urb = usb_alloc_urb(0, GFP_KERNEL); if (dev->usb.sg_en)
if (!urb) size += MT_SG_MAX_SIZE * sizeof(struct scatterlist);
return -ENOMEM;
e->urb = urb;
if (dev->usb.sg_en) { e->urb = kzalloc(size, GFP_KERNEL);
urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE, if (!e->urb)
sizeof(*urb->sg), GFP_KERNEL);
if (!urb->sg)
return -ENOMEM; return -ENOMEM;
}
usb_init_urb(e->urb);
if (dev->usb.sg_en)
e->urb->sg = (struct scatterlist *)(e->urb + 1);
return 0; return 0;
} }
......
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