qcacld-3.0: Modify SAP ACS scan

Modify SAP ACS scan logic according to new
scan common component.

Change-Id: Id85b6c8a9a1500eeec488b30ee3fd1707b402347
CRs-Fixed: 2013212
This commit is contained in:
Sandeep Puligilla 2017-03-06 19:25:47 -08:00 • committed by qcabuildsw
commit 0806e0f980
6 changed files with 121 additions and 26 deletions

View file

@ -33,6 +33,7 @@
#include <wlan_hdd_object_manager.h>
#include <wlan_osif_priv.h>
#ifdef NAPIER_SCAN
static void hdd_init_os_priv(hdd_context_t *hdd_ctx,
struct pdev_osif_priv *os_priv)
{
@ -40,6 +41,7 @@ static void hdd_init_os_priv(hdd_context_t *hdd_ctx,
os_priv->wiphy = hdd_ctx->wiphy;
wlan_cfg80211_scan_priv_init(hdd_ctx->hdd_pdev);
}
#endif
int hdd_create_and_store_psoc(hdd_context_t *hdd_ctx, uint8_t psoc_id)
{
@ -89,8 +91,9 @@ int hdd_create_and_store_pdev(hdd_context_t *hdd_ctx)
return -ENOMEM;
}
hdd_ctx->hdd_pdev = pdev;
#ifdef NAPIER_SCAN
hdd_init_os_priv(hdd_ctx, priv);
#endif
return 0;
}

View file

@ -55,7 +55,8 @@
#include "sap_internal.h"
#include "cds_concurrency.h"
#include "wma.h"
#include <wlan_objmgr_vdev_obj.h>
#include <wlan_objmgr_pdev_obj.h>
/*----------------------------------------------------------------------------
* Preprocessor Definitions and Constants
* -------------------------------------------------------------------------*/
@ -1315,3 +1316,41 @@ wlansap_roam_callback(void *ctx, tCsrRoamInfo *csr_roam_info, uint32_t roamId,
wlansap_context_put(sap_ctx);
return qdf_ret_status;
}
void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev,
struct scan_event *event, void *arg)
{
uint32_t scan_id;
uint8_t session_id;
eCsrScanStatus scan_status = eCSR_SCAN_FAILURE;
tHalHandle hal_handle;
ptSapContext sap_ctx = (ptSapContext) arg;
session_id = wlan_vdev_get_id(vdev);
scan_id = event->scan_id;
hal_handle = cds_get_context(QDF_MODULE_ID_SME);
if (!hal_handle) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_FATAL,
FL("invalid h_hal"));
return;
}
if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
((event->reason == SCAN_REASON_CANCELLED) ||
(event->reason == SCAN_REASON_TIMEDOUT) ||
(event->reason == SCAN_REASON_INTERNAL_FAILURE)))
scan_status = eCSR_SCAN_FAILURE;
else if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
(event->reason == SCAN_REASON_COMPLETED))
scan_status = eCSR_SCAN_SUCCESS;
else
return;
if (!sap_ctx->sap_acs_pre_start_bss)
wlansap_scan_callback(hal_handle, arg, session_id, scan_id,
scan_status);
else
wlansap_pre_start_bss_acs_scan_callback(hal_handle,
arg, session_id,
scan_id, scan_status);
}

View file

