Skip to content

Commit 964dc9e

Browse files
committed
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>
1 parent e05eccc commit 964dc9e

12 files changed

Lines changed: 115 additions & 92 deletions

File tree

‎drivers/net/wireless/ath/ath6kl/cfg80211.c‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3679,6 +3679,20 @@ struct wireless_dev *ath6kl_interface_add(struct ath6kl *ar, const char *name,
36793679
return NULL;
36803680
}
36813681

3682+
#ifdef CONFIG_PM
3683+
static 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+
36823696
int ath6kl_cfg80211_init(struct ath6kl *ar)
36833697
{
36843698
struct wiphy *wiphy = ar->wiphy;
@@ -3772,15 +3786,7 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
37723786
wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
37733787

37743788
#ifdef CONFIG_PM
3775-
wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
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;
3789+
wiphy->wowlan = &ath6kl_wowlan_support;
37843790
#endif
37853791

37863792
wiphy->max_sched_scan_ssids = MAX_PROBED_SSIDS;

‎drivers/net/wireless/ath/ath9k/init.c‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,15 @@ static const struct ieee80211_iface_combination if_comb[] = {
755755
}
756756
};
757757

758+
#ifdef CONFIG_PM
759+
static 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+
758767
void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
759768
{
760769
struct ath_hw *ah = sc->sc_ah;
@@ -797,15 +806,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
797806
#ifdef CONFIG_PM_SLEEP
798807

799808
if ((ah->caps.hw_caps & ATH9K_HW_WOW_DEVICE_CAPABLE) &&
800-
device_can_wakeup(sc->dev)) {
801-
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+
device_can_wakeup(sc->dev))
810+
hw->wiphy->wowlan = &ath9k_wowlan_support;
809811

810812
atomic_set(&sc->wow_sleep_proc_intr, -1);
811813
atomic_set(&sc->wow_got_bmiss_intr, -1);

‎drivers/net/wireless/iwlwifi/dvm/dev.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,9 @@ struct iwl_priv {
870870
__le64 replay_ctr;
871871
__le16 last_seq_ctl;
872872
bool have_rekey_data;
873+
#ifdef CONFIG_PM_SLEEP
874+
struct wiphy_wowlan_support wowlan_support;
875+
#endif
873876

874877
/* device_pointers: pointers to ucode event tables */
875878
struct {

‎drivers/net/wireless/iwlwifi/dvm/mac80211.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,21 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
208208
priv->trans->ops->d3_suspend &&
209209
priv->trans->ops->d3_resume &&
210210
device_can_wakeup(priv->trans->dev)) {
211-
hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
212-
WIPHY_WOWLAN_DISCONNECT |
213-
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
214-
WIPHY_WOWLAN_RFKILL_RELEASE;
211+
priv->wowlan_support.flags = WIPHY_WOWLAN_MAGIC_PKT |
212+
WIPHY_WOWLAN_DISCONNECT |
213+
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
214+
WIPHY_WOWLAN_RFKILL_RELEASE;
215215
if (!iwlwifi_mod_params.sw_crypto)
216-
hw->wiphy->wowlan.flags |=
216+
priv->wowlan_support.flags |=
217217
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
218218
WIPHY_WOWLAN_GTK_REKEY_FAILURE;
219219

220-
hw->wiphy->wowlan.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS;
221-
hw->wiphy->wowlan.pattern_min_len =
220+
priv->wowlan_support.n_patterns = IWLAGN_WOWLAN_MAX_PATTERNS;
221+
priv->wowlan_support.pattern_min_len =
222222
IWLAGN_WOWLAN_MIN_PATTERN_LEN;
223-
hw->wiphy->wowlan.pattern_max_len =
223+
priv->wowlan_support.pattern_max_len =
224224
IWLAGN_WOWLAN_MAX_PATTERN_LEN;
225+
hw->wiphy->wowlan = &priv->wowlan_support;
225226
}
226227
#endif
227228

‎drivers/net/wireless/iwlwifi/mvm/mac80211.c‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,20 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
222222
mvm->trans->ops->d3_suspend &&
223223
mvm->trans->ops->d3_resume &&
224224
device_can_wakeup(mvm->trans->dev)) {
225-
hw->wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
226-
WIPHY_WOWLAN_DISCONNECT |
227-
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
228-
WIPHY_WOWLAN_RFKILL_RELEASE;
225+
mvm->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
226+
WIPHY_WOWLAN_DISCONNECT |
227+
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
228+
WIPHY_WOWLAN_RFKILL_RELEASE;
229229
if (!iwlwifi_mod_params.sw_crypto)
230-
hw->wiphy->wowlan.flags |=
231-
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
232-
WIPHY_WOWLAN_GTK_REKEY_FAILURE |
233-
WIPHY_WOWLAN_4WAY_HANDSHAKE;
234-
235-
hw->wiphy->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS;
236-
hw->wiphy->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN;
237-
hw->wiphy->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN;
238-
hw->wiphy->wowlan.tcp = &iwl_mvm_wowlan_tcp_support;
230+
mvm->wowlan.flags |= WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
231+
WIPHY_WOWLAN_GTK_REKEY_FAILURE |
232+
WIPHY_WOWLAN_4WAY_HANDSHAKE;
233+
234+
mvm->wowlan.n_patterns = IWL_WOWLAN_MAX_PATTERNS;
235+
mvm->wowlan.pattern_min_len = IWL_WOWLAN_MIN_PATTERN_LEN;
236+
mvm->wowlan.pattern_max_len = IWL_WOWLAN_MAX_PATTERN_LEN;
237+
mvm->wowlan.tcp = &iwl_mvm_wowlan_tcp_support;
238+
hw->wiphy->wowlan = &mvm->wowlan;
239239
}
240240
#endif
241241

‎drivers/net/wireless/iwlwifi/mvm/mvm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ struct iwl_mvm {
336336
struct ieee80211_vif *p2p_device_vif;
337337

338338
#ifdef CONFIG_PM_SLEEP
339+
struct wiphy_wowlan_support wowlan;
339340
int gtk_ivlen, gtk_icvlen, ptk_ivlen, ptk_icvlen;
340341
#endif
341342

‎drivers/net/wireless/mwifiex/cfg80211.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,6 +2426,16 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = {
24262426
#endif
24272427
};
24282428

2429+
#ifdef CONFIG_PM
2430+
static 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+
24292439
/*
24302440
* This function registers the device with CFG802.11 subsystem.
24312441
*
@@ -2483,11 +2493,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
24832493
wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom);
24842494

24852495
#ifdef CONFIG_PM
2486-
wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT;
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;
2496+
wiphy->wowlan = &mwifiex_wowlan_support;
24912497
#endif
24922498

24932499
wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |

‎drivers/net/wireless/ti/wlcore/main.c‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6018,6 +6018,15 @@ int wlcore_free_hw(struct wl1271 *wl)
60186018
}
60196019
EXPORT_SYMBOL_GPL(wlcore_free_hw);
60206020

6021+
#ifdef CONFIG_PM
6022+
static 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+
60216030
static void wlcore_nvs_cb(const struct firmware *fw, void *context)
60226031
{
60236032
struct wl1271 *wl = context;
@@ -6071,14 +6080,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
60716080
if (!ret) {
60726081
wl->irq_wake_enabled = true;
60736082
device_init_wakeup(wl->dev, 1);
6074-
if (pdata->pwr_in_suspend) {
6075-
wl->hw->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY;
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-
}
6083+
if (pdata->pwr_in_suspend)
6084+
wl->hw->wiphy->wowlan = &wlcore_wowlan_support;
60826085
}
60836086
#endif
60846087
disable_irq(wl->irq);

‎include/net/cfg80211.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,7 @@ struct wiphy {
26542654
u32 hw_version;
26552655

26562656
#ifdef CONFIG_PM
2657-
struct wiphy_wowlan_support wowlan;
2657+
const struct wiphy_wowlan_support *wowlan;
26582658
struct cfg80211_wowlan *wowlan_config;
26592659
#endif
26602660

‎net/mac80211/main.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
686686
return -EINVAL;
687687

688688
#ifdef CONFIG_PM
689-
if ((hw->wiphy->wowlan.flags || hw->wiphy->wowlan.n_patterns) &&
690-
(!local->ops->suspend || !local->ops->resume))
689+
if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
691690
return -EINVAL;
692691
#endif
693692

0 commit comments

Comments
 (0)