Browse Source

qcacmn: Provide API for dp soc reinit

dp_soc_reinit is a flag to check if the
Rx descriptor memory can be reused across
WiFi up/down

Provide an API which checks the flag and
returns either true or false based on the
value set

CRs-Fixed: 2354186
Change-Id: I8c1afbfe0f743d7c9ab37a42a9ef0c6ac1fbf39c
phadiman 6 years ago
parent
commit
a1f798250d
4 changed files with 29 additions and 16 deletions
  1. 2 0
      dp/wifi3.0/dp_internal.h
  2. 19 8
      dp/wifi3.0/dp_main.c
  3. 2 2
      dp/wifi3.0/dp_rx_mon_dest.c
  4. 6 6
      dp/wifi3.0/dp_tx_desc.c

+ 2 - 0
dp/wifi3.0/dp_internal.h

@@ -807,6 +807,8 @@ static inline int dp_get_mac_id_for_mac(struct dp_soc *soc, uint32_t mac_id)
 	return 0;
 }
 
+bool dp_is_soc_reinit(struct dp_soc *soc);
+
 #ifdef WDI_EVENT_ENABLE
 QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
 				uint32_t stats_type_upload_mask,

+ 19 - 8
dp/wifi3.0/dp_main.c

@@ -1147,7 +1147,7 @@ static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng,
 	srng->alloc_size = (num_entries * entry_size) + ring_base_align - 1;
 	srng->num_entries = num_entries;
 
