mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: usb: use mt76x02u_tx_prepare_skb to fill txwi
Use mt76x02u_tx_prepare_skb routine to fill txwi in mt76x2u and mt76x0u driver and remove duplicated code. Moreover add static qualifier to mt76x02_mac_tx_rate_val and mt76x02_mac_fill_txwi routines Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
c49a3ae79f
commit
4bae980ce2
+36
-2
@@ -16,6 +16,19 @@
|
||||
|
||||
#include "mt76.h"
|
||||
#include "mt76x02_dma.h"
|
||||
#include "mt76x02_mac.h"
|
||||
#include "mt76x02_util.h"
|
||||
|
||||
static int mt76x02u_check_skb_rooms(struct sk_buff *skb)
|
||||
{
|
||||
int hdr_len = ieee80211_get_hdrlen_from_skb(skb);
|
||||
u32 need_head;
|
||||
|
||||
need_head = sizeof(struct mt76x02_txwi) + MT_DMA_HDR_LEN;
|
||||
if (hdr_len % 4)
|
||||
need_head += 2;
|
||||
return skb_cow(skb, need_head);
|
||||
}
|
||||
|
||||
int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
|
||||
{
|
||||
@@ -50,7 +63,8 @@ int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mt76x02u_set_txinfo(struct sk_buff *skb, struct mt76_wcid *wcid, u8 ep)
|
||||
static int
|
||||
mt76x02u_set_txinfo(struct sk_buff *skb, struct mt76_wcid *wcid, u8 ep)
|
||||
{
|
||||
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
|
||||
enum mt76_qsel qsel;
|
||||
@@ -69,4 +83,24 @@ int mt76x02u_set_txinfo(struct sk_buff *skb, struct mt76_wcid *wcid, u8 ep)
|
||||
|
||||
return mt76x02u_skb_dma_info(skb, WLAN_PORT, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02u_set_txinfo);
|
||||
|
||||
int mt76x02u_tx_prepare_skb(struct mt76_dev *dev, void *data,
|
||||
struct sk_buff *skb, struct mt76_queue *q,
|
||||
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
|
||||
u32 *tx_info)
|
||||
{
|
||||
struct mt76x02_txwi *txwi;
|
||||
int err, len = skb->len;
|
||||
|
||||
err = mt76x02u_check_skb_rooms(skb);
|
||||
if (err < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
mt76x02_insert_hdr_pad(skb);
|
||||
|
||||
txwi = skb_push(skb, sizeof(struct mt76x02_txwi));
|
||||
mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, len);
|
||||
|
||||
return mt76x02u_set_txinfo(skb, wcid, q2ep(q->hw_idx));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x02u_tx_prepare_skb);
|
||||
|
||||
Reference in New Issue
Block a user