Browse Source

qcacmn: Add support for local packet capture stop

Add support for local packet capture stop.

Change-Id: Ib12574f5b418ea009ec35ef85e170bc8c592c86f
CRs-Fixed: 3415812
Srinivas Girigowda 2 years ago
parent
commit
13554f0cdc

+ 30 - 0
dp/inc/cdp_txrx_mon.h

@@ -332,6 +332,30 @@ QDF_STATUS cdp_start_local_pkt_capture(ol_txrx_soc_handle soc,
 	return soc->ops->mon_ops->start_local_pkt_capture(soc, pdev_id, filter);
 	return soc->ops->mon_ops->start_local_pkt_capture(soc, pdev_id, filter);
 }
 }
 
 
+/**
+ * cdp_stop_local_pkt_capture() - stop local pkt capture
+ * @soc: opaque soc handle
+ * @pdev_id: pdev_id
+ *
+ * Return: QDF_STATUS_SUCCESS if success
+ *         QDF_STATUS_E_FAILURE if error
+ */
+static inline
+QDF_STATUS cdp_stop_local_pkt_capture(ol_txrx_soc_handle soc, uint8_t pdev_id)
+{
+	if (!soc || !soc->ops) {
+		dp_cdp_debug("Invalid Instance");
+		QDF_BUG(0);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!soc->ops->mon_ops ||
+	    !soc->ops->mon_ops->stop_local_pkt_capture)
+		return QDF_STATUS_E_FAILURE;
+
+	return soc->ops->mon_ops->stop_local_pkt_capture(soc, pdev_id);
+}
+
 #else
 #else
 static inline
 static inline
 QDF_STATUS cdp_start_local_pkt_capture(ol_txrx_soc_handle soc,
 QDF_STATUS cdp_start_local_pkt_capture(ol_txrx_soc_handle soc,
@@ -341,6 +365,12 @@ QDF_STATUS cdp_start_local_pkt_capture(ol_txrx_soc_handle soc,
 	return QDF_STATUS_E_NOSUPPORT;
 	return QDF_STATUS_E_NOSUPPORT;
 }
 }
 
 
+static inline
+QDF_STATUS cdp_stop_local_pkt_capture(ol_txrx_soc_handle soc, uint8_t pdev_id)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 
 
 #endif
 #endif

+ 4 - 0
dp/inc/cdp_txrx_ops.h

@@ -994,6 +994,7 @@ struct cdp_me_ops {
  * @txrx_cfr_filter: Handler to configure host rx monitor status ring
  * @txrx_cfr_filter: Handler to configure host rx monitor status ring
  * @txrx_update_mon_mac_filter: Handler to configure mon mac filter
  * @txrx_update_mon_mac_filter: Handler to configure mon mac filter
  * @start_local_pkt_capture: start local packet capture
  * @start_local_pkt_capture: start local packet capture
+ * @stop_local_pkt_capture: stop local packet capture
  */
  */
 struct cdp_mon_ops {
 struct cdp_mon_ops {
 
 
@@ -1106,6 +1107,9 @@ struct cdp_mon_ops {
 	QDF_STATUS (*start_local_pkt_capture)
 	QDF_STATUS (*start_local_pkt_capture)
 			(struct cdp_soc_t *soc, uint8_t pdev_id,
 			(struct cdp_soc_t *soc, uint8_t pdev_id,
 			 struct cdp_monitor_filter *filter);
 			 struct cdp_monitor_filter *filter);
+
+	QDF_STATUS (*stop_local_pkt_capture)(struct cdp_soc_t *soc,
+					     uint8_t pdev_id);
 #endif
 #endif
 };
 };
 
 

+ 1 - 0
dp/wifi3.0/monitor/1.0/dp_mon_1.0.c

@@ -1471,6 +1471,7 @@ struct cdp_mon_ops dp_ops_mon_1_0 = {
 				dp_mon_pdev_params_rssi_dbm_conv,
 				dp_mon_pdev_params_rssi_dbm_conv,
 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
 	.start_local_pkt_capture = dp_mon_start_local_pkt_capture,
 	.start_local_pkt_capture = dp_mon_start_local_pkt_capture,
+	.stop_local_pkt_capture = dp_mon_stop_local_pkt_capture,
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 };
 };
 
 

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

@@ -1455,6 +1455,7 @@ struct cdp_mon_ops dp_ops_mon_2_0 = {
 	.txrx_update_mon_mac_filter = NULL,
 	.txrx_update_mon_mac_filter = NULL,
 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
 	.start_local_pkt_capture = NULL,
 	.start_local_pkt_capture = NULL,
+	.stop_local_pkt_capture = NULL,
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 };
 };
 
 

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

@@ -3469,8 +3469,13 @@ void dp_mon_filter_reset_local_pkt_capture_tx(struct dp_pdev *pdev)
 	enum dp_mon_filter_srng_type srng_type =
 	enum dp_mon_filter_srng_type srng_type =
 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
+	struct dp_pdev_tx_monitor_be *tx_mon_be;
 
 
 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
+
+	tx_mon_be = &mon_pdev_be->tx_monitor_be;
+	tx_mon_be->mode = TX_MON_BE_DISABLE;
+	mon_pdev_be->tx_mon_mode = 0;
 	filter.tx_valid = true;
 	filter.tx_valid = true;
 	mon_pdev_be->filter_be[mode][srng_type] = filter;
 	mon_pdev_be->filter_be[mode][srng_type] = filter;
 }
 }

