Explorar el Código

qcacld-3.0: Enhance mlme_twt_is_command_in_progress() to return active_cmd

Currently, mlme_twt_is_command_in_progress() function checks if the given
command is in progress or not. For inputs like WLAN_TWT_ANY, if this function
returns true then from the current logs, its not known which
active command in progress.

Hence for better debugging, enhance this function to return active command.

Change-Id: Ibc5c5babb042408b0e8988fe229d344ed98bfff3
CRs-Fixed: 2920494
Srinivas Girigowda hace 4 años
padre
commit
8703e09f92

+ 4 - 2
components/mlme/core/inc/wlan_mlme_twt_api.h

@@ -189,18 +189,20 @@ QDF_STATUS mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
 					    enum wlan_twt_commands cmd);
 
 /**
- * mlme_twt_is_command_in_progress() - Get TWT command in progress.
+ * mlme_twt_is_command_in_progress() - Check if given command is in progress
  * @psoc: Pointer to psoc object
  * @peer_mac: Pointer to peer mac address
  * @dialog_id: Dialog id
  * @cmd: TWT command
+ * @active_cmd: Fill the active command in this output parameter
  *
  * Return: True if given command is in progress.
  */
 bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
 				     struct qdf_mac_addr *peer_mac,
 				     uint8_t dialog_id,
-				     enum wlan_twt_commands cmd);
+				     enum wlan_twt_commands cmd,
+				     enum wlan_twt_commands *active_cmd);
 
 /**
  * mlme_is_24ghz_twt_enabled() - Get if TWT is enabled on 2.4Ghz

+ 6 - 1
components/mlme/core/src/wlan_mlme_twt_api.c

@@ -476,7 +476,8 @@ bool mlme_is_twt_notify_in_progress(struct wlan_objmgr_psoc *psoc,
 bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
 				     struct qdf_mac_addr *peer_mac,
 				     uint8_t dialog_id,
-				     enum wlan_twt_commands cmd)
+				     enum wlan_twt_commands cmd,
+				     enum wlan_twt_commands *pactive_cmd)
 {
 	struct wlan_objmgr_peer *peer;
 	struct peer_mlme_priv_obj *peer_priv;
@@ -501,6 +502,10 @@ bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
 
 	for (i = 0; i < peer_priv->twt_ctx.num_twt_sessions; i++) {
 		active_cmd = peer_priv->twt_ctx.session_info[i].active_cmd;
+
+		if (pactive_cmd)
+			*pactive_cmd = active_cmd;
+
 		if (peer_priv->twt_ctx.session_info[i].dialog_id == dialog_id ||
 		    dialog_id == WLAN_ALL_SESSIONS_DIALOG_ID) {
 			if (cmd == WLAN_TWT_ANY) {

+ 9 - 4
components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h

@@ -217,11 +217,13 @@ ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
 }
 
 /**
- * ucfg_mlme_twt_is_command_in_progress() - Get TWT command in progress
+ * ucfg_mlme_twt_is_command_in_progress() - Check if given command is in
+ * progress
  * @psoc: Pointer to global PSOC object
  * @peer_mac: Global peer mac address
  * @dialog_id: TWT session dialog id
  * @cmd: TWT command
+ * @active_cmd: Fill active command in this output parameter
  *
  * Return: True if given command is in progress
  */
@@ -230,9 +232,11 @@ static inline bool
 ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
 				     struct qdf_mac_addr *peer_mac,
 				     uint8_t dialog_id,
-				     enum wlan_twt_commands cmd)
+				     enum wlan_twt_commands cmd,
+				     enum wlan_twt_commands *active_cmd)
 {
-	return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id, cmd);
+	return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id,
+					       cmd, active_cmd);
 }
 
 static inline QDF_STATUS
@@ -520,7 +524,8 @@ static inline bool
 ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
 				     struct qdf_mac_addr *peer_mac,
 				     uint8_t dialog_id,
-				     enum wlan_twt_commands cmd)
+				     enum wlan_twt_commands cmd,
+				     enum wlan_twt_commands *active_cmd)
 {
 	return false;
 }

+ 6 - 4
core/hdd/src/wlan_hdd_twt.c

@@ -2767,11 +2767,12 @@ static int hdd_twt_clear_session_traffic_stats(struct hdd_adapter *adapter,
 	if (ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
 						 &hdd_sta_ctx->conn_info.bssid,
 						 WLAN_ALL_SESSIONS_DIALOG_ID,
-						 WLAN_TWT_STATISTICS) ||
+						 WLAN_TWT_STATISTICS, NULL) ||
 	   ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
 						&hdd_sta_ctx->conn_info.bssid,
 						WLAN_ALL_SESSIONS_DIALOG_ID,
-						WLAN_TWT_CLEAR_STATISTICS)) {
+						WLAN_TWT_CLEAR_STATISTICS,
+						NULL)) {
 		hdd_warn("Already TWT statistics or clear statistics exists");
 		return -EALREADY;
 	}
@@ -2882,11 +2883,12 @@ static int hdd_twt_get_session_traffic_stats(struct hdd_adapter *adapter,
 	if (ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
 						 &hdd_sta_ctx->conn_info.bssid,
 						 WLAN_ALL_SESSIONS_DIALOG_ID,
-						 WLAN_TWT_STATISTICS) ||
+						 WLAN_TWT_STATISTICS, NULL) ||
 	    ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
 						 &hdd_sta_ctx->conn_info.bssid,
 						 WLAN_ALL_SESSIONS_DIALOG_ID,
-						 WLAN_TWT_CLEAR_STATISTICS)) {
+						 WLAN_TWT_CLEAR_STATISTICS,
+						 NULL)) {
 		hdd_warn("Already TWT statistics or clear statistics exists");
 		return -EALREADY;
 	}

+ 32 - 22
core/sme/src/common/sme_api.c

@@ -2016,23 +2016,24 @@ sme_process_twt_add_dialog_event(struct mac_context *mac,
 {
 	bool is_evt_allowed;
 	bool setup_done;
-	enum WMI_HOST_ADD_TWT_STATUS status;
+	enum WMI_HOST_ADD_TWT_STATUS status = add_dialog_event->params.status;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	is_evt_allowed = mlme_twt_is_command_in_progress(
 		mac->psoc,
 		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
-		add_dialog_event->params.dialog_id, WLAN_TWT_SETUP);
+		add_dialog_event->params.dialog_id, WLAN_TWT_SETUP,
+		&active_cmd);
 	if (!is_evt_allowed) {
-		sme_debug("add dialog event dropped for id:%d",
-			  add_dialog_event->params.dialog_id);
+		sme_debug("Drop TWT add dialog event for dialog_id:%d status:%d active_cmd:%d",
+			  add_dialog_event->params.dialog_id, status, active_cmd);
 		return;
 	}
 
 	setup_done = ucfg_mlme_is_twt_setup_done(mac->psoc,
 		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
 		add_dialog_event->params.dialog_id);
-	status = add_dialog_event->params.status;
-	sme_debug("setup_done: %d status: %d", setup_done, status);
+	sme_debug("setup_done:%d status:%d", setup_done, status);
 
 	if (setup_done && status) {
 		/* This is re-negotiation failure case */
@@ -2074,17 +2075,18 @@ sme_process_twt_del_dialog_event(struct mac_context *mac,
 {
 	twt_del_dialog_cb callback;
 	bool is_evt_allowed;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	is_evt_allowed = mlme_twt_is_command_in_progress(
 		mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr,
-		param->dialog_id, WLAN_TWT_TERMINATE);
+		param->dialog_id, WLAN_TWT_TERMINATE, &active_cmd);
 	if (!is_evt_allowed &&
 	    param->dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID &&
 	    param->status != WMI_HOST_DEL_TWT_STATUS_ROAMING &&
 	    param->status != WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN &&
 	    param->status != WMI_HOST_DEL_TWT_STATUS_CONCURRENCY) {
-		sme_debug("Del dialog event dropped for id:%d status:%d",
-			  param->dialog_id, param->status);
+		sme_debug("Drop TWT Del dialog event for dialog_id:%d status:%d active_cmd:%d",
+			  param->dialog_id, param->status, active_cmd);
 		return;
 	}
 
@@ -2160,13 +2162,14 @@ sme_process_twt_nudge_dialog_event(struct mac_context *mac,
 {
 	twt_nudge_dialog_cb callback;
 	bool is_evt_allowed;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	is_evt_allowed = mlme_twt_is_command_in_progress(
 		mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr,
-		param->dialog_id, WLAN_TWT_NUDGE);
+		param->dialog_id, WLAN_TWT_NUDGE, &active_cmd);
 	if (!is_evt_allowed &&
 	    param->dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID) {
-		sme_debug("Nudge event dropped");
+		sme_debug("Nudge event dropped active_cmd:%d", active_cmd);
 		return;
 	}
 
@@ -13829,6 +13832,7 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle,
 	QDF_STATUS status;
 	void *wma_handle;
 	struct wmi_twt_add_dialog_param *cmd_params;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	SME_ENTER();
 
@@ -13843,9 +13847,9 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle,
 	is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,
-			twt_params->dialog_id, WLAN_TWT_ANY);
+			twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
 	if (is_twt_cmd_in_progress) {
-		sme_debug("Already TWT command is in progress");
+		sme_debug("Already TWT command:%d is in progress", active_cmd);
 		return QDF_STATUS_E_PENDING;
 	}
 
@@ -13915,6 +13919,7 @@ QDF_STATUS sme_del_dialog_cmd(mac_handle_t mac_handle,
 	QDF_STATUS status;
 	void *wma_handle;
 	struct wmi_twt_del_dialog_param *cmd_params;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	SME_ENTER();
 
@@ -13922,13 +13927,14 @@ QDF_STATUS sme_del_dialog_cmd(mac_handle_t mac_handle,
 		mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,
-			twt_params->dialog_id, WLAN_TWT_SETUP) ||
+			twt_params->dialog_id, WLAN_TWT_SETUP, &active_cmd) ||
 		mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,
-			twt_params->dialog_id, WLAN_TWT_TERMINATE);
+			twt_params->dialog_id, WLAN_TWT_TERMINATE,
+			&active_cmd);
 	if (is_twt_cmd_in_progress) {
-		sme_debug("Already TWT command is in progress");
+		sme_debug("Already TWT command:%d is in progress", active_cmd);
 		return QDF_STATUS_E_PENDING;
 	}
 
@@ -13988,15 +13994,16 @@ sme_pause_dialog_cmd(mac_handle_t mac_handle,
 	bool is_twt_cmd_in_progress;
 	QDF_STATUS status;
 	void *wma_handle;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	SME_ENTER();
 
 	is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,
-			twt_params->dialog_id, WLAN_TWT_ANY);
+			twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
 	if (is_twt_cmd_in_progress) {
-		sme_debug("Already TWT command is in progress");
+		sme_debug("Already TWT command:%d is in progress", active_cmd);
 		return QDF_STATUS_E_PENDING;
 	}
 
@@ -14055,17 +14062,19 @@ sme_nudge_dialog_cmd(mac_handle_t mac_handle,
 	bool is_twt_cmd_in_progress;
 	QDF_STATUS status;
 	void *wma_handle;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	SME_ENTER();
 
 	is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,
-			twt_params->dialog_id, WLAN_TWT_ANY);
+			twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
 	if (is_twt_cmd_in_progress) {
-		sme_debug("Already TWT command is in progress");
+		sme_debug("Already TWT command:%d is in progress", active_cmd);
 		return QDF_STATUS_E_PENDING;
 	}
+
 	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
 	if (!wma_handle) {
 		sme_err("wma_handle is NULL");
@@ -14123,15 +14132,16 @@ sme_resume_dialog_cmd(mac_handle_t mac_handle,
 	bool is_twt_cmd_in_progress;
 	QDF_STATUS status;
 	void *wma_handle;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
 
 	SME_ENTER();
 
 	is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,
-			twt_params->dialog_id, WLAN_TWT_ANY);
+			twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
 	if (is_twt_cmd_in_progress) {
-		sme_debug("Already TWT command is in progress");
+		sme_debug("Already TWT command:%d is in progress", active_cmd);
 		return QDF_STATUS_E_PENDING;
 	}