Commit 92724071 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76usb: change mt76u_fill_rx_sg arguments

We do not need to pass len and sglen to the function.
Additionally pass gfp to control allocation context.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 069e2d34
...@@ -285,11 +285,13 @@ mt76u_set_endpoints(struct usb_interface *intf, ...@@ -285,11 +285,13 @@ mt76u_set_endpoints(struct usb_interface *intf,
} }
static int static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, int nsgs,
int nsgs, int len, int sglen) gfp_t gfp)
{ {
struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN];
int sglen = SKB_WITH_OVERHEAD(q->buf_size);
struct urb *urb = buf->urb; struct urb *urb = buf->urb;
int i; int i;
for (i = 0; i < nsgs; i++) { for (i = 0; i < nsgs; i++) {
...@@ -297,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf, ...@@ -297,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
void *data; void *data;
int offset; int offset;
data = page_frag_alloc(&q->rx_page, len, GFP_ATOMIC); data = page_frag_alloc(&q->rx_page, q->buf_size, gfp);
if (!data) if (!data)
break; break;
...@@ -326,8 +328,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q, ...@@ -326,8 +328,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct mt76_queue *q,
struct mt76u_buf *buf, int nsgs, gfp_t gfp) struct mt76u_buf *buf, int nsgs, gfp_t gfp)
{ {
if (dev->usb.sg_en) { if (dev->usb.sg_en) {
return mt76u_fill_rx_sg(dev, buf, nsgs, q->buf_size, return mt76u_fill_rx_sg(dev, buf, nsgs, gfp);
SKB_WITH_OVERHEAD(q->buf_size));
} else { } else {
buf->buf = page_frag_alloc(&q->rx_page, q->buf_size, gfp); buf->buf = page_frag_alloc(&q->rx_page, q->buf_size, gfp);
return buf->buf ? 0 : -ENOMEM; return buf->buf ? 0 : -ENOMEM;
......
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