Sfoglia il codice sorgente

qcacmn: Handle status code for TWT Notify event

Handle status code for TWT Notify event

Change-Id: I7065ab52b21ce8ce9dd5d12e30d2380e4c7d0da2
CRs-Fixed: 3138647
Deeksha Gupta 3 anni fa
parent
commit
b37b9b12cd

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

@@ -851,12 +851,25 @@ struct twt_resume_dialog_complete_event_param {
 	uint32_t status;
 };
 
+/* enum HOST_TWT_NOTIFY_STATUS - status code of notify TWT event
+ * @HOST_TWT_NOTIFY_EVENT_READY: FW is ready to process the TWT setup request.
+ * @HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_SET: AP set the TWT required bit
+ * @HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR: AP cleared the TWT required bit
+ */
+enum HOST_TWT_NOTIFY_STATUS {
+	HOST_TWT_NOTIFY_EVENT_READY,
+	HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_SET,
+	HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR,
+};
+
 /**
  * struct twt_notify_event_param -
  * @vdev_id: VDEV identifier
+ * @status: refer to HOST_TWT_NOTIFY_STATUS
  */
 struct twt_notify_event_param {
 	uint32_t vdev_id;
+	enum HOST_TWT_NOTIFY_STATUS status;
 };
 
 #ifdef WLAN_SUPPORT_BCAST_TWT

+ 23 - 0
wmi/src/wmi_unified_twt_tlv.c

@@ -899,6 +899,19 @@ static QDF_STATUS extract_twt_resume_dialog_comp_event_tlv(
 	return QDF_STATUS_SUCCESS;
 }
 
+static enum HOST_TWT_NOTIFY_STATUS
+wmi_get_converted_twt_notify_status(WMI_TWT_NOTIFICATION_ID_T tgt_status)
+{
+	switch (tgt_status) {
+	case WMI_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_SET:
+		return HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_SET;
+	case WMI_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR:
+		return HOST_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR;
+	default:
+		return HOST_TWT_NOTIFY_EVENT_READY;
+	}
+}
+
 static QDF_STATUS extract_twt_notify_event_tlv(
 		wmi_unified_t wmi_handle,
 		uint8_t *evt_buf,
@@ -916,7 +929,17 @@ static QDF_STATUS extract_twt_notify_event_tlv(
 
 	ev = param_buf->fixed_param;
 
+	if (ev->event_id > WMI_TWT_NOTIFY_EVENT_AP_TWT_REQ_BIT_CLEAR) {
+		wmi_debug("Incorrect TWT notify event vdev_id: %d, status: %d",
+			  ev->vdev_id, ev->event_id);
+		return QDF_STATUS_E_INVAL;
+	}
+
 	params->vdev_id = ev->vdev_id;
+	params->status = wmi_get_converted_twt_notify_status(ev->event_id);
+
+	wmi_debug("Extract notify event vdev_id: %d, status: %d",
+		  params->vdev_id, params->status);
 
 	return QDF_STATUS_SUCCESS;
 }