aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-06-03 11:25:34 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-06-03 12:43:34 -0400
commit964dc9e2c3aaccacacd40640964a58544fb5769a (patch)
tree3457e7dfc23df7d2477b57d346886031cb7361d9
parente05ecccdf752122a439b03c3190458d2c8f0bac6 (diff)
cfg80211: take WoWLAN support information out of wiphy struct
There's no need to take up the space for devices that don't support WoWLAN, and most drivers can even make the support data static const (except where it's modified at runtime.) Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c24
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c20
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/dev.h3
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c17
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c26
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h1
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c16
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c19
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/mac80211/main.c3
-rw-r--r--net/wireless/core.c20
-rw-r--r--net/wireless/nl80211.c56
12 files changed, 115 insertions, 92 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 5c9736a94e54..f7995b2b12a4 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3679,6 +3679,20 @@ err:
3679 return NULL; 3679 return NULL;
3680} 3680}
3681 3681
3682#ifdef CONFIG_PM
3683static const struct wiphy_wowlan_support ath6kl_wowlan_support = {
3684 .flags = WIPHY_WOWLAN_MAGIC_PKT |
3685 WIPHY_WOWLAN_DISCONNECT |
3686 WIPHY_WOWLAN_GTK_REKEY_FAILURE |
3687 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
3688 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
3689 WIPHY_WOWLAN_4WAY_HANDSHAKE,
3690 .n_patterns = WOW_MAX_FILTERS_PER_LIST,
3691 .pattern_min_len = 1,
3692 .pattern_max_len = WOW_PATTERN_SIZE,
3693};
3694#endif
3695
3682int ath6kl_cfg80211_init(struct ath6kl *ar) 3696int ath6kl_cfg80211_init(struct ath6kl *ar)
3683{ 3697{
3684 struct wiphy *wiphy = ar->wiphy; 3698 struct wiphy *wiphy = ar->wiphy;
@@ -3772,15 +3786,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
3772 wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); 3786 wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
3773 3787
3774#ifdef CONFIG_PM 3788#ifdef CONFIG_PM
3775 wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | 3789 wiphy->wowlan = &ath6kl_wowlan_support;
3776 WIPHY_WOWLAN_DISCONNECT |
3777 WIPHY_WOWLAN_GTK_REKEY_FAILURE |
3778 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
3779 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
3780 WIPHY_WOWLAN_4WAY_HANDSHAKE;
3781 wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST;
3782 wiphy->wowlan.pattern_min_len = 1;
3783 wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
3784#endif 3790#endif
3785 3791
3786 wiphy->max_sched_scan_ssids = MAX_PROBED_SSIDS; 3792 wiphy->max_sched_scan_ssids = MAX_PROBED_SSIDS;
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 0237b2868961..f993362e9e13 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -755,6 +755,15 @@ static const struct ieee80211_iface_combination if_comb[] = {
755 } 755 }
756}; 756};
757 757
758#ifdef CONFIG_PM
759static const struct wiphy_wowlan_support ath9k_wowlan_support = {
760 .flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
761 .n_patterns = MAX_NUM_USER_PATTERN,
762 .pattern_min_len = 1,
763 .pattern_max_len = MAX_PATTERN_SIZE,
764};
765#endif
766
758void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) 767void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
759{ 768{
760 struct ath_hw *ah = sc->sc_ah; 769 struct ath_hw *ah = sc->sc_ah;
@@ -797,15 +806,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
797#ifdef CONFIG_PM_SLEEP 806#ifdef CONFIG_PM_SLEEP
798 807
799 if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) && 808 if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) &&
800 device_can_wakeup(sc->dev)) { 809 device_can_wakeup(sc->dev))
801 810 hw->wiphy->wowlan = &ath9k_wowlan_support;
802 hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
803 WIPHY_WOWLAN_DISCONNECT;
804 hw->wiphy->wowlan.n_patterns = MAX_NUM_USER_PATTERN;
805 hw->wiphy->wowlan.pattern_min_len = 1;
806 hw->wiphy->wowlan.pattern_max_len = MAX_PATTERN_SIZE;
807
808 }
809 811
810 atomic_set(&sc->wow_sleep_proc_intr, -1); 812 atomic_set(&sc->wow_sleep_proc_intr, -1);
811 atomic_set(&sc->wow_got_bmiss_intr, -1); 813 atomic_set(&sc->wow_got_bmiss_intr, -1);
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index 71ea77576d22..e71acfd344aa 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -870,6 +870,9 @@ struct iwl_priv {
870 __le64 replay_ctr; 870 __le64 replay_ctr;
871 __le16 last_seq_ctl; 871 __le16 last_seq_ctl;
872 bool have_rekey_data; 872 bool have_rekey_data;
873#ifdef CONFIG_PM_SLEEP
874 struct wiphy_wowlan_support wowlan_support;
875#endif
873 876
874 /* device_pointers: pointers to ucode event tables */ 877 /* device_pointers: pointers to ucode event tables */
875 struct { 878 struct {
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index cab23af0be9e..661b5e71aac8 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -208,20 +208,21 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
208 priv->trans->ops->d3_suspend && 208 priv->trans->ops->d3_suspend &&
209 priv->trans->ops->d3_resume && 209 priv->trans->ops->d3_resume &&
210 device_can_wakeup(priv->trans->dev)) { 210 device_can_wakeup(priv->trans->dev)) {
211 hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | 211 priv->wowlan_support.flags = WIPHY_WOWLAN_MAGIC_PKT |
212 WIPHY_WOWLAN_DISCONNECT | 212 WIPHY_WOWLAN_DISCONNECT |
213 WIPHY_WOWLAN_EAP_IDENTITY_REQ | 213 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
214 WIPHY_WOWLAN_RFKILL_RELEASE; 214 WIPHY_WOWLAN_RFKILL_RELEASE;
215 if (!iwlwifi_mod_params.sw_crypto) 215 if (!iwlwifi_mod_params.sw_crypto)
216 hw->wiphy->wowlan.flags |= 216 priv->wowlan_support.flags |=
217 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | 217 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
218 WIPHY_WOWLAN_GTK_REKEY_FAILURE; 218 WIPHY_WOWLAN_GTK_REKEY_FAILURE;
219 219
220 hw->wiphy->wowlan.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS; 220 priv->wowlan_support.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS;
221 hw->wiphy->wowlan.pattern_min_len = 221 priv->wowlan_support.pattern_min_len =
222 IWLAGN_WOWLAN_MIN_PATTERN_LEN; 222 IWLAGN_WOWLAN_MIN_PATTERN_LEN;
223 hw->wiphy->wowlan.pattern_max_len = 223 priv->wowlan_support.pattern_max_len =
224 IWLAGN_WOWLAN_MAX_PATTERN_LEN; 224 IWLAGN_WOWLAN_MAX_PATTERN_LEN;
225 hw->wiphy->wowlan = &priv->wowlan_support;
225 } 226 }
226#endif 227#endif
227 228
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index dd158ec571fb..827fa641490f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -222,20 +222,20 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
222 mvm->trans->ops->d3_suspend && 222 mvm->trans->ops->d3_suspend &&
223 mvm->trans->ops->d3_resume && 223 mvm->trans->ops->d3_resume &&
224 device_can_wakeup(mvm->trans->dev)) { 224 device_can_wakeup(mvm->trans->dev)) {
225 hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT | 225 mvm->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
226 WIPHY_WOWLAN_DISCONNECT | 226 WIPHY_WOWLAN_DISCONNECT |
227 WIPHY_WOWLAN_EAP_IDENTITY_REQ | 227 WIPHY_WOWLAN_EAP_IDENTITY_REQ |
228 WIPHY_WOWLAN_RFKILL_RELEASE; 228 WIPHY_WOWLAN_RFKILL_RELEASE;
229 if (!iwlwifi_mod_params.sw_crypto) 229 if (!iwlwifi_mod_params.sw_crypto)
230 hw->wiphy->wowlan.flags |= 230 mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
231 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | 231 WIPHY_WOWLAN_GTK_REKEY_FAILURE |
232 WIPHY_WOWLAN_GTK_REKEY_FAILURE | 232 WIPHY_WOWLAN_4WAY_HANDSHAKE;
233 WIPHY_WOWLAN_4WAY_HANDSHAKE; 233
234 234 mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS;
235 hw->wiphy->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS; 235 mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN;
236 hw->wiphy->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN; 236 mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN;
237 hw->wiphy->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN; 237 mvm->wowlan.tcp = &iwl_mvm_wowlan_tcp_support;
238 hw->wiphy->wowlan.tcp = &iwl_mvm_wowlan_tcp_support; 238 hw->wiphy->wowlan = &mvm->wowlan;
239 } 239 }
240#endif 240#endif
241 241
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 8269bc562951..b62a948658ac 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -336,6 +336,7 @@ struct iwl_mvm {
336 struct ieee80211_vif *p2p_device_vif; 336 struct ieee80211_vif *p2p_device_vif;
337 337
338#ifdef CONFIG_PM_SLEEP 338#ifdef CONFIG_PM_SLEEP
339 struct wiphy_wowlan_support wowlan;
339 int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen; 340 int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
340#endif 341#endif
341 342
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index e42b266a023a..60077895adff 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -2426,6 +2426,16 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
2426#endif 2426#endif
2427}; 2427};
2428 2428
2429#ifdef CONFIG_PM
2430static const struct wiphy_wowlan_support mwifiex_wowlan_support = {
2431 .flags = WIPHY_WOWLAN_MAGIC_PKT,
2432 .n_patterns = MWIFIEX_MAX_FILTERS,
2433 .pattern_min_len = 1,
2434 .pattern_max_len = MWIFIEX_MAX_PATTERN_LEN,
2435 .max_pkt_offset = MWIFIEX_MAX_OFFSET_LEN,
2436};
2437#endif
2438
2429/* 2439/*
2430 * This function registers the device with CFG802.11 subsystem. 2440 * This function registers the device with CFG802.11 subsystem.
2431 * 2441 *
@@ -2483,11 +2493,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
2483 wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom); 2493 wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom);
2484 2494
2485#ifdef CONFIG_PM 2495#ifdef CONFIG_PM
2486 wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT; 2496 wiphy->wowlan = &mwifiex_wowlan_support;
2487 wiphy->wowlan.n_patterns = MWIFIEX_MAX_FILTERS;
2488 wiphy->wowlan.pattern_min_len = 1;
2489 wiphy->wowlan.pattern_max_len = MWIFIEX_MAX_PATTERN_LEN;
2490 wiphy->wowlan.max_pkt_offset = MWIFIEX_MAX_OFFSET_LEN;
2491#endif 2497#endif
2492 2498
2493 wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | 2499 wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 953111a502ee..796928ba875f 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -6018,6 +6018,15 @@ int wlcore_free_hw(struct wl1271 *wl)
6018} 6018}
6019EXPORT_SYMBOL_GPL(wlcore_free_hw); 6019EXPORT_SYMBOL_GPL(wlcore_free_hw);
6020 6020
6021#ifdef CONFIG_PM
6022static const struct wiphy_wowlan_support wlcore_wowlan_support = {
6023 .flags = WIPHY_WOWLAN_ANY,
6024 .n_patterns = WL1271_MAX_RX_FILTERS,
6025 .pattern_min_len = 1,
6026 .pattern_max_len = WL1271_RX_FILTER_MAX_PATTERN_SIZE,
6027};
6028#endif
6029
6021static void wlcore_nvs_cb(const struct firmware *fw, void *context) 6030static void wlcore_nvs_cb(const struct firmware *fw, void *context)
6022{ 6031{
6023 struct wl1271 *wl = context; 6032 struct wl1271 *wl = context;
@@ -6071,14 +6080,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
6071 if (!ret) { 6080 if (!ret) {
6072 wl->irq_wake_enabled = true; 6081 wl->irq_wake_enabled = true;
6073 device_init_wakeup(wl->dev, 1); 6082 device_init_wakeup(wl->dev, 1);
6074 if (pdata->pwr_in_suspend) { 6083 if (pdata->pwr_in_suspend)
6075 wl->hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY; 6084 wl->hw->wiphy->wowlan = &wlcore_wowlan_support;
6076 wl->hw->wiphy->wowlan.n_patterns =
6077 WL1271_MAX_RX_FILTERS;
6078 wl->hw->wiphy->wowlan.pattern_min_len = 1;
6079 wl->hw->wiphy->wowlan.pattern_max_len =
6080 WL1271_RX_FILTER_MAX_PATTERN_SIZE;
6081 }
6082 } 6085 }
6083#endif 6086#endif
6084 disable_irq(wl->irq); 6087 disable_irq(wl->irq);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 6dd19593e333..6169fca216b4 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2654,7 +2654,7 @@ struct wiphy {
2654 u32 hw_version; 2654 u32 hw_version;
2655 2655
2656#ifdef CONFIG_PM 2656#ifdef CONFIG_PM
2657 struct wiphy_wowlan_support wowlan; 2657 const struct wiphy_wowlan_support *wowlan;
2658 struct cfg80211_wowlan *wowlan_config; 2658 struct cfg80211_wowlan *wowlan_config;
2659#endif 2659#endif
2660 2660
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 1998f1475267..626c83c042d7 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -686,8 +686,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
686 return -EINVAL; 686 return -EINVAL;
687 687
688#ifdef CONFIG_PM 688#ifdef CONFIG_PM
689 if ((hw->wiphy->wowlan.flags || hw->wiphy->wowlan.n_patterns) && 689 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
690 (!local->ops->suspend || !local->ops->resume))
691 return -EINVAL; 690 return -EINVAL;
692#endif 691#endif
693 692
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 41cec1776f4f..f553b9484c1e 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -449,8 +449,13 @@ int wiphy_register(struct wiphy *wiphy)
449 u16 ifmodes = wiphy->interface_modes; 449 u16 ifmodes = wiphy->interface_modes;
450 450
451#ifdef CONFIG_PM 451#ifdef CONFIG_PM
452 if (WARN_ON((wiphy->wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && 452 if (WARN_ON(wiphy->wowlan &&
453 !(wiphy->wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY))) 453 (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
454 !(wiphy->wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY)))
455 return -EINVAL;
456 if (WARN_ON(wiphy->wowlan &&
457 !wiphy->wowlan->flags && !wiphy->wowlan->n_patterns &&
458 !wiphy->wowlan->tcp))
454 return -EINVAL; 459 return -EINVAL;
455#endif 460#endif
456 461
@@ -540,12 +545,11 @@ int wiphy_register(struct wiphy *wiphy)
540 } 545 }
541 546
542#ifdef CONFIG_PM 547#ifdef CONFIG_PM
543 if (rdev->wiphy.wowlan.n_patterns) { 548 if (WARN_ON(rdev->wiphy.wowlan && rdev->wiphy.wowlan->n_patterns &&
544 if (WARN_ON(!rdev->wiphy.wowlan.pattern_min_len || 549 (!rdev->wiphy.wowlan->pattern_min_len ||
545 rdev->wiphy.wowlan.pattern_min_len > 550 rdev->wiphy.wowlan->pattern_min_len >
546 rdev->wiphy.wowlan.pattern_max_len)) 551 rdev->wiphy.wowlan->pattern_max_len)))
547 return -EINVAL; 552 return -EINVAL;
548 }
549#endif 553#endif
550 554
551 /* check and set up bitrates */ 555 /* check and set up bitrates */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 31d265f36d2c..7ee9af3283a8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -908,7 +908,7 @@ nla_put_failure:
908static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev, 908static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev,
909 struct sk_buff *msg) 909 struct sk_buff *msg)
910{ 910{
911 const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan.tcp; 911 const struct wiphy_wowlan_tcp_support *tcp = rdev->wiphy.wowlan->tcp;
912 struct nlattr *nl_tcp; 912 struct nlattr *nl_tcp;
913 913
914 if (!tcp) 914 if (!tcp)
@@ -951,37 +951,37 @@ static int nl80211_send_wowlan(struct sk_buff *msg,
951{ 951{
952 struct nlattr *nl_wowlan; 952 struct nlattr *nl_wowlan;
953 953
954 if (!dev->wiphy.wowlan.flags && !dev->wiphy.wowlan.n_patterns) 954 if (!dev->wiphy.wowlan)
955 return 0; 955 return 0;
956 956
957 nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); 957 nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED);
958 if (!nl_wowlan) 958 if (!nl_wowlan)
959 return -ENOBUFS; 959 return -ENOBUFS;
960 960
961 if (((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_ANY) && 961 if (((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) &&
962 nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || 962 nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) ||
963 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_DISCONNECT) && 963 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) &&
964 nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || 964 nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) ||
965 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_MAGIC_PKT) && 965 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) &&
966 nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || 966 nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) ||
967 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && 967 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) &&
968 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || 968 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) ||
969 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && 969 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
970 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || 970 nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) ||
971 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && 971 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) &&
972 nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || 972 nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) ||
973 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && 973 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) &&
974 nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || 974 nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) ||
975 ((dev->wiphy.wowlan.flags & WIPHY_WOWLAN_RFKILL_RELEASE) && 975 ((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) &&
976 nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) 976 nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE)))
977 return -ENOBUFS; 977 return -ENOBUFS;
978 978
979 if (dev->wiphy.wowlan.n_patterns) { 979 if (dev->wiphy.wowlan->n_patterns) {
980 struct nl80211_wowlan_pattern_support pat = { 980 struct nl80211_wowlan_pattern_support pat = {
981 .max_patterns = dev->wiphy.wowlan.n_patterns, 981 .max_patterns = dev->wiphy.wowlan->n_patterns,
982 .min_pattern_len = dev->wiphy.wowlan.pattern_min_len, 982 .min_pattern_len = dev->wiphy.wowlan->pattern_min_len,
983 .max_pattern_len = dev->wiphy.wowlan.pattern_max_len, 983 .max_pattern_len = dev->wiphy.wowlan->pattern_max_len,
984 .max_pkt_offset = dev->wiphy.wowlan.max_pkt_offset, 984 .max_pkt_offset = dev->wiphy.wowlan->max_pkt_offset,
985 }; 985 };
986 986
987 if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, 987 if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN,
@@ -7580,8 +7580,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
7580 void *hdr; 7580 void *hdr;
7581 u32 size = NLMSG_DEFAULT_SIZE; 7581 u32 size = NLMSG_DEFAULT_SIZE;
7582 7582
7583 if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns && 7583 if (!rdev->wiphy.wowlan)
7584 !rdev->wiphy.wowlan.tcp)
7585 return -EOPNOTSUPP; 7584 return -EOPNOTSUPP;
7586 7585
7587 if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) { 7586 if (rdev->wiphy.wowlan_config && rdev->wiphy.wowlan_config->tcp) {
@@ -7654,7 +7653,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7654 u32 data_size, wake_size, tokens_size = 0, wake_mask_size; 7653 u32 data_size, wake_size, tokens_size = 0, wake_mask_size;
7655 int err, port; 7654 int err, port;
7656 7655
7657 if (!rdev->wiphy.wowlan.tcp) 7656 if (!rdev->wiphy.wowlan->tcp)
7658 return -EINVAL; 7657 return -EINVAL;
7659 7658
7660 err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP, 7659 err = nla_parse(tb, MAX_NL80211_WOWLAN_TCP,
@@ -7674,16 +7673,16 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7674 return -EINVAL; 7673 return -EINVAL;
7675 7674
7676 data_size = nla_len(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD]); 7675 data_size = nla_len(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD]);
7677 if (data_size > rdev->wiphy.wowlan.tcp->data_payload_max) 7676 if (data_size > rdev->wiphy.wowlan->tcp->data_payload_max)
7678 return -EINVAL; 7677 return -EINVAL;
7679 7678
7680 if (nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) > 7679 if (nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) >
7681 rdev->wiphy.wowlan.tcp->data_interval_max || 7680 rdev->wiphy.wowlan->tcp->data_interval_max ||
7682 nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) == 0) 7681 nla_get_u32(tb[NL80211_WOWLAN_TCP_DATA_INTERVAL]) == 0)
7683 return -EINVAL; 7682 return -EINVAL;
7684 7683
7685 wake_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_PAYLOAD]); 7684 wake_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_PAYLOAD]);
7686 if (wake_size > rdev->wiphy.wowlan.tcp->wake_payload_max) 7685 if (wake_size > rdev->wiphy.wowlan->tcp->wake_payload_max)
7687 return -EINVAL; 7686 return -EINVAL;
7688 7687
7689 wake_mask_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_MASK]); 7688 wake_mask_size = nla_len(tb[NL80211_WOWLAN_TCP_WAKE_MASK]);
@@ -7698,13 +7697,13 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7698 7697
7699 if (!tok->len || tokens_size % tok->len) 7698 if (!tok->len || tokens_size % tok->len)
7700 return -EINVAL; 7699 return -EINVAL;
7701 if (!rdev->wiphy.wowlan.tcp->tok) 7700 if (!rdev->wiphy.wowlan->tcp->tok)
7702 return -EINVAL; 7701 return -EINVAL;
7703 if (tok->len > rdev->wiphy.wowlan.tcp->tok->max_len) 7702 if (tok->len > rdev->wiphy.wowlan->tcp->tok->max_len)
7704 return -EINVAL; 7703 return -EINVAL;
7705 if (tok->len < rdev->wiphy.wowlan.tcp->tok->min_len) 7704 if (tok->len < rdev->wiphy.wowlan->tcp->tok->min_len)
7706 return -EINVAL; 7705 return -EINVAL;
7707 if (tokens_size > rdev->wiphy.wowlan.tcp->tok->bufsize) 7706 if (tokens_size > rdev->wiphy.wowlan->tcp->tok->bufsize)
7708 return -EINVAL; 7707 return -EINVAL;
7709 if (tok->offset + tok->len > data_size) 7708 if (tok->offset + tok->len > data_size)
7710 return -EINVAL; 7709 return -EINVAL;
@@ -7712,7 +7711,7 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
7712 7711
7713 if (tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]) { 7712 if (tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]) {
7714 seq = nla_data(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]); 7713 seq = nla_data(tb[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ]);
7715 if (!rdev->wiphy.wowlan.tcp->seq) 7714 if (!rdev->wiphy.wowlan->tcp->seq)
7716 return -EINVAL; 7715 return -EINVAL;
7717 if (seq->len == 0 || seq->len > 4) 7716 if (seq->len == 0 || seq->len > 4)
7718 return -EINVAL; 7717 return -EINVAL;
@@ -7793,12 +7792,11 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
7793 struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG]; 7792 struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
7794 struct cfg80211_wowlan new_triggers = {}; 7793 struct cfg80211_wowlan new_triggers = {};
7795 struct cfg80211_wowlan *ntrig; 7794 struct cfg80211_wowlan *ntrig;
7796 struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan; 7795 const struct wiphy_wowlan_support *wowlan = rdev->wiphy.wowlan;
7797 int err, i; 7796 int err, i;
7798 bool prev_enabled = rdev->wiphy.wowlan_config; 7797 bool prev_enabled = rdev->wiphy.wowlan_config;
7799 7798
7800 if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns && 7799 if (!wowlan)
7801 !rdev->wiphy.wowlan.tcp)
7802 return -EOPNOTSUPP; 7800 return -EOPNOTSUPP;
7803 7801
7804 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) { 7802 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {