mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-10 12:52:37 -05:00
qcacld-3.0: Refine the extscan start scan logic
Make the following updates to the extscan start scan logic: 1) Exclusively use the Unified WMI data structures. 2) Update the HDD<=>SME interface to enforce the contract that SME must not make any assumptions about the buffers provided by HDD. 3) Address a multitude of checkpatch issues Change-Id: I68dc988fafb7e14b2b80d1007adf614ddff284e2 CRs-Fixed: 2335045
This commit is contained in:
parent
54ecf6c7d5
commit
dab5860bf9
7 changed files with 295 additions and 460 deletions
|
|
@ -58,8 +58,8 @@ struct hdd_ext_scan_context {
|
|||
};
|
||||
static struct hdd_ext_scan_context ext_scan_context;
|
||||
|
||||
static const struct nla_policy wlan_hdd_extscan_config_policy
|
||||
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = {
|
||||
static const
|
||||
struct nla_policy wlan_hdd_extscan_config_policy[EXTSCAN_PARAM_MAX + 1] = {
|
||||
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = {
|
||||
.type = NLA_U32},
|
||||
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = {
|
||||
|
|
@ -2514,10 +2514,11 @@ int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
|
|||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void hdd_extscan_update_dwell_time_limits(
|
||||
tpSirWifiScanCmdReqParams req_msg, uint32_t bkt_idx,
|
||||
uint32_t active_min, uint32_t active_max,
|
||||
uint32_t passive_min, uint32_t passive_max)
|
||||
static void
|
||||
hdd_extscan_update_dwell_time_limits(struct wifi_scan_cmd_req_params *req_msg,
|
||||
uint32_t bkt_idx, uint32_t active_min,
|
||||
uint32_t active_max, uint32_t passive_min,
|
||||
uint32_t passive_max)
|
||||
{
|
||||
/* update per-bucket dwell times */
|
||||
if (req_msg->buckets[bkt_idx].min_dwell_time_active >
|
||||
|
|
@ -2570,13 +2571,13 @@ static void hdd_extscan_update_dwell_time_limits(
|
|||
*
|
||||
* Return: true if total channels reached max, false otherwise
|
||||
*/
|
||||
static bool hdd_extscan_channel_max_reached(tSirWifiScanCmdReqParams *req,
|
||||
uint8_t total_channels)
|
||||
static bool
|
||||
hdd_extscan_channel_max_reached(struct wifi_scan_cmd_req_params *req,
|
||||
uint8_t total_channels)
|
||||
{
|
||||
if (total_channels == WLAN_EXTSCAN_MAX_CHANNELS) {
|
||||
hdd_warn(
|
||||
"max #of channels %d reached, take only first %d bucket(s)",
|
||||
total_channels, req->numBuckets);
|
||||
if (total_channels == WMI_WLAN_EXTSCAN_MAX_CHANNELS) {
|
||||
hdd_warn("max #of channels %d reached, take only first %d bucket(s)",
|
||||
total_channels, req->num_buckets);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -2586,32 +2587,34 @@ static bool hdd_extscan_channel_max_reached(tSirWifiScanCmdReqParams *req,
|
|||
* hdd_extscan_start_fill_bucket_channel_spec() - fill bucket channel spec
|
||||
* @hdd_ctx: HDD global context
|
||||
* @req_msg: Pointer to request structure
|
||||
* @tb: pointer to NL attributes
|
||||
* @bucket_attr: pointer to bucket attribute
|
||||
*
|
||||
* Return: 0 on success; error number otherwise
|
||||
*/
|
||||
static int hdd_extscan_start_fill_bucket_channel_spec(
|
||||
struct hdd_context *hdd_ctx,
|
||||
tpSirWifiScanCmdReqParams req_msg,
|
||||
struct nlattr **tb)
|
||||
struct wifi_scan_cmd_req_params *req_msg,
|
||||
struct nlattr *bucket_attr)
|
||||
{
|
||||
mac_handle_t mac_handle;
|
||||
struct nlattr *bucket[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
|
||||
struct nlattr *channel[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1];
|
||||
struct nlattr *bucket_tb[EXTSCAN_PARAM_MAX + 1];
|
||||
struct nlattr *channel_tb[EXTSCAN_PARAM_MAX + 1];
|
||||
struct nlattr *buckets;
|
||||
struct nlattr *channels;
|
||||
int rem1, rem2;
|
||||
int id, rem1, rem2;
|
||||
QDF_STATUS status;
|
||||
uint8_t bkt_index, j, num_channels, total_channels = 0;
|
||||
uint32_t expected_buckets;
|
||||
uint32_t expected_channels;
|
||||
uint32_t chan_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
|
||||
uint32_t extscan_active_min_chn_time;
|
||||
uint32_t min_dwell_time_active_bucket;
|
||||
uint32_t max_dwell_time_active_bucket;
|
||||
uint32_t min_dwell_time_passive_bucket;
|
||||
uint32_t max_dwell_time_passive_bucket;
|
||||
struct wifi_scan_bucket_params *bucket;
|
||||
struct wifi_scan_channelspec_params *channel;
|
||||
struct nlattr *channel_attr;
|
||||
|
||||
ucfg_extscan_get_active_min_time(hdd_ctx->psoc,
|
||||
&extscan_active_min_chn_time);
|
||||
|
|
@ -2629,108 +2632,105 @@ static int hdd_extscan_start_fill_bucket_channel_spec(
|
|||
req_msg->min_dwell_time_passive =
|
||||
req_msg->max_dwell_time_passive = max_dwell_time_passive_bucket;
|
||||
|
||||
expected_buckets = req_msg->numBuckets;
|
||||
req_msg->numBuckets = 0;
|
||||
expected_buckets = req_msg->num_buckets;
|
||||
req_msg->num_buckets = 0;
|
||||
bkt_index = 0;
|
||||
|
||||
mac_handle = hdd_ctx->mac_handle;
|
||||
nla_for_each_nested(buckets,
|
||||
tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) {
|
||||
nla_for_each_nested(buckets, bucket_attr, rem1) {
|
||||
|
||||
if (bkt_index >= expected_buckets) {
|
||||
hdd_warn("ignoring excess buckets");
|
||||
break;
|
||||
}
|
||||
|
||||
if (wlan_cfg80211_nla_parse(bucket,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
|
||||
nla_data(buckets), nla_len(buckets),
|
||||
wlan_hdd_extscan_config_policy)) {
|
||||
if (wlan_cfg80211_nla_parse(bucket_tb, EXTSCAN_PARAM_MAX,
|
||||
nla_data(buckets), nla_len(buckets),
|
||||
wlan_hdd_extscan_config_policy)) {
|
||||
hdd_err("nla_parse failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bucket = &req_msg->buckets[bkt_index];
|
||||
|
||||
/* Parse and fetch bucket spec */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr bucket index failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].bucket = nla_get_u8(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]);
|
||||
bucket->bucket = nla_get_u8(bucket_tb[id]);
|
||||
|
||||
/* Parse and fetch wifi band */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr wifi band failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].band = nla_get_u8(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]);
|
||||
bucket->band = nla_get_u8(bucket_tb[id]);
|
||||
|
||||
/* Parse and fetch period */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr period failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].period = nla_get_u32(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]);
|
||||
bucket->period = nla_get_u32(bucket_tb[id]);
|
||||
|
||||
/* Parse and fetch report events */
|
||||
if (!bucket[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr report events failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].reportEvents = nla_get_u8(
|
||||
bucket[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]);
|
||||
bucket->report_events = nla_get_u8(bucket_tb[id]);
|
||||
|
||||
/* Parse and fetch max period */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr max period failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].max_period = nla_get_u32(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]);
|
||||
bucket->max_period = nla_get_u32(bucket_tb[id]);
|
||||
|
||||
/* Parse and fetch base */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr base failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].exponent = nla_get_u32(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE]);
|
||||
bucket->exponent = nla_get_u32(bucket_tb[id]);
|
||||
|
||||
/* Parse and fetch step count */
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr step count failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].step_count = nla_get_u32(
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]);
|
||||
bucket->step_count = nla_get_u32(bucket_tb[id]);
|
||||
|
||||
hdd_debug("Bucket spec Index: %d Wifi band: %d period: %d report events: %d max period: %u base: %u Step count: %u",
|
||||
req_msg->buckets[bkt_index].bucket,
|
||||
req_msg->buckets[bkt_index].band,
|
||||
req_msg->buckets[bkt_index].period,
|
||||
req_msg->buckets[bkt_index].reportEvents,
|
||||
req_msg->buckets[bkt_index].max_period,
|
||||
req_msg->buckets[bkt_index].exponent,
|
||||
req_msg->buckets[bkt_index].step_count);
|
||||
bucket->bucket,
|
||||
bucket->band,
|
||||
bucket->period,
|
||||
bucket->report_events,
|
||||
bucket->max_period,
|
||||
bucket->exponent,
|
||||
bucket->step_count);
|
||||
|
||||
/* start with known good values for bucket dwell times */
|
||||
req_msg->buckets[bkt_index].min_dwell_time_active =
|
||||
req_msg->buckets[bkt_index].max_dwell_time_active =
|
||||
max_dwell_time_active_bucket;
|
||||
bucket->min_dwell_time_active = max_dwell_time_active_bucket;
|
||||
bucket->max_dwell_time_active = max_dwell_time_active_bucket;
|
||||
bucket->min_dwell_time_passive = max_dwell_time_passive_bucket;
|
||||
bucket->max_dwell_time_passive = max_dwell_time_passive_bucket;
|
||||
|
||||
req_msg->buckets[bkt_index].min_dwell_time_passive =
|
||||
req_msg->buckets[bkt_index].max_dwell_time_passive =
|
||||
max_dwell_time_passive_bucket;
|
||||
|
||||
/* Framework shall pass the channel list if the input WiFi band
|
||||
* is WIFI_BAND_UNSPECIFIED.
|
||||
* If the input WiFi band is specified (any value other than
|
||||
* WIFI_BAND_UNSPECIFIED) then driver populates the channel list
|
||||
/* Framework shall pass the channel list if the input
|
||||
* WiFi band is WMI_WIFI_BAND_UNSPECIFIED. If the
|
||||
* input WiFi band is specified (any value other than
|
||||
* WMI_WIFI_BAND_UNSPECIFIED) then driver populates
|
||||
* the channel list.
|
||||
*/
|
||||
if (req_msg->buckets[bkt_index].band != WIFI_BAND_UNSPECIFIED) {
|
||||
if (bucket->band != WMI_WIFI_BAND_UNSPECIFIED) {
|
||||
if (hdd_extscan_channel_max_reached(req_msg,
|
||||
total_channels))
|
||||
return 0;
|
||||
|
|
@ -2738,78 +2738,72 @@ static int hdd_extscan_start_fill_bucket_channel_spec(
|
|||
num_channels = 0;
|
||||
hdd_debug("WiFi band is specified, driver to fill channel list");
|
||||
status = sme_get_valid_channels_by_band(mac_handle,
|
||||
req_msg->buckets[bkt_index].band,
|
||||
chan_list, &num_channels);
|
||||
bucket->band,
|
||||
chan_list,
|
||||
&num_channels);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
hdd_err("sme_GetValidChannelsByBand failed (err=%d)",
|
||||
status);
|
||||
hdd_err("sme_get_valid_channels_by_band failed (err=%d)",
|
||||
status);
|
||||
return -EINVAL;
|
||||
}
|
||||
hdd_debug("before trimming, num_channels: %d",
|
||||
num_channels);
|
||||
num_channels);
|
||||
|
||||
req_msg->buckets[bkt_index].numChannels =
|
||||
bucket->num_channels =
|
||||
QDF_MIN(num_channels,
|
||||
(WLAN_EXTSCAN_MAX_CHANNELS -
|
||||
(WMI_WLAN_EXTSCAN_MAX_CHANNELS -
|
||||
total_channels));
|
||||
hdd_debug("Adj Num channels/bucket: %d total_channels: %d",
|
||||
req_msg->buckets[bkt_index].numChannels,
|
||||
total_channels);
|
||||
total_channels +=
|
||||
req_msg->buckets[bkt_index].numChannels;
|
||||
bucket->num_channels, total_channels);
|
||||
total_channels += bucket->num_channels;
|
||||
|
||||
for (j = 0; j < req_msg->buckets[bkt_index].numChannels;
|
||||
j++) {
|
||||
req_msg->buckets[bkt_index].channels[j].channel =
|
||||
chan_list[j];
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
chnlClass = 0;
|
||||
for (j = 0; j < bucket->num_channels; j++) {
|
||||
channel = &bucket->channels[j];
|
||||
|
||||
channel->channel = chan_list[j];
|
||||
channel->channel_class = 0;
|
||||
if ((wlan_reg_get_channel_state(
|
||||
hdd_ctx->pdev,
|
||||
cds_freq_to_chan(chan_list[j]))) !=
|
||||
CHANNEL_STATE_ENABLE) {
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
passive = 1;
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
dwellTimeMs =
|
||||
channel->passive = 1;
|
||||
channel->dwell_time_ms =
|
||||
max_dwell_time_passive_bucket;
|
||||
/* reconfigure per-bucket dwell time */
|
||||
if (min_dwell_time_passive_bucket >
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
min_dwell_time_passive_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
if (max_dwell_time_passive_bucket <
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
max_dwell_time_passive_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
|
||||
} else {
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
passive = 0;
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
dwellTimeMs =
|
||||
channel->passive = 0;
|
||||
channel->dwell_time_ms =
|
||||
max_dwell_time_active_bucket;
|
||||
/* reconfigure per-bucket dwell times */
|
||||
if (min_dwell_time_active_bucket >
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
min_dwell_time_active_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
if (max_dwell_time_active_bucket <
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
max_dwell_time_active_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
hdd_debug("Channel: %u Passive: %u Dwell time: %u ms Class: %u",
|
||||
req_msg->buckets[bkt_index].channels[j].channel,
|
||||
req_msg->buckets[bkt_index].channels[j].passive,
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs,
|
||||
req_msg->buckets[bkt_index].channels[j].chnlClass);
|
||||
channel->channel,
|
||||
channel->passive,
|
||||
channel->dwell_time_ms,
|
||||
channel->channel_class);
|
||||
}
|
||||
|
||||
hdd_extscan_update_dwell_time_limits(
|
||||
|
|
@ -2821,164 +2815,163 @@ static int hdd_extscan_start_fill_bucket_channel_spec(
|
|||
|
||||
hdd_debug("bkt_index:%d actv_min:%d actv_max:%d pass_min:%d pass_max:%d",
|
||||
bkt_index,
|
||||
req_msg->buckets[bkt_index].min_dwell_time_active,
|
||||
req_msg->buckets[bkt_index].max_dwell_time_active,
|
||||
req_msg->buckets[bkt_index].min_dwell_time_passive,
|
||||
req_msg->buckets[bkt_index].max_dwell_time_passive);
|
||||
bucket->min_dwell_time_active,
|
||||
bucket->max_dwell_time_active,
|
||||
bucket->min_dwell_time_passive,
|
||||
bucket->max_dwell_time_passive);
|
||||
|
||||
bkt_index++;
|
||||
req_msg->numBuckets++;
|
||||
req_msg->num_buckets++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Parse and fetch number of channels */
|
||||
if (!bucket[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS;
|
||||
if (!bucket_tb[id]) {
|
||||
hdd_err("attr num channels failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].numChannels =
|
||||
nla_get_u32(bucket[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]);
|
||||
bucket->num_channels = nla_get_u32(bucket_tb[id]);
|
||||
hdd_debug("before trimming: num channels %d",
|
||||
req_msg->buckets[bkt_index].numChannels);
|
||||
bucket->num_channels);
|
||||
|
||||
req_msg->buckets[bkt_index].numChannels =
|
||||
QDF_MIN(req_msg->buckets[bkt_index].numChannels,
|
||||
(WLAN_EXTSCAN_MAX_CHANNELS - total_channels));
|
||||
bucket->num_channels =
|
||||
QDF_MIN(bucket->num_channels,
|
||||
(WMI_WLAN_EXTSCAN_MAX_CHANNELS -
|
||||
total_channels));
|
||||
hdd_debug("Num channels/bucket: %d total_channels: %d",
|
||||
req_msg->buckets[bkt_index].numChannels,
|
||||
total_channels);
|
||||
bucket->num_channels, total_channels);
|
||||
|
||||
if (hdd_extscan_channel_max_reached(req_msg, total_channels))
|
||||
return 0;
|
||||
|
||||
if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC;
|
||||
channel_attr = bucket_tb[id];
|
||||
if (!channel_attr) {
|
||||
hdd_err("attr channel spec failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
nla_for_each_nested(channels,
|
||||
bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) {
|
||||
if ((j >= req_msg->buckets[bkt_index].numChannels) ||
|
||||
expected_channels = bucket->num_channels;
|
||||
bucket->num_channels = 0;
|
||||
|
||||
nla_for_each_nested(channels, channel_attr, rem2) {
|
||||
if ((bucket->num_channels >= expected_channels) ||
|
||||
hdd_extscan_channel_max_reached(req_msg,
|
||||
total_channels))
|
||||
break;
|
||||
|
||||
if (wlan_cfg80211_nla_parse(channel,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
|
||||
nla_data(channels), nla_len(channels),
|
||||
wlan_hdd_extscan_config_policy)) {
|
||||
if (wlan_cfg80211_nla_parse(channel_tb,
|
||||
EXTSCAN_PARAM_MAX,
|
||||
nla_data(channels),
|
||||
nla_len(channels),
|
||||
wlan_hdd_extscan_config_policy)) {
|
||||
hdd_err("nla_parse failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
channel = &bucket->channels[bucket->num_channels];
|
||||
/* Parse and fetch channel */
|
||||
if (!channel[
|
||||
if (!channel_tb[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) {
|
||||
hdd_err("attr channel failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].channels[j].channel =
|
||||
nla_get_u32(channel[
|
||||
channel->channel =
|
||||
nla_get_u32(channel_tb[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]);
|
||||
hdd_debug("channel %u",
|
||||
req_msg->buckets[bkt_index].channels[j].channel);
|
||||
channel->channel);
|
||||
|
||||
/* Parse and fetch dwell time */
|
||||
if (!channel[
|
||||
if (!channel_tb[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) {
|
||||
hdd_err("attr dwelltime failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs =
|
||||
nla_get_u32(channel[
|
||||
channel->dwell_time_ms =
|
||||
nla_get_u32(channel_tb[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]);
|
||||
|
||||
/* Override dwell time if required */
|
||||
if (req_msg->buckets[bkt_index].channels[j].dwellTimeMs <
|
||||
extscan_active_min_chn_time ||
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs >
|
||||
max_dwell_time_active_bucket) {
|
||||
if (channel->dwell_time_ms <
|
||||
extscan_active_min_chn_time ||
|
||||
channel->dwell_time_ms >
|
||||
max_dwell_time_active_bucket) {
|
||||
hdd_debug("WiFi band is unspecified, dwellTime:%d",
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs);
|
||||
channel->dwell_time_ms);
|
||||
|
||||
if ((wlan_reg_get_channel_state(
|
||||
hdd_ctx->pdev,
|
||||
cds_freq_to_chan(
|
||||
req_msg->buckets[bkt_index].
|
||||
channels[j].channel)))
|
||||
channel->channel)))
|
||||
!= CHANNEL_STATE_ENABLE) {
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
dwellTimeMs =
|
||||
channel->dwell_time_ms =
|
||||
max_dwell_time_passive_bucket;
|
||||
} else {
|
||||
req_msg->buckets[bkt_index].channels[j].
|
||||
dwellTimeMs =
|
||||
channel->dwell_time_ms =
|
||||
max_dwell_time_active_bucket;
|
||||
}
|
||||
}
|
||||
|
||||
hdd_debug("New Dwell time %u ms",
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs);
|
||||
channel->dwell_time_ms);
|
||||
|
||||
if ((wlan_reg_get_channel_state(hdd_ctx->pdev,
|
||||
cds_freq_to_chan(
|
||||
req_msg->buckets[bkt_index].
|
||||
channels[j].channel)))
|
||||
channel->channel)))
|
||||
!= CHANNEL_STATE_ENABLE) {
|
||||
if (min_dwell_time_passive_bucket >
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
min_dwell_time_passive_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
if (max_dwell_time_passive_bucket <
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
max_dwell_time_passive_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
} else {
|
||||
if (min_dwell_time_active_bucket >
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
min_dwell_time_active_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
if (max_dwell_time_active_bucket <
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs) {
|
||||
channel->dwell_time_ms) {
|
||||
max_dwell_time_active_bucket =
|
||||
req_msg->buckets[bkt_index].channels[j].dwellTimeMs;
|
||||
channel->dwell_time_ms;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse and fetch channel spec passive */
|
||||
if (!channel[
|
||||
if (!channel_tb[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) {
|
||||
hdd_err("attr channel spec passive failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
req_msg->buckets[bkt_index].channels[j].passive =
|
||||
nla_get_u8(channel[
|
||||
channel->passive =
|
||||
nla_get_u8(channel_tb[
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]);
|
||||
hdd_debug("Chnl spec passive %u",
|
||||
req_msg->buckets[bkt_index].channels[j].passive);
|
||||
channel->passive);
|
||||
/* Override scan type if required */
|
||||
if ((wlan_reg_get_channel_state(hdd_ctx->pdev,
|
||||
cds_freq_to_chan(
|
||||
req_msg->buckets[bkt_index].
|
||||
channels[j].channel)))
|
||||
channel->channel)))
|
||||
!= CHANNEL_STATE_ENABLE) {
|
||||
req_msg->buckets[bkt_index].channels[j].passive = true;
|
||||
channel->passive = true;
|
||||
} else {
|
||||
req_msg->buckets[bkt_index].channels[j].passive = false;
|
||||
channel->passive = false;
|
||||
}
|
||||
j++;
|
||||
total_channels++;
|
||||
bucket->num_channels++;
|
||||
}
|
||||
|
||||
if (j != req_msg->buckets[bkt_index].numChannels) {
|
||||
hdd_err("Input parameters didn't match");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (bucket->num_channels != expected_channels)
|
||||
hdd_warn("channels: Expected %u got %u",
|
||||
expected_channels,
|
||||
bucket->num_channels);
|
||||
|
||||
hdd_extscan_update_dwell_time_limits(
|
||||
req_msg, bkt_index,
|
||||
|
|
@ -2989,13 +2982,13 @@ static int hdd_extscan_start_fill_bucket_channel_spec(
|
|||
|
||||
hdd_debug("bktIndex:%d actv_min:%d actv_max:%d pass_min:%d pass_max:%d",
|
||||
bkt_index,
|
||||
req_msg->buckets[bkt_index].min_dwell_time_active,
|
||||
req_msg->buckets[bkt_index].max_dwell_time_active,
|
||||
req_msg->buckets[bkt_index].min_dwell_time_passive,
|
||||
req_msg->buckets[bkt_index].max_dwell_time_passive);
|
||||
bucket->min_dwell_time_active,
|
||||
bucket->max_dwell_time_active,
|
||||
bucket->min_dwell_time_passive,
|
||||
bucket->max_dwell_time_passive);
|
||||
|
||||
bkt_index++;
|
||||
req_msg->numBuckets++;
|
||||
req_msg->num_buckets++;
|
||||
}
|
||||
|
||||
hdd_debug("Global: actv_min:%d actv_max:%d pass_min:%d pass_max:%d",
|
||||
|
|
@ -3031,20 +3024,6 @@ static uint32_t hdd_extscan_map_usr_drv_config_flags(uint32_t config_flags)
|
|||
*/
|
||||
#define PARAM_MAX \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
|
||||
#define PARAM_REQUEST_ID \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID
|
||||
#define PARAM_BASE_PERIOD \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD
|
||||
#define PARAM_MAX_AP_PER_SCAN \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN
|
||||
#define PARAM_RPT_THRHLD_PERCENT \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT
|
||||
#define PARAM_RPT_THRHLD_NUM_SCANS \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS
|
||||
#define PARAM_NUM_BUCKETS \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS
|
||||
#define PARAM_CONFIG_FLAGS \
|
||||
QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS
|
||||
|
||||
/**
|
||||
* __wlan_hdd_cfg80211_extscan_start() - ext scan start
|
||||
|
|
@ -3057,19 +3036,19 @@ static uint32_t hdd_extscan_map_usr_drv_config_flags(uint32_t config_flags)
|
|||
*/
|
||||
static int
|
||||
__wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
const void *data,
|
||||
int data_len)
|
||||
struct wireless_dev *wdev,
|
||||
const void *data,
|
||||
int data_len)
|
||||
{
|
||||
tpSirWifiScanCmdReqParams pReqMsg;
|
||||
struct wifi_scan_cmd_req_params *params;
|
||||
struct net_device *dev = wdev->netdev;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
||||
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
|
||||
struct nlattr *tb[PARAM_MAX + 1];
|
||||
struct hdd_ext_scan_context *context;
|
||||
uint32_t request_id, num_buckets;
|
||||
uint32_t num_buckets;
|
||||
QDF_STATUS status;
|
||||
int retval;
|
||||
int retval, id;
|
||||
unsigned long rc;
|
||||
|
||||
hdd_enter_dev(dev);
|
||||
|
|
@ -3098,106 +3077,119 @@ __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
pReqMsg = qdf_mem_malloc(sizeof(*pReqMsg));
|
||||
if (!pReqMsg) {
|
||||
hdd_err("memory allocation failed");
|
||||
params = qdf_mem_malloc(sizeof(*params));
|
||||
if (!params)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* assume the worst until proven otherwise */
|
||||
retval = -EINVAL;
|
||||
|
||||
/* Parse and fetch request Id */
|
||||
if (!tb[PARAM_REQUEST_ID]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr request id failed");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pReqMsg->requestId = nla_get_u32(tb[PARAM_REQUEST_ID]);
|
||||
pReqMsg->sessionId = adapter->session_id;
|
||||
params->request_id = nla_get_u32(tb[id]);
|
||||
params->vdev_id = adapter->session_id;
|
||||
|
||||
/* Parse and fetch base period */
|
||||
if (!tb[PARAM_BASE_PERIOD]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr base period failed");
|
||||
goto fail;
|
||||
}
|
||||
pReqMsg->basePeriod = nla_get_u32(tb[PARAM_BASE_PERIOD]);
|
||||
params->base_period = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch max AP per scan */
|
||||
if (!tb[PARAM_MAX_AP_PER_SCAN]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr max_ap_per_scan failed");
|
||||
goto fail;
|
||||
}
|
||||
pReqMsg->maxAPperScan = nla_get_u32(tb[PARAM_MAX_AP_PER_SCAN]);
|
||||
params->max_ap_per_scan = nla_get_u32(tb[id]);
|
||||
|
||||
/* Parse and fetch report threshold percent */
|
||||
if (!tb[PARAM_RPT_THRHLD_PERCENT]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr report_threshold percent failed");
|
||||
goto fail;
|
||||
}
|
||||
pReqMsg->report_threshold_percent = nla_get_u8(tb[PARAM_RPT_THRHLD_PERCENT]);
|
||||
params->report_threshold_percent = nla_get_u8(tb[id]);
|
||||
|
||||
/* Parse and fetch report threshold num scans */
|
||||
if (!tb[PARAM_RPT_THRHLD_NUM_SCANS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr report_threshold num scans failed");
|
||||
goto fail;
|
||||
}
|
||||
pReqMsg->report_threshold_num_scans = nla_get_u8(tb[PARAM_RPT_THRHLD_NUM_SCANS]);
|
||||
hdd_debug("Req Id: %d Session Id: %d Base Period: %d Max AP per Scan: %d Report Threshold percent: %d Report Threshold num scans: %d",
|
||||
pReqMsg->requestId, pReqMsg->sessionId,
|
||||
pReqMsg->basePeriod, pReqMsg->maxAPperScan,
|
||||
pReqMsg->report_threshold_percent,
|
||||
pReqMsg->report_threshold_num_scans);
|
||||
params->report_threshold_num_scans = nla_get_u8(tb[id]);
|
||||
hdd_debug("Req Id: %d Vdev Id: %d Base Period: %d Max AP per Scan: %d Report Threshold percent: %d Report Threshold num scans: %d",
|
||||
params->request_id, params->vdev_id,
|
||||
params->base_period, params->max_ap_per_scan,
|
||||
params->report_threshold_percent,
|
||||
params->report_threshold_num_scans);
|
||||
|
||||
/* Parse and fetch number of buckets */
|
||||
if (!tb[PARAM_NUM_BUCKETS]) {
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr number of buckets failed");
|
||||
goto fail;
|
||||
}
|
||||
num_buckets = nla_get_u8(tb[PARAM_NUM_BUCKETS]);
|
||||
if (num_buckets > WLAN_EXTSCAN_MAX_BUCKETS) {
|
||||
num_buckets = nla_get_u8(tb[id]);
|
||||
|
||||
if (num_buckets > WMI_WLAN_EXTSCAN_MAX_BUCKETS) {
|
||||
hdd_warn("Exceeded MAX number of buckets: %d",
|
||||
WLAN_EXTSCAN_MAX_BUCKETS);
|
||||
num_buckets = WLAN_EXTSCAN_MAX_BUCKETS;
|
||||
WMI_WLAN_EXTSCAN_MAX_BUCKETS);
|
||||
num_buckets = WMI_WLAN_EXTSCAN_MAX_BUCKETS;
|
||||
}
|
||||
hdd_debug("Input: Number of Buckets %d", num_buckets);
|
||||
pReqMsg->numBuckets = num_buckets;
|
||||
params->num_buckets = num_buckets;
|
||||
|
||||
/* This is optional attribute, if not present set it to 0 */
|
||||
if (!tb[PARAM_CONFIG_FLAGS])
|
||||
pReqMsg->configuration_flags = 0;
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS;
|
||||
if (!tb[id])
|
||||
params->configuration_flags = 0;
|
||||
else
|
||||
pReqMsg->configuration_flags =
|
||||
params->configuration_flags =
|
||||
hdd_extscan_map_usr_drv_config_flags(
|
||||
nla_get_u32(tb[PARAM_CONFIG_FLAGS]));
|
||||
nla_get_u32(tb[id]));
|
||||
|
||||
pReqMsg->extscan_adaptive_dwell_mode =
|
||||
params->extscan_adaptive_dwell_mode =
|
||||
hdd_ctx->config->extscan_adaptive_dwell_mode;
|
||||
|
||||
hdd_debug("Configuration flags: %u",
|
||||
pReqMsg->configuration_flags);
|
||||
params->configuration_flags);
|
||||
|
||||
if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) {
|
||||
/* Parse and fetch number the array of buckets */
|
||||
id = QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC;
|
||||
if (!tb[id]) {
|
||||
hdd_err("attr bucket spec failed");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (hdd_extscan_start_fill_bucket_channel_spec(hdd_ctx, pReqMsg, tb))
|
||||
retval = hdd_extscan_start_fill_bucket_channel_spec(hdd_ctx, params,
|
||||
tb[id]);
|
||||
if (retval)
|
||||
goto fail;
|
||||
|
||||
context = &ext_scan_context;
|
||||
spin_lock(&context->context_lock);
|
||||
INIT_COMPLETION(context->response_event);
|
||||
context->request_id = request_id = pReqMsg->requestId;
|
||||
context->request_id = params->request_id;
|
||||
context->buckets_scanned = 0;
|
||||
spin_unlock(&context->context_lock);
|
||||
|
||||
status = sme_ext_scan_start(hdd_ctx->mac_handle, pReqMsg);
|
||||
status = sme_ext_scan_start(hdd_ctx->mac_handle, params);
|
||||
if (!QDF_IS_STATUS_SUCCESS(status)) {
|
||||
hdd_err("sme_ext_scan_start failed(err=%d)", status);
|
||||
retval = qdf_status_to_os_return(status);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hdd_ctx->ext_scan_start_since_boot = qdf_get_monotonic_boottime();
|
||||
hdd_debug("Timestamp since boot: %llu",
|
||||
hdd_ctx->ext_scan_start_since_boot);
|
||||
hdd_ctx->ext_scan_start_since_boot);
|
||||
|
||||
/* request was sent -- wait for the response */
|
||||
rc = wait_for_completion_timeout(&context->response_event,
|
||||
|
|
@ -3208,31 +3200,18 @@ __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
|
|||
retval = -ETIMEDOUT;
|
||||
} else {
|
||||
spin_lock(&context->context_lock);
|
||||
if (context->request_id == request_id)
|
||||
if (context->request_id == params->request_id)
|
||||
retval = context->response_status;
|
||||
else
|
||||
retval = -EINVAL;
|
||||
spin_unlock(&context->context_lock);
|
||||
}
|
||||
hdd_exit();
|
||||
return retval;
|
||||
|
||||
fail:
|
||||
qdf_mem_free(pReqMsg);
|
||||
return -EINVAL;
|
||||
qdf_mem_free(params);
|
||||
return retval;
|
||||
}
|
||||
/*
|
||||
* done with short names for the global vendor params
|
||||
* used by __wlan_hdd_cfg80211_extscan_start()
|
||||
*/
|
||||
#undef PARAM_MAX
|
||||
#undef PARAM_REQUEST_ID
|
||||
#undef PARAM_BASE_PERIOD
|
||||
#undef PARAMS_MAX_AP_PER_SCAN
|
||||
#undef PARAMS_RPT_THRHLD_PERCENT
|
||||
#undef PARAMS_RPT_THRHLD_NUM_SCANS
|
||||
#undef PARAMS_NUM_BUCKETS
|
||||
#undef PARAM_CONFIG_FLAGS
|
||||
|
||||
/**
|
||||
* wlan_hdd_cfg80211_extscan_start() - start extscan
|
||||
|
|
@ -3244,8 +3223,8 @@ fail:
|
|||
* Return: 0 on success, negative errno on failure
|
||||
*/
|
||||
int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy,
|
||||
struct wireless_dev *wdev,
|
||||
const void *data, int data_len)
|
||||
struct wireless_dev *wdev,
|
||||
const void *data, int data_len)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -4036,8 +4036,8 @@ struct extscan_cached_scan_results {
|
|||
* 1 - still more fragment(s) coming
|
||||
* @ap: bssid info
|
||||
*
|
||||
* Reported when each probe response is received, if reportEvents
|
||||
* enabled in tSirWifiScanCmdReqParams
|
||||
* Reported when each probe response is received, if report_events
|
||||
* enabled in struct wifi_scan_cmd_req_params
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t requestId;
|
||||
|
|
@ -4064,105 +4064,6 @@ struct pno_match_found {
|
|||
tSirWifiScanResult ap[];
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* Frequency in MHz */
|
||||
uint32_t channel;
|
||||
|
||||
uint32_t dwellTimeMs;
|
||||
|
||||
/* 0 => active
|
||||
1 => passive scan; ignored for DFS */
|
||||
bool passive;
|
||||
|
||||
uint8_t chnlClass;
|
||||
} tSirWifiScanChannelSpec, *tpSirWifiScanChannelSpec;
|
||||
|
||||
/**
|
||||
* struct tSirWifiScanBucketSpec - wifi scan bucket spec
|
||||
* @bucket: bucket identifier
|
||||
* @band: wifi band
|
||||
* @period: Desired period, in millisecond; if this is too
|
||||
* low, the firmware should choose to generate results as fast as
|
||||
* it can instead of failing the command byte
|
||||
* for exponential backoff bucket this is the min_period
|
||||
* @reportEvents: 0 => normal reporting (reporting rssi history
|
||||
* only, when rssi history buffer is % full)
|
||||
* 1 => same as 0 + report a scan completion event after scanning
|
||||
* this bucket
|
||||
* 2 => same as 1 + forward scan results
|
||||
* (beacons/probe responses + IEs) in real time to HAL
|
||||
* @max_period: if max_period is non zero or different than period,
|
||||
* then this bucket is an exponential backoff bucket and
|
||||
* the scan period will grow exponentially as per formula:
|
||||
* actual_period(N) = period ^ (N/(step_count+1)) to a
|
||||
* maximum period of max_period
|
||||
* @exponent: for exponential back off bucket: multiplier:
|
||||
* new_period = old_period * exponent
|
||||
* @step_count: for exponential back off bucket, number of scans performed
|
||||
* at a given period and until the exponent is applied
|
||||
* @numChannels: channels to scan; these may include DFS channels
|
||||
* Note that a given channel may appear in multiple buckets
|
||||
* @min_dwell_time_active: per bucket minimum active dwell time
|
||||
* @max_dwell_time_active: per bucket maximum active dwell time
|
||||
* @min_dwell_time_passive: per bucket minimum passive dwell time
|
||||
* @max_dwell_time_passive: per bucket maximum passive dwell time
|
||||
* @channels: Channel list
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t bucket;
|
||||
tWifiBand band;
|
||||
uint32_t period;
|
||||
uint32_t reportEvents;
|
||||
uint32_t max_period;
|
||||
uint32_t exponent;
|
||||
uint32_t step_count;
|
||||
uint32_t numChannels;
|
||||
|
||||
uint32_t min_dwell_time_active;
|
||||
uint32_t max_dwell_time_active;
|
||||
uint32_t min_dwell_time_passive;
|
||||
uint32_t max_dwell_time_passive;
|
||||
tSirWifiScanChannelSpec channels[WLAN_EXTSCAN_MAX_CHANNELS];
|
||||
} tSirWifiScanBucketSpec, *tpSirWifiScanBucketSpec;
|
||||
|
||||
/**
|
||||
* struct tSirWifiScanCmdReqParams - wifi scan command request params
|
||||
* @basePeriod: base timer period
|
||||
* @maxAPperScan: max ap per scan
|
||||
* @report_threshold_percent: report threshold
|
||||
* in %, when buffer is this much full, wake up host
|
||||
* @report_threshold_num_scans: report threshold number of scans
|
||||
* in number of scans, wake up host after these many scans
|
||||
* @requestId: request id
|
||||
* @sessionId: session id
|
||||
* @numBuckets: number of buckets
|
||||
* @min_dwell_time_active: per bucket minimum active dwell time
|
||||
* @max_dwell_time_active: per bucket maximum active dwell time
|
||||
* @min_dwell_time_passive: per bucket minimum passive dwell time
|
||||
* @max_dwell_time_passive: per bucket maximum passive dwell time
|
||||
* @configuration_flags: configuration flags
|
||||
* @buckets: buckets array
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t basePeriod;
|
||||
uint32_t maxAPperScan;
|
||||
|
||||
uint32_t report_threshold_percent;
|
||||
uint32_t report_threshold_num_scans;
|
||||
|
||||
uint32_t requestId;
|
||||
uint8_t sessionId;
|
||||
uint32_t numBuckets;
|
||||
|
||||
uint32_t min_dwell_time_active;
|
||||
uint32_t max_dwell_time_active;
|
||||
uint32_t min_dwell_time_passive;
|
||||
uint32_t max_dwell_time_passive;
|
||||
uint32_t configuration_flags;
|
||||
enum scan_dwelltime_adaptive_mode extscan_adaptive_dwell_mode;
|
||||
tSirWifiScanBucketSpec buckets[WLAN_EXTSCAN_MAX_BUCKETS];
|
||||
} tSirWifiScanCmdReqParams, *tpSirWifiScanCmdReqParams;
|
||||
|
||||
/**
|
||||
* struct sir_extscan_generic_response -
|
||||
* Generic ExtScan Response structure
|
||||
|
|
|
|||
|
|
@ -1017,8 +1017,17 @@ QDF_STATUS
|
|||
sme_ext_scan_get_capabilities(mac_handle_t mac_handle,
|
||||
struct extscan_capabilities_params *params);
|
||||
|
||||
QDF_STATUS sme_ext_scan_start(tHalHandle hHal,
|
||||
tSirWifiScanCmdReqParams *pStartCmd);
|
||||
/**
|
||||
* sme_ext_scan_start() - SME API to issue extscan start
|
||||
* @mac_handle: Opaque handle to the MAC context
|
||||
* @params: extscan start structure
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS
|
||||
sme_ext_scan_start(mac_handle_t mac_handle,
|
||||
struct wifi_scan_cmd_req_params *params);
|
||||
|
||||
QDF_STATUS sme_ext_scan_stop(tHalHandle hHal,
|
||||
tSirExtScanStopReqParams *pStopReq);
|
||||
|
||||
|
|
|
|||
|
|
@ -11101,37 +11101,38 @@ sme_ext_scan_get_capabilities(mac_handle_t mac_handle,
|
|||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* sme_ext_scan_start() -
|
||||
* SME API to issue extscan start
|
||||
*
|
||||
* hHal
|
||||
* pStartCmd: extscan start structure
|
||||
* Return QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS sme_ext_scan_start(tHalHandle hHal,
|
||||
tSirWifiScanCmdReqParams *pStartCmd)
|
||||
QDF_STATUS
|
||||
sme_ext_scan_start(mac_handle_t mac_handle,
|
||||
struct wifi_scan_cmd_req_params *params)
|
||||
{
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
|
||||
tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
|
||||
QDF_STATUS status;
|
||||
tpAniSirGlobal mac = MAC_CONTEXT(mac_handle);
|
||||
struct scheduler_msg message = {0};
|
||||
struct wifi_scan_cmd_req_params *bodyptr;
|
||||
|
||||
status = sme_acquire_global_lock(&pMac->sme);
|
||||
/* per contract must make a copy of the params when messaging */
|
||||
bodyptr = qdf_mem_malloc(sizeof(*bodyptr));
|
||||
if (!bodyptr)
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
*bodyptr = *params;
|
||||
|
||||
status = sme_acquire_global_lock(&mac->sme);
|
||||
if (QDF_IS_STATUS_SUCCESS(status)) {
|
||||
/* Serialize the req through MC thread */
|
||||
message.bodyptr = pStartCmd;
|
||||
message.bodyptr = bodyptr;
|
||||
message.type = WMA_EXTSCAN_START_REQ;
|
||||
MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
|
||||
NO_SESSION, message.type));
|
||||
qdf_status = scheduler_post_message(QDF_MODULE_ID_SME,
|
||||
QDF_MODULE_ID_WMA,
|
||||
QDF_MODULE_ID_WMA,
|
||||
&message);
|
||||
if (!QDF_IS_STATUS_SUCCESS(qdf_status))
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG,
|
||||
NO_SESSION, message.type);
|
||||
status = scheduler_post_message(QDF_MODULE_ID_SME,
|
||||
QDF_MODULE_ID_WMA,
|
||||
QDF_MODULE_ID_WMA,
|
||||
&message);
|
||||
sme_release_global_lock(&mac->sme);
|
||||
}
|
||||
|
||||
sme_release_global_lock(&pMac->sme);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
sme_err("failure: %d", status);
|
||||
qdf_mem_free(bodyptr);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ struct index_vht_data_rate_type {
|
|||
uint16_t ht80_rate[2];
|
||||
};
|
||||
|
||||
struct tSirWifiScanCmdReqParams;
|
||||
struct wifi_scan_cmd_req_params;
|
||||
/*
|
||||
* wma_main.c functions declarations
|
||||
*/
|
||||
|
|
@ -356,8 +356,17 @@ int wma_extscan_wow_event_callback(void *handle, void *event, uint32_t len);
|
|||
|
||||
void wma_register_extscan_event_handler(tp_wma_handle wma_handle);
|
||||
|
||||
/**
|
||||
* wma_start_extscan() - start extscan command to fw.
|
||||
* @wma: wma handle
|
||||
* @params: extscan command request params
|
||||
*
|
||||
* This function sends start extscan request to fw.
|
||||
*
|
||||
* Return: QDF Status.
|
||||
*/
|
||||
QDF_STATUS wma_start_extscan(tp_wma_handle wma,
|
||||
tSirWifiScanCmdReqParams *pstart);
|
||||
struct wifi_scan_cmd_req_params *pstart);
|
||||
|
||||
QDF_STATUS wma_stop_extscan(tp_wma_handle wma,
|
||||
tSirExtScanStopReqParams *pstopcmd);
|
||||
|
|
|
|||
|
|
@ -8182,8 +8182,7 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
|
|||
#endif /* WLAN_FEATURE_EXTWOW_SUPPORT */
|
||||
#ifdef FEATURE_WLAN_EXTSCAN
|
||||
case WMA_EXTSCAN_START_REQ:
|
||||
wma_start_extscan(wma_handle,
|
||||
(tSirWifiScanCmdReqParams *) msg->bodyptr);
|
||||
wma_start_extscan(wma_handle, msg->bodyptr);
|
||||
qdf_mem_free(msg->bodyptr);
|
||||
break;
|
||||
case WMA_EXTSCAN_STOP_REQ:
|
||||
|
|
|
|||
|
|
@ -4474,92 +4474,29 @@ int wma_passpoint_match_event_handler(void *handle,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* wma_start_extscan() - start extscan command to fw.
|
||||
* @handle: wma handle
|
||||
* @pstart: scan command request params
|
||||
*
|
||||
* This function sends start extscan request to fw.
|
||||
*
|
||||
* Return: QDF Status.
|
||||
*/
|
||||
QDF_STATUS wma_start_extscan(tp_wma_handle wma,
|
||||
tSirWifiScanCmdReqParams *pstart)
|
||||
struct wifi_scan_cmd_req_params *params)
|
||||
{
|
||||
struct wifi_scan_cmd_req_params *params;
|
||||
int i, j;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!wma || !wma->wmi_handle) {
|
||||
WMA_LOGE("%s: WMA is closed,can not issue extscan cmd",
|
||||
__func__);
|
||||
wma_err("WMA is closed, can not issue cmd");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
if (!wmi_service_enabled(wma->wmi_handle,
|
||||
wmi_service_extscan)) {
|
||||
WMA_LOGE("%s: extscan feature bit not enabled", __func__);
|
||||
if (!wmi_service_enabled(wma->wmi_handle, wmi_service_extscan)) {
|
||||
wma_err("extscan not enabled");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
params = qdf_mem_malloc(sizeof(struct wifi_scan_cmd_req_params));
|
||||
if (!params)
|
||||
wma_err("NULL param");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
||||
params->base_period = pstart->basePeriod;
|
||||
params->max_ap_per_scan = pstart->maxAPperScan;
|
||||
params->report_threshold_percent = pstart->report_threshold_percent;
|
||||
params->report_threshold_num_scans = pstart->report_threshold_num_scans;
|
||||
params->request_id = pstart->requestId;
|
||||
params->vdev_id = pstart->sessionId;
|
||||
params->num_buckets = pstart->numBuckets;
|
||||
params->min_dwell_time_active = pstart->min_dwell_time_active;
|
||||
params->min_dwell_time_passive = pstart->min_dwell_time_passive;
|
||||
params->max_dwell_time_active = pstart->max_dwell_time_active;
|
||||
params->max_dwell_time_passive = pstart->max_dwell_time_passive;
|
||||
params->configuration_flags = pstart->configuration_flags;
|
||||
params->extscan_adaptive_dwell_mode =
|
||||
pstart->extscan_adaptive_dwell_mode;
|
||||
for (i = 0; i < WMI_WLAN_EXTSCAN_MAX_BUCKETS; i++) {
|
||||
params->buckets[i].bucket = pstart->buckets[i].bucket;
|
||||
params->buckets[i].band =
|
||||
(enum wmi_wifi_band) pstart->buckets[i].band;
|
||||
params->buckets[i].period = pstart->buckets[i].period;
|
||||
params->buckets[i].report_events =
|
||||
pstart->buckets[i].reportEvents;
|
||||
params->buckets[i].max_period = pstart->buckets[i].max_period;
|
||||
params->buckets[i].exponent = pstart->buckets[i].exponent;
|
||||
params->buckets[i].step_count = pstart->buckets[i].step_count;
|
||||
params->buckets[i].num_channels =
|
||||
pstart->buckets[i].numChannels;
|
||||
params->buckets[i].min_dwell_time_active =
|
||||
pstart->buckets[i].min_dwell_time_active;
|
||||
params->buckets[i].min_dwell_time_passive =
|
||||
pstart->buckets[i].min_dwell_time_passive;
|
||||
params->buckets[i].max_dwell_time_active =
|
||||
pstart->buckets[i].max_dwell_time_active;
|
||||
params->buckets[i].max_dwell_time_passive =
|
||||
pstart->buckets[i].max_dwell_time_passive;
|
||||
for (j = 0; j < WLAN_EXTSCAN_MAX_CHANNELS; j++) {
|
||||
params->buckets[i].channels[j].channel =
|
||||
pstart->buckets[i].channels[j].channel;
|
||||
params->buckets[i].channels[j].dwell_time_ms =
|
||||
pstart->buckets[i].channels[j].dwellTimeMs;
|
||||
params->buckets[i].channels[j].passive =
|
||||
pstart->buckets[i].channels[j].passive;
|
||||
params->buckets[i].channels[j].channel_class =
|
||||
pstart->buckets[i].channels[j].chnlClass;
|
||||
}
|
||||
}
|
||||
status = wmi_unified_start_extscan_cmd(wma->wmi_handle, params);
|
||||
if (QDF_IS_STATUS_SUCCESS(status))
|
||||
wma->interfaces[params->vdev_id].extscan_in_progress = true;
|
||||
|
||||
status = wmi_unified_start_extscan_cmd(wma->wmi_handle,
|
||||
params);
|
||||
qdf_mem_free(params);
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
return status;
|
||||
|
||||
wma->interfaces[pstart->sessionId].extscan_in_progress = true;
|
||||
WMA_LOGD("Extscan start request sent successfully for vdev %d",
|
||||
pstart->sessionId);
|
||||
wma_debug("Exit, vdev %d, status %d", params->vdev_id, status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue