diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-10-29 15:08:01 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-11-06 07:25:06 -0500 |
commit | 488dd7b53de9ea41edf7a475be63da51bdd05093 (patch) | |
tree | b82d9759fe904962dab69d4b641c512d3202a8f6 | |
parent | 0ee453552f0b1ea87f6f50a077b0ed9d9ac7d6ac (diff) |
mac80211: pass P2P powersave parameters to driver
While connected to a GO, parse the P2P NoA attribute
and pass the CT Window and opportunistic powersave
parameters to the driver.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | include/net/mac80211.h | 7 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 40 | ||||
-rw-r--r-- | net/mac80211/trace.h | 4 |
4 files changed, 53 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index dfa589b721b6..23803addca3c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -208,6 +208,8 @@ struct ieee80211_chanctx_conf { | |||
208 | * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) | 208 | * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) |
209 | * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) | 209 | * @BSS_CHANGED_PS: PS changed for this BSS (STA mode) |
210 | * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface | 210 | * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface |
211 | * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS) | ||
212 | * changed (currently only in P2P client mode, GO mode will be later) | ||
211 | */ | 213 | */ |
212 | enum ieee80211_bss_change { | 214 | enum ieee80211_bss_change { |
213 | BSS_CHANGED_ASSOC = 1<<0, | 215 | BSS_CHANGED_ASSOC = 1<<0, |
@@ -229,6 +231,7 @@ enum ieee80211_bss_change { | |||
229 | BSS_CHANGED_AP_PROBE_RESP = 1<<16, | 231 | BSS_CHANGED_AP_PROBE_RESP = 1<<16, |
230 | BSS_CHANGED_PS = 1<<17, | 232 | BSS_CHANGED_PS = 1<<17, |
231 | BSS_CHANGED_TXPOWER = 1<<18, | 233 | BSS_CHANGED_TXPOWER = 1<<18, |
234 | BSS_CHANGED_P2P_PS = 1<<19, | ||
232 | 235 | ||
233 | /* when adding here, make sure to change ieee80211_reconfig */ | 236 | /* when adding here, make sure to change ieee80211_reconfig */ |
234 | }; | 237 | }; |
@@ -312,6 +315,8 @@ enum ieee80211_rssi_event { | |||
312 | * @ssid_len: Length of SSID given in @ssid. | 315 | * @ssid_len: Length of SSID given in @ssid. |
313 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. | 316 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. |
314 | * @txpower: TX power in dBm | 317 | * @txpower: TX power in dBm |
318 | * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces | ||
319 | * @p2p_oppps: P2P opportunistic PS is enabled | ||
315 | */ | 320 | */ |
316 | struct ieee80211_bss_conf { | 321 | struct ieee80211_bss_conf { |
317 | const u8 *bssid; | 322 | const u8 *bssid; |
@@ -345,6 +350,8 @@ struct ieee80211_bss_conf { | |||
345 | size_t ssid_len; | 350 | size_t ssid_len; |
346 | bool hidden_ssid; | 351 | bool hidden_ssid; |
347 | int txpower; | 352 | int txpower; |
353 | u8 p2p_ctwindow; | ||
354 | bool p2p_oppps; | ||
348 | }; | 355 | }; |
349 | 356 | ||
350 | /** | 357 | /** |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index d272e0cabc37..e1fb97cc9a41 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -473,6 +473,8 @@ struct ieee80211_if_managed { | |||
473 | 473 | ||
474 | u8 use_4addr; | 474 | u8 use_4addr; |
475 | 475 | ||
476 | u8 p2p_noa_index; | ||
477 | |||
476 | /* Signal strength from the last Beacon frame in the current BSS. */ | 478 | /* Signal strength from the last Beacon frame in the current BSS. */ |
477 | int last_beacon_signal; | 479 | int last_beacon_signal; |
478 | 480 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 02ffe8738243..61614461e089 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1365,6 +1365,22 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1365 | 1365 | ||
1366 | sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; | 1366 | sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; |
1367 | 1367 | ||
1368 | if (sdata->vif.p2p) { | ||
1369 | u8 noa[2]; | ||
1370 | int ret; | ||
1371 | |||
1372 | ret = cfg80211_get_p2p_attr(cbss->information_elements, | ||
1373 | cbss->len_information_elements, | ||
1374 | IEEE80211_P2P_ATTR_ABSENCE_NOTICE, | ||
1375 | noa, sizeof(noa)); | ||
1376 | if (ret >= 2) { | ||
1377 | bss_conf->p2p_oppps = noa[1] & 0x80; | ||
1378 | bss_conf->p2p_ctwindow = noa[1] & 0x7f; | ||
1379 | bss_info_changed |= BSS_CHANGED_P2P_PS; | ||
1380 | sdata->u.mgd.p2p_noa_index = noa[0]; | ||
1381 | } | ||
1382 | } | ||
1383 | |||
1368 | /* just to be sure */ | 1384 | /* just to be sure */ |
1369 | ieee80211_stop_poll(sdata); | 1385 | ieee80211_stop_poll(sdata); |
1370 | 1386 | ||
@@ -1487,6 +1503,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1487 | changed |= BSS_CHANGED_ASSOC; | 1503 | changed |= BSS_CHANGED_ASSOC; |
1488 | sdata->vif.bss_conf.assoc = false; | 1504 | sdata->vif.bss_conf.assoc = false; |
1489 | 1505 | ||
1506 | sdata->vif.bss_conf.p2p_ctwindow = 0; | ||
1507 | sdata->vif.bss_conf.p2p_oppps = false; | ||
1508 | |||
1490 | /* on the next assoc, re-program HT parameters */ | 1509 | /* on the next assoc, re-program HT parameters */ |
1491 | memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); | 1510 | memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); |
1492 | memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); | 1511 | memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); |
@@ -2594,6 +2613,27 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2594 | } | 2613 | } |
2595 | } | 2614 | } |
2596 | 2615 | ||
2616 | if (sdata->vif.p2p) { | ||
2617 | u8 noa[2]; | ||
2618 | int ret; | ||
2619 | |||
2620 | ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable, | ||
2621 | len - baselen, | ||
2622 | IEEE80211_P2P_ATTR_ABSENCE_NOTICE, | ||
2623 | noa, sizeof(noa)); | ||
2624 | if (ret >= 2 && sdata->u.mgd.p2p_noa_index != noa[0]) { | ||
2625 | bss_conf->p2p_oppps = noa[1] & 0x80; | ||
2626 | bss_conf->p2p_ctwindow = noa[1] & 0x7f; | ||
2627 | changed |= BSS_CHANGED_P2P_PS; | ||
2628 | sdata->u.mgd.p2p_noa_index = noa[0]; | ||
2629 | /* | ||
2630 | * make sure we update all information, the CRC | ||
2631 | * mechanism doesn't look at P2P attributes. | ||
2632 | */ | ||
2633 | ifmgd->beacon_crc_valid = false; | ||
2634 | } | ||
2635 | } | ||
2636 | |||
2597 | if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid) | 2637 | if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid) |
2598 | return; | 2638 | return; |
2599 | ifmgd->beacon_crc = ncrc; | 2639 | ifmgd->beacon_crc = ncrc; |
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index eeebbd9cb888..7794e533989a 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -343,6 +343,8 @@ TRACE_EVENT(drv_bss_info_changed, | |||
343 | __dynamic_array(u8, ssid, info->ssid_len); | 343 | __dynamic_array(u8, ssid, info->ssid_len); |
344 | __field(bool, hidden_ssid); | 344 | __field(bool, hidden_ssid); |
345 | __field(int, txpower) | 345 | __field(int, txpower) |
346 | __field(u8, p2p_ctwindow) | ||
347 | __field(bool, p2p_oppps) | ||
346 | ), | 348 | ), |
347 | 349 | ||
348 | TP_fast_assign( | 350 | TP_fast_assign( |
@@ -378,6 +380,8 @@ TRACE_EVENT(drv_bss_info_changed, | |||
378 | memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len); | 380 | memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len); |
379 | __entry->hidden_ssid = info->hidden_ssid; | 381 | __entry->hidden_ssid = info->hidden_ssid; |
380 | __entry->txpower = info->txpower; | 382 | __entry->txpower = info->txpower; |
383 | __entry->p2p_ctwindow = info->p2p_ctwindow; | ||
384 | __entry->p2p_oppps = info->p2p_oppps; | ||
381 | ), | 385 | ), |
382 | 386 | ||
383 | TP_printk( | 387 | TP_printk( |