summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/util.c
diff options
context:
space:
mode:
authorAvinash Patil <patila@marvell.com>2015-02-13 13:11:08 +0100
committerKalle Valo <kvalo@codeaurora.org>2015-02-27 09:12:44 +0100
commit31def91b3a192bd414d87b3a408de34eed94d616 (patch)
tree16c8b41024c1a91138ada14cc577c3627037c61e /drivers/net/wireless/mwifiex/util.c
parentmwifiex: modify TX buff size for SD8887 (diff)
downloadlinux-31def91b3a192bd414d87b3a408de34eed94d616.tar.xz
linux-31def91b3a192bd414d87b3a408de34eed94d616.zip
mwifiex: DMA alignment for RX packets
This patch adds support for DMA alignment of sk_buffs allocated for RX. Patch also adds support to modify skb allocation flags. Signed-off-by: Marc Yang <yangyang@marvell.com> Signed-off-by: Qingshui Gao <gaoqs@marvell.com> Signed-off-by: Cathy Luo <cluo@marvell.com> Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/mwifiex/util.c')
-rw-r--r--drivers/net/wireless/mwifiex/util.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index 47e215b6d5f5..2148a573396b 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -631,3 +631,26 @@ void mwifiex_hist_data_reset(struct mwifiex_private *priv)
for (ix = 0; ix < MWIFIEX_MAX_SIG_STRENGTH; ix++)
atomic_set(&phist_data->sig_str[ix], 0);
}
+
+void *mwifiex_alloc_rx_buf(int rx_len, gfp_t flags)
+{
+ struct sk_buff *skb;
+ int buf_len, pad;
+
+ buf_len = rx_len + MWIFIEX_RX_HEADROOM + MWIFIEX_DMA_ALIGN_SZ;
+
+ skb = __dev_alloc_skb(buf_len, flags);
+
+ if (!skb)
+ return NULL;
+
+ skb_reserve(skb, MWIFIEX_RX_HEADROOM);
+
+ pad = MWIFIEX_ALIGN_ADDR(skb->data, MWIFIEX_DMA_ALIGN_SZ) -
+ (long)skb->data;
+
+ skb_reserve(skb, pad);
+
+ return skb;
+}
+EXPORT_SYMBOL_GPL(mwifiex_alloc_rx_buf);