From 4c6665c5ef5a20b31f4ae74cd7a46a2427bb2c80 Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Mon, 14 Jun 2021 16:11:10 +0530 Subject: [PATCH] qcacld-3.0: Pkt capture config for qos null and trigger frames Provide ucfg api to configure qos null and trigger frames. Ucfg api will send configuration to FW. Below configuration values are allowed. PACKET_CAPTURE_CONFIG_TRIGGER_QOS_DISABLE: disable capture for trigger and qos frames. 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. The packet capture config old value will be over written by new value. For example, first if we configure value as PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE and then if we send config as PACKET_CAPTURE_CONFIG_QOS_ENABLE then config is enabled only for qos. Change-Id: I02dcd4372c7194ec3e477694ad0e2c045fe6c942 CRs-Fixed: 2967824 --- .../inc/wlan_pkt_capture_public_structs.h | 23 ++++++++- .../dispatcher/inc/wlan_pkt_capture_tgt_api.h | 15 +++++- .../inc/wlan_pkt_capture_ucfg_api.h | 32 +++++++++++- .../dispatcher/src/wlan_pkt_capture_tgt_api.c | 38 +++++++++++++- .../src/wlan_pkt_capture_ucfg_api.c | 9 ++++ .../pkt_capture/src/target_if_pkt_capture.c | 49 +++++++++++++++++++ 6 files changed, 162 insertions(+), 4 deletions(-) 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 38e93730c14d..6f6ec36c9a9b 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -33,6 +33,22 @@ enum pkt_capture_mode { PACKET_CAPTURE_MODE_DATA_MGMT, }; +/** + * enum pkt_capture_trigger_qos_config - packet capture config + * @PACKET_CAPTURE_CONFIG_TRIGGER_QOS_DISABLE: disable capture for trigger and + * qos frames + * @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 + */ +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, +}; + /** * struct mgmt_offload_event_params - Management offload event params * @tsf_l32: The lower 32 bits of the TSF @@ -71,12 +87,17 @@ struct pkt_capture_callbacks { * struct wlan_pkt_capture_tx_ops - structure of tx operation function * pointers for packet capture component * @pkt_capture_send_mode: send packet capture mode + * @pkt_capture_send_config: send packet capture config * */ struct wlan_pkt_capture_tx_ops { QDF_STATUS (*pkt_capture_send_mode)(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, enum pkt_capture_mode mode); + QDF_STATUS (*pkt_capture_send_config) + (struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, + enum pkt_capture_trigger_qos_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 0f516ae8f4c5..fe5fcf28a3d2 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -52,4 +52,17 @@ tgt_pkt_capture_unregister_ev_handler(struct wlan_objmgr_vdev *vdev); 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 + * @config: packet capture config + * + * Return: QDF_STATUS + */ +QDF_STATUS +tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev, + enum pkt_capture_trigger_qos_config config); +#endif #endif /* _WLAN_PKT_CAPTURE_TGT_API_H */ 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 29bbd26fc07c..10147b580332 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -266,6 +266,28 @@ void ucfg_pkt_capture_record_channel(struct wlan_objmgr_vdev *vdev); int ucfg_pkt_capture_register_wma_callbacks(struct wlan_objmgr_psoc *psoc, struct pkt_capture_callbacks *cb_obj); + +#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) @@ -395,5 +417,13 @@ static inline void 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; +} #endif /* WLAN_FEATURE_PKT_CAPTURE */ #endif /* _WLAN_PKT_CAPTURE_UCFG_API_H_ */ 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 2361906eeae2..69c1e95e9b6c 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -117,3 +117,39 @@ 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) +{ + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct pkt_capture_vdev_priv *vdev_priv; + struct wlan_pkt_capture_tx_ops *tx_ops; + struct wlan_objmgr_psoc *psoc; + + psoc = wlan_vdev_get_psoc(vdev); + if (!psoc) { + pkt_capture_err("psoc is NULL"); + return status; + } + + vdev_priv = pkt_capture_vdev_get_priv(vdev); + if (!vdev_priv) { + pkt_capture_err("vdev priv is NULL"); + return status; + } + + tx_ops = &vdev_priv->tx_ops; + + if (!tx_ops->pkt_capture_send_config) + return status; + + status = tx_ops->pkt_capture_send_config(psoc, wlan_vdev_get_id(vdev), + config); + if (QDF_IS_STATUS_ERROR(status)) + pkt_capture_err("Unable to send packet capture config to fw"); + + return status; +} +#endif 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 11adcd3e76f6..97179fceeaa0 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 @@ -308,3 +308,12 @@ ucfg_pkt_capture_register_wma_callbacks(struct wlan_objmgr_psoc *psoc, return 0; } + +#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 7c31b5228f76..86567f7e8105 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 @@ -65,6 +65,54 @@ target_if_set_packet_capture_mode(struct wlan_objmgr_psoc *psoc, return status; } +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +/** + * target_if_set_packet_capture_config() - set packet capture config + * @psoc: pointer to psoc object + * @vdev_id: vdev id + * @config_value: config value + * + * Return: QDF_STATUS + */ +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) +{ + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); + QDF_STATUS status = QDF_STATUS_E_FAILURE; + struct vdev_set_params param; + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + target_if_debug("psoc:%pK, vdev_id:%d config_value:%d", + psoc, vdev_id, config_value); + + param.vdev_id = vdev_id; + param.param_id = WMI_VDEV_PARAM_SMART_MONITOR_CONFIG; + param.param_value = (uint32_t)config_value; + + status = wmi_unified_vdev_set_param_send(wmi_handle, ¶m); + if (QDF_IS_STATUS_ERROR(status)) + pkt_capture_err("failed to set packet capture config"); + + return status; +} +#else +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) +{ + return QDF_STATUS_SUCCESS; +} +#endif + /** * target_if_mgmt_offload_data_event_handler() - offload event handler * @handle: scn handle @@ -252,4 +300,5 @@ target_if_pkt_capture_register_tx_ops(struct wlan_pkt_capture_tx_ops *tx_ops) } tx_ops->pkt_capture_send_mode = target_if_set_packet_capture_mode; + tx_ops->pkt_capture_send_config = target_if_set_packet_capture_config; }