Lines 265-270
Link Here
|
265 |
struct iwm_scan_channel_cfg_lmac *chan, int n_ssids) |
265 |
struct iwm_scan_channel_cfg_lmac *chan, int n_ssids) |
266 |
{ |
266 |
{ |
267 |
struct ieee80211com *ic = &sc->sc_ic; |
267 |
struct ieee80211com *ic = &sc->sc_ic; |
|
|
268 |
struct ieee80211_scan_state *ss = ic->ic_scan; |
268 |
struct ieee80211_channel *c; |
269 |
struct ieee80211_channel *c; |
269 |
uint8_t nchan; |
270 |
uint8_t nchan; |
270 |
int j; |
271 |
int j; |
Lines 292-301
Link Here
|
292 |
chan->iter_count = htole16(1); |
293 |
chan->iter_count = htole16(1); |
293 |
chan->iter_interval = htole32(0); |
294 |
chan->iter_interval = htole32(0); |
294 |
chan->flags = htole32(IWM_UNIFIED_SCAN_CHANNEL_PARTIAL); |
295 |
chan->flags = htole32(IWM_UNIFIED_SCAN_CHANNEL_PARTIAL); |
295 |
#if 0 /* makes scanning while associated less useful */ |
296 |
chan->flags |= htole32(IWM_SCAN_CHANNEL_NSSIDS(n_ssids)); |
296 |
if (n_ssids != 0) |
297 |
/* XXX IEEE80211_SCAN_NOBCAST flag is never set. */ |
297 |
chan->flags |= htole32(1 << 1); /* select SSID 0 */ |
298 |
if (!IEEE80211_IS_CHAN_PASSIVE(c) && |
298 |
#endif |
299 |
(!(ss->ss_flags & IEEE80211_SCAN_NOBCAST) || n_ssids != 0)) |
|
|
300 |
chan->flags |= htole32(IWM_SCAN_CHANNEL_TYPE_ACTIVE); |
299 |
chan++; |
301 |
chan++; |
300 |
nchan++; |
302 |
nchan++; |
301 |
} |
303 |
} |
Lines 334-344
Link Here
|
334 |
chan->channel_num = ieee80211_mhz2ieee(c->ic_freq, 0); |
336 |
chan->channel_num = ieee80211_mhz2ieee(c->ic_freq, 0); |
335 |
chan->iter_count = 1; |
337 |
chan->iter_count = 1; |
336 |
chan->iter_interval = htole16(0); |
338 |
chan->iter_interval = htole16(0); |
337 |
chan->flags = htole32(0); |
339 |
chan->flags = htole32(IWM_SCAN_CHANNEL_UMAC_NSSIDS(n_ssids)); |
338 |
#if 0 /* makes scanning while associated less useful */ |
|
|
339 |
if (n_ssids != 0) |
340 |
chan->flags = htole32(1 << 0); /* select SSID 0 */ |
341 |
#endif |
342 |
chan++; |
340 |
chan++; |
343 |
nchan++; |
341 |
nchan++; |
344 |
} |
342 |
} |
Lines 355-367
Link Here
|
355 |
struct ieee80211_rateset *rs; |
353 |
struct ieee80211_rateset *rs; |
356 |
size_t remain = sizeof(preq->buf); |
354 |
size_t remain = sizeof(preq->buf); |
357 |
uint8_t *frm, *pos; |
355 |
uint8_t *frm, *pos; |
358 |
int ssid_len = 0; |
|
|
359 |
const uint8_t *ssid = NULL; |
360 |
|
356 |
|
361 |
memset(preq, 0, sizeof(*preq)); |
357 |
memset(preq, 0, sizeof(*preq)); |
362 |
|
358 |
|
363 |
/* Ensure enough space for header and SSID IE. */ |
359 |
/* Ensure enough space for header and SSID IE. */ |
364 |
if (remain < sizeof(*wh) + 2 + ssid_len) |
360 |
if (remain < sizeof(*wh) + 2) |
365 |
return ENOBUFS; |
361 |
return ENOBUFS; |
366 |
|
362 |
|
367 |
/* |
363 |
/* |
Lines 378-384
Link Here
|
378 |
*(uint16_t *)&wh->i_seq[0] = 0; /* filled by HW */ |
374 |
*(uint16_t *)&wh->i_seq[0] = 0; /* filled by HW */ |
379 |
|
375 |
|
380 |
frm = (uint8_t *)(wh + 1); |
376 |
frm = (uint8_t *)(wh + 1); |
381 |
frm = ieee80211_add_ssid(frm, ssid, ssid_len); |
377 |
frm = ieee80211_add_ssid(frm, NULL, 0); |
382 |
|
378 |
|
383 |
/* Tell the firmware where the MAC header is. */ |
379 |
/* Tell the firmware where the MAC header is. */ |
384 |
preq->mac_header.offset = 0; |
380 |
preq->mac_header.offset = 0; |
Lines 544-554
Link Here
|
544 |
.data = { NULL, }, |
540 |
.data = { NULL, }, |
545 |
.flags = IWM_CMD_SYNC, |
541 |
.flags = IWM_CMD_SYNC, |
546 |
}; |
542 |
}; |
|
|
543 |
struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; |
547 |
struct iwm_scan_req_umac *req; |
544 |
struct iwm_scan_req_umac *req; |
548 |
struct iwm_scan_req_umac_tail *tail; |
545 |
struct iwm_scan_req_umac_tail *tail; |
549 |
size_t req_len; |
546 |
size_t req_len; |
550 |
int ssid_len = 0; |
547 |
uint8_t i, nssid; |
551 |
const uint8_t *ssid = NULL; |
|
|
552 |
int ret; |
548 |
int ret; |
553 |
|
549 |
|
554 |
req_len = sizeof(struct iwm_scan_req_umac) + |
550 |
req_len = sizeof(struct iwm_scan_req_umac) + |
Lines 577-584
Link Here
|
577 |
req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); |
573 |
req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); |
578 |
req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH); |
574 |
req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH); |
579 |
|
575 |
|
|
|
576 |
nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); |
580 |
req->n_channels = iwm_mvm_umac_scan_fill_channels(sc, |
577 |
req->n_channels = iwm_mvm_umac_scan_fill_channels(sc, |
581 |
(struct iwm_scan_channel_cfg_umac *)req->data, ssid_len != 0); |
578 |
(struct iwm_scan_channel_cfg_umac *)req->data, nssid); |
582 |
|
579 |
|
583 |
req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | |
580 |
req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | |
584 |
IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE | |
581 |
IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE | |
Lines 589-603
Link Here
|
589 |
sc->sc_capa_n_scan_channels); |
586 |
sc->sc_capa_n_scan_channels); |
590 |
|
587 |
|
591 |
/* Check if we're doing an active directed scan. */ |
588 |
/* Check if we're doing an active directed scan. */ |
592 |
if (ssid_len != 0) { |
589 |
for (i = 0; i < nssid; i++) { |
593 |
tail->direct_scan[0].id = IEEE80211_ELEMID_SSID; |
590 |
tail->direct_scan[i].id = IEEE80211_ELEMID_SSID; |
594 |
tail->direct_scan[0].len = ssid_len; |
591 |
tail->direct_scan[i].len = MIN(ss->ss_ssid[i].len, |
595 |
memcpy(tail->direct_scan[0].ssid, ssid, ssid_len); |
592 |
IEEE80211_NWID_LEN); |
|
|
593 |
memcpy(tail->direct_scan[i].ssid, ss->ss_ssid[i].ssid, |
594 |
tail->direct_scan[i].len); |
595 |
/* XXX debug */ |
596 |
} |
597 |
if (nssid != 0) { |
596 |
req->general_flags |= |
598 |
req->general_flags |= |
597 |
htole32(IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT); |
599 |
htole32(IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT); |
598 |
} else { |
600 |
} else |
599 |
req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE); |
601 |
req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE); |
600 |
} |
|
|
601 |
|
602 |
|
602 |
if (isset(sc->sc_enabled_capa, |
603 |
if (isset(sc->sc_enabled_capa, |
603 |
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) |
604 |
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) |
Lines 631-641
Link Here
|
631 |
.data = { NULL, }, |
632 |
.data = { NULL, }, |
632 |
.flags = IWM_CMD_SYNC, |
633 |
.flags = IWM_CMD_SYNC, |
633 |
}; |
634 |
}; |
|
|
635 |
struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; |
634 |
struct iwm_scan_req_lmac *req; |
636 |
struct iwm_scan_req_lmac *req; |
635 |
size_t req_len; |
637 |
size_t req_len; |
|
|
638 |
uint8_t i, nssid; |
636 |
int ret; |
639 |
int ret; |
637 |
int ssid_len = 0; |
|
|
638 |
const uint8_t *ssid = NULL; |
639 |
|
640 |
|
640 |
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, |
641 |
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, |
641 |
"Handling ieee80211 scan request\n"); |
642 |
"Handling ieee80211 scan request\n"); |
Lines 668-678
Link Here
|
668 |
req->scan_flags = htole32(IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL | |
669 |
req->scan_flags = htole32(IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL | |
669 |
IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE | |
670 |
IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE | |
670 |
IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL); |
671 |
IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL); |
671 |
if (ssid_len == 0) |
|
|
672 |
req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); |
673 |
else |
674 |
req->scan_flags |= |
675 |
htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); |
676 |
if (isset(sc->sc_enabled_capa, |
672 |
if (isset(sc->sc_enabled_capa, |
677 |
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) |
673 |
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) |
678 |
req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); |
674 |
req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); |
Lines 698-712
Link Here
|
698 |
req->tx_cmd[1].sta_id = sc->sc_aux_sta.sta_id; |
694 |
req->tx_cmd[1].sta_id = sc->sc_aux_sta.sta_id; |
699 |
|
695 |
|
700 |
/* Check if we're doing an active directed scan. */ |
696 |
/* Check if we're doing an active directed scan. */ |
701 |
if (ssid_len != 0) { |
697 |
nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); |
702 |
req->direct_scan[0].id = IEEE80211_ELEMID_SSID; |
698 |
for (i = 0; i < nssid; i++) { |
703 |
req->direct_scan[0].len = ssid_len; |
699 |
req->direct_scan[i].id = IEEE80211_ELEMID_SSID; |
704 |
memcpy(req->direct_scan[0].ssid, ssid, ssid_len); |
700 |
req->direct_scan[i].len = MIN(ss->ss_ssid[i].len, |
|
|
701 |
IEEE80211_NWID_LEN); |
702 |
memcpy(req->direct_scan[i].ssid, ss->ss_ssid[i].ssid, |
703 |
req->direct_scan[i].len); |
704 |
/* XXX debug */ |
705 |
} |
705 |
} |
|
|
706 |
if (nssid != 0) { |
707 |
req->scan_flags |= |
708 |
htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); |
709 |
} else |
710 |
req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); |
706 |
|
711 |
|
707 |
req->n_channels = iwm_mvm_lmac_scan_fill_channels(sc, |
712 |
req->n_channels = iwm_mvm_lmac_scan_fill_channels(sc, |
708 |
(struct iwm_scan_channel_cfg_lmac *)req->data, |
713 |
(struct iwm_scan_channel_cfg_lmac *)req->data, nssid); |
709 |
ssid_len != 0); |
|
|
710 |
|
714 |
|
711 |
ret = iwm_mvm_fill_probe_req(sc, |
715 |
ret = iwm_mvm_fill_probe_req(sc, |
712 |
(struct iwm_scan_probe_req *)(req->data + |
716 |
(struct iwm_scan_probe_req *)(req->data + |