Browse Source

Merge "qcacmn: Set pcie addr flag for IPA rings"

Linux Build Service Account 6 years ago
parent
commit
a156a519cd
6 changed files with 78 additions and 5 deletions
  1. 8 0
      dp/wifi3.0/dp_ipa.c
  2. 3 4
      dp/wifi3.0/dp_tx.c
  3. 4 0
      dp/wifi3.0/dp_tx.h
  4. 44 0
      dp/wifi3.0/dp_tx_me.c
  5. 9 1
      qdf/inc/qdf_ipa_wdi3.h
  6. 10 0
      qdf/linux/src/i_qdf_ipa_wdi3.h

+ 8 - 0
dp/wifi3.0/dp_ipa.c

@@ -803,6 +803,7 @@ static void dp_ipa_wdi_tx_params(struct dp_soc *soc,
 	/* WBM Tail Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(tx) =
 		soc->ipa_uc_tx_rsc.ipa_wbm_tp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(tx) = true;
 
 	QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(tx) =
 		qdf_mem_get_dma_addr(soc->osdev,
@@ -814,6 +815,7 @@ static void dp_ipa_wdi_tx_params(struct dp_soc *soc,
 	/* TCL Head Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(tx) =
 		soc->ipa_uc_tx_rsc.ipa_tcl_hp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(tx) = true;
 
 	QDF_IPA_WDI_SETUP_INFO_NUM_PKT_BUFFERS(tx) =
 		ipa_res->tx_num_alloc_buffer;
@@ -856,6 +858,7 @@ static void dp_ipa_wdi_rx_params(struct dp_soc *soc,
 	/* REO Tail Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(rx) =
 		soc->ipa_uc_rx_rsc.ipa_reo_tp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(rx) = true;
 
 	QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(rx) =
 		qdf_mem_get_dma_addr(soc->osdev,
@@ -867,6 +870,7 @@ static void dp_ipa_wdi_rx_params(struct dp_soc *soc,
 	/* FW Head Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(rx) =
 		soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_hp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(rx) = false;
 
 	QDF_IPA_WDI_SETUP_INFO_PKT_OFFSET(rx) =
 		RX_PKT_TLVS_LEN + L3_HEADER_PADDING;
@@ -898,6 +902,7 @@ dp_ipa_wdi_tx_smmu_params(struct dp_soc *soc,
 	/* WBM Tail Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(tx_smmu) =
 		soc->ipa_uc_tx_rsc.ipa_wbm_tp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(tx_smmu) = true;
 
 	qdf_mem_copy(&QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(tx_smmu),
 		     &ipa_res->tx_ring.sgtable,
@@ -908,6 +913,7 @@ dp_ipa_wdi_tx_smmu_params(struct dp_soc *soc,
 	/* TCL Head Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(tx_smmu) =
 		soc->ipa_uc_tx_rsc.ipa_tcl_hp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(tx_smmu) = true;
 
 	QDF_IPA_WDI_SETUP_INFO_SMMU_NUM_PKT_BUFFERS(tx_smmu) =
 		ipa_res->tx_num_alloc_buffer;
@@ -949,6 +955,7 @@ dp_ipa_wdi_rx_smmu_params(struct dp_soc *soc,
 	/* REO Tail Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(rx_smmu) =
 		soc->ipa_uc_rx_rsc.ipa_reo_tp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(rx_smmu) = true;
 
 	qdf_mem_copy(&QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(rx_smmu),
 		     &ipa_res->rx_refill_ring.sgtable,
@@ -960,6 +967,7 @@ dp_ipa_wdi_rx_smmu_params(struct dp_soc *soc,
 	/* FW Head Pointer Address */
 	QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(rx_smmu) =
 		soc->ipa_uc_rx_rsc.ipa_rx_refill_buf_hp_paddr;
+	QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(rx_smmu) = false;
 
 	QDF_IPA_WDI_SETUP_INFO_SMMU_PKT_OFFSET(rx_smmu) =
 		RX_PKT_TLVS_LEN + L3_HEADER_PADDING;

+ 3 - 4
dp/wifi3.0/dp_tx.c

@@ -203,7 +203,7 @@ static void dp_tx_tso_desc_release(struct dp_soc *soc,
  *
  * Return:
  */
-static void
+void
 dp_tx_desc_release(struct dp_tx_desc_s *tx_desc, uint8_t desc_pool_id)
 {
 	struct dp_pdev *pdev = tx_desc->pdev;
@@ -2572,8 +2572,7 @@ dp_send_completion_to_stack(struct dp_soc *soc,  struct dp_pdev *pdev,
  *
  * Return: none
  */
-static inline void dp_tx_comp_free_buf(struct dp_soc *soc,
-		struct dp_tx_desc_s *desc)
+void dp_tx_comp_free_buf(struct dp_soc *soc, struct dp_tx_desc_s *desc)
 {
 	struct dp_vdev *vdev = desc->vdev;
 	qdf_nbuf_t nbuf = desc->nbuf;
@@ -3687,8 +3686,8 @@ static void dp_tx_desc_flush(struct dp_vdev *vdev)
 		}
 	}
 }
-#endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */
 
+#endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */
 /**
  * dp_tx_vdev_detach() - detach vdev from dp tx
  * @vdev: virtual device instance

+ 4 - 0
dp/wifi3.0/dp_tx.h

@@ -229,4 +229,8 @@ static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
 	return;
 }
 /* TODO TX_FEATURE_NOT_YET */
+
+void dp_tx_comp_free_buf(struct dp_soc *soc, struct dp_tx_desc_s *desc);
+void dp_tx_desc_release(struct dp_tx_desc_s *tx_desc, uint8_t desc_pool_id);
+
 #endif

+ 44 - 0
dp/wifi3.0/dp_tx_me.c

@@ -157,6 +157,49 @@ dp_tx_me_exit(struct dp_pdev *pdev)
 	}
 }
 
