From d7ec7b40109a25bde187a342bfbfaf6e390a24c0 Mon Sep 17 00:00:00 2001 From: Rajasekaran Kalidoss Date: Sat, 19 Dec 2020 15:41:40 +0530 Subject: [PATCH] qcacmn: Add support to handle twt notify event Add support to handle twt notify event from firmware. Change-Id: Ia4a84b0f3cfb76401681707c08e8169d07dacdbd CRs-Fixed: 2847179 --- wmi/inc/wmi_unified_param.h | 1 + wmi/inc/wmi_unified_priv.h | 3 +++ wmi/inc/wmi_unified_twt_api.h | 17 +++++++++++++++-- wmi/inc/wmi_unified_twt_param.h | 8 ++++++++ wmi/src/wmi_unified_tlv.c | 4 +++- wmi/src/wmi_unified_twt_api.c | 15 ++++++++++++++- wmi/src/wmi_unified_twt_tlv.c | 25 ++++++++++++++++++++++++- 7 files changed, 68 insertions(+), 5 deletions(-) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index be44e0004a..5df193bc4d 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/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, diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index c63d5a1a5e..b08d63e83f 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/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, diff --git a/wmi/inc/wmi_unified_twt_api.h b/wmi/inc/wmi_unified_twt_api.h index 818a425078..7a2ab5307a 100644 --- a/wmi/inc/wmi_unified_twt_api.h +++ b/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 diff --git a/wmi/inc/wmi_unified_twt_param.h b/wmi/inc/wmi_unified_twt_param.h index 9181aaa795..d4e535d65f 100644 --- a/wmi/inc/wmi_unified_twt_param.h +++ b/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 - diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 7115543059..2fde13f811 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/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; diff --git a/wmi/src/wmi_unified_twt_api.c b/wmi/src/wmi_unified_twt_api.c index 26f19bdf36..fb53feca97 100644 --- a/wmi/src/wmi_unified_twt_api.c +++ b/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, diff --git a/wmi/src/wmi_unified_twt_tlv.c b/wmi/src/wmi_unified_twt_tlv.c index 2f5e6d554e..b74f30fa36 100644 --- a/wmi/src/wmi_unified_twt_tlv.c +++ b/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); }