linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] iwlwifi driver 12/17 updates
@ 2008-12-17  8:52 Zhu Yi
  2008-12-17  8:52 ` [PATCH 1/8] iwlwifi: cleanup iwl-dev.h Zhu Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Zhu Yi

Hi John,

These are mostly cleanup except for patch 7 is targeted to address
a memory allocation problem in heavy rx.

[PATCH 1/8] iwlwifi: cleanup iwl-dev.h
[PATCH 2/8] iwlwifi: add line feed to printk
[PATCH 3/8] iwlwifi: update comments on the debug interface
[PATCH 4/8] iwlwifi: use type uint for module param debug
[PATCH 5/8] iwlwifi: remove useless goto
[PATCH 6/8] iwlwifi: use meaningful vars in _iwl_poll_bit()
[PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory
[PATCH 8/8] iwlwifi: indicate txpower is off in sysfs

Thanks,
-yi

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

* [PATCH 1/8] iwlwifi: cleanup iwl-dev.h
  2008-12-17  8:52 [PATCH 0/8] iwlwifi driver 12/17 updates Zhu Yi
@ 2008-12-17  8:52 ` Zhu Yi
  2008-12-17  8:52   ` [PATCH 2/8] iwlwifi: add line feed to printk Zhu Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Winkler, Tomas, Zhu Yi

From: Winkler, Tomas <tomas.winkler@intel.com>

The patch removes unused definition and moves code to proper places.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945.h     |    6 -----
 drivers/net/wireless/iwlwifi/iwl-calib.c    |    9 ++++++++
 drivers/net/wireless/iwlwifi/iwl-commands.h |    2 +
 drivers/net/wireless/iwlwifi/iwl-dev.h      |   29 ++------------------------
 4 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index ec6084c..85d9a51 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -405,12 +405,6 @@ struct iwl3945_rx_queue {
 
 #define SCAN_INTERVAL 100
 
-#define MAX_A_CHANNELS  252
-#define MIN_A_CHANNELS  7
-
-#define MAX_B_CHANNELS  14
-#define MIN_B_CHANNELS  1
-
 #define STATUS_HCMD_ACTIVE	0	/* host command in progress */
 #define STATUS_HCMD_SYNC_ACTIVE	1	/* sync host command in progress */
 #define STATUS_INT_ENABLED	2
diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c
index 7956e08..f836ecc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-calib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-calib.c
@@ -70,6 +70,15 @@
  * INIT calibrations framework
  *****************************************************************************/
 
+struct statistics_general_data {
+	u32 beacon_silence_rssi_a;
+	u32 beacon_silence_rssi_b;
+	u32 beacon_silence_rssi_c;
+	u32 beacon_energy_a;
+	u32 beacon_energy_b;
+	u32 beacon_energy_c;
+};
+
 int iwl_send_calib_results(struct iwl_priv *priv)
 {
 	int ret = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 60e79d9..52966ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2418,6 +2418,8 @@ struct statistics_rx_ht_phy {
 	__le32 reserved2;
 } __attribute__ ((packed));
 
+#define INTERFERENCE_DATA_AVAILABLE      __constant_cpu_to_le32(1)
+
 struct statistics_rx_non_phy {
 	__le32 bogus_cts;	/* CTS received when not expecting CTS */
 	__le32 bogus_ack;	/* ACK received when not expecting ACK */
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index eaf0c9c..0468fcc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -323,14 +323,6 @@ struct iwl_rx_queue {
 
 #define IWL_SUPPORTED_RATES_IE_LEN         8
 
-#define SCAN_INTERVAL 100
-
-#define MAX_A_CHANNELS  252
-#define MIN_A_CHANNELS  7
-
-#define MAX_B_CHANNELS  14
-#define MIN_B_CHANNELS  1
-
 #define MAX_TID_COUNT        9
 
 #define IWL_INVALID_RATE     0xFF
@@ -496,8 +488,6 @@ struct iwl_sensitivity_ranges {
 };
 
 
-#define IWL_FAT_CHANNEL_52 BIT(IEEE80211_BAND_5GHZ)
-
 #define KELVIN_TO_CELSIUS(x) ((x)-273)
 #define CELSIUS_TO_KELVIN(x) ((x)+273)
 
@@ -546,9 +536,6 @@ struct iwl_hw_params {
 	const struct iwl_sensitivity_ranges *sens;
 };
 
-#define HT_SHORT_GI_20MHZ	(1 << 0)
-#define HT_SHORT_GI_40MHZ	(1 << 1)
-
 
 /******************************************************************************
  *
@@ -590,15 +577,15 @@ static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
 }
 
 
-struct iwl_priv;
-
-
 struct iwl_dma_ptr {
 	dma_addr_t dma;
 	void *addr;
 	size_t size;
 };
 
+#define HT_SHORT_GI_20MHZ	(1 << 0)
+#define HT_SHORT_GI_40MHZ	(1 << 1)
+
 #define IWL_CHANNEL_WIDTH_20MHZ   0
 #define IWL_CHANNEL_WIDTH_40MHZ   1
 
@@ -613,7 +600,6 @@ struct iwl_dma_ptr {
 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
 
 /* Sensitivity and chain noise calibration */
-#define INTERFERENCE_DATA_AVAILABLE	__constant_cpu_to_le32(1)
 #define INITIALIZATION_VALUE		0xFFFF
 #define CAL_NUM_OF_BEACONS		20
 #define MAXIMUM_ALLOWED_PATHLOSS	15
@@ -666,15 +652,6 @@ enum iwl4965_calib_enabled_state {
 	IWL_CALIB_ENABLED = 1,
 };
 
-struct statistics_general_data {
-	u32 beacon_silence_rssi_a;
-	u32 beacon_silence_rssi_b;
-	u32 beacon_silence_rssi_c;
-	u32 beacon_energy_a;
-	u32 beacon_energy_b;
-	u32 beacon_energy_c;
-};
-
 
 /*
  * enum iwl_calib
-- 
1.5.3.6


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

* [PATCH 2/8] iwlwifi: add line feed to printk
  2008-12-17  8:52 ` [PATCH 1/8] iwlwifi: cleanup iwl-dev.h Zhu Yi
