Browse Source

qcacld-3.0: Fix IPA backward compatibility

Fix IPA WDI 1.0 update for overwrite of previous commit and use
only QCA_WIFI_3_0 build flag for qcacld-3.0.

Change-Id: I3bff4a4e10102e97aeb57fb0f67d48933e0bae9b
CRs-fixed: 994144
Rajeev Kumar 9 years ago
parent
commit
a4d80b5879
4 changed files with 99 additions and 103 deletions
  1. 0 4
      Kbuild
  2. 76 76
      core/dp/htt/htt_h2t.c
  3. 2 2
      core/dp/htt/htt_rx.c
  4. 21 21
      core/dp/htt/htt_tx.c

+ 0 - 4
Kbuild

@@ -946,10 +946,6 @@ CDEFINES += -DADRASTEA_SHADOW_REGISTERS
 CDEFINES += -DADRASTEA_RRI_ON_DDR
 endif
 
-ifneq (y,$(filter y,$(CONFIG_CNSS_EOS) $(CONFIG_ICNSS) $(CONFIG_CNSS_ADRASTEA)))
-CDEFINES += -DQCA_WIFI_2_0
-endif
-
 ifeq ($(CONFIG_WLAN_FASTPATH), y)
 CDEFINES +=	-DWLAN_FEATURE_FASTPATH
 endif

+ 76 - 76
core/dp/htt/htt_h2t.c

@@ -650,8 +650,7 @@ htt_h2t_aggr_cfg_msg(struct htt_pdev_t *pdev,
  * Return: 0 success
  *         A_NO_MEMORY No memory fail
  */
-#ifdef QCA_WIFI_2_0
-/* Rome Support only WDI 1.0 */
+#ifdef QCA_WIFI_3_0
 int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 {
 	struct htt_htc_pkt *pkt;
@@ -660,7 +659,7 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	pkt = htt_htc_pkt_alloc(pdev);
 	if (!pkt)
-		return A_NO_MEMORY;
+		return -A_NO_MEMORY;
 
 	/* show that this is not a tx frame download
 	 * (not required, but helpful)
@@ -674,7 +673,7 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 			     false);
 	if (!msg) {
 		htt_htc_pkt_free(pdev, pkt);
-		return A_NO_MEMORY;
+		return -A_NO_MEMORY;
 	}
 	/* set the length of the message */
 	qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ);
@@ -687,13 +686,17 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	*msg_word = 0;
 	HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word,
-				pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt);
+		pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt);
 	HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_CFG);
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_SET(*msg_word,
+	/* TX COMP RING BASE LO */
+	HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_LO_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_base.paddr);
+	msg_word++;
+	*msg_word = 0;
+	/* TX COMP RING BASE HI, NONE */
 
 	msg_word++;
 	*msg_word = 0;
@@ -702,18 +705,26 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_SET(*msg_word,
+	HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_LO_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr);
+	msg_word++;
+	*msg_word = 0;
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_SET(*msg_word,
+	HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_LO_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_tx_rsc.tx_ce_idx.paddr);
+	msg_word++;
+	*msg_word = 0;
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_SET(*msg_word,
+	HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_LO_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_rx_rsc.rx_ind_ring_base.paddr);
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_HI_SET(*msg_word,
+		0);
 
 	msg_word++;
 	*msg_word = 0;
@@ -722,20 +733,60 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_SET(*msg_word,
+	HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_LO_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx.paddr);
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_HI_SET(*msg_word,
+		0);
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_SET(*msg_word,
-	       (unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr);
+	HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_LO_SET(*msg_word,
+		(unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr);
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_HI_SET(*msg_word,
+		0);
+
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_LO_SET(*msg_word,
+		(unsigned int)pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.paddr);
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_HI_SET(*msg_word,
+		0);
+
+	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));
+
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_LO_SET(*msg_word,
+		(unsigned int)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr);
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_HI_SET(*msg_word,
+		0);
+
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_LO_SET(*msg_word,
+		(unsigned int)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr);
+	msg_word++;
+	*msg_word = 0;
+	HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_HI_SET(*msg_word,
+		0);
 
 	SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
 			       htt_h2t_send_complete_free_netbuf,
 			       qdf_nbuf_data(msg),
 			       qdf_nbuf_len(msg),
 			       pdev->htc_endpoint,
-			       HTC_TX_PACKET_TAG_RUNTIME_PUT);
+			       1); /* tag - not relevant here */
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
 
