Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 06/13] iwlwifi: clear the translate table area
From: Reinette Chatre @ 2009-10-02 20:44 UTC (permalink / raw)
  To: linville
  Cc: linux-wireless, ipw3945-devel, Huaxu Wan, Guo Chaohong,
	Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

From: Huaxu Wan <huaxu.wan@linux.intel.com>

Driver should clear the translate table area after receiving "Alive"
response from uCode. This patch corrects a mistake when doing this.

Signed-off-by: Huaxu Wan <huaxu.wan@linux.intel.com>
Signed-off-by: Guo Chaohong <chaohong.guo@linux.intel.com>
Acked-by: Ben M Cahill  <ben.m.cahill@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-4965.c |    3 ++-
 drivers/net/wireless/iwlwifi/iwl-5000.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 4e492c1..0921e45 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -663,7 +663,8 @@ static int iwl4965_alive_notify(struct iwl_priv *priv)
 		iwl_write_targ_mem(priv, a, 0);
 	for (; a < priv->scd_base_addr + IWL49_SCD_TRANSLATE_TBL_OFFSET; a += 4)
 		iwl_write_targ_mem(priv, a, 0);
-	for (; a < sizeof(u16) * priv->hw_params.max_txq_num; a += 4)
+	for (; a < priv->scd_base_addr +
+	       IWL49_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
 		iwl_write_targ_mem(priv, a, 0);
 
 	/* Tel 4965 where to find Tx byte count tables */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 660fd51..01d53eb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -748,7 +748,8 @@ int iwl5000_alive_notify(struct iwl_priv *priv)
 	for (; a < priv->scd_base_addr + IWL50_SCD_TRANSLATE_TBL_OFFSET;
 		a += 4)
 		iwl_write_targ_mem(priv, a, 0);
-	for (; a < sizeof(u16) * priv->hw_params.max_txq_num; a += 4)
+	for (; a < priv->scd_base_addr +
+	       IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
 		iwl_write_targ_mem(priv, a, 0);
 
 	iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR,
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 02/13] iwlwifi: fix EEPROM enhance tx power offset
From: Reinette Chatre @ 2009-10-02 20:43 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

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

Set the correct EEPROM offset for enhance tx power for 6000 series

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 |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 75fe022..3bcd600 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -220,35 +220,35 @@ struct iwl_eeprom_enhanced_txpwr {
  * Section 10: 2.4 GHz 40MHz channels: 132, 44 (_above_)
  */
 /* 2.4 GHz band: CCK */
-#define EEPROM_LB_CCK_20_COMMON       ((0xAA)\
+#define EEPROM_LB_CCK_20_COMMON       ((0xA8)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 8 bytes */
 /* 2.4 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */
-#define EEPROM_LB_OFDM_COMMON       ((0xB2)\
+#define EEPROM_LB_OFDM_COMMON       ((0xB0)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 24 bytes */
 /* 5.2 GHz band: 20MHz-Legacy, 20MHz-HT, 40MHz-HT */
-#define EEPROM_HB_OFDM_COMMON       ((0xCA)\
+#define EEPROM_HB_OFDM_COMMON       ((0xC8)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 24 bytes */
 /* 2.4GHz band channels:
  *	1Legacy, 1HT, 2Legacy, 2HT, 10Legacy, 10HT, 11Legacy, 11HT */
-#define EEPROM_LB_OFDM_20_BAND       ((0xE2)\
+#define EEPROM_LB_OFDM_20_BAND       ((0xE0)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 64 bytes */
 /* 2.4 GHz band HT40 channels: (1,+1) (2,+1) (6,+1) (7,+1) (9,+1) */
-#define EEPROM_LB_OFDM_HT40_BAND       ((0x122)\
+#define EEPROM_LB_OFDM_HT40_BAND       ((0x120)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 40 bytes */
 /* 5.2GHz band channels: 36Legacy, 36HT, 64Legacy, 64HT, 100Legacy, 100HT */
-#define EEPROM_HB_OFDM_20_BAND       ((0x14A)\
+#define EEPROM_HB_OFDM_20_BAND       ((0x148)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 48 bytes */
 /* 5.2 GHz band HT40 channels: (36,+1) (60,+1) (100,+1) */
-#define EEPROM_HB_OFDM_HT40_BAND       ((0x17A)\
+#define EEPROM_HB_OFDM_HT40_BAND       ((0x178)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 24 bytes */
 /* 2.4 GHz band, channnel 13: Legacy, HT */
-#define EEPROM_LB_OFDM_20_CHANNEL_13       ((0x192)\
+#define EEPROM_LB_OFDM_20_CHANNEL_13       ((0x190)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 16 bytes */
 /* 5.2 GHz band, channnel 140: Legacy, HT */
-#define EEPROM_HB_OFDM_20_CHANNEL_140       ((0x1A2)\
+#define EEPROM_HB_OFDM_20_CHANNEL_140       ((0x1A0)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 16 bytes */
 /* 5.2 GHz band, HT40 channnels (132,+1) (44,+1) */
-#define EEPROM_HB_OFDM_HT40_BAND_1       ((0x1B2)\
+#define EEPROM_HB_OFDM_HT40_BAND_1       ((0x1B0)\
 		| INDIRECT_ADDRESS | INDIRECT_REGULATORY)   /* 16 bytes */
 
 
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 04/13] iwlwifi: reliable entering of critical temperature state
From: Reinette Chatre @ 2009-10-02 20:43 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

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

When uCode detects critical temperature it should send "card state
notification" interrupt to driver and then shut itself down to prevent
overheating. There is a race condition where uCode shuts down before it
can deliver the interrupt to driver.
Additional method provided here for driver to enter CT_KILL state based
on temperature reading.

How it works:
Method 1:
If driver receive "card state notification" interrupt from uCode; it
enters "CT_KILL" state immediately

Method 2:
If the last temperature report by Card reach Critical temperature,
driver will send "statistic notification" request to uCode to verify the
temperature reading, if driver can not get reply from uCode within
300ms, driver will enter CT_KILL state automatically.

Method 3:
If the last temperature report by Card did not reach Critical
temperature, but uCode already shut down due to critical temperature.
All the host commands send to uCode will not get process by uCode;
when command queue reach the limit, driver will check the last reported
temperature reading, if it is within pre-defined margin, enter "CT_KILL"
state immediately. In this case, when uCode ready to exit from "CT_KILL" state,
driver need to restart the adapter in order to reset all the queues and
resume normal operation.

One additional issue being address here, when system is in CT_KILL
state, both tx and rx already stopped, but driver still can send host
command to uCode, it will flood the command queue since card was not
responding; adding STATUS_CT_KILL flag to reject enqueue host commands
to uCode if it is in CT_KILL state, when uCode is ready to come out of
CT_KILL, driver will clear  the STATUS_CT_KILL bit and allow enqueue the host
commands to uCode to recover from CT_KILL state.

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-core.h    |    6 +
 drivers/net/wireless/iwlwifi/iwl-debugfs.c |    2 +
 drivers/net/wireless/iwlwifi/iwl-power.c   |  146 ++++++++++++++++++++++------
 drivers/net/wireless/iwlwifi/iwl-power.h   |    3 +
 drivers/net/wireless/iwlwifi/iwl-tx.c      |   10 ++-
 5 files changed, 135 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 744f0ca..3bd0e59 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -580,6 +580,7 @@ void iwlcore_free_geos(struct iwl_priv *priv);
 #define STATUS_HCMD_SYNC_ACTIVE	1	/* sync host command in progress */
 #define STATUS_INT_ENABLED	2
 #define STATUS_RF_KILL_HW	3
+#define STATUS_CT_KILL		4
 #define STATUS_INIT		5
 #define STATUS_ALIVE		6
 #define STATUS_READY		7
@@ -624,6 +625,11 @@ static inline int iwl_is_rfkill(struct iwl_priv *priv)
 	return iwl_is_rfkill_hw(priv);
 }
 
+static inline int iwl_is_ctkill(struct iwl_priv *priv)
+{
+	return test_bit(STATUS_CT_KILL, &priv->status);
+}
+
 static inline int iwl_is_ready_rf(struct iwl_priv *priv)
 {
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 037b75c..fa6371d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -535,6 +535,8 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
 		test_bit(STATUS_INT_ENABLED, &priv->status));
 	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
 		test_bit(STATUS_RF_KILL_HW, &priv->status));
+	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
+		test_bit(STATUS_CT_KILL, &priv->status));
 	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
 		test_bit(STATUS_INIT, &priv->status));
 	pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index e50d77b..9c6b149 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -165,26 +165,26 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
  *=============================================================================
  *                 Condition Nxt State  Condition Nxt State Condition Nxt State
  *-----------------------------------------------------------------------------