+ 1 - 0
dp/wifi3.0/monitor/dp_mon.h

@@ -874,6 +874,7 @@ struct dp_mon_ops {
 				   struct htt_rx_ring_tlv_filter *tlv_filter);
 				   struct htt_rx_ring_tlv_filter *tlv_filter);
 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
 	QDF_STATUS (*start_local_pkt_capture)(struct dp_pdev *pdev);
 	QDF_STATUS (*start_local_pkt_capture)(struct dp_pdev *pdev);
+	QDF_STATUS (*stop_local_pkt_capture)(struct dp_pdev *pdev);
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 };
 };
 
 

+ 46 - 0
dp/wifi3.0/monitor/dp_mon_filter.c

@@ -1010,4 +1010,50 @@ QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc,
 	return status;
 	return status;
 }
 }
 
 
+QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc,
+					 uint8_t pdev_id)
+{
+	bool local_pkt_capture_running;
+	struct dp_soc *soc = cdp_soc_t_to_dp_soc(cdp_soc);
+	struct dp_pdev *pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
+	struct dp_mon_pdev *mon_pdev;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+	if (!pdev) {
+		dp_mon_filter_err("pdev Context is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mon_pdev = pdev->monitor_pdev;
+	local_pkt_capture_running =
+			dp_mon_get_local_pkt_capture_running(cdp_soc, pdev_id);
+	if (!local_pkt_capture_running) {
+		dp_mon_filter_err("Local pkt capture is not running");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	qdf_spin_lock_bh(&mon_pdev->mon_lock);
+	dp_mon_reset_local_pkt_capture_rx_filter(pdev);
+	status = dp_mon_filter_update(pdev);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		dp_mon_filter_err("local pkt capture set rx filter failed");
+		qdf_spin_unlock_bh(&mon_pdev->mon_lock);
+		return status;
+	}
+	qdf_spin_unlock_bh(&mon_pdev->mon_lock);
+
+	mon_pdev->mon_filter_mode = 0;
+	mon_pdev->fp_mgmt_filter = 0;
+	mon_pdev->fp_ctrl_filter = 0;
+	mon_pdev->fp_data_filter = 0;
+
+	qdf_spin_lock_bh(&mon_pdev->mon_lock);
+	dp_mon_filter_reset_tx_mon_mode(pdev);
+	dp_tx_mon_filter_update(pdev);
+	qdf_spin_unlock_bh(&mon_pdev->mon_lock);
+	dp_mon_filter_debug("local pkt capture stopped");
+
+	return QDF_STATUS_SUCCESS;
+}
+
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */

+ 16 - 0
dp/wifi3.0/monitor/dp_mon_filter.h

@@ -574,6 +574,14 @@ dp_rx_mon_hdr_length_set(uint32_t *msg_word,
 QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc,
 QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc,
 					  uint8_t pdev_id,
 					  uint8_t pdev_id,
 					  struct cdp_monitor_filter *filter);
 					  struct cdp_monitor_filter *filter);
+
+/**
+ * dp_mon_stop_local_pkt_capture() - stop local packet capture
+ * @cdp_soc: cdp soc
+ * @pdev_id: pdev id
+ */
+QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc,
+					 uint8_t pdev_id);
 #else
 #else
 static inline
 static inline
 QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc,
 QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc,
@@ -582,5 +590,13 @@ QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc,
 {
 {
 	return QDF_STATUS_E_NOSUPPORT;
 	return QDF_STATUS_E_NOSUPPORT;
 }
 }
+
+static inline
+QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc,
+					 uint8_t pdev_id)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */
 #endif /* #ifndef _DP_MON_FILTER_H_ */
 #endif /* #ifndef _DP_MON_FILTER_H_ */