Эх сурвалжийг харах

qcacmn: Add API for unmap with physical and virtual addr of nbuf

Tx data transfer in host mode with nbuf map_unmap debug frmwk
enabled and enhanced stats disabled results in an assert.
This is because on Tx completion path, nbuf unmap is done using API
qdf_mem_unmap_nbytes_single which takes physical address of nbuf
for unmap and does not remove nbuf from map_unmap tracking list and
when nbuf is freed, it results in assert as the tracking list still
contains that nbuf entry.

In order to fix this, define a new API for nbuf unmap passing physical
and virtual address of nbuf as arguments. Physical address is passed
as an argument in order to avoid cache miss in per packet path which
eventually helps in improving the KPI.

Change-Id: I77ab6ac3ac98556b9caff8aa3ee82bc23cd26de7
CRs-Fixed: 3006671
Harsh Kumar Bijlani 3 жил өмнө
parent
commit
43da5b8892

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

@@ -4310,10 +4310,11 @@ dp_tx_comp_process_desc_list(struct dp_soc *soc,
 			next = desc->next;
 			dp_tx_desc_history_add(soc, desc->dma_addr, desc->nbuf,
 					       desc->id, DP_TX_COMP_UNMAP);
-			qdf_mem_unmap_nbytes_single(soc->osdev,
-						    desc->dma_addr,
-						    QDF_DMA_TO_DEVICE,
-						    desc->length);
+			qdf_nbuf_unmap_nbytes_single_paddr(soc->osdev,
+							   desc->nbuf,
+							   desc->dma_addr,
+							   QDF_DMA_TO_DEVICE,
+							   desc->length);
 			qdf_nbuf_free(desc->nbuf);
 			dp_tx_desc_free(soc, desc, desc->pool_id);
 			desc = next;

+ 18 - 0
qdf/inc/qdf_nbuf.h

@@ -862,6 +862,16 @@ void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev,
 	qdf_nbuf_unmap_nbytes_single_debug(osdev, buf, dir, nbytes, \
 					   __func__, __LINE__)
 
+void qdf_nbuf_unmap_nbytes_single_paddr_debug(qdf_device_t osdev,
+					      qdf_nbuf_t buf,
+					      qdf_dma_addr_t phy_addr,
+					      qdf_dma_dir_t dir, int nbytes,
+					      const char *func, uint32_t line);
+
+#define qdf_nbuf_unmap_nbytes_single_paddr(osdev, buf, phy_addr, dir, nbytes) \
+	qdf_nbuf_unmap_nbytes_single_paddr_debug(osdev, buf, phy_addr, \
+						 dir, nbytes, __func__, \
+						 __LINE__)
 #else /* NBUF_MAP_UNMAP_DEBUG */
 
 static inline void qdf_nbuf_map_check_for_leaks(void) {}
@@ -917,6 +927,14 @@ qdf_nbuf_unmap_nbytes_single(
 {
 	return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
 }
+
+static inline void
+qdf_nbuf_unmap_nbytes_single_paddr(qdf_device_t osdev, qdf_nbuf_t buf,
+				   qdf_dma_addr_t phy_addr, qdf_dma_dir_t dir,
+				   int nbytes)
+{
+	__qdf_mem_unmap_nbytes_single(osdev, phy_addr, dir, nbytes);
+}
 #endif /* NBUF_MAP_UNMAP_DEBUG */
 
 /**

+ 13 - 0
qdf/linux/src/qdf_nbuf.c

@@ -996,6 +996,19 @@ void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev,
 
 qdf_export_symbol(qdf_nbuf_unmap_nbytes_single_debug);
 
+void qdf_nbuf_unmap_nbytes_single_paddr_debug(qdf_device_t osdev,
+					      qdf_nbuf_t buf,
+					      qdf_dma_addr_t phy_addr,
+					      qdf_dma_dir_t dir, int nbytes,
+					      const char *func, uint32_t line)
+{
+	qdf_nbuf_untrack_map(buf, func, line);
+	__qdf_mem_unmap_nbytes_single(osdev, phy_addr, dir, nbytes);
+	qdf_net_buf_debug_update_unmap_node(buf, func, line);
+}
+
+qdf_export_symbol(qdf_nbuf_unmap_nbytes_single_paddr_debug);
+
 static void qdf_nbuf_panic_on_free_if_mapped(qdf_nbuf_t nbuf,
 					     const char *func,
 					     uint32_t line)