|
@@ -431,6 +431,40 @@ int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * hdd_wait_for_recovery_completion() - Wait for cds recovery completion
|
|
|
+ *
|
|
|
+ * Block the unloading of the driver (or) interface up until the
|
|
|
+ * cds recovery is completed
|
|
|
+ *
|
|
|
+ * Return: true for recovery completion else false
|
|
|
+ */
|
|
|
+static bool hdd_wait_for_recovery_completion(void)
|
|
|
+{
|
|
|
+ int retry = 0;
|
|
|
+
|
|
|
+ /* Wait for recovery to complete */
|
|
|
+ while (cds_is_driver_recovering()) {
|
|
|
+ if (retry == HDD_MOD_EXIT_SSR_MAX_RETRIES/2)
|
|
|
+ hdd_err("Recovery in progress; wait here!!!");
|
|
|
+ msleep(1000);
|
|
|
+ if (retry++ == HDD_MOD_EXIT_SSR_MAX_RETRIES) {
|
|
|
+ hdd_err("SSR never completed, error");
|
|
|
+ /*
|
|
|
+ * Trigger the bug_on in the internal builds, in the
|
|
|
+ * customer builds self-recovery will be enabled
|
|
|
+ * in those cases just return error.
|
|
|
+ */
|
|
|
+ if (cds_is_self_recovery_enabled())
|
|
|
+ return false;
|
|
|
+ QDF_BUG(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ hdd_info("Recovery completed successfully!");
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
static int __hdd_netdev_notifier_call(struct notifier_block *nb,
|
|
|
unsigned long state, void *data)
|
|
|
{
|
|
@@ -2443,6 +2477,11 @@ static int __hdd_open(struct net_device *dev)
|
|
|
MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST,
|
|
|
adapter->sessionId, adapter->device_mode));
|
|
|
|
|
|
+ if (!hdd_wait_for_recovery_completion()) {
|
|
|
+ hdd_err("Recovery failed");
|
|
|
+ return -EIO;
|
|
|
+ }
|
|
|
+
|
|
|
/* Nothing to be done if device is unloading */
|
|
|
if (cds_is_driver_unloading()) {
|
|
|
hdd_err("Driver is unloading can not open the hdd");
|
|
@@ -11172,28 +11211,6 @@ err_dev_state:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * hdd_wait_for_recovery_completion() - Wait for cds recovery completion
|
|
|
- *
|
|
|
- * Block the unloading of the driver until the cds recovery is completed
|
|
|
- *
|
|
|
- * Return: None
|
|
|
- */
|
|
|
-static void hdd_wait_for_recovery_completion(void)
|
|
|
-{
|
|
|
- int retry = 0;
|
|
|
-
|
|
|
- /* Wait for recovery to complete */
|
|
|
- while (cds_is_driver_recovering()) {
|
|
|
- hdd_err("Recovery in progress; wait here!!!");
|
|
|
- msleep(1000);
|
|
|
- if (retry++ == HDD_MOD_EXIT_SSR_MAX_RETRIES) {
|
|
|
- hdd_err("SSR never completed, error");
|
|
|
- QDF_BUG(0);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* __hdd_module_exit - Module exit helper
|
|
|
*
|