qcacmn: Add support for local packet capture running

Add support for local packet capture running.

Change-Id: Id954c57a32210c180a8e0f9107e2469f96491173
CRs-Fixed: 3415816
This commit is contained in:
Srinivas Girigowda
2022-12-15 17:20:52 -08:00
committed by Madan Koyyalamudi
parent 13554f0cdc
commit 08ea5c2b80
8 changed files with 105 additions and 3 deletions

View File

@@ -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

View File

@@ -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
};

View File

@@ -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 */
};

View File

@@ -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 */
};

View File

@@ -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;
}

View File

@@ -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 {

View File

@@ -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;
}

View File

@@ -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_ */