Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/iwm/if_iwm_scan.c
Show First 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | iwm_mvm_umac_scan_fill_channels(struct iwm_softc *sc, | ||||
} | } | ||||
return nchan; | return nchan; | ||||
} | } | ||||
static int | static int | ||||
iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) | iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) | ||||
{ | { | ||||
const struct ieee80211_rateset *rs; | |||||
struct ieee80211com *ic = &sc->sc_ic; | struct ieee80211com *ic = &sc->sc_ic; | ||||
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); | struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); | ||||
struct ieee80211_frame *wh = (struct ieee80211_frame *)preq->buf; | struct ieee80211_frame *wh = (struct ieee80211_frame *)preq->buf; | ||||
struct ieee80211_rateset *rs; | |||||
size_t remain = sizeof(preq->buf); | size_t remain = sizeof(preq->buf); | ||||
uint8_t *frm, *pos; | uint8_t *frm, *pos; | ||||
memset(preq, 0, sizeof(*preq)); | memset(preq, 0, sizeof(*preq)); | ||||
/* Ensure enough space for header and SSID IE. */ | /* Ensure enough space for header and SSID IE. */ | ||||
if (remain < sizeof(*wh) + 2) | if (remain < sizeof(*wh) + 2) | ||||
return ENOBUFS; | return ENOBUFS; | ||||
Show All 15 Lines | iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq) | ||||
frm = ieee80211_add_ssid(frm, NULL, 0); | frm = ieee80211_add_ssid(frm, NULL, 0); | ||||
/* Tell the firmware where the MAC header is. */ | /* Tell the firmware where the MAC header is. */ | ||||
preq->mac_header.offset = 0; | preq->mac_header.offset = 0; | ||||
preq->mac_header.len = htole16(frm - (uint8_t *)wh); | preq->mac_header.len = htole16(frm - (uint8_t *)wh); | ||||
remain -= frm - (uint8_t *)wh; | remain -= frm - (uint8_t *)wh; | ||||
/* Fill in 2GHz IEs and tell firmware where they are. */ | /* Fill in 2GHz IEs and tell firmware where they are. */ | ||||
rs = &ic->ic_sup_rates[IEEE80211_MODE_11G]; | rs = ic->ic_sup_rates[IEEE80211_MODE_11G]; | ||||
if (rs->rs_nrates > IEEE80211_RATE_SIZE) { | if (rs->rs_nrates > IEEE80211_RATE_SIZE) { | ||||
if (remain < 4 + rs->rs_nrates) | if (remain < 4 + rs->rs_nrates) | ||||
return ENOBUFS; | return ENOBUFS; | ||||
} else if (remain < 2 + rs->rs_nrates) { | } else if (remain < 2 + rs->rs_nrates) { | ||||
return ENOBUFS; | return ENOBUFS; | ||||
} | } | ||||
preq->band_data[0].offset = htole16(frm - (uint8_t *)wh); | preq->band_data[0].offset = htole16(frm - (uint8_t *)wh); | ||||
pos = frm; | pos = frm; | ||||
Show All 9 Lines | if (iwm_mvm_rrm_scan_needed(sc)) { | ||||
*frm++ = IEEE80211_ELEMID_DSPARMS; | *frm++ = IEEE80211_ELEMID_DSPARMS; | ||||
*frm++ = 1; | *frm++ = 1; | ||||
*frm++ = 0; | *frm++ = 0; | ||||
remain -= 3; | remain -= 3; | ||||
} | } | ||||
if (sc->nvm_data->sku_cap_band_52GHz_enable) { | if (sc->nvm_data->sku_cap_band_52GHz_enable) { | ||||
/* Fill in 5GHz IEs. */ | /* Fill in 5GHz IEs. */ | ||||
rs = &ic->ic_sup_rates[IEEE80211_MODE_11A]; | rs = ic->ic_sup_rates[IEEE80211_MODE_11A]; | ||||
if (rs->rs_nrates > IEEE80211_RATE_SIZE) { | if (rs->rs_nrates > IEEE80211_RATE_SIZE) { | ||||
if (remain < 4 + rs->rs_nrates) | if (remain < 4 + rs->rs_nrates) | ||||
return ENOBUFS; | return ENOBUFS; | ||||
} else if (remain < 2 + rs->rs_nrates) { | } else if (remain < 2 + rs->rs_nrates) { | ||||
return ENOBUFS; | return ENOBUFS; | ||||
} | } | ||||
preq->band_data[1].offset = htole16(frm - (uint8_t *)wh); | preq->band_data[1].offset = htole16(frm - (uint8_t *)wh); | ||||
pos = frm; | pos = frm; | ||||
▲ Show 20 Lines • Show All 430 Lines • Show Last 20 Lines |