qcacld-3.0: Decouple get channel command from extscan

Currently get valid channel vandor command is defined
under EXTSCAN feature and also depends on gExtScanEnable
ini. when Extscan feature is disabled by ini or by feature
flag this command doesn't work.

As this command is to get the valid channel list, this
should not depend on extscan feature.

To address above issue, decouple get valid channel command
from extscan feature.

Change-Id: I6496cb94e6330f071f8027607e7d55a8f5d3db8a
CRs-Fixed: 2518313
This commit is contained in:
Ashish Kumar Dhanotiya 2019-09-06 15:42:05 +05:30 committed by nshrivas
parent 4aab29f4ad
commit 1a720e76ee
7 changed files with 365 additions and 343 deletions

View File

@ -13011,6 +13011,252 @@ int wlan_hdd_send_mode_change_event(void)
return err;
}
/* Short name for QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS command */
#define EXTSCAN_CONFIG_MAX \
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
#define EXTSCAN_CONFIG_REQUEST_ID \
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID
#define EXTSCAN_CONFIG_WIFI_BAND \
QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND
#define ETCAN_CONFIG_MAX_CHANNELS \
QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS
#define EXTSCAN_RESULTS_NUM_CHANNELS \
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS
#define EXTSCAN_RESULTS_CHANNELS \
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS
/**
* hdd_remove_dsrc_channels () - remove dsrc chanels
* @hdd_ctx: hdd context
* @wiphy: Pointer to wireless phy
* @chan_list: channel list
* @num_channels: number of channels
*
* Return: none
*/
static void hdd_remove_dsrc_channels(struct hdd_context *hdd_ctx,
struct wiphy *wiphy, uint32_t *chan_list,
uint8_t *num_channels)
{
uint8_t num_chan_temp = 0;
int i;
for (i = 0; i < *num_channels; i++) {
if (!wlan_reg_is_dsrc_chan(hdd_ctx->pdev,
wlan_reg_freq_to_chan(
hdd_ctx->pdev,
chan_list[i]))) {
chan_list[num_chan_temp] = chan_list[i];
num_chan_temp++;
}
}
*num_channels = num_chan_temp;
}
/**
* hdd_remove_passive_channels () - remove passive channels
* @wiphy: Pointer to wireless phy
* @chan_list: channel list
* @num_channels: number of channels
*
* Return: none
*/
static void hdd_remove_passive_channels(struct wiphy *wiphy,
uint32_t *chan_list,
uint8_t *num_channels)
{
uint8_t num_chan_temp = 0;
int i, j, k;
for (i = 0; i < *num_channels; i++)
for (j = 0; j < HDD_NUM_NL80211_BANDS; j++) {
if (!wiphy->bands[j])
continue;
for (k = 0; k < wiphy->bands[j]->n_channels; k++) {
if ((chan_list[i] ==
wiphy->bands[j]->channels[k].center_freq)
&& (!(wiphy->bands[j]->channels[k].flags &
IEEE80211_CHAN_PASSIVE_SCAN))
) {
chan_list[num_chan_temp] = chan_list[i];
num_chan_temp++;
}
}
}
*num_channels = num_chan_temp;
}
/**
* __wlan_hdd_cfg80211_extscan_get_valid_channels () - get valid channels
* @wiphy: Pointer to wireless phy
* @wdev: Pointer to wireless device
* @data: Pointer to data
* @data_len: Data length
*
* Return: none
*/
static int
__wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len)
{
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
struct net_device *dev = wdev->netdev;
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
uint32_t chan_list[CFG_VALID_CHANNEL_LIST_LEN] = {0};
uint8_t num_channels = 0, i, buf[256] = {0};
struct nlattr *tb[EXTSCAN_CONFIG_MAX +
1];
uint32_t requestId, maxChannels;
tWifiBand wifi_band;
QDF_STATUS status;
struct sk_buff *reply_skb;
int ret, len = 0;
/* ENTER_DEV() intentionally not used in a frequently invoked API */
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return -EINVAL;
if (wlan_cfg80211_nla_parse(
tb,
EXTSCAN_CONFIG_MAX,
data, data_len, wlan_hdd_extscan_config_policy)) {
hdd_err("Invalid ATTR");
return -EINVAL;
}
/* Parse and fetch request Id */
if (!tb[EXTSCAN_CONFIG_REQUEST_ID]) {
hdd_err("attr request id failed");
return -EINVAL;
}
requestId =
nla_get_u32(tb
[EXTSCAN_CONFIG_REQUEST_ID]);
/* Parse and fetch wifi band */
if (!tb
[EXTSCAN_CONFIG_WIFI_BAND]) {
hdd_err("attr wifi band failed");
return -EINVAL;
}
wifi_band =
nla_get_u32(tb
[EXTSCAN_CONFIG_WIFI_BAND]);
if (!tb
[ETCAN_CONFIG_MAX_CHANNELS]) {
hdd_err("attr max channels failed");
return -EINVAL;
}
maxChannels =
nla_get_u32(tb
[ETCAN_CONFIG_MAX_CHANNELS]);
if (maxChannels > CFG_VALID_CHANNEL_LIST_LEN) {
hdd_err("Max channels %d exceeded Valid channel list len %d",
maxChannels, CFG_VALID_CHANNEL_LIST_LEN);
return -EINVAL;
}
hdd_err("Req Id: %u Wifi band: %d Max channels: %d", requestId,
wifi_band, maxChannels);
status = sme_get_valid_channels_by_band(hdd_ctx->mac_handle,
wifi_band, chan_list,
&num_channels);
if (QDF_STATUS_SUCCESS != status) {
hdd_err("sme_get_valid_channels_by_band failed (err=%d)",
status);
return -EINVAL;
}
num_channels = QDF_MIN(num_channels, maxChannels);
hdd_remove_dsrc_channels(hdd_ctx, wiphy, chan_list, &num_channels);
if ((QDF_SAP_MODE == adapter->device_mode) ||
!strncmp(hdd_get_fwpath(), "ap", 2))
hdd_remove_passive_channels(wiphy, chan_list,
&num_channels);
hdd_debug("Number of channels: %d", num_channels);
for (i = 0; i < num_channels; i++)
len += scnprintf(buf + len, sizeof(buf) - len,
"%u ", chan_list[i]);
hdd_debug("Channels: %s", buf);
reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) +
sizeof(u32) *
num_channels +
NLMSG_HDRLEN);
if (reply_skb) {
if (nla_put_u32(
reply_skb,
EXTSCAN_RESULTS_NUM_CHANNELS,
num_channels) ||
nla_put(
reply_skb,
EXTSCAN_RESULTS_CHANNELS,
sizeof(u32) * num_channels, chan_list)) {
hdd_err("nla put fail");
kfree_skb(reply_skb);
return -EINVAL;
}
ret = cfg80211_vendor_cmd_reply(reply_skb);
return ret;
}
hdd_err("valid channels: buffer alloc fail");
return -EINVAL;
}
#undef EXTSCAN_CONFIG_MAX
#undef EXTSCAN_CONFIG_REQUEST_ID
#undef EXTSCAN_CONFIG_WIFI_BAND
#undef ETCAN_CONFIG_MAX_CHANNELS
#undef EXTSCAN_RESULTS_NUM_CHANNELS
#undef EXTSCAN_RESULTS_CHANNELS
/**
* wlan_hdd_cfg80211_extscan_get_valid_channels() - get ext scan valid channels
* @wiphy: Pointer to wireless phy
* @wdev: Pointer to wireless device
* @data: Pointer to data
* @data_len: Data length
*
* Return: 0 on success, negative errno on failure
*/
static int wlan_hdd_cfg80211_extscan_get_valid_channels(
struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
struct osif_psoc_sync *psoc_sync;
int errno;
errno = osif_psoc_sync_op_start(wiphy_dev(wiphy), &psoc_sync);
if (errno)
return errno;
errno = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev,
data, data_len);
osif_psoc_sync_op_stop(psoc_sync);
return errno;
}
const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
{
.info.vendor_id = QCA_NL80211_VENDOR_ID,
@ -13019,6 +13265,15 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = is_driver_dfs_capable
},
{
.info.vendor_id = QCA_NL80211_VENDOR_ID,
.info.subcmd =
QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS,
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
WIPHY_VENDOR_CMD_NEED_NETDEV |
WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = wlan_hdd_cfg80211_extscan_get_valid_channels
},
#ifdef WLAN_FEATURE_STATS_EXT
{
@ -13044,13 +13299,6 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = wlan_hdd_cfg80211_extscan_stop
},
{
.info.vendor_id = QCA_NL80211_VENDOR_ID,
.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS,
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING,
.doit = wlan_hdd_cfg80211_extscan_get_valid_channels
},
{
.info.vendor_id = QCA_NL80211_VENDOR_ID,
.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES,

View File

@ -32,8 +32,7 @@
#include "cds_sched.h"
#include <qca_vendor.h>
#include "wlan_extscan_ucfg_api.h"
#define EXTSCAN_PARAM_MAX QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
#include "wlan_hdd_scan.h"
/* amount of time to wait for a synchronous request/response operation */
#define WLAN_WAIT_TIME_EXTSCAN 1000
@ -59,86 +58,6 @@ struct hdd_ext_scan_context {
};
static struct hdd_ext_scan_context ext_scan_context;
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] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] = {
.type = NLA_U8 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = {
.type = NLA_UNSPEC,
.len = QDF_MAC_ADDR_SIZE},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = {
.type = NLA_S32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = {
.type = NLA_S32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = {
.type = NLA_BINARY,
.len = IEEE80211_MAX_SSID_LEN + 1 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] = {
.type = NLA_U32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] = {
.type = NLA_U32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] = {
.type = NLA_U8 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] = {
.type = NLA_S32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] = {
.type = NLA_S32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] = {
.type = NLA_U32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] = {
.type = NLA_U32},
};
static const struct nla_policy
wlan_hdd_pno_config_policy[QCA_WLAN_VENDOR_ATTR_PNO_MAX + 1] = {
[QCA_WLAN_VENDOR_ATTR_PNO_PASSPOINT_LIST_PARAM_NUM] = {
@ -2291,230 +2210,6 @@ int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy,
return errno;
}
/**
* hdd_remove_dsrc_channels () - remove dsrc chanels
* @hdd_ctx: hdd context
* @wiphy: Pointer to wireless phy
* @chan_list: channel list
* @num_channels: number of channels
*
* Return: none
*/
static void hdd_remove_dsrc_channels(struct hdd_context *hdd_ctx,
struct wiphy *wiphy, uint32_t *chan_list,
uint8_t *num_channels)
{
uint8_t num_chan_temp = 0;
int i;
for (i = 0; i < *num_channels; i++) {
if (!wlan_reg_is_dsrc_chan(hdd_ctx->pdev,
wlan_reg_freq_to_chan(
hdd_ctx->pdev,
chan_list[i]))) {
chan_list[num_chan_temp] = chan_list[i];
num_chan_temp++;
}
}
*num_channels = num_chan_temp;
}
/**
* hdd_remove_passive_channels () - remove passive channels
* @wiphy: Pointer to wireless phy
* @chan_list: channel list
* @num_channels: number of channels
*
* Return: none
*/
static void hdd_remove_passive_channels(struct wiphy *wiphy,
uint32_t *chan_list,
uint8_t *num_channels)
{
uint8_t num_chan_temp = 0;
int i, j, k;
for (i = 0; i < *num_channels; i++)
for (j = 0; j < HDD_NUM_NL80211_BANDS; j++) {
if (!wiphy->bands[j])
continue;
for (k = 0; k < wiphy->bands[j]->n_channels; k++) {
if ((chan_list[i] ==
wiphy->bands[j]->channels[k].center_freq)
&& (!(wiphy->bands[j]->channels[k].flags &
IEEE80211_CHAN_PASSIVE_SCAN))
) {
chan_list[num_chan_temp] = chan_list[i];
num_chan_temp++;
}
}
}
*num_channels = num_chan_temp;
}
/**
* __wlan_hdd_cfg80211_extscan_get_valid_channels () - get valid channels
* @wiphy: Pointer to wireless phy
* @wdev: Pointer to wireless device
* @data: Pointer to data
* @data_len: Data length
*
* Return: none
*/
static int
__wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len)
{
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
struct net_device *dev = wdev->netdev;
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
uint32_t chan_list[CFG_VALID_CHANNEL_LIST_LEN] = {0};
uint8_t num_channels = 0, i, buf[256] = {0};
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX +
1];
uint32_t requestId, maxChannels;
tWifiBand wifi_band;
QDF_STATUS status;
struct sk_buff *reply_skb;
int ret, len = 0;
/* ENTER_DEV() intentionally not used in a frequently invoked API */
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return -EPERM;
}
ret = wlan_hdd_validate_context(hdd_ctx);
if (0 != ret)
return -EINVAL;
if (!ucfg_extscan_get_enable(hdd_ctx->psoc)) {
hdd_err("extscan not supported");
return -ENOTSUPP;
}
if (wlan_cfg80211_nla_parse(tb,
QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX,
data, data_len, wlan_hdd_extscan_config_policy)) {
hdd_err("Invalid ATTR");
return -EINVAL;
}
/* Parse and fetch request Id */
if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) {
hdd_err("attr request id failed");
return -EINVAL;
}
requestId =
nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]);
/* Parse and fetch wifi band */
if (!tb
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) {
hdd_err("attr wifi band failed");
return -EINVAL;
}
wifi_band =
nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]);
if (!tb
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]) {
hdd_err("attr max channels failed");
return -EINVAL;
}
maxChannels =
nla_get_u32(tb
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]);
if (maxChannels > CFG_VALID_CHANNEL_LIST_LEN) {
hdd_err("Max channels %d exceeded Valid channel list len %d",
maxChannels, CFG_VALID_CHANNEL_LIST_LEN);
return -EINVAL;
}
hdd_debug("Req Id: %u Wifi band: %d Max channels: %d", requestId,
wifi_band, maxChannels);
status = sme_get_valid_channels_by_band(hdd_ctx->mac_handle,
wifi_band, chan_list,
&num_channels);
if (QDF_STATUS_SUCCESS != status) {
hdd_err("sme_get_valid_channels_by_band failed (err=%d)",
status);
return -EINVAL;
}
num_channels = QDF_MIN(num_channels, maxChannels);
hdd_remove_dsrc_channels(hdd_ctx, wiphy, chan_list, &num_channels);
if ((QDF_SAP_MODE == adapter->device_mode) ||
!strncmp(hdd_get_fwpath(), "ap", 2))
hdd_remove_passive_channels(wiphy, chan_list,
&num_channels);
hdd_debug("Number of channels: %d", num_channels);
for (i = 0; i < num_channels; i++)
len += scnprintf(buf + len, sizeof(buf) - len,
"%u ", chan_list[i]);
hdd_debug("Channels: %s", buf);
reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) +
sizeof(u32) *
num_channels +
NLMSG_HDRLEN);
if (reply_skb) {
if (nla_put_u32(reply_skb,
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS,
num_channels) ||
nla_put(reply_skb,
QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS,
sizeof(u32) * num_channels, chan_list)) {
hdd_err("nla put fail");
kfree_skb(reply_skb);
return -EINVAL;
}
ret = cfg80211_vendor_cmd_reply(reply_skb);
return ret;
}
hdd_err("valid channels: buffer alloc fail");
return -EINVAL;
}
/**
* wlan_hdd_cfg80211_extscan_get_valid_channels() - get ext scan valid channels
* @wiphy: Pointer to wireless phy
* @wdev: Pointer to wireless device
* @data: Pointer to data
* @data_len: Data length
*
* Return: 0 on success, negative errno on failure
*/
int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len)
{
struct osif_psoc_sync *psoc_sync;
int errno;
errno = osif_psoc_sync_op_start(wiphy_dev(wiphy), &psoc_sync);
if (errno)
return errno;
errno = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev,
data, data_len);
osif_psoc_sync_op_stop(psoc_sync);
return errno;
}
/**
* hdd_extscan_update_dwell_time_limits() - update dwell times
* @req_msg: Pointer to request message

View File

@ -49,11 +49,6 @@ int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len);
int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy,
struct wireless_dev
*wdev, const void *data,
int data_len);
int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int data_len);

View File

@ -30,6 +30,8 @@
#include "csr_inside_api.h"
#include <wlan_cfg80211_scan.h>
#define EXTSCAN_PARAM_MAX QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX
int hdd_scan_context_init(struct hdd_context *hdd_ctx);
void hdd_scan_context_destroy(struct hdd_context *hdd_ctx);
@ -131,5 +133,86 @@ void hdd_reset_scan_reject_params(struct hdd_context *hdd_ctx,
* Return: none
*/
void wlan_hdd_cfg80211_scan_block(struct hdd_adapter *adapter);
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] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = {.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = {.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] = {
.type = NLA_U8 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = {
.type = NLA_U8},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = {
.type = NLA_UNSPEC,
.len = QDF_MAC_ADDR_SIZE},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = {
.type = NLA_S32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = {
.type = NLA_S32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BASE] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = {
.type = NLA_U32},
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = {
.type = NLA_BINARY,
.len = IEEE80211_MAX_SSID_LEN + 1 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] = {
.type = NLA_U32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] = {
.type = NLA_U32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] = {
.type = NLA_U8 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] = {
.type = NLA_S32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] = {
.type = NLA_S32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] = {
.type = NLA_U32 },
[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] = {
.type = NLA_U32},
};
#endif /* end #if !defined(WLAN_HDD_SCAN_H) */

View File

@ -2972,6 +2972,29 @@ struct sir_wisa_params {
uint8_t vdev_id;
};
/**
* typedef enum wifi_scan_flags - wifi scan flags
* @WIFI_SCAN_FLAG_INTERRUPTED: Indicates that scan results are not complete
* because probes were not sent on some channels
*/
typedef enum {
WIFI_SCAN_FLAG_INTERRUPTED = 1,
} wifi_scan_flags;
typedef enum {
WIFI_BAND_UNSPECIFIED,
WIFI_BAND_BG = 1, /* 2.4 GHz */
WIFI_BAND_A = 2, /* 5 GHz without DFS */
WIFI_BAND_ABG = 3, /* 2.4 GHz + 5 GHz; no DFS */
WIFI_BAND_A_DFS_ONLY = 4, /* 5 GHz DFS only */
/* 5 is reserved */
WIFI_BAND_A_WITH_DFS = 6, /* 5 GHz with DFS */
WIFI_BAND_ABG_WITH_DFS = 7, /* 2.4 GHz + 5 GHz with DFS */
/* Keep it last */
WIFI_BAND_MAX
} tWifiBand;
#ifdef FEATURE_WLAN_EXTSCAN
#define WLAN_EXTSCAN_MAX_CHANNELS 36
@ -3004,29 +3027,6 @@ typedef enum {
eSIR_EXTSCAN_CALLBACK_TYPE_MAX,
} tSirExtScanCallbackType;
/**
* typedef enum wifi_scan_flags - wifi scan flags
* @WIFI_SCAN_FLAG_INTERRUPTED: Indicates that scan results are not complete
* because probes were not sent on some channels
*/
typedef enum {
WIFI_SCAN_FLAG_INTERRUPTED = 1,
} wifi_scan_flags;
typedef enum {
WIFI_BAND_UNSPECIFIED,
WIFI_BAND_BG = 1, /* 2.4 GHz */
WIFI_BAND_A = 2, /* 5 GHz without DFS */
WIFI_BAND_ABG = 3, /* 2.4 GHz + 5 GHz; no DFS */
WIFI_BAND_A_DFS_ONLY = 4, /* 5 GHz DFS only */
/* 5 is reserved */
WIFI_BAND_A_WITH_DFS = 6, /* 5 GHz with DFS */
WIFI_BAND_ABG_WITH_DFS = 7, /* 2.4 GHz + 5 GHz with DFS */
/* Keep it last */
WIFI_BAND_MAX
} tWifiBand;
/**
* enum wifi_extscan_event_type - extscan event type
* @WIFI_EXTSCAN_RESULTS_AVAILABLE: reported when REPORT_EVENTS_EACH_SCAN is set

View File

@ -1184,12 +1184,12 @@ QDF_STATUS sme_update_dfs_scan_mode(mac_handle_t mac_handle,
uint8_t allowDFSChannelRoam);
uint8_t sme_get_dfs_scan_mode(mac_handle_t mac_handle);
#ifdef FEATURE_WLAN_EXTSCAN
QDF_STATUS sme_get_valid_channels_by_band(mac_handle_t mac_handle,
uint8_t wifiBand,
uint32_t *aValidChannels,
uint8_t *pNumChannels);
#ifdef FEATURE_WLAN_EXTSCAN
/**
* sme_ext_scan_get_capabilities() - SME API to fetch extscan capabilities
* @mac_handle: Opaque handle to the MAC context

View File

@ -9798,7 +9798,6 @@ QDF_STATUS sme_abort_roam_scan(mac_handle_t mac_handle, uint8_t sessionId)
return status;
}
#ifdef FEATURE_WLAN_EXTSCAN
/**
* sme_get_valid_channels_by_band() - to fetch valid channels filtered by band
* @mac_handle: Opaque handle to the global MAC context
@ -9916,6 +9915,8 @@ QDF_STATUS sme_get_valid_channels_by_band(mac_handle_t mac_handle,
return status;
}
#ifdef FEATURE_WLAN_EXTSCAN
QDF_STATUS
sme_ext_scan_get_capabilities(mac_handle_t mac_handle,
struct extscan_capabilities_params *params)