qcacmn: Clean scan active and passive dwell time apis

Create ucfg apis in scan components for calling from hdd.
Move the scan apis to new file, wlan_scan_api.c

Change-Id: Iec08eddbba3066a4d781c988624d47749a75610a
CRs-Fixed: 2342892
This commit is contained in:
Harprit Chhabada
2018-10-30 15:10:52 -07:00
zatwierdzone przez nshrivas
rodzic 07215e8082
commit 2de9f012bd
5 zmienionych plików z 206 dodań i 82 usunięć

Wyświetl plik

@@ -510,15 +510,23 @@ struct wlan_scan_obj {
*
* Return: scan object
*/
#define wlan_psoc_get_scan_obj(psoc) \
wlan_psoc_get_scan_obj_fl(psoc, \
__func__, __LINE__)
static inline struct wlan_scan_obj *
wlan_psoc_get_scan_obj(struct wlan_objmgr_psoc *psoc)
wlan_psoc_get_scan_obj_fl(struct wlan_objmgr_psoc *psoc,
const char *func, uint32_t line)
{
struct wlan_scan_obj *scan_obj;
scan_obj = (struct wlan_scan_obj *)
wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_SCAN);
if (!scan_obj) {
scm_err("%s:%u, Failed to get scan object", func, line);
return NULL;
}
return scan_obj;
}

Wyświetl plik

@@ -0,0 +1,69 @@
/*
* Copyright (c) 2017-2018 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: contains scan api
*/
#ifndef _WLAN_SCAN_API_H_
#define _WLAN_SCAN_API_H_
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_objmgr_vdev_obj.h>
#include "../../core/src/wlan_scan_main.h"
/**
* wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan active dwell time
*
* Return: none
*/
void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time);
/**
* wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan active dwelltime
*
* Return: scan active dwell time
*/
void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time);
/**
* wlan_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan passive dwell time
*
* Return: none
*/
void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time);
/**
* wlan_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan passive dwelltime
*
* Return: scan passive dwell time
*/
void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time);
#endif

Wyświetl plik

@@ -28,6 +28,7 @@
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_objmgr_vdev_obj.h>
#include <wlan_scan_public_structs.h>
#include "wlan_scan_api.h"
/**
* ucfg_scan_register_requester() - assigns requester ID to caller and
@@ -629,41 +630,58 @@ void ucfg_scan_set_vdev_del_in_progress(struct wlan_objmgr_vdev *vdev);
void ucfg_scan_clear_vdev_del_in_progress(struct wlan_objmgr_vdev *vdev);
/**
* wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
* ucfg_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan active dwell time
*
* Return: none
*/
void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time);
/**
* wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan active dwelltime
*
* Return: scan active dwell time
*/
void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time);
static inline
void ucfg_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time)
{
return wlan_scan_cfg_set_active_dwelltime(psoc, dwell_time);
}
/**
* wlan_scan_cfg_set_passive_dwelltime() - API to set scan active dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan active dwell time
*
* Return: none
*/
void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time);
/**
* wlan_scan_cfg_get_passive_dwelltime() - API to get active dwelltime
* ucfg_scan_cfg_get_active_dwelltime() - API to get active dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan active dwelltime
*
* Return: scan active dwell time
*/
void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time);
static inline
void ucfg_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time)
{
return wlan_scan_cfg_get_active_dwelltime(psoc, dwell_time);
}
/**
* ucfg_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan passive dwell time
*
* Return: none
*/
static inline
void ucfg_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time)
{
return wlan_scan_cfg_set_passive_dwelltime(psoc, dwell_time);
}
/**
* ucfg_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
* @psoc: pointer to psoc object
* @dwell_time: scan passive dwelltime
*
* Return: scan passive dwell time
*/
static inline
void ucfg_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time)
{
return wlan_scan_cfg_get_passive_dwelltime(psoc, dwell_time);
}
#endif

