summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/util.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-02-08 01:25:50 +0100
committerJohn W. Linville <linville@tuxdriver.com>2014-02-12 21:36:14 +0100
commitdbccc92b5d543d1ead727f1416af9e113a3ccc4a (patch)
treede19768520319278f26081b60dc0cdac24338608 /drivers/net/wireless/mwifiex/util.h
parentmwifiex: implement extended scan feature (diff)
downloadlinux-dbccc92b5d543d1ead727f1416af9e113a3ccc4a.tar.xz
linux-dbccc92b5d543d1ead727f1416af9e113a3ccc4a.zip
mwifiex: balance dma map/unmap sizes
Depending on the underlying DMA implementation its not possible to partially unmap DMA buffers. Moreover its not possible to understand the intent of passing 0 as the size to dma unmap. The intent of this driver is unmap the entire skb buffer. The only way to ensure that the size matches on unmap is to store both the dma address and the size in the skb ca field. Introduce a mwifiex_dma_mapping structure which tracks the dma address and the size. Additionally, provide a mwifiex_unmap_pci_memory() that utilizes the new structure. This also provide symmetry within the internal API. Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Stewart <pstew@chromium.org> Reviewed-by: Avinash Patil <patila@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/util.h')
-rw-r--r--drivers/net/wireless/mwifiex/util.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h
index cb2d0582bd36..ddae57021397 100644
--- a/drivers/net/wireless/mwifiex/util.h
+++ b/drivers/net/wireless/mwifiex/util.h
@@ -30,8 +30,24 @@ static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb)
return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t));
}
-static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, dma_addr_t *buf_pa)
+struct mwifiex_dma_mapping {
+ dma_addr_t addr;
+ size_t len;
+};
+
+static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb,
+ struct mwifiex_dma_mapping *mapping)
{
- memcpy(buf_pa, skb->cb, sizeof(dma_addr_t));
+ memcpy(mapping, skb->cb, sizeof(*mapping));
}
+
+static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb)
+{
+ struct mwifiex_dma_mapping mapping;
+
+ MWIFIEX_SKB_PACB(skb, &mapping);
+
+ return mapping.addr;
+}
+
#endif /* !_MWIFIEX_UTIL_H_ */