Browse Source

qcacld-3.0: Remove PLD_RECOVERY handling

The platform driver uevent handling in WLAN handles both the firmware-
down and "recovery" events. However, the recovery event on snoc
platforms is actually the firmware-crashed event. Recovery _is_ a valid
uevent for pcie platforms, but I20db3698602ea273038a3f024b4e5f61639f6d74
is adding support for the firmware down event.

Additionally, there is no good reason to handle both events, and the
various handling logics are spread across both events with little rhyme
or reason. Remove handling of the "recovery" platform uevent, and move all
associated logic to the firmware-down uevent handling.

Change-Id: I36b6f607438c930dff1936f372af80be311dfe49
CRs-Fixed: 2339357
Dustin Brown 6 years ago
parent
commit
8f05f65391

+ 0 - 7
core/hdd/inc/wlan_hdd_main.h

@@ -3306,13 +3306,6 @@ void hdd_start_driver_ops_timer(int drv_op);
  */
 void hdd_stop_driver_ops_timer(void);
 
-/**
- * hdd_pld_ipa_uc_shutdown_pipes() - Disconnect IPA WDI pipes during PDR
- *
- * Return: None
- */
-void hdd_pld_ipa_uc_shutdown_pipes(void);
-
 /**
  * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100%
  * (0x64). If it exceed make it 100%

+ 41 - 62
core/hdd/src/wlan_hdd_driver_ops.c

@@ -1483,7 +1483,7 @@ static void wlan_hdd_purge_notifier(void)
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
-		hdd_err("hdd context is NULL return!!");
+		hdd_err("hdd_ctx is null");
 		return;
 	}
 
@@ -1493,43 +1493,15 @@ static void wlan_hdd_purge_notifier(void)
 	cds_shutdown_notifier_call();
 	cds_shutdown_notifier_purge();
 	mutex_unlock(&hdd_ctx->iface_change_lock);
-	hdd_exit();
-}
 
-/**
- * wlan_hdd_set_the_pld_uevent() - set the pld event
- * @uevent: uevent status
- *
- * Return: void
- */
-static void wlan_hdd_set_the_pld_uevent(struct pld_uevent_data *uevent)
-{
-	switch (uevent->uevent) {
-	case PLD_RECOVERY:
-		cds_set_target_ready(false);
-		cds_set_recovery_in_progress(true);
-		break;
-	case PLD_FW_DOWN:
-		cds_set_target_ready(false);
-		cds_set_recovery_in_progress(true);
-		break;
-	}
+	hdd_exit();
 }
 
-/**
- * wlan_hdd_handle_the_pld_uevent() - handle the pld event
- * @uevent: uevent status
- *
- * Return: void
- */
-static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent)
+static void __hdd_firmware_down_handler(void)
 {
-	enum cds_driver_state driver_state;
 	struct hdd_context *hdd_ctx;
 
-	driver_state = cds_get_driver_state();
-
-	if (driver_state == CDS_DRIVER_STATE_UNINITIALIZED)
+	if (cds_get_driver_state() == CDS_DRIVER_STATE_UNINITIALIZED)
 		return;
 
 	if (cds_is_driver_loading())
@@ -1537,53 +1509,60 @@ static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent)
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
-		hdd_err("hdd_ctx is NULL return");
+		hdd_err("hdd_ctx is null");
 		return;
 	}
 
 	if (hdd_ctx->driver_status == DRIVER_MODULES_CLOSED) {
-		hdd_info("Driver modules are already closed!");
+		hdd_info("Driver modules are already closed");
 		return;
 	}
 
-	switch (uevent->uevent) {
-	case PLD_RECOVERY:
-		cds_set_target_ready(false);
-		hdd_pld_ipa_uc_shutdown_pipes();
-		break;
-	case PLD_FW_DOWN:
-		qdf_complete_wait_events();
-		cds_set_target_ready(false);
-		wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, NULL);
-		if (pld_is_fw_rejuvenate(hdd_ctx->parent_dev) &&
-		    ucfg_ipa_is_enabled())
+	cds_set_target_ready(false);
+	qdf_complete_wait_events();
+	wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, NULL);
+
+	if (ucfg_ipa_is_enabled()) {
+		ucfg_ipa_uc_force_pipe_shutdown(hdd_ctx->pdev);
+
+		if (pld_is_fw_rejuvenate(hdd_ctx->parent_dev))
 			ucfg_ipa_fw_rejuvenate_send_msg(hdd_ctx->pdev);
-		break;
-	default:
-		break;
 	}
 }
 
