ath10k support for Mindspeed features.
Add support for GFP_DMA_NCNB for descriptors and for skbs.
Change-Id: I557df691b5c6ba9ebf20a24f0cce9f7e37ebe747
diff --git a/.local-symbols b/.local-symbols
index b7d5942..0b50db1 100644
--- a/.local-symbols
+++ b/.local-symbols
@@ -158,6 +158,8 @@
ATH10K_DEBUGFS=
ATH10K_TRACING=
ATH10K_DFS_CERTIFIED=
+ATH10K_USE_NCNB_DESCR=
+ATH10K_USE_NCNB_SKB=
WCN36XX=
WCN36XX_DEBUGFS=
B43=
diff --git a/drivers/net/wireless/ath/ath10k/Kconfig b/drivers/net/wireless/ath/ath10k/Kconfig
index 489bf8b..5c53b6c 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -46,3 +46,20 @@
---help---
This option enables DFS support for initiating radiation on
ath10k.
+
+config ATH10K_USE_NCNB_DESCR
+ bool "Atheros support for GFP_DMA_NCNB for descriptors"
+ depends on ATH10K
+ default n
+ ---help---
+ This option enables use of GFP_DMA_NCNB for descriptors
+ shared with the firmware, on platforms like the Mindspeed
+ Comcerto C2000.
+
+config ATH10K_USE_NCNB_SKB
+ bool "Atheros support for GFP_DMA_NCNB for sk_buffs"
+ depends on ATH10K
+ default n
+ ---help---
+ This option enables use of GFP_DMA_NCNB for sk_buffs on
+ platforms like the Mindspeed Comcerto C2000.
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 629bd45..c498521 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -919,6 +919,7 @@
struct ath10k_ce_ring *src_ring;
u32 nentries = attr->src_nentries;
dma_addr_t base_addr;
+ gfp_t gfpflag;
nentries = roundup_pow_of_two(nentries);
@@ -932,6 +933,12 @@
src_ring->nentries = nentries;
src_ring->nentries_mask = nentries - 1;
+#ifdef CPTCFG_ATH10K_USE_NCNB_DESCR
+ gfpflag = GFP_KERNEL|__GFP_REPEAT|__GFP_HIGH|GFP_DMA_NCNB;
+#else
+ gfpflag = GFP_KERNEL|__GFP_REPEAT|__GFP_HIGH;
+#endif
+
/*
* Legacy platforms that do not support cache
* coherent DMA are unsupported
@@ -940,7 +947,8 @@
dma_alloc_coherent(ar->dev,
(nentries * sizeof(struct ce_desc) +
CE_DESC_RING_ALIGN),
- &base_addr, GFP_KERNEL|__GFP_REPEAT|__GFP_HIGH);
+ &base_addr, gfpflag);
+
if (!src_ring->base_addr_owner_space_unaligned) {
kfree(src_ring);
return ERR_PTR(-ENOMEM);
diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 5b58dbb..c9319cd 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -44,7 +44,12 @@
struct sk_buff *skb;
struct ath10k_skb_cb *skb_cb;
+#ifdef CPTCFG_ATH10K_USE_NCNB_SKB
+ skb = __dev_alloc_skb(ATH10K_HTC_CONTROL_BUFFER_SIZE,
+ GFP_DMA_NCNB | GFP_ATOMIC);
+#else
skb = dev_alloc_skb(ATH10K_HTC_CONTROL_BUFFER_SIZE);
+#endif
if (!skb) {
ath10k_warn("Unable to allocate ctrl skb\n");
return NULL;
@@ -787,7 +792,12 @@
{
struct sk_buff *skb;
+#ifdef CPTCFG_ATH10K_USE_NCNB_SKB
+ skb = __dev_alloc_skb(size + sizeof(struct ath10k_htc_hdr),
+ GFP_DMA_NCNB | GFP_ATOMIC);
+#else
skb = dev_alloc_skb(size + sizeof(struct ath10k_htc_hdr));
+#endif
if (!skb) {
ath10k_warn("could not allocate HTC tx skb\n");
return NULL;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 35f7e64..d91ba92 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -134,7 +134,12 @@
idx = __le32_to_cpu(*(htt->rx_ring.alloc_idx.vaddr));
while (num > 0) {
+#ifdef CPTCFG_ATH10K_USE_NCNB_SKB
+ skb = __dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN,
+ GFP_DMA_NCNB | GFP_ATOMIC);
+#else
skb = dev_alloc_skb(HTT_RX_BUF_SIZE + HTT_RX_DESC_ALIGN);
+#endif
if (!skb) {
ret = -ENOMEM;
goto fail;
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 427d861..279a9c9 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1042,7 +1042,12 @@
return 0;
for (i = 0; i < num; i++) {
+#ifdef CPTCFG_ATH10K_USE_NCNB_SKB
+ skb = __dev_alloc_skb(pipe_info->buf_sz,
+ GFP_DMA_NCNB | GFP_ATOMIC);
+#else
skb = dev_alloc_skb(pipe_info->buf_sz);
+#endif
if (!skb) {
ath10k_warn("failed to allocate skbuff for pipe %d\n",
num);