提交 85d2955e 编写于 作者: S Stanislaw Gruszka 提交者: 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: NStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: NFelix Fietkau <nbd@nbd.name>
上级 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);
if (dev->usb.sg_en)
size += MT_SG_MAX_SIZE * sizeof(struct scatterlist);
urb = usb_alloc_urb(0, GFP_KERNEL); e->urb = kzalloc(size, GFP_KERNEL);
if (!urb) if (!e->urb)
return -ENOMEM; return -ENOMEM;
e->urb = urb;
if (dev->usb.sg_en) { usb_init_urb(e->urb);
urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE,
sizeof(*urb->sg), GFP_KERNEL); if (dev->usb.sg_en)
if (!urb->sg) e->urb->sg = (struct scatterlist *)(e->urb + 1);
return -ENOMEM;
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册