-/**
- * wlan_hdd_pld_uevent() - update driver status
- * @dev: device
- * @uevent: uevent status
- *
- * Return: void
- */
-static void wlan_hdd_pld_uevent(struct device *dev,
-				struct pld_uevent_data *uevent)
+static void hdd_firmware_down_handler(void)
 {
-	hdd_enter();
-	hdd_info("pld event %d", uevent->uevent);
+	hdd_info("Received firmware down indication");
+
+	cds_set_target_ready(false);
+	cds_set_recovery_in_progress(true);
 
-	wlan_hdd_set_the_pld_uevent(uevent);
 	mutex_lock(&hdd_init_deinit_lock);
-	wlan_hdd_handle_the_pld_uevent(uevent);
+	__hdd_firmware_down_handler();
 	mutex_unlock(&hdd_init_deinit_lock);
 
 	wlan_hdd_purge_notifier();
-	hdd_exit();
+}
+
+/**
+ * wlan_hdd_pld_uevent() - platform uevent handler
+ * @dev: device on which the uevent occurred
+ * @event_data: uevent parameters
+ *
+ * Return: None
+ */
+static void
+wlan_hdd_pld_uevent(struct device *dev, struct pld_uevent_data *event_data)
+{
+	hdd_debug("Received uevent %d", event_data->uevent);
+
+	switch (event_data->uevent) {
+	case PLD_FW_DOWN:
+		hdd_firmware_down_handler();
+		break;
+	default:
+		break;
+	}
 }
 
 #ifdef FEATURE_RUNTIME_PM

+ 0 - 10
core/hdd/src/wlan_hdd_main.c

@@ -14534,16 +14534,6 @@ void hdd_drv_ops_inactivity_handler(void)
 	cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
 }
 
-void hdd_pld_ipa_uc_shutdown_pipes(void)
-{
-	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-
-	if (!hdd_ctx)
-		return;
-
-	ucfg_ipa_uc_force_pipe_shutdown(hdd_ctx->pdev);
-}
-
 /**
  * hdd_set_rx_mode_rps() - Enable/disable RPS in SAP mode
  * @struct hdd_context *hdd_ctx

+ 6 - 4
core/pld/inc/pld_common.h

@@ -119,13 +119,15 @@ struct pld_platform_cap {
 };
 
 /**
- * enum pld_uevent - WLAN FW status
- * @PLD_RECOVERY: driver is recovering
- * @PLD_FW_DOWN: FW is down
+ * enum pld_uevent - PLD uevent event types
+ * @PLD_FW_DOWN: firmware is down
+ * @PLD_FW_CRASHED: firmware has crashed
+ * @PLD_FW_RECOVERY_START: firmware is starting recovery
  */
 enum pld_uevent {
-	PLD_RECOVERY,
 	PLD_FW_DOWN,
+	PLD_FW_CRASHED,
+	PLD_FW_RECOVERY_START,
 };
 
 /**

+ 1 - 1
core/pld/src/pld_pcie.c

@@ -192,7 +192,7 @@ static void pld_pcie_uevent(struct pci_dev *pdev, uint32_t status)
 
 	switch (status) {
 	case CNSS_RECOVERY:
-		data.uevent = PLD_RECOVERY;
+		data.uevent = PLD_FW_RECOVERY_START;
 		break;
 	case CNSS_FW_DOWN:
 		data.uevent = PLD_FW_DOWN;

+ 1 - 1
core/pld/src/pld_snoc.c

@@ -245,7 +245,7 @@ static int pld_snoc_uevent(struct device *dev,
 
 	switch (uevent->uevent) {
 	case ICNSS_UEVENT_FW_CRASHED:
-		data.uevent = PLD_RECOVERY;
+		data.uevent = PLD_FW_CRASHED;
 		break;
 	case ICNSS_UEVENT_FW_DOWN:
 		if (uevent->data == NULL)