diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_main.h b/components/pkt_capture/core/inc/wlan_pkt_capture_main.h index 9561217bc6..da20a0e170 100644 --- a/components/pkt_capture/core/inc/wlan_pkt_capture_main.h +++ b/components/pkt_capture/core/inc/wlan_pkt_capture_main.h @@ -172,6 +172,25 @@ void pkt_capture_set_pktcap_mode(struct wlan_objmgr_psoc *psoc, enum pkt_capture_mode pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc); +/** + * pkt_capture_set_pktcap_config - Set packet capture config + * @vdev: pointer to vdev object + * @config: config to be set + * + * Return: None + */ +void pkt_capture_set_pktcap_config(struct wlan_objmgr_vdev *vdev, + enum pkt_capture_config config); + +/** + * pkt_capture_get_pktcap_config - Get packet capture config + * @vdev: pointer to vdev object + * + * Return: config value + */ +enum pkt_capture_config +pkt_capture_get_pktcap_config(struct wlan_objmgr_vdev *vdev); + /** * pkt_capture_drop_nbuf_list() - drop an nbuf list * @buf_list: buffer list to be dropepd diff --git a/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h b/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h index 0e55f86049..d1ab788f98 100644 --- a/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h +++ b/components/pkt_capture/core/inc/wlan_pkt_capture_priv.h @@ -32,23 +32,23 @@ #include "wlan_pkt_capture_mon_thread.h" /** - * struct pkt_capture_cfg - packet capture cfg to store ini values + * struct pkt_capture_cfg - struct to store config values * @pkt_capture_mode: packet capture mode + * @pkt_capture_config: config for trigger, qos and beacon frames */ struct pkt_capture_cfg { enum pkt_capture_mode pkt_capture_mode; + enum pkt_capture_config pkt_capture_config; }; /** * struct pkt_capture_cb_context - packet capture callback context * @mon_cb: monitor callback function pointer * @mon_ctx: monitor callback context - * @pkt_capture_mode: packet capture mode */ struct pkt_capture_cb_context { QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t); void *mon_ctx; - enum pkt_capture_mode pkt_capture_mode; }; /** @@ -59,6 +59,7 @@ struct pkt_capture_cb_context { * @rx_ops: rx ops * @tx_ops: tx ops * @frame_filter: config filter set by vendor command + * @cfg_params: packet capture config params * @rx_avg_rssi: avg rssi of rx data packets * @ppdu_stats_q: list used for storing smu related ppdu stats * @lock_q: spinlock for ppdu_stats q @@ -73,6 +74,7 @@ struct pkt_capture_vdev_priv { struct wlan_pkt_capture_rx_ops rx_ops; struct wlan_pkt_capture_tx_ops tx_ops; struct pkt_capture_frame_filter frame_filter; + struct pkt_capture_cfg cfg_params; int32_t rx_avg_rssi; qdf_list_t ppdu_stats_q; qdf_spinlock_t lock_q; diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_main.c b/components/pkt_capture/core/src/wlan_pkt_capture_main.c index bfa0ad6579..f12b08e742 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_main.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_main.c @@ -150,7 +150,7 @@ pkt_capture_get_pktcap_mode_v2() if (!vdev_priv) pkt_capture_err("vdev_priv is NULL"); else - mode = vdev_priv->cb_ctx->pkt_capture_mode; + mode = vdev_priv->cfg_params.pkt_capture_mode; return mode; } @@ -650,7 +650,7 @@ void pkt_capture_set_pktcap_mode(struct wlan_objmgr_psoc *psoc, vdev_priv = pkt_capture_vdev_get_priv(vdev); if (vdev_priv) - vdev_priv->cb_ctx->pkt_capture_mode = mode; + vdev_priv->cfg_params.pkt_capture_mode = mode; else pkt_capture_err("vdev_priv is NULL"); @@ -682,12 +682,47 @@ pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc) if (!vdev_priv) pkt_capture_err("vdev_priv is NULL"); else - mode = vdev_priv->cb_ctx->pkt_capture_mode; + mode = vdev_priv->cfg_params.pkt_capture_mode; wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID); return mode; } +void pkt_capture_set_pktcap_config(struct wlan_objmgr_vdev *vdev, + enum pkt_capture_config config) +{ + struct pkt_capture_vdev_priv *vdev_priv; + + if (!vdev) { + pkt_capture_err("vdev is NULL"); + return; + } + + vdev_priv = pkt_capture_vdev_get_priv(vdev); + if (vdev_priv) + vdev_priv->cfg_params.pkt_capture_config = config; + else + pkt_capture_err("vdev_priv is NULL"); +} + +enum pkt_capture_config +pkt_capture_get_pktcap_config(struct wlan_objmgr_vdev *vdev) +{ + enum pkt_capture_config config = 0; + struct pkt_capture_vdev_priv *vdev_priv; + + if (!vdev) + return 0; + + vdev_priv = pkt_capture_vdev_get_priv(vdev); + if (!vdev_priv) + pkt_capture_err("vdev_priv is NULL"); + else + config = vdev_priv->cfg_params.pkt_capture_config; + + return config; +} + /** * pkt_capture_callback_ctx_create() - Create packet capture callback context * @vdev_priv: pointer to packet capture vdev priv obj @@ -988,6 +1023,8 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, enum pkt_capture_mode mode = PACKET_CAPTURE_MODE_DISABLE; ol_txrx_soc_handle soc; QDF_STATUS status; + enum pkt_capture_config config = 0; + bool check_enable_beacon = 0; if (!vdev) { pkt_capture_err("vdev is NULL"); @@ -1047,10 +1084,35 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, vdev_priv->frame_filter.connected_beacon_interval = frame_filter.connected_beacon_interval; - if (vdev_priv->frame_filter.mgmt_tx_frame_filter || - vdev_priv->frame_filter.mgmt_rx_frame_filter) + if (vdev_priv->frame_filter.mgmt_tx_frame_filter) mode |= PACKET_CAPTURE_MODE_MGMT_ONLY; + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_FRAME_TYPE_ALL) { + mode |= PACKET_CAPTURE_MODE_MGMT_ONLY; + config |= PACKET_CAPTURE_CONFIG_BEACON_ENABLE; + config |= PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE; + } else { + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_CONNECT_NO_BEACON) { + mode |= PACKET_CAPTURE_MODE_MGMT_ONLY; + config |= PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE; + } else { + check_enable_beacon = 1; + } + } + + if (check_enable_beacon) { + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_CONNECT_BEACON) + config |= PACKET_CAPTURE_CONFIG_BEACON_ENABLE; + + if (vdev_priv->frame_filter.mgmt_rx_frame_filter & + PKT_CAPTURE_MGMT_CONNECT_SCAN_BEACON) + config |= + PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE; + } + if (vdev_priv->frame_filter.data_tx_frame_filter || vdev_priv->frame_filter.data_rx_frame_filter) mode |= PACKET_CAPTURE_MODE_DATA_ONLY; @@ -1066,5 +1128,21 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, cdp_set_pkt_capture_mode(soc, true); } + if (vdev_priv->frame_filter.ctrl_tx_frame_filter || + vdev_priv->frame_filter.ctrl_rx_frame_filter) + config |= PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE; + + if (vdev_priv->frame_filter.data_rx_frame_filter & + PKT_CAPTURE_DATA_FRAME_QOS_NULL) + config |= PACKET_CAPTURE_CONFIG_QOS_ENABLE; + + if (config != pkt_capture_get_pktcap_config(vdev)) { + status = tgt_pkt_capture_send_config(vdev, config); + if (QDF_IS_STATUS_ERROR(status)) { + pkt_capture_err("packet capture send config failed"); + return status; + } + } + return QDF_STATUS_SUCCESS; } diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h index acc1656b78..ab71e1a5db 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h @@ -38,19 +38,22 @@ enum pkt_capture_mode { }; /** - * enum pkt_capture_trigger_qos_config - packet capture config - * @PACKET_CAPTURE_CONFIG_TRIGGER_QOS_DISABLE: disable capture for trigger and - * qos frames + * enum pkt_capture_config - packet capture config * @PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE: enable capture for trigger frames only * @PACKET_CAPTURE_CONFIG_QOS_ENABLE: enable capture for qos frames only - * @PACKET_CAPTURE_CONFIG_TRIGGER_QOS_ENABLE: enable capture for both trigger - * and qos frames + * @PACKET_CAPTURE_CONFIG_CONNECT_NO_BEACON_ENABLE: drop all beacons, when + * device in connected state + * @PACKET_CAPTURE_CONFIG_CONNECT_BEACON_ENABLE: enable only connected BSSID + * beacons, when device in connected state + * @PACKET_CAPTURE_CONFIG_CONNECT_OFF_CHANNEL_BEACON_ENABLE: enable off channel + * beacons, when device in connected state */ -enum pkt_capture_trigger_qos_config { - PACKET_CAPTURE_CONFIG_TRIGGER_QOS_DISABLE = 0, - PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE, - PACKET_CAPTURE_CONFIG_QOS_ENABLE, - PACKET_CAPTURE_CONFIG_TRIGGER_QOS_ENABLE, +enum pkt_capture_config { + PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE = BIT(0), + PACKET_CAPTURE_CONFIG_QOS_ENABLE = BIT(1), + PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE = BIT(2), + PACKET_CAPTURE_CONFIG_BEACON_ENABLE = BIT(3), + PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE = BIT(4), }; /** @@ -106,7 +109,7 @@ struct wlan_pkt_capture_tx_ops { QDF_STATUS (*pkt_capture_send_config) (struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, - enum pkt_capture_trigger_qos_config config); + enum pkt_capture_config config); }; /** diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h index e4c1c3da7f..8cccff114d 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h @@ -53,7 +53,6 @@ QDF_STATUS tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev, enum pkt_capture_mode mode); -#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 /** * tgt_pkt_capture_send_config() - send packet capture config to firmware * @vdev: pointer to vdev object @@ -63,8 +62,9 @@ tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev, */ QDF_STATUS tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev, - enum pkt_capture_trigger_qos_config config); + enum pkt_capture_config config); +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 /** * tgt_pkt_capture_smu_event() - Receive smart monitor event from firmware * @psoc: pointer to psoc diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h index 768b3ac00f..70571466e8 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_ucfg_api.h @@ -120,6 +120,25 @@ void ucfg_pkt_capture_set_pktcap_mode(struct wlan_objmgr_psoc *psoc, enum pkt_capture_mode ucfg_pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc); +/** + * ucfg_pkt_capturee_set_pktcap_config - Set packet capture config + * @vdev: pointer to vdev object + * @config: config to be set + * + * Return: None + */ +void ucfg_pkt_capture_set_pktcap_config(struct wlan_objmgr_vdev *vdev, + enum pkt_capture_config config); + +/** + * ucfg_pkt_capture_get_pktcap_config - Get packet capture config + * @vdev: pointer to vdev object + * + * Return: config value + */ +enum pkt_capture_config +ucfg_pkt_capture_get_pktcap_config(struct wlan_objmgr_vdev *vdev); + /** * ucfg_pkt_capture_process_mgmt_tx_data() - process management tx packets * @pdev: pointer to pdev object @@ -278,27 +297,6 @@ QDF_STATUS ucfg_pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, struct wlan_objmgr_vdev *vdev); -#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 -/** - * ucfg_pkt_capture_send_config - send packet capture config - * @vdev: pointer to vdev object - * @config: packet capture config - * - * Return: None - */ -QDF_STATUS ucfg_pkt_capture_send_config - (struct wlan_objmgr_vdev *vdev, - enum pkt_capture_trigger_qos_config config); -#else -static inline -QDF_STATUS ucfg_pkt_capture_send_config - (struct wlan_objmgr_vdev *vdev, - enum pkt_capture_trigger_qos_config config) -{ - return QDF_STATUS_SUCCESS; -} - -#endif #else static inline QDF_STATUS ucfg_pkt_capture_init(void) @@ -354,6 +352,18 @@ ucfg_pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc) return PACKET_CAPTURE_MODE_DISABLE; } +static inline +void ucfg_pkt_capture_set_pktcap_config(struct wlan_objmgr_vdev *vdev, + enum pkt_capture_config config) +{ +} + +static inline enum pkt_capture_config +ucfg_pkt_capture_get_pktcap_config(struct wlan_objmgr_vdev *vdev) +{ + return 0; +} + static inline QDF_STATUS ucfg_pkt_capture_process_mgmt_tx_data( struct mgmt_offload_event_params *params, @@ -429,14 +439,6 @@ ucfg_pkt_capture_record_channel(struct wlan_objmgr_vdev *vdev) { } -static inline -QDF_STATUS ucfg_pkt_capture_send_config - (struct wlan_objmgr_vdev *vdev, - enum pkt_capture_trigger_qos_config config) -{ - return QDF_STATUS_SUCCESS; -} - static inline QDF_STATUS ucfg_pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, struct wlan_objmgr_vdev *vdev) diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c index 0d069cd0cc..d66b8a6560 100644 --- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c @@ -126,10 +126,9 @@ tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev, return status; } -#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 QDF_STATUS tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev, - enum pkt_capture_trigger_qos_config config) + enum pkt_capture_config config) { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct pkt_capture_vdev_priv *vdev_priv; @@ -161,6 +160,7 @@ tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev, return status; } +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 QDF_STATUS tgt_pkt_capture_smu_event(struct wlan_objmgr_psoc *psoc, struct smu_event_params *param) diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c index 626ef47572..135ed9a178 100644 --- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c @@ -86,6 +86,31 @@ ucfg_pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc) return pkt_capture_get_pktcap_mode(psoc); } +/** + * ucfg_pkt_capture_set_pktcap_config - Set packet capture config + * @vdev: pointer to vdev object + * @config: config to be set + * + * Return: None + */ +void ucfg_pkt_capture_set_pktcap_config(struct wlan_objmgr_vdev *vdev, + enum pkt_capture_config config) +{ + pkt_capture_set_pktcap_config(vdev, config); +} + +/** + * ucfg_pkt_capture_get_pktcap_config - Get packet capture config + * @vdev: pointer to vdev object + * + * Return: config value + */ +enum pkt_capture_config +ucfg_pkt_capture_get_pktcap_config(struct wlan_objmgr_vdev *vdev) +{ + return pkt_capture_get_pktcap_config(vdev); +} + /** * ucfg_pkt_capture_init() - Packet capture component initialization. * @@ -315,12 +340,3 @@ ucfg_pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, { return pkt_capture_set_filter(frame_filter, vdev); } - -#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 -QDF_STATUS ucfg_pkt_capture_send_config - (struct wlan_objmgr_vdev *vdev, - enum pkt_capture_trigger_qos_config config) -{ - return tgt_pkt_capture_send_config(vdev, config); -} -#endif diff --git a/components/target_if/pkt_capture/src/target_if_pkt_capture.c b/components/target_if/pkt_capture/src/target_if_pkt_capture.c index faed9cd68c..5642861596 100644 --- a/components/target_if/pkt_capture/src/target_if_pkt_capture.c +++ b/components/target_if/pkt_capture/src/target_if_pkt_capture.c @@ -79,10 +79,11 @@ static QDF_STATUS target_if_set_packet_capture_config (struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, - enum pkt_capture_trigger_qos_config config_value) + enum pkt_capture_config config_value) { wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct wlan_objmgr_vdev *vdev; struct vdev_set_params param; if (!wmi_handle) { @@ -90,6 +91,13 @@ target_if_set_packet_capture_config return QDF_STATUS_E_INVAL; } + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, + WLAN_PKT_CAPTURE_ID); + if (!vdev) { + pkt_capture_err("vdev is NULL"); + return QDF_STATUS_E_INVAL; + } + target_if_debug("psoc:%pK, vdev_id:%d config_value:%d", psoc, vdev_id, config_value); @@ -98,9 +106,12 @@ target_if_set_packet_capture_config param.param_value = (uint32_t)config_value; status = wmi_unified_vdev_set_param_send(wmi_handle, ¶m); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_SUCCESS(status)) + ucfg_pkt_capture_set_pktcap_config(vdev, config_value); + else pkt_capture_err("failed to set packet capture config"); + wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID); return status; } #else @@ -108,7 +119,7 @@ static QDF_STATUS target_if_set_packet_capture_config (struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, - enum pkt_capture_trigger_qos_config config_value) + enum pkt_capture_config config_value) { return QDF_STATUS_SUCCESS; }