compat-wireless: p2p power save support
Subsystems (2)
RFC 4/7 compat-wireless: p2p power save support
From: Janusz Dziedzic <[email protected]>
Date: Thu, 4 Aug 2011 11:42:16 +0200
P2P power save support:
- Opportunistic Power Save
- Notice Of Absence
--- include/linux/nl80211.h | 12 +++++ include/net/cfg80211.h | 34 +++++++++++++ include/net/mac80211.h | 3 + net/mac80211/cfg.c | 24 +++++++++ net/mac80211/ieee80211_i.h | 3 + net/mac80211/mlme.c | 114 ++++++++++++++++++++++++++++++++++++++++++ net/wireless/nl80211.c | 119 ++++++++++++++++++++++++++++++++++++++++++++ net/wireless/util.c | 9 +++ 8 files changed, 318 insertions(+), 0 deletions(-)
include/linux/nl80211.h +12 -0
@@ -638,6 +638,10 @@ enum nl80211_commands {NL80211_CMD_TDLS_OPER ,NL80211_CMD_TDLS_MGMT , +NL80211_CMD_GET_NOA , +NL80211_CMD_SET_NOA , +NL80211_CMD_SET_P2P_POWER_SAVE , +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -1337,6 +1341,14 @@ enum nl80211_attrs {NL80211_ATTR_TDLS_SUPPORT ,NL80211_ATTR_TDLS_EXTERNAL_SETUP , +NL80211_ATTR_P2P_PS_NOA , +NL80211_ATTR_P2P_PS_NOA_COUNT , +NL80211_ATTR_P2P_PS_NOA_START , +NL80211_ATTR_P2P_PS_NOA_DURATION , +NL80211_ATTR_P2P_PS_NOA_INTERVAL , +NL80211_ATTR_P2P_PS_LEGACY_PS , +NL80211_ATTR_P2P_PS_OPP_PS , +NL80211_ATTR_P2P_PS_CTWINDOW ,/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
include/net/cfg80211.h +34 -0
@@ -1253,6 +1253,33 @@ struct cfg80211_gtk_rekey_data {u8 replay_ctr[NL80211_REPLAY_CTR_LEN ]; }; +/* +* struct cfg80211_p2p_ps - p2p power save params +* +* This structure ... +* +* @legacy_ps: 0=disable, 1=enable, 2=maximum_ps, -1=no change +* @opp_ps: 0=disable, 1=enable, -1=no change +* @ctwidnow: 0... - change in ms, -1=no change +* @count: 0..255 - count +* @start: Start time in ms from next TBTT +* @duration: Duration in ms +* @interval: interval in ms +*/ +struct cfg80211_p2p_ps { +int legacy_ps; + +/* Opportunistic Power Save */ +int opp_ps; +int ctwindow; + +/* Notice of Absence */ +u8 count; +int start; +int duration; +int interval; +}; +/** * struct cfg80211_ops - backend description for wireless configuration *
@@ -1625,6 +1652,9 @@ struct cfg80211_ops { u16 status_code, const u8 *buf, size_t len);int (*tdls_oper)(struct wiphy *wiphy,struct net_device *dev,u8 *peer,enum nl80211_tdls_operation oper); +int (*set_p2p_power_mgmt)(struct wiphy *wiphy, +struct net_device *dev, +struct cfg80211_p2p_ps *ps); };/*
@@ -2188,6 +2218,8 @@ struct wireless_dev {bool ps;int ps_timeout; +struct cfg80211_p2p_ps p2p_ps; +int beacon_interval;#ifdef CONFIG_CFG80211_WEXT
@@ -2376,6 +2408,7 @@ struct ieee802_11_elems {u8 *ext_supp_rates;u8 *wmm_info;u8 *wmm_param; +u8 *p2p_ie;struct ieee80211_ht_cap *ht_cap_elem;struct ieee80211_ht_info *ht_info_elem;struct ieee80211_meshconf_ie *mesh_config;
@@ -2406,6 +2439,7 @@ struct ieee802_11_elems {u8 ext_supp_rates_len;u8 wmm_info_len;u8 wmm_param_len; +u8 p2p_ie_len;u8 mesh_id_len;u8 peering_len;u8 preq_len;
include/net/mac80211.h +3 -0
@@ -760,6 +760,7 @@ enum ieee80211_conf_changed {IEEE80211_CONF_CHANGE_CHANNEL =BIT (6 ),IEEE80211_CONF_CHANGE_RETRY_LIMITS =BIT (7 ),IEEE80211_CONF_CHANGE_IDLE =BIT (8 ), + IEEE80211_CONF_CHANGE_P2P_PS = BIT(9), };/**
@@ -830,6 +831,7 @@ struct ieee80211_conf {struct ieee80211_channel *channel;enum nl80211_channel_type channel_type;enum ieee80211_smps_mode smps_mode; +struct cfg80211_p2p_ps p2p_ps; };/**
@@ -1165,6 +1167,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_TX_AMPDU_SETUP_IN_HW =1 <<23 ,IEEE80211_HW_SUPPORTS_CQM_BEACON_MISS =1 <<24 ,IEEE80211_HW_SUPPORTS_CQM_TX_FAIL =1 <<25 , + IEEE80211_HW_SUPPORTS_P2P_PS = 1<<26, };/**
net/mac80211/cfg.c +24 -0
@@ -1722,6 +1722,29 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,return 0 ; } +static int ieee80211_set_p2p_power_mgmt (struct wiphy *wiphy, +struct net_device *dev, +struct cfg80211_p2p_ps *p2p_ps) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); +struct ieee80211_conf *conf = &local->hw.conf; + +if (!(sdata->vif.type ==NL80211_IFTYPE_P2P_CLIENT || + sdata->vif.type ==NL80211_IFTYPE_P2P_GO || + sdata->vif.type ==NL80211_IFTYPE_STATION || + sdata->vif.type ==NL80211_IFTYPE_AP )) +return -EOPNOTSUPP ; + +if (!(local->hw.flags &IEEE80211_HW_SUPPORTS_P2P_PS )) +return -EOPNOTSUPP ; + + conf->p2p_ps = *p2p_ps; +ieee80211_hw_config (local,IEEE80211_CONF_CHANGE_P2P_PS ); + +return 0 ; +} +static int ieee80211_set_cqm_rssi_config (struct wiphy *wiphy,struct net_device *dev,s32 rssi_thold,u32 rssi_hyst)
@@ -2589,4 +2612,5 @@ struct cfg80211_ops mac80211_config_ops = { .set_rekey_data = ieee80211_set_rekey_data, .tdls_oper = ieee80211_tdls_oper, .tdls_mgmt = ieee80211_tdls_mgmt, + .set_p2p_power_mgmt = ieee80211_set_p2p_power_mgmt, };
net/mac80211/ieee80211_i.h +3 -0
@@ -409,6 +409,9 @@ struct ieee80211_if_managed {int wmm_last_param_set; +char p2p_last_ie[255 ]; +u8 p2p_last_ie_len; +u8 use_4addr;/* Signal strength from the last Beacon frame in the current BSS. */
net/mac80211/mlme.c +114 -0
126 lines not on this page · raw message
net/wireless/nl80211.c +119 -0
137 lines not on this page · raw message
net/wireless/util.c +9 -0
@@ -1142,6 +1142,15 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, } } } +if (elen >=4 && pos[0 ] ==0x50 && pos[1 ] ==0x6F && + pos[2 ] ==0x9A ) { +/* P2P OUI (50:6F:9A) */ +if (calc_crc) + crc =crc32_be (crc, pos -2 , elen +2 ); + + elems->p2p_ie = pos; + elems->p2p_ie_len = elen; + }break ;case WLAN_EID_RSN : elems->rsn = pos;
Signature · 1 line
1.7.1
Hi Dmitry,
Some minor comments on this patch:
Note that I'm not a maintainer and that these are comments on the patch itself, not the code it adds.
Quoted 12 lines · Dmitry Tarnyagin
From: Janusz Dziedzic <[email protected]>
Date: Thu, 4 Aug 2011 11:42:16 +0200P2P power save support:
- Opportunistic Power Save
- Notice Of AbsenceSigned-off-by Dmitry Tarnyagin <[email protected]>---
include/linux/nl80211.h | 12 +++++ include/net/cfg80211.h | 34 +++++++++++++ include/net/mac80211.h | 3 +
Quoted 7 lines
net/mac80211/cfg.c | 24 +++++++++
net/mac80211/ieee80211_i.h | 3 +
net/mac80211/mlme.c | 114
++++++++++++++++++++++++++++++++++++++++++
net/wireless/nl80211.c | 119
++++++++++++++++++++++++++++++++++++++++++++
net/wireless/util.c | 9 +++
Same again.
Thanks,
Signature · 5 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/ .Plan: http://sites.google.com/site/juliancalaby/
Johannes Berg
maintainerQuoted 6 lines · Dmitry Tarnyagin
From: Janusz Dziedzic <[email protected]>
Date: Thu, 4 Aug 2011 11:42:16 +0200P2P power save support:
- Opportunistic Power Save
- Notice Of Absence
More explanation please. I know I sound like a broken record but for such a big change you really need more text.
I'm not even going to bother to review the patch in detail. You need to explain why you need to set NoA. There are three reasons this would be used:
1) actually save power
2) do scanning, multi-channel operation, etc.
3) P2P certification testing
Only 3) seems to be useful from userspace, and then maybe it shouldn't be full-blown nl80211 API.
Similarly for the P2P power save stuff. Since you generally lack documentation updates in your patches (read this as criticism) there's no way reason to even look through your patches since they don't explain anything.
FWIW, a very brief glance over this patch tells me that there's at least one obvious, glaring bug in it.
johannes