|
@@ -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
|