// SPDX-License-Identifier: GPL-2.0-only /* * This file is part of wl1271 * * Copyright (C) 2009-2010 Nokia Corporation * * Contact: Luciano Coelho <luciano.coelho@nokia.com>
*/
if (unlikely(wl->state != WLCORE_STATE_ON)) goto out;
if (wl->scan.state == WL1271_SCAN_STATE_IDLE) goto out;
wlvif = wl->scan_wlvif;
/* * Rearm the tx watchdog just before idling scan. This * prevents just-finished scans from triggering the watchdog
*/
wl12xx_rearm_tx_watchdog_locked(wl);
/* * count active interfaces according to interface type. * checking only bss_conf.idle is bad for some cases, e.g. * we don't want to count sta in p2p_find as active interface.
*/ switch (wlvif->bss_type) { case BSS_TYPE_STA_BSS: if (test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
active = true; break;
case BSS_TYPE_AP_BSS: if (wlvif->wl->active_sta_count > 0)
active = true; break;
default: break;
}
if (active)
(*count)++;
}
staticint wlcore_count_started_vifs(struct wl1271 *wl)
{ int count = 0;
staticint
wlcore_scan_get_channels(struct wl1271 *wl, struct ieee80211_channel *req_channels[],
u32 n_channels,
u32 n_ssids, struct conn_scan_ch_params *channels,
u32 band, bool radar, bool passive, int start, int max_channels,
u8 *n_pactive_ch, int scan_type)
{ int i, j;
u32 flags; bool force_passive = !n_ssids;
u32 min_dwell_time_active, max_dwell_time_active;
u32 dwell_time_passive, dwell_time_dfs;
/* configure dwell times according to scan type */ if (scan_type == SCAN_TYPE_SEARCH) { struct conf_scan_settings *c = &wl->conf.scan; bool active_vif_exists = !!wlcore_count_started_vifs(wl);
/* * n_pactive_ch is counted down from the end of * the passive channel list
*/
(*n_pactive_ch)++;
wl1271_debug(DEBUG_SCAN, "n_pactive_ch = %d",
*n_pactive_ch);
}
/* we assume failure so that timeout scenarios are handled correctly */
wl->scan.failed = true;
ieee80211_queue_delayed_work(wl->hw, &wl->scan_complete_work,
msecs_to_jiffies(WL1271_SCAN_TIMEOUT));
wl->ops->scan_start(wl, wlvif, req);
return 0;
} /* Returns the scan type to be used or a negative value on error */ int
wlcore_scan_sched_scan_ssid_list(struct wl1271 *wl, struct wl12xx_vif *wlvif, struct cfg80211_sched_scan_request *req)
{ struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL; struct cfg80211_match_set *sets = req->match_sets; struct cfg80211_ssid *ssids = req->ssids; int ret = 0, type, i, j, n_match_ssids = 0;
/* count the match sets that contain SSIDs */ for (i = 0; i < req->n_match_sets; i++) if (sets[i].ssid.ssid_len > 0)
n_match_ssids++;
/* No filter, no ssids or only bcast ssid */ if (!n_match_ssids &&
(!req->n_ssids ||
(req->n_ssids == 1 && req->ssids[0].ssid_len == 0))) {
type = SCAN_SSID_FILTER_ANY; goto out;
}
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); if (!cmd) {
ret = -ENOMEM; goto out;
}
cmd->role_id = wlvif->role_id; if (!n_match_ssids) { /* No filter, with ssids */
type = SCAN_SSID_FILTER_DISABLED;
for (i = 0; i < req->n_ssids; i++) {
cmd->ssids[cmd->n_ssids].type = (ssids[i].ssid_len) ?
SCAN_SSID_TYPE_HIDDEN : SCAN_SSID_TYPE_PUBLIC;
cmd->ssids[cmd->n_ssids].len = ssids[i].ssid_len;
memcpy(cmd->ssids[cmd->n_ssids].ssid, ssids[i].ssid,
ssids[i].ssid_len);
cmd->n_ssids++;
}
} else {
type = SCAN_SSID_FILTER_LIST;
/* Add all SSIDs from the filters */ for (i = 0; i < req->n_match_sets; i++) { /* ignore sets without SSIDs */ if (!sets[i].ssid.ssid_len) continue;
cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC;
cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len;
memcpy(cmd->ssids[cmd->n_ssids].ssid,
sets[i].ssid.ssid, sets[i].ssid.ssid_len);
cmd->n_ssids++;
} if ((req->n_ssids > 1) ||
(req->n_ssids == 1 && req->ssids[0].ssid_len > 0)) { /* * Mark all the SSIDs passed in the SSID list as HIDDEN, * so they're used in probe requests.
*/ for (i = 0; i < req->n_ssids; i++) { if (!req->ssids[i].ssid_len) continue;
for (j = 0; j < cmd->n_ssids; j++) if ((req->ssids[i].ssid_len ==
cmd->ssids[j].len) &&
!memcmp(req->ssids[i].ssid,
cmd->ssids[j].ssid,
req->ssids[i].ssid_len)) {
cmd->ssids[j].type =
SCAN_SSID_TYPE_HIDDEN; break;
} /* Fail if SSID isn't present in the filters */ if (j == cmd->n_ssids) {
ret = -EINVAL; goto out_free;
}
}
}
}
ret = wl1271_cmd_send(wl, CMD_CONNECTION_SCAN_SSID_CFG, cmd, sizeof(*cmd), 0); if (ret < 0) {
wl1271_error("cmd sched scan ssid list failed"); goto out_free;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.