diff --git a/target_if/scan/src/target_if_scan.c b/target_if/scan/src/target_if_scan.c index c78129f5cc..a3b825bfac 100644 --- a/target_if/scan/src/target_if_scan.c +++ b/target_if/scan/src/target_if_scan.c @@ -28,9 +28,6 @@ #include #include #include -#ifdef FEATURE_WLAN_SCAN_PNO -#include "wmi.h" -#endif static inline struct wlan_lmac_if_scan_rx_ops * target_if_scan_get_rx_ops(struct wlan_objmgr_psoc *psoc) @@ -95,12 +92,10 @@ target_if_scan_event_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen) int target_if_nlo_complete_handler(ol_scn_t scn, uint8_t *data, uint32_t len) { - wmi_nlo_event *nlo_event; struct scan_event_info *event_info; struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; struct wlan_lmac_if_scan_rx_ops *scan_rx_ops; - WMI_NLO_MATCH_EVENTID_param_tlvs *param_buf = - (WMI_NLO_MATCH_EVENTID_param_tlvs *) data; QDF_STATUS status; if (!scn || !data) { @@ -114,16 +109,25 @@ int target_if_nlo_complete_handler(ol_scn_t scn, uint8_t *data, return -EINVAL; } + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + target_if_err("wmi_handle is NULL"); + return -EINVAL; + } + event_info = qdf_mem_malloc(sizeof(*event_info)); if (!event_info) return -ENOMEM; - nlo_event = param_buf->fixed_param; - target_if_debug("PNO complete event received for vdev %d", - nlo_event->vdev_id); + if (wmi_extract_nlo_complete_ev_param(wmi_handle, data, + &event_info->event)) { + target_if_err("Failed to extract WMI PNO complete event"); + qdf_mem_free(event_info); + return -EINVAL; + } - event_info->event.type = SCAN_EVENT_TYPE_NLO_COMPLETE; - event_info->event.vdev_id = nlo_event->vdev_id; + target_if_debug("PNO complete event received for vdev %d", + event_info->event.vdev_id); scan_rx_ops = target_if_scan_get_rx_ops(psoc); if (scan_rx_ops->scan_ev_handler) { @@ -143,12 +147,10 @@ int target_if_nlo_complete_handler(ol_scn_t scn, uint8_t *data, int target_if_nlo_match_event_handler(ol_scn_t scn, uint8_t *data, uint32_t len) { - wmi_nlo_event *nlo_event; struct scan_event_info *event_info; struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; struct wlan_lmac_if_scan_rx_ops *scan_rx_ops; - WMI_NLO_MATCH_EVENTID_param_tlvs *param_buf = - (WMI_NLO_MATCH_EVENTID_param_tlvs *) data; QDF_STATUS status; if (!scn || !data) { @@ -162,16 +164,25 @@ int target_if_nlo_match_event_handler(ol_scn_t scn, uint8_t *data, return -EINVAL; } + wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + if (!wmi_handle) { + target_if_err("wmi_handle is NULL"); + return -EINVAL; + } + event_info = qdf_mem_malloc(sizeof(*event_info)); if (!event_info) return -ENOMEM; - nlo_event = param_buf->fixed_param; - target_if_debug("PNO match event received for vdev %d", - nlo_event->vdev_id); + if (wmi_extract_nlo_match_ev_param(wmi_handle, data, + &event_info->event)) { + target_if_err("Failed to extract WMI PNO match event"); + qdf_mem_free(event_info); + return -EINVAL; + } - event_info->event.type = SCAN_EVENT_TYPE_NLO_MATCH; - event_info->event.vdev_id = nlo_event->vdev_id; + target_if_debug("PNO match event received for vdev %d", + event_info->event.vdev_id); scan_rx_ops = target_if_scan_get_rx_ops(psoc); if (scan_rx_ops->scan_ev_handler) { diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 616b28b4fc..d83c889e47 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -2502,6 +2502,32 @@ QDF_STATUS wmi_extract_vdev_scan_ev_param(wmi_unified_t wmi_handle, void *evt_buf, struct scan_event *param); +#ifdef FEATURE_WLAN_SCAN_PNO +/** + * wmi_extract_nlo_match_ev_param() - extract NLO match param from event + * @wmi_handle: pointer to WMI handle + * @evt_buf: pointer to WMI event buffer + * @param: pointer to scan event param for NLO match + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS +wmi_extract_nlo_match_ev_param(wmi_unified_t wmi_handle, void *evt_buf, + struct scan_event *param); + +/** + * wmi_extract_nlo_complete_ev_param() - extract NLO complete param from event + * @wmi_handle: pointer to WMI handle + * @evt_buf: pointer to WMI event buffer + * @param: pointer to scan event param for NLO complete + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS +wmi_extract_nlo_complete_ev_param(wmi_unified_t wmi_handle, void *evt_buf, + struct scan_event *param); +#endif + /** * wmi_extract_mu_ev_param() - extract mu param from event * @wmi_handle: wmi handle diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index c6766ebcd9..9e572dcd42 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1437,6 +1437,16 @@ QDF_STATUS (*extract_vdev_roam_param)(wmi_unified_t wmi_handle, void *evt_buf, QDF_STATUS (*extract_vdev_scan_ev_param)(wmi_unified_t wmi_handle, void *evt_buf, struct scan_event *param); +#ifdef FEATURE_WLAN_SCAN_PNO +QDF_STATUS (*extract_nlo_match_ev_param)(wmi_unified_t wmi_handle, + void *evt_buf, + struct scan_event *param); + +QDF_STATUS (*extract_nlo_complete_ev_param)(wmi_unified_t wmi_handle, + void *evt_buf, + struct scan_event *param); +#endif + QDF_STATUS (*extract_mu_ev_param)(wmi_unified_t wmi_handle, void *evt_buf, wmi_host_mu_report_event *param); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 02c70d85df..c1c4105ddb 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -1903,6 +1903,30 @@ wmi_extract_vdev_scan_ev_param(wmi_unified_t wmi_handle, void *evt_buf, return QDF_STATUS_E_FAILURE; } +#ifdef FEATURE_WLAN_SCAN_PNO +QDF_STATUS +wmi_extract_nlo_match_ev_param(wmi_unified_t wmi_handle, void *evt_buf, + struct scan_event *param) +{ + if (wmi_handle->ops->extract_nlo_match_ev_param) + return wmi_handle->ops->extract_nlo_match_ev_param(wmi_handle, + evt_buf, param); + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS +wmi_extract_nlo_complete_ev_param(wmi_unified_t wmi_handle, void *evt_buf, + struct scan_event *param) +{ + if (wmi_handle->ops->extract_nlo_complete_ev_param) + return wmi_handle->ops->extract_nlo_complete_ev_param( + wmi_handle, evt_buf, param); + + return QDF_STATUS_E_FAILURE; +} +#endif + QDF_STATUS wmi_extract_mu_ev_param(wmi_unified_t wmi_handle, void *evt_buf, wmi_host_mu_report_event *param) diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index a1b3130dd7..2a1214e7a3 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -8946,6 +8946,54 @@ static QDF_STATUS extract_vdev_scan_ev_param_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +#ifdef FEATURE_WLAN_SCAN_PNO +/** + * extract_nlo_match_ev_param_tlv() - extract NLO match param from event + * @wmi_handle: pointer to WMI handle + * @evt_buf: pointer to WMI event buffer + * @param: pointer to scan event param for NLO match + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS extract_nlo_match_ev_param_tlv(wmi_unified_t wmi_handle, + void *evt_buf, + struct scan_event *param) +{ + WMI_NLO_MATCH_EVENTID_param_tlvs *param_buf = evt_buf; + wmi_nlo_event *evt = param_buf->fixed_param; + + qdf_mem_zero(param, sizeof(*param)); + + param->type = SCAN_EVENT_TYPE_NLO_MATCH; + param->vdev_id = evt->vdev_id; + + return QDF_STATUS_SUCCESS; +} + +/** + * extract_nlo_complete_ev_param_tlv() - extract NLO complete param from event + * @wmi_handle: pointer to WMI handle + * @evt_buf: pointer to WMI event buffer + * @param: pointer to scan event param for NLO complete + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS extract_nlo_complete_ev_param_tlv(wmi_unified_t wmi_handle, + void *evt_buf, + struct scan_event *param) +{ + WMI_NLO_SCAN_COMPLETE_EVENTID_param_tlvs *param_buf = evt_buf; + wmi_nlo_event *evt = param_buf->fixed_param; + + qdf_mem_zero(param, sizeof(*param)); + + param->type = SCAN_EVENT_TYPE_NLO_COMPLETE; + param->vdev_id = evt->vdev_id; + + return QDF_STATUS_SUCCESS; +} +#endif + /** * extract_all_stats_counts_tlv() - extract all stats count from event * @wmi_handle: wmi handle @@ -12978,6 +13026,10 @@ struct wmi_ops tlv_ops = { .extract_mgmt_rx_params = extract_mgmt_rx_params_tlv, .extract_vdev_roam_param = extract_vdev_roam_param_tlv, .extract_vdev_scan_ev_param = extract_vdev_scan_ev_param_tlv, +#ifdef FEATURE_WLAN_SCAN_PNO + .extract_nlo_match_ev_param = extract_nlo_match_ev_param_tlv, + .extract_nlo_complete_ev_param = extract_nlo_complete_ev_param_tlv, +#endif .extract_all_stats_count = extract_all_stats_counts_tlv, .extract_pdev_stats = extract_pdev_stats_tlv, .extract_unit_test = extract_unit_test_tlv,