mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt76u: add mt76_skb_adjust_pad utility routine
Introduce mt76_skb_adjust_pad to reuse the code adding sdio support to mt7615 driver and remove code duplication. Move 4B header configuration for usb devices out of mt76_skb_adjust_pad Signed-off-by: Lorenzo Bianconi <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
8c0a25d6a3
commit
c0cbef79eb
@@ -904,35 +904,6 @@ mt76u_tx_setup_buffers(struct mt76_dev *dev, struct sk_buff *skb,
|
||||
return urb->num_sgs;
|
||||
}
|
||||
|
||||
int mt76u_skb_dma_info(struct sk_buff *skb, u32 info)
|
||||
{
|
||||
struct sk_buff *iter, *last = skb;
|
||||
u32 pad;
|
||||
|
||||
put_unaligned_le32(info, skb_push(skb, sizeof(info)));
|
||||
/* Add zero pad of 4 - 7 bytes */
|
||||
pad = round_up(skb->len, 4) + 4 - skb->len;
|
||||
|
||||
/* First packet of a A-MSDU burst keeps track of the whole burst
|
||||
* length, need to update length of it and the last packet.
|
||||
*/
|
||||
skb_walk_frags(skb, iter) {
|
||||
last = iter;
|
||||
if (!iter->next) {
|
||||
skb->data_len += pad;
|
||||
skb->len += pad;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (skb_pad(last, pad))
|
||||
return -ENOMEM;
|
||||
__skb_put(last, pad);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76u_skb_dma_info);
|
||||
|
||||
static int
|
||||
mt76u_tx_queue_skb(struct mt76_dev *dev, enum mt76_txq_id qid,
|
||||
struct sk_buff *skb, struct mt76_wcid *wcid,
|
||||
|
||||
Reference in New Issue
Block a user