@ 2008-12-17  8:52   ` Zhu Yi
  2008-12-17  8:52     ` [PATCH 3/8] iwlwifi: update comments on the debug interface Zhu Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wu, Fengguang, Zhu Yi

From: Wu, Fengguang <fengguang.wu@intel.com>

This adds line feed to printk.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-led.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index dce32ff..11eccd7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -292,7 +292,7 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
 			if (tpt  > (blink_tbl[i].tpt * IWL_1MB_RATE))
 				break;
 
-	IWL_DEBUG_LED("LED BLINK IDX=%d", i);
+	IWL_DEBUG_LED("LED BLINK IDX=%d\n", i);
 	return i;
 }
 
-- 
1.5.3.6


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

* [PATCH 3/8] iwlwifi: update comments on the debug interface
  2008-12-17  8:52   ` [PATCH 2/8] iwlwifi: add line feed to printk Zhu Yi
@ 2008-12-17  8:52     ` Zhu Yi
  2008-12-17  8:52       ` [PATCH 4/8] iwlwifi: use type uint for module param debug Zhu Yi
  2008-12-17 10:53       ` [PATCH 3/8] iwlwifi: update comments on the debug interface Wu Fengguang
  0 siblings, 2 replies; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wu, Fengguang, Zhu Yi

From: Wu, Fengguang <fengguang.wu@intel.com>

Bring up-to-date some comments on the location of debug files.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c   |    2 +-
 drivers/net/wireless/iwlwifi/iwl-debug.h |   17 +++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 9d50fad..d0fb7a3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3354,7 +3354,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
 
 /*
  * The following adds a new attribute to the sysfs representation
- * of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/)
+ * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)
  * used for controlling the debug level.
  *
  * See the level definitions in iwl for details.
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index e4c264b..56c13b4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -96,28 +96,25 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
 #endif				/* CONFIG_IWLWIFI_DEBUGFS */
 
 /*
- * To use the debug system;
+ * To use the debug system:
  *
  * If you are defining a new debug classification, simply add it to the #define
- * list here in the form of:
+ * list here in the form of
  *
  * #define IWL_DL_xxxx VALUE
  *
- * shifting value to the left one bit from the previous entry.  xxxx should be
- * the name of the classification (for example, WEP)
+ * where xxxx should be the name of the classification (for example, WEP).
  *
  * You then need to either add a IWL_xxxx_DEBUG() macro definition for your
  * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want
  * to send output to that classification.
  *
- * To add your debug level to the list of levels seen when you perform
+ * The active debug levels can be accessed via files
  *
- * % cat /sys/class/net/wlanX/device/debug_level
+ * 	/sys/module/iwlagn/parameters/debug{50}
+ * 	/sys/class/net/wlan0/device/debug_level
  *
- * you simply need to add your entry to the iwl_debug_levels array.
- *
- * If you do not see debug_level in  /sys/class/net/wlanX/device/debug_level
- * then you do not have CONFIG_IWLWIFI_DEBUG defined in your kernel config file
+ * when CONFIG_IWLWIFI_DEBUG=y.
  */
 
 #define IWL_DL_INFO		(1 << 0)
