diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2019-02-20 23:35:18 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-02-26 12:25:18 +0100 |
commit | 04eb16fc70164c03ad84b7eb287c55dfbfc5e4e6 (patch) | |
tree | 59e17290fab2081e719e67c4fd601e6f6ac63813 /drivers/net/wireless/mediatek | |
parent | mt76: usb: simplify rx buffer allocation (diff) | |
download | linux-04eb16fc70164c03ad84b7eb287c55dfbfc5e4e6.tar.xz linux-04eb16fc70164c03ad84b7eb287c55dfbfc5e4e6.zip |
mt76: usb: simplify mt76u_tx_build_sg routine
Use skb_to_sgvec instad of skb_to_sgvec_nomark in mt76u_tx_build_sg.
Remove nsgs check in mt76u_tx_build_sg since it is already performed
by skb_to_sgvec
Suggested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/usb.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index 6801928cadd0..096bc99378f5 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -714,23 +714,12 @@ static int mt76u_tx_build_sg(struct mt76_dev *dev, struct sk_buff *skb, struct urb *urb) { - struct sk_buff *iter; - int nsgs; - if (!dev->usb.sg_en) return 0; - nsgs = 1 + skb_shinfo(skb)->nr_frags; - skb_walk_frags(skb, iter) - nsgs += 1 + skb_shinfo(iter)->nr_frags; - - memset(urb->sg, 0, sizeof(*urb->sg) * MT_SG_MAX_SIZE); - - nsgs = min_t(int, MT_SG_MAX_SIZE, nsgs); - sg_init_marker(urb->sg, nsgs); - urb->num_sgs = nsgs; - - return skb_to_sgvec_nomark(skb, urb->sg, 0, skb->len); + sg_init_table(urb->sg, MT_SG_MAX_SIZE); + urb->num_sgs = skb_to_sgvec(skb, urb->sg, 0, skb->len); + return urb->num_sgs; } static int |