Skip to content

Commit

Permalink
move header pad insert/remove functions and utility header to a new c…
Browse files Browse the repository at this point in the history
…ore module

Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Felix Fietkau committed Dec 6, 2015
1 parent a0ee207 commit 1212107
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
EXTRA_CFLAGS += -Werror

obj-m := mt76x2e.o
obj-m := mt76.o mt76x2e.o

mt76-y := \
util.o

mt76x2e-y := \
mt76x2_pci.o mt76x2_dma.o \
mt76x2_main.o mt76x2_init.o mt76x2_debugfs.o mt76x2_tx.o mt76x2_util.o \
mt76x2_main.o mt76x2_init.o mt76x2_debugfs.o mt76x2_tx.o \
mt76x2_core.o mt76x2_mac.o mt76x2_eeprom.o mt76x2_mcu.o mt76x2_phy.o \
mt76x2_trace.o

Expand Down
2 changes: 1 addition & 1 deletion mt76x2.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define MT_CALIBRATE_INTERVAL HZ

#include "mt76x2_regs.h"
#include "mt76x2_util.h"
#include "util.h"
#include "mt76x2_mac.h"

struct mt76x2_queue_entry {
Expand Down
2 changes: 1 addition & 1 deletion mt76x2_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mt76x2_dma_tx_queue_skb(struct mt76x2_dev *dev, struct mt76x2_queue *q,
dma_sync_single_for_device(dev->dev, t->dma_addr, sizeof(t->txwi),
DMA_TO_DEVICE);

ret = mt76x2_insert_hdr_pad(skb);
ret = mt76_insert_hdr_pad(skb);
if (ret)
goto put_txwi;

Expand Down
2 changes: 1 addition & 1 deletion mt76x2_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb, void *rxi
int len;

if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_L2PAD))
mt76x2_remove_hdr_pad(skb);
mt76_remove_hdr_pad(skb);

if (rxwi->rxinfo & cpu_to_le32(MT_RXINFO_DECRYPT)) {
status->flag |= RX_FLAG_DECRYPTED;
Expand Down
2 changes: 0 additions & 2 deletions mt76x2_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ void mt76x2_mac_wcid_set_rate(struct mt76x2_dev *dev, struct mt76x2_wcid *wcid,
int mt76x2_mac_shared_key_setup(struct mt76x2_dev *dev, u8 vif_idx, u8 key_idx,
struct ieee80211_key_conf *key);

int mt76x2_insert_hdr_pad(struct sk_buff *skb);
void mt76x2_remove_hdr_pad(struct sk_buff *skb);
int mt76x2_mac_skb_tx_overhead(struct mt76x2_dev *dev, struct sk_buff *skb);

int mt76x2_mac_set_beacon(struct mt76x2_dev *dev, u8 vif_idx, struct sk_buff *skb);
Expand Down
7 changes: 4 additions & 3 deletions mt76x2_util.c → util.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@

#include "mt76x2.h"

void mt76x2_remove_hdr_pad(struct sk_buff *skb)
void mt76_remove_hdr_pad(struct sk_buff *skb)
{
int len = ieee80211_get_hdrlen_from_skb(skb);
memmove(skb->data + 2, skb->data, len);
skb_pull(skb, 2);
}
EXPORT_SYMBOL_GPL(mt76_remove_hdr_pad);

int mt76x2_insert_hdr_pad(struct sk_buff *skb)
int mt76_insert_hdr_pad(struct sk_buff *skb)
{
int len = ieee80211_get_hdrlen_from_skb(skb);
int ret;
Expand All @@ -39,4 +40,4 @@ int mt76x2_insert_hdr_pad(struct sk_buff *skb)
skb->data[len + 1] = 0;
return 0;
}

EXPORT_SYMBOL_GPL(mt76_insert_hdr_pad);
3 changes: 3 additions & 0 deletions mt76x2_util.h → util.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@
#define MT76_INCR(_var, _size) \
_var = (((_var) + 1) % _size)

int mt76_insert_hdr_pad(struct sk_buff *skb);
void mt76_remove_hdr_pad(struct sk_buff *skb);

#endif

0 comments on commit 1212107

Please sign in to comment.