994
994
if (beaconint_us > latency) {
995
995
local->ps_sdata = NULL;
997
struct ieee80211_bss *bss;
1001
bss = (void *)found->u.mgd.associated->priv;
1002
dtimper = bss->dtim_period;
998
u8 dtimper = found->u.mgd.dtim_period;
1004
1000
/* If the TIM IE is invalid, pretend the value is 1 */
1306
1302
ieee80211_led_assoc(local, 1);
1308
if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD)
1309
bss_conf->dtim_period = bss->dtim_period;
1304
if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
1306
* If the AP is buggy we may get here with no DTIM period
1307
* known, so assume it's 1 which is the only safe assumption
1308
* in that case, although if the TIM IE is broken powersave
1309
* probably just won't work at all.
1311
bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1;
1311
1313
bss_conf->dtim_period = 0;
1313
1316
bss_conf->assoc = 1;
1441
1444
del_timer_sync(&sdata->u.mgd.bcn_mon_timer);
1442
1445
del_timer_sync(&sdata->u.mgd.timer);
1443
1446
del_timer_sync(&sdata->u.mgd.chswitch_timer);
1448
sdata->vif.bss_conf.dtim_period = 0;
1446
1451
void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
2205
2210
struct ieee80211_channel *channel;
2206
2211
bool need_ps = false;
2208
if (sdata->u.mgd.associated &&
2209
ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) {
2210
bss = (void *)sdata->u.mgd.associated->priv;
2213
if ((sdata->u.mgd.associated &&
2214
ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) ||
2215
(sdata->u.mgd.assoc_data &&
2216
ether_addr_equal(mgmt->bssid,
2217
sdata->u.mgd.assoc_data->bss->bssid))) {
2211
2218
/* not previously set so we may need to recalc */
2212
need_ps = !bss->dtim_period;
2219
need_ps = sdata->u.mgd.associated && !sdata->u.mgd.dtim_period;
2221
if (elems->tim && !elems->parse_error) {
2222
struct ieee80211_tim_ie *tim_ie = elems->tim;
2223
sdata->u.mgd.dtim_period = tim_ie->dtim_period;
2215
2227
if (elems->ds_params && elems->ds_params_len == 1)
3413
3425
/* kick off associate process */
3415
3427
ifmgd->assoc_data = assoc_data;
3428
ifmgd->dtim_period = 0;
3417
3430
err = ieee80211_prep_connection(sdata, req->bss, true);
3419
3432
goto err_clear;
3421
if (!bss->dtim_period &&
3422
sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
3424
* Wait up to one beacon interval ...
3425
* should this be more if we miss one?
3427
printk(KERN_DEBUG "%s: waiting for beacon from %pM\n",
3428
sdata->name, ifmgd->bssid);
3429
assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval);
3434
if (sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
3435
const u8 *beacon_ies = req->bss->beacon_ies;
3436
size_t beacon_ies_len = req->bss->len_beacon_ies;
3438
if (!beacon_ies_len) {
3440
* Wait up to one beacon interval ...
3441
* should this be more if we miss one?
3443
printk(KERN_DEBUG "%s: waiting for beacon from %pM\n",
3444
sdata->name, ifmgd->bssid);
3445
assoc_data->timeout =
3446
TU_TO_EXP_TIME(req->bss->beacon_interval);
3448
const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM,
3451
if (tim_ie && tim_ie[1] >=
3452
sizeof(struct ieee80211_tim_ie)) {
3453
const struct ieee80211_tim_ie *tim;
3454
tim = (void *)(tim_ie + 2);
3455
ifmgd->dtim_period = tim->dtim_period;
3457
assoc_data->have_beacon = true;
3458
assoc_data->sent_assoc = false;
3459
assoc_data->timeout = jiffies;
3431
3462
assoc_data->have_beacon = true;
3432
3463
assoc_data->sent_assoc = false;