+/* dp_tx_me_desc_flush() - release me resources associated to tx_desc
+ * @pdev: DP_PDEV handle
+ *
+ * This function will free all outstanding ME buffer
+ * for which either free during
+ * completion didn't happened or completion is not
+ * received.
+ */
+void dp_tx_me_desc_flush(struct dp_pdev *pdev)
+{
+	uint8_t i, num_pool;
+	uint32_t j;
+	uint32_t num_desc, page_id, offset;
+	uint16_t num_desc_per_page;
+	struct dp_soc *soc = pdev->soc;
+	struct dp_tx_desc_s *tx_desc = NULL;
+	struct dp_tx_desc_pool_s *tx_desc_pool = NULL;
+
+	num_desc = wlan_cfg_get_num_tx_desc(soc->wlan_cfg_ctx);
+	num_pool = wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx);
+
+	for (i = 0; i < num_pool; i++) {
+		tx_desc_pool = &soc->tx_desc[i];
+		if (!tx_desc_pool || !tx_desc_pool->desc_pages.cacheable_pages)
+			continue;
+
+		num_desc_per_page =
+			tx_desc_pool->desc_pages.num_element_per_page;
+		for (j = 0; j < num_desc; j++) {
+			page_id = j / num_desc_per_page;
+			offset = j % num_desc_per_page;
+			tx_desc = dp_tx_desc_find(soc, i, page_id, offset);
+
+			if (tx_desc && (tx_desc->pdev == pdev) &&
+			    (tx_desc->flags & DP_TX_DESC_FLAG_ME) &&
+			     (tx_desc->flags & DP_TX_DESC_FLAG_ALLOCATED)) {
+				dp_tx_comp_free_buf(soc, tx_desc);
+				dp_tx_desc_release(tx_desc, i);
+			}
+		}
+	}
+}
+
 /**
  * dp_tx_me_free_descriptor():free ME descriptor
  * @pdev_handle:DP_PDEV handle
@@ -169,6 +212,7 @@ dp_tx_me_free_descriptor(struct cdp_pdev *pdev_handle)
 	struct dp_pdev *pdev = (struct dp_pdev *) pdev_handle;
 	qdf_atomic_dec(&pdev->mc_num_vap_attached);
 	if (atomic_read(&pdev->mc_num_vap_attached) == 0) {
+		dp_tx_me_desc_flush(pdev);
 		dp_tx_me_exit(pdev);
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
 				"Disable MCAST_TO_UCAST");

+ 9 - 1
qdf/inc/qdf_ipa_wdi3.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -73,12 +73,16 @@ typedef __qdf_ipa_wdi_pipe_setup_info_smmu_t qdf_ipa_wdi_pipe_setup_info_smmu_t;
 	__QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_SIZE(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(txrx)
+#define QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(txrx)	\
+	__QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_SIZE(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_SIZE(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(txrx)
+#define QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(txrx)	\
+	__QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_SMMU_NUM_PKT_BUFFERS(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_SMMU_NUM_PKT_BUFFERS(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_SMMU_PKT_OFFSET(txrx)	\
@@ -202,12 +206,16 @@ typedef __qdf_ipa_wdi_pipe_setup_info_t qdf_ipa_wdi_pipe_setup_info_t;
 	__QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_SIZE(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(txrx)
+#define QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(txrx)	\
+	__QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_EVENT_RING_SIZE(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_EVENT_RING_SIZE(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(txrx)
+#define QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(txrx)	\
+	__QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_NUM_PKT_BUFFERS(txrx)	\
 	__QDF_IPA_WDI_SETUP_INFO_NUM_PKT_BUFFERS(txrx)
 #define QDF_IPA_WDI_SETUP_INFO_PKT_OFFSET(txrx)	\

+ 10 - 0
qdf/linux/src/i_qdf_ipa_wdi3.h

@@ -135,12 +135,16 @@ typedef struct ipa_wdi_pipe_setup_info  __qdf_ipa_wdi_pipe_setup_info_t;
 	(((struct ipa_wdi_pipe_setup_info *)(txrx))->transfer_ring_size)
 #define __QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info *)(txrx))->transfer_ring_doorbell_pa)
+#define __QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(txrx)  \
+	(((struct ipa_wdi_pipe_setup_info *)(txrx))->is_txr_rn_db_pcie_addr)
 #define __QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info *)(txrx))->event_ring_base_pa)
 #define __QDF_IPA_WDI_SETUP_INFO_EVENT_RING_SIZE(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info *)(txrx))->event_ring_size)
 #define __QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info *)(txrx))->event_ring_doorbell_pa)
+#define __QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(txrx) \
+	(((struct ipa_wdi_pipe_setup_info *)(txrx))->is_evt_rn_db_pcie_addr)
 #define __QDF_IPA_WDI_SETUP_INFO_NUM_PKT_BUFFERS(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info *)(txrx))->num_pkt_buffers)
 #define __QDF_IPA_WDI_SETUP_INFO_PKT_OFFSET(txrx)	\
@@ -164,12 +168,18 @@ typedef struct ipa_wdi_pipe_setup_info_smmu __qdf_ipa_wdi_pipe_setup_info_smmu_t
 	(((struct ipa_wdi_pipe_setup_info_smmu *)(txrx))->transfer_ring_size)
 #define __QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info_smmu *)(txrx))->transfer_ring_doorbell_pa)
+#define __QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(txrx)  \
+	(((struct ipa_wdi_pipe_setup_info_smmu *) \
+	  (txrx))->is_txr_rn_db_pcie_addr)
 #define __QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info_smmu *)(txrx))->event_ring_base)
 #define __QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_SIZE(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info_smmu *)(txrx))->event_ring_size)
 #define __QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info_smmu *)(txrx))->event_ring_doorbell_pa)
+#define __QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(txrx) \
+	(((struct ipa_wdi_pipe_setup_info_smmu *) \
+	  (txrx))->is_evt_rn_db_pcie_addr)
 #define __QDF_IPA_WDI_SETUP_INFO_SMMU_NUM_PKT_BUFFERS(txrx)	\
 	(((struct ipa_wdi_pipe_setup_info_smmu *)(txrx))->num_pkt_buffers)
 #define __QDF_IPA_WDI_SETUP_INFO_SMMU_PKT_OFFSET(txrx)	\