From a4d80b5879fd7efa1ddb7cdee2fe672802f74ada Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Fri, 15 Apr 2016 18:03:50 -0700 Subject: [PATCH] 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 --- Kbuild | 4 - core/dp/htt/htt_h2t.c | 188 +++++++++++++++++++++--------------------- core/dp/htt/htt_rx.c | 4 +- core/dp/htt/htt_tx.c | 120 +++++++++++++-------------- 4 files changed, 156 insertions(+), 160 deletions(-) diff --git a/Kbuild b/Kbuild index 33169715e278..93c3be8e3923 100755 --- a/Kbuild +++ b/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 diff --git a/core/dp/htt/htt_h2t.c b/core/dp/htt/htt_h2t.c index 2246e7fda1b8..d472d915e591 100644 --- a/core/dp/htt/htt_h2t.c +++ b/core/dp/htt/htt_h2t.c @@ -650,100 +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 */ -int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev) -{ - struct htt_htc_pkt *pkt; - qdf_nbuf_t msg; - uint32_t *msg_word; - - pkt = htt_htc_pkt_alloc(pdev); - if (!pkt) - return A_NO_MEMORY; - - /* show that this is not a tx frame download - * (not required, but helpful) - */ - pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; - pkt->pdev_ctxt = NULL; /* not used during send-done callback */ - - /* reserve room for HTC header */ - msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_WDI_IPA_CFG_SZ), - HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, - false); - if (!msg) { - htt_htc_pkt_free(pdev, pkt); - return A_NO_MEMORY; - } - /* set the length of the message */ - qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ); - - /* fill in the message contents */ - msg_word = (uint32_t *) qdf_nbuf_data(msg); - - /* rewind beyond alignment pad to get to the HTC header reserved area */ - qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); - - *msg_word = 0; - HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word, - 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, - (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_base.paddr); - - msg_word++; - *msg_word = 0; - HTT_WDI_IPA_CFG_TX_COMP_RING_SIZE_SET(*msg_word, - (unsigned int)ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev)); - - msg_word++; - *msg_word = 0; - 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; - 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; - 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_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_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_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, - 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); - - return A_OK; -} -#else +#ifdef QCA_WIFI_3_0 int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev) { struct htt_htc_pkt *pkt; @@ -887,6 +794,99 @@ 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; + qdf_nbuf_t msg; + uint32_t *msg_word; + + pkt = htt_htc_pkt_alloc(pdev); + if (!pkt) + return A_NO_MEMORY; + + /* show that this is not a tx frame download + * (not required, but helpful) + */ + pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; + pkt->pdev_ctxt = NULL; /* not used during send-done callback */ + + /* reserve room for HTC header */ + msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_WDI_IPA_CFG_SZ), + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, + false); + if (!msg) { + htt_htc_pkt_free(pdev, pkt); + return A_NO_MEMORY; + } + /* set the length of the message */ + qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ); + + /* fill in the message contents */ + msg_word = (uint32_t *) qdf_nbuf_data(msg); + + /* rewind beyond alignment pad to get to the HTC header reserved area */ + qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); + + *msg_word = 0; + HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word, + 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, + (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_base.paddr); + + msg_word++; + *msg_word = 0; + HTT_WDI_IPA_CFG_TX_COMP_RING_SIZE_SET(*msg_word, + (unsigned int)ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev)); + + msg_word++; + *msg_word = 0; + 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; + 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; + 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_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_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_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, + 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); + + return A_OK; +} #endif /** diff --git a/core/dp/htt/htt_rx.c b/core/dp/htt/htt_rx.c index 5e7231584ad4..0064a8f282d6 100644 --- a/core/dp/htt/htt_rx.c +++ b/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); diff --git a/core/dp/htt/htt_tx.c b/core/dp/htt/htt_tx.c index ac81810b6117..5727bb5891b1 100644 --- a/core/dp/htt/htt_tx.c +++ b/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 @@ -859,65 +859,6 @@ void htt_tx_desc_display(void *tx_desc) * * Return: 0 success */ -int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev, - unsigned int uc_tx_buf_sz, - unsigned int uc_tx_buf_cnt, - unsigned int uc_tx_partition_base) -{ - unsigned int tx_buffer_count; - qdf_nbuf_t buffer_vaddr; - 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 - - ring_vaddr = pdev->ipa_uc_tx_rsc.tx_comp_base.vaddr; - /* Allocate TX buffers as many as possible */ - for (tx_buffer_count = 0; - tx_buffer_count < (uc_tx_buf_cnt - 1); tx_buffer_count++) { - buffer_vaddr = qdf_nbuf_alloc(pdev->osdev, - uc_tx_buf_sz, 0, 4, false); - if (!buffer_vaddr) { - qdf_print("%s: TX BUF alloc fail, loop index: %d", - __func__, tx_buffer_count); - return tx_buffer_count; - } - - /* Init buffer */ - qdf_mem_zero(qdf_nbuf_data(buffer_vaddr), uc_tx_buf_sz); - header_ptr = (uint32_t *) qdf_nbuf_data(buffer_vaddr); - - /* HTT control header */ - *header_ptr = HTT_IPA_UC_OFFLOAD_TX_HEADER_DEFAULT; - header_ptr++; - - /* PKT ID */ - *header_ptr |= ((uint16_t) uc_tx_partition_base + - tx_buffer_count) << 16; - - qdf_nbuf_map(pdev->osdev, buffer_vaddr, QDF_DMA_BIDIRECTIONAL); - buffer_paddr = qdf_nbuf_get_frag_paddr(buffer_vaddr, 0); - header_ptr++; - *header_ptr = (uint32_t) (buffer_paddr + - IPA_UC_TX_BUF_FRAG_DESC_OFFSET); - header_ptr++; - *header_ptr = 0xFFFFFFFF; - - /* FRAG Header */ - header_ptr++; - *header_ptr = buffer_paddr + IPA_UC_TX_BUF_FRAG_HDR_OFFSET; - - *ring_vaddr = buffer_paddr; - pdev->ipa_uc_tx_rsc.tx_buf_pool_vaddr_strg[tx_buffer_count] = - buffer_vaddr; - /* Memory barrier to ensure actual value updated */ - - ring_vaddr++; - } - return tx_buffer_count; -} -#else int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev, unsigned int uc_tx_buf_sz, unsigned int uc_tx_buf_cnt, @@ -988,6 +929,65 @@ int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev, } return tx_buffer_count; } +#else +int htt_tx_ipa_uc_wdi_tx_buf_alloc(struct htt_pdev_t *pdev, + unsigned int uc_tx_buf_sz, + unsigned int uc_tx_buf_cnt, + unsigned int uc_tx_partition_base) +{ + unsigned int tx_buffer_count; + qdf_nbuf_t buffer_vaddr; + 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 + + ring_vaddr = pdev->ipa_uc_tx_rsc.tx_comp_base.vaddr; + /* Allocate TX buffers as many as possible */ + for (tx_buffer_count = 0; + tx_buffer_count < (uc_tx_buf_cnt - 1); tx_buffer_count++) { + buffer_vaddr = qdf_nbuf_alloc(pdev->osdev, + uc_tx_buf_sz, 0, 4, false); + if (!buffer_vaddr) { + qdf_print("%s: TX BUF alloc fail, loop index: %d", + __func__, tx_buffer_count); + return tx_buffer_count; + } + + /* Init buffer */ + qdf_mem_zero(qdf_nbuf_data(buffer_vaddr), uc_tx_buf_sz); + header_ptr = (uint32_t *) qdf_nbuf_data(buffer_vaddr); + + /* HTT control header */ + *header_ptr = HTT_IPA_UC_OFFLOAD_TX_HEADER_DEFAULT; + header_ptr++; + + /* PKT ID */ + *header_ptr |= ((uint16_t) uc_tx_partition_base + + tx_buffer_count) << 16; + + qdf_nbuf_map(pdev->osdev, buffer_vaddr, QDF_DMA_BIDIRECTIONAL); + buffer_paddr = qdf_nbuf_get_frag_paddr(buffer_vaddr, 0); + header_ptr++; + *header_ptr = (uint32_t) (buffer_paddr + + IPA_UC_TX_BUF_FRAG_DESC_OFFSET); + header_ptr++; + *header_ptr = 0xFFFFFFFF; + + /* FRAG Header */ + header_ptr++; + *header_ptr = buffer_paddr + IPA_UC_TX_BUF_FRAG_HDR_OFFSET; + + *ring_vaddr = buffer_paddr; + pdev->ipa_uc_tx_rsc.tx_buf_pool_vaddr_strg[tx_buffer_count] = + buffer_vaddr; + /* Memory barrier to ensure actual value updated */ + + ring_vaddr++; + } + return tx_buffer_count; +} #endif /**