- *     IWL_TI_0     T >= 115   CT_KILL  115>T>=105   TI_1      N/A      N/A
- *     IWL_TI_1     T >= 115   CT_KILL  115>T>=110   TI_2     T<=95     TI_0
- *     IWL_TI_2     T >= 115   CT_KILL                        T<=100    TI_1
+ *     IWL_TI_0     T >= 114   CT_KILL  114>T>=105   TI_1      N/A      N/A
+ *     IWL_TI_1     T >= 114   CT_KILL  114>T>=110   TI_2     T<=95     TI_0
+ *     IWL_TI_2     T >= 114   CT_KILL                        T<=100    TI_1
  *    IWL_CT_KILL      N/A       N/A       N/A        N/A     T<=95     TI_0
  *=============================================================================
  */
 static const struct iwl_tt_trans tt_range_0[IWL_TI_STATE_MAX - 1] = {
 	{IWL_TI_0, IWL_ABSOLUTE_ZERO, 104},
-	{IWL_TI_1, 105, CT_KILL_THRESHOLD},
-	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD + 1, IWL_ABSOLUTE_MAX}
+	{IWL_TI_1, 105, CT_KILL_THRESHOLD - 1},
+	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX}
 };
 static const struct iwl_tt_trans tt_range_1[IWL_TI_STATE_MAX - 1] = {
 	{IWL_TI_0, IWL_ABSOLUTE_ZERO, 95},
-	{IWL_TI_2, 110, CT_KILL_THRESHOLD},
-	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD + 1, IWL_ABSOLUTE_MAX}
+	{IWL_TI_2, 110, CT_KILL_THRESHOLD - 1},
+	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX}
 };
 static const struct iwl_tt_trans tt_range_2[IWL_TI_STATE_MAX - 1] = {
 	{IWL_TI_1, IWL_ABSOLUTE_ZERO, 100},
-	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD + 1, IWL_ABSOLUTE_MAX},
-	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD + 1, IWL_ABSOLUTE_MAX}
+	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX},
+	{IWL_TI_CT_KILL, CT_KILL_THRESHOLD, IWL_ABSOLUTE_MAX}
 };
 static const struct iwl_tt_trans tt_range_3[IWL_TI_STATE_MAX - 1] = {
 	{IWL_TI_0, IWL_ABSOLUTE_ZERO, CT_KILL_EXIT_THRESHOLD},
@@ -351,6 +351,23 @@ bool iwl_ht_enabled(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_ht_enabled);
 
+bool iwl_within_ct_kill_margin(struct iwl_priv *priv)
+{
+	s32 temp = priv->temperature; /* degrees CELSIUS except 4965 */
+	bool within_margin = false;
+
+	if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)
+		temp = KELVIN_TO_CELSIUS(priv->temperature);
+
+	if (!priv->thermal_throttle.advanced_tt)
+		within_margin = ((temp + IWL_TT_CT_KILL_MARGIN) >=
+				CT_KILL_THRESHOLD_LEGACY) ? true : false;
+	else
+		within_margin = ((temp + IWL_TT_CT_KILL_MARGIN) >=
+				CT_KILL_THRESHOLD) ? true : false;
+	return within_margin;
+}
+
 enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv)
 {
 	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
@@ -375,6 +392,7 @@ enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv)
 }
 
 #define CT_KILL_EXIT_DURATION (5)	/* 5 seconds duration */
+#define CT_KILL_WAITING_DURATION (300)	/* 300ms duration */
 
 /*
  * toggle the bit to wake up uCode and check the temperature
@@ -412,6 +430,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
 		/* Reschedule the ct_kill timer to occur in
 		 * CT_KILL_EXIT_DURATION seconds to ensure we get a
 		 * thermal update */
+		IWL_DEBUG_POWER(priv, "schedule ct_kill exit timer\n");
 		mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, jiffies +
 			  CT_KILL_EXIT_DURATION * HZ);
 	}
@@ -435,6 +454,33 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
 	}
 }
 
+static void iwl_tt_ready_for_ct_kill(unsigned long data)
+{
+	struct iwl_priv *priv = (struct iwl_priv *)data;
+	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
+
+	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+		return;
+
+	/* temperature timer expired, ready to go into CT_KILL state */
+	if (tt->state != IWL_TI_CT_KILL) {
+		IWL_DEBUG_POWER(priv, "entering CT_KILL state when temperature timer expired\n");
+		tt->state = IWL_TI_CT_KILL;
+		set_bit(STATUS_CT_KILL, &priv->status);
+		iwl_perform_ct_kill_task(priv, true);
+	}
+}
+
+static void iwl_prepare_ct_kill_task(struct iwl_priv *priv)
+{
+	IWL_DEBUG_POWER(priv, "Prepare to enter IWL_TI_CT_KILL\n");
+	/* make request to retrieve statistics information */
+	iwl_send_statistics_request(priv, 0);
+	/* Reschedule the ct_kill wait timer */
+	mod_timer(&priv->thermal_throttle.ct_kill_waiting_tm,
+		 jiffies + msecs_to_jiffies(CT_KILL_WAITING_DURATION));
+}
+
 #define IWL_MINIMAL_POWER_THRESHOLD		(CT_KILL_THRESHOLD_LEGACY)
 #define IWL_REDUCED_PERFORMANCE_THRESHOLD_2	(100)
 #define IWL_REDUCED_PERFORMANCE_THRESHOLD_1	(90)
@@ -448,7 +494,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
  *	Throttle early enough to lower the power consumption before
  *	drastic steps are needed
  */
-static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
+static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
 {
 	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
 	enum iwl_tt_state old_state;
@@ -477,6 +523,8 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
 #ifdef CONFIG_IWLWIFI_DEBUG
 	tt->tt_previous_temp = temp;
 #endif
+	/* stop ct_kill_waiting_tm timer */
+	del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm);
 	if (tt->state != old_state) {
 		switch (tt->state) {
 		case IWL_TI_0:
@@ -497,17 +545,28 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
 			break;
 		}
 		mutex_lock(&priv->mutex);
-		if (iwl_power_update_mode(priv, true)) {
+		if (old_state == IWL_TI_CT_KILL)
+			clear_bit(STATUS_CT_KILL, &priv->status);
+		if (tt->state != IWL_TI_CT_KILL &&
+		    iwl_power_update_mode(priv, true)) {
 			/* TT state not updated
 			 * try again during next temperature read
 			 */
+			if (old_state == IWL_TI_CT_KILL)
+				set_bit(STATUS_CT_KILL, &priv->status);
 			tt->state = old_state;
 			IWL_ERR(priv, "Cannot update power mode, "
 					"TT state not updated\n");
 		} else {
-			if (tt->state == IWL_TI_CT_KILL)
-				iwl_perform_ct_kill_task(priv, true);
-			else if (old_state == IWL_TI_CT_KILL &&
+			if (tt->state == IWL_TI_CT_KILL) {
+				if (force) {
+					set_bit(STATUS_CT_KILL, &priv->status);
+					iwl_perform_ct_kill_task(priv, true);
+				} else {
+					iwl_prepare_ct_kill_task(priv);
+					tt->state = old_state;
+				}
+			} else if (old_state == IWL_TI_CT_KILL &&
 				 tt->state != IWL_TI_CT_KILL)
 				iwl_perform_ct_kill_task(priv, false);
 			IWL_DEBUG_POWER(priv, "Temperature state changed %u\n",
@@ -534,13 +593,13 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
  *=============================================================================
  *                 Condition Nxt State  Condition Nxt State Condition Nxt State
  *-----------------------------------------------------------------------------
- *     IWL_TI_0     T >= 115   CT_KILL  115>T>=105   TI_1      N/A      N/A
- *     IWL_TI_1     T >= 115   CT_KILL  115>T>=110   TI_2     T<=95     TI_0
- *     IWL_TI_2     T >= 115   CT_KILL                        T<=100    TI_1
+ *     IWL_TI_0     T >= 114   CT_KILL  114>T>=105   TI_1      N/A      N/A
+ *     IWL_TI_1     T >= 114   CT_KILL  114>T>=110   TI_2     T<=95     TI_0
+ *     IWL_TI_2     T >= 114   CT_KILL                        T<=100    TI_1
  *    IWL_CT_KILL      N/A       N/A       N/A        N/A     T<=95     TI_0
  *=============================================================================
  */
-static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp)
+static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
 {
 	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
 	int i;
@@ -585,6 +644,8 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp)
 			break;
 		}
 	}
+	/* stop ct_kill_waiting_tm timer */
+	del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm);
 	if (changed) {
 		struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
 
@@ -616,12 +677,17 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp)
 			iwl_set_rxon_ht(priv, &priv->current_ht_config);
 		}
 		mutex_lock(&priv->mutex);
-		if (iwl_power_update_mode(priv, true)) {
+		if (old_state == IWL_TI_CT_KILL)
+			clear_bit(STATUS_CT_KILL, &priv->status);
+		if (tt->state != IWL_TI_CT_KILL &&
+		    iwl_power_update_mode(priv, true)) {
 			/* TT state not updated
 			 * try again during next temperature read
 			 */
 			IWL_ERR(priv, "Cannot update power mode, "
 					"TT state not updated\n");
+			if (old_state == IWL_TI_CT_KILL)
+				set_bit(STATUS_CT_KILL, &priv->status);
 			tt->state = old_state;
 		} else {
 			IWL_DEBUG_POWER(priv,
@@ -629,9 +695,15 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp)
 					tt->state);
 			if (old_state != IWL_TI_CT_KILL &&
 			    tt->state == IWL_TI_CT_KILL) {
-				IWL_DEBUG_POWER(priv, "Enter IWL_TI_CT_KILL\n");
-				iwl_perform_ct_kill_task(priv, true);
-
+				if (force) {
+					IWL_DEBUG_POWER(priv,
+						"Enter IWL_TI_CT_KILL\n");
+					set_bit(STATUS_CT_KILL, &priv->status);
+					iwl_perform_ct_kill_task(priv, true);
+				} else {
+					iwl_prepare_ct_kill_task(priv);
+					tt->state = old_state;
+				}
 			} else if (old_state == IWL_TI_CT_KILL &&
 				  tt->state != IWL_TI_CT_KILL) {
 				IWL_DEBUG_POWER(priv, "Exit IWL_TI_CT_KILL\n");
@@ -668,10 +740,11 @@ static void iwl_bg_ct_enter(struct work_struct *work)
 			      "- ucode going to sleep!\n");
 		if (!priv->thermal_throttle.advanced_tt)
 			iwl_legacy_tt_handler(priv,
-					      IWL_MINIMAL_POWER_THRESHOLD);
+					      IWL_MINIMAL_POWER_THRESHOLD,
+					      true);
 		else
 			iwl_advance_tt_handler(priv,
-					       CT_KILL_THRESHOLD + 1);
+					       CT_KILL_THRESHOLD + 1, true);
 	}
 }
 
