mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
qcacld-3.0: Enhance EXTSCAN feature
qcacld-2.0 to qcacld-3.0 propagation Make the following enhancements to the EXTSCAN feature: * Add buckets_scanned param while sending on_full_scan_result/cached result event to user space. * Configure REPORT_EVENTS_CONTEXT_HUB to firmware. * Remove status while sending on_scan_event to user space. * Add support for SCAN_THRESHOLD_NUM_SCANS / SCAN_THRESHOLD_PERCENT while sending scan event. Change-Id: Ib37ce7cef5b3ce9d9ee4ebdc5ea9bcadaad7b695 CRs-Fixed: 960456
This commit is contained in:
parent
dd3bc6012f
commit
fa937be21a
4 changed files with 136 additions and 22 deletions
|
|
@ -931,10 +931,9 @@ enum qca_wlan_vendor_attr {
|
|||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD:
|
||||
* Unsigned 32-bit value. If max_period is non zero or different than
|
||||
* period, then this bucket is an exponential backoff bucket.
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT:
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE:
|
||||
* Unsigned 32-bit value. For exponential back off bucket,
|
||||
* number of scans performed at a given period and until the
|
||||
* exponent is applied.
|
||||
* number of scans to performed for a given period.
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT:
|
||||
* Unsigned 8-bit value; in number of scans, wake up AP after these
|
||||
* many scans.
|
||||
|
|
@ -1010,7 +1009,7 @@ enum qca_wlan_vendor_attr_extscan_config_params {
|
|||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE,
|
||||
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS,
|
||||
|
||||
|
|
@ -1130,6 +1129,10 @@ enum qca_wlan_vendor_attr_extscan_config_params {
|
|||
* Unsigned 32bit value; Max number of epno networks by ssid
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_NUM_WHITELISTED_SSID:
|
||||
* Unsigned 32bit value; Max number of whitelisted ssids
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_BUCKETS_SCANNED:
|
||||
* Unsigned 32bit value, Bit mask of all buckets scanned in the
|
||||
* current EXTSCAN CYCLE. For e.g. If fw scan is going to scan
|
||||
* following buckets 0, 1, 2 in current cycle then it will be (0x111)
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_AFTER_LAST: After last
|
||||
* @QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_MAX: Max value
|
||||
*/
|
||||
|
|
@ -1250,6 +1253,7 @@ enum qca_wlan_vendor_attr_extscan_results {
|
|||
/* Use attr QCA_WLAN_VENDOR_ATTR_EXTSCAN_NUM_RESULTS_AVAILABLE
|
||||
* to indicate number of results.
|
||||
*/
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_BUCKETS_SCANNED,
|
||||
|
||||
/* keep last */
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_AFTER_LAST,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
* @ignore_cached_results: Flag to ignore cached results or not
|
||||
* @context_lock: Spinlock to serialize all context accesses
|
||||
* @capability_response: Ext scan capability response data from target
|
||||
* @buckets_scanned: bitmask of buckets scanned in extscan cycle
|
||||
*/
|
||||
struct hdd_ext_scan_context {
|
||||
uint32_t request_id;
|
||||
|
|
@ -54,6 +55,7 @@ struct hdd_ext_scan_context {
|
|||
struct completion response_event;
|
||||
spinlock_t context_lock;
|
||||
struct ext_scan_capabilities_response capability_response;
|
||||
uint32_t buckets_scanned;
|
||||
};
|
||||
static struct hdd_ext_scan_context ext_scan_context;
|
||||
|
||||
|
|
@ -314,6 +316,7 @@ wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx,
|
|||
#define EXTSCAN_CACHED_NL_FIXED_TLV \
|
||||
((sizeof(data->request_id) + NLA_HDRLEN) + \
|
||||
(sizeof(data->num_scan_ids) + NLA_HDRLEN) + \
|
||||
(sizeof(data->buckets_scanned) + NLA_HDRLEN)+ \
|
||||
(sizeof(data->more_data) + NLA_HDRLEN))
|
||||
#define EXTSCAN_CACHED_NL_SCAN_ID_TLV \
|
||||
((sizeof(result->scan_id) + NLA_HDRLEN) + \
|
||||
|
|
@ -365,8 +368,9 @@ wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx,
|
|||
hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed");
|
||||
goto fail;
|
||||
}
|
||||
hdd_notice("Req Id %u Num_scan_ids %u More Data %u",
|
||||
data->request_id, data->num_scan_ids, data->more_data);
|
||||
hdd_notice("Req Id %u Num_scan_ids %u More Data %u buckets_scanned %u",
|
||||
data->request_id, data->num_scan_ids, data->more_data,
|
||||
data->buckets_scanned);
|
||||
|
||||
result = &data->result[0];
|
||||
for (i = 0; i < data->num_scan_ids; i++) {
|
||||
|
|
@ -449,6 +453,9 @@ wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx,
|
|||
nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS,
|
||||
result->flags) ||
|
||||
nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_BUCKETS_SCANNED,
|
||||
data->buckets_scanned) ||
|
||||
nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_NUM_RESULTS_AVAILABLE,
|
||||
result->num_results)) {
|
||||
|
|
@ -774,6 +781,7 @@ wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx,
|
|||
hdd_context_t *pHddCtx = (hdd_context_t *) ctx;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct timespec ts;
|
||||
struct hdd_ext_scan_context *context;
|
||||
|
||||
int flags = cds_get_gfp_flags();
|
||||
|
||||
|
|
@ -878,6 +886,17 @@ wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx,
|
|||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
context = &ext_scan_context;
|
||||
spin_lock(&context->context_lock);
|
||||
if (nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_BUCKETS_SCANNED,
|
||||
context->buckets_scanned)) {
|
||||
spin_unlock(&context->context_lock);
|
||||
hdd_notice("Failed to include buckets_scanned");
|
||||
goto nla_put_failure;
|
||||
}
|
||||
spin_unlock(&context->context_lock);
|
||||
|
||||
cfg80211_vendor_event(skb, flags);
|
||||
EXIT();
|
||||
return;
|
||||
|
|
@ -966,6 +985,7 @@ wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx,
|
|||
hdd_context_t *pHddCtx = (hdd_context_t *) ctx;
|
||||
struct sk_buff *skb = NULL;
|
||||
int flags = cds_get_gfp_flags();
|
||||
struct hdd_ext_scan_context *context;
|
||||
|
||||
ENTER();
|
||||
|
||||
|
|
@ -987,17 +1007,32 @@ wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx,
|
|||
hdd_err("cfg80211_vendor_event_alloc failed");
|
||||
return;
|
||||
}
|
||||
hdd_notice("Req Id %u Scan event type %u Scan event status %u",
|
||||
pData->requestId, pData->scanEventType, pData->status);
|
||||
|
||||
hdd_notice("Request Id %u Scan event type %u Scan event status %u buckets scanned %u",
|
||||
pData->requestId, pData->scanEventType, pData->status,
|
||||
pData->buckets_scanned);
|
||||
|
||||
|
||||
context = &ext_scan_context;
|
||||
spin_lock(&context->context_lock);
|
||||
if (pData->scanEventType == WIFI_EXTSCAN_CYCLE_COMPLETED_EVENT) {
|
||||
context->buckets_scanned = 0;
|
||||
pData->scanEventType = WIFI_EXTSCAN_RESULTS_AVAILABLE;
|
||||
spin_unlock(&context->context_lock);
|
||||
} else if (pData->scanEventType == WIFI_EXTSCAN_CYCLE_STARTED_EVENT) {
|
||||
context->buckets_scanned = pData->buckets_scanned;
|
||||
/* No need to report to user space */
|
||||
spin_unlock(&context->context_lock);
|
||||
return;
|
||||
} else {
|
||||
spin_unlock(&context->context_lock);
|
||||
}
|
||||
|
||||
if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID,
|
||||
pData->requestId) ||
|
||||
nla_put_u8(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE,
|
||||
pData->scanEventType) ||
|
||||
nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS,
|
||||
pData->status)) {
|
||||
pData->scanEventType)) {
|
||||
hdd_err("nla put fail");
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
|
@ -2771,14 +2806,14 @@ static int hdd_extscan_start_fill_bucket_channel_spec(
|
|||
hdd_notice("max period %u",
|
||||
req_msg->buckets[bkt_index].max_period);
|
||||
|
||||
/* Parse and fetch exponent */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]) {
|
||||
hdd_err("attr exponent failed");
|
||||
/* Parse and fetch base */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE]) {
|
||||
hdd_err("attr base failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].exponent = nla_get_u32(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]);
|
||||
hdd_notice("exponent %u",
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE]);
|
||||
hdd_notice("base %u",
|
||||
req_msg->buckets[bkt_index].exponent);
|
||||
|
||||
/* Parse and fetch step count */
|
||||
|
|
@ -3241,6 +3276,7 @@ __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
|
|||
spin_lock(&context->context_lock);
|
||||
INIT_COMPLETION(context->response_event);
|
||||
context->request_id = request_id = pReqMsg->requestId;
|
||||
context->buckets_scanned = 0;
|
||||
spin_unlock(&context->context_lock);
|
||||
|
||||
status = sme_ext_scan_start(pHddCtx->hHal, pReqMsg);
|
||||
|
|
|
|||
|
|
@ -4210,8 +4210,35 @@ typedef enum {
|
|||
|
||||
/* wifi scan related events */
|
||||
typedef enum {
|
||||
WIFI_SCAN_BUFFER_FULL,
|
||||
WIFI_SCAN_COMPLETE,
|
||||
/*
|
||||
* reported when REPORT_EVENTS_EACH_SCAN is set and a scan
|
||||
* completes. WIFI_SCAN_THRESHOLD_NUM_SCANS or
|
||||
* WIFI_SCAN_THRESHOLD_PERCENT can be reported instead if the
|
||||
* reason for the event is available; however, at most one of
|
||||
* these events should be reported per scan.
|
||||
*/
|
||||
WIFI_EXTSCAN_RESULTS_AVAILABLE,
|
||||
/*
|
||||
* can be reported when REPORT_EVENTS_EACH_SCAN is not set and
|
||||
* report_threshold_num_scans is reached.
|
||||
*/
|
||||
WIFI_EXTSCAN_THRESHOLD_NUM_SCANS,
|
||||
/*
|
||||
* can be reported when REPORT_EVENTS_EACH_SCAN is not set and
|
||||
* report_threshold_percent is reached
|
||||
*/
|
||||
WIFI_EXTSCAN_THRESHOLD_PERCENT,
|
||||
/*
|
||||
* reported when currently executing gscans are disabled
|
||||
* start_gscan will need to be called again in order to continue
|
||||
* scanning
|
||||
*/
|
||||
WIFI_SCAN_DISABLED,
|
||||
|
||||
/* Below events are consumed in driver only */
|
||||
WIFI_EXTSCAN_BUCKET_STARTED_EVENT = 0x10,
|
||||
WIFI_EXTSCAN_CYCLE_STARTED_EVENT,
|
||||
WIFI_EXTSCAN_CYCLE_COMPLETED_EVENT,
|
||||
} tWifiScanEventType;
|
||||
|
||||
/**
|
||||
|
|
@ -4381,12 +4408,14 @@ typedef struct {
|
|||
* @more_data: 0 - for last fragment
|
||||
* 1 - still more fragment(s) coming
|
||||
* @num_scan_ids: number of scan ids
|
||||
* @buckets_scanned: bitmask of buckets scanned in current extscan cycle
|
||||
* @result: wifi scan result
|
||||
*/
|
||||
struct extscan_cached_scan_results {
|
||||
uint32_t request_id;
|
||||
bool more_data;
|
||||
uint32_t num_scan_ids;
|
||||
uint32_t buckets_scanned;
|
||||
struct extscan_cached_scan_result *result;
|
||||
};
|
||||
|
||||
|
|
@ -4655,6 +4684,7 @@ typedef struct {
|
|||
uint32_t requestId;
|
||||
uint32_t status;
|
||||
uint8_t scanEventType;
|
||||
uint32_t buckets_scanned;
|
||||
} tSirExtScanOnScanEventIndParams, *tpSirExtScanOnScanEventIndParams;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -86,12 +86,14 @@
|
|||
* fire completion events regardless of REPORT_EVENTS_EACH_SCAN.
|
||||
* @EXTSCAN_REPORT_EVENTS_NO_BATCH: controls batching,
|
||||
* 0 => batching, 1 => no batching
|
||||
*/
|
||||
* @EXTSCAN_REPORT_EVENTS_CONTEXT_HUB: forward results to context hub
|
||||
*/
|
||||
enum extscan_report_events_type {
|
||||
EXTSCAN_REPORT_EVENTS_BUFFER_FULL = 0x00,
|
||||
EXTSCAN_REPORT_EVENTS_EACH_SCAN = 0x01,
|
||||
EXTSCAN_REPORT_EVENTS_FULL_RESULTS = 0x02,
|
||||
EXTSCAN_REPORT_EVENTS_NO_BATCH = 0x04,
|
||||
EXTSCAN_REPORT_EVENTS_CONTEXT_HUB = 0x08,
|
||||
};
|
||||
|
||||
#define WMA_EXTSCAN_CYCLE_WAKE_LOCK_DURATION (5 * 1000) /* in msec */
|
||||
|
|
@ -3617,6 +3619,8 @@ int wma_extscan_operations_event_handler(void *handle,
|
|||
WMI_EXTSCAN_OPERATION_EVENTID_param_tlvs *param_buf;
|
||||
wmi_extscan_operation_event_fixed_param *oprn_event;
|
||||
tSirExtScanOnScanEventIndParams *oprn_ind;
|
||||
uint32_t cnt;
|
||||
|
||||
tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
|
||||
if (!pMac) {
|
||||
WMA_LOGE("%s: Invalid pMac", __func__);
|
||||
|
|
@ -3644,22 +3648,56 @@ int wma_extscan_operations_event_handler(void *handle,
|
|||
|
||||
switch (oprn_event->event) {
|
||||
case WMI_EXTSCAN_BUCKET_COMPLETED_EVENT:
|
||||
oprn_ind->scanEventType = WIFI_SCAN_COMPLETE;
|
||||
WMA_LOGD("%s: received WMI_EXTSCAN_BUCKET_COMPLETED_EVENT",
|
||||
__func__);
|
||||
oprn_ind->scanEventType = WIFI_EXTSCAN_RESULTS_AVAILABLE;
|
||||
oprn_ind->status = 0;
|
||||
break;
|
||||
|
||||
case WMI_EXTSCAN_CYCLE_STARTED_EVENT:
|
||||
WMA_LOGD("%s: received WMI_EXTSCAN_CYCLE_STARTED_EVENT",
|
||||
__func__);
|
||||
qdf_wake_lock_timeout_acquire(&wma->extscan_wake_lock,
|
||||
WMA_EXTSCAN_CYCLE_WAKE_LOCK_DURATION,
|
||||
WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN);
|
||||
goto exit_handler;
|
||||
oprn_ind->scanEventType = WIFI_EXTSCAN_CYCLE_STARTED_EVENT;
|
||||
oprn_ind->status = 0;
|
||||
oprn_ind->buckets_scanned = 0;
|
||||
for (cnt = 0; cnt < oprn_event->num_buckets; cnt++)
|
||||
oprn_ind->buckets_scanned |=
|
||||
(1 << param_buf->bucket_id[cnt]);
|
||||
WMA_LOGD(FL("num_buckets %u request_id %u buckets_scanned %u"),
|
||||
oprn_event->num_buckets, oprn_ind->requestId,
|
||||
oprn_ind->buckets_scanned);
|
||||
break;
|
||||
case WMI_EXTSCAN_CYCLE_COMPLETED_EVENT:
|
||||
WMA_LOGD("%s: received WMI_EXTSCAN_CYCLE_COMPLETED_EVENT",
|
||||
__func__);
|
||||
qdf_wake_lock_release(&wma->extscan_wake_lock,
|
||||
WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN);
|
||||
oprn_ind->scanEventType = WIFI_EXTSCAN_CYCLE_COMPLETED_EVENT;
|
||||
oprn_ind->status = 0;
|
||||
/* Set bucket scanned mask to zero on cycle complete */
|
||||
oprn_ind->buckets_scanned = 0;
|
||||
break;
|
||||
case WMI_EXTSCAN_BUCKET_STARTED_EVENT:
|
||||
WMA_LOGD("%s: received WIFI_EXTSCAN_BUCKET_STARTED_EVENT",
|
||||
__func__);
|
||||
oprn_ind->scanEventType = WIFI_EXTSCAN_BUCKET_STARTED_EVENT;
|
||||
oprn_ind->status = 0;
|
||||
goto exit_handler;
|
||||
case WMI_EXTSCAN_THRESHOLD_NUM_SCANS:
|
||||
WMA_LOGD("%s: received WIFI_EXTSCAN_THRESHOLD_NUM_SCANS",
|
||||
__func__);
|
||||
oprn_ind->scanEventType = WIFI_EXTSCAN_THRESHOLD_NUM_SCANS;
|
||||
oprn_ind->status = 0;
|
||||
break;
|
||||
case WMI_EXTSCAN_THRESHOLD_PERCENT:
|
||||
WMA_LOGD("%s: received WIFI_EXTSCAN_THRESHOLD_PERCENT",
|
||||
__func__);
|
||||
oprn_ind->scanEventType = WIFI_EXTSCAN_THRESHOLD_PERCENT;
|
||||
oprn_ind->status = 0;
|
||||
break;
|
||||
default:
|
||||
WMA_LOGE("%s: Unknown event(%d) from target",
|
||||
__func__, oprn_event->event);
|
||||
|
|
@ -4159,6 +4197,7 @@ int wma_extscan_cached_results_event_handler(void *handle,
|
|||
qdf_mem_zero(dest_cachelist, sizeof(*dest_cachelist));
|
||||
dest_cachelist->request_id = event->request_id;
|
||||
dest_cachelist->more_data = moredata;
|
||||
dest_cachelist->buckets_scanned = event->buckets_scanned;
|
||||
|
||||
scan_ids_cnt = wma_extscan_find_unique_scan_ids(cmd_param_info);
|
||||
WMA_LOGI("%s: scan_ids_cnt %d", __func__, scan_ids_cnt);
|
||||
|
|
@ -4656,6 +4695,11 @@ QDF_STATUS wma_get_buf_extscan_start_cmd(tp_wma_handle wma_handle,
|
|||
dest_blist->configuration_flags =
|
||||
WMI_EXTSCAN_BUCKET_CACHE_RESULTS;
|
||||
|
||||
if (src_bucket->reportEvents &
|
||||
EXTSCAN_REPORT_EVENTS_CONTEXT_HUB)
|
||||
dest_blist->configuration_flags |=
|
||||
WMI_EXTSCAN_REPORT_EVENT_CONTEXT_HUB;
|
||||
|
||||
WMA_LOGI("%s: ntfy_extscan_events:%u cfg_flags:%u fwd_flags:%u",
|
||||
__func__, dest_blist->notify_extscan_events,
|
||||
dest_blist->configuration_flags,
|
||||
|
|
|
|||
Loading…
Reference in a new issue