diff options
author | Janusz Dziedzic <janusz.dziedzic@gmail.com> | 2013-03-21 10:47:56 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-03-22 09:13:42 -0400 |
commit | 67baf66339f82b5ddef5731caedb1e6db496818d (patch) | |
tree | 828716f2f60aec07f8c912ce0de7f89a3494b34e | |
parent | 934457eeb0bbe9af1849d9201cb3fb81fd9fa4d0 (diff) |
mac80211: add P2P NoA settings
Add P2P NoA settings for STA mode.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
[fix docs]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | 12 | ||||
-rw-r--r-- | include/net/mac80211.h | 6 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 23 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 2 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 45 | ||||
-rw-r--r-- | net/mac80211/trace.h | 6 |
6 files changed, 57 insertions, 37 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 341dbc0237ea..1d20287b1120 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -662,6 +662,7 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, | |||
662 | u32 action) | 662 | u32 action) |
663 | { | 663 | { |
664 | struct iwl_mac_ctx_cmd cmd = {}; | 664 | struct iwl_mac_ctx_cmd cmd = {}; |
665 | struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr; | ||
665 | 666 | ||
666 | WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p); | 667 | WARN_ON(vif->type != NL80211_IFTYPE_STATION || !vif->p2p); |
667 | 668 | ||
@@ -671,7 +672,8 @@ static int iwl_mvm_mac_ctxt_cmd_p2p_client(struct iwl_mvm *mvm, | |||
671 | /* Fill the data specific for station mode */ | 672 | /* Fill the data specific for station mode */ |
672 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); | 673 | iwl_mvm_mac_ctxt_cmd_fill_sta(mvm, vif, &cmd.p2p_sta.sta); |
673 | 674 | ||
674 | cmd.p2p_sta.ctwin = cpu_to_le32(vif->bss_conf.p2p_ctwindow); | 675 | cmd.p2p_sta.ctwin = cpu_to_le32(noa->oppps_ctwindow & |
676 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); | ||
675 | 677 | ||
676 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); | 678 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); |
677 | } | 679 | } |
@@ -892,6 +894,7 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, | |||
892 | u32 action) | 894 | u32 action) |
893 | { | 895 | { |
894 | struct iwl_mac_ctx_cmd cmd = {}; | 896 | struct iwl_mac_ctx_cmd cmd = {}; |
897 | struct ieee80211_p2p_noa_attr *noa = &vif->bss_conf.p2p_noa_attr; | ||
895 | 898 | ||
896 | WARN_ON(vif->type != NL80211_IFTYPE_AP || !vif->p2p); | 899 | WARN_ON(vif->type != NL80211_IFTYPE_AP || !vif->p2p); |
897 | 900 | ||
@@ -901,8 +904,11 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, | |||
901 | /* Fill the data specific for GO mode */ | 904 | /* Fill the data specific for GO mode */ |
902 | iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap); | 905 | iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap); |
903 | 906 | ||
904 | cmd.go.ctwin = cpu_to_le32(vif->bss_conf.p2p_ctwindow); | 907 | cmd.go.ctwin = cpu_to_le32(noa->oppps_ctwindow & |
905 | cmd.go.opp_ps_enabled = cpu_to_le32(!!vif->bss_conf.p2p_oppps); | 908 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK); |
909 | cmd.go.opp_ps_enabled = | ||
910 | cpu_to_le32(!!(noa->oppps_ctwindow & | ||
911 | IEEE80211_P2P_OPPPS_ENABLE_BIT)); | ||
906 | 912 | ||
907 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); | 913 | return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); |
908 | } | 914 | } |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index dd73b8c6746b..9b536172e27e 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -330,8 +330,7 @@ enum ieee80211_rssi_event { | |||
330 | * @ssid_len: Length of SSID given in @ssid. | 330 | * @ssid_len: Length of SSID given in @ssid. |
331 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. | 331 | * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. |
332 | * @txpower: TX power in dBm | 332 | * @txpower: TX power in dBm |
333 | * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces | 333 | * @p2p_noa_attr: P2P NoA attribute for P2P powersave |
334 | * @p2p_oppps: P2P opportunistic PS is enabled | ||
335 | */ | 334 | */ |
336 | struct ieee80211_bss_conf { | 335 | struct ieee80211_bss_conf { |
337 | const u8 *bssid; | 336 | const u8 *bssid; |
@@ -365,8 +364,7 @@ struct ieee80211_bss_conf { | |||
365 | size_t ssid_len; | 364 | size_t ssid_len; |
366 | bool hidden_ssid; | 365 | bool hidden_ssid; |
367 | int txpower; | 366 | int txpower; |
368 | u8 p2p_ctwindow; | 367 | struct ieee80211_p2p_noa_attr p2p_noa_attr; |
369 | bool p2p_oppps; | ||
370 | }; | 368 | }; |
371 | 369 | ||
372 | /** | 370 | /** |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index e5c1441ac2b8..50aaf25d4735 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -965,8 +965,13 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, | |||
965 | sdata->vif.bss_conf.hidden_ssid = | 965 | sdata->vif.bss_conf.hidden_ssid = |
966 | (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); | 966 | (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); |
967 | 967 | ||
968 | sdata->vif.bss_conf.p2p_ctwindow = params->p2p_ctwindow; | 968 | memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, |
969 | sdata->vif.bss_conf.p2p_oppps = params->p2p_opp_ps; | 969 | sizeof(sdata->vif.bss_conf.p2p_noa_attr)); |
970 | sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow = | ||
971 | params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK; | ||
972 | if (params->p2p_opp_ps) | ||
973 | sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |= | ||
974 | IEEE80211_P2P_OPPPS_ENABLE_BIT; | ||
970 | 975 | ||
971 | err = ieee80211_assign_beacon(sdata, ¶ms->beacon); | 976 | err = ieee80211_assign_beacon(sdata, ¶ms->beacon); |
972 | if (err < 0) | 977 | if (err < 0) |
@@ -1961,12 +1966,20 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
1961 | } | 1966 | } |
1962 | 1967 | ||
1963 | if (params->p2p_ctwindow >= 0) { | 1968 | if (params->p2p_ctwindow >= 0) { |
1964 | sdata->vif.bss_conf.p2p_ctwindow = params->p2p_ctwindow; | 1969 | sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow &= |
1970 | ~IEEE80211_P2P_OPPPS_CTWINDOW_MASK; | ||
1971 | sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |= | ||
1972 | params->p2p_ctwindow & IEEE80211_P2P_OPPPS_CTWINDOW_MASK; | ||
1965 | changed |= BSS_CHANGED_P2P_PS; | 1973 | changed |= BSS_CHANGED_P2P_PS; |
1966 | } | 1974 | } |
1967 | 1975 | ||
1968 | if (params->p2p_opp_ps >= 0) { | 1976 | if (params->p2p_opp_ps > 0) { |
1969 | sdata->vif.bss_conf.p2p_oppps = params->p2p_opp_ps; | 1977 | sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow |= |
1978 | IEEE80211_P2P_OPPPS_ENABLE_BIT; | ||
1979 | changed |= BSS_CHANGED_P2P_PS; | ||
1980 | } else if (params->p2p_opp_ps == 0) { | ||
1981 | sdata->vif.bss_conf.p2p_noa_attr.oppps_ctwindow &= | ||
1982 | ~IEEE80211_P2P_OPPPS_ENABLE_BIT; | ||
1970 | changed |= BSS_CHANGED_P2P_PS; | 1983 | changed |= BSS_CHANGED_P2P_PS; |
1971 | } | 1984 | } |
1972 | 1985 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index ae2d1754b792..55155e3b9b20 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -442,7 +442,7 @@ struct ieee80211_if_managed { | |||
442 | 442 | ||
443 | u8 use_4addr; | 443 | u8 use_4addr; |
444 | 444 | ||
445 | u8 p2p_noa_index; | 445 | s16 p2p_noa_index; |
446 | 446 | ||
447 | /* Signal strength from the last Beacon frame in the current BSS. */ | 447 | /* Signal strength from the last Beacon frame in the current BSS. */ |
448 | int last_beacon_signal; | 448 | int last_beacon_signal; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index f9258707b15a..8b3e852d6032 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1661,20 +1661,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
1661 | rcu_read_lock(); | 1661 | rcu_read_lock(); |
1662 | ies = rcu_dereference(cbss->ies); | 1662 | ies = rcu_dereference(cbss->ies); |
1663 | if (ies) { | 1663 | if (ies) { |
1664 | struct ieee80211_p2p_noa_attr noa; | ||
1665 | int ret; | 1664 | int ret; |
1666 | 1665 | ||
1667 | ret = cfg80211_get_p2p_attr( | 1666 | ret = cfg80211_get_p2p_attr( |
1668 | ies->data, ies->len, | 1667 | ies->data, ies->len, |
1669 | IEEE80211_P2P_ATTR_ABSENCE_NOTICE, | 1668 | IEEE80211_P2P_ATTR_ABSENCE_NOTICE, |
1670 | (u8 *) &noa, sizeof(noa)); | 1669 | (u8 *) &bss_conf->p2p_noa_attr, |
1670 | sizeof(bss_conf->p2p_noa_attr)); | ||
1671 | if (ret >= 2) { | 1671 | if (ret >= 2) { |
1672 | bss_conf->p2p_oppps = noa.oppps_ctwindow & | 1672 | sdata->u.mgd.p2p_noa_index = |
1673 | IEEE80211_P2P_OPPPS_ENABLE_BIT; | 1673 | bss_conf->p2p_noa_attr.index; |
1674 | bss_conf->p2p_ctwindow = noa.oppps_ctwindow & | ||
1675 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK; | ||
1676 | bss_info_changed |= BSS_CHANGED_P2P_PS; | 1674 | bss_info_changed |= BSS_CHANGED_P2P_PS; |
1677 | sdata->u.mgd.p2p_noa_index = noa.index; | ||
1678 | } | 1675 | } |
1679 | } | 1676 | } |
1680 | rcu_read_unlock(); | 1677 | rcu_read_unlock(); |
@@ -1799,8 +1796,9 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
1799 | changed |= BSS_CHANGED_ASSOC; | 1796 | changed |= BSS_CHANGED_ASSOC; |
1800 | sdata->vif.bss_conf.assoc = false; | 1797 | sdata->vif.bss_conf.assoc = false; |
1801 | 1798 | ||
1802 | sdata->vif.bss_conf.p2p_ctwindow = 0; | 1799 | ifmgd->p2p_noa_index = -1; |
1803 | sdata->vif.bss_conf.p2p_oppps = false; | 1800 | memset(&sdata->vif.bss_conf.p2p_noa_attr, 0, |
1801 | sizeof(sdata->vif.bss_conf.p2p_noa_attr)); | ||
1804 | 1802 | ||
1805 | /* on the next assoc, re-program HT/VHT parameters */ | 1803 | /* on the next assoc, re-program HT/VHT parameters */ |
1806 | memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); | 1804 | memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); |
@@ -2963,24 +2961,30 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
2963 | } | 2961 | } |
2964 | 2962 | ||
2965 | if (sdata->vif.p2p) { | 2963 | if (sdata->vif.p2p) { |
2966 | struct ieee80211_p2p_noa_attr noa; | 2964 | struct ieee80211_p2p_noa_attr noa = {}; |
2967 | int ret; | 2965 | int ret; |
2968 | 2966 | ||
2969 | ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable, | 2967 | ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable, |
2970 | len - baselen, | 2968 | len - baselen, |
2971 | IEEE80211_P2P_ATTR_ABSENCE_NOTICE, | 2969 | IEEE80211_P2P_ATTR_ABSENCE_NOTICE, |
2972 | (u8 *) &noa, sizeof(noa)); | 2970 | (u8 *) &noa, sizeof(noa)); |
2973 | if (ret >= 2 && sdata->u.mgd.p2p_noa_index != noa.index) { | 2971 | if (ret >= 2) { |
2974 | bss_conf->p2p_oppps = noa.oppps_ctwindow & | 2972 | if (sdata->u.mgd.p2p_noa_index != noa.index) { |
2975 | IEEE80211_P2P_OPPPS_ENABLE_BIT; | 2973 | /* valid noa_attr and index changed */ |
2976 | bss_conf->p2p_ctwindow = noa.oppps_ctwindow & | 2974 | sdata->u.mgd.p2p_noa_index = noa.index; |
2977 | IEEE80211_P2P_OPPPS_CTWINDOW_MASK; | 2975 | memcpy(&bss_conf->p2p_noa_attr, &noa, sizeof(noa)); |
2976 | changed |= BSS_CHANGED_P2P_PS; | ||
2977 | /* | ||
2978 | * make sure we update all information, the CRC | ||
2979 | * mechanism doesn't look at P2P attributes. | ||
2980 | */ | ||
2981 | ifmgd->beacon_crc_valid = false; | ||
2982 | } | ||
2983 | } else if (sdata->u.mgd.p2p_noa_index != -1) { | ||
2984 | /* noa_attr not found and we had valid noa_attr before */ | ||
2985 | sdata->u.mgd.p2p_noa_index = -1; | ||
2986 | memset(&bss_conf->p2p_noa_attr, 0, sizeof(bss_conf->p2p_noa_attr)); | ||
2978 | changed |= BSS_CHANGED_P2P_PS; | 2987 | changed |= BSS_CHANGED_P2P_PS; |
2979 | sdata->u.mgd.p2p_noa_index = noa.index; | ||
2980 | /* | ||
2981 | * make sure we update all information, the CRC | ||
2982 | * mechanism doesn't look at P2P attributes. | ||
2983 | */ | ||
2984 | ifmgd->beacon_crc_valid = false; | 2988 | ifmgd->beacon_crc_valid = false; |
2985 | } | 2989 | } |
2986 | } | 2990 | } |
@@ -3523,6 +3527,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata) | |||
3523 | ifmgd->powersave = sdata->wdev.ps; | 3527 | ifmgd->powersave = sdata->wdev.ps; |
3524 | ifmgd->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; | 3528 | ifmgd->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; |
3525 | ifmgd->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; | 3529 | ifmgd->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; |
3530 | ifmgd->p2p_noa_index = -1; | ||
3526 | 3531 | ||
3527 | mutex_init(&ifmgd->mtx); | 3532 | mutex_init(&ifmgd->mtx); |
3528 | 3533 | ||
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index c5899797a8d4..d79e374e129a 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h | |||
@@ -359,8 +359,7 @@ TRACE_EVENT(drv_bss_info_changed, | |||
359 | __dynamic_array(u8, ssid, info->ssid_len); | 359 | __dynamic_array(u8, ssid, info->ssid_len); |
360 | __field(bool, hidden_ssid); | 360 | __field(bool, hidden_ssid); |
361 | __field(int, txpower) | 361 | __field(int, txpower) |
362 | __field(u8, p2p_ctwindow) | 362 | __field(u8, p2p_oppps_ctwindow) |
363 | __field(bool, p2p_oppps) | ||
364 | ), | 363 | ), |
365 | 364 | ||
366 | TP_fast_assign( | 365 | TP_fast_assign( |
@@ -400,8 +399,7 @@ TRACE_EVENT(drv_bss_info_changed, | |||
400 | memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len); | 399 | memcpy(__get_dynamic_array(ssid), info->ssid, info->ssid_len); |
401 | __entry->hidden_ssid = info->hidden_ssid; | 400 | __entry->hidden_ssid = info->hidden_ssid; |
402 | __entry->txpower = info->txpower; | 401 | __entry->txpower = info->txpower; |
403 | __entry->p2p_ctwindow = info->p2p_ctwindow; | 402 | __entry->p2p_oppps_ctwindow = info->p2p_noa_attr.oppps_ctwindow; |
404 | __entry->p2p_oppps = info->p2p_oppps; | ||
405 | ), | 403 | ), |
406 | 404 | ||
407 | TP_printk( | 405 | TP_printk( |