@@ -698,11 +771,18 @@ static void iwl_bg_ct_exit(struct work_struct *work)
 		IWL_ERR(priv,
 			"Device temperature below critical"
 			"- ucode awake!\n");
+		/*
+		 * exit from CT_KILL state
+		 * reset the current temperature reading
+		 */
+		priv->temperature = 0;
 		if (!priv->thermal_throttle.advanced_tt)
 			iwl_legacy_tt_handler(priv,
-					IWL_REDUCED_PERFORMANCE_THRESHOLD_2);
+					      IWL_REDUCED_PERFORMANCE_THRESHOLD_2,
+					      true);
 		else
-			iwl_advance_tt_handler(priv, CT_KILL_EXIT_THRESHOLD);
+			iwl_advance_tt_handler(priv, CT_KILL_EXIT_THRESHOLD,
+					       true);
 	}
 }
 
@@ -738,9 +818,9 @@ static void iwl_bg_tt_work(struct work_struct *work)
 		temp = KELVIN_TO_CELSIUS(priv->temperature);
 
 	if (!priv->thermal_throttle.advanced_tt)
-		iwl_legacy_tt_handler(priv, temp);
+		iwl_legacy_tt_handler(priv, temp, false);
 	else
-		iwl_advance_tt_handler(priv, temp);
+		iwl_advance_tt_handler(priv, temp, false);
 }
 
 void iwl_tt_handler(struct iwl_priv *priv)
@@ -771,8 +851,12 @@ void iwl_tt_initialize(struct iwl_priv *priv)
 	tt->state = IWL_TI_0;
 	init_timer(&priv->thermal_throttle.ct_kill_exit_tm);
 	priv->thermal_throttle.ct_kill_exit_tm.data = (unsigned long)priv;
-	priv->thermal_throttle.ct_kill_exit_tm.function = iwl_tt_check_exit_ct_kill;
-
+	priv->thermal_throttle.ct_kill_exit_tm.function =
+		iwl_tt_check_exit_ct_kill;
+	init_timer(&priv->thermal_throttle.ct_kill_waiting_tm);
+	priv->thermal_throttle.ct_kill_waiting_tm.data = (unsigned long)priv;
+	priv->thermal_throttle.ct_kill_waiting_tm.function =
+		iwl_tt_ready_for_ct_kill;
 	/* setup deferred ct kill work */
 	INIT_WORK(&priv->tt_work, iwl_bg_tt_work);
 	INIT_WORK(&priv->ct_enter, iwl_bg_ct_enter);
@@ -829,6 +913,8 @@ void iwl_tt_exit(struct iwl_priv *priv)
 
 	/* stop ct_kill_exit_tm timer if activated */
 	del_timer_sync(&priv->thermal_throttle.ct_kill_exit_tm);
+	/* stop ct_kill_waiting_tm timer if activated */
+	del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm);
 	cancel_work_sync(&priv->tt_work);
 	cancel_work_sync(&priv->ct_enter);
 	cancel_work_sync(&priv->ct_exit);
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index df6f6a4..310c32e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -33,6 +33,7 @@
 #define IWL_ABSOLUTE_ZERO		0
 #define IWL_ABSOLUTE_MAX		0xFFFFFFFF
 #define IWL_TT_INCREASE_MARGIN	5
+#define IWL_TT_CT_KILL_MARGIN	3
 
 enum iwl_antenna_ok {
 	IWL_ANT_OK_NONE,
@@ -110,6 +111,7 @@ struct iwl_tt_mgmt {
 	struct iwl_tt_restriction *restriction;
 	struct iwl_tt_trans *transaction;
 	struct timer_list ct_kill_exit_tm;
+	struct timer_list ct_kill_waiting_tm;
 };
 
 enum iwl_power_level {
@@ -129,6 +131,7 @@ struct iwl_power_mgr {
 
 int iwl_power_update_mode(struct iwl_priv *priv, bool force);
 bool iwl_ht_enabled(struct iwl_priv *priv);
+bool iwl_within_ct_kill_margin(struct iwl_priv *priv);
 enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv);
 enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv);
 void iwl_tt_enter_ct_kill(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index ad69479..2ba9725 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -969,13 +969,19 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 	BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
 	       !(cmd->flags & CMD_SIZE_HUGE));
 
-	if (iwl_is_rfkill(priv)) {
-		IWL_DEBUG_INFO(priv, "Not sending command - RF KILL\n");
+	if (iwl_is_rfkill(priv) || iwl_is_ctkill(priv)) {
+		IWL_DEBUG_INFO(priv, "Not sending command - RF/CT KILL\n");
 		return -EIO;
 	}
 
 	if (iwl_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
 		IWL_ERR(priv, "No space for Tx\n");
+		if (iwl_within_ct_kill_margin(priv))
+			iwl_tt_enter_ct_kill(priv);
+		else {
+			IWL_ERR(priv, "Restarting adapter due to queue full\n");
+			queue_work(priv->workqueue, &priv->restart);
+		}
 		return -ENOSPC;
 	}
 
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 08/13] iwlwifi: device tracing
From: Reinette Chatre @ 2009-10-02 20:44 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Johannes Berg, Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

From: Johannes Berg <johannes@sipsolutions.net>

In order to have an easier way to debug issues, create
trace events (using the ftrace framework) that will
allow us to follow exactly what the driver is doing
with the device.

The text format isn't all that useful, but the binary
format can also be obtained easily via debugfs and
then analysed on the fly or offline with debugging
tools.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
 drivers/net/wireless/iwlwifi/Kconfig        |   18 +++
 drivers/net/wireless/iwlwifi/Makefile       |    7 +-
 drivers/net/wireless/iwlwifi/iwl-agn.c      |    8 ++
 drivers/net/wireless/iwlwifi/iwl-devtrace.c |   13 ++
 drivers/net/wireless/iwlwifi/iwl-devtrace.h |  178 +++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-eeprom.h   |    2 +
 drivers/net/wireless/iwlwifi/iwl-io.h       |   16 ++-
 drivers/net/wireless/iwlwifi/iwl-tx.c       |   14 ++-
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    8 +-
 9 files changed, 256 insertions(+), 8 deletions(-)
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-devtrace.c
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-devtrace.h

diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index eb62c20..48d8f2c 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -49,6 +49,24 @@ config IWLWIFI_DEBUGFS
         ---help---
 	  Enable creation of debugfs files for the iwlwifi drivers.
 
+config IWLWIFI_DEVICE_TRACING
+	bool "iwlwifi device access tracing"
+	depends on IWLWIFI
+	depends on EVENT_TRACING
+	help
+	  Say Y here to trace all commands, including TX frames and IO
+	  accesses, sent to the device. If you say yes, iwlwifi will
+	  register with the ftrace framework for event tracing and dump
+	  all this information to the ringbuffer, you may need to
+	  increase the ringbuffer size. See the ftrace documentation
+	  for more information.
+
+	  When tracing is not enabled, this option still has some
+	  (though rather small) overhead.
+
+	  If unsure, say Y so we can help you better when problems
+	  occur.
+
 config IWLAGN
 	tristate "Intel Wireless WiFi Next Gen AGN (iwlagn)"
 	depends on IWLWIFI
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index 1d4e0a2..3f31d86 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -5,7 +5,11 @@ iwlcore-objs 		+= iwl-scan.o
 iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
 iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
 iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
+iwlcore-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
 
+CFLAGS_iwl-devtrace.o := -I$(src)
+
+# AGN
 obj-$(CONFIG_IWLAGN)	+= iwlagn.o
 iwlagn-objs		:= iwl-agn.o iwl-agn-rs.o
 
@@ -14,7 +18,6 @@ iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
 iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
 iwlagn-$(CONFIG_IWL5000) += iwl-1000.o
 
+# 3945
 obj-$(CONFIG_IWL3945)	+= iwl3945.o
 iwl3945-objs		:= iwl3945-base.o iwl-3945.o iwl-3945-rs.o iwl-3945-led.o
-
-
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 26c66b4..4fb50d0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -791,6 +791,9 @@ void iwl_rx_handle(struct iwl_priv *priv)
 				 PCI_DMA_FROMDEVICE);
 		pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
+		trace_iwlwifi_dev_rx(priv, pkt,
+			le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
+
 		/* Reclaim a command buffer only if this packet is a response
 		 *   to a (driver-originated) command.
 		 * If the packet (e.g. Rx frame) originated from uCode,
@@ -1610,6 +1613,9 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
 	line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32));
 	time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32));
 
+	trace_iwlwifi_dev_ucode_error(priv, desc, time, data1, data2, line,
+				      blink1, blink2, ilink1, ilink2);
+
 	IWL_ERR(priv, "Desc                               Time       "
 		"data1      data2      line\n");
 	IWL_ERR(priv, "%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
@@ -1658,12 +1664,14 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
 		ptr += sizeof(u32);
 		if (mode == 0) {
 			/* data, ev */
+			trace_iwlwifi_dev_ucode_event(priv, 0, time, ev);
 			IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", time, ev);
 		} else {
 			data = iwl_read_targ_mem(priv, ptr);
 			ptr += sizeof(u32);
 			IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n",
 					time, data, ev);
+			trace_iwlwifi_dev_ucode_event(priv, time, data, ev);
 		}
 	}
 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.c b/drivers/net/wireless/iwlwifi/iwl-devtrace.c
