Selaa lähdekoodia

qcacld-3.0: Send separate TWT disable cmd based on req/res role

Currently, the same twt disable api hdd_send_twt_disable_cmd()
sends to firmware for both requestor and responder role.

As part of this change, decouple disable api based on requestor
and responder role as per below:
for requestor: hdd_send_twt_requestor_disable_cmd()
for responder: hdd_send_twt_responder_disable_cmd()

Change-Id: Ib92b0fa46dde78dec0d5b7ca914d018c7c0970e5
CRs-Fixed: 2937591
Jyoti Kumari 3 vuotta sitten
vanhempi
sitoutus
b5e2a330bc
3 muutettua tiedostoa jossa 76 lisäystä ja 15 poistoa
  1. 23 6
      core/hdd/inc/wlan_hdd_twt.h
  2. 2 0
      core/hdd/src/wlan_hdd_hostapd.c
  3. 51 9
      core/hdd/src/wlan_hdd_twt.c

+ 23 - 6
core/hdd/inc/wlan_hdd_twt.h

@@ -148,12 +148,22 @@ QDF_STATUS hdd_send_twt_requestor_enable_cmd(struct hdd_context *hdd_ctx);
 QDF_STATUS hdd_send_twt_responder_enable_cmd(struct hdd_context *hdd_ctx);
 
 /**
- * hdd_send_twt_disable_cmd() - Send TWT disable command to target
+ * hdd_send_twt_requestor_disable_cmd() - Send TWT requestor disable command
+ * to target
  * @hdd_ctx: HDD Context
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS hdd_send_twt_disable_cmd(struct hdd_context *hdd_ctx);
+QDF_STATUS hdd_send_twt_requestor_disable_cmd(struct hdd_context *hdd_ctx);
+
+/**
+ * hdd_send_twt_responder_disable_cmd() - Send TWT responder disable command
+ * to target
+ * @hdd_ctx: HDD Context
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS hdd_send_twt_responder_disable_cmd(struct hdd_context *hdd_ctx);
 
 /**
  * wlan_hdd_twt_init() - Initialize TWT
@@ -248,18 +258,25 @@ static inline void hdd_update_tgt_twt_cap(struct hdd_context *hdd_ctx,
 static inline
 QDF_STATUS hdd_send_twt_requestor_enable_cmd(struct hdd_context *hdd_ctx)
 {
-	return QDF_STATUS_E_FAILURE;
+	return QDF_STATUS_E_NOSUPPORT;
 }
 
 static inline
 QDF_STATUS hdd_send_twt_responder_enable_cmd(struct hdd_context *hdd_ctx)
 {
-	return QDF_STATUS_E_FAILURE;
+	return QDF_STATUS_E_NOSUPPORT;
 }
 
-static inline QDF_STATUS hdd_send_twt_disable_cmd(struct hdd_context *hdd_ctx)
+static inline
+QDF_STATUS hdd_send_twt_requestor_disable_cmd(struct hdd_context *hdd_ctx)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+
+static inline
+QDF_STATUS hdd_send_twt_responder_disable_cmd(struct hdd_context *hdd_ctx)
 {
-	return QDF_STATUS_SUCCESS;
+	return QDF_STATUS_E_NOSUPPORT;
 }
 
 static inline void wlan_hdd_twt_init(struct hdd_context *hdd_ctx)

+ 2 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -6495,6 +6495,8 @@ wlan_hdd_update_twt_responder(struct hdd_context *hdd_ctx,
 	ucfg_mlme_set_twt_responder(hdd_ctx->psoc, params->twt_responder);
 	if (params->twt_responder)
 		hdd_send_twt_responder_enable_cmd(hdd_ctx);
+	else
+		hdd_send_twt_responder_disable_cmd(hdd_ctx);
 }
 #else
 static inline void

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

@@ -356,7 +356,7 @@ int hdd_test_config_twt_setup_session(struct hdd_adapter *adapter,
 						     &congestion_timeout);
 		if (congestion_timeout) {
 			ret = qdf_status_to_os_return(
-				hdd_send_twt_disable_cmd(adapter->hdd_ctx));
+			hdd_send_twt_requestor_disable_cmd(adapter->hdd_ctx));
 			if (ret) {
 				hdd_err("Failed to disable TWT");
 				return ret;
@@ -1612,7 +1612,7 @@ static int hdd_twt_setup_session(struct hdd_adapter *adapter,
 
 	if (congestion_timeout) {
 		ret = qdf_status_to_os_return(
-			hdd_send_twt_disable_cmd(adapter->hdd_ctx));
+			hdd_send_twt_requestor_disable_cmd(adapter->hdd_ctx));
 		if (ret) {
 			hdd_err("Failed to disable TWT");
 			return ret;
@@ -3677,27 +3677,69 @@ QDF_STATUS hdd_send_twt_responder_enable_cmd(struct hdd_context *hdd_ctx)
 	return status;
 }
 
-QDF_STATUS hdd_send_twt_disable_cmd(struct hdd_context *hdd_ctx)
+QDF_STATUS hdd_send_twt_requestor_disable_cmd(struct hdd_context *hdd_ctx)
 {
 	uint8_t pdev_id = hdd_ctx->pdev->pdev_objmgr.wlan_pdev_id;
 	struct twt_enable_disable_conf twt_en_dis = {0};
-	QDF_STATUS status;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 
-	hdd_debug("TWT disable cmd :pdev:%d", pdev_id);
+	hdd_debug("TWT requestor disable cmd: pdev:%d", pdev_id);
 
-	/* One disable should be fine, with extended configuration
-	 * set to false, and extended arguments will be ignored by target
-	 */
+	/* Set MLME TWT flag */
+	ucfg_mlme_set_twt_requestor_flag(hdd_ctx->psoc, false);
+
+       /* One disable should be fine, with extended configuration
+	* set to false, and extended arguments will be ignored by target
+	*/
+	twt_en_dis.role = WMI_TWT_ROLE_REQUESTOR;
 	hdd_ctx->twt_state = TWT_DISABLE_REQUESTED;
 	twt_en_dis.ext_conf_present = false;
+	qdf_event_reset(&hdd_ctx->twt_disable_comp_evt);
 	wma_send_twt_disable_cmd(pdev_id, &twt_en_dis);
 
 	status = qdf_wait_single_event(&hdd_ctx->twt_disable_comp_evt,
 				       TWT_DISABLE_COMPLETE_TIMEOUT);
 
 	if (!QDF_IS_STATUS_SUCCESS(status))
-		hdd_warn("TWT Responder disable timedout");
+		goto timeout;
+
+	return status;
+
+timeout:
+	hdd_warn("TWT Requestor disable timedout");
+	return status;
+}
+
+QDF_STATUS hdd_send_twt_responder_disable_cmd(struct hdd_context *hdd_ctx)
+{
+	uint8_t pdev_id = hdd_ctx->pdev->pdev_objmgr.wlan_pdev_id;
+	struct twt_enable_disable_conf twt_en_dis = {0};
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	hdd_debug("TWT responder disable cmd: pdev:%d", pdev_id);
+
+	/* Set MLME TWT flag */
+	ucfg_mlme_set_twt_responder_flag(hdd_ctx->psoc, false);
+
+       /* One disable should be fine, with extended configuration
+	* set to false, and extended arguments will be ignored by target
+	*/
+	twt_en_dis.role = WMI_TWT_ROLE_RESPONDER;
+	hdd_ctx->twt_state = TWT_DISABLE_REQUESTED;
+	twt_en_dis.ext_conf_present = false;
+	qdf_event_reset(&hdd_ctx->twt_disable_comp_evt);
+	wma_send_twt_disable_cmd(pdev_id, &twt_en_dis);
+
+	status = qdf_wait_single_event(&hdd_ctx->twt_disable_comp_evt,
+				       TWT_DISABLE_COMPLETE_TIMEOUT);
+
+	if (!QDF_IS_STATUS_SUCCESS(status))
+		goto timeout;
+
+	return status;
 
+timeout:
+	hdd_warn("TWT Responder disable timedout");
 	return status;
 }