From 1212107d7b3f5d239875e2e1efff0dd919e6c6c6 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 6 Dec 2015 17:01:42 +0100 Subject: [PATCH] move header pad insert/remove functions and utility header to a new core module Signed-off-by: Felix Fietkau --- Makefile | 7 +++++-- mt76x2.h | 2 +- mt76x2_dma.c | 2 +- mt76x2_mac.c | 2 +- mt76x2_mac.h | 2 -- mt76x2_util.c => util.c | 7 ++++--- mt76x2_util.h => util.h | 3 +++ 7 files changed, 15 insertions(+), 10 deletions(-) rename mt76x2_util.c => util.c (83%) rename mt76x2_util.h => util.h (96%) diff --git a/Makefile b/Makefile index 8a99a7a5b..f7bfc39e1 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/mt76x2.h b/mt76x2.h index 6ec3e2d8f..fb9fe6328 100644 --- a/mt76x2.h +++ b/mt76x2.h @@ -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 { diff --git a/mt76x2_dma.c b/mt76x2_dma.c index b3f6197cf..41f0ff4d6 100644 --- a/mt76x2_dma.c +++ b/mt76x2_dma.c @@ -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; diff --git a/mt76x2_mac.c b/mt76x2_mac.c index 879af3d0d..aa10b082d 100644 --- a/mt76x2_mac.c +++ b/mt76x2_mac.c @@ -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; diff --git a/mt76x2_mac.h b/mt76x2_mac.h index 33002470c..b372f4aa1 100644 --- a/mt76x2_mac.h +++ b/mt76x2_mac.h @@ -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); diff --git a/mt76x2_util.c b/util.c similarity index 83% rename from mt76x2_util.c rename to util.c index 3269c0698..a00a71d01 100644 --- a/mt76x2_util.c +++ b/util.c @@ -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; @@ -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); diff --git a/mt76x2_util.h b/util.h similarity index 96% rename from mt76x2_util.h rename to util.h index 1eb4ee149..7ca2e8731 100644 --- a/mt76x2_util.h +++ b/util.h @@ -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