瀏覽代碼

qcacmn: Add buffer mgmt for monitor vap

Add buffer mgmt for monitor vap creation
and deletion.

Change-Id: Iabe4c49e1395fa44368a13c3c178e1fd1467e9b5
CRs-Fixed: 3087839
Naga 3 年之前
父節點
當前提交
315229c57c

+ 36 - 3
dp/wifi3.0/monitor/2.0/dp_mon_2.0.c

@@ -303,6 +303,39 @@ QDF_STATUS dp_mon_desc_pool_alloc(uint32_t pool_size,
 static
 void dp_vdev_set_monitor_mode_buf_rings_2_0(struct dp_pdev *pdev)
 {
+	int tx_mon_max_entries, rx_mon_max_entries;
+	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
+	struct dp_soc *soc = pdev->soc;
+	struct dp_mon_soc *mon_soc;
+	struct dp_mon_soc_be *mon_soc_be = NULL;
+
+	mon_soc = soc->monitor_soc;
+	mon_soc_be = (struct dp_mon_soc_be *)mon_soc;
+	if (!mon_soc_be) {
+		dp_mon_err("DP MON SOC is NULL");
+		return;
+	}
+
+	soc_cfg_ctx = soc->wlan_cfg_ctx;
+	rx_mon_max_entries = wlan_cfg_get_dp_soc_rx_mon_buf_ring_size(soc_cfg_ctx);
+
+	if (dp_rx_mon_buffers_alloc(soc,
+				    (rx_mon_max_entries - mon_soc_be->tx_mon_ring_fill_level))) {
+		dp_mon_err("%pK: Rx mon buffers allocation failed", soc);
+		return;
+	}
+
+	tx_mon_max_entries = wlan_cfg_get_dp_soc_tx_mon_buf_ring_size(soc_cfg_ctx);
+	if (dp_tx_mon_buffers_alloc(soc,
+				    (tx_mon_max_entries - mon_soc_be->tx_mon_ring_fill_level))) {
+		dp_mon_err("%pK: Tx mon buffers allocation failed", soc);
+		return;
+	}
+
+	mon_soc_be->tx_mon_ring_fill_level +=
+				(tx_mon_max_entries - mon_soc_be->tx_mon_ring_fill_level);
+	mon_soc_be->rx_mon_ring_fill_level +=
+				(rx_mon_max_entries - mon_soc_be->rx_mon_ring_fill_level);
 }
 
 static
@@ -608,13 +641,13 @@ QDF_STATUS dp_mon_soc_attach_2_0(struct dp_soc *soc)
 		goto fail;
 	}
 
-	/* allocate and replenish initial buffers */
-	if (dp_rx_mon_buffers_alloc(soc)) {
+	/* monitor buffers for src */
+	if (dp_rx_mon_buffers_alloc(soc, DP_MON_RING_FILL_LEVEL_DEFAULT)) {
 		dp_mon_err("%pK: Rx mon buffers allocation failed", soc);
 		goto fail;
 	}
 
-	if (dp_tx_mon_buffers_alloc(soc)) {
+	if (dp_tx_mon_buffers_alloc(soc, DP_MON_RING_FILL_LEVEL_DEFAULT)) {
 		dp_mon_err("%pK: Tx mon buffers allocation failed", soc);
 		goto fail;
 	}

+ 6 - 0
dp/wifi3.0/monitor/2.0/dp_mon_filter_2.0.c

@@ -1063,7 +1063,9 @@ void dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev *pdev)
 	enum dp_mon_filter_srng_type srng_type =
 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
 	struct dp_mon_pdev *mon_pdev;
+	struct dp_mon_soc *mon_soc;
 	struct dp_mon_pdev_be *mon_pdev_be;
+	struct dp_mon_soc_be *mon_soc_be = NULL;
 
 	if (!pdev) {
 		dp_mon_filter_err("pdev Context is null");
@@ -1077,7 +1079,11 @@ void dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev *pdev)
 	}
 
 	mon_pdev = pdev->monitor_pdev;
+	mon_soc = soc->monitor_soc;
 	mon_pdev_be = (struct dp_mon_pdev_be *)mon_pdev;
+	mon_soc_be = (struct dp_mon_soc_be *)mon_soc;
+	mon_soc_be->tx_mon_ring_fill_level = DP_MON_RING_FILL_LEVEL_DEFAULT;
+	mon_soc_be->rx_mon_ring_fill_level = DP_MON_RING_FILL_LEVEL_DEFAULT;
 
 	mon_pdev_be->filter_be[mode][srng_type] = filter;
 }

