Bladeren bron

qcacmn: Honor Umac reset trigger atomically

Make sure the Umac reset state is updated when
the trigger is received only after checking
Umac reset in progress flag.

Change-Id: I2c6ac68bee5b69b1f083a109646cb6bf61d8cdd6
CRs-Fixed: 3487388
Pavankumar Nandeshwar 2 jaren geleden
bovenliggende
commit
e8bf99b94f
4 gewijzigde bestanden met toevoegingen van 57 en 18 verwijderingen
  1. 20 2
      dp/wifi3.0/be/mlo/dp_mlo.c
  2. 5 1
      dp/wifi3.0/dp_internal.h
  3. 15 15
      dp/wifi3.0/dp_umac_reset.c
  4. 17 0
      dp/wifi3.0/dp_umac_reset.h

+ 20 - 2
dp/wifi3.0/be/mlo/dp_mlo.c

@@ -1128,19 +1128,27 @@ void dp_umac_reset_complete_umac_recovery(struct dp_soc *soc)
 /**
  * dp_umac_reset_initiate_umac_recovery() - Initiate Umac reset session
  * @soc: dp soc handle
+ * @umac_reset_ctx: Umac reset context
+ * @rx_event: Rx event received
  * @is_target_recovery: Flag to indicate if it is triggered for target recovery
  *
  * Return: status
  */
 QDF_STATUS dp_umac_reset_initiate_umac_recovery(struct dp_soc *soc,
-						bool is_target_recovery)
+				struct dp_soc_umac_reset_ctx *umac_reset_ctx,
+				enum umac_reset_rx_event rx_event,
+				bool is_target_recovery)
 {
 	struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
 	struct dp_mlo_ctxt *mlo_ctx = be_soc->ml_ctxt;
 	struct dp_soc_mlo_umac_reset_ctx *grp_umac_reset_ctx;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
 	if (!mlo_ctx)
-		return QDF_STATUS_SUCCESS;
+		return dp_umac_reset_validate_n_update_state_machine_on_rx(
+					umac_reset_ctx, rx_event,
+					UMAC_RESET_STATE_WAIT_FOR_TRIGGER,
+					UMAC_RESET_STATE_DO_TRIGGER_RECEIVED);
 
 	grp_umac_reset_ctx = &mlo_ctx->grp_umac_reset_ctx;
 	qdf_spin_lock_bh(&grp_umac_reset_ctx->grp_ctx_lock);
@@ -1150,6 +1158,16 @@ QDF_STATUS dp_umac_reset_initiate_umac_recovery(struct dp_soc *soc,
 		return QDF_STATUS_E_INVAL;
 	}
 
+	status = dp_umac_reset_validate_n_update_state_machine_on_rx(
+					umac_reset_ctx, rx_event,
+					UMAC_RESET_STATE_WAIT_FOR_TRIGGER,
+					UMAC_RESET_STATE_DO_TRIGGER_RECEIVED);
+
+	if (status != QDF_STATUS_SUCCESS) {
+		qdf_spin_unlock_bh(&grp_umac_reset_ctx->grp_ctx_lock);
+		return status;
+	}
+
 	grp_umac_reset_ctx->umac_reset_in_progress = true;
 	grp_umac_reset_ctx->is_target_recovery = is_target_recovery;
 

+ 5 - 1
dp/wifi3.0/dp_internal.h

@@ -2707,12 +2707,16 @@ void dp_umac_reset_complete_umac_recovery(struct dp_soc *soc);
 /**
  * dp_umac_reset_initiate_umac_recovery() - Initiate Umac reset session
  * @soc: dp soc handle
+ * @umac_reset_ctx: Umac reset context
+ * @rx_event: Rx event received
  * @is_target_recovery: Flag to indicate if it is triggered for target recovery
  *
  * Return: status
  */
 QDF_STATUS dp_umac_reset_initiate_umac_recovery(struct dp_soc *soc,
-						bool is_target_recovery);
+				struct dp_soc_umac_reset_ctx *umac_reset_ctx,
+				enum umac_reset_rx_event rx_event,
+				bool is_target_recovery);
 
 /**
  * dp_umac_reset_handle_action_cb() - Function to call action callback

+ 15 - 15
dp/wifi3.0/dp_umac_reset.c

@@ -277,7 +277,7 @@ dp_umac_reset_get_rx_event(struct dp_soc_umac_reset_ctx *umac_reset_ctx)
  *
  * Return: QDF_STATUS of operation
  */
