Commit edcdf8b2 authored by Ron Rindjunsky's avatar Ron Rindjunsky Committed by John W. Linville

mac80211: separate Tx and Rx MCS when configuring HT

This patch follows the 11n spec in separation between Tx and Rx MCS
capabilities. Up until now, when configuring the HT possible set of Tx
MCS only Rx MCS were considered, assuming they are the same as the Tx MCS.
This patch fixed this by looking at low level driver Tx capabilities.
Signed-off-by: default avatarRon Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0b794d63
...@@ -3958,6 +3958,13 @@ static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv) ...@@ -3958,6 +3958,13 @@ static void iwl4965_dealloc_ucode_pci(struct iwl_priv *priv)
iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot); iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
} }
static void iwl4965_nic_start(struct iwl_priv *priv)
{
/* Remove all resets to allow NIC to operate */
iwl_write32(priv, CSR_RESET, 0);
}
/** /**
* iwl4965_read_ucode - Read uCode images from disk file. * iwl4965_read_ucode - Read uCode images from disk file.
* *
...@@ -4447,8 +4454,7 @@ static int __iwl4965_up(struct iwl_priv *priv) ...@@ -4447,8 +4454,7 @@ static int __iwl4965_up(struct iwl_priv *priv)
} }
/* start card; "initialize" will load runtime ucode */ /* start card; "initialize" will load runtime ucode */
/* Remove all resets to allow NIC to operate */ iwl4965_nic_start(priv);
iwl_write32(priv, CSR_RESET, 0);
IWL_DEBUG_INFO(DRV_NAME " is coming up\n"); IWL_DEBUG_INFO(DRV_NAME " is coming up\n");
...@@ -6842,10 +6848,6 @@ static int __init iwl4965_init(void) ...@@ -6842,10 +6848,6 @@ static int __init iwl4965_init(void)
return ret; return ret;
#ifdef CONFIG_IWLWIFI_DEBUG
pci_unregister_driver(&iwl_driver);
#endif
error_register: error_register:
iwl4965_rate_control_unregister(); iwl4965_rate_control_unregister();
return ret; return ret;
......
...@@ -306,8 +306,18 @@ struct ieee80211_ht_addt_info { ...@@ -306,8 +306,18 @@ struct ieee80211_ht_addt_info {
#define IEEE80211_HT_CAP_SGI_40 0x0040 #define IEEE80211_HT_CAP_SGI_40 0x0040
#define IEEE80211_HT_CAP_DELAY_BA 0x0400 #define IEEE80211_HT_CAP_DELAY_BA 0x0400
#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
/* 802.11n HT capability AMPDU settings */
#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
/* 802.11n HT capability MSC set */
#define IEEE80211_SUPP_MCS_SET_UEQM 4
#define IEEE80211_HT_CAP_MAX_STREAMS 4
#define IEEE80211_SUPP_MCS_SET_LEN 10
/* maximum streams the spec allows */
#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
/* 802.11n HT IE masks */ /* 802.11n HT IE masks */
#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
#define IEEE80211_HT_IE_CHA_WIDTH 0x04 #define IEEE80211_HT_IE_CHA_WIDTH 0x04
......
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#include "debugfs.h" #include "debugfs.h"
#include "debugfs_netdev.h" #include "debugfs_netdev.h"
#define SUPP_MCS_SET_LEN 16
/* /*
* For seeing transmitted packets on monitor interfaces * For seeing transmitted packets on monitor interfaces
* we have a radiotap header too. * we have a radiotap header too.
...@@ -1068,21 +1066,32 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, ...@@ -1068,21 +1066,32 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
struct ieee80211_ht_info ht_conf; struct ieee80211_ht_info ht_conf;
struct ieee80211_ht_bss_info ht_bss_conf; struct ieee80211_ht_bss_info ht_bss_conf;
int i;
u32 changed = 0; u32 changed = 0;
int i;
u8 max_tx_streams = IEEE80211_HT_CAP_MAX_STREAMS;
u8 tx_mcs_set_cap;
sband = local->hw.wiphy->bands[conf->channel->band]; sband = local->hw.wiphy->bands[conf->channel->band];
memset(&ht_conf, 0, sizeof(struct ieee80211_ht_info));
memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info));
/* HT is not supported */ /* HT is not supported */
if (!sband->ht_info.ht_supported) { if (!sband->ht_info.ht_supported) {
conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
return 0; goto out;
}
/* disable HT */
if (!enable_ht) {
if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)
changed |= BSS_CHANGED_HT;
conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
conf->ht_conf.ht_supported = 0;
goto out;
} }
memset(&ht_conf, 0, sizeof(struct ieee80211_ht_info));
memset(&ht_bss_conf, 0, sizeof(struct ieee80211_ht_bss_info));
if (enable_ht) {
if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE))
changed |= BSS_CHANGED_HT; changed |= BSS_CHANGED_HT;
...@@ -1092,12 +1101,6 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, ...@@ -1092,12 +1101,6 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap; ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap;
ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS); ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS);
ht_conf.cap |= sband->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS; ht_conf.cap |= sband->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS;
for (i = 0; i < SUPP_MCS_SET_LEN; i++)
ht_conf.supp_mcs_set[i] =
sband->ht_info.supp_mcs_set[i] &
req_ht_cap->supp_mcs_set[i];
ht_bss_conf.primary_channel = req_bss_cap->primary_channel; ht_bss_conf.primary_channel = req_bss_cap->primary_channel;
ht_bss_conf.bss_cap = req_bss_cap->bss_cap; ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode; ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
...@@ -1105,6 +1108,34 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, ...@@ -1105,6 +1108,34 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
ht_conf.ampdu_factor = req_ht_cap->ampdu_factor; ht_conf.ampdu_factor = req_ht_cap->ampdu_factor;
ht_conf.ampdu_density = req_ht_cap->ampdu_density; ht_conf.ampdu_density = req_ht_cap->ampdu_density;
/* Bits 96-100 */
tx_mcs_set_cap = sband->ht_info.supp_mcs_set[12];
/* configure suppoerted Tx MCS according to requested MCS
* (based in most cases on Rx capabilities of peer) and self
* Tx MCS capabilities (as defined by low level driver HW
* Tx capabilities) */
if (!(tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_DEFINED))
goto check_changed;
/* Counting from 0 therfore + 1 */
if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_RX_DIFF)
max_tx_streams = ((tx_mcs_set_cap &
IEEE80211_HT_CAP_MCS_TX_STREAMS) >> 2) + 1;
for (i = 0; i < max_tx_streams; i++)
ht_conf.supp_mcs_set[i] =
sband->ht_info.supp_mcs_set[i] &
req_ht_cap->supp_mcs_set[i];
if (tx_mcs_set_cap & IEEE80211_HT_CAP_MCS_TX_UEQM)
for (i = IEEE80211_SUPP_MCS_SET_UEQM;
i < IEEE80211_SUPP_MCS_SET_LEN; i++)
ht_conf.supp_mcs_set[i] =
sband->ht_info.supp_mcs_set[i] &
req_ht_cap->supp_mcs_set[i];
check_changed:
/* if bss configuration changed store the new one */ /* if bss configuration changed store the new one */
if (memcmp(&conf->ht_conf, &ht_conf, sizeof(ht_conf)) || if (memcmp(&conf->ht_conf, &ht_conf, sizeof(ht_conf)) ||
memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) { memcmp(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf))) {
...@@ -1112,12 +1143,7 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, ...@@ -1112,12 +1143,7 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
memcpy(&conf->ht_conf, &ht_conf, sizeof(ht_conf)); memcpy(&conf->ht_conf, &ht_conf, sizeof(ht_conf));
memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf)); memcpy(&conf->ht_bss_conf, &ht_bss_conf, sizeof(ht_bss_conf));
} }
} else { out:
if (conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)
changed |= BSS_CHANGED_HT;
conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
}
return changed; return changed;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment