浏览代码

qcacmn: Delay monitor buffers replenish to monitor VAP create

Monitor buffer are required only when monitor VAP is created. Allocate
these buffers only when montior VAP is created. This provides memory
savings when no monitor VAP is created/required.

Change-Id: I3ddaef00615f00fd13adb2789469a62f1a0af165
CRs-Fixed: 2491873
Kiran Venkatappa 5 年之前
父节点
当前提交
115309a008
共有 5 个文件被更改,包括 69 次插入7 次删除
  1. 2 0
      dp/wifi3.0/dp_main.c
  2. 1 1
      dp/wifi3.0/dp_rx.c
  3. 18 0
      dp/wifi3.0/dp_rx.h
  4. 7 0
      dp/wifi3.0/dp_rx_mon.h
  5. 41 6
      dp/wifi3.0/dp_rx_mon_dest.c

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

@@ -6321,6 +6321,8 @@ static QDF_STATUS dp_vdev_set_monitor_mode(struct cdp_vdev *vdev_handle,
 
 	pdev->monitor_configured = true;
 
+	dp_mon_buf_delayed_replenish(pdev);
+
 	return dp_pdev_configure_monitor_rings(pdev);
 }
 

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

@@ -2210,7 +2210,7 @@ dp_pdev_nbuf_alloc_and_map(struct dp_soc *dp_soc, qdf_nbuf_t *nbuf,
 	return QDF_STATUS_SUCCESS;
 }
 
-static QDF_STATUS
+QDF_STATUS
 dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
 			  struct dp_srng *dp_rxdma_srng,
 			  struct rx_desc_pool *rx_desc_pool,

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

@@ -1103,6 +1103,24 @@ QDF_STATUS dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
 				 union dp_rx_desc_list_elem_t **desc_list,
 				 union dp_rx_desc_list_elem_t **tail);
 
+/*
+ * dp_pdev_rx_buffers_attach() - replenish rxdma ring with rx nbufs
+ *                               called during dp rx initialization
+ *
+ * @soc: core txrx main context
+ * @mac_id: mac_id which is one of 3 mac_ids
+ * @dp_rxdma_srng: dp rxdma circular ring
+ * @rx_desc_pool: Pointer to free Rx descriptor pool
+ * @num_req_buffers: number of buffer to be replenished
+ *
+ * Return: return success or failure
+ */
+QDF_STATUS
+dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
+			  struct dp_srng *dp_rxdma_srng,
+			  struct rx_desc_pool *rx_desc_pool,
+			  uint32_t num_req_buffers);
+
 /**
  * dp_rx_link_desc_return() - Return a MPDU link descriptor to HW
  *			      (WBM), following error handling

+ 7 - 0
dp/wifi3.0/dp_rx_mon.h

@@ -95,6 +95,13 @@ QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id);
 uint32_t dp_rxdma_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
 			      uint32_t mac_id, uint32_t quota);
 
+/**
+ * dp_mon_buf_delayed_replenish() - Helper routine to replenish monitor dest buf
+ * @pdev: DP pdev object
+ *
+ * Return: None
+ */
+void dp_mon_buf_delayed_replenish(struct dp_pdev *pdev);
 #ifndef REMOVE_MON_DBG_STATS
 /*
  * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count

+ 41 - 6
dp/wifi3.0/dp_rx_mon_dest.c

@@ -1196,18 +1196,17 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota)
  *
  * Return: QDF_STATUS
  */
+#define MON_BUF_MIN_ALLOC_ENTRIES 128
 static QDF_STATUS
 dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev, int mac_id) {
 	uint8_t pdev_id = pdev->pdev_id;
 	struct dp_soc *soc = pdev->soc;
-	union dp_rx_desc_list_elem_t *desc_list = NULL;
-	union dp_rx_desc_list_elem_t *tail = NULL;
 	struct dp_srng *mon_buf_ring;
 	uint32_t num_entries;
 	struct rx_desc_pool *rx_desc_pool;
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	uint8_t mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id);
-	uint32_t rx_desc_pool_size;
+	uint32_t rx_desc_pool_size, replenish_size;
 
 	mon_buf_ring = &pdev->rxdma_mon_buf_ring[mac_for_pdev];
 
@@ -1226,9 +1225,10 @@ dp_rx_pdev_mon_buf_attach(struct dp_pdev *pdev, int mac_id) {
 
 	rx_desc_pool->owner = HAL_RX_BUF_RBM_SW3_BM;
 
-	status = dp_rx_buffers_replenish(soc, mac_id, mon_buf_ring,
-					 rx_desc_pool, num_entries,
-					 &desc_list, &tail);
+	replenish_size = (num_entries < MON_BUF_MIN_ALLOC_ENTRIES) ?
+			  num_entries : MON_BUF_MIN_ALLOC_ENTRIES;
+	status = dp_pdev_rx_buffers_attach(soc, mac_id, mon_buf_ring,
+					   rx_desc_pool, replenish_size);
 
 	return status;
 }
@@ -1498,6 +1498,38 @@ void dp_mon_link_desc_pool_cleanup(struct dp_soc *soc, uint32_t mac_id)
 		}
 	}
 }
+
+/**
+ * dp_mon_buf_delayed_replenish() - Helper routine to replenish monitor dest buf
+ * @pdev: DP pdev object
+ *
+ * Return: None
+ */
+void dp_mon_buf_delayed_replenish(struct dp_pdev *pdev)
+{
+	struct dp_soc *soc;
+	uint32_t mac_for_pdev;
+	union dp_rx_desc_list_elem_t *tail = NULL;
+	union dp_rx_desc_list_elem_t *desc_list = NULL;
+	uint32_t num_entries;
+	uint32_t mac_id;
+
+	soc = pdev->soc;
+	num_entries = wlan_cfg_get_dma_mon_buf_ring_size(pdev->wlan_cfg_ctx);
+
+	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
+		mac_for_pdev = dp_get_mac_id_for_pdev(mac_id,
+						      pdev->pdev_id);
+
+		dp_rx_buffers_replenish(soc, mac_for_pdev,
+					dp_rxdma_get_mon_buf_ring(pdev,
+								  mac_for_pdev),
+					dp_rx_get_mon_desc_pool(soc,
+								mac_for_pdev,
+								pdev->pdev_id),
+					num_entries, &desc_list, &tail);
+	}
+}
 #else
 static
 QDF_STATUS dp_mon_link_desc_pool_setup(struct dp_soc *soc, uint32_t mac_id)
@@ -1521,6 +1553,9 @@ dp_rx_pdev_mon_buf_detach(struct dp_pdev *pdev, int mac_id)
 {
 	return QDF_STATUS_SUCCESS;
 }
+
+void dp_mon_buf_delayed_replenish(struct dp_pdev *pdev)
+{}
 #endif
 
 /**