From e1f0d3b5e32bb835982f90eabb3a081c594e84dc Mon Sep 17 00:00:00 2001 From: Dundi Raviteja Date: Wed, 25 Apr 2018 16:48:05 +0530 Subject: [PATCH] qcacld-3.0: Add support to dynamicaly configure concurrent dwell time Add new driver command to dynamically configure concurrent active and passive dwell time parameters. Change-Id: Ib758786349f8889600cab34609f5c7763fc36251 CRs-Fixed: 2230861 --- core/hdd/src/wlan_hdd_ioctl.c | 139 ++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 7d43407b5708..c6cb07b31a4d 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -2362,6 +2362,131 @@ struct link_status_priv { uint8_t link_status; }; +#ifdef WLAN_AP_STA_CONCURRENCY +/** + * hdd_conc_set_dwell_time() - Set Concurrent dwell time parameters + * @adapter: Adapter upon which the command was received + * @command: ASCII text command that is received + * + * Driver commands: + * wpa_cli DRIVER CONCSETDWELLTIME ACTIVE MAX + * wpa_cli DRIVER CONCSETDWELLTIME ACTIVE MIN + * wpa_cli DRIVER CONCSETDWELLTIME PASSIVE MAX + * wpa_cli DRIVER CONCSETDWELLTIME PASSIVE MIN + * + * Return: 0 for success non-zero for failure + */ +static int hdd_conc_set_dwell_time(hdd_context_t *hdd_ctx, uint8_t *command) +{ + tHalHandle hhal; + struct hdd_config *p_cfg; + u8 *value = command; + tSmeConfigParams *sme_config; + int val = 0, temp = 0; + int retval = 0; + + p_cfg = hdd_ctx->config; + hhal = hdd_ctx->hHal; + if (!p_cfg || !hhal) { + hdd_err("Argument passed for CONCSETDWELLTIME is incorrect"); + return -EINVAL; + } + + sme_config = qdf_mem_malloc(sizeof(*sme_config)); + if (!sme_config) { + hdd_err("Failed to allocate memory for sme_config"); + return -ENOMEM; + } + + qdf_mem_zero(sme_config, sizeof(*sme_config)); + sme_get_config_param(hhal, sme_config); + + if (strncmp(command, "CONCSETDWELLTIME ACTIVE MAX", 27) == 0) { + if (drv_cmd_validate(command, 27)) { + hdd_err("Invalid driver command"); + retval = -EINVAL; + goto sme_config_free; + } + + value = value + 28; + temp = kstrtou32(value, 10, &val); + if (temp != 0 || val < CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_MIN || + val > CFG_ACTIVE_MAX_CHANNEL_TIME_CONC_MAX) { + hdd_err("Argument passed for CONCSETDWELLTIME ACTIVE MAX is incorrect"); + retval = -EFAULT; + goto sme_config_free; + } + + p_cfg->nActiveMaxChnTimeConc = val; + sme_config->csrConfig.nActiveMaxChnTimeConc = val; + sme_update_config(hhal, sme_config); + } else if (strncmp(command, "CONCSETDWELLTIME ACTIVE MIN", 27) == 0) { + if (drv_cmd_validate(command, 27)) { + hdd_err("Invalid driver command"); + retval = -EINVAL; + goto sme_config_free; + } + + value = value + 28; + temp = kstrtou32(value, 10, &val); + if (temp != 0 || val < CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_MIN || + val > CFG_ACTIVE_MIN_CHANNEL_TIME_CONC_MAX) { + hdd_err("argument passed for CONCSETDWELLTIME ACTIVE MIN is incorrect"); + retval = -EFAULT; + goto sme_config_free; + } + + p_cfg->nActiveMinChnTimeConc = val; + sme_config->csrConfig.nActiveMinChnTimeConc = val; + sme_update_config(hhal, sme_config); + } else if (strncmp(command, "CONCSETDWELLTIME PASSIVE MAX", 28) == 0) { + if (drv_cmd_validate(command, 28)) { + hdd_err("Invalid driver command"); + retval = -EINVAL; + goto sme_config_free; + } + + value = value + 29; + temp = kstrtou32(value, 10, &val); + if (temp != 0 || val < CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_MIN || + val > CFG_PASSIVE_MAX_CHANNEL_TIME_CONC_MAX) { + hdd_err("Argument passed for CONCSETDWELLTIME PASSIVE MAX is incorrect"); + retval = -EFAULT; + goto sme_config_free; + } + + p_cfg->nPassiveMaxChnTimeConc = val; + sme_config->csrConfig.nPassiveMaxChnTimeConc = val; + sme_update_config(hhal, sme_config); + } else if (strncmp(command, "CONCSETDWELLTIME PASSIVE MIN", 28) == 0) { + if (drv_cmd_validate(command, 28)) { + hdd_err("Invalid driver command"); + retval = -EINVAL; + goto sme_config_free; + } + + value = value + 29; + temp = kstrtou32(value, 10, &val); + if (temp != 0 || val < CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_MIN || + val > CFG_PASSIVE_MIN_CHANNEL_TIME_CONC_MAX) { + hdd_err("argument passed for SETDWELLTIME PASSIVE MIN is incorrect"); + retval = -EFAULT; + goto sme_config_free; + } + + p_cfg->nPassiveMinChnTimeConc = val; + sme_config->csrConfig.nPassiveMinChnTimeConc = val; + sme_update_config(hhal, sme_config); + } else { + retval = -EINVAL; + } + +sme_config_free: + qdf_mem_free(sme_config); + return retval; +} +#endif + static void hdd_get_link_status_cb(uint8_t status, void *context) { struct hdd_request *request; @@ -4641,6 +4766,17 @@ static int drv_cmd_set_dwell_time(struct hdd_adapter *adapter, return hdd_set_dwell_time(adapter, command); } +#ifdef WLAN_AP_STA_CONCURRENCY +static int drv_cmd_conc_set_dwell_time(hdd_adapter_t *adapter, + hdd_context_t *hdd_ctx, + u8 *command, + u8 command_len, + hdd_priv_data_t *priv_data) +{ + return hdd_conc_set_dwell_time(hdd_ctx, command); +} +#endif + static int drv_cmd_miracast(struct hdd_adapter *adapter, struct hdd_context *hdd_ctx, uint8_t *command, @@ -6821,6 +6957,9 @@ static const struct hdd_drv_cmd hdd_drv_cmds[] = { {"BTCOEXMODE", drv_cmd_bt_coex_mode, true}, {"SCAN-ACTIVE", drv_cmd_scan_active, false}, {"SCAN-PASSIVE", drv_cmd_scan_passive, false}, +#ifdef WLAN_AP_STA_CONCURRENCY + {"CONCSETDWELLTIME", drv_cmd_conc_set_dwell_time, true}, +#endif {"GETDWELLTIME", drv_cmd_get_dwell_time, false}, {"SETDWELLTIME", drv_cmd_set_dwell_time, true}, {"MIRACAST", drv_cmd_miracast, true},