From 5a60cebf6d70b56ea4b4b41ac8bad8cd5701c29d Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Thu, 30 Jan 2020 10:05:49 +0530 Subject: [PATCH] qcacld-3.0: Send vdev param command to set pkt capture mode Send vdev param command to FW for STA vdev to set the packet capture mode. Send the command only if packet capture support is enabled. Change-Id: Ifed2431882b1f7d2869771e812daa5bcd5dc17e9 CRs-Fixed: 2619314 --- Kbuild | 7 +- .../pkt_capture/inc/target_if_pkt_capture.h | 42 ++++++++++++ .../pkt_capture/src/target_if_pkt_capture.c | 61 +++++++++++++++++ core/wma/inc/wma.h | 3 - core/wma/src/wma_dev_if.c | 66 ------------------- 5 files changed, 108 insertions(+), 71 deletions(-) create mode 100644 components/target_if/pkt_capture/inc/target_if_pkt_capture.h create mode 100644 components/target_if/pkt_capture/src/target_if_pkt_capture.c diff --git a/Kbuild b/Kbuild index 67436a50c305..de49b93baa6d 100644 --- a/Kbuild +++ b/Kbuild @@ -1043,13 +1043,16 @@ endif ######## PACKET CAPTURE ######## PKT_CAPTURE_DIR := components/pkt_capture +PKT_CAPTURE_TARGET_IF_DIR := components/target_if/pkt_capture/ PKT_CAPTURE_INC := -I$(WLAN_ROOT)/$(PKT_CAPTURE_DIR)/core/inc \ - -I$(WLAN_ROOT)/$(PKT_CAPTURE_DIR)/dispatcher/inc + -I$(WLAN_ROOT)/$(PKT_CAPTURE_DIR)/dispatcher/inc \ + -I$(WLAN_ROOT)/$(PKT_CAPTURE_TARGET_IF_DIR)/inc ifeq ($(CONFIG_WLAN_FEATURE_PKT_CAPTURE), y) PKT_CAPTURE_OBJS := $(PKT_CAPTURE_DIR)/core/src/wlan_pkt_capture_main.o \ $(PKT_CAPTURE_DIR)/core/src/wlan_pkt_capture_mon_thread.o \ - $(PKT_CAPTURE_DIR)/dispatcher/src/wlan_pkt_capture_ucfg_api.o + $(PKT_CAPTURE_DIR)/dispatcher/src/wlan_pkt_capture_ucfg_api.o \ + $(PKT_CAPTURE_TARGET_IF_DIR)/src/target_if_pkt_capture.o endif ########## FTM TIME SYNC ########## diff --git a/components/target_if/pkt_capture/inc/target_if_pkt_capture.h b/components/target_if/pkt_capture/inc/target_if_pkt_capture.h new file mode 100644 index 000000000000..8e4aedf03f99 --- /dev/null +++ b/components/target_if/pkt_capture/inc/target_if_pkt_capture.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 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 copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: Declare various api/struct which shall be used + * by packet capture component for wmi cmd (tx path) and + * event (rx) handling. + */ + +#ifndef _TARGET_IF_PKT_CAPTURE_H_ +#define _TARGET_IF_PKT_CAPTURE_H_ + +#include +#include "wlan_pkt_capture_public_structs.h" + +/** + * target_if_set_packet_capture_mode() - set packet capture mode + * @psoc: pointer to psoc object + * @vdev_id: vdev id + * @mode: mode to set + * + * Return: QDF_STATUS + */ +QDF_STATUS target_if_set_packet_capture_mode(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, + enum pkt_capture_mode mode); +#endif /* _TARGET_IF_PKT_CAPTURE_H_ */ 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 new file mode 100644 index 000000000000..d2d4bffea8d2 --- /dev/null +++ b/components/target_if/pkt_capture/src/target_if_pkt_capture.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2020 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 copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: Target interface file for pkt_capture component to + * Implement api's which shall be used by pkt_capture component + * in target_if internally. + */ + +#include +#include +#include +#include +#include +#include + +QDF_STATUS target_if_set_packet_capture_mode(struct wlan_objmgr_psoc *psoc, + uint8_t vdev_id, + enum pkt_capture_mode mode) +{ + wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc); + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + if (!wmi_handle) { + target_if_err("Invalid wmi handle"); + return QDF_STATUS_E_INVAL; + } + + target_if_debug("psoc:%pK, vdev_id:%d mode:%d", + psoc, vdev_id, mode); + + if (mode != PACKET_CAPTURE_MODE_DISABLE) { + struct vdev_set_params param; + + param.vdev_id = vdev_id; + param.param_id = WMI_VDEV_PARAM_PACKET_CAPTURE_MODE; + param.param_value = (uint32_t)mode; + + status = wmi_unified_vdev_set_param_send(wmi_handle, ¶m); + if (QDF_IS_STATUS_SUCCESS(status)) + ucfg_pkt_capture_set_pktcap_mode(psoc, mode); + else + pkt_capture_err("failed to set packet capture mode"); + } + return status; +} diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 50d00fc5d011..f82240e8afcc 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1121,9 +1121,6 @@ typedef struct { qdf_mc_timer_t wma_fw_time_sync_timer; bool fw_therm_throt_support; bool enable_tx_compl_tsf64; -#ifdef WLAN_FEATURE_PKT_CAPTURE - bool is_pktcapture_enabled; -#endif } t_wma_handle, *tp_wma_handle; /** diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 9ff743c4f313..3f4289424fde 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -60,9 +60,6 @@ #include #include #include -#ifdef WLAN_FEATURE_PKT_CAPTURE -#include -#endif /* WLAN_FEATURE_PKT_CAPTURE */ #include "wlan_policy_mgr_api.h" #include "wma_nan_datapath.h" @@ -2158,66 +2155,6 @@ static void wma_clear_iface_key(struct wma_txrx_node *iface) } #endif -#ifdef WLAN_FEATURE_PKT_CAPTURE -/** - * wma_set_packet_capture_mode() - set packet capture mode - * @wma: wma handle - * @vdev_id: vdev id - * @val: mode to set - * - * Return: 0 on success, errno on failure - */ -static int wma_set_packet_capture_mode( - tp_wma_handle wma_handle, - uint8_t vdev_id, - uint8_t val) -{ - int ret; - - ret = wma_cli_set_command(vdev_id, - WMI_VDEV_PARAM_PACKET_CAPTURE_MODE, - val, VDEV_CMD); - return ret; -} - -/** - * wma_handle_packet_capture_mode() - handle packet capture mode - * @wma_handle: wma handle - * @vdev_id: vdev id - * @pdev_id: pdev id - * - * Return: none - */ -static void wma_handle_packet_capture_mode( - tp_wma_handle wma_handle, - uint8_t vdev_id, uint8_t pdev_id) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - void *soc = cds_get_context(QDF_MODULE_ID_SOC); - - if (soc && cds_is_pktcapture_enabled() && - wma_handle->is_pktcapture_enabled && - (cds_get_pktcapture_mode() != PKT_CAPTURE_MODE_DISABLE)) { - uint8_t val = cds_get_pktcapture_mode(); - - status = wma_set_packet_capture_mode( - wma_handle, vdev_id, val); - - if (status != QDF_STATUS_SUCCESS) - WMA_LOGE("failed to set capture mode (err=%d)", - status); - else if (status == QDF_STATUS_SUCCESS) - cdp_set_packet_capture_mode(soc, pdev_id, val); - } -} -#else -static void wma_handle_packet_capture_mode( - tp_wma_handle wma_handle, - uint8_t vdev_id, uint8_t pdev_id) -{ -} -#endif - QDF_STATUS __wma_handle_vdev_stop_rsp(struct vdev_stop_response *resp_event) { @@ -2577,9 +2514,6 @@ QDF_STATUS wma_post_vdev_create_setup(struct wlan_objmgr_vdev *vdev) WMA_LOGE("failed to set sw retry threshold tx non aggr(status = %d)", status); - wma_handle_packet_capture_mode(wma_handle, vdev_id, - WMI_PDEV_ID_SOC); - status = wma_set_sw_retry_threshold_per_ac(wma_handle, vdev_id, qos_aggr); if (QDF_IS_STATUS_ERROR(status))