Browse Source

qcacld-3.0: TWT WMI callback registration/deregistration

Add TWT WMI event registration and deregistration

Change-Id: Ib6cadfe05ba38f3ca33fb9f128c40698d6a969c0
CRs-Fixed: 3085525
Srinivas Girigowda 3 years ago
parent
commit
a76b7145d5
1 changed files with 154 additions and 1 deletions
  1. 154 1
      components/target_if/twt/src/target_if_ext_twt_evt.c

+ 154 - 1
components/target_if/twt/src/target_if_ext_twt_evt.c

@@ -78,6 +78,159 @@ target_if_twt_ack_complete_event_handler(ol_scn_t scn, uint8_t *event,
 QDF_STATUS
 target_if_twt_register_ext_events(struct wlan_objmgr_psoc *psoc)
 {
-	return QDF_STATUS_SUCCESS;
+	QDF_STATUS status;
+	struct wmi_unified *wmi_handle;
+
+	if (!psoc) {
+		target_if_err("psoc obj is null!");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null!");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = wmi_unified_register_event_handler
+			(wmi_handle,
+			 wmi_twt_add_dialog_complete_event_id,
+			 target_if_twt_setup_complete_event_handler,
+			 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt add dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_register_event_handler
+			(wmi_handle,
+			 wmi_twt_del_dialog_complete_event_id,
+			 target_if_twt_teardown_complete_event_handler,
+			 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt del dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_register_event_handler
+			(wmi_handle,
+			 wmi_twt_pause_dialog_complete_event_id,
+			 target_if_twt_pause_complete_event_handler,
+			 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt pause dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_register_event_handler
+			(wmi_handle,
+			 wmi_twt_resume_dialog_complete_event_id,
+			 target_if_twt_resume_complete_event_handler,
+			 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt resume dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_register_event_handler
+			(wmi_handle,
+			 wmi_twt_nudge_dialog_complete_event_id,
+			 target_if_twt_nudge_complete_event_handler,
+			 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt nudge dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_register_event_handler
+				(wmi_handle,
+				 wmi_twt_notify_event_id,
+				 target_if_twt_notify_event_handler,
+				 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt notify event cb");
+		return status;
+	}
+
+	status = wmi_unified_register_event_handler
+				(wmi_handle,
+				 wmi_twt_ack_complete_event_id,
+				 target_if_twt_ack_complete_event_handler,
+				 WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to register twt ack event cb");
+		return status;
+	}
+
+	return status;
+}
+
+QDF_STATUS
+target_if_twt_deregister_ext_events(struct wlan_objmgr_psoc *psoc)
+{
+	QDF_STATUS status;
+	struct wmi_unified *wmi_handle;
+
+	if (!psoc) {
+		target_if_err("psoc is NULL!");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+					wmi_twt_add_dialog_complete_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt add dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+					wmi_twt_del_dialog_complete_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt del dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+					wmi_twt_pause_dialog_complete_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt pause dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+				wmi_twt_resume_dialog_complete_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt resume dialog event");
+		return status;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+					wmi_twt_nudge_dialog_complete_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt nudge dialog event cb");
+		return status;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+					wmi_twt_notify_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt notify event cb");
+		return status;
+	}
+
+	status = wmi_unified_unregister_event_handler(wmi_handle,
+					wmi_twt_ack_complete_event_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		target_if_err("Failed to deregister twt ack complete event cb");
+		return status;
+	}
+
+	return status;
 }