qcacmn: Clean up wmi.h in target_if_scan.c

Add WMI unified APIs to extract PNO related WMI events in order to
remove wmi.h inclusion in target_if_scan.c.

Change-Id: I7fd28f175de002b48c294783f69b819ce2f3e37a
CRs-fixed: 2519032
This commit is contained in:
Yue Ma
2019-11-01 17:06:57 -07:00
committed by nshrivas
parent 28d1d127aa
commit 4b48131ce2
5 changed files with 142 additions and 19 deletions

View File

@@ -28,9 +28,6 @@
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_scan_tgt_api.h>
#include <target_if.h>
#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) {

View File

@@ -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

View File

@@ -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);

View File

@@ -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)

View File

@@ -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,