-- 
1.5.3.6


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

* [PATCH 4/8] iwlwifi: use type uint for module param debug
  2008-12-17  8:52     ` [PATCH 3/8] iwlwifi: update comments on the debug interface Zhu Yi
@ 2008-12-17  8:52       ` Zhu Yi
  2008-12-17  8:52         ` [PATCH 5/8] iwlwifi: remove useless goto Zhu Yi
  2008-12-17 10:53       ` [PATCH 3/8] iwlwifi: update comments on the debug interface Wu Fengguang
  1 sibling, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wu, Fengguang, Zhu Yi

From: Wu, Fengguang <fengguang.wu@intel.com>

This enables one to change the debug level at bit 31.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-4965.c     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-core.h     |    2 +-
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a7e6e32..3a78d86 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2354,7 +2354,7 @@ module_param_named(disable, iwl4965_mod_params.disable, int, 0444);
 MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
 module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444);
 MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
-module_param_named(debug, iwl4965_mod_params.debug, int, 0444);
+module_param_named(debug, iwl4965_mod_params.debug, uint, 0444);
 MODULE_PARM_DESC(debug, "debug output mask");
 module_param_named(
 	disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int, 0444);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 2344de9..7f3a921 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1623,7 +1623,7 @@ MODULE_PARM_DESC(disable50,
 module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444);
 MODULE_PARM_DESC(swcrypto50,
 		  "using software crypto engine (default 0 [hardware])\n");
-module_param_named(debug50, iwl50_mod_params.debug, int, 0444);
+module_param_named(debug50, iwl50_mod_params.debug, uint, 0444);
 MODULE_PARM_DESC(debug50, "50XX debug output mask");
 module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444);
 MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 08b842f..7c3a20a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -154,7 +154,7 @@ struct iwl_ops {
 struct iwl_mod_params {
 	int disable;		/* def: 0 = enable radio */
 	int sw_crypto;		/* def: 0 = using hardware encryption */
-	int debug;		/* def: 0 = minimal debug log messages */
+	u32 debug;		/* def: 0 = minimal debug log messages */
 	int disable_hw_scan;	/* def: 0 = use h/w scan */
 	int num_of_queues;	/* def: HW dependent */
 	int num_of_ampdu_queues;/* def: HW dependent */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 161d812..dad8e6d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -65,7 +65,7 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
 
 /* module parameters */
 static int iwl3945_param_disable_hw_scan; /* def: 0 = use 3945's h/w scan */
-static int iwl3945_param_debug;    /* def: 0 = minimal debug log messages */
+static u32 iwl3945_param_debug;    /* def: 0 = minimal debug log messages */
 static int iwl3945_param_disable;  /* def: 0 = enable radio */
 static int iwl3945_param_antenna;  /* def: 0 = both antennas (use diversity) */
 int iwl3945_param_hwcrypto;        /* def: 0 = use software encryption */
@@ -8361,7 +8361,7 @@ MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
 module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444);
 MODULE_PARM_DESC(hwcrypto,
 		 "using hardware crypto engine (default 0 [software])\n");
-module_param_named(debug, iwl3945_param_debug, int, 0444);
+module_param_named(debug, iwl3945_param_debug, uint, 0444);
 MODULE_PARM_DESC(debug, "debug output mask");
 module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444);
 MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
-- 
1.5.3.6


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

