浏览代码

qcacmn: Add API to free sw mon_desc to pool

Add API to free sw mon_desc to pool

Change-Id: Ibc10c7dc9a41d4c972471683b7232c76d46c5109
Amir Patel 3 年之前
父节点
当前提交
3abc7d0459

+ 1 - 1
dp/wifi3.0/monitor/2.0/dp_mon_2.0.c

@@ -39,7 +39,7 @@
  * @tail: attach the point to last desc of local desc list
  * @mon_desc_pool: monitor descriptor pool pointer
  */
-static void
+void
 dp_mon_add_desc_list_to_free_list(struct dp_soc *soc,
 				  union dp_mon_desc_list_elem_t **local_desc_list,
 				  union dp_mon_desc_list_elem_t **tail,

+ 47 - 0
dp/wifi3.0/monitor/2.0/dp_mon_2.0.h

@@ -209,4 +209,51 @@ QDF_STATUS dp_mon_buffers_replenish(struct dp_soc *dp_soc,
 void dp_mon_filter_show_filter_be(struct dp_mon_pdev_be *mon_pdev,
 				  enum dp_mon_filter_mode mode,
 				  struct dp_mon_filter_be *filter);
+
+/**
+ * dp_rx_add_to_free_desc_list() - Adds to a local free descriptor list
+ *
+ * @head: pointer to the head of local free list
+ * @tail: pointer to the tail of local free list
+ * @new: new descriptor that is added to the free list
+ * @func_name: caller func name
+ *
+ * Return: void
+ */
+static inline
+void __dp_mon_add_to_free_desc_list(union dp_mon_desc_list_elem_t **head,
+				    union dp_mon_desc_list_elem_t **tail,
+				    struct dp_mon_desc *new,
+				    const char *func_name)
+{
+	qdf_assert(head && new);
+
+	new->buf_addr = NULL;
+	new->in_use = 0;
+
+	((union dp_mon_desc_list_elem_t *)new)->next = *head;
+	*head = (union dp_mon_desc_list_elem_t *)new;
+	 /* reset tail if head->next is NULL */
+	if (!*tail || !(*head)->next)
+		*tail = *head;
+}
+
+#define dp_mon_add_to_free_desc_list(head, tail, new) \
+	__dp_mon_add_to_free_desc_list(head, tail, new, __func__)
+
+/*
+ * dp_mon_add_desc_list_to_free_list() - append unused desc_list back to
+ * freelist.
+ *
+ * @soc: core txrx main context
+ * @local_desc_list: local desc list provided by the caller
+ * @tail: attach the point to last desc of local desc list
+ * @mon_desc_pool: monitor descriptor pool pointer
+ */
+
+void
+dp_mon_add_desc_list_to_free_list(struct dp_soc *soc,
+				  union dp_mon_desc_list_elem_t **local_desc_list,
+				  union dp_mon_desc_list_elem_t **tail,
+				  struct dp_mon_desc_pool *mon_desc_pool);
 #endif /* _DP_MON_2_0_H_ */

+ 7 - 0
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.c

@@ -41,6 +41,9 @@ dp_rx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
 	struct dp_mon_soc_be *mon_soc_be = dp_get_be_mon_soc_from_dp_mon_soc(mon_soc);
 	uint32_t work_done = 0;
+	union dp_mon_desc_list_elem_t *desc_list = NULL;
+	union dp_mon_desc_list_elem_t *tail = NULL;
+	struct dp_mon_desc_pool *rx_mon_desc_pool = &mon_soc_be->rx_desc_mon;
 
 	if (!pdev) {
 		dp_mon_err("%pK: pdev is null for mac_id = %d", soc, mac_id);
@@ -95,10 +98,14 @@ dp_rx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 					     mon_desc->paddr);
 
 		qdf_frag_free(mon_desc->buf_addr);
+		dp_mon_add_to_free_desc_list(&desc_list, &tail, mon_desc);
 		work_done++;
 	}
 	dp_srng_access_end(int_ctx, soc, mon_dst_srng);
 
+	if (desc_list)
+		dp_mon_add_desc_list_to_free_list(soc, &desc_list,
+						  &tail, rx_mon_desc_pool);
 	qdf_spin_unlock_bh(&mon_pdev->mon_lock);
 	dp_mon_info("mac_id: %d, work_done:%d", mac_id, work_done);
 	return work_done;

+ 8 - 0
dp/wifi3.0/monitor/2.0/dp_tx_mon_2.0.c

@@ -41,6 +41,9 @@ dp_tx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 	uint32_t work_done = 0;
 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
 	struct dp_mon_soc_be *mon_soc_be = dp_get_be_mon_soc_from_dp_mon_soc(mon_soc);
+	union dp_mon_desc_list_elem_t *desc_list = NULL;
+	union dp_mon_desc_list_elem_t *tail = NULL;
+	struct dp_mon_desc_pool *tx_mon_desc_pool = &mon_soc_be->tx_desc_mon;
 
 	if (!pdev) {
 		dp_mon_err("%pK: pdev is null for mac_id = %d", soc, mac_id);
@@ -95,10 +98,15 @@ dp_tx_mon_srng_process_2_0(struct dp_soc *soc, struct dp_intr *int_ctx,
 					     mon_desc->paddr);
 
 		qdf_frag_free(mon_desc->buf_addr);
+		dp_mon_add_to_free_desc_list(&desc_list, &tail, mon_desc);
 		work_done++;
 	}
 	dp_srng_access_end(int_ctx, soc, mon_dst_srng);
 
+	if (desc_list)
+		dp_mon_add_desc_list_to_free_list(soc, &desc_list,
+						  &tail, tx_mon_desc_pool);
+
 	qdf_spin_unlock_bh(&mon_pdev->mon_lock);
 	dp_mon_info("mac_id: %d, work_done:%d", mac_id, work_done);
 	return work_done;

+ 2 - 4
hal/wifi3.0/be/hal_be_api_mon.h

@@ -110,11 +110,9 @@ hal_be_get_mon_dest_status(hal_soc_handle_t hal_soc,
 			   struct hal_mon_desc *status)
 {
 	struct mon_destination_ring *desc = hw_desc;
-	uint32_t stat_buf_virt_addr_31_0 = desc->stat_buf_virt_addr_31_0;
-	uint32_t stat_buf_virt_addr_63_32 = desc->stat_buf_virt_addr_63_32;
 
-	status->buf_addr = (HAL_MON_BUFFER_ADDR_31_0_GET(&stat_buf_virt_addr_31_0) |
-			((uint64_t)(HAL_MON_BUFFER_ADDR_39_32_GET(&stat_buf_virt_addr_63_32)) << 32));
+	status->buf_addr = ((u64)desc->stat_buf_virt_addr_31_0 |
+				((u64)desc->stat_buf_virt_addr_63_32 << 32));
 	status->ppdu_id = desc->ppdu_id;
 	status->end_offset = desc->end_offset;
 	status->end_reason = desc->end_reason;

+ 4 - 2
hal/wifi3.0/qcn9224/hal_9224.c

@@ -40,6 +40,8 @@
 #include <wbm_release_ring_tx.h>
 #include <wbm_release_ring_rx.h>
 #include <phyrx_location.h>
+#include <mon_ingress_ring.h>
+#include <mon_destination_ring.h>
 
 #include <hal_be_rx.h>
 
@@ -2173,7 +2175,7 @@ struct hal_hw_srng_config hw_srng_table_9224[] = {
 	{ /* RXDMA_MONITOR_BUF */
 		.start_ring_id = HAL_SRNG_WMAC1_SW2RXDMA2_BUF,
 		.max_rings = 1,
-		.entry_size = sizeof(struct wbm_buffer_ring) >> 2,
+		.entry_size = sizeof(struct mon_ingress_ring) >> 2,
 		.lmac_ring = TRUE,
 		.ring_dir = HAL_SRNG_SRC_RING,
 		/* reg_start is not set because LMAC rings are not accessed
@@ -2199,7 +2201,7 @@ struct hal_hw_srng_config hw_srng_table_9224[] = {
 	{ /* RXDMA_MONITOR_DST */
 		.start_ring_id = HAL_SRNG_WMAC1_RXMON2SW0,
 		.max_rings = 1,
-		.entry_size = sizeof(struct sw_monitor_ring) >> 2,
+		.entry_size = sizeof(struct mon_destination_ring) >> 2,
 		.lmac_ring = TRUE,
 		.ring_dir = HAL_SRNG_DST_RING,
 		/* reg_start is not set because LMAC rings are not accessed