@@ -744,6 +795,7 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 	return A_OK;
 }
 #else
+/* Rome Support only WDI 1.0 */
 int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 {
 	struct htt_htc_pkt *pkt;
@@ -752,7 +804,7 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	pkt = htt_htc_pkt_alloc(pdev);
 	if (!pkt)
-		return -A_NO_MEMORY;
+		return A_NO_MEMORY;
 
 	/* show that this is not a tx frame download
 	 * (not required, but helpful)
@@ -766,7 +818,7 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 			     false);
 	if (!msg) {
 		htt_htc_pkt_free(pdev, pkt);
-		return -A_NO_MEMORY;
+		return A_NO_MEMORY;
 	}
 	/* set the length of the message */
 	qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ);
@@ -779,17 +831,13 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	*msg_word = 0;
 	HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word,
-		pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt);
+				pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt);
 	HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_CFG);
 
 	msg_word++;
 	*msg_word = 0;
-	/* TX COMP RING BASE LO */
-	HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_LO_SET(*msg_word,
+	HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_base.paddr);
-	msg_word++;
-	*msg_word = 0;
-	/* TX COMP RING BASE HI, NONE */
 
 	msg_word++;
 	*msg_word = 0;
@@ -798,26 +846,18 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_LO_SET(*msg_word,
+	HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr);
-	msg_word++;
-	*msg_word = 0;
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_LO_SET(*msg_word,
+	HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_tx_rsc.tx_ce_idx.paddr);
-	msg_word++;
-	*msg_word = 0;
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_LO_SET(*msg_word,
+	HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_rx_rsc.rx_ind_ring_base.paddr);
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_HI_SET(*msg_word,
-		0);
 
 	msg_word++;
 	*msg_word = 0;
@@ -826,60 +866,20 @@ int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev)
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_LO_SET(*msg_word,
+	HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_SET(*msg_word,
 		(unsigned int)pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx.paddr);
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_HI_SET(*msg_word,
-		0);
 
 	msg_word++;
 	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_LO_SET(*msg_word,
-		(unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr);
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_HI_SET(*msg_word,
-		0);
-
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_LO_SET(*msg_word,
-		(unsigned int)pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.paddr);
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_HI_SET(*msg_word,
-		0);
-
-	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));
-
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_LO_SET(*msg_word,
-		(unsigned int)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr);
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_HI_SET(*msg_word,
-		0);
-
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_LO_SET(*msg_word,
-		(unsigned int)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr);
-	msg_word++;
-	*msg_word = 0;
-	HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_HI_SET(*msg_word,
-		0);
+	HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_SET(*msg_word,
+	       (unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr);
 
 	SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
 			       htt_h2t_send_complete_free_netbuf,
 			       qdf_nbuf_data(msg),
 			       qdf_nbuf_len(msg),
 			       pdev->htc_endpoint,
-			       1); /* tag - not relevant here */
+			       HTC_TX_PACKET_TAG_RUNTIME_PUT);
 
 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
 

+ 2 - 2
core/dp/htt/htt_rx.c

