mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: mt76u: introduce mt76u_skb_dma_info routine
Introduce mt76u_skb_dma_info utility routine in mt76-usb module in order to be reused adding mt7663u support Co-developed-by: Sean Wang <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
8c6cf328eb
commit
e742618fc5
@@ -881,6 +881,7 @@ mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
|
||||
return usb_bulk_msg(udev, pipe, data, len, actual_len, timeout);
|
||||
}
|
||||
|
||||
int mt76u_skb_dma_info(struct sk_buff *skb, u32 info);
|
||||
int mt76u_vendor_request(struct mt76_dev *dev, u8 req,
|
||||
u8 req_type, u16 val, u16 offset,
|
||||
void *buf, size_t len);
|
||||
|
||||
+2
-23
@@ -46,8 +46,7 @@ EXPORT_SYMBOL_GPL(mt76x02u_mac_start);
|
||||
|
||||
int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
|
||||
{
|
||||
struct sk_buff *iter, *last = skb;
|
||||
u32 info, pad;
|
||||
u32 info;
|
||||
|
||||
/* Buffer layout:
|
||||
* | 4B | xfer len | pad | 4B |
|
||||
@@ -57,28 +56,8 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
|
||||
*/
|
||||
info = FIELD_PREP(MT_TXD_INFO_LEN, round_up(skb->len, 4)) |
|
||||
FIELD_PREP(MT_TXD_INFO_DPORT, port) | flags;
|
||||
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;
|
||||
return mt76u_skb_dma_info(skb, info);
|
||||
}
|
||||
|
||||
int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data,
|
||||
|
||||
@@ -907,6 +907,35 @@ 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