提交 488dd7b5 编写于 作者: J Johannes Berg

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: NJohannes Berg <johannes.berg@intel.com>
上级 0ee45355
...@@ -208,6 +208,8 @@ struct ieee80211_chanctx_conf { ...@@ -208,6 +208,8 @@ struct ieee80211_chanctx_conf {
* @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
* @BSS_CHANGED_PS: PS changed for this BSS (STA mode) * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
* @BSS_CHANGED_TXPOWER: TX power setting changed for this interface * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
* @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
* changed (currently only in P2P client mode, GO mode will be later)
*/ */
enum ieee80211_bss_change { enum ieee80211_bss_change {
BSS_CHANGED_ASSOC = 1<<0, BSS_CHANGED_ASSOC = 1<<0,
...@@ -229,6 +231,7 @@ enum ieee80211_bss_change { ...@@ -229,6 +231,7 @@ enum ieee80211_bss_change {
BSS_CHANGED_AP_PROBE_RESP = 1<<16, BSS_CHANGED_AP_PROBE_RESP = 1<<16,
BSS_CHANGED_PS = 1<<17, BSS_CHANGED_PS = 1<<17,
BSS_CHANGED_TXPOWER = 1<<18, BSS_CHANGED_TXPOWER = 1<<18,
BSS_CHANGED_P2P_PS = 1<<19,
/* when adding here, make sure to change ieee80211_reconfig */ /* when adding here, make sure to change ieee80211_reconfig */
}; };
...@@ -312,6 +315,8 @@ enum ieee80211_rssi_event { ...@@ -312,6 +315,8 @@ enum ieee80211_rssi_event {
* @ssid_len: Length of SSID given in @ssid. * @ssid_len: Length of SSID given in @ssid.
* @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
* @txpower: TX power in dBm * @txpower: TX power in dBm
* @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces
* @p2p_oppps: P2P opportunistic PS is enabled
*/ */
struct ieee80211_bss_conf { struct ieee80211_bss_conf {
const u8 *bssid; const u8 *bssid;
...@@ -345,6 +350,8 @@ struct ieee80211_bss_conf { ...@@ -345,6 +350,8 @@ struct ieee80211_bss_conf {
size_t ssid_len; size_t ssid_len;
bool hidden_ssid; bool hidden_ssid;
int txpower; int txpower;
u8 p2p_ctwindow;
bool p2p_oppps;
}; };
/** /**
......
...@@ -473,6 +473,8 @@ struct ieee80211_if_managed { ...@@ -473,6 +473,8 @@ struct ieee80211_if_managed {
u8 use_4addr; u8 use_4addr;
u8 p2p_noa_index;
/* Signal strength from the last Beacon frame in the current BSS. */ /* Signal strength from the last Beacon frame in the current BSS. */
int last_beacon_signal; int last_beacon_signal;
......
...@@ -1365,6 +1365,22 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, ...@@ -1365,6 +1365,22 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE;
if (sdata->vif.p2p) {
u8 noa[2];
int ret;
ret = cfg80211_get_p2p_attr(cbss->information_elements,
cbss->len_information_elements,
IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
noa, sizeof(noa));
if (ret >= 2) {
bss_conf->p2p_oppps = noa[1] & 0x80;
bss_conf->p2p_ctwindow = noa[1] & 0x7f;
bss_info_changed |= BSS_CHANGED_P2P_PS;
sdata->u.mgd.p2p_noa_index = noa[0];
}
}
/* just to be sure */ /* just to be sure */
ieee80211_stop_poll(sdata); ieee80211_stop_poll(sdata);
...@@ -1487,6 +1503,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -1487,6 +1503,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
changed |= BSS_CHANGED_ASSOC; changed |= BSS_CHANGED_ASSOC;
sdata->vif.bss_conf.assoc = false; sdata->vif.bss_conf.assoc = false;
sdata->vif.bss_conf.p2p_ctwindow = 0;
sdata->vif.bss_conf.p2p_oppps = false;
/* on the next assoc, re-program HT parameters */ /* on the next assoc, re-program HT parameters */
memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa));
memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); 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,6 +2613,27 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
} }
} }
if (sdata->vif.p2p) {
u8 noa[2];
int ret;
ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable,
len - baselen,
IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
noa, sizeof(noa));
if (ret >= 2 && sdata->u.mgd.p2p_noa_index != noa[0]) {
bss_conf->p2p_oppps = noa[1] & 0x80;
bss_conf->p2p_ctwindow = noa[1] & 0x7f;
changed |= BSS_CHANGED_P2P_PS;
sdata->u.mgd.p2p_noa_index = noa[0];
/*
* make sure we update all information, the CRC
* mechanism doesn't look at P2P attributes.
*/
ifmgd->beacon_crc_valid = false;
}
}
if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid) if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid)
return; return;
ifmgd->beacon_crc = ncrc; ifmgd->beacon_crc = ncrc;
......
...@@ -343,6 +343,8 @@ TRACE_EVENT(drv_bss_info_changed, ...@@ -343,6 +343,8 @@ TRACE_EVENT(drv_bss_info_changed,
__dynamic_array(u8, ssid, info->ssid_len); __dynamic_array(u8, ssid, info->ssid_len);
__field(bool, hidden_ssid); __field(bool, hidden_ssid);
__field(int, txpower) __field(int, txpower)
__field(u8, p2p_ctwindow)
__field(bool, p2p_oppps)
), ),
TP_fast_assign( TP_fast_assign(
...@@ -378,6 +380,8 @@ TRACE_EVENT(drv_bss_info_changed, ...@@ -378,6 +380,8 @@ TRACE_EVENT(drv_bss_info_changed,
memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len); memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len);
__entry->hidden_ssid = info->hidden_ssid; __entry->hidden_ssid = info->hidden_ssid;
__entry->txpower = info->txpower; __entry->txpower = info->txpower;
__entry->p2p_ctwindow = info->p2p_ctwindow;
__entry->p2p_oppps = info->p2p_oppps;
), ),
TP_printk( TP_printk(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册