Pārlūkot izejas kodu

qcacmn: Add support to handle twt notify event

Add support to handle twt notify event from firmware.

Change-Id: Ia4a84b0f3cfb76401681707c08e8169d07dacdbd
CRs-Fixed: 2847179
Rajasekaran Kalidoss 4 gadi atpakaļ
vecāks
revīzija
d7ec7b4010

+ 1 - 0
wmi/inc/wmi_unified_param.h

@@ -4481,6 +4481,7 @@ typedef enum {
 	wmi_twt_resume_dialog_complete_event_id,
 	wmi_twt_nudge_dialog_complete_event_id,
 	wmi_twt_session_stats_event_id,
+	wmi_twt_notify_event_id,
 #endif
 	wmi_apf_get_vdev_work_memory_resp_event_id,
 	wmi_roam_scan_stats_event_id,

+ 3 - 0
wmi/inc/wmi_unified_priv.h

@@ -2273,6 +2273,9 @@ QDF_STATUS (*extract_twt_resume_dialog_comp_event)(wmi_unified_t wmi_handle,
 		uint8_t *evt_buf,
 		struct wmi_twt_resume_dialog_complete_event_param *params);
 
+QDF_STATUS (*extract_twt_notify_event)(wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct wmi_twt_notify_event_param *params);
 #ifdef WLAN_SUPPORT_BCAST_TWT
 QDF_STATUS (*extract_twt_btwt_invite_sta_comp_event)(wmi_unified_t wmi_handle,
 		uint8_t *evt_buf,

+ 15 - 2
wmi/inc/wmi_unified_twt_api.h

@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -242,6 +241,20 @@ QDF_STATUS wmi_extract_twt_resume_dialog_comp_event(
 		uint8_t *evt_buf,
 		struct wmi_twt_resume_dialog_complete_event_param *params);
 
+/**
+ * wmi_extract_twt_notify_event() - Extract WMI event params for TWT
+ *                                  notify event
+ * @wmi_handle: wmi handle
+ * @evt_buf: Pointer event buffer
+ * @params: Parameters to extract
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_twt_notify_event(
+		wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct wmi_twt_notify_event_param *params);
+
 #ifdef WLAN_SUPPORT_BCAST_TWT
 /**
  * wmi_extract_twt_btwt_invite_sta_comp_event() - Extract WMI event params for

+ 8 - 0
wmi/inc/wmi_unified_twt_param.h

@@ -586,6 +586,14 @@ struct wmi_twt_resume_dialog_complete_event_param {
 	uint32_t status;
 };
 
+/**
+ * struct wmi_twt_notify_event_param -
+ * @vdev_id: VDEV identifier
+ */
+struct wmi_twt_notify_event_param {
+	uint32_t vdev_id;
+};
+
 #ifdef WLAN_SUPPORT_BCAST_TWT
 /**
  * struct wmi_twt_btwt_invite_sta_cmd_param -

+ 3 - 1
wmi/src/wmi_unified_tlv.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -14844,6 +14844,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
 		WMI_TWT_NUDGE_DIALOG_COMPLETE_EVENTID;
 	event_ids[wmi_twt_session_stats_event_id] =
 		WMI_TWT_SESSION_STATS_EVENTID;
+	event_ids[wmi_twt_notify_event_id] =
+		WMI_TWT_NOTIFY_EVENTID;
 #endif
 	event_ids[wmi_apf_get_vdev_work_memory_resp_event_id] =
 		WMI_BPF_GET_VDEV_WORK_MEMORY_RESP_EVENTID;

+ 14 - 1
wmi/src/wmi_unified_twt_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -222,6 +222,19 @@ QDF_STATUS wmi_extract_twt_resume_dialog_comp_event(
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_extract_twt_notify_event(
+		wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct wmi_twt_notify_event_param *params)
+{
+	if (wmi_handle->ops->extract_twt_notify_event)
+		return wmi_handle->ops->extract_twt_notify_event(wmi_handle,
+								 evt_buf,
+								 params);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 #ifdef WLAN_SUPPORT_BCAST_TWT
 QDF_STATUS wmi_extract_twt_btwt_invite_sta_comp_event(
 		wmi_unified_t wmi_handle,

+ 24 - 1
wmi/src/wmi_unified_twt_tlv.c

@@ -738,6 +738,28 @@ static QDF_STATUS extract_twt_resume_dialog_comp_event_tlv(
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS extract_twt_notify_event_tlv(
+		wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct wmi_twt_notify_event_param *params)
+{
+	WMI_TWT_NOTIFY_EVENTID_param_tlvs *param_buf;
+	wmi_twt_notify_event_fixed_param *ev;
+
+	param_buf =
+		(WMI_TWT_NOTIFY_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		wmi_err("evt_buf is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	ev = param_buf->fixed_param;
+
+	params->vdev_id = ev->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 #ifdef WLAN_SUPPORT_BCAST_TWT
 static QDF_STATUS
 extract_twt_btwt_invite_sta_comp_event_tlv(
@@ -933,6 +955,7 @@ void wmi_twt_attach_tlv(wmi_unified_t wmi_handle)
 				extract_twt_session_stats_event_tlv;
 	ops->extract_twt_session_stats_data =
 				extract_twt_session_stats_event_data;
-
+	ops->extract_twt_notify_event =
+				extract_twt_notify_event_tlv;
 	wmi_twt_attach_bcast_twt_tlv(ops);
 }