Wyświetl plik

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2017-2018 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* DOC: This file contains all SCAN component's APIs
*/
#include "cfg_ucfg_api.h"
#include "wlan_scan_api.h"
void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj)
return;
*dwell_time = scan_obj->scan_def.passive_dwell;
}
void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj)
return;
scan_obj->scan_def.passive_dwell = dwell_time;
}
void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj)
return;
*dwell_time = scan_obj->scan_def.active_dwell;
}
void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj)
return;
scan_obj->scan_def.active_dwell = dwell_time;
}

Wyświetl plik

@@ -987,6 +987,8 @@ ucfg_scan_set_wide_band_scan(struct wlan_objmgr_pdev *pdev, bool enable)
}
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
scan_obj = wlan_pdev_get_scan_obj(pdev);
if (!scan_obj)
return QDF_STATUS_E_FAILURE;
scm_debug("set wide_band_scan to %d", enable);
scan_obj->pdev_info[pdev_id].wide_band_scan = enable;
@@ -1005,6 +1007,8 @@ bool ucfg_scan_get_wide_band_scan(struct wlan_objmgr_pdev *pdev)
}
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
scan_obj = wlan_pdev_get_scan_obj(pdev);
if (!scan_obj)
return QDF_STATUS_E_FAILURE;
return scan_obj->pdev_info[pdev_id].wide_band_scan;
}
@@ -1023,6 +1027,8 @@ ucfg_scan_config_hidden_ssid_for_bssid(struct wlan_objmgr_pdev *pdev,
}
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
scan_obj = wlan_pdev_get_scan_obj(pdev);
if (!scan_obj)
return QDF_STATUS_E_FAILURE;
scm_debug("Configure bsssid:%pM ssid:%.*s",
bssid, ssid->length, ssid->ssid);
@@ -1166,6 +1172,9 @@ ucfg_scan_register_requester(struct wlan_objmgr_psoc *psoc,
return 0;
}
scan = wlan_psoc_get_scan_obj(psoc);
if (!scan)
return 0;
requesters = scan->requesters;
qdf_spin_lock_bh(&scan->lock);
for (i = 0; i < WLAN_MAX_REQUESTORS; ++i) {
@@ -1216,6 +1225,8 @@ ucfg_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
return;
}
scan = wlan_psoc_get_scan_obj(psoc);
if (!scan)
return;
requesters = scan->requesters;
scm_debug("reqid: %d", requester);
@@ -1240,6 +1251,9 @@ ucfg_get_scan_requester_name(struct wlan_objmgr_psoc *psoc,
return "null";
}
scan = wlan_psoc_get_scan_obj(psoc);
if (!scan)
return "null";
requesters = scan->requesters;
if ((idx < WLAN_MAX_REQUESTORS) &&
@@ -1341,62 +1355,6 @@ ucfg_scan_register_event_handler(struct wlan_objmgr_pdev *pdev,
return QDF_STATUS_SUCCESS;
}
void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj) {
scm_err("Failed to get scan object");
return;
}
*dwell_time = scan_obj->scan_def.passive_dwell;
}
void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj) {
scm_err("Failed to get scan object");
return;
}
scan_obj->scan_def.passive_dwell = dwell_time;
}
void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t *dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj) {
scm_err("Failed to get scan object");
return;
}
*dwell_time = scan_obj->scan_def.active_dwell;
}
void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
uint32_t dwell_time)
{
struct wlan_scan_obj *scan_obj;
scan_obj = wlan_psoc_get_scan_obj(psoc);
if (!scan_obj) {
scm_err("Failed to get scan object");
return;
}
scan_obj->scan_def.active_dwell = dwell_time;
}
static QDF_STATUS
wlan_scan_global_init(struct wlan_objmgr_psoc *psoc,
struct wlan_scan_obj *scan_obj)
@@ -1509,6 +1467,9 @@ ucfg_scan_unregister_event_handler(struct wlan_objmgr_pdev *pdev,
return;
}
scan = wlan_pdev_get_scan_obj(pdev);
if (!scan)
return;
pdev_ev_handler = wlan_pdev_get_pdev_scan_ev_handlers(pdev);
cb_handler = &(pdev_ev_handler->cb_handlers[0]);