-	if (!soc->dp_soc_reinit) {
+	if (!dp_is_soc_reinit(soc)) {
 		srng->base_vaddr_unaligned =
 			qdf_mem_alloc_consistent(soc->osdev,
 						 soc->osdev->dev,
@@ -1269,7 +1269,7 @@ static void dp_srng_deinit(struct dp_soc *soc, struct dp_srng *srng,
 static void dp_srng_cleanup(struct dp_soc *soc, struct dp_srng *srng,
 	int ring_type, int ring_num)
 {
-	if (!soc->dp_soc_reinit) {
+	if (!dp_is_soc_reinit(soc)) {
 		if (!srng->hal_srng && (srng->alloc_size == 0)) {
 			QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
 				  FL("Ring type: %d, num:%d not setup"),
@@ -1884,7 +1884,7 @@ static int dp_hw_link_desc_pool_setup(struct dp_soc *soc)
 		total_mem_size, num_link_desc_banks);
 
 	for (i = 0; i < num_link_desc_banks; i++) {
-		if (!soc->dp_soc_reinit) {
+		if (!dp_is_soc_reinit(soc)) {
 			baseaddr = &soc->link_desc_banks[i].
 					base_paddr_unaligned;
 			soc->link_desc_banks[i].base_vaddr_unaligned =
@@ -1918,7 +1918,7 @@ static int dp_hw_link_desc_pool_setup(struct dp_soc *soc)
 		/* Allocate last bank in case total memory required is not exact
 		 * multiple of max_alloc_size
 		 */
-		if (!soc->dp_soc_reinit) {
+		if (!dp_is_soc_reinit(soc)) {
 			baseaddr = &soc->link_desc_banks[i].
 					base_paddr_unaligned;
 			soc->link_desc_banks[i].base_vaddr_unaligned =
@@ -2008,7 +2008,7 @@ static int dp_hw_link_desc_pool_setup(struct dp_soc *soc)
 
 		for (i = 0; i < num_scatter_bufs; i++) {
 			baseaddr = &soc->wbm_idle_scatter_buf_base_paddr[i];
-			if (!soc->dp_soc_reinit) {
+			if (!dp_is_soc_reinit(soc)) {
 				buf_size = soc->wbm_idle_scatter_buf_size;
 				soc->wbm_idle_scatter_buf_base_vaddr[i] =
 					qdf_mem_alloc_consistent(soc->osdev,
@@ -3169,7 +3169,7 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc,
 	struct dp_soc *soc = (struct dp_soc *)txrx_soc;
 	struct dp_pdev *pdev = NULL;
 
-	if (soc->dp_soc_reinit)
+	if (dp_is_soc_reinit(soc))
 		pdev = soc->pdev_list[pdev_id];
 	else
 		pdev = qdf_mem_malloc(sizeof(*pdev));
@@ -3684,7 +3684,7 @@ static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force)
 	struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev;
 	struct dp_soc *soc = pdev->soc;
 
-	if (soc->dp_soc_reinit) {
+	if (dp_is_soc_reinit(soc)) {
 		dp_pdev_detach(txrx_pdev, force);
 	} else {
 		dp_pdev_deinit(txrx_pdev, force);
@@ -3935,7 +3935,7 @@ static void dp_soc_detach_wifi3(void *txrx_soc)
 {
 	struct dp_soc *soc = (struct dp_soc *)txrx_soc;
 
-	if (soc->dp_soc_reinit) {
+	if (dp_is_soc_reinit(soc)) {
 		dp_soc_detach(txrx_soc);
 	} else {
 		dp_soc_deinit(txrx_soc);
@@ -9818,6 +9818,17 @@ void dp_is_hw_dbs_enable(struct dp_soc *soc,
 	*max_mac_rings = (dbs_enable)?(*max_mac_rings):1;
 }
 
+/*
+* dp_is_soc_reinit() - Check if soc reinit is true
+* @soc: DP SoC context
+*
+* Return: true or false
+*/
+bool dp_is_soc_reinit(struct dp_soc *soc)
+{
+	return soc->dp_soc_reinit;
+}
+
 /*
 * dp_set_pktlog_wifi3() - attach txrx vdev
 * @pdev: Datapath PDEV handle

+ 2 - 2
dp/wifi3.0/dp_rx_mon_dest.c

@@ -1245,7 +1245,7 @@ QDF_STATUS dp_mon_link_desc_pool_setup(struct dp_soc *soc, uint32_t mac_id)
 	for (i = 0; i < num_link_desc_banks; i++) {
 		baseaddr = &dp_pdev->link_desc_banks[mac_for_pdev][i].
 			base_paddr_unaligned;
-		if (!soc->dp_soc_reinit) {
+		if (!dp_is_soc_reinit(soc)) {
 			dp_pdev->link_desc_banks[mac_for_pdev][i].
 				base_vaddr_unaligned =
 				qdf_mem_alloc_consistent(soc->osdev,
@@ -1290,7 +1290,7 @@ QDF_STATUS dp_mon_link_desc_pool_setup(struct dp_soc *soc, uint32_t mac_id)
 		 */
 		baseaddr = &dp_pdev->link_desc_banks[mac_for_pdev][i].
 			base_paddr_unaligned;
-		if (!soc->dp_soc_reinit) {
+		if (!dp_is_soc_reinit(soc)) {
 			dp_pdev->link_desc_banks[mac_for_pdev][i].
 				base_vaddr_unaligned =
 				qdf_mem_alloc_consistent(soc->osdev,

+ 6 - 6
dp/wifi3.0/dp_tx_desc.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-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
@@ -101,7 +101,7 @@ QDF_STATUS dp_tx_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 
 	desc_size = DP_TX_DESC_SIZE(sizeof(*tx_desc_elem));
 	tx_desc_pool->elem_size = desc_size;
-	if (!soc->dp_soc_reinit)
+	if (!dp_is_soc_reinit(soc))
 		qdf_mem_multi_pages_alloc(soc->osdev,
 					  &tx_desc_pool->desc_pages,
 					  desc_size, num_elem,
@@ -196,7 +196,7 @@ QDF_STATUS dp_tx_ext_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	soc->tx_ext_desc[pool_id].elem_size = HAL_TX_EXT_DESC_WITH_META_DATA;
 	soc->tx_ext_desc[pool_id].elem_count = num_elem;
 	memctx = qdf_get_dma_mem_context((&soc->tx_ext_desc[pool_id]), memctx);
-	if (!soc->dp_soc_reinit) {
+	if (!dp_is_soc_reinit(soc)) {
 		qdf_mem_multi_pages_alloc(soc->osdev,
 					  &soc->tx_ext_desc[pool_id].
 					  desc_pages,
@@ -220,7 +220,7 @@ QDF_STATUS dp_tx_ext_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	 */
 	soc->tx_ext_desc[pool_id].link_elem_size =
 		sizeof(struct dp_tx_ext_desc_elem_s);
-	if (!soc->dp_soc_reinit) {
+	if (!dp_is_soc_reinit(soc)) {
 		qdf_mem_multi_pages_alloc(soc->osdev,
 					  &soc->tx_ext_desc[pool_id].
 					  desc_link_pages,
@@ -341,7 +341,7 @@ QDF_STATUS dp_tx_tso_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	tso_desc_pool = &soc->tx_tso_desc[pool_id];
 	tso_desc_pool->num_free = 0;
 	desc_size = DP_TX_DESC_SIZE(sizeof(struct qdf_tso_seg_elem_t));
-	if (!soc->dp_soc_reinit)
+	if (!dp_is_soc_reinit(soc))
 		qdf_mem_multi_pages_alloc(soc->osdev,
 					  &tso_desc_pool->desc_pages,
 					  desc_size,
@@ -419,7 +419,7 @@ QDF_STATUS dp_tx_tso_num_seg_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	tso_num_seg_pool = &soc->tx_tso_num_seg[pool_id];
 	tso_num_seg_pool->num_free = 0;
 	desc_size = DP_TX_DESC_SIZE(sizeof(struct qdf_tso_num_seg_elem_t));
-	if (!soc->dp_soc_reinit)
+	if (!dp_is_soc_reinit(soc))
 		qdf_mem_multi_pages_alloc(soc->osdev,
 					  &tso_num_seg_pool->desc_pages,
 					  desc_size,