mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
qcacld-3.0: Better featurize the SSR injection debug code
The driver supports a "SSR injection" feature that is used during testing to validate certain recovery features. Currently this feature is protected by a generic WLAN_DEBUG feature flag, and in addition there are two separate debug ioctl handlers which have duplicate code. In order to better support a finer level of configurability introduce a new configuration flag and consolidate to a single implementation of the feature under that flag. Change-Id: I73e8dd4580ca53d129ae0181ffc46d011699f3dc CRs-Fixed: 2224815
This commit is contained in:
parent
810f3aed05
commit
df5d779c08
5 changed files with 56 additions and 41 deletions
3
Kbuild
3
Kbuild
|
|
@ -303,6 +303,7 @@ ifneq ($(TARGET_BUILD_VARIANT),user)
|
|||
else
|
||||
CONFIG_FEATURE_PKTLOG := y
|
||||
endif
|
||||
CONFIG_WLAN_DEBUG_CRASH_INJECT := y
|
||||
endif
|
||||
|
||||
#Enable WLAN/Power debugfs feature only if debug_fs is enabled
|
||||
|
|
@ -2063,7 +2064,7 @@ ccflags-y += -DTRACE_RECORD \
|
|||
-DHDD_TRACE_RECORD
|
||||
endif
|
||||
endif
|
||||
|
||||
ccflags-$(CONFIG_WLAN_DEBUG_CRASH_INJECT) += -DCONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||
ccflags-$(CONFIG_FEATURE_UNIT_TEST_SUSPEND) += -DWLAN_SUSPEND_RESUME_TEST
|
||||
|
||||
ifeq ($(CONFIG_LEAK_DETECTION), y)
|
||||
|
|
|
|||
|
|
@ -141,9 +141,7 @@ struct channel_list_info {
|
|||
#define QCSAP_IOCTL_GET_INI_CFG (SIOCIWFIRSTPRIV + 25)
|
||||
#define QCSAP_IOCTL_SET_INI_CFG (SIOCIWFIRSTPRIV + 26)
|
||||
#define QCSAP_IOCTL_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
|
||||
#ifdef WLAN_DEBUG
|
||||
#define QCSAP_IOCTL_SET_FW_CRASH_INJECT 1
|
||||
#endif
|
||||
#define QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL 2
|
||||
#define QCSAP_ENABLE_FW_PROFILE 3
|
||||
#define QCSAP_SET_FW_PROFILE_HIST_INTVL 4
|
||||
|
|
|
|||
|
|
@ -340,4 +340,27 @@ int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
|
|||
*/
|
||||
int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
|
||||
uint32_t bandwidth);
|
||||
|
||||
/**
|
||||
* hdd_crash_inject() - Inject a crash
|
||||
* @adapter: Adapter upon which the command was received
|
||||
* @v1: first value to inject
|
||||
* @v2: second value to inject
|
||||
*
|
||||
* This function is the handler for the crash inject debug feature.
|
||||
* This feature only exists for internal testing and must not be
|
||||
* enabled on a production device.
|
||||
*
|
||||
* Return: result of the command
|
||||
*/
|
||||
#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||
int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2);
|
||||
#else
|
||||
static inline
|
||||
int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
|
||||
{
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __WEXT_IW_H__ */
|
||||
|
|
|
|||
|
|
@ -3055,24 +3055,9 @@ static int __iw_softap_set_two_ints_getnone(struct net_device *dev,
|
|||
return ret;
|
||||
|
||||
switch (sub_cmd) {
|
||||
#ifdef WLAN_DEBUG
|
||||
case QCSAP_IOCTL_SET_FW_CRASH_INJECT:
|
||||
hdd_err("WE_SET_FW_CRASH_INJECT: %d %d",
|
||||
value[1], value[2]);
|
||||
if (!hdd_ctx->config->crash_inject_enabled) {
|
||||
hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
|
||||
return 0;
|
||||
}
|
||||
if (value[1] == 3) {
|
||||
cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
|
||||
return 0;
|
||||
}
|
||||
ret = wma_cli_set2_command(adapter->session_id,
|
||||
GEN_PARAM_CRASH_INJECT,
|
||||
value[1], value[2],
|
||||
GEN_CMD);
|
||||
ret = hdd_crash_inject(adapter, value[1], value[2]);
|
||||
break;
|
||||
#endif
|
||||
case QCSAP_IOCTL_DUMP_DP_TRACE_LEVEL:
|
||||
hdd_debug("WE_DUMP_DP_TRACE: %d %d",
|
||||
value[1], value[2]);
|
||||
|
|
@ -5868,7 +5853,7 @@ static const struct iw_priv_args hostapd_private_args[] = {
|
|||
}
|
||||
,
|
||||
/* handlers for sub-ioctl */
|
||||
#ifdef WLAN_DEBUG
|
||||
#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||
{
|
||||
QCSAP_IOCTL_SET_FW_CRASH_INJECT,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
|
||||
|
|
|
|||
|
|
@ -2786,9 +2786,7 @@
|
|||
/* Private ioctls and their sub-ioctls */
|
||||
#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
|
||||
#define WE_SET_SMPS_PARAM 1
|
||||
#ifdef WLAN_DEBUG
|
||||
#define WE_SET_FW_CRASH_INJECT 2
|
||||
#endif
|
||||
#define WE_DUMP_DP_TRACE_LEVEL 3
|
||||
/* Private sub ioctl for enabling and setting histogram interval of profiling */
|
||||
#define WE_ENABLE_FW_PROFILE 4
|
||||
|
|
@ -9314,6 +9312,32 @@ static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||
int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
|
||||
{
|
||||
struct hdd_context *hdd_ctx;
|
||||
int ret;
|
||||
|
||||
hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
|
||||
v1, v2);
|
||||
pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
|
||||
v1, v2);
|
||||
hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
if (!hdd_ctx->config->crash_inject_enabled) {
|
||||
hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
|
||||
return 0;
|
||||
}
|
||||
if (v1 == 3) {
|
||||
cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
|
||||
return 0;
|
||||
}
|
||||
ret = wma_cli_set2_command(adapter->session_id,
|
||||
GEN_PARAM_CRASH_INJECT,
|
||||
v1, v2, GEN_CMD);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int __iw_set_two_ints_getnone(struct net_device *dev,
|
||||
struct iw_request_info *info,
|
||||
union iwreq_data *wrqu, char *extra)
|
||||
|
|
@ -9343,25 +9367,9 @@ static int __iw_set_two_ints_getnone(struct net_device *dev,
|
|||
| value[2],
|
||||
VDEV_CMD);
|
||||
break;
|
||||
#ifdef WLAN_DEBUG
|
||||
case WE_SET_FW_CRASH_INJECT:
|
||||
hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
|
||||
value[1], value[2]);
|
||||
pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
|
||||
value[1], value[2]);
|
||||
if (!hdd_ctx->config->crash_inject_enabled) {
|
||||
hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
|
||||
return 0;
|
||||
}
|
||||
if (value[1] == 3) {
|
||||
cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
|
||||
return 0;
|
||||
}
|
||||
ret = wma_cli_set2_command(adapter->session_id,
|
||||
GEN_PARAM_CRASH_INJECT,
|
||||
value[1], value[2], GEN_CMD);
|
||||
ret = hdd_crash_inject(adapter, value[1], value[2]);
|
||||
break;
|
||||
#endif
|
||||
case WE_ENABLE_FW_PROFILE:
|
||||
hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
|
||||
value[1], value[2]);
|
||||
|
|
@ -10585,18 +10593,18 @@ static const struct iw_priv_args we_private_args[] = {
|
|||
IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
|
||||
0, "set_dot11p" }
|
||||
,
|
||||
#ifdef WLAN_DEBUG
|
||||
#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
|
||||
{WE_SET_FW_CRASH_INJECT,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
|
||||
0, "crash_inject"}
|
||||
,
|
||||
#endif
|
||||
#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
|
||||
{WE_LOG_BUFFER,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
|
||||
0, "log_buffer"}
|
||||
,
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WLAN_SUSPEND_RESUME_TEST
|
||||
{WE_SET_WLAN_SUSPEND,
|
||||
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
|
||||
|
|
|
|||
Loading…
Reference in a new issue