All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/13] iwlwifi driver updates 09/11/2009
@ 2009-09-11 17:38 Reinette Chatre
  2009-09-11 17:38 ` [PATCH 01/13] iwlwifi: modify LED blink index table Reinette Chatre
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Reinette Chatre

In this series we include a few fixes for 2.6.32. It also contains some
cleanup and preparation work for new hardware.

The fixes for 2.6.32 are:
- patch 2/13 fixes the problem where stations are not able to use HT rates
and keep using legacy rates
- patch 6/13 fixes buffer loss that occur when system is not able to
allocate an skb. This can happen more often than expected since the driver
attempts skb allocation while in tasklet and thus with GFP_ATOMIC that is
more likely to fail.
- patch 12/13 fixes the problem where we transmit on incorrect antenna
- patch 13/13 even though powersave is default disabled for iwlwifi users
are still able to enable it using iwconfig. We need to prevent this for
4965 since it cannot handle the powersave requests well.

[PATCH 01/13] iwlwifi: modify LED blink index table
[PATCH 02/13 v2.6.32 and w-t] iwlwifi: fix HT operation in 2.4 GHz band
[PATCH 03/13] iwlwifi: remove un-supported eeprom parameters
[PATCH 04/13] iwlwifi: separate nic_config for different NIC
[PATCH 05/13] iwlwifi: separate set_hw_params function for 6000 series
[PATCH 06/13 v2.6.32 and w-t] iwlwifi: fix potential rx buffer loss
[PATCH 07/13] iwlwifi: clean up ht config a little
[PATCH 08/13] iwlwifi: Adjust blink rate to compensate Clock difference
[PATCH 09/13] iwlwifi: clean up ht config naming
[PATCH 10/13] iwlwifi: show NVM version in debugfs
[PATCH 11/13] iwlwifi: clarify and clean up chain settings
[PATCH 12/13 v2.6.32 and w-t] iwlwifi: find the correct first antenna
[PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965


Thank you

Reinette


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/13] iwlwifi: modify LED blink index table
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 02/13 v2.6.32 and w-t] iwlwifi: fix HT operation in 2.4 GHz band Reinette Chatre
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

Modify LED blink index table to include 1Mbps.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-led.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index f420c99..41addd1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -65,9 +65,9 @@ static const struct {
 	{70, 65, 65},
 	{50, 75, 75},
 	{20, 85, 85},
-	{15, 95, 95 },
-	{10, 110, 110},
-	{5, 130, 130},
+	{10, 95, 95},
+	{5, 110, 110},
+	{1, 130, 130},
 	{0, 167, 167},
 /* SOLID_ON */
 	{-1, IWL_LED_SOLID, 0}
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/13 v2.6.32 and w-t] iwlwifi: fix HT operation in 2.4 GHz band
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
  2009-09-11 17:38 ` [PATCH 01/13] iwlwifi: modify LED blink index table Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 03/13] iwlwifi: remove un-supported eeprom parameters Reinette Chatre
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville
  Cc: linux-wireless, ipw3945-devel, Daniel C Halperin, Reinette Chatre

From: Daniel C Halperin <daniel.c.halperin@intel.com>

When we cleaned up the driver to properly tell mac80211 about HT rates
("iwlwifi: use iwl_hwrate_get_mac80211_idx where appropriate"), we broke
internal rate indexing in 2.4 GHz band.

Signed-off-by: Daniel C Halperin <daniel.c.halperin@intel.com>
Tested-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 40b207a..fd73153 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -883,6 +883,12 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
 		mac_index &= RATE_MCS_CODE_MSK;	/* Remove # of streams */
 		if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE))
 			mac_index++;
+		/*
+		 * mac80211 HT index is always zero-indexed; we need to move
+		 * HT OFDM rates after CCK rates in 2.4 GHz band
+		 */
+		if (priv->band == IEEE80211_BAND_2GHZ)
+			mac_index += IWL_FIRST_OFDM_RATE;
 	}
 
 	if ((mac_index < 0) ||
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/13] iwlwifi: remove un-supported eeprom parameters
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
  2009-09-11 17:38 ` [PATCH 01/13] iwlwifi: modify LED blink index table Reinette Chatre
  2009-09-11 17:38 ` [PATCH 02/13 v2.6.32 and w-t] iwlwifi: fix HT operation in 2.4 GHz band Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 04/13] iwlwifi: separate nic_config for different NIC Reinette Chatre
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

Remove few of the parameters not used and no longer valid in EEPROM.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-eeprom.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 6b68db7..90e2b4e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -370,12 +370,10 @@ struct iwl_eeprom_calib_info {
 #define EEPROM_BOARD_PBA_NUMBER             (2*0x3B+1)	/* 9  bytes */
 #define EEPROM_VERSION                      (2*0x44)	/* 2  bytes */
 #define EEPROM_SKU_CAP                      (2*0x45)	/* 1  bytes */
-#define EEPROM_LEDS_MODE                    (2*0x45+1)	/* 1  bytes */
 #define EEPROM_OEM_MODE                     (2*0x46)	/* 2  bytes */
 #define EEPROM_WOWLAN_MODE                  (2*0x47)	/* 2  bytes */
 #define EEPROM_RADIO_CONFIG                 (2*0x48)	/* 2  bytes */
 #define EEPROM_3945_M_VERSION               (2*0x4A)	/* 1  bytes */
-#define EEPROM_ANTENNA_SWITCH_TYPE          (2*0x4A+1)	/* 1  bytes */
 
 /* The following masks are to be applied on EEPROM_RADIO_CONFIG */
 #define EEPROM_RF_CFG_TYPE_MSK(x)   (x & 0x3)         /* bits 0-1   */
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/13] iwlwifi: separate nic_config for different NIC
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (2 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 03/13] iwlwifi: remove un-supported eeprom parameters Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 05/13] iwlwifi: separate set_hw_params function for 6000 series Reinette Chatre
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

Different NIC has different requirements for configuration. Currently all
5000 series hardware and later share the same configuration function even
though they do not need the same configurations. Fix this by separating the
needed configuration actions for each hardware model.

.5000 series: L1-ASPM H/W bug work-around
              configure radio
              write CSR_HW_IF_CONFIG_REG for uCode use
              work-around for NIC get stuck after early PCIe power off

.1000 series: write CSR_HW_IF_CONFIG_REG for uCode use
              setting digital SVR for 1000 card to 1.32V

.6000 series: configure radio
              write CSR_HW_IF_CONFIG_REG for uCode use
              write CSR_GP_DRIVER_REG to indicate radio sku

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-1000.c   |    5 ++++-
 drivers/net/wireless/iwlwifi/iwl-5000.c   |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-6000.c   |   16 +++++++++++++++-
 drivers/net/wireless/iwlwifi/iwl-eeprom.h |    7 ++++++-
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index a95caa0..b6d2abe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -76,7 +76,10 @@ static void iwl1000_set_ct_threshold(struct iwl_priv *priv)
 /* NIC configuration for 1000 series */
 static void iwl1000_nic_config(struct iwl_priv *priv)
 {
-	iwl5000_nic_config(priv);
+	/* set CSR_HW_CONFIG_REG for uCode use */
+	iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+		    CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
+		    CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
 
 	/* Setting digital SVR for 1000 card to 1.32V */
 	/* locking is acquired in iwl_set_bits_mask_prph() function */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 1d539e3..ea215bb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -198,7 +198,7 @@ out:
 }
 
 
-/* NIC configuration for 5000 series and up */
+/* NIC configuration for 5000 series */
 void iwl5000_nic_config(struct iwl_priv *priv)
 {
 	unsigned long flags;
@@ -221,7 +221,7 @@ void iwl5000_nic_config(struct iwl_priv *priv)
 	radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
 
 	/* write radio config values to register */
-	if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_5000_RF_CFG_TYPE_MAX)
+	if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) < EEPROM_RF_CONFIG_TYPE_MAX)
 		iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
 			    EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
 			    EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 82b9c93..36655c2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -71,7 +71,21 @@ static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
 /* NIC configuration for 6000 series */
 static void iwl6000_nic_config(struct iwl_priv *priv)
 {
-	iwl5000_nic_config(priv);
+	u16 radio_cfg;
+
+	radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
+
+	/* write radio config values to register */
+	if (EEPROM_RF_CFG_TYPE_MSK(radio_cfg) <= EEPROM_RF_CONFIG_TYPE_MAX)
+		iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+			    EEPROM_RF_CFG_TYPE_MSK(radio_cfg) |
+			    EEPROM_RF_CFG_STEP_MSK(radio_cfg) |
+			    EEPROM_RF_CFG_DASH_MSK(radio_cfg));
+
+	/* set CSR_HW_CONFIG_REG for uCode use */
+	iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+		    CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
+		    CSR_HW_IF_CONFIG_REG_BIT_MAC_SI);
 
 	/* no locking required for register write */
 	if (priv->cfg->pa_type == IWL_PA_HYBRID) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 90e2b4e..61794eb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -385,7 +385,12 @@ struct iwl_eeprom_calib_info {
 
 #define EEPROM_3945_RF_CFG_TYPE_MAX  0x0
 #define EEPROM_4965_RF_CFG_TYPE_MAX  0x1
-#define EEPROM_5000_RF_CFG_TYPE_MAX  0x3
+
+/* Radio Config for 5000 and up */
+#define EEPROM_RF_CONFIG_TYPE_R3x3	0x0
+#define EEPROM_RF_CONFIG_TYPE_R2x2	0x1
+#define EEPROM_RF_CONFIG_TYPE_R1x2	0x2
+#define EEPROM_RF_CONFIG_TYPE_MAX	0x3
 
 /*
  * Per-channel regulatory data.
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/13] iwlwifi: separate set_hw_params function for 6000 series
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (3 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 04/13] iwlwifi: separate nic_config for different NIC Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 06/13 v2.6.32 and w-t] iwlwifi: fix potential rx buffer loss Reinette Chatre
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

Separate set_hw_params() function for 6000
series from 5000/1000 series because:
    1) 6000 series use different set of sensitivity range table
    2) 6000 series has different uCode image size

Also include the new sensitivity parameters needed by sensitivity
algorithm.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-5000.c  |   12 +----
 drivers/net/wireless/iwlwifi/iwl-6000.c  |   71 +++++++++++++++++++++++++++++-
 drivers/net/wireless/iwlwifi/iwl-calib.c |    2 +-
 3 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index ea215bb..e4acfc3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -833,16 +833,8 @@ int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
 	priv->hw_params.max_stations = IWL5000_STATION_COUNT;
 	priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
 
-	switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-	case CSR_HW_REV_TYPE_6x00:
-	case CSR_HW_REV_TYPE_6x50:
-		priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
-		priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
-		break;
-	default:
-		priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
-		priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
-	}
+	priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
+	priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
 
 	priv->hw_params.max_bsm_size = 0;
 	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 36655c2..957205c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -44,6 +44,7 @@
 #include "iwl-sta.h"
 #include "iwl-helpers.h"
 #include "iwl-5000-hw.h"
+#include "iwl-6000-hw.h"
 
 /* Highest firmware API version supported */
 #define IWL6000_UCODE_API_MAX 4
@@ -100,8 +101,76 @@ static void iwl6000_nic_config(struct iwl_priv *priv)
 	/* else do nothing, uCode configured */
 }
 
+static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
+	.min_nrg_cck = 97,
+	.max_nrg_cck = 0, /* not used, set to 0 */
+	.auto_corr_min_ofdm = 80,
+	.auto_corr_min_ofdm_mrc = 128,
+	.auto_corr_min_ofdm_x1 = 105,
+	.auto_corr_min_ofdm_mrc_x1 = 192,
+
+	.auto_corr_max_ofdm = 145,
+	.auto_corr_max_ofdm_mrc = 232,
+	.auto_corr_max_ofdm_x1 = 145,
+	.auto_corr_max_ofdm_mrc_x1 = 232,
+
+	.auto_corr_min_cck = 125,
+	.auto_corr_max_cck = 175,
+	.auto_corr_min_cck_mrc = 160,
+	.auto_corr_max_cck_mrc = 310,
+	.nrg_th_cck = 97,
+	.nrg_th_ofdm = 100,
+};
+
+static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
+{
+	if ((priv->cfg->mod_params->num_of_queues > IWL50_NUM_QUEUES) ||
+	    (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
+		IWL_ERR(priv,
+			"invalid queues_num, should be between %d and %d\n",
+			IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES);
+		return -EINVAL;
+	}
+
+	priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues;
+	priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
+	priv->hw_params.scd_bc_tbls_size =
+			IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl);
+	priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
+	priv->hw_params.max_stations = IWL5000_STATION_COUNT;
+	priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
+
+	priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
+	priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
+
+	priv->hw_params.max_bsm_size = 0;
+	priv->hw_params.ht40_channel =  BIT(IEEE80211_BAND_2GHZ) |
+					BIT(IEEE80211_BAND_5GHZ);
+	priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
+
+	priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
+	priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
+	priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
+	priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
+
+	if (priv->cfg->ops->lib->temp_ops.set_ct_kill)
+		priv->cfg->ops->lib->temp_ops.set_ct_kill(priv);
+
+	/* Set initial sensitivity parameters */
+	/* Set initial calibration set */
+	priv->hw_params.sens = &iwl6000_sensitivity;
+	priv->hw_params.calib_init_cfg =
+			BIT(IWL_CALIB_XTAL)		|
+			BIT(IWL_CALIB_LO)		|
+			BIT(IWL_CALIB_TX_IQ) 		|
+			BIT(IWL_CALIB_TX_IQ_PERD)	|
+			BIT(IWL_CALIB_BASE_BAND);
+
+	return 0;
+}
+
 static struct iwl_lib_ops iwl6000_lib = {
-	.set_hw_params = iwl5000_hw_set_hw_params,
+	.set_hw_params = iwl6000_hw_set_hw_params,
 	.txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
 	.txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
 	.txq_set_sched = iwl5000_txq_set_sched,
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c
index c4b565a..6e73317 100644
--- a/drivers/net/wireless/iwlwifi/iwl-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-calib.c
@@ -516,7 +516,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
 	for (i = 0; i < NRG_NUM_PREV_STAT_L; i++)
 		data->nrg_silence_rssi[i] = 0;
 
-	data->auto_corr_ofdm = 90;
+	data->auto_corr_ofdm =  ranges->auto_corr_min_ofdm;
 	data->auto_corr_ofdm_mrc = ranges->auto_corr_min_ofdm_mrc;
 	data->auto_corr_ofdm_x1  = ranges->auto_corr_min_ofdm_x1;
 	data->auto_corr_ofdm_mrc_x1 = ranges->auto_corr_min_ofdm_mrc_x1;
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/13 v2.6.32 and w-t] iwlwifi: fix potential rx buffer loss
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (4 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 05/13] iwlwifi: separate set_hw_params function for 6000 series Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 07/13] iwlwifi: clean up ht config a little Reinette Chatre
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Reinette Chatre

From: Reinette Chatre <reinette.chatre@intel.com>

RX handling maintains a few lists that keep track of the RX buffers.
Buffers move from one list to the other as they are used, replenished, and
again made available for usage. In one such instance, when a buffer is used
it enters the "rx_used" list. When buffers are replenished an skb is
attached to the buffer and it is moved to the "rx_free" list. The problem
here is that the buffer is first removed from the "rx_used" list _before_ the
skb is allocated. Thus, if the skb allocation fails this buffer remains
removed from the "rx_used" list and is thus lost for future usage.

Fix this by first allocating the skb before trying to attach it to a list.
We add an additional check to not do this unnecessarily.

Reported-by: Rick Farrington <rickdic@hotmail.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-rx.c       |   24 +++++++++++++++++-------
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   24 ++++++++++++++++--------
 2 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8150c5c..b90adcb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -239,26 +239,22 @@ void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority)
 	struct iwl_rx_queue *rxq = &priv->rxq;
 	struct list_head *element;
 	struct iwl_rx_mem_buffer *rxb;
+	struct sk_buff *skb;
 	unsigned long flags;
 
 	while (1) {
 		spin_lock_irqsave(&rxq->lock, flags);
-
 		if (list_empty(&rxq->rx_used)) {
 			spin_unlock_irqrestore(&rxq->lock, flags);
 			return;
 		}
-		element = rxq->rx_used.next;
-		rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
-		list_del(element);
-
 		spin_unlock_irqrestore(&rxq->lock, flags);
 
 		/* Alloc a new receive buffer */
-		rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
+		skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
 						priority);
 
-		if (!rxb->skb) {
+		if (!skb) {
 			IWL_CRIT(priv, "Can not allocate SKB buffers\n");
 			/* We don't reschedule replenish work here -- we will
 			 * call the restock method and if it still needs
@@ -266,6 +262,20 @@ void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority)
 			break;
 		}
 
+		spin_lock_irqsave(&rxq->lock, flags);
+
+		if (list_empty(&rxq->rx_used)) {
+			spin_unlock_irqrestore(&rxq->lock, flags);
+			dev_kfree_skb_any(skb);
+			return;
+		}
+		element = rxq->rx_used.next;
+		rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
+		list_del(element);
+
+		spin_unlock_irqrestore(&rxq->lock, flags);
+
+		rxb->skb = skb;
 		/* Get physical address of RB/SKB */
 		rxb->real_dma_addr = pci_map_single(
 					priv->pci_dev,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2238c9f..0909668 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1134,6 +1134,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
 	struct iwl_rx_queue *rxq = &priv->rxq;
 	struct list_head *element;
 	struct iwl_rx_mem_buffer *rxb;
+	struct sk_buff *skb;
 	unsigned long flags;
 
 	while (1) {
@@ -1143,17 +1144,11 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
 			spin_unlock_irqrestore(&rxq->lock, flags);
 			return;
 		}
-
-		element = rxq->rx_used.next;
-		rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
-		list_del(element);
 		spin_unlock_irqrestore(&rxq->lock, flags);
 
 		/* Alloc a new receive buffer */
-		rxb->skb =
-		    alloc_skb(priv->hw_params.rx_buf_size,
-				priority);
-		if (!rxb->skb) {
+		skb = alloc_skb(priv->hw_params.rx_buf_size, priority);
+		if (!skb) {
 			if (net_ratelimit())
 				IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
 			/* We don't reschedule replenish work here -- we will
@@ -1162,6 +1157,19 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
 			break;
 		}
 
+		spin_lock_irqsave(&rxq->lock, flags);
+		if (list_empty(&rxq->rx_used)) {
+			spin_unlock_irqrestore(&rxq->lock, flags);
+			dev_kfree_skb_any(skb);
+			return;
+		}
+		element = rxq->rx_used.next;
+		rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
+		list_del(element);
+		spin_unlock_irqrestore(&rxq->lock, flags);
+
+		rxb->skb = skb;
+
 		/* If radiotap head is required, reserve some headroom here.
 		 * The physical head count is a variable rx_stats->phy_count.
 		 * We reserve 4 bytes here. Plus these extra bytes, the
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/13] iwlwifi: clean up ht config a little
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (5 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 06/13 v2.6.32 and w-t] iwlwifi: fix potential rx buffer loss Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:46   ` Gábor Stefanik
  2009-09-11 17:38 ` [PATCH 08/13] iwlwifi: Adjust blink rate to compensate Clock difference Reinette Chatre
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg, Reinette Chatre

From: Johannes Berg <johannes@sipsolutions.net>

is_ht can be bool instead of u8, and there's
no need to use IWL_CHANNEL_WIDTH_* constants
in supported_chan_width when that could just
be named is_40mhz instead.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-core.c |   14 +++++---------
 drivers/net/wireless/iwlwifi/iwl-dev.h  |    7 ++-----
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index acfd7b4..7c50065 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -636,8 +636,7 @@ u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
 {
 	struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;
 
-	if ((!iwl_ht_conf->is_ht) ||
-	    (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ))
+	if (!iwl_ht_conf->is_ht || !iwl_ht_conf->is_40mhz)
 		return 0;
 
 	/* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
@@ -2799,21 +2798,18 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
 			if (conf_is_ht40_minus(conf)) {
 				ht_conf->extension_chan_offset =
 					IEEE80211_HT_PARAM_CHA_SEC_BELOW;
-				ht_conf->supported_chan_width =
-					IWL_CHANNEL_WIDTH_40MHZ;
+				ht_conf->is_40mhz = true;
 			} else if (conf_is_ht40_plus(conf)) {
 				ht_conf->extension_chan_offset =
 					IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
-				ht_conf->supported_chan_width =
-					IWL_CHANNEL_WIDTH_40MHZ;
+				ht_conf->is_40mhz = true;
 			} else {
 				ht_conf->extension_chan_offset =
 					IEEE80211_HT_PARAM_CHA_SEC_NONE;
-				ht_conf->supported_chan_width =
-					IWL_CHANNEL_WIDTH_20MHZ;
+				ht_conf->is_40mhz = false;
 			}
 		} else
-			ht_conf->supported_chan_width = IWL_CHANNEL_WIDTH_20MHZ;
+			ht_conf->is_40mhz = false;
 		/* Default to no protection. Protection mode will later be set
 		 * from BSS config in iwl_ht_conf */
 		ht_conf->ht_protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 028d505..961d534 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -504,8 +504,8 @@ union iwl_ht_rate_supp {
 
 struct iwl_ht_info {
 	/* self configuration data */
-	u8 is_ht;
-	u8 supported_chan_width;
+	bool is_ht;
+	bool is_40mhz;
 	u8 sm_ps;
 	struct ieee80211_mcs_info mcs;
 	/* BSS related data */
@@ -726,9 +726,6 @@ struct iwl_dma_ptr {
 	size_t size;
 };
 
-#define IWL_CHANNEL_WIDTH_20MHZ   0
-#define IWL_CHANNEL_WIDTH_40MHZ   1
-
 #define IWL_OPERATION_MODE_AUTO     0
 #define IWL_OPERATION_MODE_HT_ONLY  1
 #define IWL_OPERATION_MODE_MIXED    2
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/13] iwlwifi: Adjust blink rate to compensate Clock difference
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (6 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 07/13] iwlwifi: clean up ht config a little Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 09/13] iwlwifi: clean up ht config naming Reinette Chatre
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

Adjust led blink rate to compensate on a MAC Clock difference on every
HW. Led blink rate analysis showed an average deviation of 0% on 3945,
5% on 4965 HW and 20% on 5000 series and up.
Need to compensate on the led on/off time per HW according to the
deviation to achieve the desired led frequency
The calculation is: (100-averageDeviation)/100 * blinkTime
For code efficiency the calculation will be:
    compensation = (100 - averageDeviation) * 64 / 100
    NewBlinkTime = (compensation * BlinkTime) / 64

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-1000.c |    1 +
 drivers/net/wireless/iwlwifi/iwl-3945.c |    2 +
 drivers/net/wireless/iwlwifi/iwl-4965.c |    1 +
 drivers/net/wireless/iwlwifi/iwl-5000.c |    6 +++++
 drivers/net/wireless/iwlwifi/iwl-6000.c |    5 ++++
 drivers/net/wireless/iwlwifi/iwl-core.h |    4 +++
 drivers/net/wireless/iwlwifi/iwl-led.c  |   33 +++++++++++++++++++++++++++++-
 7 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index b6d2abe..486b144 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -162,5 +162,6 @@ struct iwl_cfg iwl1000_bgn_cfg = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_1000,
 	.shadow_ram_support = false,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index e9a685d..63dfa57 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2892,6 +2892,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
 	.mod_params = &iwl3945_mod_params,
 	.use_isr_legacy = true,
 	.ht_greenfield_support = false,
+	.led_compensation = 64,
 };
 
 static struct iwl_cfg iwl3945_abg_cfg = {
@@ -2906,6 +2907,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
 	.mod_params = &iwl3945_mod_params,
 	.use_isr_legacy = true,
 	.ht_greenfield_support = false,
+	.led_compensation = 64,
 };
 
 struct pci_device_id iwl3945_hw_card_ids[] = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 6a13bfb..63df1e4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2346,6 +2346,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
 	.mod_params = &iwl4965_mod_params,
 	.use_isr_legacy = true,
 	.ht_greenfield_support = false,
+	.led_compensation = 61,
 };
 
 /* Module firmware */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e4acfc3..c31bde3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1646,6 +1646,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
 	.valid_rx_ant = ANT_ABC,
 	.need_pll_cfg = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl5100_bg_cfg = {
@@ -1663,6 +1664,7 @@ struct iwl_cfg iwl5100_bg_cfg = {
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl5100_abg_cfg = {
@@ -1680,6 +1682,7 @@ struct iwl_cfg iwl5100_abg_cfg = {
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl5100_agn_cfg = {
@@ -1697,6 +1700,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl5350_agn_cfg = {
@@ -1714,6 +1718,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
 	.valid_rx_ant = ANT_ABC,
 	.need_pll_cfg = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl5150_agn_cfg = {
@@ -1731,6 +1736,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
 	.valid_rx_ant = ANT_AB,
 	.need_pll_cfg = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 957205c..89b111a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -256,6 +256,7 @@ struct iwl_cfg iwl6000h_2agn_cfg = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 /*
@@ -279,6 +280,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl6050_2agn_cfg = {
@@ -299,6 +301,7 @@ struct iwl_cfg iwl6050_2agn_cfg = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl6000_3agn_cfg = {
@@ -319,6 +322,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 struct iwl_cfg iwl6050_3agn_cfg = {
@@ -339,6 +343,7 @@ struct iwl_cfg iwl6050_3agn_cfg = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.ht_greenfield_support = true,
+	.led_compensation = 51,
 };
 
 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index c04d2a2..dfeca62 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -211,6 +211,9 @@ struct iwl_mod_params {
  * @pa_type: used by 6000 series only to identify the type of Power Amplifier
  * @max_ll_items: max number of OTP blocks
  * @shadow_ram_support: shadow support for OTP memory
+ * @led_compensation: compensate on the led on/off time per HW according
+ *	to the deviation to achieve the desired led frequency.
+ *	The detail algorithm is described in iwl-led.c
  *
  * We enable the driver to be backward compatible wrt API version. The
  * driver specifies which APIs it supports (with @ucode_api_max being the
@@ -252,6 +255,7 @@ struct iwl_cfg {
 	const u16 max_ll_items;
 	const bool shadow_ram_support;
 	const bool ht_greenfield_support;
+	u16 led_compensation;
 };
 
 /***************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 41addd1..f547233 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -78,6 +78,29 @@ static const struct {
 #define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /* exclude SOLID_ON */
 #define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1)
 
+/*
+ * Adjust led blink rate to compensate on a MAC Clock difference on every HW
+ * Led blink rate analysis showed an average deviation of 0% on 3945,
+ * 5% on 4965 HW and 20% on 5000 series and up.
+ * Need to compensate on the led on/off time per HW according to the deviation
+ * to achieve the desired led frequency
+ * The calculation is: (100-averageDeviation)/100 * blinkTime
+ * For code efficiency the calculation will be:
+ *     compensation = (100 - averageDeviation) * 64 / 100
+ *     NewBlinkTime = (compensation * BlinkTime) / 64
+ */
+static inline u8 iwl_blink_compensation(struct iwl_priv *priv,
+				    u8 time, u16 compensation)
+{
+	if (!compensation) {
+		IWL_ERR(priv, "undefined blink compensation: "
+			"use pre-defined blinking time\n");
+		return time;
+	}
+
+	return (u8)((time * compensation) >> 6);
+}
+
 /*  [0-256] -> [0..8] FIXME: we need [0..10] */
 static inline int iwl_brightness_to_idx(enum led_brightness brightness)
 {
@@ -114,8 +137,14 @@ static int iwl_led_pattern(struct iwl_priv *priv, int led_id,
 
 	BUG_ON(idx > IWL_MAX_BLINK_TBL);
 
-	led_cmd.on = blink_tbl[idx].on_time;
-	led_cmd.off = blink_tbl[idx].off_time;
+	IWL_DEBUG_LED(priv, "Led blink time compensation= %u\n",
+			priv->cfg->led_compensation);
+	led_cmd.on =
+		iwl_blink_compensation(priv, blink_tbl[idx].on_time,
+					priv->cfg->led_compensation);
+	led_cmd.off =
+		iwl_blink_compensation(priv, blink_tbl[idx].off_time,
+					priv->cfg->led_compensation);
 
 	return iwl_send_led_cmd(priv, &led_cmd);
 }
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/13] iwlwifi: clean up ht config naming
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (7 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 08/13] iwlwifi: Adjust blink rate to compensate Clock difference Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-13 23:45   ` [ipw3945-devel] " Tomas Winkler
  2009-09-11 17:38 ` [PATCH 10/13] iwlwifi: show NVM version in debugfs Reinette Chatre
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg, Reinette Chatre

From: Johannes Berg <johannes@sipsolutions.net>

Daniel Halperin pointed out that the naming
here is rather inconsistent with at least 3
different names being used for one thing in
different contexts. Rename the struct to
iwl_ht_config (rather than iwl_ht_info) and
use ht_conf as a variable for it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Daniel C Halperin <daniel.c.halperin@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-core.c   |   48 ++++++++++++++--------------
 drivers/net/wireless/iwlwifi/iwl-core.h   |    2 +-
 drivers/net/wireless/iwlwifi/iwl-dev.h    |    4 +-
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index fd73153..9d0758a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -662,7 +662,7 @@ static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
  * there are no non-GF stations present in the BSS.
  */
 static inline u8 rs_use_green(struct ieee80211_sta *sta,
-			      struct iwl_ht_info *ht_conf)
+			      struct iwl_ht_config *ht_conf)
 {
 	return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) &&
 		!(ht_conf->non_GF_STA_present);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 7c50065..d9a757a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -634,9 +634,9 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv,
 u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
 			 struct ieee80211_sta_ht_cap *sta_ht_inf)
 {
-	struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;
+	struct iwl_ht_config *ht_conf = &priv->current_ht_config;
 
-	if (!iwl_ht_conf->is_ht || !iwl_ht_conf->is_40mhz)
+	if (!ht_conf->is_ht || !ht_conf->is_40mhz)
 		return 0;
 
 	/* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
@@ -652,7 +652,7 @@ u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
 #endif
 	return iwl_is_channel_extension(priv, priv->band,
 			le16_to_cpu(priv->staging_rxon.channel),
-			iwl_ht_conf->extension_chan_offset);
+			ht_conf->extension_chan_offset);
 }
 EXPORT_SYMBOL(iwl_is_ht40_tx_allowed);
 
@@ -876,11 +876,11 @@ u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_rate_get_lowest_plcp);
 
-void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
+void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
 {
 	struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
 
-	if (!ht_info->is_ht) {
+	if (!ht_conf->is_ht) {
 		rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK |
 			RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK |
 			RXON_FLG_HT40_PROT_MSK |
@@ -891,7 +891,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
 	/* FIXME: if the definition of ht_protection changed, the "translation"
 	 * will be needed for rxon->flags
 	 */
-	rxon->flags |= cpu_to_le32(ht_info->ht_protection << RXON_FLG_HT_OPERATING_MODE_POS);
+	rxon->flags |= cpu_to_le32(ht_conf->ht_protection << RXON_FLG_HT_OPERATING_MODE_POS);
 
 	/* Set up channel bandwidth:
 	 * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */
@@ -900,10 +900,10 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
 			 RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
 	if (iwl_is_ht40_tx_allowed(priv, NULL)) {
 		/* pure ht40 */
-		if (ht_info->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
+		if (ht_conf->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
 			rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40;
 			/* Note: control channel is opposite of extension channel */
-			switch (ht_info->extension_chan_offset) {
+			switch (ht_conf->extension_chan_offset) {
 			case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
 				rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
 				break;
@@ -913,7 +913,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
 			}
 		} else {
 			/* Note: control channel is opposite of extension channel */
-			switch (ht_info->extension_chan_offset) {
+			switch (ht_conf->extension_chan_offset) {
 			case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
 				rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
 				rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED;
@@ -939,11 +939,11 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
 	IWL_DEBUG_ASSOC(priv, "supported HT rate 0x%X 0x%X 0x%X "
 			"rxon flags 0x%X operation mode :0x%X "
 			"extension channel offset 0x%x\n",
-			ht_info->mcs.rx_mask[0],
-			ht_info->mcs.rx_mask[1],
-			ht_info->mcs.rx_mask[2],
-			le32_to_cpu(rxon->flags), ht_info->ht_protection,
-			ht_info->extension_chan_offset);
+			ht_conf->mcs.rx_mask[0],
+			ht_conf->mcs.rx_mask[1],
+			ht_conf->mcs.rx_mask[2],
+			le32_to_cpu(rxon->flags), ht_conf->ht_protection,
+			ht_conf->extension_chan_offset);
 	return;
 }
 EXPORT_SYMBOL(iwl_set_rxon_ht);
@@ -2408,13 +2408,13 @@ EXPORT_SYMBOL(iwl_mac_conf_tx);
 static void iwl_ht_conf(struct iwl_priv *priv,
 			    struct ieee80211_bss_conf *bss_conf)
 {
-	struct ieee80211_sta_ht_cap *ht_conf;
-	struct iwl_ht_info *iwl_conf = &priv->current_ht_config;
+	struct iwl_ht_config *ht_conf = &priv->current_ht_config;
+	struct ieee80211_sta_ht_cap *ht_cap;
 	struct ieee80211_sta *sta;
 
 	IWL_DEBUG_MAC80211(priv, "enter: \n");
 
-	if (!iwl_conf->is_ht)
+	if (!ht_conf->is_ht)
 		return;
 
 
@@ -2430,15 +2430,15 @@ static void iwl_ht_conf(struct iwl_priv *priv,
 		rcu_read_unlock();
 		return;
 	}
-	ht_conf = &sta->ht_cap;
+	ht_cap = &sta->ht_cap;
 
-	iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
+	ht_conf->sm_ps = (u8)((ht_cap->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
 
-	memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16);
+	memcpy(&ht_conf->mcs, &ht_cap->mcs, 16);
 
-	iwl_conf->ht_protection =
+	ht_conf->ht_protection =
 		bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION;
-	iwl_conf->non_GF_STA_present =
+	ht_conf->non_GF_STA_present =
 		!!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
 
 	rcu_read_unlock();
@@ -2748,7 +2748,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
 	struct iwl_priv *priv = hw->priv;
 	const struct iwl_channel_info *ch_info;
 	struct ieee80211_conf *conf = &hw->conf;
-	struct iwl_ht_info *ht_conf = &priv->current_ht_config;
+	struct iwl_ht_config *ht_conf = &priv->current_ht_config;
 	unsigned long flags = 0;
 	int ret = 0;
 	u16 ch;
@@ -2915,7 +2915,7 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
 	IWL_DEBUG_MAC80211(priv, "enter\n");
 
 	spin_lock_irqsave(&priv->lock, flags);
-	memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info));
+	memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_config));
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	iwl_reset_qos(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index dfeca62..cab148d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -274,7 +274,7 @@ int iwl_check_rxon_cmd(struct iwl_priv *priv);
 int iwl_full_rxon_required(struct iwl_priv *priv);
 void iwl_set_rxon_chain(struct iwl_priv *priv);
 int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
-void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
+void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf);
 u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
 			 struct ieee80211_sta_ht_cap *sta_ht_inf);
 void iwl_set_flags_for_band(struct iwl_priv *priv, enum ieee80211_band band);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 961d534..e161f8d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -502,7 +502,7 @@ union iwl_ht_rate_supp {
 #define CFG_HT_MPDU_DENSITY_4USEC   (0x5)
 #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
 
-struct iwl_ht_info {
+struct iwl_ht_config {
 	/* self configuration data */
 	bool is_ht;
 	bool is_40mhz;
@@ -1077,7 +1077,7 @@ struct iwl_priv {
 	struct iwl_chain_noise_data chain_noise_data;
 	__le16 sensitivity_tbl[HD_TABLE_SIZE];
 
-	struct iwl_ht_info current_ht_config;
+	struct iwl_ht_config current_ht_config;
 	u8 last_phy_res[100];
 
 	/* Rate scaling data */
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/13] iwlwifi: show NVM version in debugfs
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (8 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 09/13] iwlwifi: clean up ht config naming Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 11/13] iwlwifi: clarify and clean up chain settings Reinette Chatre
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

Show version number along with dumping NVM data, the version information
being removed from sysfs, add it back to debugfs to help debugging.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-debugfs.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index fb84485..1a0337f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -383,6 +383,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
 	int pos = 0, ofs = 0, buf_size = 0;
 	const u8 *ptr;
 	char *buf;
+	u16 eeprom_ver;
 	size_t eeprom_len = priv->cfg->eeprom_size;
 	buf_size = 4 * eeprom_len + 256;
 
@@ -403,9 +404,11 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file,
 		IWL_ERR(priv, "Can not allocate Buffer\n");
 		return -ENOMEM;
 	}
-	pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s\n",
+	eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
+	pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, "
+			"version: 0x%x\n",
 			(priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
-			? "OTP" : "EEPROM");
+			 ? "OTP" : "EEPROM", eeprom_ver);
 	for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
 		pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
 		hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/13] iwlwifi: clarify and clean up chain settings
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (9 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 10/13] iwlwifi: show NVM version in debugfs Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 12/13 v2.6.32 and w-t] iwlwifi: find the correct first antenna Reinette Chatre
  2009-09-11 17:38 ` [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965 Reinette Chatre
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg, Reinette Chatre

From: Johannes Berg <johannes@sipsolutions.net>

The chain settings we currently use in iwlwifi are
rather confusing -- and we also go by the wrong
settings entirely under certain circumstances. To
clean it up, create a new variable in the current
HT config -- single_chain_sufficient -- that tells
us whether we need more than one chain. Calculate
that based on the AP and operating mode (no IBSS
HT implemented -- so no need for multiple chains,
for station mode we use the AP's capabilities).

Additionally, since APs always send disabled SM PS
mode, keeping track of their sm_ps mode isn't very
useful -- doubly not so for our _own_ RX config
since that should depend on our, not the AP's, SM
PS mode.

Finally, document that our configuration of the
number of RX chains used is currently wrong when
in powersave (by adding a comment).

All together this removes the two remaining items
in struct iwl_ht_config that were done wrong there.

For the future, the number of RX chains and some
SM PS handshaking needs to be added to mac80211,
which then needs to tell us, and the new variable
current_ht_config.single_chain_sufficient should
also be calculated by mac80211.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Daniel C Halperin <daniel.c.halperin@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-core.c |  105 +++++++++++++++----------------
 drivers/net/wireless/iwlwifi/iwl-dev.h  |    3 +-
 2 files changed, 51 insertions(+), 57 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index d9a757a..5c6cee2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -607,8 +607,7 @@ EXPORT_SYMBOL(iwlcore_free_geos);
 static bool is_single_rx_stream(struct iwl_priv *priv)
 {
 	return !priv->current_ht_config.is_ht ||
-	       ((priv->current_ht_config.mcs.rx_mask[1] == 0) &&
-		(priv->current_ht_config.mcs.rx_mask[2] == 0));
+	       priv->current_ht_config.single_chain_sufficient;
 }
 
 static u8 iwl_is_channel_extension(struct iwl_priv *priv,
@@ -936,12 +935,8 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
 	if (priv->cfg->ops->hcmd->set_rxon_chain)
 		priv->cfg->ops->hcmd->set_rxon_chain(priv);
 
-	IWL_DEBUG_ASSOC(priv, "supported HT rate 0x%X 0x%X 0x%X "
-			"rxon flags 0x%X operation mode :0x%X "
+	IWL_DEBUG_ASSOC(priv, "rxon flags 0x%X operation mode :0x%X "
 			"extension channel offset 0x%x\n",
-			ht_conf->mcs.rx_mask[0],
-			ht_conf->mcs.rx_mask[1],
-			ht_conf->mcs.rx_mask[2],
 			le32_to_cpu(rxon->flags), ht_conf->ht_protection,
 			ht_conf->extension_chan_offset);
 	return;
@@ -960,12 +955,8 @@ EXPORT_SYMBOL(iwl_set_rxon_ht);
  */
 static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
 {
-	bool is_single = is_single_rx_stream(priv);
-	bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
-
 	/* # of Rx chains to use when expecting MIMO. */
-	if (is_single || (!is_cam && (priv->current_ht_config.sm_ps ==
-						 WLAN_HT_CAP_SM_PS_STATIC)))
+	if (is_single_rx_stream(priv))
 		return IWL_NUM_RX_CHAINS_SINGLE;
 	else
 		return IWL_NUM_RX_CHAINS_MULTIPLE;
@@ -973,27 +964,17 @@ static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
 
 static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
 {
-	int idle_cnt;
 	bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
+
 	/* # Rx chains when idling and maybe trying to save power */
-	switch (priv->current_ht_config.sm_ps) {
-	case WLAN_HT_CAP_SM_PS_STATIC:
-	case WLAN_HT_CAP_SM_PS_DYNAMIC:
-		idle_cnt = (is_cam) ? IWL_NUM_IDLE_CHAINS_DUAL :
-					IWL_NUM_IDLE_CHAINS_SINGLE;
-		break;
-	case WLAN_HT_CAP_SM_PS_DISABLED:
-		idle_cnt = (is_cam) ? active_cnt : IWL_NUM_IDLE_CHAINS_SINGLE;
-		break;
-	case WLAN_HT_CAP_SM_PS_INVALID:
-	default:
-		IWL_ERR(priv, "invalid mimo ps mode %d\n",
-			   priv->current_ht_config.sm_ps);
-		WARN_ON(1);
-		idle_cnt = -1;
-		break;
-	}
-	return idle_cnt;
+
+	/*
+	 * XXX: this is incorrect!!
+	 *	we always indicate to the AP that
+	 *	our SM PS mode is "disabled"
+	 */
+
+	return is_cam ? active_cnt : IWL_NUM_IDLE_CHAINS_SINGLE;
 }
 
 /* up to 4 chains */
@@ -1673,8 +1654,6 @@ int iwl_init_drv(struct iwl_priv *priv)
 
 	priv->iw_mode = NL80211_IFTYPE_STATION;
 
-	priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED;
-
 	/* Choose which receivers/antennas to use */
 	if (priv->cfg->ops->hcmd->set_rxon_chain)
 		priv->cfg->ops->hcmd->set_rxon_chain(priv);
@@ -2406,10 +2385,9 @@ int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
 EXPORT_SYMBOL(iwl_mac_conf_tx);
 
 static void iwl_ht_conf(struct iwl_priv *priv,
-			    struct ieee80211_bss_conf *bss_conf)
+			struct ieee80211_bss_conf *bss_conf)
 {
 	struct iwl_ht_config *ht_conf = &priv->current_ht_config;
-	struct ieee80211_sta_ht_cap *ht_cap;
 	struct ieee80211_sta *sta;
 
 	IWL_DEBUG_MAC80211(priv, "enter: \n");
@@ -2417,31 +2395,48 @@ static void iwl_ht_conf(struct iwl_priv *priv,
 	if (!ht_conf->is_ht)
 		return;
 
-
-	/*
-	 * It is totally wrong to base global information on something
-	 * that is valid only when associated, alas, this driver works
-	 * that way and I don't know how to fix it.
-	 */
-
-	rcu_read_lock();
-	sta = ieee80211_find_sta(priv->hw, priv->bssid);
-	if (!sta) {
-		rcu_read_unlock();
-		return;
-	}
-	ht_cap = &sta->ht_cap;
-
-	ht_conf->sm_ps = (u8)((ht_cap->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
-
-	memcpy(&ht_conf->mcs, &ht_cap->mcs, 16);
-
 	ht_conf->ht_protection =
 		bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION;
 	ht_conf->non_GF_STA_present =
 		!!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
 
-	rcu_read_unlock();
+	ht_conf->single_chain_sufficient = false;
+
+	switch (priv->iw_mode) {
+	case NL80211_IFTYPE_STATION:
+		rcu_read_lock();
+		sta = ieee80211_find_sta(priv->hw, priv->bssid);
+		if (sta) {
+			struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
+			int maxstreams;
+
+			maxstreams = (ht_cap->mcs.tx_params &
+				      IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK)
+					>> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT;
+			maxstreams += 1;
+
+			if ((ht_cap->mcs.rx_mask[1] == 0) &&
+			    (ht_cap->mcs.rx_mask[2] == 0))
+				ht_conf->single_chain_sufficient = true;
+			if (maxstreams <= 1)
+				ht_conf->single_chain_sufficient = true;
+		} else {
+			/*
+			 * If at all, this can only happen through a race
+			 * when the AP disconnects us while we're still
+			 * setting up the connection, in that case mac80211
+			 * will soon tell us about that.
+			 */
+			ht_conf->single_chain_sufficient = true;
+		}
+		rcu_read_unlock();
+		break;
+	case NL80211_IFTYPE_ADHOC:
+		ht_conf->single_chain_sufficient = true;
+		break;
+	default:
+		break;
+	}
 
 	IWL_DEBUG_MAC80211(priv, "leave\n");
 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index e161f8d..0c80692 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -506,8 +506,7 @@ struct iwl_ht_config {
 	/* self configuration data */
 	bool is_ht;
 	bool is_40mhz;
-	u8 sm_ps;
-	struct ieee80211_mcs_info mcs;
+	bool single_chain_sufficient;
 	/* BSS related data */
 	u8 extension_chan_offset;
 	u8 ht_protection;
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/13 v2.6.32 and w-t] iwlwifi: find the correct first antenna
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (10 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 11/13] iwlwifi: clarify and clean up chain settings Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:38 ` [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965 Reinette Chatre
  12 siblings, 0 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

We can not assume antenna "A" is the first valid anttena for
all the NIC. Need to make sure choice the correct antenna based on
h/w configuration for transmit to avoid sending frame on invalid
antenna

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 9d0758a..18af37c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -760,6 +760,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
 	u16 high_low;
 	u8 switch_to_legacy = 0;
 	u8 is_green = lq_sta->is_green;
+	struct iwl_priv *priv = lq_sta->drv;
 
 	/* check if we need to switch from HT to legacy rates.
 	 * assumption is that mandatory rates (1Mbps or 6Mbps)
@@ -773,7 +774,8 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
 			tbl->lq_type = LQ_G;
 
 		if (num_of_ant(tbl->ant_type) > 1)
-			tbl->ant_type = ANT_A;/*FIXME:RS*/
+			tbl->ant_type =
+				first_antenna(priv->hw_params.valid_tx_ant);
 
 		tbl->is_ht40 = 0;
 		tbl->is_SGI = 0;
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965
  2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
                   ` (11 preceding siblings ...)
  2009-09-11 17:38 ` [PATCH 12/13 v2.6.32 and w-t] iwlwifi: find the correct first antenna Reinette Chatre
@ 2009-09-11 17:38 ` Reinette Chatre
  2009-09-11 17:48   ` reinette chatre
  2009-09-11 17:50   ` [PATCH 13/13 v2.6.32] " reinette chatre
  12 siblings, 2 replies; 21+ messages in thread
From: Reinette Chatre @ 2009-09-11 17:38 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg, Reinette Chatre

From: Johannes Berg <johannes@sipsolutions.net>

There's a bug in 4965 powersave that appears to
be related to the way it keeps track of its data
during sleep, but we haven't found it yet. Due to
that, using powersave may spontaneously cause the
device to SYSASSERT when transitioning from sleep
to wake. Therefore, disable powersave for 4965,
until (if ever, unfortunately) we can identify
and fix the problem.

Cf. http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=1982
which was closed, but now has re-appeared with
IDLE mode, which probably means we never really
fixed it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-4965.c  |    1 +
 drivers/net/wireless/iwlwifi/iwl-core.c  |    9 ++++++---
 drivers/net/wireless/iwlwifi/iwl-core.h  |    1 +
 drivers/net/wireless/iwlwifi/iwl-power.c |    5 +++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 63df1e4..d61d5a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2346,6 +2346,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
 	.mod_params = &iwl4965_mod_params,
 	.use_isr_legacy = true,
 	.ht_greenfield_support = false,
+	.broken_powersave = true,
 	.led_compensation = 61,
 };
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 5c6cee2..e447c1a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1565,9 +1565,12 @@ int iwl_setup_mac(struct iwl_priv *priv)
 	hw->flags = IEEE80211_HW_SIGNAL_DBM |
 		    IEEE80211_HW_NOISE_DBM |
 		    IEEE80211_HW_AMPDU_AGGREGATION |
-		    IEEE80211_HW_SPECTRUM_MGMT |
-		    IEEE80211_HW_SUPPORTS_PS |
-		    IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
+		    IEEE80211_HW_SPECTRUM_MGMT;
+
+	if (!priv->cfg->broken_powersave)
+		hw->flags |= IEEE80211_HW_SUPPORTS_PS |
+			     IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
+
 	hw->wiphy->interface_modes =
 		BIT(NL80211_IFTYPE_STATION) |
 		BIT(NL80211_IFTYPE_ADHOC);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index cab148d..5e1f700 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -256,6 +256,7 @@ struct iwl_cfg {
 	const bool shadow_ram_support;
 	const bool ht_greenfield_support;
 	u16 led_compensation;
+	const bool broken_powersave;
 };
 
 /***************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 4ec6a83..60be976 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -292,8 +292,9 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
 	else
 		dtimper = 1;
 
-	/* TT power setting overwrites everything */
-	if (tt->state >= IWL_TI_1)
+	if (priv->cfg->broken_powersave)
+		iwl_power_sleep_cam_cmd(priv, &cmd);
+	else if (tt->state >= IWL_TI_1)
 		iwl_static_sleep_cmd(priv, &cmd, tt->tt_power_mode, dtimper);
 	else if (!enabled)
 		iwl_power_sleep_cam_cmd(priv, &cmd);
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/13] iwlwifi: clean up ht config a little
  2009-09-11 17:38 ` [PATCH 07/13] iwlwifi: clean up ht config a little Reinette Chatre
@ 2009-09-11 17:46   ` Gábor Stefanik
  2009-09-11 21:12     ` reinette chatre
  2009-09-12 13:12     ` Johannes Berg
  0 siblings, 2 replies; 21+ messages in thread
From: Gábor Stefanik @ 2009-09-11 17:46 UTC (permalink / raw)
  To: Reinette Chatre; +Cc: linville, linux-wireless, ipw3945-devel, Johannes Berg

On Fri, Sep 11, 2009 at 7:38 PM, Reinette Chatre
<reinette.chatre@intel.com> wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
>
> is_ht can be bool instead of u8, and there's
> no need to use IWL_CHANNEL_WIDTH_* constants
> in supported_chan_width when that could just
> be named is_40mhz instead.

What about is_ht40?

>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> ---
>  drivers/net/wireless/iwlwifi/iwl-core.c |   14 +++++---------
>  drivers/net/wireless/iwlwifi/iwl-dev.h  |    7 ++-----
>  2 files changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
> index acfd7b4..7c50065 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-core.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
> @@ -636,8 +636,7 @@ u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
>  {
>        struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;
>
> -       if ((!iwl_ht_conf->is_ht) ||
> -           (iwl_ht_conf->supported_chan_width != IWL_CHANNEL_WIDTH_40MHZ))
> +       if (!iwl_ht_conf->is_ht || !iwl_ht_conf->is_40mhz)
>                return 0;
>
>        /* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
> @@ -2799,21 +2798,18 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
>                        if (conf_is_ht40_minus(conf)) {
>                                ht_conf->extension_chan_offset =
>                                        IEEE80211_HT_PARAM_CHA_SEC_BELOW;
> -                               ht_conf->supported_chan_width =
> -                                       IWL_CHANNEL_WIDTH_40MHZ;
> +                               ht_conf->is_40mhz = true;
>                        } else if (conf_is_ht40_plus(conf)) {
>                                ht_conf->extension_chan_offset =
>                                        IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
> -                               ht_conf->supported_chan_width =
> -                                       IWL_CHANNEL_WIDTH_40MHZ;
> +                               ht_conf->is_40mhz = true;
>                        } else {
>                                ht_conf->extension_chan_offset =
>                                        IEEE80211_HT_PARAM_CHA_SEC_NONE;
> -                               ht_conf->supported_chan_width =
> -                                       IWL_CHANNEL_WIDTH_20MHZ;
> +                               ht_conf->is_40mhz = false;
>                        }
>                } else
> -                       ht_conf->supported_chan_width = IWL_CHANNEL_WIDTH_20MHZ;
> +                       ht_conf->is_40mhz = false;
>                /* Default to no protection. Protection mode will later be set
>                 * from BSS config in iwl_ht_conf */
>                ht_conf->ht_protection = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
> index 028d505..961d534 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-dev.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
> @@ -504,8 +504,8 @@ union iwl_ht_rate_supp {
>
>  struct iwl_ht_info {
>        /* self configuration data */
> -       u8 is_ht;
> -       u8 supported_chan_width;
> +       bool is_ht;
> +       bool is_40mhz;
>        u8 sm_ps;
>        struct ieee80211_mcs_info mcs;
>        /* BSS related data */
> @@ -726,9 +726,6 @@ struct iwl_dma_ptr {
>        size_t size;
>  };
>
> -#define IWL_CHANNEL_WIDTH_20MHZ   0
> -#define IWL_CHANNEL_WIDTH_40MHZ   1
> -
>  #define IWL_OPERATION_MODE_AUTO     0
>  #define IWL_OPERATION_MODE_HT_ONLY  1
>  #define IWL_OPERATION_MODE_MIXED    2
> --
> 1.5.6.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965
  2009-09-11 17:38 ` [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965 Reinette Chatre
@ 2009-09-11 17:48   ` reinette chatre
  2009-09-11 17:50   ` [PATCH 13/13 v2.6.32] " reinette chatre
  1 sibling, 0 replies; 21+ messages in thread
From: reinette chatre @ 2009-09-11 17:48 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg

On Fri, 2009-09-11 at 10:38 -0700, Chatre, Reinette wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
> 
> There's a bug in 4965 powersave that appears to
> be related to the way it keeps track of its data
> during sleep, but we haven't found it yet. Due to
> that, using powersave may spontaneously cause the
> device to SYSASSERT when transitioning from sleep
> to wake. Therefore, disable powersave for 4965,
> until (if ever, unfortunately) we can identify
> and fix the problem.
> 
> Cf. http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=1982
> which was closed, but now has re-appeared with
> IDLE mode, which probably means we never really
> fixed it.
> 
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> ---

This patch only applies to wireless-testing (as it is based on an
earlier patch in this series that does not target 2.6.32). I will send a
different version that applies cleanly onto 2.6.32.

Sorry for inconvenience.

Reinette



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 13/13 v2.6.32] iwlwifi: disable powersave for 4965
  2009-09-11 17:38 ` [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965 Reinette Chatre
  2009-09-11 17:48   ` reinette chatre
@ 2009-09-11 17:50   ` reinette chatre
  1 sibling, 0 replies; 21+ messages in thread
From: reinette chatre @ 2009-09-11 17:50 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg

From: Johannes Berg <johannes@sipsolutions.net>

There's a bug in 4965 powersave that appears to
be related to the way it keeps track of its data
during sleep, but we haven't found it yet. Due to
that, using powersave may spontaneously cause the
device to SYSASSERT when transitioning from sleep
to wake. Therefore, disable powersave for 4965,
until (if ever, unfortunately) we can identify
and fix the problem.

Cf. http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=1982
which was closed, but now has re-appeared with
IDLE mode, which probably means we never really
fixed it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---

This version of the patch applies to 2.6.32. Please use previous
version for wireless-testing.

Thank you very much

 drivers/net/wireless/iwlwifi/iwl-4965.c  |    1 +
 drivers/net/wireless/iwlwifi/iwl-core.c  |    9 ++++++---
 drivers/net/wireless/iwlwifi/iwl-core.h  |    1 +
 drivers/net/wireless/iwlwifi/iwl-power.c |    5 +++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 63df1e4..d61d5a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2346,6 +2346,7 @@ struct iwl_cfg iwl4965_agn_cfg = {
 	.mod_params = &iwl4965_mod_params,
 	.use_isr_legacy = true,
 	.ht_greenfield_support = false,
+	.broken_powersave = true,
 };
 
 /* Module firmware */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 5c6cee2..e447c1a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1565,9 +1565,12 @@ int iwl_setup_mac(struct iwl_priv *priv)
 	hw->flags = IEEE80211_HW_SIGNAL_DBM |
 		    IEEE80211_HW_NOISE_DBM |
 		    IEEE80211_HW_AMPDU_AGGREGATION |
-		    IEEE80211_HW_SPECTRUM_MGMT |
-		    IEEE80211_HW_SUPPORTS_PS |
-		    IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
+		    IEEE80211_HW_SPECTRUM_MGMT;
+
+	if (!priv->cfg->broken_powersave)
+		hw->flags |= IEEE80211_HW_SUPPORTS_PS |
+			     IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
+
 	hw->wiphy->interface_modes =
 		BIT(NL80211_IFTYPE_STATION) |
 		BIT(NL80211_IFTYPE_ADHOC);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index cab148d..5e1f700 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -256,6 +256,7 @@ struct iwl_cfg {
 	const u16 max_ll_items;
 	const bool shadow_ram_support;
 	const bool ht_greenfield_support;
+	const bool broken_powersave;
 };
 
 /***************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 4ec6a83..60be976 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -292,8 +292,9 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
 	else
 		dtimper = 1;
 
-	/* TT power setting overwrites everything */
-	if (tt->state >= IWL_TI_1)
+	if (priv->cfg->broken_powersave)
+		iwl_power_sleep_cam_cmd(priv, &cmd);
+	else if (tt->state >= IWL_TI_1)
 		iwl_static_sleep_cmd(priv, &cmd, tt->tt_power_mode, dtimper);
 	else if (!enabled)
 		iwl_power_sleep_cam_cmd(priv, &cmd);
-- 
1.5.6.3




^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/13] iwlwifi: clean up ht config a little
  2009-09-11 17:46   ` Gábor Stefanik
@ 2009-09-11 21:12     ` reinette chatre
  2009-09-12 13:12     ` Johannes Berg
  1 sibling, 0 replies; 21+ messages in thread
From: reinette chatre @ 2009-09-11 21:12 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: linville, linux-wireless, ipw3945-devel, Johannes Berg

Hi Gábor,

On Fri, 2009-09-11 at 10:46 -0700, Gábor Stefanik wrote:
> On Fri, Sep 11, 2009 at 7:38 PM, Reinette Chatre
> <reinette.chatre@intel.com> wrote:
> > From: Johannes Berg <johannes@sipsolutions.net>
> >
> > is_ht can be bool instead of u8, and there's
> > no need to use IWL_CHANNEL_WIDTH_* constants
> > in supported_chan_width when that could just
> > be named is_40mhz instead.
> 
> What about is_ht40?

It seems that this structure distinguishes explicitly between being ht
(with "is_ht") and the supported channel width (now with "is_40mhz"). To
me it seems a bit awkward to have "is_ht" and "is_ht40". As you can tell
Johannes has been cleaning this up, so maybe he noticed a way in which
this can be clarified.

Reinette



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/13] iwlwifi: clean up ht config a little
  2009-09-11 17:46   ` Gábor Stefanik
  2009-09-11 21:12     ` reinette chatre
@ 2009-09-12 13:12     ` Johannes Berg
  1 sibling, 0 replies; 21+ messages in thread
From: Johannes Berg @ 2009-09-12 13:12 UTC (permalink / raw)
  To: Gábor Stefanik
  Cc: Reinette Chatre, linville, linux-wireless, ipw3945-devel

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

On Fri, 2009-09-11 at 19:46 +0200, Gábor Stefanik wrote:
> On Fri, Sep 11, 2009 at 7:38 PM, Reinette Chatre
> <reinette.chatre@intel.com> wrote:
> > From: Johannes Berg <johannes@sipsolutions.net>
> >
> > is_ht can be bool instead of u8, and there's
> > no need to use IWL_CHANNEL_WIDTH_* constants
> > in supported_chan_width when that could just
> > be named is_40mhz instead.
> 
> What about is_ht40?

Wrong approach. If you want to clean it up further, I would suggest
replacing both "is_ht" and "is_40mhz" by the channel type as passed by
mac80211, or using conf_is_ht40() etc. instead. Didn't feel motivated
enough at this point though and just wanted to get rid of the extra
constants.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ipw3945-devel] [PATCH 09/13] iwlwifi: clean up ht config naming
  2009-09-11 17:38 ` [PATCH 09/13] iwlwifi: clean up ht config naming Reinette Chatre
@ 2009-09-13 23:45   ` Tomas Winkler
  2009-09-13 23:52     ` Johannes Berg
  0 siblings, 1 reply; 21+ messages in thread
From: Tomas Winkler @ 2009-09-13 23:45 UTC (permalink / raw)
  To: Reinette Chatre; +Cc: linville, Johannes Berg, linux-wireless, ipw3945-devel

On Fri, Sep 11, 2009 at 8:38 PM, Reinette Chatre
<reinette.chatre@intel.com> wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
>
> Daniel Halperin pointed out that the naming
> here is rather inconsistent with at least 3
> different names being used for one thing in
> different contexts. Rename the struct to
> iwl_ht_config (rather than iwl_ht_info) and
> use ht_conf as a variable for it.

Hmm. ht_info was used to describe protocol handshake info (as
described by spec) while ht_configis actual HW configuration
constrained by HW capabilities or current state I didn't follow
closely current changes but at least they used to be not the same
things.

Thanks
Tomas


>

> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> Acked-by: Daniel C Halperin <daniel.c.halperin@intel.com>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> ---
>  drivers/net/wireless/iwlwifi/iwl-agn-rs.c |    2 +-
>  drivers/net/wireless/iwlwifi/iwl-core.c   |   48 ++++++++++++++--------------
>  drivers/net/wireless/iwlwifi/iwl-core.h   |    2 +-
>  drivers/net/wireless/iwlwifi/iwl-dev.h    |    4 +-
>  4 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> index fd73153..9d0758a 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
> @@ -662,7 +662,7 @@ static int rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
>  * there are no non-GF stations present in the BSS.
>  */
>  static inline u8 rs_use_green(struct ieee80211_sta *sta,
> -                             struct iwl_ht_info *ht_conf)
> +                             struct iwl_ht_config *ht_conf)
>  {
>        return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) &&
>                !(ht_conf->non_GF_STA_present);
> diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
> index 7c50065..d9a757a 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-core.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
> @@ -634,9 +634,9 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv,
>  u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
>                         struct ieee80211_sta_ht_cap *sta_ht_inf)
>  {
> -       struct iwl_ht_info *iwl_ht_conf = &priv->current_ht_config;
> +       struct iwl_ht_config *ht_conf = &priv->current_ht_config;
>
> -       if (!iwl_ht_conf->is_ht || !iwl_ht_conf->is_40mhz)
> +       if (!ht_conf->is_ht || !ht_conf->is_40mhz)
>                return 0;
>
>        /* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
> @@ -652,7 +652,7 @@ u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
>  #endif
>        return iwl_is_channel_extension(priv, priv->band,
>                        le16_to_cpu(priv->staging_rxon.channel),
> -                       iwl_ht_conf->extension_chan_offset);
> +                       ht_conf->extension_chan_offset);
>  }
>  EXPORT_SYMBOL(iwl_is_ht40_tx_allowed);
>
> @@ -876,11 +876,11 @@ u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
>  }
>  EXPORT_SYMBOL(iwl_rate_get_lowest_plcp);
>
> -void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
> +void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
>  {
>        struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
>
> -       if (!ht_info->is_ht) {
> +       if (!ht_conf->is_ht) {
>                rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK |
>                        RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK |
>                        RXON_FLG_HT40_PROT_MSK |
> @@ -891,7 +891,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
>        /* FIXME: if the definition of ht_protection changed, the "translation"
>         * will be needed for rxon->flags
>         */
> -       rxon->flags |= cpu_to_le32(ht_info->ht_protection << RXON_FLG_HT_OPERATING_MODE_POS);
> +       rxon->flags |= cpu_to_le32(ht_conf->ht_protection << RXON_FLG_HT_OPERATING_MODE_POS);
>
>        /* Set up channel bandwidth:
>         * 20 MHz only, 20/40 mixed or pure 40 if ht40 ok */
> @@ -900,10 +900,10 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
>                         RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
>        if (iwl_is_ht40_tx_allowed(priv, NULL)) {
>                /* pure ht40 */
> -               if (ht_info->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
> +               if (ht_conf->ht_protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
>                        rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40;
>                        /* Note: control channel is opposite of extension channel */
> -                       switch (ht_info->extension_chan_offset) {
> +                       switch (ht_conf->extension_chan_offset) {
>                        case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
>                                rxon->flags &= ~RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK;
>                                break;
> @@ -913,7 +913,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
>                        }
>                } else {
>                        /* Note: control channel is opposite of extension channel */
> -                       switch (ht_info->extension_chan_offset) {
> +                       switch (ht_conf->extension_chan_offset) {
>                        case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
>                                rxon->flags &= ~(RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
>                                rxon->flags |= RXON_FLG_CHANNEL_MODE_MIXED;
> @@ -939,11 +939,11 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
>        IWL_DEBUG_ASSOC(priv, "supported HT rate 0x%X 0x%X 0x%X "
>                        "rxon flags 0x%X operation mode :0x%X "
>                        "extension channel offset 0x%x\n",
> -                       ht_info->mcs.rx_mask[0],
> -                       ht_info->mcs.rx_mask[1],
> -                       ht_info->mcs.rx_mask[2],
> -                       le32_to_cpu(rxon->flags), ht_info->ht_protection,
> -                       ht_info->extension_chan_offset);
> +                       ht_conf->mcs.rx_mask[0],
> +                       ht_conf->mcs.rx_mask[1],
> +                       ht_conf->mcs.rx_mask[2],
> +                       le32_to_cpu(rxon->flags), ht_conf->ht_protection,
> +                       ht_conf->extension_chan_offset);
>        return;
>  }
>  EXPORT_SYMBOL(iwl_set_rxon_ht);
> @@ -2408,13 +2408,13 @@ EXPORT_SYMBOL(iwl_mac_conf_tx);
>  static void iwl_ht_conf(struct iwl_priv *priv,
>                            struct ieee80211_bss_conf *bss_conf)
>  {
> -       struct ieee80211_sta_ht_cap *ht_conf;
> -       struct iwl_ht_info *iwl_conf = &priv->current_ht_config;
> +       struct iwl_ht_config *ht_conf = &priv->current_ht_config;
> +       struct ieee80211_sta_ht_cap *ht_cap;
>        struct ieee80211_sta *sta;
>
>        IWL_DEBUG_MAC80211(priv, "enter: \n");
>
> -       if (!iwl_conf->is_ht)
> +       if (!ht_conf->is_ht)
>                return;
>
>
> @@ -2430,15 +2430,15 @@ static void iwl_ht_conf(struct iwl_priv *priv,
>                rcu_read_unlock();
>                return;
>        }
> -       ht_conf = &sta->ht_cap;
> +       ht_cap = &sta->ht_cap;
>
> -       iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
> +       ht_conf->sm_ps = (u8)((ht_cap->cap & IEEE80211_HT_CAP_SM_PS) >> 2);
>
> -       memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16);
> +       memcpy(&ht_conf->mcs, &ht_cap->mcs, 16);
>
> -       iwl_conf->ht_protection =
> +       ht_conf->ht_protection =
>                bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION;
> -       iwl_conf->non_GF_STA_present =
> +       ht_conf->non_GF_STA_present =
>                !!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
>
>        rcu_read_unlock();
> @@ -2748,7 +2748,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
>        struct iwl_priv *priv = hw->priv;
>        const struct iwl_channel_info *ch_info;
>        struct ieee80211_conf *conf = &hw->conf;
> -       struct iwl_ht_info *ht_conf = &priv->current_ht_config;
> +       struct iwl_ht_config *ht_conf = &priv->current_ht_config;
>        unsigned long flags = 0;
>        int ret = 0;
>        u16 ch;
> @@ -2915,7 +2915,7 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
>        IWL_DEBUG_MAC80211(priv, "enter\n");
>
>        spin_lock_irqsave(&priv->lock, flags);
> -       memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info));
> +       memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_config));
>        spin_unlock_irqrestore(&priv->lock, flags);
>
>        iwl_reset_qos(priv);
> diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
> index dfeca62..cab148d 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-core.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-core.h
> @@ -274,7 +274,7 @@ int iwl_check_rxon_cmd(struct iwl_priv *priv);
>  int iwl_full_rxon_required(struct iwl_priv *priv);
>  void iwl_set_rxon_chain(struct iwl_priv *priv);
>  int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
> -void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
> +void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf);
>  u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
>                         struct ieee80211_sta_ht_cap *sta_ht_inf);
>  void iwl_set_flags_for_band(struct iwl_priv *priv, enum ieee80211_band band);
> diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
> index 961d534..e161f8d 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-dev.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
> @@ -502,7 +502,7 @@ union iwl_ht_rate_supp {
>  #define CFG_HT_MPDU_DENSITY_4USEC   (0x5)
>  #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
>
> -struct iwl_ht_info {
> +struct iwl_ht_config {
>        /* self configuration data */
>        bool is_ht;
>        bool is_40mhz;
> @@ -1077,7 +1077,7 @@ struct iwl_priv {
>        struct iwl_chain_noise_data chain_noise_data;
>        __le16 sensitivity_tbl[HD_TABLE_SIZE];
>
> -       struct iwl_ht_info current_ht_config;
> +       struct iwl_ht_config current_ht_config;
>        u8 last_phy_res[100];
>
>        /* Rate scaling data */
> --
> 1.5.6.3
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ipw3945-devel mailing list
> Ipw3945-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ipw3945-devel
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ipw3945-devel] [PATCH 09/13] iwlwifi: clean up ht config naming
  2009-09-13 23:45   ` [ipw3945-devel] " Tomas Winkler
@ 2009-09-13 23:52     ` Johannes Berg
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Berg @ 2009-09-13 23:52 UTC (permalink / raw)
  To: Tomas Winkler; +Cc: Reinette Chatre, linville, linux-wireless, ipw3945-devel

[-- Attachment #1: Type: text/plain, Size: 967 bytes --]

On Mon, 2009-09-14 at 02:45 +0300, Tomas Winkler wrote:
> On Fri, Sep 11, 2009 at 8:38 PM, Reinette Chatre
> <reinette.chatre@intel.com> wrote:
> > From: Johannes Berg <johannes@sipsolutions.net>
> >
> > Daniel Halperin pointed out that the naming
> > here is rather inconsistent with at least 3
> > different names being used for one thing in
> > different contexts. Rename the struct to
> > iwl_ht_config (rather than iwl_ht_info) and
> > use ht_conf as a variable for it.
> 
> Hmm. ht_info was used to describe protocol handshake info (as
> described by spec) while ht_configis actual HW configuration
> constrained by HW capabilities or current state I didn't follow
> closely current changes but at least they used to be not the same
> things.

Umm ... what am I supposed to read out of this comment? The code before
this patch intermingled info and config (i.e. HW config and protocol
config) and we're trying to clean that up.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2009-09-13 23:53 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-11 17:38 [PATCH 0/13] iwlwifi driver updates 09/11/2009 Reinette Chatre
2009-09-11 17:38 ` [PATCH 01/13] iwlwifi: modify LED blink index table Reinette Chatre
2009-09-11 17:38 ` [PATCH 02/13 v2.6.32 and w-t] iwlwifi: fix HT operation in 2.4 GHz band Reinette Chatre
2009-09-11 17:38 ` [PATCH 03/13] iwlwifi: remove un-supported eeprom parameters Reinette Chatre
2009-09-11 17:38 ` [PATCH 04/13] iwlwifi: separate nic_config for different NIC Reinette Chatre
2009-09-11 17:38 ` [PATCH 05/13] iwlwifi: separate set_hw_params function for 6000 series Reinette Chatre
2009-09-11 17:38 ` [PATCH 06/13 v2.6.32 and w-t] iwlwifi: fix potential rx buffer loss Reinette Chatre
2009-09-11 17:38 ` [PATCH 07/13] iwlwifi: clean up ht config a little Reinette Chatre
2009-09-11 17:46   ` Gábor Stefanik
2009-09-11 21:12     ` reinette chatre
2009-09-12 13:12     ` Johannes Berg
2009-09-11 17:38 ` [PATCH 08/13] iwlwifi: Adjust blink rate to compensate Clock difference Reinette Chatre
2009-09-11 17:38 ` [PATCH 09/13] iwlwifi: clean up ht config naming Reinette Chatre
2009-09-13 23:45   ` [ipw3945-devel] " Tomas Winkler
2009-09-13 23:52     ` Johannes Berg
2009-09-11 17:38 ` [PATCH 10/13] iwlwifi: show NVM version in debugfs Reinette Chatre
2009-09-11 17:38 ` [PATCH 11/13] iwlwifi: clarify and clean up chain settings Reinette Chatre
2009-09-11 17:38 ` [PATCH 12/13 v2.6.32 and w-t] iwlwifi: find the correct first antenna Reinette Chatre
2009-09-11 17:38 ` [PATCH 13/13 v2.6.32 and w-t] iwlwifi: disable powersave for 4965 Reinette Chatre
2009-09-11 17:48   ` reinette chatre
2009-09-11 17:50   ` [PATCH 13/13 v2.6.32] " reinette chatre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.