Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit caab5b7d authored by Sameer Thalappil's avatar Sameer Thalappil
Browse files

icnss: Allow recursive recovery for WLAN



Recursive recovery is not allowed for WLAN on debug builds,
that is to ensure that certain error conditions are captured in
stress tests(eg: Modem SSR during WLAN PDR will result in download
mode to see if Modem really failed during PDR handling). But this
prevents adversarial testing of recovery use cases, so add knob to
allow recursive recovery.

CRs-Fixed: 2170294
Change-Id: If093f432be3dac48ede2864c3635d3be6b7b7808
Signed-off-by: default avatarSameer Thalappil <sameert@codeaurora.org>
parent af4ea937
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -463,6 +463,7 @@ static struct icnss_priv {
	struct ramdump_device *msa0_dump_dev;
	bool bypass_s1_smmu;
	bool force_err_fatal;
	bool allow_recursive_recovery;
	u8 cause_for_rejuvenation;
	u8 requesting_sub_system;
	u16 line_number;
@@ -2230,6 +2231,7 @@ static int icnss_pd_restart_complete(struct icnss_priv *priv)
	if (ret < 0) {
		icnss_pr_err("Driver reinit failed: %d, state: 0x%lx\n",
			     ret, priv->state);
		if (!priv->allow_recursive_recovery)
			ICNSS_ASSERT(false);
		goto out_power_off;
	}
@@ -2405,6 +2407,7 @@ static int icnss_driver_event_pd_service_down(struct icnss_priv *priv,
	if (test_bit(ICNSS_PD_RESTART, &priv->state) && event_data->crashed) {
		icnss_pr_err("PD Down while recovery inprogress, crashed: %d, state: 0x%lx\n",
			     event_data->crashed, priv->state);
		if (!priv->allow_recursive_recovery)
			ICNSS_ASSERT(0);
		goto out;
	}
@@ -3725,6 +3728,15 @@ static int icnss_test_mode_fw_test(struct icnss_priv *priv,
	return ret;
}

static void icnss_allow_recursive_recovery(struct device *dev)
{
	struct icnss_priv *priv = dev_get_drvdata(dev);

	priv->allow_recursive_recovery = true;

	icnss_pr_info("Recursive recovery allowed for WLAN\n");
}

static ssize_t icnss_fw_debug_write(struct file *fp,
				    const char __user *user_buf,
				    size_t count, loff_t *off)
@@ -3773,6 +3785,9 @@ static ssize_t icnss_fw_debug_write(struct file *fp,
		case 3:
			ret = icnss_trigger_recovery(&priv->pdev->dev);
			break;
		case 4:
			icnss_allow_recursive_recovery(&priv->pdev->dev);
			break;
		default:
			return -EINVAL;
		}