diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-12-10 17:37:27 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-22 13:56:07 -0500 |
commit | ba37a3d0395a66b3c9164c4f4d1318317da32e96 (patch) | |
tree | a9d17eba0a6eddb3e26365c0dec3400745521fd7 | |
parent | 11466f1342a3400dd5e03da3d8c45aa4149c62d4 (diff) |
iwlwifi: use new mac80211 SMPS
Instead of hard-coding the SM PS mode per hardware,
this makes iwlwifi support the new mac80211 API for
controlling the SM PS mode.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-1000.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-6000.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 53 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 1 |
8 files changed, 32 insertions, 38 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 9d4fdd7a1134..5759f91343a5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -174,7 +174,6 @@ struct iwl_cfg iwl1000_bgn_cfg = { | |||
174 | .use_rts_for_ht = true, /* use rts/cts protection */ | 174 | .use_rts_for_ht = true, /* use rts/cts protection */ |
175 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 175 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
176 | .support_ct_kill_exit = true, | 176 | .support_ct_kill_exit = true, |
177 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
178 | }; | 177 | }; |
179 | 178 | ||
180 | struct iwl_cfg iwl1000_bg_cfg = { | 179 | struct iwl_cfg iwl1000_bg_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 386513b601f5..34778cf120fc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -2239,7 +2239,6 @@ struct iwl_cfg iwl4965_agn_cfg = { | |||
2239 | .broken_powersave = true, | 2239 | .broken_powersave = true, |
2240 | .led_compensation = 61, | 2240 | .led_compensation = 61, |
2241 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, | 2241 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, |
2242 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
2243 | }; | 2242 | }; |
2244 | 2243 | ||
2245 | /* Module firmware */ | 2244 | /* Module firmware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 5a277cdffd07..3236315c75be 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -1600,7 +1600,6 @@ struct iwl_cfg iwl5300_agn_cfg = { | |||
1600 | .ht_greenfield_support = true, | 1600 | .ht_greenfield_support = true, |
1601 | .led_compensation = 51, | 1601 | .led_compensation = 51, |
1602 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1602 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1603 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
1604 | }; | 1603 | }; |
1605 | 1604 | ||
1606 | struct iwl_cfg iwl5100_bgn_cfg = { | 1605 | struct iwl_cfg iwl5100_bgn_cfg = { |
@@ -1669,7 +1668,6 @@ struct iwl_cfg iwl5100_agn_cfg = { | |||
1669 | .ht_greenfield_support = true, | 1668 | .ht_greenfield_support = true, |
1670 | .led_compensation = 51, | 1669 | .led_compensation = 51, |
1671 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1670 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1672 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
1673 | }; | 1671 | }; |
1674 | 1672 | ||
1675 | struct iwl_cfg iwl5350_agn_cfg = { | 1673 | struct iwl_cfg iwl5350_agn_cfg = { |
@@ -1693,7 +1691,6 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
1693 | .ht_greenfield_support = true, | 1691 | .ht_greenfield_support = true, |
1694 | .led_compensation = 51, | 1692 | .led_compensation = 51, |
1695 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1693 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1696 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
1697 | }; | 1694 | }; |
1698 | 1695 | ||
1699 | struct iwl_cfg iwl5150_agn_cfg = { | 1696 | struct iwl_cfg iwl5150_agn_cfg = { |
@@ -1717,7 +1714,6 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
1717 | .ht_greenfield_support = true, | 1714 | .ht_greenfield_support = true, |
1718 | .led_compensation = 51, | 1715 | .led_compensation = 51, |
1719 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 1716 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
1720 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
1721 | }; | 1717 | }; |
1722 | 1718 | ||
1723 | struct iwl_cfg iwl5150_abg_cfg = { | 1719 | struct iwl_cfg iwl5150_abg_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index fec43771c49e..788457ae25a8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -307,7 +307,6 @@ struct iwl_cfg iwl6000i_2agn_cfg = { | |||
307 | .supports_idle = true, | 307 | .supports_idle = true, |
308 | .adv_thermal_throttle = true, | 308 | .adv_thermal_throttle = true, |
309 | .support_ct_kill_exit = true, | 309 | .support_ct_kill_exit = true, |
310 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
311 | }; | 310 | }; |
312 | 311 | ||
313 | struct iwl_cfg iwl6000i_2abg_cfg = { | 312 | struct iwl_cfg iwl6000i_2abg_cfg = { |
@@ -396,7 +395,6 @@ struct iwl_cfg iwl6050_2agn_cfg = { | |||
396 | .supports_idle = true, | 395 | .supports_idle = true, |
397 | .adv_thermal_throttle = true, | 396 | .adv_thermal_throttle = true, |
398 | .support_ct_kill_exit = true, | 397 | .support_ct_kill_exit = true, |
399 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DYNAMIC, | ||
400 | }; | 398 | }; |
401 | 399 | ||
402 | struct iwl_cfg iwl6050_2abg_cfg = { | 400 | struct iwl_cfg iwl6050_2abg_cfg = { |
@@ -456,7 +454,6 @@ struct iwl_cfg iwl6000_3agn_cfg = { | |||
456 | .supports_idle = true, | 454 | .supports_idle = true, |
457 | .adv_thermal_throttle = true, | 455 | .adv_thermal_throttle = true, |
458 | .support_ct_kill_exit = true, | 456 | .support_ct_kill_exit = true, |
459 | .sm_ps_mode = WLAN_HT_CAP_SM_PS_DISABLED, | ||
460 | }; | 457 | }; |
461 | 458 | ||
462 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); | 459 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 0b3669f317a4..904b5d8da860 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2623,6 +2623,10 @@ static int iwl_setup_mac(struct iwl_priv *priv) | |||
2623 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | | 2623 | hw->flags |= IEEE80211_HW_SUPPORTS_PS | |
2624 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; | 2624 | IEEE80211_HW_SUPPORTS_DYNAMIC_PS; |
2625 | 2625 | ||
2626 | if (priv->cfg->sku & IWL_SKU_N) | ||
2627 | hw->flags |= IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS | | ||
2628 | IEEE80211_HW_SUPPORTS_STATIC_SMPS; | ||
2629 | |||
2626 | hw->sta_data_size = sizeof(struct iwl_station_priv); | 2630 | hw->sta_data_size = sizeof(struct iwl_station_priv); |
2627 | hw->wiphy->interface_modes = | 2631 | hw->wiphy->interface_modes = |
2628 | BIT(NL80211_IFTYPE_STATION) | | 2632 | BIT(NL80211_IFTYPE_STATION) | |
@@ -3361,6 +3365,7 @@ static int iwl_init_drv(struct iwl_priv *priv) | |||
3361 | priv->band = IEEE80211_BAND_2GHZ; | 3365 | priv->band = IEEE80211_BAND_2GHZ; |
3362 | 3366 | ||
3363 | priv->iw_mode = NL80211_IFTYPE_STATION; | 3367 | priv->iw_mode = NL80211_IFTYPE_STATION; |
3368 | priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; | ||
3364 | 3369 | ||
3365 | /* Choose which receivers/antennas to use */ | 3370 | /* Choose which receivers/antennas to use */ |
3366 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 3371 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index c3c31dc9fd4d..e3b96b48b7fe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -450,8 +450,6 @@ static void iwlcore_init_ht_hw_capab(const struct iwl_priv *priv, | |||
450 | if (priv->cfg->ht_greenfield_support) | 450 | if (priv->cfg->ht_greenfield_support) |
451 | ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; | 451 | ht_info->cap |= IEEE80211_HT_CAP_GRN_FLD; |
452 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; | 452 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; |
453 | ht_info->cap |= (IEEE80211_HT_CAP_SM_PS & | ||
454 | (priv->cfg->sm_ps_mode << 2)); | ||
455 | max_bit_rate = MAX_BIT_RATE_20_MHZ; | 453 | max_bit_rate = MAX_BIT_RATE_20_MHZ; |
456 | if (priv->hw_params.ht40_channel & BIT(band)) { | 454 | if (priv->hw_params.ht40_channel & BIT(band)) { |
457 | ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; | 455 | ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
@@ -636,7 +634,7 @@ EXPORT_SYMBOL(iwlcore_rts_tx_cmd_flag); | |||
636 | 634 | ||
637 | static bool is_single_rx_stream(struct iwl_priv *priv) | 635 | static bool is_single_rx_stream(struct iwl_priv *priv) |
638 | { | 636 | { |
639 | return !priv->current_ht_config.is_ht || | 637 | return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC || |
640 | priv->current_ht_config.single_chain_sufficient; | 638 | priv->current_ht_config.single_chain_sufficient; |
641 | } | 639 | } |
642 | 640 | ||
@@ -1003,28 +1001,18 @@ static int iwl_get_active_rx_chain_count(struct iwl_priv *priv) | |||
1003 | */ | 1001 | */ |
1004 | static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) | 1002 | static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt) |
1005 | { | 1003 | { |
1006 | int idle_cnt = active_cnt; | 1004 | /* # Rx chains when idling, depending on SMPS mode */ |
1007 | bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status); | 1005 | switch (priv->current_ht_config.smps) { |
1008 | 1006 | case IEEE80211_SMPS_STATIC: | |
1009 | /* # Rx chains when idling and maybe trying to save power */ | 1007 | case IEEE80211_SMPS_DYNAMIC: |
1010 | switch (priv->cfg->sm_ps_mode) { | 1008 | return IWL_NUM_IDLE_CHAINS_SINGLE; |
1011 | case WLAN_HT_CAP_SM_PS_STATIC: | 1009 | case IEEE80211_SMPS_OFF: |
1012 | idle_cnt = (is_cam) ? active_cnt : IWL_NUM_IDLE_CHAINS_SINGLE; | 1010 | return active_cnt; |
1013 | break; | ||
1014 | case WLAN_HT_CAP_SM_PS_DYNAMIC: | ||
1015 | idle_cnt = (is_cam) ? IWL_NUM_IDLE_CHAINS_DUAL : | ||
1016 | IWL_NUM_IDLE_CHAINS_SINGLE; | ||
1017 | break; | ||
1018 | case WLAN_HT_CAP_SM_PS_DISABLED: | ||
1019 | break; | ||
1020 | case WLAN_HT_CAP_SM_PS_INVALID: | ||
1021 | default: | 1011 | default: |
1022 | IWL_ERR(priv, "invalid sm_ps mode %u\n", | 1012 | WARN(1, "invalid SMPS mode %d", |
1023 | priv->cfg->sm_ps_mode); | 1013 | priv->current_ht_config.smps); |
1024 | WARN_ON(1); | 1014 | return active_cnt; |
1025 | break; | ||
1026 | } | 1015 | } |
1027 | return idle_cnt; | ||
1028 | } | 1016 | } |
1029 | 1017 | ||
1030 | /* up to 4 chains */ | 1018 | /* up to 4 chains */ |
@@ -2686,6 +2674,21 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2686 | IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); | 2674 | IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); |
2687 | } | 2675 | } |
2688 | 2676 | ||
2677 | if (changed & (IEEE80211_CONF_CHANGE_SMPS | | ||
2678 | IEEE80211_CONF_CHANGE_CHANNEL)) { | ||
2679 | /* mac80211 uses static for non-HT which is what we want */ | ||
2680 | priv->current_ht_config.smps = conf->smps_mode; | ||
2681 | |||
2682 | /* | ||
2683 | * Recalculate chain counts. | ||
2684 | * | ||
2685 | * If monitor mode is enabled then mac80211 will | ||
2686 | * set up the SM PS mode to OFF if an HT channel is | ||
2687 | * configured. | ||
2688 | */ | ||
2689 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
2690 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
2691 | } | ||
2689 | 2692 | ||
2690 | /* during scanning mac80211 will delay channel setting until | 2693 | /* during scanning mac80211 will delay channel setting until |
2691 | * scan finish with changed = 0 | 2694 | * scan finish with changed = 0 |
@@ -2782,10 +2785,6 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2782 | iwl_set_tx_power(priv, conf->power_level, false); | 2785 | iwl_set_tx_power(priv, conf->power_level, false); |
2783 | } | 2786 | } |
2784 | 2787 | ||
2785 | /* call to ensure that 4965 rx_chain is set properly in monitor mode */ | ||
2786 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
2787 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
2788 | |||
2789 | if (!iwl_is_ready(priv)) { | 2788 | if (!iwl_is_ready(priv)) { |
2790 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 2789 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
2791 | goto out; | 2790 | goto out; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 650d3808d24a..f7acbb32900a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -232,7 +232,6 @@ struct iwl_mod_params { | |||
232 | * @chain_noise_num_beacons: number of beacons used to compute chain noise | 232 | * @chain_noise_num_beacons: number of beacons used to compute chain noise |
233 | * @adv_thermal_throttle: support advance thermal throttle | 233 | * @adv_thermal_throttle: support advance thermal throttle |
234 | * @support_ct_kill_exit: support ct kill exit condition | 234 | * @support_ct_kill_exit: support ct kill exit condition |
235 | * @sm_ps_mode: spatial multiplexing power save mode | ||
236 | * @support_wimax_coexist: support wimax/wifi co-exist | 235 | * @support_wimax_coexist: support wimax/wifi co-exist |
237 | * | 236 | * |
238 | * We enable the driver to be backward compatible wrt API version. The | 237 | * We enable the driver to be backward compatible wrt API version. The |
@@ -289,7 +288,6 @@ struct iwl_cfg { | |||
289 | const bool supports_idle; | 288 | const bool supports_idle; |
290 | bool adv_thermal_throttle; | 289 | bool adv_thermal_throttle; |
291 | bool support_ct_kill_exit; | 290 | bool support_ct_kill_exit; |
292 | u8 sm_ps_mode; | ||
293 | const bool support_wimax_coexist; | 291 | const bool support_wimax_coexist; |
294 | }; | 292 | }; |
295 | 293 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index b3a29c7cdbc0..1e12e7340c90 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -512,6 +512,7 @@ struct iwl_ht_config { | |||
512 | bool is_ht; | 512 | bool is_ht; |
513 | bool is_40mhz; | 513 | bool is_40mhz; |
514 | bool single_chain_sufficient; | 514 | bool single_chain_sufficient; |
515 | enum ieee80211_smps_mode smps; /* current smps mode */ | ||
515 | /* BSS related data */ | 516 | /* BSS related data */ |
516 | u8 extension_chan_offset; | 517 | u8 extension_chan_offset; |
517 | u8 ht_protection; | 518 | u8 ht_protection; |