qcacld-3.0: ipa data path bug fix

WDI RX ring size should be larger than RX buffer count
RX2 ring free bug fix
WDI HTT message free bug fix

Change-Id: Ib3dda42ab46d07fab1847e2590d815c851524960
CRs-fixed: 1037977
diff --git a/core/dp/htt/htt.c b/core/dp/htt/htt.c
index 0bb7b61..56f4df3 100644
--- a/core/dp/htt/htt.c
+++ b/core/dp/htt/htt.c
@@ -703,8 +703,7 @@
 
 	/* RX resource attach */
 	error = htt_rx_ipa_uc_attach(
-		pdev,
-		ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev));
+		pdev, qdf_get_pwr2(pdev->rx_ring.fill_level));
 	if (error) {
 		qdf_print("HTT IPA UC RX attach fail code %d\n", error);
 		htt_tx_ipa_uc_detach(pdev);
diff --git a/core/dp/htt/htt_h2t.c b/core/dp/htt/htt_h2t.c
index f52c064..b9bff6c 100644
--- a/core/dp/htt/htt_h2t.c
+++ b/core/dp/htt/htt_h2t.c
@@ -61,6 +61,17 @@
 	((type *)((char *)(ptr) - (char *)(&((type *)0)->member)))
 #endif
 
+#ifdef ATH_11AC_TXCOMPACT
+#define HTT_SEND_HTC_PKT(pdev, pkt)                              \
+do {                                                             \
+	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK) \
+		htt_htc_misc_pkt_list_add(pdev, pkt);            \
+} while (0)
+#else
+#define HTT_SEND_HTC_PKT(pdev, ppkt) htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
+#endif
+
+
 static void
 htt_h2t_send_complete_free_netbuf(void *pdev, A_STATUS status,
 				  qdf_nbuf_t netbuf, uint16_t msdu_id)
@@ -272,13 +283,7 @@
 			       1); /* tag - not relevant here */
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-#ifdef ATH_11AC_TXCOMPACT
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK)
-		htt_htc_misc_pkt_list_add(pdev, pkt);
-#else
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-#endif
+	HTT_SEND_HTC_PKT(pdev, pkt);
 
 	if ((pdev->cfg.is_high_latency) &&
 	    (!pdev->cfg.default_tx_comp_req))
@@ -473,13 +478,7 @@
 			       HTC_TX_PACKET_TAG_RUNTIME_PUT);
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-#ifdef ATH_11AC_TXCOMPACT
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK)
-		htt_htc_misc_pkt_list_add(pdev, pkt);
-#else
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-#endif
+	HTT_SEND_HTC_PKT(pdev, pkt);
 	return A_OK;
 }
 
@@ -765,13 +764,7 @@
 			       HTC_TX_PACKET_TAG_RUNTIME_PUT);
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-#ifdef ATH_11AC_TXCOMPACT
-	if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK)
-		htt_htc_misc_pkt_list_add(pdev, pkt);
-#else
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-#endif
+	HTT_SEND_HTC_PKT(pdev, pkt);
 
 	if ((pdev->cfg.is_high_latency) &&
 	    (!pdev->cfg.default_tx_comp_req))
@@ -938,7 +931,7 @@
 	msg_word++;
 	*msg_word = 0;
 	HTT_WDI_IPA_CFG_RX_IND_RING_SIZE_SET(*msg_word,
-		(unsigned int)ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev));
+		(unsigned int)qdf_get_pwr2(pdev->rx_ring.fill_level));
 
 	msg_word++;
 	*msg_word = 0;
@@ -970,7 +963,7 @@
 	msg_word++;
 	*msg_word = 0;
 	HTT_WDI_IPA_CFG_RX_RING2_SIZE_SET(*msg_word,
-		(unsigned int)ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev));
+		(unsigned int)qdf_get_pwr2(pdev->rx_ring.fill_level));
 
 	msg_word++;
 	*msg_word = 0;
@@ -998,9 +991,7 @@
 			       HTC_TX_PACKET_TAG_RUNTIME_PUT);
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-
+	HTT_SEND_HTC_PKT(pdev, pkt);
 	return A_OK;
 }
 #else
@@ -1072,7 +1063,7 @@
 	msg_word++;
 	*msg_word = 0;
 	HTT_WDI_IPA_CFG_RX_IND_RING_SIZE_SET(*msg_word,
-		(unsigned int)ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev));
+		(unsigned int)qdf_get_pwr2(pdev->rx_ring.fill_level));
 
 	msg_word++;
 	*msg_word = 0;
@@ -1092,9 +1083,7 @@
 			       HTC_TX_PACKET_TAG_RUNTIME_PUT);
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-
+	HTT_SEND_HTC_PKT(pdev, pkt);
 	return A_OK;
 }
 #endif
@@ -1165,9 +1154,7 @@
 			       1); /* tag - not relevant here */
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-
+	HTT_SEND_HTC_PKT(pdev, pkt);
 	return A_OK;
 }
 
@@ -1225,9 +1212,7 @@
 			       1); /* tag - not relevant here */
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
-
-	htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt);
-
+	HTT_SEND_HTC_PKT(pdev, pkt);
 	return A_OK;
 }
 #endif /* IPA_OFFLOAD */
diff --git a/core/dp/htt/htt_rx.c b/core/dp/htt/htt_rx.c
index e3f3340..dceafca 100644
--- a/core/dp/htt/htt_rx.c
+++ b/core/dp/htt/htt_rx.c
@@ -3420,10 +3420,10 @@
 			pdev->osdev, pdev->osdev->dev,
 			4,
 			pdev->ipa_uc_rx_rsc.
-			rx_ipa_prc_done_idx.vaddr,
+			rx2_ipa_prc_done_idx.vaddr,
 			pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr,
 			qdf_get_dma_mem_context((&pdev->ipa_uc_rx_rsc.
-						 rx_ipa_prc_done_idx),
+						 rx2_ipa_prc_done_idx),
 						memctx));
 	}
 }