+ 8 - 4
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.c

@@ -149,13 +149,17 @@ dp_rx_mon_buf_desc_pool_alloc(struct dp_soc *soc)
 	struct dp_mon_desc_pool *rx_mon_desc_pool;
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
 	struct dp_mon_soc_be *mon_soc = be_soc->monitor_soc_be;
+	int entries;
+	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
 
+	soc_cfg_ctx = soc->wlan_cfg_ctx;
+
+	entries = wlan_cfg_get_dp_soc_rx_mon_buf_ring_size(soc_cfg_ctx);
 	mon_buf_ring = &soc->rxdma_mon_buf_ring[0];
 
 	rx_mon_desc_pool = &mon_soc->rx_desc_mon;
 
-	return dp_mon_desc_pool_alloc(mon_soc->rx_mon_ring_fill_level,
-				      rx_mon_desc_pool);
+	return dp_mon_desc_pool_alloc(entries, rx_mon_desc_pool);
 }
 
 void
@@ -171,7 +175,7 @@ dp_rx_mon_buffers_free(struct dp_soc *soc)
 }
 
 QDF_STATUS
-dp_rx_mon_buffers_alloc(struct dp_soc *soc)
+dp_rx_mon_buffers_alloc(struct dp_soc *soc, uint32_t size)
 {
 	struct dp_srng *mon_buf_ring;
 	struct dp_mon_desc_pool *rx_mon_desc_pool;
@@ -186,7 +190,7 @@ dp_rx_mon_buffers_alloc(struct dp_soc *soc)
 
 	return dp_mon_buffers_replenish(soc, mon_buf_ring,
 					rx_mon_desc_pool,
-					mon_soc->rx_mon_ring_fill_level,
+					size,
 					&desc_list, &tail);
 }
 

+ 1 - 1
dp/wifi3.0/monitor/2.0/dp_rx_mon_2.0.h

@@ -29,7 +29,7 @@
  *         QDF_STATUS_E_FAILURE: Error
  */
 QDF_STATUS
-dp_rx_mon_buffers_alloc(struct dp_soc *soc);
+dp_rx_mon_buffers_alloc(struct dp_soc *soc, uint32_t size);
 
 /*
  * dp_rx_mon_buffers_free() - free rx monitor buffers

+ 9 - 4
dp/wifi3.0/monitor/2.0/dp_tx_mon_2.0.c

@@ -149,13 +149,18 @@ dp_tx_mon_buf_desc_pool_alloc(struct dp_soc *soc)
 	struct dp_mon_desc_pool *tx_mon_desc_pool;
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
 	struct dp_mon_soc_be *mon_soc = be_soc->monitor_soc_be;
+	int entries;
+	struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
+
+	soc_cfg_ctx = soc->wlan_cfg_ctx;
+
+	entries = wlan_cfg_get_dp_soc_tx_mon_buf_ring_size(soc_cfg_ctx);
 
 	mon_buf_ring = &mon_soc->tx_mon_buf_ring;
 
 	tx_mon_desc_pool = &mon_soc->tx_desc_mon;
 
-	return dp_mon_desc_pool_alloc(mon_soc->tx_mon_ring_fill_level,
-				      tx_mon_desc_pool);
+	return dp_mon_desc_pool_alloc(entries, tx_mon_desc_pool);
 }
 
 void
@@ -171,7 +176,7 @@ dp_tx_mon_buffers_free(struct dp_soc *soc)
 }
 
 QDF_STATUS
-dp_tx_mon_buffers_alloc(struct dp_soc *soc)
+dp_tx_mon_buffers_alloc(struct dp_soc *soc, uint32_t size)
 {
 	struct dp_srng *mon_buf_ring;
 	struct dp_mon_desc_pool *tx_mon_desc_pool;
@@ -186,6 +191,6 @@ dp_tx_mon_buffers_alloc(struct dp_soc *soc)
 
 	return dp_mon_buffers_replenish(soc, mon_buf_ring,
 					tx_mon_desc_pool,
-					mon_soc->tx_mon_ring_fill_level,
+					size,
 					&desc_list, &tail);
 }

+ 1 - 1
dp/wifi3.0/monitor/2.0/dp_tx_mon_2.0.h

@@ -29,7 +29,7 @@
  *         QDF_STATUS_E_FAILURE: Error
  */
 QDF_STATUS
-dp_tx_mon_buffers_alloc(struct dp_soc *soc);
+dp_tx_mon_buffers_alloc(struct dp_soc *soc, uint32_t size);
 
 /*
  * dp_tx_mon_buffers_free() - free tx monitor buffers