diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 78e474256e95..dd9e96245fba 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -731,9 +731,8 @@ static QDF_STATUS scm_add_update_entry(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } -QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg) +QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn) { - struct scan_bcn_probe_event *bcn; struct wlan_objmgr_psoc *psoc; struct wlan_objmgr_pdev *pdev = NULL; struct scan_cache_entry *scan_entry; @@ -745,7 +744,6 @@ QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg) struct scan_cache_node *scan_node; struct wlan_frame_hdr *hdr = NULL; - bcn = msg->bodyptr; if (!bcn) { scm_err("bcn is NULL"); return QDF_STATUS_E_INVAL; @@ -870,6 +868,16 @@ free_nbuf: return status; } +QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg) +{ + if (!msg) { + scm_err("msg is NULL"); + return QDF_STATUS_E_NULL_VALUE; + } + + return __scm_handle_bcn_probe(msg->bodyptr); +} + /** * scm_list_insert_sorted() - add the entries in scan_list in sorted way * @psoc: psoc ptr diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h index 6955beee39fe..f0a670d16ffc 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.h +++ b/umac/scan/core/src/wlan_scan_cache_db.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019 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 @@ -65,7 +65,7 @@ struct scan_bcn_probe_event { /** * scm_handle_bcn_probe() - Process beacon and probe rsp - * @bcn: beacon info; + * @msg: schedular msg with bcn info; * * API to handle the beacon/probe resp * @@ -73,6 +73,17 @@ struct scan_bcn_probe_event { */ QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg); +/** + * __scm_handle_bcn_probe() - Process beacon and probe rsp + * @bcn: beacon info; + * + * API to handle the beacon/probe resp + * + * Return: QDF status. + */ +QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn); + + /** * scm_age_out_entries() - Age out entries older than aging time * @psoc: psoc pointer diff --git a/umac/scan/dispatcher/inc/wlan_scan_api.h b/umac/scan/dispatcher/inc/wlan_scan_api.h index 9835f2ffb988..cbad19c48700 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_api.h @@ -154,4 +154,23 @@ void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc, */ bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc); +/** + * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to + * scheduler thread + * @psoc: psoc context + * @buf: frame buf + * @params: rx event params + * @frm_type: frame type + * + * handle bcn without posting to scheduler thread, this should be called + * while caller is already in scheduler thread context + * + * Return: success or error code. + */ +QDF_STATUS +wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc, + qdf_nbuf_t buf, + struct mgmt_rx_event_params *rx_param, + enum mgmt_frame_type frm_type); + #endif diff --git a/umac/scan/dispatcher/src/wlan_scan_api.c b/umac/scan/dispatcher/src/wlan_scan_api.c index 0b3ad36b10fb..04ac3d96fb02 100644 --- a/umac/scan/dispatcher/src/wlan_scan_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_api.c @@ -175,3 +175,60 @@ bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc) return scan_obj->scan_def.scan_f_chan_stat_evnt; } + +QDF_STATUS +wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc, + qdf_nbuf_t buf, + struct mgmt_rx_event_params *rx_param, + enum mgmt_frame_type frm_type) +{ + struct scan_bcn_probe_event *bcn = NULL; + QDF_STATUS status; + + if ((frm_type != MGMT_PROBE_RESP) && + (frm_type != MGMT_BEACON)) { + scm_err("frame is not beacon or probe resp"); + status = QDF_STATUS_E_INVAL; + goto free; + } + bcn = qdf_mem_malloc_atomic(sizeof(*bcn)); + + if (!bcn) { + scm_debug_rl("Failed to allocate memory for bcn"); + status = QDF_STATUS_E_NOMEM; + goto free; + } + bcn->rx_data = + qdf_mem_malloc_atomic(sizeof(*rx_param)); + if (!bcn->rx_data) { + scm_debug_rl("Failed to allocate memory for rx_data"); + status = QDF_STATUS_E_NOMEM; + goto free; + } + + if (frm_type == MGMT_PROBE_RESP) + bcn->frm_type = MGMT_SUBTYPE_PROBE_RESP; + else + bcn->frm_type = MGMT_SUBTYPE_BEACON; + + status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_SCAN_ID); + if (QDF_IS_STATUS_ERROR(status)) { + scm_info("unable to get reference"); + goto free; + } + + bcn->psoc = psoc; + bcn->buf = buf; + qdf_mem_copy(bcn->rx_data, rx_param, sizeof(*rx_param)); + + return __scm_handle_bcn_probe(bcn); +free: + if (bcn && bcn->rx_data) + qdf_mem_free(bcn->rx_data); + if (bcn) + qdf_mem_free(bcn); + if (buf) + qdf_nbuf_free(buf); + + return status; +}