From 08ea5c2b8043923b59713365533bdf947d18432a Mon Sep 17 00:00:00 2001 From: Srinivas Girigowda Date: Thu, 15 Dec 2022 17:20:52 -0800 Subject: [PATCH] qcacmn: Add support for local packet capture running Add support for local packet capture running. Change-Id: Id954c57a32210c180a8e0f9107e2469f96491173 CRs-Fixed: 3415816 --- dp/inc/cdp_txrx_mon.h | 28 +++++++++++++++++++++ dp/inc/cdp_txrx_ops.h | 3 +++ dp/wifi3.0/monitor/1.0/dp_mon_1.0.c | 1 + dp/wifi3.0/monitor/2.0/dp_mon_2.0.c | 1 + dp/wifi3.0/monitor/dp_mon.c | 2 ++ dp/wifi3.0/monitor/dp_mon.h | 4 +++ dp/wifi3.0/monitor/dp_mon_filter.c | 39 ++++++++++++++++++++++++++--- dp/wifi3.0/monitor/dp_mon_filter.h | 30 ++++++++++++++++++++++ 8 files changed, 105 insertions(+), 3 deletions(-) diff --git a/dp/inc/cdp_txrx_mon.h b/dp/inc/cdp_txrx_mon.h index eeb9cac358..fc12e005e9 100644 --- a/dp/inc/cdp_txrx_mon.h +++ b/dp/inc/cdp_txrx_mon.h @@ -356,6 +356,29 @@ QDF_STATUS cdp_stop_local_pkt_capture(ol_txrx_soc_handle soc, uint8_t pdev_id) return soc->ops->mon_ops->stop_local_pkt_capture(soc, pdev_id); } +/** + * cdp_is_local_pkt_capture_running() - get is local packet capture running + * @soc: opaque soc handle + * @pdev_id: pdev id + * + * Return: true if running + * false if not running + */ +static inline +bool cdp_is_local_pkt_capture_running(ol_txrx_soc_handle soc, uint8_t pdev_id) +{ + if (!soc || !soc->ops) { + dp_cdp_debug("Invalid Instance"); + QDF_BUG(0); + return false; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->is_local_pkt_capture_running) + return false; + + return soc->ops->mon_ops->is_local_pkt_capture_running(soc, pdev_id); +} #else static inline QDF_STATUS cdp_start_local_pkt_capture(ol_txrx_soc_handle soc, @@ -371,6 +394,11 @@ QDF_STATUS cdp_stop_local_pkt_capture(ol_txrx_soc_handle soc, uint8_t pdev_id) return QDF_STATUS_E_NOSUPPORT; } +static inline +bool cdp_is_local_pkt_capture_running(ol_txrx_soc_handle soc, uint8_t pdev_id) +{ + return false; +} #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ #endif diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 519c2fc919..f713dbb9c6 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -995,6 +995,7 @@ struct cdp_me_ops { * @txrx_update_mon_mac_filter: Handler to configure mon mac filter * @start_local_pkt_capture: start local packet capture * @stop_local_pkt_capture: stop local packet capture + * @is_local_pkt_capture_running: is local packet capture running */ struct cdp_mon_ops { @@ -1110,6 +1111,8 @@ struct cdp_mon_ops { QDF_STATUS (*stop_local_pkt_capture)(struct cdp_soc_t *soc, uint8_t pdev_id); + bool (*is_local_pkt_capture_running)(struct cdp_soc_t *soc, + uint8_t pdev_id); #endif }; diff --git a/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c b/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c index 12276094b2..e0a4f5459a 100644 --- a/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c +++ b/dp/wifi3.0/monitor/1.0/dp_mon_1.0.c @@ -1472,6 +1472,7 @@ struct cdp_mon_ops dp_ops_mon_1_0 = { #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE .start_local_pkt_capture = dp_mon_start_local_pkt_capture, .stop_local_pkt_capture = dp_mon_stop_local_pkt_capture, + .is_local_pkt_capture_running = dp_mon_get_is_local_pkt_capture_running, #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ }; diff --git a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c index 081094f168..f0711f9386 100644 --- a/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c +++ b/dp/wifi3.0/monitor/2.0/dp_mon_2.0.c @@ -1456,6 +1456,7 @@ struct cdp_mon_ops dp_ops_mon_2_0 = { #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE .start_local_pkt_capture = NULL, .stop_local_pkt_capture = NULL, + .is_local_pkt_capture_running = NULL, #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ }; diff --git a/dp/wifi3.0/monitor/dp_mon.c b/dp/wifi3.0/monitor/dp_mon.c index 28f7a6fc6f..94de173970 100644 --- a/dp/wifi3.0/monitor/dp_mon.c +++ b/dp/wifi3.0/monitor/dp_mon.c @@ -6013,6 +6013,7 @@ QDF_STATUS dp_mon_pdev_init(struct dp_pdev *pdev) mon_ops->mon_rx_pdev_tlv_logger_init(pdev); mon_pdev->is_dp_mon_pdev_initialized = true; + dp_mon_set_local_pkt_capture_running(mon_pdev, false); return QDF_STATUS_SUCCESS; @@ -6084,6 +6085,7 @@ QDF_STATUS dp_mon_pdev_deinit(struct dp_pdev *pdev) if (mon_pdev->invalid_mon_peer) qdf_mem_free(mon_pdev->invalid_mon_peer); mon_pdev->is_dp_mon_pdev_initialized = false; + dp_mon_set_local_pkt_capture_running(mon_pdev, false); return QDF_STATUS_SUCCESS; } diff --git a/dp/wifi3.0/monitor/dp_mon.h b/dp/wifi3.0/monitor/dp_mon.h index ad19ed1e21..8bc2e2d18c 100644 --- a/dp/wifi3.0/monitor/dp_mon.h +++ b/dp/wifi3.0/monitor/dp_mon.h @@ -875,6 +875,7 @@ struct dp_mon_ops { #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE QDF_STATUS (*start_local_pkt_capture)(struct dp_pdev *pdev); QDF_STATUS (*stop_local_pkt_capture)(struct dp_pdev *pdev); + bool (*is_local_pkt_capture_running)(struct dp_pdev *pdev); #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ }; @@ -1220,6 +1221,9 @@ struct dp_mon_pdev { bool rssi_dbm_conv_support; struct dp_rx_mon_rssi_offset rssi_offsets; uint8_t phy_ppdu_id_size; +#ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE + bool is_local_pkt_capture_running; +#endif }; struct dp_mon_vdev { diff --git a/dp/wifi3.0/monitor/dp_mon_filter.c b/dp/wifi3.0/monitor/dp_mon_filter.c index 6bb782415f..897facd65d 100644 --- a/dp/wifi3.0/monitor/dp_mon_filter.c +++ b/dp/wifi3.0/monitor/dp_mon_filter.c @@ -894,6 +894,37 @@ fail: } #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE +QDF_STATUS dp_mon_set_local_pkt_capture_running(struct dp_mon_pdev *mon_pdev, + bool val) +{ + if (!mon_pdev) { + dp_mon_filter_err("Invalid monitor pdev"); + return QDF_STATUS_E_FAILURE; + } + + mon_pdev->is_local_pkt_capture_running = val; + dp_mon_filter_debug("local_pkt_capture_running is set to %d", val); + return QDF_STATUS_SUCCESS; +} + +bool dp_mon_get_is_local_pkt_capture_running(struct cdp_soc_t *cdp_soc, + uint8_t pdev_id) +{ + struct dp_soc *soc = (struct 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; + + if (!pdev || !pdev->monitor_pdev) { + dp_mon_filter_err("Invalid pdev_id %u", pdev_id); + return false; + } + + mon_pdev = pdev->monitor_pdev; + + return mon_pdev->is_local_pkt_capture_running; +} + static void dp_mon_set_local_pkt_capture_rx_filter(struct dp_pdev *pdev, struct cdp_monitor_filter *src_filter) @@ -974,8 +1005,8 @@ QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc, } mon_pdev = pdev->monitor_pdev; - local_pkt_capture_running = dp_mon_get_local_pkt_capture_running(cdp_soc, - pdev_id); + local_pkt_capture_running = + dp_mon_get_is_local_pkt_capture_running(cdp_soc, pdev_id); if (local_pkt_capture_running) { dp_mon_filter_err("Can't start local pkt capture. Already running"); return QDF_STATUS_E_ALREADY; @@ -1007,6 +1038,7 @@ QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc, dp_mon_filter_debug("local pkt capture tx filter set"); + dp_mon_set_local_pkt_capture_running(mon_pdev, true); return status; } @@ -1026,7 +1058,7 @@ QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc, mon_pdev = pdev->monitor_pdev; local_pkt_capture_running = - dp_mon_get_local_pkt_capture_running(cdp_soc, pdev_id); + dp_mon_get_is_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; @@ -1053,6 +1085,7 @@ QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc, qdf_spin_unlock_bh(&mon_pdev->mon_lock); dp_mon_filter_debug("local pkt capture stopped"); + dp_mon_set_local_pkt_capture_running(mon_pdev, false); return QDF_STATUS_SUCCESS; } diff --git a/dp/wifi3.0/monitor/dp_mon_filter.h b/dp/wifi3.0/monitor/dp_mon_filter.h index 7d95401fb6..baa0d54a6b 100644 --- a/dp/wifi3.0/monitor/dp_mon_filter.h +++ b/dp/wifi3.0/monitor/dp_mon_filter.h @@ -582,7 +582,30 @@ QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc, */ QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc, uint8_t pdev_id); + +/** + * dp_mon_set_local_pkt_capture_running() - set local packet capture running + * @mon_pdev: monitor pdev + * @val: value + */ +QDF_STATUS dp_mon_set_local_pkt_capture_running(struct dp_mon_pdev *mon_pdev, + bool val); + +/** + * dp_mon_get_is_local_pkt_capture_running() - get local packet capture running + * @cdp_soc: cdp soc + * @pdev_id: pdev id + */ +bool dp_mon_get_is_local_pkt_capture_running(struct cdp_soc_t *cdp_soc, + uint8_t pdev_id); #else +static inline +QDF_STATUS dp_mon_set_local_pkt_capture_running(struct dp_mon_pdev *mon_pdev, + bool val) +{ + return QDF_STATUS_E_NOSUPPORT; +} + static inline QDF_STATUS dp_mon_start_local_pkt_capture(struct cdp_soc_t *cdp_soc, uint8_t pdev_id, @@ -598,5 +621,12 @@ QDF_STATUS dp_mon_stop_local_pkt_capture(struct cdp_soc_t *cdp_soc, return QDF_STATUS_E_NOSUPPORT; } +static inline +bool dp_mon_get_is_local_pkt_capture_running(struct cdp_soc_t *cdp_soc, + uint8_t pdev_id) +{ + return false; +} + #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE */ #endif /* #ifndef _DP_MON_FILTER_H_ */