new file mode 100644
index 0000000..4ef5aca
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.c
@@ -0,0 +1,13 @@
+#include <linux/module.h>
+
+/* sparse doesn't like tracepoint macros */
+#ifndef __CHECKER__
+#define CREATE_TRACE_POINTS
+#include "iwl-devtrace.h"
+
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ioread32);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_iowrite32);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_rx);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_event);
+EXPORT_TRACEPOINT_SYMBOL(iwlwifi_dev_ucode_error);
+#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
new file mode 100644
index 0000000..8c71592
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
@@ -0,0 +1,178 @@
+#if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
+#define __IWLWIFI_DEVICE_TRACE
+
+#include <linux/tracepoint.h>
+#include "iwl-dev.h"
+
+#if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
+#undef TRACE_EVENT
+#define TRACE_EVENT(name, proto, ...) \
+static inline void trace_ ## name(proto) {}
+#endif
+
+#define PRIV_ENTRY	__field(struct iwl_priv *, priv)
+#define PRIV_ASSIGN	__entry->priv = priv
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM iwlwifi
+
+TRACE_EVENT(iwlwifi_dev_ioread32,
+	TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
+	TP_ARGS(priv, offs, val),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+		__field(u32, offs)
+		__field(u32, val)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		__entry->offs = offs;
+		__entry->val = val;
+	),
+	TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
+);
+
+TRACE_EVENT(iwlwifi_dev_iowrite32,
+	TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
+	TP_ARGS(priv, offs, val),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+		__field(u32, offs)
+		__field(u32, val)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		__entry->offs = offs;
+		__entry->val = val;
+	),
+	TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
+);
+
+TRACE_EVENT(iwlwifi_dev_hcmd,
+	TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags),
+	TP_ARGS(priv, hcmd, len, flags),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+		__dynamic_array(u8, hcmd, len)
+		__field(u32, flags)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		memcpy(__get_dynamic_array(hcmd), hcmd, len);
+		__entry->flags = flags;
+	),
+	TP_printk("[%p] hcmd %#.2x (%ssync)",
+		  __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0],
+		  __entry->flags & CMD_ASYNC ? "a" : "")
+);
+
+TRACE_EVENT(iwlwifi_dev_rx,
+	TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len),
+	TP_ARGS(priv, rxbuf, len),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+		__dynamic_array(u8, rxbuf, len)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
+	),
+	TP_printk("[%p] RX cmd %#.2x",
+		  __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
+);
+
+TRACE_EVENT(iwlwifi_dev_tx,
+	TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen,
+		 void *buf0, size_t buf0_len,
+		 void *buf1, size_t buf1_len),
+	TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+
+		__field(size_t, framelen)
+		__dynamic_array(u8, tfd, tfdlen)
+
+		/*
+		 * Do not insert between or below these items,
+		 * we want to keep the frame together (except
+		 * for the possible padding).
+		 */
+		__dynamic_array(u8, buf0, buf0_len)
+		__dynamic_array(u8, buf1, buf1_len)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		__entry->framelen = buf0_len + buf1_len;
+		memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
+		memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
+		memcpy(__get_dynamic_array(buf1), buf1, buf0_len);
+	),
+	TP_printk("[%p] TX %.2x (%zu bytes)",
+		  __entry->priv,
+		  ((u8 *)__get_dynamic_array(buf0))[0],
+		  __entry->framelen)
+);
+
+TRACE_EVENT(iwlwifi_dev_ucode_error,
+	TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time,
+		 u32 data1, u32 data2, u32 line, u32 blink1,
+		 u32 blink2, u32 ilink1, u32 ilink2),
+	TP_ARGS(priv, desc, time, data1, data2, line,
+		blink1, blink2, ilink1, ilink2),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+		__field(u32, desc)
+		__field(u32, time)
+		__field(u32, data1)
+		__field(u32, data2)
+		__field(u32, line)
+		__field(u32, blink1)
+		__field(u32, blink2)
+		__field(u32, ilink1)
+		__field(u32, ilink2)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		__entry->desc = desc;
+		__entry->time = time;
+		__entry->data1 = data1;
+		__entry->data2 = data2;
+		__entry->line = line;
+		__entry->blink1 = blink1;
+		__entry->blink2 = blink2;
+		__entry->ilink1 = ilink1;
+		__entry->ilink2 = ilink2;
+	),
+	TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
+		  "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X",
+		  __entry->priv, __entry->desc, __entry->time, __entry->data1,
+		  __entry->data2, __entry->line, __entry->blink1,
+		  __entry->blink2, __entry->ilink1, __entry->ilink2)
+);
+
+TRACE_EVENT(iwlwifi_dev_ucode_event,
+	TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
+	TP_ARGS(priv, time, data, ev),
+	TP_STRUCT__entry(
+		PRIV_ENTRY
+
+		__field(u32, time)
+		__field(u32, data)
+		__field(u32, ev)
+	),
+	TP_fast_assign(
+		PRIV_ASSIGN;
+		__entry->time = time;
+		__entry->data = data;
+		__entry->ev = ev;
+	),
+	TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
+		  __entry->priv, __entry->time, __entry->data, __entry->ev)
+);
+#endif /* __IWLWIFI_DEVICE_TRACE */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE iwl-devtrace
+#include <trace/define_trace.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 0eee059..b363c96 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -63,6 +63,8 @@
 #ifndef __iwl_eeprom_h__
 #define __iwl_eeprom_h__
 
+#include <net/mac80211.h>
+
 struct iwl_priv;
 
 /*
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index d30cb02..0a078b0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -32,6 +32,7 @@
 #include <linux/io.h>
 
 #include "iwl-debug.h"
+#include "iwl-devtrace.h"
 
 /*
  * IO, register, and NIC memory access functions
@@ -61,7 +62,12 @@
  *
  */
 
-#define _iwl_write32(priv, ofs, val) iowrite32((val), (priv)->hw_base + (ofs))
+static inline void _iwl_write32(struct iwl_priv *priv, u32 ofs, u32 val)
+{
+	trace_iwlwifi_dev_iowrite32(priv, ofs, val);
+	iowrite32(val, priv->hw_base + ofs);
+}
+
 #ifdef CONFIG_IWLWIFI_DEBUG
 static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv,
 				 u32 ofs, u32 val)
@@ -75,7 +81,13 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv,
 #define iwl_write32(priv, ofs, val) _iwl_write32(priv, ofs, val)
 #endif
 
-#define _iwl_read32(priv, ofs) ioread32((priv)->hw_base + (ofs))
+static inline u32 _iwl_read32(struct iwl_priv *priv, u32 ofs)
+{
+	u32 val = ioread32(priv->hw_base + ofs);
+	trace_iwlwifi_dev_ioread32(priv, ofs, val);
+	return val;
+}
+
 #ifdef CONFIG_IWLWIFI_DEBUG
 static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs)
 {
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 2ba9725..c832ba0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -709,7 +709,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	dma_addr_t phys_addr;
 	dma_addr_t txcmd_phys;
 	dma_addr_t scratch_phys;
-	u16 len, len_org;
+	u16 len, len_org, firstlen, secondlen;
 	u16 seq_number = 0;
 	__le16 fc;
 	u8 hdr_len;
@@ -842,7 +842,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 		sizeof(struct iwl_cmd_header) + hdr_len;
 
 	len_org = len;
-	len = (len + 3) & ~3;
+	firstlen = len = (len + 3) & ~3;
 
 	if (len_org != len)
 		len_org = 1;
@@ -876,7 +876,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
 	/* Set up TFD's 2nd entry to point directly to remainder of skb,
 	 * if any (802.11 null frames have no payload). */
-	len = skb->len - hdr_len;
+	secondlen = len = skb->len - hdr_len;
 	if (len) {
 		phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
 					   len, PCI_DMA_TODEVICE);
@@ -910,6 +910,12 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	pci_dma_sync_single_for_device(priv->pci_dev, txcmd_phys,
 				       len, PCI_DMA_BIDIRECTIONAL);
 
+	trace_iwlwifi_dev_tx(priv,
+			     &((struct iwl_tfd *)txq->tfds)[txq->q.write_ptr],
+			     sizeof(struct iwl_tfd),
+			     &out_cmd->hdr, firstlen,
+			     skb->data + hdr_len, secondlen);
+
 	/* Tell device the write index *just past* this latest filled TFD */
 	q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
 	ret = iwl_txq_update_write_ptr(priv, txq);
@@ -1044,6 +1050,8 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 	pci_unmap_addr_set(out_meta, mapping, phys_addr);
 	pci_unmap_len_set(out_meta, len, fix_size);
 
+	trace_iwlwifi_dev_hcmd(priv, &out_cmd->hdr, fix_size, cmd->flags);
+
 	priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
 						   phys_addr, fix_size, 1,
 						   U32_PAD(cmd->len));
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3575e7f..d0d1b7f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1404,6 +1404,9 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
 				PCI_DMA_FROMDEVICE);
 		pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
+		trace_iwlwifi_dev_rx(priv, pkt,
+			le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK);
+
 		/* Reclaim a command buffer only if this packet is a response
 		 *   to a (driver-originated) command.
 		 * If the packet (e.g. Rx frame) originated from uCode,
@@ -1549,8 +1552,9 @@ void iwl3945_dump_nic_error_log(struct iwl_priv *priv)
 			"%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
 			desc_lookup(desc), desc, time, blink1, blink2,
 			ilink1, ilink2, data1);
+		trace_iwlwifi_dev_ucode_error(priv, desc, time, data1, 0,
+					0, blink1, blink2, ilink1, ilink2);
 	}
-
 }
 
 #define EVENT_START_OFFSET  (6 * sizeof(u32))
@@ -1590,10 +1594,12 @@ static void iwl3945_print_event_log(struct iwl_priv *priv, u32 start_idx,
 		if (mode == 0) {
 			/* data, ev */
 			IWL_ERR(priv, "0x%08x\t%04u\n", time, ev);
