Browse Source

qcacmn: check for in use flag during free

Add a in_use flag to identify if a rx desc is associated
with a valid nbuf and use this flag while freeing the nbuf.

Change-Id: Iace002ecadfd95ce60b7d1eaebc42194a433963b
CRs-fixed: 2044907
Pramod Simha 7 years ago
parent
commit
59fcb31d81
5 changed files with 18 additions and 1 deletions
  1. 11 0
      dp/wifi3.0/dp_main.c
  2. 1 0
      dp/wifi3.0/dp_rx.c
  3. 2 0
      dp/wifi3.0/dp_rx.h
  4. 2 1
      dp/wifi3.0/dp_rx_desc.c
  5. 2 0
      dp/wifi3.0/dp_rx_mon_status.c

+ 11 - 0
dp/wifi3.0/dp_main.c

@@ -403,10 +403,21 @@ static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc)
 static void dp_soc_interrupt_detach(void *txrx_soc)
 {
 	struct dp_soc *soc = (struct dp_soc *)txrx_soc;
+	int i;
 
 	qdf_timer_stop(&soc->int_timer);
 
 	qdf_timer_free(&soc->int_timer);
+
+	for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) {
+		soc->intr_ctx[i].tx_ring_mask = 0;
+		soc->intr_ctx[i].rx_ring_mask = 0;
+		soc->intr_ctx[i].rx_mon_ring_mask = 0;
+		soc->intr_ctx[i].rx_err_ring_mask = 0;
+		soc->intr_ctx[i].rx_wbm_rel_ring_mask = 0;
+		soc->intr_ctx[i].reo_status_ring_mask = 0;
+		qdf_lro_deinit(soc->intr_ctx[i].lro_ctx);
+	}
 }
 #else
 /*

+ 1 - 0
dp/wifi3.0/dp_rx.c

@@ -174,6 +174,7 @@ QDF_STATUS dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
 		next = (*desc_list)->next;
 
 		dp_rx_desc_prep(&((*desc_list)->rx_desc), rx_netbuf);
+		(*desc_list)->rx_desc.in_use = 1;
 
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
 				"rx_netbuf=%p, buf=%p, paddr=0x%llx, cookie=%d\n",

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

@@ -70,6 +70,7 @@ struct dp_rx_desc {
 #ifdef RX_DESC_DEBUG_CHECK
 	uint32_t magic;
 #endif
+	uint8_t in_use:1;
 };
 
 #define RX_DESC_COOKIE_INDEX_SHIFT		0
@@ -322,6 +323,7 @@ void dp_rx_add_to_free_desc_list(union dp_rx_desc_list_elem_t **head,
 	qdf_assert(head && new);
 
 	new->nbuf = NULL;
+	new->in_use = 0;
 
 	((union dp_rx_desc_list_elem_t *)new)->next = *head;
 	*head = (union dp_rx_desc_list_elem_t *)new;

+ 2 - 1
dp/wifi3.0/dp_rx_desc.c

@@ -55,6 +55,7 @@ QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id,
 		rx_desc_pool->array[i].next = &rx_desc_pool->array[i+1];
 		rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
 		rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
+		rx_desc_pool->array[i].rx_desc.in_use = 0;
 	}
 
 	rx_desc_pool->array[i].next = NULL;
@@ -79,7 +80,7 @@ void dp_rx_desc_pool_free(struct dp_soc *soc, uint32_t pool_id,
 
 	qdf_spin_lock_bh(&soc->rx_desc_mutex[pool_id]);
 	for (i = 0; i < rx_desc_pool->pool_size; i++) {
-		if (rx_desc_pool->array[i].rx_desc.nbuf)
+		if (rx_desc_pool->array[i].rx_desc.in_use)
 			qdf_nbuf_free(rx_desc_pool->array[i].rx_desc.nbuf);
 	}
 	qdf_mem_free(rx_desc_pool->array);

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

@@ -215,6 +215,7 @@ dp_rx_mon_status_srng_process(struct dp_soc *soc, uint32_t mac_id,
 		paddr = qdf_nbuf_get_frag_paddr(status_nbuf, 0);
 
 		rx_desc->nbuf = status_nbuf;
+		rx_desc->in_use = 1;
 
 		hal_rxdma_buff_addr_info_set(rxdma_mon_status_ring_entry,
 			paddr, rx_desc->cookie, HAL_RX_BUF_RBM_SW3_BM);
@@ -397,6 +398,7 @@ QDF_STATUS dp_rx_mon_status_buffers_replenish(struct dp_soc *dp_soc,
 		next = (*desc_list)->next;
 
 		(*desc_list)->rx_desc.nbuf = rx_netbuf;
+		(*desc_list)->rx_desc.in_use = 1;
 		hal_rxdma_buff_addr_info_set(rxdma_ring_entry, paddr,
 			(*desc_list)->rx_desc.cookie, owner);