Skip to contentSkip to conversation

ath11k: enable support for subsystem recovery.

PATCH New Pradeep Kumar Chitrapu 1 participant 1 message Apr 17, 2019 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath11k: enable support for subsystem recovery.

When underlying device crash for some reason, driver will restore wireless state and perform the recovery.

---
 drivers/net/wireless/ath/ath11k/ahb.h  |  2 +-
 drivers/net/wireless/ath/ath11k/core.c | 10 +++++-----
 drivers/net/wireless/ath/ath11k/qmi.c  | 19 ++++++++++---------
 3 files changed, 16 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.h +1 -1
index b0bc4e763dbc..8a6b308d4a6a 100644
@@ -7,7 +7,7 @@
 
 #include "core.h"
 
-#define ATH11K_AHB_RECOVERY_TIMEOUT (100000 * HZ)
+#define ATH11K_AHB_RECOVERY_TIMEOUT (3 * HZ)
 struct ath11k_base;
 
 u32 ath11k_ahb_read32(struct ath11k_base *ab, u32 address);
drivers/net/wireless/ath/ath11k/core.c +5 -5
index 5d7c78b8c570..dc56df5d98f6 100644
@@ -625,13 +625,16 @@ static int ath11k_core_reconfigure_on_crash(struct ath11k_base *sc)
 {
 	int ret;
 
+	mutex_lock(&sc->core_lock);
 	ath11k_ahb_ext_irq_disable(sc);
-
 	ath11k_dp_pdev_free(sc);
-	ath11k_dp_free(sc);
 	ath11k_ahb_stop(sc);
 	ath11k_wmi_detach(sc);
+	mutex_unlock(&sc->core_lock);
+
+	ath11k_dp_free(sc);
 	ath11k_hal_srng_deinit(sc);
+
 	sc->free_vdev_map = (1LL << (sc->num_radios * TARGET_NUM_VDEVS)) - 1;
 
 	ret = ath11k_hal_srng_init(sc);
@@ -707,13 +710,11 @@ static void ath11k_core_restart(struct work_struct *work)
 	wake_up(&sc->wmi_sc.tx_credits_wq);
 	wake_up(&sc->peer_mapping_wq);
 
-	mutex_lock(&sc->core_lock);
 	ret = ath11k_core_reconfigure_on_crash(sc);
 	if (ret) {
 		ath11k_err(sc, "failed to reconfigure driver on crash recovery\n");
 		return;
 	}
-	mutex_unlock(&sc->core_lock);
 
 	for (i = 0; i < sc->num_radios; i++) {
 		pdev = &sc->pdevs[i];
@@ -767,7 +768,6 @@ int ath11k_core_init(struct ath11k_base *sc)
 	sc->tgt_rproc = prproc;
 	sc->hw_params = ath11k_hw_params;
 
-	set_bit(ATH11K_FLAG_REGISTERED, &sc->dev_flags);
 	ret = ath11k_core_soc_create(sc);
 	if (ret) {
 		ath11k_err(sc, "failed to create soc core: %d\n", ret);
drivers/net/wireless/ath/ath11k/qmi.c +10 -9
index af09686fbe70..aca717ca1955 100644
@@ -2351,6 +2351,9 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
 		list_del(&event->list);
 		spin_unlock(&qmi->event_lock);
 
+		if (test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))
+			return;
+
 		switch (event->type) {
 		case ATH11K_QMI_EVENT_SERVER_ARRIVE:
 			ath11k_qmi_event_server_arrive(qmi);
@@ -2366,17 +2369,15 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
 			ath11k_qmi_event_load_bdf(qmi);
 			break;
 		case ATH11K_QMI_EVENT_FW_READY:
-			if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags) &&
-			    !test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags) &&
-			    ab->qmi.cal_done) {
-				set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
-				set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
+			if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
 				queue_work(ab->workqueue, &ab->restart_work);
+				break;
 			}
-			else {
-				ath11k_qmi_firmware_indication(ab);
-				ab->qmi.cal_done = 1;
-			}
+
+			ath11k_qmi_firmware_indication(ab);
+			ab->qmi.cal_done = 1;
+			set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
+
 			break;
 		case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE:
 			break;
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k