diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-05-04 22:22:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-14 16:29:45 -0400 |
commit | 47c5196e4a340667d8d92053380ecca24ed45a9b (patch) | |
tree | a17bb99d134181e62eb2b4fabd193e12e146013f | |
parent | bf403db8a2f5580a5eb355a109d29b9287ca51e1 (diff) |
iwlwifi: move iwl4965_set_rxon_ht into iwlcore
This patch moves iwl4965_set_rxon_ht to iwlcore under name
iwl_set_rxon_ht. It also moves collateral changes
iwl_is_channel_extension and iwl_is_fat_tx_allowed.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 99 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 99 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 6 |
5 files changed, 105 insertions, 104 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index b4f2c3c89542..bc988c3b6782 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -3719,103 +3719,6 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
3719 | 3719 | ||
3720 | #ifdef CONFIG_IWL4965_HT | 3720 | #ifdef CONFIG_IWL4965_HT |
3721 | 3721 | ||
3722 | static u8 iwl4965_is_channel_extension(struct iwl_priv *priv, | ||
3723 | enum ieee80211_band band, | ||
3724 | u16 channel, u8 extension_chan_offset) | ||
3725 | { | ||
3726 | const struct iwl_channel_info *ch_info; | ||
3727 | |||
3728 | ch_info = iwl_get_channel_info(priv, band, channel); | ||
3729 | if (!is_channel_valid(ch_info)) | ||
3730 | return 0; | ||
3731 | |||
3732 | if (extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_NONE) | ||
3733 | return 0; | ||
3734 | |||
3735 | if ((ch_info->fat_extension_channel == extension_chan_offset) || | ||
3736 | (ch_info->fat_extension_channel == HT_IE_EXT_CHANNEL_MAX)) | ||
3737 | return 1; | ||
3738 | |||
3739 | return 0; | ||
3740 | } | ||
3741 | |||
3742 | static u8 iwl4965_is_fat_tx_allowed(struct iwl_priv *priv, | ||
3743 | struct ieee80211_ht_info *sta_ht_inf) | ||
3744 | { | ||
3745 | struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config; | ||
3746 | |||
3747 | if ((!iwl_ht_conf->is_ht) || | ||
3748 | (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) || | ||
3749 | (iwl_ht_conf->extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_NONE)) | ||
3750 | return 0; | ||
3751 | |||
3752 | if (sta_ht_inf) { | ||
3753 | if ((!sta_ht_inf->ht_supported) || | ||
3754 | (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))) | ||
3755 | return 0; | ||
3756 | } | ||
3757 | |||
3758 | return (iwl4965_is_channel_extension(priv, priv->band, | ||
3759 | iwl_ht_conf->control_channel, | ||
3760 | iwl_ht_conf->extension_chan_offset)); | ||
3761 | } | ||
3762 | |||
3763 | void iwl4965_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | ||
3764 | { | ||
3765 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | ||
3766 | u32 val; | ||
3767 | |||
3768 | if (!ht_info->is_ht) | ||
3769 | return; | ||
3770 | |||
3771 | /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */ | ||
3772 | if (iwl4965_is_fat_tx_allowed(priv, NULL)) | ||
3773 | rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK; | ||
3774 | else | ||
3775 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | | ||
3776 | RXON_FLG_CHANNEL_MODE_PURE_40_MSK); | ||
3777 | |||
3778 | if (le16_to_cpu(rxon->channel) != ht_info->control_channel) { | ||
3779 | IWL_ERROR("control diff than current %d %d\n", | ||
3780 | le16_to_cpu(rxon->channel), | ||
3781 | ht_info->control_channel); | ||
3782 | WARN_ON(1); | ||
3783 | return; | ||
3784 | } | ||
3785 | |||
3786 | /* Note: control channel is opposite of extension channel */ | ||
3787 | switch (ht_info->extension_chan_offset) { | ||
3788 | case IWL_EXT_CHANNEL_OFFSET_ABOVE: | ||
3789 | rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); | ||
3790 | break; | ||
3791 | case IWL_EXT_CHANNEL_OFFSET_BELOW: | ||
3792 | rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; | ||
3793 | break; | ||
3794 | case IWL_EXT_CHANNEL_OFFSET_NONE: | ||
3795 | default: | ||
3796 | rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK; | ||
3797 | break; | ||
3798 | } | ||
3799 | |||
3800 | val = ht_info->ht_protection; | ||
3801 | |||
3802 | rxon->flags |= cpu_to_le32(val << RXON_FLG_HT_OPERATING_MODE_POS); | ||
3803 | |||
3804 | iwl_set_rxon_chain(priv); | ||
3805 | |||
3806 | IWL_DEBUG_ASSOC("supported HT rate 0x%X 0x%X 0x%X " | ||
3807 | "rxon flags 0x%X operation mode :0x%X " | ||
3808 | "extension channel offset 0x%x " | ||
3809 | "control chan %d\n", | ||
3810 | ht_info->supp_mcs_set[0], | ||
3811 | ht_info->supp_mcs_set[1], | ||
3812 | ht_info->supp_mcs_set[2], | ||
3813 | le32_to_cpu(rxon->flags), ht_info->ht_protection, | ||
3814 | ht_info->extension_chan_offset, | ||
3815 | ht_info->control_channel); | ||
3816 | return; | ||
3817 | } | ||
3818 | |||
3819 | void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index, | 3722 | void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index, |
3820 | struct ieee80211_ht_info *sta_ht_inf) | 3723 | struct ieee80211_ht_info *sta_ht_inf) |
3821 | { | 3724 | { |
@@ -3851,7 +3754,7 @@ void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index, | |||
3851 | sta_flags |= cpu_to_le32( | 3754 | sta_flags |= cpu_to_le32( |
3852 | (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); | 3755 | (u32)sta_ht_inf->ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); |
3853 | 3756 | ||
3854 | if (iwl4965_is_fat_tx_allowed(priv, sta_ht_inf)) | 3757 | if (iwl_is_fat_tx_allowed(priv, sta_ht_inf)) |
3855 | sta_flags |= STA_FLG_FAT_EN_MSK; | 3758 | sta_flags |= STA_FLG_FAT_EN_MSK; |
3856 | else | 3759 | else |
3857 | sta_flags &= ~STA_FLG_FAT_EN_MSK; | 3760 | sta_flags &= ~STA_FLG_FAT_EN_MSK; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 55e3d139f427..2ff27a01cf66 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -434,6 +434,105 @@ static u8 is_single_rx_stream(struct iwl_priv *priv) | |||
434 | (priv->current_ht_config.supp_mcs_set[2] == 0)) || | 434 | (priv->current_ht_config.supp_mcs_set[2] == 0)) || |
435 | priv->ps_mode == IWL_MIMO_PS_STATIC; | 435 | priv->ps_mode == IWL_MIMO_PS_STATIC; |
436 | } | 436 | } |
437 | static u8 iwl_is_channel_extension(struct iwl_priv *priv, | ||
438 | enum ieee80211_band band, | ||
439 | u16 channel, u8 extension_chan_offset) | ||
440 | { | ||
441 | const struct iwl_channel_info *ch_info; | ||
442 | |||
443 | ch_info = iwl_get_channel_info(priv, band, channel); | ||
444 | if (!is_channel_valid(ch_info)) | ||
445 | return 0; | ||
446 | |||
447 | if (extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_NONE) | ||
448 | return 0; | ||
449 | |||
450 | if ((ch_info->fat_extension_channel == extension_chan_offset) || | ||
451 | (ch_info->fat_extension_channel == HT_IE_EXT_CHANNEL_MAX)) | ||
452 | return 1; | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, | ||
458 | struct ieee80211_ht_info *sta_ht_inf) | ||
459 | { | ||
460 | struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config; | ||
461 | |||
462 | if ((!iwl_ht_conf->is_ht) || | ||
463 | (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ) || | ||
464 | (iwl_ht_conf->extension_chan_offset == IWL_EXT_CHANNEL_OFFSET_NONE)) | ||
465 | return 0; | ||
466 | |||
467 | if (sta_ht_inf) { | ||
468 | if ((!sta_ht_inf->ht_supported) || | ||
469 | (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))) | ||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | return iwl_is_channel_extension(priv, priv->band, | ||
474 | iwl_ht_conf->control_channel, | ||
475 | iwl_ht_conf->extension_chan_offset); | ||
476 | } | ||
477 | EXPORT_SYMBOL(iwl_is_fat_tx_allowed); | ||
478 | |||
479 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | ||
480 | { | ||
481 | struct iwl4965_rxon_cmd *rxon = &priv->staging_rxon; | ||
482 | u32 val; | ||
483 | |||
484 | if (!ht_info->is_ht) | ||
485 | return; | ||
486 | |||
487 | /* Set up channel bandwidth: 20 MHz only, or 20/40 mixed if fat ok */ | ||
488 | if (iwl_is_fat_tx_allowed(priv, NULL)) | ||
489 | rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED_MSK; | ||
490 | else | ||
491 | rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK | | ||
492 | RXON_FLG_CHANNEL_MODE_PURE_40_MSK); | ||
493 | |||
494 | if (le16_to_cpu(rxon->channel) != ht_info->control_channel) { | ||
495 | IWL_DEBUG_ASSOC("control diff than current %d %d\n", | ||
496 | le16_to_cpu(rxon->channel), | ||
497 | ht_info->control_channel); | ||
498 | rxon->channel = cpu_to_le16(ht_info->control_channel); | ||
499 | return; | ||
500 | } | ||
501 | |||
502 | /* Note: control channel is opposite of extension channel */ | ||
503 | switch (ht_info->extension_chan_offset) { | ||
504 | case IWL_EXT_CHANNEL_OFFSET_ABOVE: | ||
505 | rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); | ||
506 | break; | ||
507 | case IWL_EXT_CHANNEL_OFFSET_BELOW: | ||
508 | rxon->flags |= RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK; | ||
509 | break; | ||
510 | case IWL_EXT_CHANNEL_OFFSET_NONE: | ||
511 | default: | ||
512 | rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK; | ||
513 | break; | ||
514 | } | ||
515 | |||
516 | val = ht_info->ht_protection; | ||
517 | |||
518 | rxon->flags |= cpu_to_le32(val << RXON_FLG_HT_OPERATING_MODE_POS); | ||
519 | |||
520 | iwl_set_rxon_chain(priv); | ||
521 | |||
522 | IWL_DEBUG_ASSOC("supported HT rate 0x%X 0x%X 0x%X " | ||
523 | "rxon flags 0x%X operation mode :0x%X " | ||
524 | "extension channel offset 0x%x " | ||
525 | "control chan %d\n", | ||
526 | ht_info->supp_mcs_set[0], | ||
527 | ht_info->supp_mcs_set[1], | ||
528 | ht_info->supp_mcs_set[2], | ||
529 | le32_to_cpu(rxon->flags), ht_info->ht_protection, | ||
530 | ht_info->extension_chan_offset, | ||
531 | ht_info->control_channel); | ||
532 | return; | ||
533 | } | ||
534 | EXPORT_SYMBOL(iwl_set_rxon_ht); | ||
535 | |||
437 | #else | 536 | #else |
438 | static inline u8 is_single_rx_stream(struct iwl_priv *priv) | 537 | static inline u8 is_single_rx_stream(struct iwl_priv *priv) |
439 | { | 538 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index df27ee65015c..12418061ab7f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -173,6 +173,9 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, | |||
173 | u16 channel); | 173 | u16 channel); |
174 | void iwlcore_free_geos(struct iwl_priv *priv); | 174 | void iwlcore_free_geos(struct iwl_priv *priv); |
175 | int iwl_setup(struct iwl_priv *priv); | 175 | int iwl_setup(struct iwl_priv *priv); |
176 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info); | ||
177 | u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv, | ||
178 | struct ieee80211_ht_info *sta_ht_inf); | ||
176 | 179 | ||
177 | /***************************************************** | 180 | /***************************************************** |
178 | * RX | 181 | * RX |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 0a37ff4d98b6..23cae4c13459 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -454,7 +454,6 @@ union iwl4965_ht_rate_supp { | |||
454 | }; | 454 | }; |
455 | }; | 455 | }; |
456 | 456 | ||
457 | #ifdef CONFIG_IWL4965_HT | ||
458 | #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) | 457 | #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3) |
459 | #define CFG_HT_MPDU_DENSITY_2USEC (0x5) | 458 | #define CFG_HT_MPDU_DENSITY_2USEC (0x5) |
460 | #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC | 459 | #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC |
@@ -477,7 +476,6 @@ struct iwl_ht_info { | |||
477 | u8 ht_protection; | 476 | u8 ht_protection; |
478 | u8 non_GF_STA_present; | 477 | u8 non_GF_STA_present; |
479 | }; | 478 | }; |
480 | #endif /*CONFIG_IWL4965_HT */ | ||
481 | 479 | ||
482 | union iwl4965_qos_capabity { | 480 | union iwl4965_qos_capabity { |
483 | struct { | 481 | struct { |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 9f51d3a61f36..ad45249454f0 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -2783,9 +2783,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2783 | tx_resp->failure_frame); | 2783 | tx_resp->failure_frame); |
2784 | 2784 | ||
2785 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); | 2785 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); |
2786 | #ifdef CONFIG_IWL4965_HT | ||
2786 | if (index != -1) { | 2787 | if (index != -1) { |
2787 | int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); | 2788 | int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); |
2788 | #ifdef CONFIG_IWL4965_HT | ||
2789 | if (tid != MAX_TID_COUNT) | 2789 | if (tid != MAX_TID_COUNT) |
2790 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 2790 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
2791 | if (iwl4965_queue_space(&txq->q) > txq->q.low_mark && | 2791 | if (iwl4965_queue_space(&txq->q) > txq->q.low_mark && |
@@ -2793,9 +2793,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
2793 | ieee80211_wake_queue(priv->hw, txq_id); | 2793 | ieee80211_wake_queue(priv->hw, txq_id); |
2794 | if (tid != MAX_TID_COUNT) | 2794 | if (tid != MAX_TID_COUNT) |
2795 | iwl4965_check_empty_hw_queue(priv, sta_id, tid, txq_id); | 2795 | iwl4965_check_empty_hw_queue(priv, sta_id, tid, txq_id); |
2796 | #endif | ||
2797 | } | 2796 | } |
2798 | #ifdef CONFIG_IWL4965_HT | ||
2799 | } | 2797 | } |
2800 | #endif /* CONFIG_IWL4965_HT */ | 2798 | #endif /* CONFIG_IWL4965_HT */ |
2801 | 2799 | ||
@@ -5124,7 +5122,7 @@ static void iwl4965_post_associate(struct iwl_priv *priv) | |||
5124 | 5122 | ||
5125 | #ifdef CONFIG_IWL4965_HT | 5123 | #ifdef CONFIG_IWL4965_HT |
5126 | if (priv->current_ht_config.is_ht) | 5124 | if (priv->current_ht_config.is_ht) |
5127 | iwl4965_set_rxon_ht(priv, &priv->current_ht_config); | 5125 | iwl_set_rxon_ht(priv, &priv->current_ht_config); |
5128 | #endif /* CONFIG_IWL4965_HT*/ | 5126 | #endif /* CONFIG_IWL4965_HT*/ |
5129 | iwl_set_rxon_chain(priv); | 5127 | iwl_set_rxon_chain(priv); |
5130 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 5128 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); |