Commit e0c1ca23 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Johannes Berg

wifi: iwlwifi: honor the enable_ini value

In case the user sets the enable_ini to some preset, we want to honor
the value.

Remove the ops to set the value of the module parameter is runtime, we
don't want to allow to modify the value in runtime since we configure
the firmware once at the beginning on its life.

Fixes: b49c2b25 ("iwlwifi: Configure FW debug preset via module param.")
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230830112059.5734e0f374bb.I6698eda8ed2112378dd47ac5d62866ebe7a94f77@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent aee2eac7
......@@ -13,6 +13,7 @@
#define IWL_FW_INI_DOMAIN_ALWAYS_ON 0
#define IWL_FW_INI_REGION_ID_MASK GENMASK(15, 0)
#define IWL_FW_INI_REGION_DUMP_POLICY_MASK GENMASK(31, 16)
#define IWL_FW_INI_PRESET_DISABLE 0xff
/**
* struct iwl_fw_ini_hcmd
......
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*/
#ifndef __iwl_dbg_tlv_h__
#define __iwl_dbg_tlv_h__
......@@ -11,6 +11,7 @@
#include <fw/api/dbg-tlv.h>
#define IWL_DBG_TLV_MAX_PRESET 15
#define ENABLE_INI (IWL_DBG_TLV_MAX_PRESET + 1)
/**
* struct iwl_dbg_tlv_node - debug TLV node
......
......@@ -1795,6 +1795,22 @@ struct iwl_drv *iwl_drv_start(struct iwl_trans *trans)
#endif
drv->trans->dbg.domains_bitmap = IWL_TRANS_FW_DBG_DOMAIN(drv->trans);
if (iwlwifi_mod_params.enable_ini != ENABLE_INI) {
/* We have a non-default value in the module parameter,
* take its value
*/
drv->trans->dbg.domains_bitmap &= 0xffff;
if (iwlwifi_mod_params.enable_ini != IWL_FW_INI_PRESET_DISABLE) {
if (iwlwifi_mod_params.enable_ini > ENABLE_INI) {
IWL_ERR(trans,
"invalid enable_ini module parameter value: max = %d, using 0 instead\n",
ENABLE_INI);
iwlwifi_mod_params.enable_ini = 0;
}
drv->trans->dbg.domains_bitmap =
BIT(IWL_FW_DBG_DOMAIN_POS + iwlwifi_mod_params.enable_ini);
}
}
ret = iwl_request_firmware(drv, true);
if (ret) {
......@@ -1843,8 +1859,6 @@ void iwl_drv_stop(struct iwl_drv *drv)
kfree(drv);
}
#define ENABLE_INI (IWL_DBG_TLV_MAX_PRESET + 1)
/* shared module parameters */
struct iwl_mod_params iwlwifi_mod_params = {
.fw_restart = true,
......@@ -1964,38 +1978,7 @@ module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable, uint, 0644);
MODULE_PARM_DESC(uapsd_disable,
"disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3)");
static int enable_ini_set(const char *arg, const struct kernel_param *kp)
{
int ret = 0;
bool res;
__u32 new_enable_ini;
/* in case the argument type is a number */
ret = kstrtou32(arg, 0, &new_enable_ini);
if (!ret) {
if (new_enable_ini > ENABLE_INI) {
pr_err("enable_ini cannot be %d, in range 0-16\n", new_enable_ini);
return -EINVAL;
}
goto out;
}
/* in case the argument type is boolean */
ret = kstrtobool(arg, &res);
if (ret)
return ret;
new_enable_ini = (res ? ENABLE_INI : 0);
out:
iwlwifi_mod_params.enable_ini = new_enable_ini;
return 0;
}
static const struct kernel_param_ops enable_ini_ops = {
.set = enable_ini_set
};
module_param_cb(enable_ini, &enable_ini_ops, &iwlwifi_mod_params.enable_ini, 0644);
module_param_named(enable_ini, iwlwifi_mod_params.enable_ini, uint, 0444);
MODULE_PARM_DESC(enable_ini,
"0:disable, 1-15:FW_DBG_PRESET Values, 16:enabled without preset value defined,"
"Debug INI TLV FW debug infrastructure (default: 16)");
......
......@@ -56,6 +56,10 @@
* 6) Eventually, the free function will be called.
*/
/* default preset 0 (start from bit 16)*/
#define IWL_FW_DBG_DOMAIN_POS 16
#define IWL_FW_DBG_DOMAIN BIT(IWL_FW_DBG_DOMAIN_POS)
#define IWL_TRANS_FW_DBG_DOMAIN(trans) IWL_FW_INI_DOMAIN_ALWAYS_ON
#define FH_RSCSR_FRAME_SIZE_MSK 0x00003FFF /* bits 0-13 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment