Эх сурвалжийг харах

qcacmn: Handle TWT disable reason code

When host sends TWT disable command to firmware, send reason code
also as part of it. So that firmware will check and take the
following action:
a. If host sends disable due SCC/MCC concurrency then firmware
will teardown the existing TWT session and send the teardown
reason code as concurrency to host.
b. If it's for other reason then it will take action based on
that.

Change-Id: I5b4584a964f142d17aef5629adeb12e686fd983c
CRs-Fixed: 3098862
Jyoti Kumari 3 жил өмнө
parent
commit
6ff68674b9

+ 6 - 4
umac/twt/core/src/wlan_twt_common.c

@@ -268,8 +268,9 @@ wlan_twt_requestor_disable(struct wlan_objmgr_psoc *psoc,
 
 	req->twt_role = TWT_ROLE_REQUESTOR;
 
-	twt_debug("TWT req disable: pdev_id:%d role:%d ext:%d",
-		  req->pdev_id, req->twt_role, req->ext_conf_present);
+	twt_debug("TWT req disable: pdev_id:%d role:%d ext:%d reason_code:%d",
+		  req->pdev_id, req->twt_role, req->ext_conf_present,
+		  req->dis_reason_code);
 
 	return tgt_twt_disable_req_send(psoc, req);
 }
@@ -298,8 +299,9 @@ wlan_twt_responder_disable(struct wlan_objmgr_psoc *psoc,
 
 	req->twt_role = TWT_ROLE_RESPONDER;
 
-	twt_debug("TWT res disable: pdev_id:%d role:%d ext:%d",
-		  req->pdev_id, req->twt_role, req->ext_conf_present);
+	twt_debug("TWT res disable: pdev_id:%d role:%d ext:%d reason_code:%d",
+		  req->pdev_id, req->twt_role, req->ext_conf_present,
+		  req->dis_reason_code);
 
 	return tgt_twt_disable_req_send(psoc, req);
 }

+ 22 - 0
umac/twt/dispatcher/inc/wlan_twt_public_structs.h

@@ -177,18 +177,40 @@ struct twt_enable_param {
 		 b_twt_ax_mbss_enable:1;
 };
 
+/* HOST_TWT_DISABLE_REASON - reason code of disable TWT
+ * @HOST_TWT_DISABLE_REASON_NONE: Host sends TWT disable command to firmware
+ *                              in normal case.
+ * @HOST_TWT_DISABLE_REASON_CONCURRENCY_SCC: Host sends TWT disable command
+ *                              to firmware when SCC concurrency exist.
+ * @HOST_TWT_DISABLE_REASON_CONCURRENCY_MCC: Host sends TWT disable command
+ *                              to firmware when MCC concurrency exist.
+ * @HOST_TWT_DISABLE_REASON_CHANGE_CONGESTION_TIMEOUT: Host sends TWT disable
+ *                              command to firmware to change congestion timeout
+ * @HOST_TWT_DISABLE_REASON_P2P_GO_NOA: Host sends TWT disable command to
+ *                              firmware when P2P GO NOA exist.
+ */
+enum HOST_TWT_DISABLE_REASON {
+	HOST_TWT_DISABLE_REASON_NONE,
+	HOST_TWT_DISABLE_REASON_CONCURRENCY_SCC,
+	HOST_TWT_DISABLE_REASON_CONCURRENCY_MCC,
+	HOST_TWT_DISABLE_REASON_CHANGE_CONGESTION_TIMEOUT,
+	HOST_TWT_DISABLE_REASON_P2P_GO_NOA,
+};
+
 /**
  * struct twt_disable_param:
  * @pdev_id: pdev_id for identifying the MAC.
  * @ext_conf_present: If requestor/responder extend config is present.
  * @twt_role: values from enum TWT_ROLE.
  * @twt_oper: values from enum TWT_OPERATION.
+ * @dis_reason_code: values from disable reason code.
  */
 struct twt_disable_param {
 	uint32_t pdev_id;
 	bool ext_conf_present;
 	enum TWT_ROLE twt_role;
 	enum TWT_OPERATION twt_oper;
+	enum HOST_TWT_DISABLE_REASON dis_reason_code;
 };
 
 /* status code of enabling TWT

+ 21 - 1
wmi/src/wmi_unified_twt_tlv.c

@@ -86,6 +86,25 @@ static QDF_STATUS send_twt_enable_cmd_tlv(wmi_unified_t wmi_handle,
 	return status;
 }
 
+static WMI_DISABLE_TWT_REASON_T
+wmi_convert_dis_reason_code(enum HOST_TWT_DISABLE_REASON reason)
+{
+	switch (reason) {
+	case HOST_TWT_DISABLE_REASON_NONE:
+		return WMI_DISABLE_TWT_REASON_NONE;
+	case HOST_TWT_DISABLE_REASON_CONCURRENCY_SCC:
+		return WMI_DISABLE_TWT_REASON_CONCURRENCY_SCC;
+	case HOST_TWT_DISABLE_REASON_CONCURRENCY_MCC:
+		return WMI_DISABLE_TWT_REASON_CONCURRENCY_MCC;
+	case HOST_TWT_DISABLE_REASON_CHANGE_CONGESTION_TIMEOUT:
+		return WMI_DISABLE_TWT_REASON_CHANGE_CONGESTION_TIMEOUT;
+	case HOST_TWT_DISABLE_REASON_P2P_GO_NOA:
+		return WMI_DISABLE_TWT_REASON_P2P_GO_NOA;
+	default:
+		return WMI_DISABLE_TWT_REASON_NONE;
+	}
+}
+
 static QDF_STATUS send_twt_disable_cmd_tlv(wmi_unified_t wmi_handle,
 			struct twt_disable_param *params)
 {
@@ -115,6 +134,8 @@ static QDF_STATUS send_twt_disable_cmd_tlv(wmi_unified_t wmi_handle,
 		TWT_EN_DIS_FLAGS_SET_I_B_TWT(cmd->flags, params->twt_oper);
 	}
 
+	cmd->reason_code = wmi_convert_dis_reason_code(
+					params->dis_reason_code);
 	status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
 				      WMI_TWT_DISABLE_CMDID);
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -1216,7 +1237,6 @@ static QDF_STATUS send_twt_enable_cmd_tlv(wmi_unified_t wmi_handle,
 	return status;
 }
 
-
 static QDF_STATUS send_twt_disable_cmd_tlv(wmi_unified_t wmi_handle,
 			struct wmi_twt_disable_param *params)
 {