Skip to content

Commit

Permalink
move mt76_insert_hdr_pad to mt76x2_tx.c
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Sep 4, 2016
1 parent 01c6303 commit 05e9617
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
22 changes: 21 additions & 1 deletion mt76x2_tx.c
Expand Up @@ -124,6 +124,26 @@ void mt76x2_tx_set_txpwr_auto(struct mt76x2_dev *dev, s8 txpwr)
MT_PROT_AUTO_TX_CFG_AUTO_PADJ, txpwr_adj);
}

static int mt76x2_insert_hdr_pad(struct sk_buff *skb)
{
int len = ieee80211_get_hdrlen_from_skb(skb);
int ret;

if (len % 4 == 0)
return 0;

if (skb_headroom(skb) < 2 &&
(ret = pskb_expand_head(skb, 2, 0, GFP_ATOMIC)) != 0)
return ret;

skb_push(skb, 2);
memmove(skb->data, skb->data + 2, len);

skb->data[len] = 0;
skb->data[len + 1] = 0;
return 2;
}

int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,
struct sk_buff *skb, struct mt76_queue *q,
struct mt76_wcid *wcid, struct ieee80211_sta *sta,
Expand All @@ -136,7 +156,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,

mt76x2_mac_write_txwi(dev, txwi, skb, wcid, sta);

ret = mt76_insert_hdr_pad(skb);
ret = mt76x2_insert_hdr_pad(skb);
if (ret < 0)
return ret;

Expand Down
21 changes: 0 additions & 21 deletions util.c
Expand Up @@ -17,27 +17,6 @@
#include <linux/module.h>
#include "mt76.h"

int mt76_insert_hdr_pad(struct sk_buff *skb)
{
int len = ieee80211_get_hdrlen_from_skb(skb);
int ret;

if (len % 4 == 0)
return 0;

if (skb_headroom(skb) < 2 &&
(ret = pskb_expand_head(skb, 2, 0, GFP_ATOMIC)) != 0)
return ret;

skb_push(skb, 2);
memmove(skb->data, skb->data + 2, len);

skb->data[len] = 0;
skb->data[len + 1] = 0;
return 2;
}
EXPORT_SYMBOL_GPL(mt76_insert_hdr_pad);

bool __mt76_poll(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
int timeout)
{
Expand Down
1 change: 0 additions & 1 deletion util.h
Expand Up @@ -22,7 +22,6 @@
#define MT76_INCR(_var, _size) \
_var = (((_var) + 1) % _size)

int mt76_insert_hdr_pad(struct sk_buff *skb);
int mt76_wcid_alloc(unsigned long *mask, int size);

static inline void
Expand Down

0 comments on commit 05e9617

Please sign in to comment.