+			trace_iwlwifi_dev_ucode_event(priv, 0, time, ev);
 		} else {
 			data = iwl_read_targ_mem(priv, ptr);
 			ptr += sizeof(u32);
 			IWL_ERR(priv, "%010u\t0x%08x\t%04u\n", time, data, ev);
+			trace_iwlwifi_dev_ucode_event(priv, time, data, ev);
 		}
 	}
 }
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 07/13] iwlwifi: set default aggregation frame count limit to 31
From: Reinette Chatre @ 2009-10-02 20:44 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

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

Multiple MPDUs can be aggregated, transmitted, and finally acknowledged
together using a single BA frame. Block ACK (BA) contains
bitmap size of 64*16 bits so the maximum frame count is 64.
The default value of aggregation frame count suggested by uCode is 31 to
achieve best performance.

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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index e6c35e0..a07be29 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2800,7 +2800,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
 		repeat_rate--;
 	}
 
-	lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_MAX;
+	lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
 	lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
 	lq_cmd->agg_params.agg_time_limit =
 		cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 03/13] iwlwifi: fix compile warning
From: Reinette Chatre @ 2009-10-02 20:43 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

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

Fixes following on big endian systems:
  CC [M]  drivers/net/wireless/iwlwifi/iwl-rx.o
  drivers/net/wireless/iwlwifi/iwl-rx.c: In function ‘iwl_rx_reply_rx’:
  drivers/net/wireless/iwlwifi/iwl-rx.c:1029: warning: integer overflow in
  expression

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
---
 drivers/net/wireless/iwlwifi/iwl-3945.c     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-commands.h |    2 +-
 drivers/net/wireless/iwlwifi/iwl-rx.c       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 33e40c2..7bf447e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -610,7 +610,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
 	if (rx_status.band == IEEE80211_BAND_5GHZ)
 		rx_status.rate_idx -= IWL_FIRST_OFDM_RATE;
 
-	rx_status.antenna = le16_to_cpu(rx_hdr->phy_flags &
+	rx_status.antenna = (le16_to_cpu(rx_hdr->phy_flags) &
 					RX_RES_PHY_FLAGS_ANTENNA_MSK) >> 4;
 
 	/* set the preamble flag if appropriate */
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index e5f40f3..ba3e4c8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -1164,7 +1164,7 @@ struct iwl_wep_cmd {
 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK		cpu_to_le16(1 << 1)
 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK	cpu_to_le16(1 << 2)
 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK	cpu_to_le16(1 << 3)
-#define RX_RES_PHY_FLAGS_ANTENNA_MSK		cpu_to_le16(0xf0)
+#define RX_RES_PHY_FLAGS_ANTENNA_MSK		0xf0
 #define RX_RES_PHY_FLAGS_ANTENNA_POS		4
 
 #define RX_RES_STATUS_SEC_TYPE_MSK	(0x7 << 8)
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 8e1bb53..493626b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -1044,7 +1044,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
 	 * as a bitmask.
 	 */
 	rx_status.antenna =
-		le16_to_cpu(phy_res->phy_flags & RX_RES_PHY_FLAGS_ANTENNA_MSK)
+		(le16_to_cpu(phy_res->phy_flags) & RX_RES_PHY_FLAGS_ANTENNA_MSK)
 		>> RX_RES_PHY_FLAGS_ANTENNA_POS;
 
 	/* set the preamble flag if appropriate */
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 05/13] iwlwifi: change valid EEPROM version for 1000 series
From: Reinette Chatre @ 2009-10-02 20:43 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wey-Yi Guy, Reinette Chatre
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

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

In order to support different type of 1000 series NICs we release to
customers before the production release, iwlwifi driver need to support
all the NICs has EEPROM version greater than 0x15c.

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, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index 3bcd600..0eee059 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -257,7 +257,7 @@ struct iwl_eeprom_enhanced_txpwr {
 #define EEPROM_5050_EEPROM_VERSION	(0x21E)
 
 /* 1000 Specific */
-#define EEPROM_1000_EEPROM_VERSION	(0x15D)
+#define EEPROM_1000_EEPROM_VERSION	(0x15C)
 
 /* 60x0 Specific */
 #define EEPROM_6000_EEPROM_VERSION	(0x434)
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 01/13 v2.6.31, v2.6.32 and w-t] iwlwifi: incorrect method used for finding valid OTP blocks
From: Reinette Chatre @ 2009-10-02 20:43 UTC (permalink / raw)
  To: linville
  Cc: linux-wireless, ipw3945-devel, Jay Sternberg, Reinette Chatre,
	stable
In-Reply-To: <1254516247-4085-1-git-send-email-reinette.chatre@intel.com>

From: Jay Sternberg <jay.e.sternberg@intel.com>

The address stored in the next link address is a word address but when
reading the OTP blocks, a byte address is used. Also if the blocks are
full and the last link pointer is not zero, then none of the blocks are
valid so return an error.

The algorithm is simply valid blocks have a next address and that
address's contents is zero.

Using the wrong address for the next link address gets arbitrary data,
obviously. In cases seen, the first block is considered valid when it is not.

If the block has in fact been invalidated there may be old data or
there may be no data, bad data, or partial data, there is no way of
telling. Without this patch it is possible that a device with valid OTP data
is unable to work.

Signed-off-by: Jay Sternberg <jay.e.sternberg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
CC: stable@kernel.org
---
 drivers/net/wireless/iwlwifi/iwl-eeprom.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 3d2b93a..e14c995 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -410,7 +410,6 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
 					u16 *validblockaddr)
 {
 	u16 next_link_addr = 0, link_value = 0, valid_addr;
-	int ret = 0;
 	int usedblocks = 0;
 
 	/* set addressing mode to absolute to traverse the link list */
@@ -430,29 +429,29 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
 		 * check for more block on the link list
 		 */
 		valid_addr = next_link_addr;
-		next_link_addr = link_value;
+		next_link_addr = link_value * sizeof(u16);
 		IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
 			       usedblocks, next_link_addr);
 		if (iwl_read_otp_word(priv, next_link_addr, &link_value))
 			return -EINVAL;
 		if (!link_value) {
 			/*
-			 * reach the end of link list,
+			 * reach the end of link list, return success and
 			 * set address point to the starting address
 			 * of the image
 			 */
-			goto done;
+			*validblockaddr = valid_addr;
+			/* skip first 2 bytes (link list pointer) */
+			*validblockaddr += 2;
+			return 0;
 		}
 		/* more in the link list, continue */
 		usedblocks++;
-	} while (usedblocks < priv->cfg->max_ll_items);
-	/* OTP full, use last block */
-	IWL_DEBUG_INFO(priv, "OTP is full, use last block\n");
-done:
-	*validblockaddr = valid_addr;
-	/* skip first 2 bytes (link list pointer) */
-	*validblockaddr += 2;
-	return ret;
+	} while (usedblocks <= priv->cfg->max_ll_items);
+
+	/* OTP has no valid blocks */
+	IWL_DEBUG_INFO(priv, "OTP has no valid blocks\n");
+	return -EINVAL;
 }
 
 /**
-- 
1.5.6.3


^ permalink raw reply related

* [PATCH 0/13] iwlwifi driver updates 10/2/2009
From: Reinette Chatre @ 2009-10-02 20:43 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Reinette Chatre

In this series we include two fixes targeting 2.6.32:
1/13 is needed to parse OTP data correctly, without this devices with valid
OTP data may be unable to work - this fix also targets 2.6.31
2/13 fixes the EEPROM offsets used for enhanced TX power data

This series introduces, thanks to Johannes, device tracing utilizing the
ftrace framework.

[PATCH 01/13 v2.6.31, v2.6.32 and w-t] iwlwifi: incorrect method used for finding valid OTP blocks
[PATCH 02/13 v2.6.32 and w-t] iwlwifi: fix EEPROM enhance tx power offset
[PATCH 03/13] iwlwifi: fix compile warning
[PATCH 04/13] iwlwifi: reliable entering of critical temperature state
[PATCH 05/13] iwlwifi: change valid EEPROM version for 1000 series
[PATCH 06/13] iwlwifi: clear the translate table area
[PATCH 07/13] iwlwifi: set default aggregation frame count limit to 31
[PATCH 08/13] iwlwifi: device tracing
[PATCH 09/13] iwlwifi: LED cleanup
[PATCH 10/13] iwlwifi/iwl3945 : unify apm stop operation
[PATCH 11/13] iwlwifi: replace iwl_poll_direct_bit with iwl_poll_bit for CSR access
[PATCH 12/13] iwlwifi: validate the signature for EEPROM and OTP
[PATCH 13/13] iwlagn: fix compile warning in iwl5000_gain_computation

Thank you

Reinette


^ permalink raw reply

* Re: [PATCH] compat-wireless: Fix the bleeding-edge version to build on 2.6.27
From: Luis R. Rodriguez @ 2009-10-02 20:48 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless
In-Reply-To: <4ac55601.EpUUwD1vnjBKSXDy%Larry.Finger@lwfinger.net>

On Thu, Oct 1, 2009 at 6:23 PM, Larry Finger <Larry.Finger@lwfinger.net> wrote:

> I checked these patches on 2.6.27 and 2.6.31, but not for the intermediate
> releases.

That works for me thanks, applied with some minor modifications.

> Index: compat-wireless-2009-09-05/include/net/compat-2.6.28.h
> ===================================================================
> --- compat-wireless-2009-09-05.orig/include/net/compat-2.6.28.h
> +++ compat-wireless-2009-09-05/include/net/compat-2.6.28.h


> Index: compat-wireless-2009-09-05/net/wireless/compat-2.6.28.c
> ===================================================================
> --- compat-wireless-2009-09-05.orig/net/wireless/compat-2.6.28.c
> +++ compat-wireless-2009-09-05/net/wireless/compat-2.6.28.c

Just a heads up, I don't keep these file at include/net or
net/wireless on my git tree, instead I stash them into compat/. The
./scripts/admin-update.sh then is used to cp then. I did this to make
it clear that the compat stuff comes from outside.

> Index: compat-wireless-2009-09-05/net/wireless/scan.c
> ===================================================================
> --- compat-wireless-2009-09-05.orig/net/wireless/scan.c
> +++ compat-wireless-2009-09-05/net/wireless/scan.c
> @@ -499,8 +499,10 @@ cfg80211_inform_bss(struct wiphy *wiphy,
>
>        kref_init(&res->ref);
>
> +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
>        /* cfg80211_bss_update() eats up res - we ensure we free it there */
>        kmemleak_ignore(res);
> +#endif