* [PATCH 5/8] iwlwifi: remove useless goto
  2008-12-17  8:52       ` [PATCH 4/8] iwlwifi: use type uint for module param debug Zhu Yi
@ 2008-12-17  8:52         ` Zhu Yi
  2008-12-17  8:52           ` [PATCH 6/8] iwlwifi: use meaningful vars in _iwl_poll_bit() Zhu Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wu Fengguang, Zhu Yi

From: Wu Fengguang <fengguang.wu@intel.com>

The patch removes some useless goto in code cleanup.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-4965.c |    8 ++------
 drivers/net/wireless/iwlwifi/iwl-5000.c |    8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 3a78d86..5a72bc0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -426,7 +426,6 @@ static void iwl4965_nic_config(struct iwl_priv *priv)
 
 static int iwl4965_apm_stop_master(struct iwl_priv *priv)
 {
-	int ret = 0;
 	unsigned long flags;
 
 	spin_lock_irqsave(&priv->lock, flags);
@@ -434,16 +433,13 @@ static int iwl4965_apm_stop_master(struct iwl_priv *priv)
 	/* set stop master bit */
 	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
 
-	ret = iwl_poll_direct_bit(priv, CSR_RESET,
+	iwl_poll_direct_bit(priv, CSR_RESET,
 			CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
-	if (ret < 0)
-		goto out;
 
-out:
 	spin_unlock_irqrestore(&priv->lock, flags);
 	IWL_DEBUG_INFO("stop master\n");
 
-	return ret;
+	return 0;
 }
 
 static void iwl4965_apm_stop(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 7f3a921..66d053d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -73,7 +73,6 @@ static const u16 iwl5000_default_queue_to_tx_fifo[] = {
 /* FIXME: same implementation as 4965 */
 static int iwl5000_apm_stop_master(struct iwl_priv *priv)
 {
-	int ret = 0;
 	unsigned long flags;
 
 	spin_lock_irqsave(&priv->lock, flags);
@@ -81,16 +80,13 @@ static int iwl5000_apm_stop_master(struct iwl_priv *priv)
 	/* set stop master bit */
 	iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
 
-	ret = iwl_poll_direct_bit(priv, CSR_RESET,
+	iwl_poll_direct_bit(priv, CSR_RESET,
 				  CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
-	if (ret < 0)
-		goto out;
 
-out:
 	spin_unlock_irqrestore(&priv->lock, flags);
 	IWL_DEBUG_INFO("stop master\n");
 
-	return ret;
+	return 0;
 }
 
 
-- 
1.5.3.6


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

* [PATCH 6/8] iwlwifi: use meaningful vars in _iwl_poll_bit()
  2008-12-17  8:52         ` [PATCH 5/8] iwlwifi: remove useless goto Zhu Yi
@ 2008-12-17  8:52           ` Zhu Yi
  2008-12-17  8:52             ` [PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory Zhu Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Wu, Fengguang, Zhu Yi

From: Wu, Fengguang <fengguang.wu@intel.com>

Rename vars in _iwl_poll_bit() to better reflect the truth.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-io.h |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index 998ac19..0a92e74 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -87,17 +87,18 @@ static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs)
 #define iwl_read32(p, o) _iwl_read32(p, o)
 #endif
 
+#define IWL_POLL_INTERVAL 10	/* microseconds */
 static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
 				u32 bits, u32 mask, int timeout)
 {
-	int i = 0;
+	int t = 0;
 
 	do {
 		if ((_iwl_read32(priv, addr) & mask) == (bits & mask))
-			return i;
-		udelay(10);
-		i += 10;
-	} while (i < timeout);
+			return t;
+		udelay(IWL_POLL_INTERVAL);
+		t += IWL_POLL_INTERVAL;
+	} while (t < timeout);
 
 	return -ETIMEDOUT;
 }
-- 
1.5.3.6


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

