From f324265e16c5571fc96363d3cf78128df30b804c Mon Sep 17 00:00:00 2001 From: Abdul Muqtadeer Ahmed Date: Thu, 17 Dec 2020 14:51:28 +0530 Subject: [PATCH] qcacld-3.0: Add new driver commands TPUT_DEBUG_MODE_ENABLE and TPUT_DEBUG_MODE_DISABLE are two new driver commands. So when this commands will get issue, host needs to send setUnitTestcmd with different arguments for different target to enable/disable the module logging. Change-Id: I5deb18f08f59ce936696e00b6537b0acf7c846a1 CRs-Fixed: 2842740 --- core/hdd/src/wlan_hdd_ioctl.c | 160 ++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 0e60e658a779..9ae09178fe01 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -38,6 +38,7 @@ #include "wma.h" #include "wlan_hdd_napi.h" #include "wlan_mlme_ucfg_api.h" +#include "target_type.h" #ifdef FEATURE_WLAN_ESE #include #include @@ -2293,6 +2294,145 @@ static int hdd_conc_set_dwell_time(struct hdd_adapter *adapter, return retval; } +static int hdd_enable_unit_test_commands(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx) +{ + enum pld_bus_type bus_type = pld_get_bus_type(hdd_ctx->parent_dev); + u32 arg[2]; + QDF_STATUS status; + + if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE || + hdd_get_conparam() == QDF_GLOBAL_MISSION_MODE) + return -EPERM; + + if (adapter->vdev_id >= WLAN_MAX_VDEVS) { + hdd_err_rl("Invalid vdev id"); + return -EINVAL; + } + + if (bus_type == PLD_BUS_TYPE_PCIE) { + arg[0] = 360; + arg[1] = 3; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_TX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + + arg[0] = 361; + arg[1] = 1; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_TX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + + if (hdd_ctx->target_type == TARGET_TYPE_QCA6390) { + arg[0] = 37; + arg[1] = 3000; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_RX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + } + + if (hdd_ctx->target_type == TARGET_TYPE_QCA6490) { + arg[0] = 39; + arg[1] = 3000; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_RX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + } + } else if (bus_type == PLD_BUS_TYPE_SNOC) { + arg[0] = 7; + arg[1] = 1; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + 0x44, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + } else { + return -EINVAL; + } + return 0; +} + +static int hdd_disable_unit_test_commands(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx) +{ + enum pld_bus_type bus_type = pld_get_bus_type(hdd_ctx->parent_dev); + u32 arg[2]; + QDF_STATUS status; + + if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE || + hdd_get_conparam() == QDF_GLOBAL_MISSION_MODE) + return -EPERM; + + if (adapter->vdev_id >= WLAN_MAX_VDEVS) { + hdd_err_rl("Invalid vdev id"); + return -EINVAL; + } + + if (bus_type == PLD_BUS_TYPE_PCIE) { + arg[0] = 360; + arg[1] = 0; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_TX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + + arg[0] = 361; + arg[1] = 0; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_TX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + + arg[0] = 39; + arg[1] = 0; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + WLAN_MODULE_RX, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + + } else if (bus_type == PLD_BUS_TYPE_SNOC) { + arg[0] = 7; + arg[1] = 0; + + status = sme_send_unit_test_cmd(adapter->vdev_id, + 0x44, + 2, + arg); + if (status != QDF_STATUS_SUCCESS) + return qdf_status_to_os_return(status); + } else { + return -EINVAL; + } + return 0; +} + static void hdd_get_link_status_cb(uint8_t status, void *context) { struct osif_request *request; @@ -4764,6 +4904,24 @@ exit: return ret; } +static int drv_cmd_tput_debug_mode_enable(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx, + u8 *command, + u8 command_len, + struct hdd_priv_data *priv_data) +{ + return hdd_enable_unit_test_commands(adapter, hdd_ctx); +} + +static int drv_cmd_tput_debug_mode_disable(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx, + u8 *command, + u8 command_len, + struct hdd_priv_data *priv_data) +{ + return hdd_disable_unit_test_commands(adapter, hdd_ctx); +} + #ifdef FEATURE_WLAN_ESE static int drv_cmd_set_ccx_roam_scan_channels(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx, @@ -7041,6 +7199,8 @@ static const struct hdd_drv_cmd hdd_drv_cmds[] = { {"GETDWELLTIME", drv_cmd_get_dwell_time, false}, {"SETDWELLTIME", drv_cmd_set_dwell_time, true}, {"MIRACAST", drv_cmd_miracast, true}, + {"TPUT_DEBUG_MODE_ENABLE", drv_cmd_tput_debug_mode_enable, false}, + {"TPUT_DEBUG_MODE_DISABLE", drv_cmd_tput_debug_mode_disable, false}, #ifdef FEATURE_WLAN_ESE {"SETCCXROAMSCANCHANNELS", drv_cmd_set_ccx_roam_scan_channels, true}, {"GETTSMSTATS", drv_cmd_get_tsm_stats, true},