Sfoglia il codice sorgente

qcacmn: change pool id validation for mon status ring process

Pool id validation should not be against MAX_PDEV_CNT because pool id
1 is valid in case of monitor status ring process. Hence, added a new
API dp_get_rx_mon_status_desc_from_cookie() which validate the pool id
against NUM_RXDMA_RINGS_PER_PDEV to get rx_desc from rx_desc_status pool.

Change-Id: I20baf8c667c1983eff08a204afe3736708d844d1
CRs-Fixed: 3262544
Venkateswara Naralasetty 2 anni fa
parent
commit
4fc084d9c6
1 ha cambiato i file con 25 aggiunte e 1 eliminazioni
  1. 25 1
      dp/wifi3.0/dp_rx.h

+ 25 - 1
dp/wifi3.0/dp_rx.h

@@ -556,6 +556,28 @@ struct dp_rx_desc *dp_get_rx_desc_from_cookie(struct dp_soc *soc,
 	return &rx_desc_elem->rx_desc;
 }
 
+static inline
+struct dp_rx_desc *dp_get_rx_mon_status_desc_from_cookie(struct dp_soc *soc,
+							 struct rx_desc_pool *pool,
+							 uint32_t cookie)
+{
+	uint8_t pool_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(cookie);
+	uint16_t page_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(cookie);
+	uint8_t offset = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(cookie);
+	struct rx_desc_pool *rx_desc_pool;
+	union dp_rx_desc_list_elem_t *rx_desc_elem;
+
+	if (qdf_unlikely(pool_id >= NUM_RXDMA_RINGS_PER_PDEV))
+		return NULL;
+
+	rx_desc_pool = &pool[pool_id];
+	rx_desc_elem = (union dp_rx_desc_list_elem_t *)
+		(rx_desc_pool->desc_pages.cacheable_pages[page_id] +
+		rx_desc_pool->elem_size * offset);
+
+	return &rx_desc_elem->rx_desc;
+}
+
 /**
  * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
  *			 the Rx descriptor on Rx DMA source ring buffer
@@ -598,7 +620,9 @@ static inline
 struct dp_rx_desc *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc,
 						uint32_t cookie)
 {
-	return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_status[0], cookie);
+	return dp_get_rx_mon_status_desc_from_cookie(soc,
+						     &soc->rx_desc_status[0],
+						     cookie);
 }
 #else