diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2019-03-21 16:25:36 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-05-01 13:03:57 +0200 |
commit | 85d2955ea185434f874ff9c5bcf7f4b06eb0efcd (patch) | |
tree | f6bbb5dd883846a5b2ca0daa0d20c36ad1f120dd | |
parent | 7524c63f1f5b958a205537eedb4f610499bec956 (diff) |
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: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/usb.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index 0ae69c2fedaf..a80d6abee748 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -336,19 +336,19 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp) static int 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); - if (!urb) + e->urb = kzalloc(size, GFP_KERNEL); + if (!e->urb) return -ENOMEM; - e->urb = urb; - if (dev->usb.sg_en) { - urb->sg = devm_kcalloc(dev->dev, MT_SG_MAX_SIZE, - sizeof(*urb->sg), GFP_KERNEL); - if (!urb->sg) - return -ENOMEM; - } + usb_init_urb(e->urb); + + if (dev->usb.sg_en) + e->urb->sg = (struct scatterlist *)(e->urb + 1); return 0; } |