diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-01-22 06:34:29 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-01-31 08:00:21 -0500 |
commit | cd8f7cb4e6dfa4ea08fc250a814240b883ef7911 (patch) | |
tree | 2bcb8f04f01ee9768e5524799b0d429e51fb583d /include | |
parent | 3b144658bc7be5f7fa68d13ba24afb4c24489965 (diff) |
cfg80211/mac80211: support reporting wakeup reason
When waking up from WoWLAN, it is useful to know
what triggered the wakeup. Support reporting the
wakeup reason(s) in cfg80211 (and a pass-through
in mac80211) to allow userspace to know.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/cfg80211.h | 41 | ||||
-rw-r--r-- | include/net/mac80211.h | 12 | ||||
-rw-r--r-- | include/uapi/linux/nl80211.h | 31 |
3 files changed, 84 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 36e076e374d2..48add7e3ba1d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1597,6 +1597,32 @@ struct cfg80211_wowlan { | |||
1597 | }; | 1597 | }; |
1598 | 1598 | ||
1599 | /** | 1599 | /** |
1600 | * struct cfg80211_wowlan_wakeup - wakeup report | ||
1601 | * @disconnect: woke up by getting disconnected | ||
1602 | * @magic_pkt: woke up by receiving magic packet | ||
1603 | * @gtk_rekey_failure: woke up by GTK rekey failure | ||
1604 | * @eap_identity_req: woke up by EAP identity request packet | ||
1605 | * @four_way_handshake: woke up by 4-way handshake | ||
1606 | * @rfkill_release: woke up by rfkill being released | ||
1607 | * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern | ||
1608 | * @packet_present_len: copied wakeup packet data | ||
1609 | * @packet_len: original wakeup packet length | ||
1610 | * @packet: The packet causing the wakeup, if any. | ||
1611 | * @packet_80211: For pattern match, magic packet and other data | ||
1612 | * frame triggers an 802.3 frame should be reported, for | ||
1613 | * disconnect due to deauth 802.11 frame. This indicates which | ||
1614 | * it is. | ||
1615 | */ | ||
1616 | struct cfg80211_wowlan_wakeup { | ||
1617 | bool disconnect, magic_pkt, gtk_rekey_failure, | ||
1618 | eap_identity_req, four_way_handshake, | ||
1619 | rfkill_release, packet_80211; | ||
1620 | s32 pattern_idx; | ||
1621 | u32 packet_present_len, packet_len; | ||
1622 | const void *packet; | ||
1623 | }; | ||
1624 | |||
1625 | /** | ||
1600 | * struct cfg80211_gtk_rekey_data - rekey data | 1626 | * struct cfg80211_gtk_rekey_data - rekey data |
1601 | * @kek: key encryption key | 1627 | * @kek: key encryption key |
1602 | * @kck: key confirmation key | 1628 | * @kck: key confirmation key |
@@ -3852,6 +3878,21 @@ int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, | |||
3852 | enum ieee80211_p2p_attr_id attr, | 3878 | enum ieee80211_p2p_attr_id attr, |
3853 | u8 *buf, unsigned int bufsize); | 3879 | u8 *buf, unsigned int bufsize); |
3854 | 3880 | ||
3881 | /** | ||
3882 | * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN | ||
3883 | * @wdev: the wireless device reporting the wakeup | ||
3884 | * @wakeup: the wakeup report | ||
3885 | * @gfp: allocation flags | ||
3886 | * | ||
3887 | * This function reports that the given device woke up. If it | ||
3888 | * caused the wakeup, report the reason(s), otherwise you may | ||
3889 | * pass %NULL as the @wakeup parameter to advertise that something | ||
3890 | * else caused the wakeup. | ||
3891 | */ | ||
3892 | void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, | ||
3893 | struct cfg80211_wowlan_wakeup *wakeup, | ||
3894 | gfp_t gfp); | ||
3895 | |||
3855 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3896 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
3856 | 3897 | ||
3857 | /* wiphy_printk helpers, similar to dev_printk */ | 3898 | /* wiphy_printk helpers, similar to dev_printk */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 21831ee57e3c..7a27e00c513a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -4206,4 +4206,16 @@ void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); | |||
4206 | */ | 4206 | */ |
4207 | int ieee80211_ave_rssi(struct ieee80211_vif *vif); | 4207 | int ieee80211_ave_rssi(struct ieee80211_vif *vif); |
4208 | 4208 | ||
4209 | /** | ||
4210 | * ieee80211_report_wowlan_wakeup - report WoWLAN wakeup | ||
4211 | * @vif: virtual interface | ||
4212 | * @wakeup: wakeup reason(s) | ||
4213 | * @gfp: allocation flags | ||
4214 | * | ||
4215 | * See cfg80211_report_wowlan_wakeup(). | ||
4216 | */ | ||
4217 | void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif, | ||
4218 | struct cfg80211_wowlan_wakeup *wakeup, | ||
4219 | gfp_t gfp); | ||
4220 | |||
4209 | #endif /* MAC80211_H */ | 4221 | #endif /* MAC80211_H */ |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 5b7dbc1ea966..225a65e72219 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -513,6 +513,12 @@ | |||
513 | * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For | 513 | * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For |
514 | * more background information, see | 514 | * more background information, see |
515 | * http://wireless.kernel.org/en/users/Documentation/WoWLAN. | 515 | * http://wireless.kernel.org/en/users/Documentation/WoWLAN. |
516 | * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification | ||
517 | * from the driver reporting the wakeup reason. In this case, the | ||
518 | * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason | ||
519 | * for the wakeup, if it was caused by wireless. If it is not present | ||
520 | * in the wakeup notification, the wireless device didn't cause the | ||
521 | * wakeup but reports that it was woken up. | ||
516 | * | 522 | * |
517 | * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver | 523 | * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver |
518 | * the necessary information for supporting GTK rekey offload. This | 524 | * the necessary information for supporting GTK rekey offload. This |
@@ -2947,6 +2953,10 @@ struct nl80211_wowlan_pattern_support { | |||
2947 | * | 2953 | * |
2948 | * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute | 2954 | * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute |
2949 | * carrying a &struct nl80211_wowlan_pattern_support. | 2955 | * carrying a &struct nl80211_wowlan_pattern_support. |
2956 | * | ||
2957 | * When reporting wakeup. it is a u32 attribute containing the 0-based | ||
2958 | * index of the pattern that caused the wakeup, in the patterns passed | ||
2959 | * to the kernel when configuring. | ||
2950 | * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be | 2960 | * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be |
2951 | * used when setting, used only to indicate that GTK rekeying is supported | 2961 | * used when setting, used only to indicate that GTK rekeying is supported |
2952 | * by the device (flag) | 2962 | * by the device (flag) |
@@ -2957,8 +2967,25 @@ struct nl80211_wowlan_pattern_support { | |||
2957 | * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) | 2967 | * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) |
2958 | * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released | 2968 | * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released |
2959 | * (on devices that have rfkill in the device) (flag) | 2969 | * (on devices that have rfkill in the device) (flag) |
2970 | * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211: For wakeup reporting only, contains | ||
2971 | * the 802.11 packet that caused the wakeup, e.g. a deauth frame. The frame | ||
2972 | * may be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN | ||
2973 | * attribute contains the original length. | ||
2974 | * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN: Original length of the 802.11 | ||
2975 | * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211 | ||
2976 | * attribute if the packet was truncated somewhere. | ||
2977 | * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023: For wakeup reporting only, contains the | ||
2978 | * 802.11 packet that caused the wakeup, e.g. a magic packet. The frame may | ||
2979 | * be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN attribute | ||
2980 | * contains the original length. | ||
2981 | * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN: Original length of the 802.3 | ||
2982 | * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023 | ||
2983 | * attribute if the packet was truncated somewhere. | ||
2960 | * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers | 2984 | * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers |
2961 | * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number | 2985 | * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number |
2986 | * | ||
2987 | * These nested attributes are used to configure the wakeup triggers and | ||
2988 | * to report the wakeup reason(s). | ||
2962 | */ | 2989 | */ |
2963 | enum nl80211_wowlan_triggers { | 2990 | enum nl80211_wowlan_triggers { |
2964 | __NL80211_WOWLAN_TRIG_INVALID, | 2991 | __NL80211_WOWLAN_TRIG_INVALID, |
@@ -2971,6 +2998,10 @@ enum nl80211_wowlan_triggers { | |||
2971 | NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, | 2998 | NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, |
2972 | NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, | 2999 | NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, |
2973 | NL80211_WOWLAN_TRIG_RFKILL_RELEASE, | 3000 | NL80211_WOWLAN_TRIG_RFKILL_RELEASE, |
3001 | NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211, | ||
3002 | NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN, | ||
3003 | NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023, | ||
3004 | NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN, | ||
2974 | 3005 | ||
2975 | /* keep last */ | 3006 | /* keep last */ |
2976 | NUM_NL80211_WOWLAN_TRIG, | 3007 | NUM_NL80211_WOWLAN_TRIG, |