And this hunk should no longer be present on bleeding edge.

Thanks!

  Luis

^ permalink raw reply

* Re: 2.6.32-rc1-git2: Reported regressions from 2.6.31
From: Luis R. Rodriguez @ 2009-10-02 20:34 UTC (permalink / raw)
  To: linux-wireless; +Cc: Rafael J. Wysocki
In-Reply-To: <9UCePxij8cB.A.VCG.-3SxKB@chimera>

Not bad we have only 2 for wireless, so far:

On Thu, Oct 1, 2009 at 12:26 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:

iwl3945:

> Bug-Entry       : http://bugzilla.kernel.org/show_bug.cgi?id=14299
> Subject         : oops in wireless, iwl3945 related?
> Submitter       : Pavel Machek <pavel@ucw.cz>
> Date            : 2009-09-29 17:12 (3 days old)
> References      : http://marc.info/?l=linux-kernel&m=125424439725743&w=4

b43:

> Bug-Entry       : http://bugzilla.kernel.org/show_bug.cgi?id=14277
> Subject         : Caught 8-bit read from freed memory in b43 driver at association
> Submitter       : Christian Casteyde <casteyde.christian@free.fr>
> Date            : 2009-09-30 18:06 (2 days old)

  Luis

^ permalink raw reply

* Re: WARNING: at drivers/net/wireless/b43/main.c:3923 b43_wireless_core_stop+0x1c8/0x1d0()
From: Andrew Price @ 2009-10-02 19:52 UTC (permalink / raw)
  To: Michael Buesch; +Cc: linux-wireless
In-Reply-To: <200910022138.04296.mb@bu3sch.de>

On Fri, Oct 02, 2009 at 09:38:02PM +0200, Michael Buesch wrote:
> On Friday 02 October 2009 21:30:43 Andrew Price wrote:
> > Hi,
> > 
> > I'm seeing this warning when I unplug my wireless card while the
> > network interface is still up. It doesn't seem to cause any permanent
> > damage - when I plug it back in I can use the wireless card again.
> > 
> > I'm using today's mainline kernel as of 0efe5e32 with Michael Buesch's
> > "b43: Don't use struct wldev after detach" patch added, though I don't
> > believe that patch is the culprit because the warning triggers without
> > it too.
> > 
> > The line it refers to is:
> >     B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK));
> 
> This should fix it

It does indeed,

Tested-by: Andrew Price <andy@andrewprice.me.uk>

(for this and the "b43: Don't use struct wldev after detach" patch).

Thanks.

> 
> ---
>  drivers/net/wireless/b43/main.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> --- wireless-testing.orig/drivers/net/wireless/b43/main.c
> +++ wireless-testing/drivers/net/wireless/b43/main.c
> @@ -3874,6 +3874,7 @@ static struct b43_wldev * b43_wireless_c
>  {
>  	struct b43_wl *wl = dev->wl;
>  	struct b43_wldev *orig_dev;
> +	u32 mask;
>  
>  redo:
>  	if (!dev || b43_status(dev) < B43_STAT_STARTED)
> @@ -3920,7 +3921,8 @@ redo:
>  			goto redo;
>  		return dev;
>  	}
> -	B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK));
> +	mask = b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);
> +	B43_WARN_ON(mask != 0xFFFFFFFF && mask);
>  
>  	/* Drain the TX queue */
>  	while (skb_queue_len(&wl->tx_queue))
> 
> 
> 
> -- 
> Greetings, Michael.

^ permalink raw reply

* Re: WARNING: at drivers/net/wireless/b43/main.c:3923 b43_wireless_core_stop+0x1c8/0x1d0()
From: Michael Buesch @ 2009-10-02 19:38 UTC (permalink / raw)
  To: Andrew Price; +Cc: linux-wireless
In-Reply-To: <20091002193042.GA3719@plato.andrewprice.me.uk>

On Friday 02 October 2009 21:30:43 Andrew Price wrote:
> Hi,
> 
> I'm seeing this warning when I unplug my wireless card while the
> network interface is still up. It doesn't seem to cause any permanent
> damage - when I plug it back in I can use the wireless card again.
> 
> I'm using today's mainline kernel as of 0efe5e32 with Michael Buesch's
> "b43: Don't use struct wldev after detach" patch added, though I don't
> believe that patch is the culprit because the warning triggers without
> it too.
> 
> The line it refers to is:
>     B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK));

This should fix it

---
 drivers/net/wireless/b43/main.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- wireless-testing.orig/drivers/net/wireless/b43/main.c
+++ wireless-testing/drivers/net/wireless/b43/main.c
@@ -3874,6 +3874,7 @@ static struct b43_wldev * b43_wireless_c
 {
 	struct b43_wl *wl = dev->wl;
 	struct b43_wldev *orig_dev;
+	u32 mask;
 
 redo:
 	if (!dev || b43_status(dev) < B43_STAT_STARTED)
@@ -3920,7 +3921,8 @@ redo:
 			goto redo;
 		return dev;
 	}
-	B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK));
+	mask = b43_read32(dev, B43_MMIO_GEN_IRQ_MASK);
+	B43_WARN_ON(mask != 0xFFFFFFFF && mask);
 
 	/* Drain the TX queue */
 	while (skb_queue_len(&wl->tx_queue))



-- 
Greetings, Michael.

^ permalink raw reply

* WARNING: at drivers/net/wireless/b43/main.c:3923 b43_wireless_core_stop+0x1c8/0x1d0()
From: Andrew Price @ 2009-10-02 19:30 UTC (permalink / raw)
  To: linux-wireless

Hi,

I'm seeing this warning when I unplug my wireless card while the
network interface is still up. It doesn't seem to cause any permanent
damage - when I plug it back in I can use the wireless card again.

I'm using today's mainline kernel as of 0efe5e32 with Michael Buesch's
"b43: Don't use struct wldev after detach" patch added, though I don't
believe that patch is the culprit because the warning triggers without
it too.

The line it refers to is:
    B43_WARN_ON(b43_read32(dev, B43_MMIO_GEN_IRQ_MASK));

Andrew

[  405.463902] pcmcia_socket pcmcia_socket0: pccard: card ejected from slot 0
[  405.496420] b43-phy3 debug: Disabling hardware based encryption for keyidx: 0, mac: [...]
[  405.496444] wlan1: deauthenticating from [...] by local choice (reason=3)
[  405.502031] b43-phy3 debug: Disabling hardware based encryption for keyidx: 2, mac: ff:ff:ff:ff:ff:ff
[  405.502046] b43-phy3 debug: Removing Interface type 2
[  405.502092] ------------[ cut here ]------------
[  405.502110] WARNING: at drivers/net/wireless/b43/main.c:3923 b43_wireless_core_stop+0x1c8/0x1d0()
[  405.502117] Hardware name: W730-K8
[  405.502121] Modules linked in:
[  405.502131] Pid: 721, comm: pccardd Tainted: G        W  2.6.32-rc2-00197-g82bb352 #4
[  405.502137] Call Trace:
[  405.502149]  [<c13adfa8>] ? b43_wireless_core_stop+0x1c8/0x1d0
[  405.502158]  [<c13adfa8>] ? b43_wireless_core_stop+0x1c8/0x1d0
[  405.502168]  [<c1038f6f>] ? warn_slowpath_common+0x6f/0xd0
[  405.502178]  [<c13adfa8>] ? b43_wireless_core_stop+0x1c8/0x1d0
[  405.502186]  [<c1038fe3>] ? warn_slowpath_null+0x13/0x20
[  405.502195]  [<c13adfa8>] ? b43_wireless_core_stop+0x1c8/0x1d0
[  405.502204]  [<c13adfe7>] ? b43_op_stop+0x37/0x70
[  405.502217]  [<c15c161d>] ? ieee80211_stop_device+0x1d/0x60
[  405.502226]  [<c15b72a7>] ? ieee80211_stop+0x3f7/0x5e0
[  405.502236]  [<c14afc73>] ? dev_close+0x63/0xb0
[  405.502244]  [<c14afd01>] ? rollback_registered+0x41/0x280
[  405.502255]  [<c10e4164>] ? fsnotify_clear_marks_by_inode+0x74/0xb0
[  405.502263]  [<c14aff56>] ? unregister_netdevice+0x16/0x70
[  405.502272]  [<c15b6a24>] ? ieee80211_remove_interfaces+0x64/0xa0
[  405.502284]  [<c15abc48>] ? ieee80211_unregister_hw+0x38/0xd0
[  405.502293]  [<c13abe42>] ? b43_remove+0xa2/0xd0
[  405.502303]  [<c1449c1a>] ? ssb_device_remove+0x1a/0x30
[  405.502313]  [<c135876e>] ? __device_release_driver+0x4e/0xa0
[  405.502321]  [<c135886d>] ? device_release_driver+0x1d/0x30
[  405.502330]  [<c1357e03>] ? bus_remove_device+0x73/0xa0
[  405.502337]  [<c13562a3>] ? device_del+0xf3/0x180
[  405.502345]  [<c1356338>] ? device_unregister+0x8/0x10
[  405.502354]  [<c144ad13>] ? ssb_bus_unregister+0x33/0x90
[  405.502362]  [<c144cc11>] ? ssb_pcihost_remove+0x21/0x50
[  405.502372]  [<c1255e26>] ? pci_device_remove+0x16/0x40
[  405.502380]  [<c135876e>] ? __device_release_driver+0x4e/0xa0
[  405.502389]  [<c135886d>] ? device_release_driver+0x1d/0x30
[  405.502397]  [<c1357e03>] ? bus_remove_device+0x73/0xa0
[  405.502404]  [<c13562a3>] ? device_del+0xf3/0x180
[  405.502411]  [<c1356338>] ? device_unregister+0x8/0x10
[  405.502422]  [<c12518ee>] ? pci_stop_bus_device+0x4e/0x60
[  405.502432]  [<c125197a>] ? pci_remove_bus_device+0xa/0xa0
[  405.502441]  [<c1251a39>] ? pci_remove_behind_bridge+0x29/0x40
[  405.502452]  [<c13d82b4>] ? socket_shutdown+0x84/0x120
[  405.502461]  [<c13d90c7>] ? pccardd+0x1a7/0x250
[  405.502469]  [<c13d8f20>] ? pccardd+0x0/0x250
[  405.502480]  [<c1051f34>] ? kthread+0x74/0x80
[  405.502488]  [<c1051ec0>] ? kthread+0x0/0x80
[  405.502498]  [<c100381f>] ? kernel_thread_helper+0x7/0x18
[  405.502504] ---[ end trace 5fab67b52b76e31e ]---
[  405.502516] b43-phy3 debug: Wireless interface stopped
[  405.502524] b43-phy3 debug: DMA-30 rx_ring: Used slots 2/64, Failed frames 0/0 = 0.0%, Average tries 0.00
[  405.522030] b43-phy3 ERROR: DMA RX reset timed out
[  405.522089] b43-phy3 debug: DMA-30 tx_ring_AC_BK: Used slots 0/256, Failed frames 0/0 = 0.0%, Average tries 0.00
[  405.562030] b43-phy3 ERROR: DMA TX reset timed out
[  405.562039] b43-phy3 debug: DMA-30 tx_ring_AC_BE: Used slots 2/256, Failed frames 2/27 = 7.4%, Average tries 1.29
[  405.602029] b43-phy3 ERROR: DMA TX reset timed out
[  405.602038] b43-phy3 debug: DMA-30 tx_ring_AC_VI: Used slots 0/256, Failed frames 0/0 = 0.0%, Average tries 0.00
[  405.642028] b43-phy3 ERROR: DMA TX reset timed out
[  405.642037] b43-phy3 debug: DMA-30 tx_ring_AC_VO: Used slots 4/256, Failed frames 0/15 = 0.0%, Average tries 1.00
[  405.682030] b43-phy3 ERROR: DMA TX reset timed out
[  405.682044] b43-phy3 debug: DMA-30 tx_ring_mcast: Used slots 0/256, Failed frames 0/0 = 0.0%, Average tries 0.00
[  405.722029] b43-phy3 ERROR: DMA TX reset timed out
[  405.722660] ssb: Failed to switch to core 0
[  405.979518] b43-pci-bridge 0000:02:00.0: PCI INT A disabled


^ permalink raw reply

* Re: [PATCH] ar9170usb: LEDs are confused
From: Christian Lamparter @ 2009-10-02 19:08 UTC (permalink / raw)
  To: Malte Gell; +Cc: linux-wireless, Luis R. Rodriguez, linville, Hin-Tak Leung
In-Reply-To: <200910021345.55567.malte.gell@gmx.de>

On Friday 02 October 2009 13:45:55 Malte Gell wrote:
> Christian Lamparter <chunkeey@googlemail.com> wrote
> > > The Netgear (WN?) 111 even only has one blue LED as far as I know.
> > 
> > the question is if it's the only device with this deficit, or not?
> Is it feasable to write to the well known stick makers (Netgear, AVM, 
> Belkin, Asus...) and just ask them? 

No idea, but from my past experience about Linux support from resellers,
I somehow doubt it... Instead it was always more fruitful to ask around
in various (vendor) support forums for _help_.

Of course, the situation might have improved, so if you're considering
to write to the resellers, then please do! :)
> > > > FYI: you can assign the LEDs under "/sys/class/leds/"
> > > Very good to know. This needs a udev rule, right?
> > 
> > yes, should be possible one way or another...
>  
> > If you do find an easy ACTION== rule, then let us know!
> 
> Do I hear irony? Is it not easy? Isn't it just a link that needs to be made / 
> changed? Does it matter, when to do this, e.g. after the module ist loaded or 
> the network system is started?
If you take a look at the ledtriggers values in /sys/call/leds/
"none rfkill0 phy0rx phy0tx [phy0assoc] phy0radio", 
you instantly see that the phyXname trigger is dynamic.

in my opinion, finding a simple udev rule is harder than simply
modify the driver code :-D.
> > > But, what about a USB ID based decission in the driver how to handle the
> > > LED? I have a Fritz WLAN N, USB ID:  057c:8401
> > 
> > The first post had a patch attached:
> > http://patchwork.kernel.org/patch/50977/
> 
> Have not tried it, is it well tested?
Hin-Tak Leung has (or had?) some comments about the ONLY_ONE_LED (WN111 v2)
implementation. Other than that, no: I haven't received any horror stories to date.

> If it works, will the patch become official part of compat-wireless?
Sure! But best of all: the change will eventually tickle down into
2.6.x vanilla.

Regards,
	Chr

^ permalink raw reply

* Re: 2.6.32-rc1-git2: Reported regressions from 2.6.31
From: Rafael J. Wysocki @ 2009-10-02 17:32 UTC (permalink / raw)
  To: Stefan Richter
  Cc: Jaswinder Singh Rajput, Linux Kernel Mailing List, Adrian Bunk,
	Andrew Morton, Linus Torvalds, Natalie Protasevich,
	Kernel Testers List, Network Development, Linux ACPI,
	Linux PM List, Linux SCSI List, Linux Wireless List, DRI
In-Reply-To: <4AC5F975.6060505@s5r6.in-berlin.de>

On Friday 02 October 2009, Stefan Richter wrote:
> Jaswinder Singh Rajput wrote:
> > If you add one more entry say "Suspected commit :" then it will be great
> > and will solve regressions much faster.
> 
> Will?  Might.

In fact I add the "First-Bad-Commit" annotation where there is a bisection
result or it's possible to fix things by reverting a specific commit.

