Browse Source

qcacld-3.0: Reset the stored TWT dialog ID on TWT setup failure

Driver doesn't clear the stored dialog id for TWT session when
TWT setup returns failure. This causes subsequent TWT sessions
to fail.

Reset the TWT session state and clear the dialog id for the
failed TWT setup to allow the next TWT setup commands.

Change-Id: I2f0ccb7a07ef49011b01d7336389d6ce56315fe9
CRs-Fixed: 2865240
Pragaspathi Thilagaraj 4 years ago
parent
commit
ec67e85fc5
3 changed files with 27 additions and 18 deletions
  1. 3 9
      core/hdd/src/wlan_hdd_twt.c
  2. 22 8
      core/sme/src/common/sme_api.c
  3. 2 1
      core/wma/src/wma_twt.c

+ 3 - 9
core/hdd/src/wlan_hdd_twt.c

@@ -1094,8 +1094,10 @@ hdd_twt_setup_pack_resp_nlmsg(struct sk_buff *reply_skb,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (event->params.num_additional_twt_params == 0)
+	if (event->params.num_additional_twt_params == 0) {
+		nla_nest_end(reply_skb, config_attr);
 		return QDF_STATUS_SUCCESS;
+	}
 
 	response_type = wmi_twt_add_cmd_to_vendor_twt_resp_type(event->additional_params.twt_cmd);
 	if (response_type == -EINVAL) {
@@ -1267,14 +1269,6 @@ hdd_twt_add_dialog_comp_cb(struct wlan_objmgr_psoc *psoc,
 		  add_dialog_event->params.status, vdev_id,
 		  QDF_MAC_ADDR_REF(add_dialog_event->params.peer_macaddr));
 	hdd_send_twt_setup_response(adapter, add_dialog_event);
-
-	if (add_dialog_event->params.status)
-		return;
-
-	ucfg_mlme_set_twt_setup_done(
-		adapter->hdd_ctx->psoc,
-		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
-		add_dialog_event->params.dialog_id, true);
 }
 
 /**

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

@@ -2079,7 +2079,8 @@ sme_process_twt_add_dialog_event(struct mac_context *mac,
 		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
 		add_dialog_event->params.dialog_id, WLAN_TWT_SETUP);
 	if (!is_evt_allowed) {
-		sme_debug("add dialog event dropped");
+		sme_debug("add dialog event dropped for id:%d",
+			  add_dialog_event->params.dialog_id);
 		return;
 	}
 
@@ -2087,17 +2088,29 @@ sme_process_twt_add_dialog_event(struct mac_context *mac,
 	if (callback)
 		callback(mac->psoc, add_dialog_event);
 
-	ucfg_mlme_set_twt_session_state(
-		mac->psoc,
-		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
-		add_dialog_event->params.dialog_id,
-		WLAN_TWT_SETUP_STATE_ACTIVE);
-
 	/* Reset the active TWT command to none */
 	mlme_set_twt_command_in_progress(
 		mac->psoc,
 		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
 		add_dialog_event->params.dialog_id, WLAN_TWT_NONE);
+
+	if (add_dialog_event->params.status) {
+		/* Clear the stored TWT dialog ID as TWT setup failed */
+		ucfg_mlme_init_twt_context(mac->psoc, (struct qdf_mac_addr *)
+					   add_dialog_event->params.peer_macaddr,
+					   add_dialog_event->params.dialog_id);
+		return;
+	}
+
+	ucfg_mlme_set_twt_setup_done(mac->psoc, (struct qdf_mac_addr *)
+				     add_dialog_event->params.peer_macaddr,
+				     add_dialog_event->params.dialog_id, true);
+
+	ucfg_mlme_set_twt_session_state(
+		mac->psoc,
+		(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
+		add_dialog_event->params.dialog_id,
+		WLAN_TWT_SETUP_STATE_ACTIVE);
 }
 
 /**
@@ -2122,7 +2135,8 @@ sme_process_twt_del_dialog_event(struct mac_context *mac,
 	    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) {
-		sme_debug("add dialog event dropped");
+		sme_debug("Del dialog event dropped for id:%d",
+			  param->dialog_id);
 		return;
 	}
 

+ 2 - 1
core/wma/src/wma_twt.c

@@ -207,7 +207,8 @@ int wma_twt_add_dialog_complete_event_handler(void *handle,
 			return qdf_status_to_os_return(status);
 	}
 
-	wma_debug("TWT: Extract TWT add dialog event :%d", status);
+	wma_debug("TWT: Extract TWT add dialog event id:%d",
+		  add_dialog_event->params.dialog_id);
 
 	sme_msg.type = eWNI_SME_TWT_ADD_DIALOG_EVENT;
 	sme_msg.bodyptr = add_dialog_event;