* [PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory
  2008-12-17  8:52           ` [PATCH 6/8] iwlwifi: use meaningful vars in _iwl_poll_bit() Zhu Yi
@ 2008-12-17  8:52             ` Zhu Yi
  2008-12-17  8:52               ` [PATCH 8/8] iwlwifi: indicate txpower is off in sysfs Zhu Yi
  0 siblings, 1 reply; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Zhu Yi

Previously we allocate Rx SKB with GFP_ATOMIC flag. This is because we need
to hold a spinlock to protect the two rx_used and rx_free lists operation
in the rxq.

	spin_lock();
	...
	element = rxq->rx_used.next;
	element->skb = alloc_skb(..., GFP_ATOMIC);
	list_del(element);
	list_add_tail(&element->list, &rxq->rx_free);
	...
	spin_unlock();

After spliting the rx_used delete and rx_free insert into two operations,
we don't require the skb allocation in an atomic context any more (the
function itself is scheduled in a workqueue).

	spin_lock();
	...
	element = rxq->rx_used.next;
	list_del(element);
	...
	spin_unlock();
	...
	element->skb = alloc_skb(..., GFP_KERNEL);
	...
	spin_lock()
	...
	list_add_tail(&element->list, &rxq->rx_free);
	...
	spin_unlock();

This patch should fix the "iwlagn: Can not allocate SKB buffers" warning
we see recently.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |   12 +-----------
 drivers/net/wireless/iwlwifi/iwl-rx.c  |   29 +++++++++++++++++++----------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d0fb7a3..8102815 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1112,16 +1112,6 @@ static void iwl_setup_rx_handlers(struct iwl_priv *priv)
 	priv->cfg->ops->lib->rx_handler_setup(priv);
 }
 
-/*
- * this should be called while priv->lock is locked
-*/
-static void __iwl_rx_replenish(struct iwl_priv *priv)
-{
-	iwl_rx_allocate(priv);
-	iwl_rx_queue_restock(priv);
-}
-
-
 /**
  * iwl_rx_handle - Main entry function for receiving responses from uCode
  *
@@ -1230,7 +1220,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
 			count++;
 			if (count >= 8) {
 				priv->rxq.read = i;
-				__iwl_rx_replenish(priv);
+				iwl_rx_queue_restock(priv);
 				count = 0;
 			}
 		}
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index 919a775..c5f1aa0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -244,25 +244,31 @@ void iwl_rx_allocate(struct iwl_priv *priv)
 	struct list_head *element;
 	struct iwl_rx_mem_buffer *rxb;
 	unsigned long flags;
-	spin_lock_irqsave(&rxq->lock, flags);
-	while (!list_empty(&rxq->rx_used)) {
+
+	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,
-				__GFP_NOWARN | GFP_ATOMIC);
+				     GFP_KERNEL);
 		if (!rxb->skb) {
-			if (net_ratelimit())
-				printk(KERN_CRIT DRV_NAME
-				       ": Can not allocate SKB buffers\n");
+			printk(KERN_CRIT DRV_NAME
+				   "Can not allocate SKB buffers\n");
 			/* We don't reschedule replenish work here -- we will
 			 * call the restock method and if it still needs
 			 * more buffers it will schedule replenish */
 			break;
 		}
-		priv->alloc_rxb_skb++;
-		list_del(element);
 
 		/* Get physical address of RB/SKB */
 		rxb->real_dma_addr = pci_map_single(
@@ -276,12 +282,15 @@ void iwl_rx_allocate(struct iwl_priv *priv)
 		rxb->aligned_dma_addr = ALIGN(rxb->real_dma_addr, 256);
 		skb_reserve(rxb->skb, rxb->aligned_dma_addr - rxb->real_dma_addr);
 
+		spin_lock_irqsave(&rxq->lock, flags);
+
 		list_add_tail(&rxb->list, &rxq->rx_free);
 		rxq->free_count++;
+		priv->alloc_rxb_skb++;
+
+		spin_unlock_irqrestore(&rxq->lock, flags);
 	}
-	spin_unlock_irqrestore(&rxq->lock, flags);
 }
-EXPORT_SYMBOL(iwl_rx_allocate);
 
 void iwl_rx_replenish(struct iwl_priv *priv)
 {
-- 
1.5.3.6


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

* [PATCH 8/8] iwlwifi: indicate txpower is off in sysfs
  2008-12-17  8:52             ` [PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory Zhu Yi
@ 2008-12-17  8:52               ` Zhu Yi
  0 siblings, 0 replies; 10+ messages in thread
From: Zhu Yi @ 2008-12-17  8:52 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, ipw3945-devel, Jay Sternberg, Zhu Yi

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

The patch checks if the radio is disabled before displaying the tx power
level. Previously when the txpower was set off show_tx_power still
returned the prior power level. Now it will indicate the power has been
turned off.

Signed-off-by: Jay Sternberg <jay.e.sternberg@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-agn.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 8102815..b6c74a1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3430,7 +3430,11 @@ static ssize_t show_tx_power(struct device *d,
 			     struct device_attribute *attr, char *buf)
 {
 	struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
-	return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
+
+	if (!iwl_is_ready_rf(priv))
+		return sprintf(buf, "off\n");
+	else
+		return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
 }
 
 static ssize_t store_tx_power(struct device *d,
-- 
1.5.3.6


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

* Re: [PATCH 3/8] iwlwifi: update comments on the debug interface
  2008-12-17  8:52     ` [PATCH 3/8] iwlwifi: update comments on the debug interface Zhu Yi
  2008-12-17  8:52       ` [PATCH 4/8] iwlwifi: use type uint for module param debug Zhu Yi
@ 2008-12-17 10:53       ` Wu Fengguang
  1 sibling, 0 replies; 10+ messages in thread
From: Wu Fengguang @ 2008-12-17 10:53 UTC (permalink / raw)
  To: Zhu, Yi
  Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net

On Wed, Dec 17, 2008 at 10:52:29AM +0200, Zhu, Yi wrote:
> From: Wu, Fengguang <fengguang.wu@intel.com>
> 
> Bring up-to-date some comments on the location of debug files.
> 
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> Acked-by: Tomas Winkler <tomas.winkler@intel.com>
> Signed-off-by: Zhu Yi <yi.zhu@intel.com>
> ---
>  drivers/net/wireless/iwlwifi/iwl-agn.c   |    2 +-
>  drivers/net/wireless/iwlwifi/iwl-debug.h |   17 +++++++----------
>  2 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index 9d50fad..d0fb7a3 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -3354,7 +3354,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
>  
>  /*
>   * The following adds a new attribute to the sysfs representation
> - * of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/)
> + * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)
>   * used for controlling the debug level.
>   *
>   * See the level definitions in iwl for details.
> diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
> index e4c264b..56c13b4 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-debug.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
> @@ -96,28 +96,25 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
>  #endif				/* CONFIG_IWLWIFI_DEBUGFS */
>  
>  /*
> - * To use the debug system;
> + * To use the debug system:
>   *
>   * If you are defining a new debug classification, simply add it to the #define
> - * list here in the form of:
> + * list here in the form of
>   *
>   * #define IWL_DL_xxxx VALUE
>   *
> - * shifting value to the left one bit from the previous entry.  xxxx should be
> - * the name of the classification (for example, WEP)
> + * where xxxx should be the name of the classification (for example, WEP).
>   *
>   * You then need to either add a IWL_xxxx_DEBUG() macro definition for your
>   * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want
>   * to send output to that classification.
>   *
> - * To add your debug level to the list of levels seen when you perform
> + * The active debug levels can be accessed via files
>   *
> - * % cat /sys/class/net/wlanX/device/debug_level
> + * 	/sys/module/iwlagn/parameters/debug{50}
> + * 	/sys/class/net/wlan0/device/debug_level
>   *
> - * you simply need to add your entry to the iwl_debug_levels array.
> - *
> - * If you do not see debug_level in  /sys/class/net/wlanX/device/debug_level
> - * then you do not have CONFIG_IWLWIFI_DEBUG defined in your kernel config file
> + * when CONFIG_IWLWIFI_DEBUG=y.
>   */

Hi Yi,

This was my prepared version:

 * The debug levels can be activated by the "debug" module parameter("debug50"
 * for 5000), and be runtime accessed via file
 *
 *     /sys/class/net/wlan0/device/debug_level
 *
 * when CONFIG_IWLWIFI_DEBUG=y.

It's not really an obviously better writing though, and can be safely ignored.

Thanks,
Fengguang


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

end of thread, other threads:[~2008-12-17 10:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-17  8:52 [PATCH 0/8] iwlwifi driver 12/17 updates Zhu Yi
2008-12-17  8:52 ` [PATCH 1/8] iwlwifi: cleanup iwl-dev.h Zhu Yi
2008-12-17  8:52   ` [PATCH 2/8] iwlwifi: add line feed to printk Zhu Yi
2008-12-17  8:52     ` [PATCH 3/8] iwlwifi: update comments on the debug interface Zhu Yi
2008-12-17  8:52       ` [PATCH 4/8] iwlwifi: use type uint for module param debug Zhu Yi
2008-12-17  8:52         ` [PATCH 5/8] iwlwifi: remove useless goto Zhu Yi
2008-12-17  8:52           ` [PATCH 6/8] iwlwifi: use meaningful vars in _iwl_poll_bit() Zhu Yi
2008-12-17  8:52             ` [PATCH 7/8] iwlwifi: use GFP_KERNEL to allocate Rx SKB memory Zhu Yi
2008-12-17  8:52               ` [PATCH 8/8] iwlwifi: indicate txpower is off in sysfs Zhu Yi
2008-12-17 10:53       ` [PATCH 3/8] iwlwifi: update comments on the debug interface Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).