> > You can request submitter to
> > submit 'suspected commit' by git bisect and also specify git bisect
> > links like : (for more information about git bisect check
> > http://kerneltrap.org/node/11753)
> 
> I disagree.  A reporter should only be asked to bisect (using git or
> other tools) /if/ a developer determined that bisection may speed up the
> debugging process or is the only remaining option to make progress with
> a bug.
> 
> It would be wrong to steal a reporter's valuable time by asking for
> bisection before anybody familiar with the matter even had a first look
> at the report.

Agreed.

Thanks,
Rafael

^ permalink raw reply

* Re: sony-laptop: check for rfkill hard block at load time
From: Norbert Preining @ 2009-10-02 15:02 UTC (permalink / raw)
  To: Greg KH
  Cc: Alan Jenkins, Johannes Berg, Mattia Dongili, John W. Linville,
	linux-wireless
In-Reply-To: <20091002143800.GC21025@suse.de>

On Fr, 02 Okt 2009, Greg KH wrote:
> On Fri, Oct 02, 2009 at 07:00:29PM +0900, Norbert Preining wrote:
> > On Thu, 24 Sep 2009, Alan Jenkins wrote:
> > > We can fix this by querying the firmware at load time and calling
> > > rfkill_set_hw_state().
> > 
> > The bug concerning checking the state after suspend to ram should probably
> > be also queued. Original email attached.
> 
> Queued for what?

Queued for inclusion into 2.6.3N (for N>=2), that is what the original email
was stating. Sorry if I stripped it down to far.

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>        Vienna University of Technology
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
HIBBING (n.)
The marks left on the outside breast pocket of a storekeeper's overall
where he has put away his pen and missed.
			--- Douglas Adams, The Meaning of Liff

^ permalink raw reply

* Re: sony-laptop: check for rfkill hard block at load time
From: Greg KH @ 2009-10-02 14:38 UTC (permalink / raw)
  To: Norbert Preining
  Cc: Alan Jenkins, Johannes Berg, Mattia Dongili, John W. Linville,
	linux-wireless
In-Reply-To: <20091002100029.GC4406@gandalf.dynalias.org>

On Fri, Oct 02, 2009 at 07:00:29PM +0900, Norbert Preining wrote:
> On Thu, 24 Sep 2009, Alan Jenkins wrote:
> > We can fix this by querying the firmware at load time and calling
> > rfkill_set_hw_state().
> 
> The bug concerning checking the state after suspend to ram should probably
> be also queued. Original email attached.

Queued for what?

confused,

greg k-h

^ permalink raw reply

* Re: 2.6.32-rc1-git2: Reported regressions from 2.6.31
From: Stefan Richter @ 2009-10-02 13:00 UTC (permalink / raw)
  To: Jaswinder Singh Rajput
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Adrian Bunk,
	Andrew Morton, Linus Torvalds, Natalie Protasevich,
	Kernel Testers List, Network Development, Linux ACPI,
	Linux PM List, Linux SCSI List, Linux Wireless List, DRI
In-Reply-To: <1254469139.3531.19.camel@ht.satnam>

Jaswinder Singh Rajput wrote:
> If you add one more entry say "Suspected commit :" then it will be great
> and will solve regressions much faster.

Will?  Might.

> You can request submitter to
> submit 'suspected commit' by git bisect and also specify git bisect
> links like : (for more information about git bisect check
> http://kerneltrap.org/node/11753)

I disagree.  A reporter should only be asked to bisect (using git or
other tools) /if/ a developer determined that bisection may speed up the
debugging process or is the only remaining option to make progress with
a bug.

It would be wrong to steal a reporter's valuable time by asking for
bisection before anybody familiar with the matter even had a first look
at the report.

Remember:
  - Not all bugs can be economically narrowed down by bisection.
  - Bisection requires skills, rigor, and time.
  - Alas there are considerable sections in our kernel history which
    are not bisectable.
-- 
Stefan Richter
-=====-==--= =-=- ---=-
http://arcgraph.de/sr/

^ permalink raw reply

* Re: Linux-2.6.32-rc1/2] wext refactor needs wpasupplicant 0.7.0+?
From: Sedat Dilek @ 2009-10-02 11:48 UTC (permalink / raw)
  To: Holger Schurig; +Cc: Johannes Berg, wireless
In-Reply-To: <200910020910.47068.hs4233@mail.mn-solutions.de>

The logs were not helpful (running wpa_supplicant in background), I
send new ones to Johannes via PM directly.
I was not sure if the logs had sensitive informations.
The problem was discussed on IRC and the problem with v0.6.9 does not
exist anymore.

- Sedat -

On Fri, Oct 2, 2009 at 9:10 AM, Holger Schurig
<hs4233@mail.mn-solutions.de> wrote:
> In both logs you have
>
> 1254429476.088527: ctrl_iface bind(PF_UNIX) failed: Address already in use
> 1254429476.088543: ctrl_iface exists and seems to be in use - cannot override it
> 1254429476.088548: Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
>
> are you sure that no other wpa_supplicant did
> run when you made the logs?
>
> If yes, then just remove the file and re-run wpa_supplicant.
> Be sure to run it as "root".
>
> --
> http://www.holgerschurig.de
>

^ permalink raw reply

* Re: [PATCH] ar9170usb: LEDs are confused
From: Malte Gell @ 2009-10-02 11:45 UTC (permalink / raw)
  To: Christian Lamparter
  Cc: linux-wireless, Luis R. Rodriguez, linville, Hin-Tak Leung
In-Reply-To: <200910021246.34699.chunkeey@googlemail.com>


Christian Lamparter <chunkeey@googlemail.com> wrote

> > The Netgear (WN?) 111 even only has one blue LED as far as I know.
> 
> the question is if it's the only device with this deficit, or not?

Is it feasable to write to the well known stick makers (Netgear, AVM, 
Belkin,Asus...) and just ask them? 
> 
> > > FYI: you can assign the LEDs under "/sys/class/leds/"
> > Very good to know. This needs a udev rule, right?
> 
> yes, should be possible one way or another...
 
> If you do find an easy ACTION== rule, then let us know!

Do I hear irony? Is it not easy? Isn't it just a link that needs to be made / 
changed? Does it matter, when to do this, e.g. after the module ist loaded or 
the network system is started?
 
> > But, what about a USB ID based decission in the driver how to handle the
> > LED? I have a Fritz WLAN N, USB ID:  057c:8401
> 
> The first post had a patch attached:
> http://patchwork.kernel.org/patch/50977/

Have not tried it, is it well tested? If it works, will the patch become 
official part of compat-wireless?

Regards
Malte

^ permalink raw reply

* Re: [PATCH] ar9170usb: LEDs are confused
From: Christian Lamparter @ 2009-10-02 10:46 UTC (permalink / raw)
  To: Malte Gell; +Cc: linux-wireless, Luis R. Rodriguez, linville, Hin-Tak Leung
In-Reply-To: <200910020852.36427.malte.gell@gmx.de>

On Friday 02 October 2009 08:52:36 Malte Gell wrote:
> Christian Lamparter <chunkeey@googlemail.com> wrote
> > On 2009-10-01 06:32 AM, Malte Gell wrote:
> > For example: The Netgear uses a single bi-color LED for their WNDA3100
> >  stick. It glows blue or/and orange depending on the selected band and
> >  current operation mode and state...
> 
> The Netgear (WN?) 111 even only has one blue LED as far as I know.
the question is if it's the only device with this deficit, or not?

> > FYI: you can assign the LEDs under "/sys/class/leds/" with a different
> >  tigger without messing with the kernel source... An up-to-date README can
> >  be found in the kernel's documentation directory:
> >  Documentation/leds-class.txt , or you can look it up online as well:
> > http://www.mjmwired.net/kernel/Documentation/leds-class.txt (from 2.6.31)
> 
> Very good to know. This needs a udev rule, right?
yes, should be possible one way or another...

If you do find an easy ACTION== rule, then let us know!
It would make a nice addition to the wiki @ wireless.kernel.org .
 
> But, what about a USB ID based decission in the driver how to handle the LED? 
> I have a Fritz WLAN N, USB ID:  057c:8401
The first post had a patch attached:
http://patchwork.kernel.org/patch/50977/

(raw patch)
=> http://patchwork.kernel.org/patch/50977/raw/

it should do exactly what you want.
just make sure, you reverted any previous LED related patch,
or it will not apply cleanly.

Regards,
	Chr

^ permalink raw reply

* Re: [PATCH] ar9170usb: LEDs are confused
From: Malte Gell @ 2009-10-02 10:06 UTC (permalink / raw)
  To: linux-wireless
In-Reply-To: <200910020118.27545.chunkeey@googlemail.com>


Christian Lamparter <chunkeey@googlemail.com> wrote

> > >
> > > and AFAIK: Malte uses an AVM FRITZ!WLAN Stick N (2.4?).
> >
> > I just remember the ID from Malte's ndiswrapper-list posting.
 
> indeed, he must have bought a WN111 v2 as well?!

Carefully observed ;-) Yes, I _had_ a WN111v2, but gave it back, my goal was 
to get the Fritz WLAN N ( not the 2.4 version) working it it works now. I had 
the WN111v2 just for a few days to be able to be online.

Regards
Malte

^ permalink raw reply

* Re: sony-laptop: check for rfkill hard block at load time
From: Norbert Preining @ 2009-10-02 10:00 UTC (permalink / raw)
  To: Alan Jenkins
  Cc: Johannes Berg, Mattia Dongili, John W. Linville,
	Greg Kroah-Hartman, linux-wireless

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

On Thu, 24 Sep 2009, Alan Jenkins wrote:
> We can fix this by querying the firmware at load time and calling
> rfkill_set_hw_state().

The bug concerning checking the state after suspend to ram should probably
be also queued. Original email attached.

Tested-by: Norbert Preining <preining@logic.at>

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at>        Vienna University of Technology
Debian Developer <preining@debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
SWANAGE (pl.n.)
Swanage is the series of diversionary tactics used when trying to
cover up the existence of a glossop (q.v.) and may include (a)
uttering a high-pitched laugh and pointing out of the window (NB. this
doesn't work more that twice); (b) sneezing as loudly as possible and
wiping the glossop off the table in the same movement as whipping out
your handkerchief; (c) saying 'Christ! I seen to have dropped some
shit on your table' (very unwise); (d) saying 'Christ, who did that?'
(better) (e) pressing your elbow on the glossop itself and working
your arms slowly to the edge of the table; (f) leaving the glossop
where it is but moving a plate over it and putting up with sitting at
an uncomfortable angle the rest of the meal; or, if the glossop is in
too exposed a position, (g) leaving it there unremarked except for the
occasional humorous glance.
			--- Douglas Adams, The Meaning of Liff

[-- Attachment #2: Type: message/rfc822, Size: 4576 bytes --]

From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>, Mattia Dongili <malattia@linux.it>, Norbert Preining <preining@logic.at>
Subject: [PATCH] [RFT] sony-laptop: re-read the rfkill state when resuming from suspend
Date: Fri, 25 Sep 2009 10:18:21 +0100
Message-ID: <4ABC8ADD.3090803@tuffmail.co.uk>

Without this, the hard-blocked state will be reported incorrectly if
the hardware switch is changed while the laptop is suspended.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
--

Again, this is from code inspection only.  Since suspend/resume can
be tricky, please test that this change works (and is necessary).


diff a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1044,6 +1044,9 @@ static int sony_nc_resume(struct acpi_device *device)
 			sony_backlight_update_status(sony_backlight_device) < 0)
 		printk(KERN_WARNING DRV_PFX "unable to restore brightness level\n");
 
+	/* re-read rfkill state */
+	sony_nc_rfkill_update();
+
 	return 0;
 }
 


^ permalink raw reply

* [PATCH] cfg80211: fix a wrong ifdef
From: Johannes Berg @ 2009-10-02  8:38 UTC (permalink / raw)
  To: John Linville; +Cc: Holger Schurig, linux-wireless

The wext refactoring replaced all
	#ifdef CONFIG_WIRELESS_EXT
in cfg80211 with
	#ifdef CONFIG_CFG80211_WEXT
but one -- that one needs fixing now.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
Might be worth rolling it into the refactor patch.

 net/wireless/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- wireless-testing.orig/net/wireless/core.c	2009-10-02 10:34:13.000000000 +0200
+++ wireless-testing/net/wireless/core.c	2009-10-02 10:34:24.000000000 +0200
@@ -669,7 +669,7 @@ static int cfg80211_netdev_notifier_call
 		wdev->netdev = dev;
 		wdev->sme_state = CFG80211_SME_IDLE;
 		mutex_unlock(&rdev->devlist_mtx);
-#ifdef CONFIG_WIRELESS_EXT
+#ifdef CONFIG_CFG80211_WEXT
 		wdev->wext.default_key = -1;
 		wdev->wext.default_mgmt_key = -1;
 		wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;



^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox