瀏覽代碼

qcacld-3.0: Block the TWT setup till notify event is received

Currently, TWT setup is allowed after roaming even if
TWT notify from firmware is not received.

Block the TWT setup till notify event is received
from firmware.

Change-Id: Ia6ff8fe9e05f32ddf6dbdd608d9090b612237f26
CRs-Fixed: 2870610
Deeksha Gupta 4 年之前
父節點
當前提交
a3ca2a725e

+ 3 - 0
components/mlme/core/inc/wlan_mlme_main.h

@@ -319,6 +319,8 @@ struct wait_for_key_timer {
  * @mscs_req_info: Information related to mscs request
  * @he_config: he config
  * @he_sta_obsspd: he_sta_obsspd
+ * @twt_wait_for_notify: TWT session teardown received, wait for
+ * notify event from firmware before next TWT setup is done.
  * @rso_cfg: per vdev RSO config to be sent to FW
  * @connect_info: mlme connect information
  * @wait_key_timer: wait key timer
@@ -346,6 +348,7 @@ struct mlme_legacy_priv {
 	uint32_t hb_failure_rssi;
 	struct mlme_cfg_str opr_rate_set;
 	struct mlme_cfg_str ext_opr_rate_set;
+	bool twt_wait_for_notify;
 #ifdef WLAN_FEATURE_MSCS
 	struct mscs_req_info mscs_req_info;
 #endif

+ 11 - 12
components/mlme/core/inc/wlan_mlme_twt_api.h

@@ -146,26 +146,25 @@ QDF_STATUS mlme_init_twt_context(struct wlan_objmgr_psoc *psoc,
 				 uint8_t dialog_id);
 
 /**
- * mlme_twt_is_notify_done()  - Check if notify is done.
+ * mlme_twt_set_wait_for_notify()  - Set wait for notify flag.
  * @psoc: Pointer to psoc object
- * @peer_mac: Pointer to peer mac address
+ * @vdev_id: VDEV identifier
+ * @is_set: Set or clear notify flag
  *
- * Return: True if notify is done
+ * Return: None
  */
-bool mlme_twt_is_notify_done(struct wlan_objmgr_psoc *psoc,
-			     struct qdf_mac_addr *peer_mac);
+void mlme_twt_set_wait_for_notify(struct wlan_objmgr_psoc *psoc,
+				  uint32_t vdev_id, bool is_set);
 
 /**
- * mlme_twt_set_wait_for_notify()  - Set wait for notify flag.
+ * mlme_is_twt_notify_in_progress() - Get TWT notify in progress.
  * @psoc: Pointer to psoc object
- * @peer_mac: Pointer to peer mac address
- * @is_set: Set or clear notify flag
+ * @vdev_id: VDEV identifier
  *
- * Return: None
+ * Return: True if twt_notify is in progress.
  */
-void mlme_twt_set_wait_for_notify(struct wlan_objmgr_psoc *psoc,
-				  struct qdf_mac_addr *peer_mac,
-				  bool is_set);
+bool mlme_is_twt_notify_in_progress(struct wlan_objmgr_psoc *psoc,
+				    uint32_t vdev_id);
 
 /**
  * mlme_is_flexible_twt_enabled() - Check if flexible TWT is enabled.

+ 41 - 44
components/mlme/core/src/wlan_mlme_twt_api.c

@@ -219,58 +219,27 @@ bool mlme_is_twt_setup_done(struct wlan_objmgr_psoc *psoc,
 }
 
 void mlme_twt_set_wait_for_notify(struct wlan_objmgr_psoc *psoc,
-				  struct qdf_mac_addr *peer_mac,
-				  bool is_set)
+				  uint32_t vdev_id, bool is_set)
 {
-	struct peer_mlme_priv_obj *peer_priv;
-	struct wlan_objmgr_peer *peer;
+	struct wlan_objmgr_vdev *vdev;
+	struct mlme_legacy_priv *mlme_priv;
 
-	peer = wlan_objmgr_get_peer_by_mac(psoc, peer_mac->bytes,
-					   WLAN_MLME_NB_ID);
-	if (!peer) {
-		mlme_legacy_err("Peer object not found");
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_NB_ID);
+	if (!vdev) {
+		mlme_legacy_err("vdev object not found");
 		return;
 	}
 
-	peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer,
-							  WLAN_UMAC_COMP_MLME);
-	if (!peer_priv) {
-		wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID);
-		mlme_legacy_err("peer mlme component object is NULL");
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
+		mlme_legacy_err("vdev legacy private object is NULL");
 		return;
 	}
 
-	peer_priv->twt_ctx.wait_for_notify = is_set;
-
-	wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID);
-}
-
-bool mlme_twt_is_notify_done(struct wlan_objmgr_psoc *psoc,
-			     struct qdf_mac_addr *peer_mac)
-{
-	struct peer_mlme_priv_obj *peer_priv;
-	struct wlan_objmgr_peer *peer;
-	bool notify_done;
-
-	peer = wlan_objmgr_get_peer_by_mac(psoc, peer_mac->bytes,
-					   WLAN_MLME_NB_ID);
-	if (!peer) {
-		mlme_legacy_err("Peer object not found");
-		return false;
-	}
-
-	peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer,
-							  WLAN_UMAC_COMP_MLME);
-	if (!peer_priv) {
-		mlme_legacy_err(" peer mlme component object is NULL");
-		wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID);
-		return false;
-	}
-
-	notify_done = peer_priv->twt_ctx.wait_for_notify;
-	wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID);
-
-	return notify_done;
+	mlme_priv->twt_wait_for_notify = is_set;
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
 }
 
 void mlme_set_twt_session_state(struct wlan_objmgr_psoc *psoc,
@@ -485,6 +454,34 @@ QDF_STATUS mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+bool mlme_is_twt_notify_in_progress(struct wlan_objmgr_psoc *psoc,
+				    uint32_t vdev_id)
+{
+	struct wlan_objmgr_vdev *vdev;
+	struct mlme_legacy_priv *mlme_priv;
+	bool is_twt_notify_in_progress;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_MLME_NB_ID);
+
+	if (!vdev) {
+		mlme_legacy_err("vdev object not found");
+		return false;
+	}
+
+	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
+	if (!mlme_priv) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
+		mlme_legacy_err("vdev legacy private object is NULL");
+		return false;
+	}
+
+	is_twt_notify_in_progress = mlme_priv->twt_wait_for_notify;
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID);
+
+	return is_twt_notify_in_progress;
+}
+
 bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
 				     struct qdf_mac_addr *peer_mac,
 				     uint8_t dialog_id,

+ 0 - 3
components/mlme/dispatcher/inc/wlan_mlme_twt_public_struct.h

@@ -98,14 +98,11 @@ struct twt_session_info {
  * struct twt_context  - TWT context
  * @peer_capability: TWT peer capability bitmap. Refer enum
  * wlan_twt_capabilities for representation.
- * @wait_for_notify: TWT session teardown received, wait for
- * notify event from firmware before next TWT setup is done.
  * @num_twt_sessions: Maximum supported TWT sessions.
  * @session_info: TWT session related parameters for each session
  */
 struct twt_context {
 	uint8_t peer_capability;
-	bool wait_for_notify;
 	uint8_t num_twt_sessions;
 	struct twt_session_info session_info[WLAN_MAX_TWT_SESSIONS_PER_PEER];
 };

+ 11 - 8
core/sme/src/common/sme_api.c

@@ -2175,8 +2175,7 @@ sme_process_twt_del_dialog_event(struct mac_context *mac,
 	if (param->status == WMI_HOST_DEL_TWT_STATUS_ROAMING ||
 	    param->status == WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN)
 		mlme_twt_set_wait_for_notify(
-			mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr,
-			true);
+			mac->psoc, param->vdev_id, true);
 
 	/* Reset the active TWT command to none */
 	mlme_set_twt_command_in_progress(
@@ -2301,12 +2300,8 @@ sme_process_twt_notify_event(struct mac_context *mac,
 			     struct wmi_twt_notify_event_param *notify_event)
 {
 	twt_notify_cb callback;
-	struct csr_roam_session *session;
 
-	session = CSR_GET_SESSION(mac, notify_event->vdev_id);
-	mlme_twt_set_wait_for_notify(mac->psoc,
-				     &session->connectedProfile.bssid,
-				     FALSE);
+	mlme_twt_set_wait_for_notify(mac->psoc, notify_event->vdev_id, false);
 	callback = mac->sme.twt_notify_cb;
 	if (callback)
 		callback(mac->psoc, notify_event);
@@ -13923,13 +13918,21 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle,
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	struct scheduler_msg twt_msg = {0};
-	bool is_twt_cmd_in_progress;
+	bool is_twt_cmd_in_progress, is_twt_notify_in_progress;
 	QDF_STATUS status;
 	void *wma_handle;
 	struct wmi_twt_add_dialog_param *cmd_params;
 
 	SME_ENTER();
 
+	is_twt_notify_in_progress = mlme_is_twt_notify_in_progress(
+			mac->psoc, twt_params->vdev_id);
+
+	if (is_twt_notify_in_progress) {
+		sme_debug("Waiting for TWT Notify");
+		return QDF_STATUS_E_BUSY;
+	}
+
 	is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
 			mac->psoc,
 			(struct qdf_mac_addr *)twt_params->peer_macaddr,