aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-05-04 09:37:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-05-05 14:59:19 -0400
commitff1b6e69ad4f31fb3c9c6da2665655f2e798dd70 (patch)
tree6fc049fd0389ffb382ea401096d7bd665642af5c /include
parent8f7f3b2fcc4ccbba0be776049df41a2f96c986ac (diff)
nl80211/cfg80211: WoWLAN support
This is based on (but now quite far from) the original work from Luis and Eliad. Add support for configuring WoWLAN triggers, and getting the configuration out again. Changes from the original patchset are too numerous to list, but one important change needs highlighting: the suspend() callback is passed NULL for the trigger configuration if userspace has not configured WoWLAN at all. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/nl80211.h99
-rw-r--r--include/net/cfg80211.h74
2 files changed, 171 insertions, 2 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index be8df57b789d..a75dea9c416e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -420,6 +420,14 @@
420 * new station with the AUTHENTICATED flag unset and maybe change it later 420 * new station with the AUTHENTICATED flag unset and maybe change it later
421 * depending on the authentication result. 421 * depending on the authentication result.
422 * 422 *
423 * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings.
424 * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings.
425 * Since wireless is more complex than wired ethernet, it supports
426 * various triggers. These triggers can be configured through this
427 * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
428 * more background information, see
429 * http://wireless.kernel.org/en/users/Documentation/WoWLAN.
430 *
423 * @NL80211_CMD_MAX: highest used command number 431 * @NL80211_CMD_MAX: highest used command number
424 * @__NL80211_CMD_AFTER_LAST: internal use 432 * @__NL80211_CMD_AFTER_LAST: internal use
425 */ 433 */
@@ -534,6 +542,9 @@ enum nl80211_commands {
534 542
535 NL80211_CMD_NEW_PEER_CANDIDATE, 543 NL80211_CMD_NEW_PEER_CANDIDATE,
536 544
545 NL80211_CMD_GET_WOWLAN,
546 NL80211_CMD_SET_WOWLAN,
547
537 /* add new commands above here */ 548 /* add new commands above here */
538 549
539 /* used to define NL80211_CMD_MAX below */ 550 /* used to define NL80211_CMD_MAX below */
@@ -903,6 +914,13 @@ enum nl80211_commands {
903 * allows auth frames in a mesh to be passed to userspace for processing via 914 * allows auth frames in a mesh to be passed to userspace for processing via
904 * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. 915 * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag.
905 * 916 *
917 * @NL80211_ATTR_WOWLAN_SUPPORTED: indicates, as part of the wiphy capabilities,
918 * the supported WoWLAN triggers
919 * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to
920 * indicate which WoW triggers should be enabled. This is also
921 * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
922 * triggers.
923 *
906 * @NL80211_ATTR_MAX: highest attribute number currently defined 924 * @NL80211_ATTR_MAX: highest attribute number currently defined
907 * @__NL80211_ATTR_AFTER_LAST: internal use 925 * @__NL80211_ATTR_AFTER_LAST: internal use
908 */ 926 */
@@ -1092,6 +1110,9 @@ enum nl80211_attrs {
1092 1110
1093 NL80211_ATTR_SUPPORT_MESH_AUTH, 1111 NL80211_ATTR_SUPPORT_MESH_AUTH,
1094 1112
1113 NL80211_ATTR_WOWLAN_TRIGGERS,
1114 NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
1115
1095 /* add attributes here, update the policy in nl80211.c */ 1116 /* add attributes here, update the policy in nl80211.c */
1096 1117
1097 __NL80211_ATTR_AFTER_LAST, 1118 __NL80211_ATTR_AFTER_LAST,
@@ -2061,4 +2082,82 @@ enum nl80211_tx_power_setting {
2061 NL80211_TX_POWER_FIXED, 2082 NL80211_TX_POWER_FIXED,
2062}; 2083};
2063 2084
2085/**
2086 * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute
2087 * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute
2088 * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has
2089 * a zero bit are ignored
2090 * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have
2091 * a bit for each byte in the pattern. The lowest-order bit corresponds
2092 * to the first byte of the pattern, but the bytes of the pattern are
2093 * in a little-endian-like format, i.e. the 9th byte of the pattern
2094 * corresponds to the lowest-order bit in the second byte of the mask.
2095 * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where
2096 * xx indicates "don't care") would be represented by a pattern of
2097 * twelve zero bytes, and a mask of "0xed,0x07".
2098 * Note that the pattern matching is done as though frames were not
2099 * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
2100 * first (including SNAP header unpacking) and then matched.
2101 * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
2102 * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
2103 */
2104enum nl80211_wowlan_packet_pattern_attr {
2105 __NL80211_WOWLAN_PKTPAT_INVALID,
2106 NL80211_WOWLAN_PKTPAT_MASK,
2107 NL80211_WOWLAN_PKTPAT_PATTERN,
2108
2109 NUM_NL80211_WOWLAN_PKTPAT,
2110 MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
2111};
2112
2113/**
2114 * struct nl80211_wowlan_pattern_support - pattern support information
2115 * @max_patterns: maximum number of patterns supported
2116 * @min_pattern_len: minimum length of each pattern
2117 * @max_pattern_len: maximum length of each pattern
2118 *
2119 * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
2120 * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
2121 * capability information given by the kernel to userspace.
2122 */
2123struct nl80211_wowlan_pattern_support {
2124 __u32 max_patterns;
2125 __u32 min_pattern_len;
2126 __u32 max_pattern_len;
2127} __attribute__((packed));
2128
2129/**
2130 * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
2131 * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
2132 * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
2133 * the chip into a special state -- works best with chips that have
2134 * support for low-power operation already (flag)
2135 * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
2136 * is detected is implementation-specific (flag)
2137 * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
2138 * by 16 repetitions of MAC addr, anywhere in payload) (flag)
2139 * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns
2140 * which are passed in an array of nested attributes, each nested attribute
2141 * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern.
2142 * Each pattern defines a wakeup packet. The matching is done on the MSDU,
2143 * i.e. as though the packet was an 802.3 packet, so the pattern matching
2144 * is done after the packet is converted to the MSDU.
2145 *
2146 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
2147 * carrying a &struct nl80211_wowlan_pattern_support.
2148 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
2149 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
2150 */
2151enum nl80211_wowlan_triggers {
2152 __NL80211_WOWLAN_TRIG_INVALID,
2153 NL80211_WOWLAN_TRIG_ANY,
2154 NL80211_WOWLAN_TRIG_DISCONNECT,
2155 NL80211_WOWLAN_TRIG_MAGIC_PKT,
2156 NL80211_WOWLAN_TRIG_PKT_PATTERN,
2157
2158 /* keep last */
2159 NUM_NL80211_WOWLAN_TRIG,
2160 MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
2161};
2162
2064#endif /* __LINUX_NL80211_H */ 2163#endif /* __LINUX_NL80211_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 4932dfcb72b4..0920daf36807 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1088,6 +1088,38 @@ struct cfg80211_pmksa {
1088}; 1088};
1089 1089
1090/** 1090/**
1091 * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern
1092 * @mask: bitmask where to match pattern and where to ignore bytes,
1093 * one bit per byte, in same format as nl80211
1094 * @pattern: bytes to match where bitmask is 1
1095 * @pattern_len: length of pattern (in bytes)
1096 *
1097 * Internal note: @mask and @pattern are allocated in one chunk of
1098 * memory, free @mask only!
1099 */
1100struct cfg80211_wowlan_trig_pkt_pattern {
1101 u8 *mask, *pattern;
1102 int pattern_len;
1103};
1104
1105/**
1106 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
1107 *
1108 * This structure defines the enabled WoWLAN triggers for the device.
1109 * @any: wake up on any activity -- special trigger if device continues
1110 * operating as normal during suspend
1111 * @disconnect: wake up if getting disconnected
1112 * @magic_pkt: wake up on receiving magic packet
1113 * @patterns: wake up on receiving packet matching a pattern
1114 * @n_patterns: number of patterns
1115 */
1116struct cfg80211_wowlan {
1117 bool any, disconnect, magic_pkt;
1118 struct cfg80211_wowlan_trig_pkt_pattern *patterns;
1119 int n_patterns;
1120};
1121
1122/**
1091 * struct cfg80211_ops - backend description for wireless configuration 1123 * struct cfg80211_ops - backend description for wireless configuration
1092 * 1124 *
1093 * This struct is registered by fullmac card drivers and/or wireless stacks 1125 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -1100,7 +1132,9 @@ struct cfg80211_pmksa {
1100 * wireless extensions but this is subject to reevaluation as soon as this 1132 * wireless extensions but this is subject to reevaluation as soon as this
1101 * code is used more widely and we have a first user without wext. 1133 * code is used more widely and we have a first user without wext.
1102 * 1134 *
1103 * @suspend: wiphy device needs to be suspended 1135 * @suspend: wiphy device needs to be suspended. The variable @wow will
1136 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
1137 * configured for the device.
1104 * @resume: wiphy device needs to be resumed 1138 * @resume: wiphy device needs to be resumed
1105 * 1139 *
1106 * @add_virtual_intf: create a new virtual interface with the given name, 1140 * @add_virtual_intf: create a new virtual interface with the given name,
@@ -1244,7 +1278,7 @@ struct cfg80211_pmksa {
1244 * @get_ringparam: Get tx and rx ring current and maximum sizes. 1278 * @get_ringparam: Get tx and rx ring current and maximum sizes.
1245 */ 1279 */
1246struct cfg80211_ops { 1280struct cfg80211_ops {
1247 int (*suspend)(struct wiphy *wiphy); 1281 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
1248 int (*resume)(struct wiphy *wiphy); 1282 int (*resume)(struct wiphy *wiphy);
1249 1283
1250 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1284 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy,
@@ -1480,6 +1514,38 @@ struct ieee80211_txrx_stypes {
1480}; 1514};
1481 1515
1482/** 1516/**
1517 * enum wiphy_wowlan_support_flags - WoWLAN support flags
1518 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
1519 * trigger that keeps the device operating as-is and
1520 * wakes up the host on any activity, for example a
1521 * received packet that passed filtering; note that the
1522 * packet should be preserved in that case
1523 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
1524 * (see nl80211.h)
1525 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
1526 */
1527enum wiphy_wowlan_support_flags {
1528 WIPHY_WOWLAN_ANY = BIT(0),
1529 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
1530 WIPHY_WOWLAN_DISCONNECT = BIT(2),
1531};
1532
1533/**
1534 * struct wiphy_wowlan_support - WoWLAN support data
1535 * @flags: see &enum wiphy_wowlan_support_flags
1536 * @n_patterns: number of supported wakeup patterns
1537 * (see nl80211.h for the pattern definition)
1538 * @pattern_max_len: maximum length of each pattern
1539 * @pattern_min_len: minimum length of each pattern
1540 */
1541struct wiphy_wowlan_support {
1542 u32 flags;
1543 int n_patterns;
1544 int pattern_max_len;
1545 int pattern_min_len;
1546};
1547
1548/**
1483 * struct wiphy - wireless hardware description 1549 * struct wiphy - wireless hardware description
1484 * @reg_notifier: the driver's regulatory notification callback, 1550 * @reg_notifier: the driver's regulatory notification callback,
1485 * note that if your driver uses wiphy_apply_custom_regulatory() 1551 * note that if your driver uses wiphy_apply_custom_regulatory()
@@ -1546,6 +1612,8 @@ struct ieee80211_txrx_stypes {
1546 * 1612 *
1547 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 1613 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
1548 * may request, if implemented. 1614 * may request, if implemented.
1615 *
1616 * @wowlan: WoWLAN support information
1549 */ 1617 */
1550struct wiphy { 1618struct wiphy {
1551 /* assign these fields before you register the wiphy */ 1619 /* assign these fields before you register the wiphy */
@@ -1583,6 +1651,8 @@ struct wiphy {
1583 char fw_version[ETHTOOL_BUSINFO_LEN]; 1651 char fw_version[ETHTOOL_BUSINFO_LEN];
1584 u32 hw_version; 1652 u32 hw_version;
1585 1653
1654 struct wiphy_wowlan_support wowlan;
1655
1586 u16 max_remain_on_channel_duration; 1656 u16 max_remain_on_channel_duration;
1587 1657
1588 u8 max_num_pmkids; 1658 u8 max_num_pmkids;