qcacld-3.0: HDD changes for common scan module

HDD changes to support scan start and abort

Change-Id: I3260369879108f167453d5e0b8435c30ed729c5e
CRs-Fixed: 2013212
This commit is contained in:
Sandeep Puligilla 2017-02-26 18:34:56 -08:00 • committed by qcabuildsw
commit d000421944
9 changed files with 92 additions and 77 deletions

View file

@ -1508,8 +1508,10 @@ struct hdd_context_s {
struct delayed_work roc_req_work;
qdf_spinlock_t hdd_roc_req_q_lock;
qdf_list_t hdd_roc_req_q;
#ifndef NAPIER_SCAN
qdf_spinlock_t hdd_scan_req_q_lock;
qdf_list_t hdd_scan_req_q;
#endif
uint8_t miracast_value;
#ifdef WLAN_NS_OFFLOAD

View file

@ -6943,8 +6943,12 @@ static int drv_cmd_set_fcc_channel(hdd_adapter_t *adapter,
hdd_err("value out of range");
return -EINVAL;
}
#ifndef NAPIER_SCAN
/* This code will be removed*/
scan_pending = !qdf_list_empty(&hdd_ctx->hdd_scan_req_q);
#else
scan_pending = ucfg_scan_get_pdev_status(hdd_ctx->hdd_pdev);
#endif
status = sme_handle_set_fcc_channel(hdd_ctx->hHal, !fcc_constraint,
scan_pending);
if (status != QDF_STATUS_SUCCESS) {

View file

@ -6900,9 +6900,9 @@ scan_destroy:
hdd_scan_context_destroy(hdd_ctx);
hdd_rx_wake_lock_destroy(hdd_ctx);
hdd_tdls_context_destroy(hdd_ctx);
list_destroy:
qdf_list_destroy(&hdd_ctx->hddAdapters);
return ret;
}

View file

@ -38,6 +38,7 @@ static void hdd_init_os_priv(hdd_context_t *hdd_ctx,
{
/* Initialize the OS private structure*/
os_priv->wiphy = hdd_ctx->wiphy;
wlan_cfg80211_scan_priv_init(hdd_ctx->hdd_pdev);
}
int hdd_create_and_store_psoc(hdd_context_t *hdd_ctx, uint8_t psoc_id)
@ -82,15 +83,13 @@ int hdd_create_and_store_pdev(hdd_context_t *hdd_ctx)
hdd_err("pdev os obj create failed");
return -ENOMEM;
}
hdd_init_os_priv(hdd_ctx, priv);
pdev = wlan_objmgr_pdev_obj_create(psoc, priv);
if (!pdev) {
hdd_err("pdev obj create failed");
return -ENOMEM;
}
hdd_ctx->hdd_pdev = pdev;
hdd_init_os_priv(hdd_ctx, priv);
return 0;
}

View file

@ -1308,8 +1308,11 @@ QDF_STATUS hdd_wlan_shutdown(void)
hdd_info("Invoking packetdump deregistration API");
wlan_deregister_txrx_packetdump();
#ifndef NAPIER_SCAN
hdd_cleanup_scan_queue(pHddCtx);
#else
wlan_cfg80211_abort_scan(pHddCtx->hdd_pdev);
#endif
hdd_ipa_uc_ssr_deinit();
hdd_reset_all_adapters(pHddCtx);

View file

@ -52,6 +52,10 @@
#endif
#include <qca_vendor.h>
#ifdef NAPIER_SCAN
#include <wlan_cfg80211_scan.h>
#endif
#define MAX_RATES 12
#define HDD_WAKE_LOCK_SCAN_DURATION (5 * 1000) /* in msec */
@ -70,7 +74,7 @@ typedef enum eSSIDBcastType {
eBCAST_HIDDEN = 2,
} tSSIDBcastType;
#ifndef NAPIER_SCAN
/**
* typedef hdd_scan_info_t - HDD scan info
* @dev: Pointer to net device
@ -84,7 +88,6 @@ typedef struct hdd_scan_info {
char *start;
char *end;
} hdd_scan_info_t, *hdd_scan_info_tp;
/**
* hdd_translate_abg_rate_to_mbps_rate() - translate abg rate to Mbps rate
* @pFcRate: Rate pointer
@ -191,7 +194,6 @@ static int hdd_get_wparsn_ies(uint8_t *ieFields, uint16_t ie_length,
return 0;
}
/**
* hdd_indicate_scan_result() - indicate scan results
* @scanInfo: Pointer to the scan info structure.
@ -545,7 +547,6 @@ static bool wlan_hdd_is_scan_pending(hdd_adapter_t *adapter)
qdf_spin_unlock(&hdd_ctx->hdd_scan_req_q_lock);
return false;
}
/**
* wlan_hdd_scan_request_enqueue() - enqueue Scan Request
* @adapter: Pointer to the adapter
@ -660,7 +661,6 @@ static QDF_STATUS wlan_hdd_scan_request_dequeue(hdd_context_t *hdd_ctx,
hdd_err("Failed to find scan id %d", scan_id);
return status;
}
/**
* hdd_scan_request_callback() - scan complete callback from SME
* @halHandle: Pointer to the Hal Handle
@ -910,7 +910,6 @@ int iw_set_scan(struct net_device *dev, struct iw_request_info *info,
return ret;
}
/**
* __iw_get_scan() - get scan
* @dev: Pointer to the net device.
@ -1013,6 +1012,7 @@ int iw_get_scan(struct net_device *dev,
return ret;
}
#endif
/**
* hdd_abort_mac_scan() - aborts ongoing mac scan
@ -1028,9 +1028,13 @@ int iw_get_scan(struct net_device *dev,
void hdd_abort_mac_scan(hdd_context_t *pHddCtx, uint8_t sessionId,
uint32_t scan_id, eCsrAbortReason reason)
{
#ifndef NAPIER_SCAN
sme_abort_mac_scan(pHddCtx->hHal, sessionId, scan_id, reason);
#else
wlan_abort_scan(pHddCtx->hdd_pdev, INVAL_PDEV_ID, sessionId, scan_id);
#endif
}
#ifndef NAPIER_SCAN
/**
* hdd_vendor_scan_callback() - Scan completed callback event
* @hddctx: HDD context
@ -1116,7 +1120,7 @@ nla_put_failure:
qdf_mem_free(req);
return;
}
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
/**
* hdd_cfg80211_scan_done() - Scan completed callback to cfg80211
@ -1175,7 +1179,7 @@ static void hdd_cfg80211_scan_done(hdd_adapter_t *adapter,
cfg80211_scan_done(req, aborted);
}
#endif
#ifndef NAPIER_SCAN
/**
* hdd_cfg80211_scan_done_callback() - scan done callback function called after
* scan is finished
@ -1305,7 +1309,7 @@ allow_suspend:
EXIT();
return 0;
}
#endif
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
/**
* wlan_hdd_sap_skip_scan_check() - The function will check OBSS
@ -1482,14 +1486,6 @@ static int wlan_hdd_update_scan_ies(hdd_adapter_t *adapter,
*
* Return: 0 for success, non zero for failure
*/
#ifdef WLAN_UMAC_CONVERGENCE
static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
struct cfg80211_scan_request *request,
uint8_t source)
{
return wlan_cfg80211_scan(wiphy, request);
}
#else
static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
struct cfg80211_scan_request *request,
uint8_t source)
@ -1497,17 +1493,19 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
struct net_device *dev = request->wdev->netdev;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
struct hdd_config *cfg_param = NULL;
tCsrScanRequest scan_req;
uint8_t *channelList = NULL, i;
int status;
hdd_scaninfo_t *pScanInfo = NULL;
uint8_t *pP2pIe = NULL;
hdd_adapter_t *con_sap_adapter;
uint16_t con_dfs_ch;
hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
#ifndef NAPIER_SCAN
tCsrScanRequest scan_req;
uint8_t *channelList = NULL, i;
uint8_t *pP2pIe = NULL;
uint8_t num_chan = 0;
bool is_p2p_scan = false;
#endif
uint8_t curr_session_id;
enum scan_reject_states curr_reason;
@ -1524,7 +1522,6 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
}
status = wlan_hdd_validate_context(pHddCtx);
if (0 != status)
return status;
@ -1573,25 +1570,7 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
return 0;
}
}
if (!wma_is_hw_dbs_capable()) {
if (true == pScanInfo->mScanPending) {
if (MAX_PENDING_LOG >
pScanInfo->mScanPendingCounter++) {
hdd_err("mScanPending is true");
}
return -EBUSY;
}
/* Don't Allow Scan and return busy if Remain On
* Channel and action frame is pending
* Otherwise Cancel Remain On Channel and allow Scan
* If no action frame pending
*/
if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) {
hdd_err("Remain On Channel Pending");
return -EBUSY;
}
}
#ifdef FEATURE_WLAN_TDLS
/* if tdls disagree scan right now, return immediately.
* tdls will schedule the scan when scan is allowed.
@ -1660,6 +1639,33 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
return 0;
}
/* Store the Scan IE's in Adapter*/
if (request->ie_len) {
/* save this for future association (join requires this) */
memset(&pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE));
memcpy(pScanInfo->scanAddIE.addIEdata, request->ie,
request->ie_len);
pScanInfo->scanAddIE.length = request->ie_len;
if (wlan_hdd_update_scan_ies(pAdapter, pScanInfo,
pScanInfo->scanAddIE.addIEdata,
(uint8_t *)&pScanInfo->scanAddIE.length))
hdd_err("Update scan IEs with default Scan IEs failed");
if ((QDF_STA_MODE == pAdapter->device_mode) ||
(QDF_P2P_CLIENT_MODE == pAdapter->device_mode) ||
(QDF_P2P_DEVICE_MODE == pAdapter->device_mode)
) {
pwextBuf->roamProfile.pAddIEScan =
pScanInfo->scanAddIE.addIEdata;
pwextBuf->roamProfile.nAddIEScanLength =
pScanInfo->scanAddIE.length;
}
}
#ifdef NAPIER_SCAN
return wlan_cfg80211_scan(pHddCtx->hdd_pdev, request, source);
#else
/* Below code will be removed once common scan module is available.*/
qdf_mem_zero(&scan_req, sizeof(scan_req));
scan_req.timestamp = qdf_mc_timer_get_system_time();
@ -1782,27 +1788,6 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
pAdapter->sessionId);
}
if (request->ie_len) {
/* save this for future association (join requires this) */
memset(&pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE));
memcpy(pScanInfo->scanAddIE.addIEdata, request->ie,
request->ie_len);
pScanInfo->scanAddIE.length = request->ie_len;
if (wlan_hdd_update_scan_ies(pAdapter, pScanInfo,
pScanInfo->scanAddIE.addIEdata,
(uint8_t *)&pScanInfo->scanAddIE.length))
hdd_err("Update scan IEs with default Scan IEs failed");
if ((QDF_STA_MODE == pAdapter->device_mode) ||
(QDF_P2P_CLIENT_MODE == pAdapter->device_mode) ||
(QDF_P2P_DEVICE_MODE == pAdapter->device_mode)
) {
pwextBuf->roamProfile.pAddIEScan =
pScanInfo->scanAddIE.addIEdata;
pwextBuf->roamProfile.nAddIEScanLength =
pScanInfo->scanAddIE.length;
}
scan_req.uIEFieldLen = pScanInfo->scanAddIE.length;
scan_req.pIEField = pScanInfo->scanAddIE.addIEdata;
@ -1906,7 +1891,6 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
scan_req.scan_id, scan_req.timestamp);
pAdapter->scan_info.mScanPending = true;
pHddCtx->beacon_probe_rsp_cnt_per_scan = 0;
free_mem:
if (scan_req.SSIDs.SSIDList)
qdf_mem_free(scan_req.SSIDs.SSIDList);
@ -1916,9 +1900,10 @@ free_mem:
EXIT();
return status;
}
#endif
}
/**
* wlan_hdd_cfg80211_scan() - API to process cfg80211 scan request
* @wiphy: Pointer to wiphy
@ -2310,6 +2295,8 @@ int wlan_hdd_cfg80211_vendor_scan(struct wiphy *wiphy,
return ret;
}
/* Below code will be removed once common scan module is available.*/
#ifndef NAPIER_SCAN
/**
* wlan_hdd_get_scanid() - API to get the scan id
* from the scan cookie attribute.
@ -2362,6 +2349,7 @@ static int wlan_hdd_get_scanid(hdd_context_t *hdd_ctx,
return ret;
}
#endif
/**
* __wlan_hdd_vendor_abort_scan() - API to process vendor command for
* abort scan
@ -2379,9 +2367,11 @@ static int __wlan_hdd_vendor_abort_scan(
int data_len)
{
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
#ifndef NAPIER_SCAN
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SCAN_MAX + 1];
uint32_t scan_id;
uint64_t cookie;
#endif
int ret;
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
@ -2393,6 +2383,8 @@ static int __wlan_hdd_vendor_abort_scan(
if (0 != ret)
return ret;
/* Below code will be removed once common scan module is available.*/
#ifndef NAPIER_SCAN
ret = -EINVAL;
if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SCAN_MAX, data,
data_len, NULL)) {
@ -2413,7 +2405,10 @@ static int __wlan_hdd_vendor_abort_scan(
scan_id,
eCSR_SCAN_ABORT_DEFAULT);
}
#else
wlan_vendor_abort_scan(hdd_ctx->hdd_pdev, data,
data_len);
#endif
return ret;
}
@ -3058,8 +3053,11 @@ static void __wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy,
if (!ret)
return;
#ifndef NAPIER_SCAN
wlan_hdd_scan_abort(adapter);
#else
wlan_cfg80211_abort_scan(hdd_ctx->hdd_pdev);
#endif
EXIT();
}
@ -3081,7 +3079,7 @@ void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy,
cds_ssr_unprotect(__func__);
}
#endif
#ifndef NAPIER_SCAN
/**
* hdd_cleanup_scan_queue() - remove entries in scan queue
*
@ -3133,6 +3131,7 @@ void hdd_cleanup_scan_queue(hdd_context_t *hdd_ctx)
return;
}
#endif
/**
* hdd_scan_context_destroy() - Destroy scan context
@ -3144,7 +3143,9 @@ void hdd_cleanup_scan_queue(hdd_context_t *hdd_ctx)
*/
void hdd_scan_context_destroy(hdd_context_t *hdd_ctx)
{
#ifndef NAPIER_SCAN
qdf_list_destroy(&hdd_ctx->hdd_scan_req_q);
#endif
qdf_spinlock_destroy(&hdd_ctx->sched_scan_lock);
}
@ -3159,9 +3160,9 @@ void hdd_scan_context_destroy(hdd_context_t *hdd_ctx)
int hdd_scan_context_init(hdd_context_t *hdd_ctx)
{
qdf_spinlock_create(&hdd_ctx->sched_scan_lock);
#ifndef NAPIER_SCAN
qdf_spinlock_create(&hdd_ctx->hdd_scan_req_q_lock);
qdf_list_create(&hdd_ctx->hdd_scan_req_q, CFG_MAX_SCAN_COUNT_MAX);
#endif
return 0;
}

View file

@ -30,6 +30,7 @@
#define WLAN_HDD_SCAN_H
#include "wlan_hdd_main.h"
#include <wlan_cfg80211_scan.h>
#define MAX_PENDING_LOG 5

View file

@ -12182,8 +12182,13 @@ static const iw_handler we_handler[] = {
(iw_handler) iw_get_ap_address, /* SIOCGIWAP */
(iw_handler) iw_set_mlme, /* SIOCSIWMLME */
(iw_handler) NULL, /* SIOCGIWAPLIST */
#ifndef NAPIER_SCAN
(iw_handler) iw_set_scan, /* SIOCSIWSCAN */
(iw_handler) iw_get_scan, /* SIOCGIWSCAN */
#else
(iw_handler) NULL, /* SIOCSIWSCAN */
(iw_handler) NULL, /* SIOCGIWSCAN */
#endif
(iw_handler) iw_set_essid, /* SIOCSIWESSID */
(iw_handler) iw_get_essid, /* SIOCGIWESSID */
(iw_handler) iw_set_nick, /* SIOCSIWNICKN */

View file

@ -3000,7 +3000,7 @@ QDF_STATUS wma_start(void *cds_ctx)
qdf_status = QDF_STATUS_E_INVAL;
goto end;
}
#ifndef NAPIER_SCAN
status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
WMI_SCAN_EVENTID,
wma_scan_event_callback,
@ -3010,7 +3010,7 @@ QDF_STATUS wma_start(void *cds_ctx)
qdf_status = QDF_STATUS_E_FAILURE;
goto end;
}
#endif
status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
WMI_ROAM_EVENTID,
wma_roam_event_callback,