diff --git a/wmi/inc/wmi_unified_nan_api.h b/wmi/inc/wmi_unified_nan_api.h index dcce912359..47547d74f5 100644 --- a/wmi/inc/wmi_unified_nan_api.h +++ b/wmi/inc/wmi_unified_nan_api.h @@ -193,4 +193,14 @@ QDF_STATUS wmi_extract_nan_event_rsp(wmi_unified_t wmi_handle, void *evt_buf, struct nan_event_params *temp_evt_params, uint8_t **nan_msg_buf); +/** + * wmi_extract_ndp_host_event - api to extract ndp event from event buffer + * @wmi_handle: wmi handle + * @data: event buffer + * @evt: event buffer to populate + * + * Return: status of operation + */ +QDF_STATUS wmi_extract_ndp_host_event(wmi_unified_t wmi_handle, uint8_t *data, + struct nan_datapath_host_event *evt); #endif /* _WMI_UNIFIED_NAN_API_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 61c3de5495..71292e864b 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -2471,6 +2471,8 @@ QDF_STATUS (*extract_ndp_end_ind)(wmi_unified_t wmi_handle, uint8_t *data, struct nan_datapath_end_indication_event **ind); QDF_STATUS (*extract_ndp_sch_update)(wmi_unified_t wmi_handle, uint8_t *data, struct nan_datapath_sch_update_event *ind); +QDF_STATUS (*extract_ndp_host_event)(wmi_unified_t wmi_handle, uint8_t *data, + struct nan_datapath_host_event *evt); #endif /* WLAN_FEATURE_NAN */ QDF_STATUS (*send_obss_detection_cfg_cmd)(wmi_unified_t wmi_handle, diff --git a/wmi/src/wmi_unified_nan_api.c b/wmi/src/wmi_unified_nan_api.c index fde8e516f9..95a31d9b0e 100644 --- a/wmi/src/wmi_unified_nan_api.c +++ b/wmi/src/wmi_unified_nan_api.c @@ -179,3 +179,13 @@ QDF_STATUS wmi_extract_ndp_sch_update(wmi_unified_t wmi_handle, uint8_t *data, return QDF_STATUS_E_FAILURE; } + +QDF_STATUS wmi_extract_ndp_host_event(wmi_unified_t wmi_handle, uint8_t *data, + struct nan_datapath_host_event *evt) +{ + if (wmi_handle->ops->extract_ndp_host_event) + return wmi_handle->ops->extract_ndp_host_event(wmi_handle, + data, evt); + + return QDF_STATUS_E_FAILURE; +} diff --git a/wmi/src/wmi_unified_nan_tlv.c b/wmi/src/wmi_unified_nan_tlv.c index ee169001da..e2dfeb3ac9 100644 --- a/wmi/src/wmi_unified_nan_tlv.c +++ b/wmi/src/wmi_unified_nan_tlv.c @@ -655,6 +655,31 @@ static QDF_STATUS nan_ndp_end_req_tlv(wmi_unified_t wmi_handle, return status; } +static QDF_STATUS +extract_ndp_host_event_tlv(wmi_unified_t wmi_handle, uint8_t *data, + struct nan_datapath_host_event *evt) +{ + WMI_NDP_EVENTID_param_tlvs *event; + wmi_ndp_event_param *fixed_params; + + event = (WMI_NDP_EVENTID_param_tlvs *)data; + fixed_params = event->fixed_param; + + evt->vdev = + wlan_objmgr_get_vdev_by_id_from_psoc(wmi_handle->soc->wmi_psoc, + fixed_params->vdev_id, + WLAN_NAN_ID); + if (!evt->vdev) { + wmi_err("vdev is null"); + return QDF_STATUS_E_INVAL; + } + + evt->ndp_termination_in_progress = + fixed_params->ndp_termination_in_progress ? true : false; + + return QDF_STATUS_SUCCESS; +} + static QDF_STATUS extract_ndp_initiator_rsp_tlv(wmi_unified_t wmi_handle, uint8_t *data, struct nan_datapath_initiator_rsp *rsp) { @@ -1226,4 +1251,5 @@ void wmi_nan_attach_tlv(wmi_unified_t wmi_handle) ops->extract_ndp_end_rsp = extract_ndp_end_rsp_tlv; ops->extract_ndp_end_ind = extract_ndp_end_ind_tlv; ops->extract_ndp_sch_update = extract_ndp_sch_update_tlv; + ops->extract_ndp_host_event = extract_ndp_host_event_tlv; }