qdpc-host: use alloc_dma_coherent_skb().
Change-Id: I53369105fadb534184f68cead9822e3bc1e9f183
diff --git a/drivers/net/wireless/quantenna/pcie2/host/common/topaz_vnet.c b/drivers/net/wireless/quantenna/pcie2/host/common/topaz_vnet.c
index 2893fdb..d21f7bf 100644
--- a/drivers/net/wireless/quantenna/pcie2/host/common/topaz_vnet.c
+++ b/drivers/net/wireless/quantenna/pcie2/host/common/topaz_vnet.c
@@ -771,8 +771,19 @@
if (comcerto_wifi_rx_fastpath(skb))
#endif
{
- skb->protocol = eth_type_trans(skb, ndev);
- netif_receive_skb(skb);
+#ifdef CONFIG_COMCERTO_DMA_COHERENT_SKB
+ if (skb->dma_coherent) {
+ // Copy to normal memory before passing to the kernel.
+ struct sk_buff *n = skb_copy(skb, GFP_ATOMIC);
+ consume_skb(skb);
+ skb = n;
+ }
+#endif
+
+ if (skb) {
+ skb->protocol = eth_type_trans(skb, ndev);
+ netif_receive_skb(skb);
+ }
}
ndev->stats.rx_packets++;
@@ -832,11 +843,14 @@
}
spin_unlock(&vmp->rx_skb_freelist_lock);
#else
-#ifdef CONFIG_COMCERTO_ZONE_DMA_NCNB
- if (!(skb = __dev_alloc_skb(SKB_BUF_SIZE, GFP_ATOMIC | GFP_DMA_NCNB))) {
+#if defined(CONFIG_COMCERTO_ZONE_DMA_NCNB)
+ skb = __dev_alloc_skb(SKB_BUF_SIZE, GFP_ATOMIC | GFP_DMA_NCNB);
+#elif defined(CONFIG_COMCERTO_DMA_COHERENT_SKB)
+ skb = alloc_dma_coherent_skb(SKB_BUF_SIZE);
#else
- if (!(skb = dev_alloc_skb(SKB_BUF_SIZE))) {
+ skb = dev_alloc_skb(SKB_BUF_SIZE);
#endif
+ if (!skb) {
vmp->rx_skb_alloc_failures++;
vmp->rx_skb[rx_bd_index] = NULL;/* prevent old packet from passing the packet up */
return -1;