-static QDF_STATUS
+QDF_STATUS
 dp_umac_reset_validate_n_update_state_machine_on_rx(
 	struct dp_soc_umac_reset_ctx *umac_reset_ctx,
 	enum umac_reset_rx_event rx_event,
@@ -325,14 +325,21 @@ bool dp_check_umac_reset_in_progress(struct dp_soc *soc)
 /**
  * dp_umac_reset_initiate_umac_recovery() - Initiate Umac reset session
  * @soc: dp soc handle
+ * @umac_reset_ctx: Umac reset context
+ * @rx_event: Rx event received
  * @is_target_recovery: Flag to indicate if it is triggered for target recovery
  *
  * Return: status
  */
 static QDF_STATUS dp_umac_reset_initiate_umac_recovery(struct dp_soc *soc,
-						       bool is_target_recovery)
+				struct dp_soc_umac_reset_ctx *umac_reset_ctx,
+				enum umac_reset_rx_event rx_event,
+				bool is_target_recovery)
 {
-	return QDF_STATUS_SUCCESS;
+	return dp_umac_reset_validate_n_update_state_machine_on_rx(
+					umac_reset_ctx, rx_event,
+					UMAC_RESET_STATE_WAIT_FOR_TRIGGER,
+					UMAC_RESET_STATE_DO_TRIGGER_RECEIVED);
 }
 
 /**
@@ -472,23 +479,16 @@ static int dp_umac_reset_rx_event_handler(void *dp_ctx)
 		target_recovery = true;
 		/* Fall through */
 	case UMAC_RESET_RX_EVENT_DO_TRIGGER_RECOVERY:
-		status = dp_umac_reset_validate_n_update_state_machine_on_rx(
-			umac_reset_ctx, rx_event,
-			UMAC_RESET_STATE_WAIT_FOR_TRIGGER,
-			UMAC_RESET_STATE_DO_TRIGGER_RECEIVED);
-
-		if (status == QDF_STATUS_E_FAILURE)
-			goto exit;
-
-		umac_reset_ctx->ts.trigger_start =
-						qdf_get_log_timestamp_usecs();
-
 		status =
-		dp_umac_reset_initiate_umac_recovery(soc, target_recovery);
+		dp_umac_reset_initiate_umac_recovery(soc, umac_reset_ctx,
+						     rx_event, target_recovery);
 
 		if (status != QDF_STATUS_SUCCESS)
 			break;
 
+		umac_reset_ctx->ts.trigger_start =
+						qdf_get_log_timestamp_usecs();
+
 		action = UMAC_RESET_ACTION_DO_TRIGGER_RECOVERY;
 
 		break;

+ 17 - 0
dp/wifi3.0/dp_umac_reset.h

@@ -310,6 +310,23 @@ bool dp_check_umac_reset_in_progress(struct dp_soc *soc);
  * Return: QDF_STATUS
  */
 QDF_STATUS dp_umac_reset_stats_print(struct dp_soc *soc);
+
+/**
+ * dp_umac_reset_validate_n_update_state_machine_on_rx() - Validate the state
+ * machine for a given rx event and update the state machine
+ * @umac_reset_ctx: UMAC reset context
+ * @rx_event: Rx event
+ * @current_exp_state: Expected state
+ * @next_state: The state to which the state machine needs to be updated
+ *
+ * Return: QDF_STATUS of operation
+ */
+QDF_STATUS
+dp_umac_reset_validate_n_update_state_machine_on_rx(
+				struct dp_soc_umac_reset_ctx *umac_reset_ctx,
+				enum umac_reset_rx_event rx_event,
+				enum umac_reset_state current_exp_state,
+				enum umac_reset_state next_state);
 #else
 static inline bool dp_check_umac_reset_in_progress(struct dp_soc *soc)
 {