@ -51,7 +51,9 @@
#include "cds_reg_service.h"
#include "qdf_util.h"
#include "cds_concurrency.h"
#include <wlan_objmgr_pdev_obj.h>
#include <wlan_objmgr_vdev_obj.h>
#include <wlan_utility.h>
/*----------------------------------------------------------------------------
* Preprocessor Definitions and Constants
* -------------------------------------------------------------------------*/
@ -2192,9 +2194,15 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
/* Initiate a SCAN request */
QDF_STATUS qdf_ret_status;
/* To be initialised if scan is required */
tCsrScanRequest scan_request;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
tpAniSirGlobal mac_ctx;
#ifdef NAPIER_SCAN
struct scan_start_request *req;
struct wlan_objmgr_vdev *vdev;
uint8_t i;
#else
tCsrScanRequest scan_request;
#endif
#ifdef SOFTAP_CHANNEL_RANGE
uint8_t *channel_list = NULL;
@ -2305,50 +2313,57 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
if (sap_context->acs_cfg->skip_scan_status !=
eSAP_SKIP_ACS_SCAN) {
#endif
#ifndef NAPIER_SCAN
qdf_mem_zero(&scan_request, sizeof(scan_request));
/*
* Set scanType to Active scan. FW takes care of using passive
* scan for DFS and active for non DFS channels.
*/
scan_request.scanType = eSIR_ACTIVE_SCAN;
/* Set min and max channel time to zero */
scan_request.minChnTime = 0;
scan_request.maxChnTime = 0;
/* Set BSSType to default type */
scan_request.BSSType = eCSR_BSS_TYPE_ANY;
#ifndef SOFTAP_CHANNEL_RANGE
/*Scan all the channels */
scan_request.ChannelInfo.num_of_channels = 0;
scan_request.ChannelInfo.ChannelList = NULL;
scan_request.requestType = eCSR_SCAN_REQUEST_FULL_SCAN;
/* eCSR_SCAN_REQUEST_11D_SCAN; */
#else
req = qdf_mem_malloc(sizeof(*req));
if (!req) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("Failed to allocate memory"));
return QDF_STATUS_E_NOMEM;
}
vdev = wlan_objmgr_get_vdev_by_macaddr_from_psoc(
mac_ctx->psoc,
sap_context->self_mac_addr,
WLAN_LEGACY_SME_ID);
ucfg_scan_init_default_params(vdev, req);
req->scan_req.dwell_time_active = 0;
req->scan_req.scan_id = ucfg_scan_get_scan_id(mac_ctx->psoc);
req->scan_req.vdev_id = wlan_vdev_get_id(vdev);
req->scan_req.scan_req_id = sap_context->req_id;
#endif
sap_get_channel_list(sap_context, &channel_list,
&num_of_channels);
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
if (num_of_channels != 0) {
#endif
#ifndef NAPIER_SCAN
/*Scan the channels in the list */
scan_request.ChannelInfo.numOfChannels =
num_of_channels;
scan_request.ChannelInfo.ChannelList =
channel_list;
scan_request.requestType =
eCSR_SCAN_SOFTAP_CHANNEL_RANGE;
#else
req->scan_req.num_chan = num_of_channels;
for (i = 0; i < num_of_channels; i++)
req->scan_req.chan_list[i] =
wlan_chan_to_freq(channel_list[i]);
#endif
sap_context->channelList = channel_list;
sap_context->num_of_channel = num_of_channels;
#endif
/* Set requestType to Full scan */
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
@ -2358,6 +2373,8 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
eSAP_DO_NEW_ACS_SCAN)
#endif
sme_scan_flush_result(h_hal);
sap_context->sap_acs_pre_start_bss = sap_do_acs_pre_start_bss;
#ifndef NAPIER_SCAN
if (true == sap_do_acs_pre_start_bss) {
/*
* when ID == 0 11D scan/active scan with callback,
@ -2383,6 +2400,10 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
&wlansap_scan_callback,
sap_context);
}
#else
qdf_ret_status = ucfg_scan_start(req);
wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
#endif
if (QDF_STATUS_SUCCESS != qdf_ret_status) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
FL("sme_scan_request fail %d!!!"),
@ -2420,7 +2441,12 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context,
} else {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("return sme_ScanReq, scanID=%d, Ch=%d"),
scan_request.scan_id, sap_context->channel);
#ifndef NAPIER_SCAN
scan_request.scan_id,
#else
req->scan_req.scan_id,
#endif
sap_context->channel);
}
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
}

View file

@ -41,6 +41,8 @@
#include "sap_api.h"
#include "sap_fsm_ext.h"
#include "sap_ch_select.h"
#include <wlan_scan_public_structs.h>
#include <wlan_objmgr_pdev_obj.h>
/*----------------------------------------------------------------------------
* Preprocessor Definitions and Constants
@ -275,6 +277,8 @@ typedef struct sSapContext {
tSirMacRateSet supp_rate_set;
tSirMacRateSet extended_rate_set;
enum sap_acs_dfs_mode dfs_mode;
wlan_scan_requester req_id;
uint8_t sap_acs_pre_start_bss;
} *ptSapContext;
/*----------------------------------------------------------------------------
@ -457,6 +461,9 @@ sap_mark_leaking_ch(ptSapContext sap_ctx,
uint8_t temp_ch_lst_sz,
uint8_t *temp_ch_lst);
void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev,
struct scan_event *event, void *arg);
#ifdef __cplusplus
}
#endif

View file

@ -315,6 +315,7 @@ QDF_STATUS wlansap_start(void *pCtx, enum tQDF_ADAPTER_MODE mode,
ptSapContext pSapCtx = NULL;
QDF_STATUS qdf_ret_status;
tHalHandle hal;
tpAniSirGlobal pmac;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
@ -369,9 +370,8 @@ QDF_STATUS wlansap_start(void *pCtx, enum tQDF_ADAPTER_MODE mode,
"%s: Invalid HAL pointer", __func__);
return QDF_STATUS_E_INVAL;
}
pmac = PMAC_STRUCT(hal);
qdf_ret_status = sap_open_session(hal, pSapCtx, session_id);
if (QDF_STATUS_SUCCESS != qdf_ret_status) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
"Error: In %s calling sap_open_session status = %d",
@ -379,6 +379,9 @@ QDF_STATUS wlansap_start(void *pCtx, enum tQDF_ADAPTER_MODE mode,
return QDF_STATUS_E_FAILURE;
}
/* Register with scan component */
pSapCtx->req_id = ucfg_scan_register_requester(pmac->psoc, "SAP",
sap_scan_event_callback, pSapCtx);
return QDF_STATUS_SUCCESS;
}
@ -400,6 +403,7 @@ QDF_STATUS wlansap_start(void *pCtx, enum tQDF_ADAPTER_MODE mode,
QDF_STATUS wlansap_stop(void *pCtx)
{
ptSapContext pSapCtx = NULL;
tpAniSirGlobal pmac;
/* Sanity check - Extract SAP control block */
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
@ -411,7 +415,14 @@ QDF_STATUS wlansap_stop(void *pCtx)
"%s: Invalid SAP pointer from pCtx", __func__);
return QDF_STATUS_E_FAULT;
}
pmac = (tpAniSirGlobal) CDS_GET_HAL_CB(pSapCtx->p_cds_gctx);
if (NULL == pmac) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
"%s: Invalid MAC context from p_cds_gctx",
__func__);
return QDF_STATUS_E_FAULT;
}
ucfg_scan_unregister_requester(pmac->psoc, pSapCtx->req_id);
sap_free_roam_profile(&pSapCtx->csr_roamProfile);
if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy(&pSapCtx->SapGlobalLock))) {

View file

@ -2922,6 +2922,7 @@ QDF_STATUS sme_remove_bssid_from_scan_list(tHalHandle hal,
return status;
}
#ifndef NAPIER_SCAN
/**
* sme_scan_request() - wrapper function to Request a 11d or full scan from CSR.
* @hal: hal global context
@ -3012,6 +3013,14 @@ QDF_STATUS sme_scan_request(tHalHandle hal, uint8_t session_id,
sme_release_global_lock(&mac_ctx->sme);
return status;
}
#else
QDF_STATUS sme_scan_request(tHalHandle hal, uint8_t session_id,
tCsrScanRequest *scan_req,
csr_scan_completeCallback callback, void *ctx)
{
return QDF_STATUS_SUCCESS;
}
#endif
/* ---------------------------------------------------------------------------
\fn sme_scan_get_result