@@ -2294,7 +2294,7 @@ int htt_rx_ipa_uc_alloc_wdi2_rsc(struct htt_pdev_t *pdev,
 		qdf_mem_alloc_consistent(
 			pdev->osdev, pdev->osdev->dev,
 			rx_ind_ring_elements *
-			sizeof(struct ipa_uc_rx_ring_elem_t),
+			sizeof(qdf_dma_addr_t),
 			&pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.paddr);
 	if (!pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.vaddr) {
 		qdf_print("%s: RX IND RING alloc fail", __func__);
@@ -2303,7 +2303,7 @@ int htt_rx_ipa_uc_alloc_wdi2_rsc(struct htt_pdev_t *pdev,
 
 	/* RX indication ring size, by bytes */
 	pdev->ipa_uc_rx_rsc.rx2_ind_ring_size =
-		rx_ind_ring_elements * sizeof(struct ipa_uc_rx_ring_elem_t);
+		rx_ind_ring_elements * sizeof(qdf_dma_addr_t);
 	qdf_mem_zero(pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.vaddr,
 		pdev->ipa_uc_rx_rsc.rx2_ind_ring_size);
 

+ 21 - 21
core/dp/htt/htt_tx.c

@@ -847,7 +847,7 @@ void htt_tx_desc_display(void *tx_desc)
 #endif
 
 #ifdef IPA_OFFLOAD
-#ifdef QCA_WIFI_2_0
+#ifdef QCA_WIFI_3_0
 /**
  * htt_tx_ipa_uc_wdi_tx_buf_alloc() - Alloc WDI TX buffers
  * @pdev: htt context
@@ -869,8 +869,9 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 	qdf_dma_addr_t buffer_paddr;
 	uint32_t *header_ptr;
 	uint32_t *ring_vaddr;
-#define IPA_UC_TX_BUF_FRAG_DESC_OFFSET 16
-#define IPA_UC_TX_BUF_FRAG_HDR_OFFSET 32
+#define IPA_UC_TX_BUF_FRAG_DESC_OFFSET 20
+#define IPA_UC_TX_BUF_FRAG_HDR_OFFSET 64
+#define IPA_UC_TX_BUF_TSO_HDR_SIZE 6
 
 	ring_vaddr = pdev->ipa_uc_tx_rsc.tx_comp_base.vaddr;
 	/* Allocate TX buffers as many as possible */
@@ -899,13 +900,24 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 		qdf_nbuf_map(pdev->osdev, buffer_vaddr, QDF_DMA_BIDIRECTIONAL);
 		buffer_paddr = qdf_nbuf_get_frag_paddr(buffer_vaddr, 0);
 		header_ptr++;
+
+		/* Frag Desc Pointer */
+		/* 64bits descriptor, Low 32bits */
 		*header_ptr = (uint32_t) (buffer_paddr +
 						IPA_UC_TX_BUF_FRAG_DESC_OFFSET);
 		header_ptr++;
+
+		/* 64bits descriptor, high 32bits */
+		*header_ptr = 0;
+		header_ptr++;
+
+		/* chanreq, peerid */
 		*header_ptr = 0xFFFFFFFF;
+		header_ptr++;
 
 		/* FRAG Header */
-		header_ptr++;
+		/* 6 words TSO header */
+		header_ptr += IPA_UC_TX_BUF_TSO_HDR_SIZE;
 		*header_ptr = buffer_paddr + IPA_UC_TX_BUF_FRAG_HDR_OFFSET;
 
 		*ring_vaddr = buffer_paddr;
@@ -913,7 +925,7 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 			buffer_vaddr;
 		/* Memory barrier to ensure actual value updated */
 
-		ring_vaddr++;
+		ring_vaddr += 2;
 	}
 	return tx_buffer_count;
 }
@@ -928,9 +940,8 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 	qdf_dma_addr_t buffer_paddr;
 	uint32_t *header_ptr;
 	uint32_t *ring_vaddr;
-#define IPA_UC_TX_BUF_FRAG_DESC_OFFSET 20
-#define IPA_UC_TX_BUF_FRAG_HDR_OFFSET 64
-#define IPA_UC_TX_BUF_TSO_HDR_SIZE 6
+#define IPA_UC_TX_BUF_FRAG_DESC_OFFSET 16
+#define IPA_UC_TX_BUF_FRAG_HDR_OFFSET 32
 
 	ring_vaddr = pdev->ipa_uc_tx_rsc.tx_comp_base.vaddr;
 	/* Allocate TX buffers as many as possible */
@@ -959,24 +970,13 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 		qdf_nbuf_map(pdev->osdev, buffer_vaddr, QDF_DMA_BIDIRECTIONAL);
 		buffer_paddr = qdf_nbuf_get_frag_paddr(buffer_vaddr, 0);
 		header_ptr++;
-
-		/* Frag Desc Pointer */
-		/* 64bits descriptor, Low 32bits */
 		*header_ptr = (uint32_t) (buffer_paddr +
 						IPA_UC_TX_BUF_FRAG_DESC_OFFSET);
 		header_ptr++;
-
-		/* 64bits descriptor, high 32bits */
-		*header_ptr = 0;
-		header_ptr++;
-
-		/* chanreq, peerid */
 		*header_ptr = 0xFFFFFFFF;
-		header_ptr++;
 
 		/* FRAG Header */
-		/* 6 words TSO header */
-		header_ptr += IPA_UC_TX_BUF_TSO_HDR_SIZE;
+		header_ptr++;
 		*header_ptr = buffer_paddr + IPA_UC_TX_BUF_FRAG_HDR_OFFSET;
 
 		*ring_vaddr = buffer_paddr;
@@ -984,7 +984,7 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev,
 			buffer_vaddr;
 		/* Memory barrier to ensure actual value updated */
 
-		ring_vaddr += 2;
+		ring_vaddr++;
 	}
 	return tx_buffer_count;
 }