linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/17] iwlwifi: provide frequency to radiotap monitor not channel index
       [not found] <11855284012123-git-send-email-yi.zhu@intel.com>
@ 2007-07-27  9:26 ` Zhu Yi
  2007-07-27  9:26   ` [PATCH 02/17] iwlwifi: Calculate and report noise level while associated Zhu Yi
  2007-07-27  9:30 ` [PATCH 00/17] iwlwifi driver updated to version 0.1.5 Zhu Yi
  1 sibling, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Andy Green

iwlwifi wrongly provides the channel index to the radiotap header
on Monitor mode. This results in tcpdump showing "6MHz" for example.

This patch arranges to send the frequency in MHz instead eg, 2437MHz

Signed-off-by: Andy Green <andy@warmcat.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c |    5 ++---
 drivers/net/wireless/iwlwifi.h  |    2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index a1ebc2a..8671891 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -3120,7 +3120,6 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
 	 * the information provided in the skb from the hardware */
 	s8 signal = stats->ssi;
 	s8 noise = 0;
-	u16 channel = stats->channel;
 	int rate = stats->rate;
 	u64 tsf = stats->mactime;
 
@@ -3162,8 +3161,8 @@ void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
 	iwl_rt->rt_dbmsignal = signal;
 	iwl_rt->rt_dbmnoise = noise;
 
-	/* Convert the channel data and set the flags */
-	iwl_rt->rt_channel = cpu_to_le16(channel);
+	/* Convert the channel frequency and set the flags */
+	iwl_rt->rt_channelMHz = cpu_to_le16(stats->freq);
 	if (!(phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK)) {
 		iwl_rt->rt_chbitmask =
 		    cpu_to_le16((IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ));
diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h
index a86fc48..58e3ea6 100644
--- a/drivers/net/wireless/iwlwifi.h
+++ b/drivers/net/wireless/iwlwifi.h
@@ -104,7 +104,7 @@ struct iwl_rt_rx_hdr {
 	__le64 rt_tsf;		/* TSF */
 	u8 rt_flags;		/* radiotap packet flags */
 	u8 rt_rate;		/* rate in 500kb/s */
-	__le16 rt_channel;	/* channel in mHz */
+	__le16 rt_channelMHz;	/* channel in MHz */
 	__le16 rt_chbitmask;	/* channel bitfield */
 	s8 rt_dbmsignal;	/* signal in dBm, kluged to signed */
 	s8 rt_dbmnoise;
-- 
1.5.2

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

* [PATCH 02/17] iwlwifi: Calculate and report noise level while associated
  2007-07-27  9:26 ` [PATCH 01/17] iwlwifi: provide frequency to radiotap monitor not channel index Zhu Yi
@ 2007-07-27  9:26   ` Zhu Yi
  2007-07-27  9:26     ` [PATCH 03/17] iwlwifi: modify station fix Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Cahill, Ben M

The patch fixed the "Noise level" info from iwconfig disappeared
after association bug.

Signed-off-by: Cahill, Ben M <ben.m.cahill@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-4965.c |   90 +++++++++++++++++++++++++++------------
 drivers/net/wireless/iwl-4965.h |    2 +-
 drivers/net/wireless/iwl-base.c |    2 +-
 drivers/net/wireless/iwl-priv.h |    6 +--
 4 files changed, 67 insertions(+), 33 deletions(-)

diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index caefb2c..9991956 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -3459,6 +3459,43 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
 	return 1;
 }
 
+/* Calculate noise level, based on measurements during network silence just
+ *   before arriving beacon.  This measurement can be done only if we know
+ *   exactly when to expect beacons, therefore only when we're associated. */
+static void iwl4965_rx_calc_noise(struct iwl_priv *priv)
+{
+	struct statistics_rx_non_phy *rx_info
+				= &(priv->statistics.rx.general);
+	int num_active_rx = 0;
+	int total_silence = 0;
+	int bcn_silence_a = rx_info->beacon_silence_rssi_a & IN_BAND_FILTER;
+	int bcn_silence_b = rx_info->beacon_silence_rssi_b & IN_BAND_FILTER;
+	int bcn_silence_c = rx_info->beacon_silence_rssi_c & IN_BAND_FILTER;
+
+	if (bcn_silence_a) {
+		total_silence += bcn_silence_a;
+		num_active_rx++;
+	}
+	if (bcn_silence_b) {
+		total_silence += bcn_silence_b;
+		num_active_rx++;
+	}
+	if (bcn_silence_c) {
+		total_silence += bcn_silence_c;
+		num_active_rx++;
+	}
+
+	/* Average among active antennas */
+	if (num_active_rx)
+		priv->last_rx_noise = (total_silence / num_active_rx) - 107;
+	else
+		priv->last_rx_noise = -127;
+
+	IWL_DEBUG_CALIB("inband silence a %u, b %u, c %u, dBm %d\n",
+			bcn_silence_a, bcn_silence_b, bcn_silence_c,
+			priv->last_rx_noise);
+}
+
 void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
 {
 	struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
@@ -3485,11 +3522,14 @@ void iwl_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
 	mod_timer(&priv->statistics_periodic, jiffies +
 		  msecs_to_jiffies(REG_RECALIB_PERIOD * 1000));
 
-#ifdef CONFIG_IWLWIFI_SENSITIVITY
 	if (unlikely(!(priv->status & STATUS_SCANNING)) &&
-	    (pkt->hdr.cmd == STATISTICS_NOTIFICATION))
+	    (pkt->hdr.cmd == STATISTICS_NOTIFICATION)) {
+		iwl4965_rx_calc_noise(priv);
+#ifdef CONFIG_IWLWIFI_SENSITIVITY
 		queue_work(priv->workqueue, &priv->sensitivity_work);
 #endif
+	}
+
 	/* If the hardware hasn't reported a change in
 	 * temperature then don't bother computing a
 	 * calibrated temperature value */
@@ -3828,46 +3868,42 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,
 	/* Find max signal strength (dBm) among 3 antenna/receiver chains */
 	stats.ssi = iwl4965_calc_rssi(rx_start);
 
-	IWL_DEBUG_RX("Rssi %d, TSF %llu\n", stats.ssi,
-			le64_to_cpu(rx_start->timestamp));
-
-	/* Sensitivity algo, if used (only while associated, not scanning),
-	 * calculates signal-to-noise ratio in dB.  Use this if available,
-	 * else calculate signal quality using only the signal strength. */
-	if (priv->last_rx_snr && iwl_is_associated(priv) &&
-			!(priv->status & STATUS_SCANNING)) {
-		/* TODO:  Find better noise level reference, use
-		 *        in iwl_calc_sig_qual() */
-		stats.noise = stats.ssi - priv->last_rx_snr;
-		stats.signal = iwl_calc_sig_qual(stats.ssi, 0);
+	/* Meaningful noise values are available only from beacon statistics,
+	 *   which are gathered only when associated, and indicate noise
+	 *   only for the associated network channel ...
+	 * Ignore these noise values while scanning (other channels) */
+	if (iwl_is_associated(priv) && !(priv->status & STATUS_SCANNING)) {
+		stats.noise = priv->last_rx_noise;
+		stats.signal = iwl_calc_sig_qual(stats.ssi, stats.noise);
 	} else {
+		stats.noise = -127;
 		stats.signal = iwl_calc_sig_qual(stats.ssi, 0);
+	}
 
-		/* Reset noise values if not associated or snr not available. */
-		/* Set default noise value to -127 ... this works better than
-		 *   0 when averaging frames with/without noise info;
-		 *   measured dBm values are always negative ... using a
-		 *   negative value as the default keeps all averages
-		 *   within an s8's (used in some apps) range of negative
-		 *   values. */
-		priv->last_rx_snr = 0;
+	/* Reset beacon noise level if not associated.
+	 * Use default noise value of -127 ... this works better than
+	 *   0 when averaging frames with/without noise info;
+	 *   measured dBm values are always negative ... using a
+	 *   negative value as the default keeps all averages within
+	 *   an s8's (used in some apps) range of negative values. */
+	if (!iwl_is_associated(priv))
 		priv->last_rx_noise = -127;
-		stats.noise = -127;
-	}
-	IWL_DEBUG_STATS("Rssi %d noise %d qual %d snr db %d\n", stats.ssi,
-			stats.noise, stats.signal, priv->last_rx_snr);
 
 #ifdef CONFIG_IWLWIFI_DEBUG
 	/* TODO:  Parts of iwl_report_frame are broken for 4965 */
 	if (iwl_debug_level & (IWL_DL_RX))
 		/* Set "1" to report good data frames in groups of 100 */
 		iwl_report_frame(priv, pkt, header, 1);
+
+	if (iwl_debug_level & (IWL_DL_RX | IWL_DL_STATS))
+	IWL_DEBUG_RX("Rssi %d, noise %d, qual %d, TSF %lu\n",
+		stats.ssi, stats.noise, stats.signal,
+		 (long unsigned int)le64_to_cpu(rx_start->timestamp));
 #endif
 
 	network_packet = iwl_is_network_packet(priv, header);
 	if (network_packet) {
 		priv->last_rx_rssi = stats.ssi;
-		priv->last_rx_noise = stats.noise;
 		priv->last_beacon_time =  priv->ucode_beacon_time;
 		priv->last_tsf = le64_to_cpu(rx_start->timestamp);
 	}
diff --git a/drivers/net/wireless/iwl-4965.h b/drivers/net/wireless/iwl-4965.h
index a2452e9..816df54 100644
--- a/drivers/net/wireless/iwl-4965.h
+++ b/drivers/net/wireless/iwl-4965.h
@@ -197,7 +197,6 @@ struct iwl_lq_mngr {
 /* Sensitivity and chain noise calibration */
 #define INITIALIZATION_VALUE		0xFFFF
 #define CAL_NUM_OF_BEACONS		20
-#define IN_BAND_FILTER			0xFF
 #define MAXIMUM_ALLOWED_PATHLOSS	15
 
 /* Param table within SENSITIVITY_CMD */
@@ -257,6 +256,7 @@ struct iwl_lq_mngr {
 #define CHAIN_C             2
 #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
 #define ALL_BAND_FILTER			0xFF00
+#define IN_BAND_FILTER			0xFF
 #define MIN_AVERAGE_NOISE_MAX_VALUE	0xFFFFFFFF
 
 enum iwl_false_alarm_state {
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 8671891..7f8f2ac 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -3655,7 +3655,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
 		__le16 *qc = ieee80211_get_qos_ctrl(hdr);
 
 		if(qc == NULL) {
-			IWL_ERROR("BUG_ON qc is null!!!!");
+			IWL_ERROR("BUG_ON qc is null!!!!\n");
 			return;
 		}
 
diff --git a/drivers/net/wireless/iwl-priv.h b/drivers/net/wireless/iwl-priv.h
index 0a0f4bc..9de898d 100644
--- a/drivers/net/wireless/iwl-priv.h
+++ b/drivers/net/wireless/iwl-priv.h
@@ -182,10 +182,8 @@ struct iwl_priv {
 	u32 status;
 	u32 config;
 
-	int quality;
-	int last_rx_rssi;
-	int last_rx_noise;
-	int last_rx_snr;
+	int last_rx_rssi;	/* From Rx packet statisitics */
+	int last_rx_noise;	/* From beacon statistics */
 
 	struct iwl_power_mgr power_data;
 
-- 
1.5.2

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

* [PATCH 03/17] iwlwifi: modify station fix
  2007-07-27  9:26   ` [PATCH 02/17] iwlwifi: Calculate and report noise level while associated Zhu Yi
@ 2007-07-27  9:26     ` Zhu Yi
  2007-07-27  9:26       ` [PATCH 04/17] iwlwifi: cleanup tx queue allocation Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

This patch fixes bit mask for modify station parameters.
Using assignment (=) instead of adding (|). The later caused
bringing parameters from previous command to the current and
eventaully caused uCode error.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-4965.c |   10 +++++-----
 drivers/net/wireless/iwl-base.c |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index 9991956..3f1a339 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -3759,7 +3759,7 @@ static void iwl4965_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
 	priv->stations[sta_id].sta.station_flags &= ~STA_FLG_PWR_SAVE_MSK;
 	priv->stations[sta_id].sta.station_flags_msk = STA_FLG_PWR_SAVE_MSK;
 	priv->stations[sta_id].sta.sta.modify_mask = 0;
-	priv->stations[sta_id].sta.mode |= STA_CONTROL_MODIFY_MSK;
+	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 	spin_unlock_irqrestore(&priv->sta_lock, lock_flags);
 	/* assuming we are in rx flow and the lock is already locked */
 	iwl_send_add_station(priv, &priv->stations[sta_id].sta,
@@ -4097,9 +4097,9 @@ static void iwl_sta_modify_enable_tid_tx(struct iwl_priv *priv, int sta_id,
 	unsigned long lock_flags;
 
 	spin_lock_irqsave(&priv->sta_lock, lock_flags);
-	priv->stations[sta_id].sta.sta.modify_mask |= STA_MODIFY_TID_DISABLE_TX;
+	priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_TID_DISABLE_TX;
 	priv->stations[sta_id].sta.tid_disable_tx &= cpu_to_le32(~(1 << tid));
-	priv->stations[sta_id].sta.mode |= STA_CONTROL_MODIFY_MSK;
+	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 	spin_unlock_irqrestore(&priv->sta_lock, lock_flags);
 	iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
 }
@@ -4556,7 +4556,7 @@ static void iwl4965_sta_modify_add_ba_tid(struct iwl_priv *priv,
 	priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_ADDBA_TID_MSK;
 	priv->stations[sta_id].sta.add_immediate_ba_tid = (u8)tid;
 	priv->stations[sta_id].sta.add_immediate_ba_ssn = cpu_to_le16(ssn);
-	priv->stations[sta_id].sta.mode |= STA_CONTROL_MODIFY_MSK;
+	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 	spin_unlock_irqrestore(&priv->sta_lock, lock_flags);
 	iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
 }
@@ -4570,7 +4570,7 @@ static void iwl4965_sta_modify_del_ba_tid(struct iwl_priv *priv,
 	priv->stations[sta_id].sta.station_flags_msk = 0;
 	priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_DELBA_TID_MSK;
 	priv->stations[sta_id].sta.remove_immediate_ba_tid = (u8)tid;
-	priv->stations[sta_id].sta.mode |= STA_CONTROL_MODIFY_MSK;
+	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 	spin_unlock_irqrestore(&priv->sta_lock, lock_flags);
 	iwl_send_add_station(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
 }
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 7f8f2ac..1437f66 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -1405,8 +1405,8 @@ static int iwl_update_sta_key_info(struct iwl_priv *priv,
 	memcpy(priv->stations[sta_id].sta.key.key, keyconf->key,
 	       keyconf->keylen);
 	priv->stations[sta_id].sta.key.key_flags = key_flags;
-	priv->stations[sta_id].sta.sta.modify_mask |= STA_MODIFY_KEY_MASK;
-	priv->stations[sta_id].sta.mode |= STA_CONTROL_MODIFY_MSK;
+	priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+	priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 
 	spin_unlock_irqrestore(&priv->sta_lock, flags);
 
-- 
1.5.2

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

* [PATCH 04/17] iwlwifi: cleanup tx queue allocation
  2007-07-27  9:26     ` [PATCH 03/17] iwlwifi: modify station fix Zhu Yi
@ 2007-07-27  9:26       ` Zhu Yi
  2007-07-27  9:26         ` [PATCH 05/17] iwlwifi: rxon filter_flags endianity fix Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

The following patch cleans up tx queue allocation.  Change txq bd
from u8* to struct iwl_tdf_frame. This allows kill
txq->q.element_size and do strong type changing.  Most importantly
in increasing number of slots from 64 to 256 for TX queues. This is
crucial for good TX performance in HT aggregation.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-3945.c |   15 +++++++--------
 drivers/net/wireless/iwl-4965.c |    6 +++---
 drivers/net/wireless/iwl-base.c |   31 +++++++++++++++----------------
 drivers/net/wireless/iwl-hw.h   |    2 +-
 drivers/net/wireless/iwlwifi.h  |    3 +--
 5 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c
index 6683778..eb8226a 100644
--- a/drivers/net/wireless/iwl-3945.c
+++ b/drivers/net/wireless/iwl-3945.c
@@ -842,7 +842,7 @@ static int iwl3945_tx_reset(struct iwl_priv *priv)
 static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
 {
 	int rc;
-	int i, num_slots;
+	int txq_id, slots_num;
 
 	iwl_hw_txq_ctx_free(priv);
 
@@ -852,13 +852,14 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
 		goto error;
 
 	/* Tx queue(s) */
-	for (i = 0; i < TFD_QUEUE_MAX; i++) {
-		num_slots =
-		    (i == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS :
+	for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
+		slots_num =
+		    (txq_id == IWL_CMD_QUEUE_NUM) ? TFD_CMD_SLOTS :
 			TFD_TX_CMD_SLOTS;
-		rc = iwl_tx_queue_init(priv, &priv->txq[i], num_slots, i);
+		rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
+					txq_id);
 		if (rc) {
-			IWL_ERROR("Tx %d queue init failed\n", i);
+			IWL_ERROR("Tx %d queue init failed\n", txq_id);
 			goto error;
 		}
 	}
@@ -2109,8 +2110,6 @@ int iwl_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
 
 	shared_data->tx_base_ptr[txq_id] = (u32) txq->q.dma_addr;
 
-	txq->q.element_size = sizeof(struct iwl_tfd_frame);
-
 	spin_lock_irqsave(&priv->lock, flags);
 	rc = iwl_grab_restricted_access(priv);
 	if (rc) {
diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index 3f1a339..03e3708 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -366,7 +366,7 @@ static void iwl4965_kw_free(struct iwl_priv *priv)
 static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
 {
 	int rc = 0;
-	int txq_id, num_slots;
+	int txq_id, slots_num;
 	unsigned long flags;
 
 	iwl4965_kw_free(priv);
@@ -401,9 +401,9 @@ static int iwl4965_txq_ctx_reset(struct iwl_priv *priv)
 
 	/* Tx queue(s) */
 	for (txq_id = 0; txq_id < priv->hw_setting.max_queue_number; txq_id++) {
-		num_slots = (txq_id == IWL_CMD_QUEUE_NUM) ?
+		slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
 					TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
-		rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], num_slots,
+		rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
 				       txq_id);
 		if (rc) {
 			IWL_ERROR("Tx %d queue init failed\n", txq_id);
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 1437f66..82470f1 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -179,10 +179,10 @@ static inline u8 get_next_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
 }
 
 static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
-			  int count, int size, u32 id)
+			  int count, int slots_num, u32 id)
 {
 	q->n_bd = count;
-	q->n_window = size;
+	q->n_window = slots_num;
 	q->id = id;
 
 	q->low_mark = q->n_window / 4;
@@ -199,7 +199,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
 }
 
 static int iwl_tx_queue_alloc(struct iwl_priv *priv,
-			      struct iwl_tx_queue *txq, int count, u32 id)
+			      struct iwl_tx_queue *txq, u32 id)
 {
 	struct pci_dev *dev = priv->pci_dev;
 
@@ -215,13 +215,12 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
 		txq->txb = NULL;
 
 	txq->bd = pci_alloc_consistent(dev,
-			sizeof(struct iwl_tfd_frame) * TFD_QUEUE_SIZE_MAX,
+			sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX,
 			&txq->q.dma_addr);
 
-	txq->q.element_size = sizeof(struct iwl_tfd_frame);
 	if (!txq->bd) {
 		IWL_ERROR("pci_alloc_consistent(%zd) failed\n",
-			  sizeof(txq->bd[0]) * count);
+			  sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX);
 		goto error;
 	}
 	txq->q.id = id;
@@ -238,7 +237,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
 }
 
 int iwl_tx_queue_init(struct iwl_priv *priv,
-		      struct iwl_tx_queue *txq, int count, u32 txq_id)
+		      struct iwl_tx_queue *txq, int slots_num, u32 txq_id)
 {
 	struct pci_dev *dev = priv->pci_dev;
 	int len;
@@ -247,14 +246,14 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
 	/* alocate command space + one big command for scan since scan
 	 * command is very huge the system will not have two scan at the
 	 * same time */
-	len = sizeof(struct iwl_cmd) * count;
+	len = sizeof(struct iwl_cmd) * slots_num;
 	if (txq_id == IWL_CMD_QUEUE_NUM);
 		len +=  IWL_MAX_SCAN_SIZE;
 	txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
 	if (!txq->cmd)
 		return -ENOMEM;
 
-	rc = iwl_tx_queue_alloc(priv, txq, count, txq_id);
+	rc = iwl_tx_queue_alloc(priv, txq, txq_id);
 	if (rc) {
 		pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
 
@@ -262,7 +261,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv,
 	}
 
 	txq->need_update = 0;
-	iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, count, txq_id);
+	iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
 	iwl_hw_tx_queue_init(priv, txq);
 
 	return 0;
@@ -551,7 +550,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 {
 	struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
 	struct iwl_queue *q = &txq->q;
-	u8 *tfd;
+	struct iwl_tfd_frame *tfd;
 	u32 *control_flags;
 	struct iwl_cmd *out_cmd;
 	u32 idx = 0;
@@ -573,8 +572,8 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 		IWL_ERROR("No space for Tx\n");
 		return -ENOSPC;
 	}
-	tfd = &txq->bd[q->first_empty * q->element_size];
-	memset(tfd, 0, q->element_size);
+	tfd = &txq->bd[q->first_empty];
+	memset(tfd, 0, sizeof(*tfd));
 
 	control_flags = (u32 *) tfd;
 
@@ -2754,7 +2753,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
 		      struct sk_buff *skb, struct ieee80211_tx_control *ctl)
 {
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-	u8 *tfd;
+	struct iwl_tfd_frame *tfd;
 	u32 *control_flags;
 	int txq_id = ctl->queue;
 	struct iwl_tx_queue *txq = NULL;
@@ -2845,8 +2844,8 @@ static int iwl_tx_skb(struct iwl_priv *priv,
 	q = &txq->q;
 
 	spin_lock_irqsave(&priv->lock, flags);
-	tfd = (u8 *) (&txq->bd[q->first_empty * q->element_size]);
-	memset(tfd, 0, q->element_size);
+	tfd = &txq->bd[q->first_empty];
+	memset(tfd, 0, sizeof(*tfd));
 	control_flags = (u32 *) tfd;
 	idx = get_next_cmd_index(q, q->first_empty, 0);
 
diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h
index 4b3cd37..3f7e5bd 100644
--- a/drivers/net/wireless/iwl-hw.h
+++ b/drivers/net/wireless/iwl-hw.h
@@ -1231,7 +1231,7 @@ struct statistics {
 #define TFD_CTL_PAD_SET(n)         (n<<28)
 #define TFD_CTL_PAD_GET(ctl)       (ctl>>28)
 
-#define TFD_TX_CMD_SLOTS 64
+#define TFD_TX_CMD_SLOTS 256
 #define TFD_CMD_SLOTS 32
 
 #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h
index 58e3ea6..d0403d0 100644
--- a/drivers/net/wireless/iwlwifi.h
+++ b/drivers/net/wireless/iwlwifi.h
@@ -134,7 +134,6 @@ struct iwl_queue {
 	dma_addr_t dma_addr;   /* physical addr for BD's */
 	int n_window;	       /* safe queue window */
 	u32 id;
-	u32 element_size;
 	int low_mark;	       /* low watermark, resume queue if free
 				* space more than this */
 	int high_mark;         /* high watermark, stop queue if free
@@ -157,7 +156,7 @@ struct iwl_tx_info {
  */
 struct iwl_tx_queue {
 	struct iwl_queue q;
-	u8 *bd;
+	struct iwl_tfd_frame *bd;
 	struct iwl_cmd *cmd;
 	dma_addr_t dma_addr_cmd;
 	struct iwl_tx_info *txb;
-- 
1.5.2

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

* [PATCH 05/17] iwlwifi: rxon filter_flags endianity fix
  2007-07-27  9:26       ` [PATCH 04/17] iwlwifi: cleanup tx queue allocation Zhu Yi
@ 2007-07-27  9:26         ` Zhu Yi
  2007-07-27  9:26           ` [PATCH 06/17] iwlwifi: rename base.c to iwl-base.c Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch
  Cc: linux-wireless, Zhu Yi, Gregory Greenman, Tomas Winkler

This patch fixes endianty issues in rxon.filter_flags.
It also discards usage of iwl_check_bits in some cases.
The result is the same but the semantic is not.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c |   12 +++----
 drivers/net/wireless/iwl-hw.h   |   74 ++++++++++++++++++--------------------
 2 files changed, 40 insertions(+), 46 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 82470f1..3d19a1a 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -984,15 +984,13 @@ static int iwl_full_rxon_required(struct iwl_priv *priv)
 	 * flag transitions are allowed using RXON_ASSOC */
 
 	/* Check if we are not switching bands */
-	if (iwl_check_bits(priv->staging_rxon.flags, RXON_FLG_BAND_24G_MSK) !=
-	    iwl_check_bits(priv->active_rxon.flags, RXON_FLG_BAND_24G_MSK))
+	if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
+	    (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK))
 		return 1;
 
 	/* Check if we are switching association toggle */
-	if (iwl_check_bits(priv->staging_rxon.filter_flags,
-			   RXON_FILTER_ASSOC_MSK) !=
-	    iwl_check_bits(priv->active_rxon.filter_flags,
-			   RXON_FILTER_ASSOC_MSK))
+	if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
+		(priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
 		return 1;
 
 	return 0;
@@ -1154,7 +1152,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
 		       "* bssid = " MAC_FMT "\n",
 		       ((priv->staging_rxon.filter_flags &
 			 RXON_FILTER_ASSOC_MSK) ? "" : "out"),
-		       priv->staging_rxon.channel,
+		       le16_to_cpu(priv->staging_rxon.channel),
 		       MAC_ARG(priv->staging_rxon.bssid_addr));
 
 	/* Apply the new configuration */
diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h
index 3f7e5bd..58afbf7 100644
--- a/drivers/net/wireless/iwl-hw.h
+++ b/drivers/net/wireless/iwl-hw.h
@@ -193,47 +193,43 @@ enum {
 };
 
 /* rx_config flags */
-enum {
-	/* band & modulation selection */
-	RXON_FLG_BAND_24G_MSK = (1 << 0),
-	RXON_FLG_CCK_MSK = (1 << 1),
-	/* auto detection enable */
-	RXON_FLG_AUTO_DETECT_MSK = (1 << 2),
-	/* TGg protection when tx */
-	RXON_FLG_TGG_PROTECT_MSK = (1 << 3),
-	/* cck short slot & preamble */
-	RXON_FLG_SHORT_SLOT_MSK = (1 << 4),
-	RXON_FLG_SHORT_PREAMBLE_MSK = (1 << 5),
-	/* antenna selection */
-	RXON_FLG_DIS_DIV_MSK = (1 << 7),
-	RXON_FLG_ANT_SEL_MSK = 0x0f00,
-	RXON_FLG_ANT_A_MSK = (1 << 8),
-	RXON_FLG_ANT_B_MSK = (1 << 9),
-	/* radar detection enable */
-	RXON_FLG_RADAR_DETECT_MSK = (1 << 12),
-	RXON_FLG_TGJ_NARROW_BAND_MSK = (1 << 13),
-	/* rx response to host with 8-byte TSF
-	 * (according to ON_AIR deassertion) */
-	RXON_FLG_TSF2HOST_MSK = (1 << 15)
-};
+/* band & modulation selection */
+#define RXON_FLG_BAND_24G_MSK           __constant_cpu_to_le32(1 << 0)
+#define RXON_FLG_CCK_MSK                __constant_cpu_to_le32(1 << 1)
+/* auto detection enable */
+#define RXON_FLG_AUTO_DETECT_MSK        __constant_cpu_to_le32(1 << 2)
+/* TGg protection when tx */
+#define RXON_FLG_TGG_PROTECT_MSK        __constant_cpu_to_le32(1 << 3)
+/* cck short slot & preamble */
+#define RXON_FLG_SHORT_SLOT_MSK          __constant_cpu_to_le32(1 << 4)
+#define RXON_FLG_SHORT_PREAMBLE_MSK     __constant_cpu_to_le32(1 << 5)
+/* antenna selection */
+#define RXON_FLG_DIS_DIV_MSK            __constant_cpu_to_le32(1 << 7)
+#define RXON_FLG_ANT_SEL_MSK            __constant_cpu_to_le32(0x0f00)
+#define RXON_FLG_ANT_A_MSK              __constant_cpu_to_le32(1 << 8)
+#define RXON_FLG_ANT_B_MSK              __constant_cpu_to_le32(1 << 9)
+/* radar detection enable */
+#define RXON_FLG_RADAR_DETECT_MSK       __constant_cpu_to_le32(1 << 12)
+#define RXON_FLG_TGJ_NARROW_BAND_MSK    __constant_cpu_to_le32(1 << 13)
+/* rx response to host with 8-byte TSF
+* (according to ON_AIR deassertion) */
+#define RXON_FLG_TSF2HOST_MSK           __constant_cpu_to_le32(1 << 15)
 
 /* rx_config filter flags */
-enum {
-	/* accept all data frames */
-	RXON_FILTER_PROMISC_MSK = (1 << 0),
-	/* pass control & management to host */
-	RXON_FILTER_CTL2HOST_MSK = (1 << 1),
-	/* accept multi-cast */
-	RXON_FILTER_ACCEPT_GRP_MSK = (1 << 2),
-	/* don't decrypt uni-cast frames */
-	RXON_FILTER_DIS_DECRYPT_MSK = (1 << 3),
-	/* don't decrypt multi-cast frames */
-	RXON_FILTER_DIS_GRP_DECRYPT_MSK = (1 << 4),
-	/* STA is associated */
-	RXON_FILTER_ASSOC_MSK = (1 << 5),
-	/* transfer to host non bssid beacons in associated state */
-	RXON_FILTER_BCON_AWARE_MSK = (1 << 6)
-};
+/* accept all data frames */
+#define RXON_FILTER_PROMISC_MSK         __constant_cpu_to_le32(1 << 0)
+/* pass control & management to host */
+#define RXON_FILTER_CTL2HOST_MSK        __constant_cpu_to_le32(1 << 1)
+/* accept multi-cast */
+#define RXON_FILTER_ACCEPT_GRP_MSK      __constant_cpu_to_le32(1 << 2)
+/* don't decrypt uni-cast frames */
+#define RXON_FILTER_DIS_DECRYPT_MSK     __constant_cpu_to_le32(1 << 3)
+/* don't decrypt multi-cast frames */
+#define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4)
+/* STA is associated */
+#define RXON_FILTER_ASSOC_MSK           __constant_cpu_to_le32(1 << 5)
+/* transfer to host non bssid beacons in associated state */
+#define RXON_FILTER_BCON_AWARE_MSK      __constant_cpu_to_le32(1 << 6)
 
 /*
  * RXON-Timings Command & Response
-- 
1.5.2

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

* [PATCH 06/17] iwlwifi: rename base.c to iwl-base.c
  2007-07-27  9:26         ` [PATCH 05/17] iwlwifi: rxon filter_flags endianity fix Zhu Yi
@ 2007-07-27  9:26           ` Zhu Yi
  2007-07-27  9:26             ` [PATCH 07/17] iwilwifi: removed unused constant Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-3945.c |    2 +-
 drivers/net/wireless/iwl-3945.h |    2 +-
 drivers/net/wireless/iwl-4965.h |    2 +-
 drivers/net/wireless/iwl-base.c |    2 +-
 drivers/net/wireless/iwlwifi.h  |    8 ++++----
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c
index eb8226a..af136c8 100644
--- a/drivers/net/wireless/iwl-3945.c
+++ b/drivers/net/wireless/iwl-3945.c
@@ -223,7 +223,7 @@ int iwl3945_get_antenna_flags(const struct iwl_priv *priv)
  *
  *  RX handler implementations
  *
- *  Used by base.c
+ *  Used by iwl-base.c
  *
  *****************************************************************************/
 
diff --git a/drivers/net/wireless/iwl-3945.h b/drivers/net/wireless/iwl-3945.h
index b26b184..4f43702 100644
--- a/drivers/net/wireless/iwl-3945.h
+++ b/drivers/net/wireless/iwl-3945.h
@@ -45,7 +45,7 @@ static inline u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
 		 u16 tx_rate, u8 flags) { return 0; }
 #else				/* IWL == 3945 */
 /*
- * Forward declare iwl-3945.c functions for base.c
+ * Forward declare iwl-3945.c functions for iwl-base.c
  */
 extern int iwl3945_get_antenna_flags(const struct iwl_priv *priv);
 extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwl-4965.h b/drivers/net/wireless/iwl-4965.h
index 816df54..1f832e7 100644
--- a/drivers/net/wireless/iwl-4965.h
+++ b/drivers/net/wireless/iwl-4965.h
@@ -67,7 +67,7 @@ static inline int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode,
 static inline void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) {}
 #else				/* IWL == 4965 */
 /*
- * Forward declare iwl-4965.c functions for base.c
+ * Forward declare iwl-4965.c functions for iwl-base.c
  */
 extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
 					  struct iwl_tx_queue *txq,
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 3d19a1a..95e8ead 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -28,7 +28,7 @@
  *****************************************************************************/
 
 /*
- * NOTE:  This file (base.c) is used to build to multiple hardware targets
+ * NOTE:  This file (iwl-base.c) is used to build to multiple hardware targets
  * by defining IWL to either 3945 or 4965.  The Makefile used when building
  * the base targets will create base-3945.o and base-4965.o
  *
diff --git a/drivers/net/wireless/iwlwifi.h b/drivers/net/wireless/iwlwifi.h
index d0403d0..6941031 100644
--- a/drivers/net/wireless/iwlwifi.h
+++ b/drivers/net/wireless/iwlwifi.h
@@ -581,7 +581,7 @@ struct iwl_driver_hw_info {
 
 /******************************************************************************
  *
- * Functions implemented in base.c which are forward declared here
+ * Functions implemented in iwl-base.c which are forward declared here
  * for use by iwl-*.c
  *
  *****************************************************************************/
@@ -657,11 +657,11 @@ extern void iwl_down(struct iwl_priv *priv);
 
 /******************************************************************************
  *
- * Functions implemented in iwl-*.c which are forward declared here
- * for use by base.c
+ * Functions implemented in iwl-[34]*.c which are forward declared here
+ * for use by iwl-base.c
  *
  * NOTE:  The implementation of these functions are hardware specific
- * which is why they are in the hardware specific files (vs. base.c)
+ * which is why they are in the hardware specific files (vs. iwl-base.c)
  *
  * Naming convention --
  * iwl_         <-- Its part of iwlwifi (should be changed to iwl_)
-- 
1.5.2

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

* [PATCH 07/17] iwilwifi: removed unused constant
  2007-07-27  9:26           ` [PATCH 06/17] iwlwifi: rename base.c to iwl-base.c Zhu Yi
@ 2007-07-27  9:26             ` Zhu Yi
  2007-07-27  9:26               ` [PATCH 08/17] iwlwifi: QoS control endianity fixes Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

removed OFDM_SYMBOL_TIME

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-hw.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h
index 58afbf7..49ad71b 100644
--- a/drivers/net/wireless/iwl-hw.h
+++ b/drivers/net/wireless/iwl-hw.h
@@ -99,7 +99,6 @@
  */
 #define SHORT_SLOT_TIME 9
 #define LONG_SLOT_TIME 20
-#define OFDM_SYMBOL_TIME 4
 
 /* RSSI to dBm */
 #if IWL == 3945
-- 
1.5.2

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

* [PATCH 08/17] iwlwifi: QoS control endianity fixes
  2007-07-27  9:26             ` [PATCH 07/17] iwilwifi: removed unused constant Zhu Yi
@ 2007-07-27  9:26               ` Zhu Yi
  2007-07-27  9:26                 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

This patch fixes endianity issues in accessing QoS control field

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-4965.c    |    4 ++--
 drivers/net/wireless/iwl-base.c    |    4 ++--
 drivers/net/wireless/iwl-helpers.h |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index 03e3708..5586b4c 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -3236,7 +3236,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
 	int rate_index = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1);
 #ifdef CONFIG_IWLWIFI_HT
 #ifdef CONFIG_IWLWIFI_HT_AGG
-	u16 *qc;
+	__le16 *qc;
 #endif /*CONFIG_IWLWIFI_HT_AGG */
 #endif /* CONFIG_IWLWIFI_HT */
 
@@ -3308,7 +3308,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd,
 	if (qc &&
 	    (priv->iw_mode != IEEE80211_IF_TYPE_IBSS)) {
 		u8 tid = 0;
-		tid = (u8) (*qc & 0xF);
+		tid = (u8) (le16_to_cpu(*qc) & 0xF);
 		if (tid < TID_MAX_LOAD_COUNT)
 			iwl4965_tl_add_packet(priv, tid);
 	}
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 95e8ead..1adcdbe 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -2650,7 +2650,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv,
 {
 	u32 tx_flags;
 	u16 fc = le16_to_cpu(hdr->frame_control);
-	u16 *qc;
+	__le16 *qc;
 
 	tx_flags = cmd->cmd.tx.tx_flags;
 
@@ -2673,7 +2673,7 @@ static void iwl_build_tx_cmd_basic(struct iwl_priv *priv,
 
 	qc = ieee80211_get_qos_ctrl(hdr);
 	if (qc) {
-		cmd->cmd.tx.tid_tspec = (u8) (*qc & 0xf);
+		cmd->cmd.tx.tid_tspec = (u8) (le16_to_cpu(*qc) & 0xf);
 		tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
 	} else
 		tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
diff --git a/drivers/net/wireless/iwl-helpers.h b/drivers/net/wireless/iwl-helpers.h
index c9ceff6..94dbb38 100644
--- a/drivers/net/wireless/iwl-helpers.h
+++ b/drivers/net/wireless/iwl-helpers.h
@@ -181,7 +181,7 @@ static inline __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
 	u16 fc = le16_to_cpu(hdr->frame_control);
 	int hdr_len = ieee80211_get_hdrlen(fc);
 	if ( (fc & 0x00cc) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA))
-		return (u16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
+		return (__le16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
 	return NULL;
 }
 
-- 
1.5.2

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

* [PATCH 09/17] iwlwifi: EEPROM reading fix
  2007-07-27  9:26               ` [PATCH 08/17] iwlwifi: QoS control endianity fixes Zhu Yi
@ 2007-07-27  9:26                 ` Zhu Yi
  2007-07-27  9:26                   ` [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd Zhu Yi
  2007-07-27 11:22                   ` [PATCH 09/17] iwlwifi: EEPROM reading fix Michael Buesch
  0 siblings, 2 replies; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch
  Cc: linux-wireless, Zhu Yi, Gregory Greenman, Tomas Winkler

This patch fixes EEPROM access. 4965 requires aquiring of EEPROM
semaphore. In addition the timeout on EEPROM read must be longer 10.
This version fixes CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM definition.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-3945.c |    6 ++++++
 drivers/net/wireless/iwl-3945.h |    1 +
 drivers/net/wireless/iwl-4965.c |   29 +++++++++++++++++++++++++++++
 drivers/net/wireless/iwl-4965.h |    8 ++++++++
 drivers/net/wireless/iwl-base.c |   23 +++++++++++++++--------
 drivers/net/wireless/iwl-hw.h   |    2 +-
 6 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwl-3945.c b/drivers/net/wireless/iwl-3945.c
index af136c8..6c42f53 100644
--- a/drivers/net/wireless/iwl-3945.c
+++ b/drivers/net/wireless/iwl-3945.c
@@ -2295,4 +2295,10 @@ struct pci_device_id iwl_hw_card_ids[] = {
 	{0}
 };
 
+inline int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv)
+{
+	_iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_OWNER);
+	return 0;
+}
+
 MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
diff --git a/drivers/net/wireless/iwl-3945.h b/drivers/net/wireless/iwl-3945.h
index 4f43702..d134a4b 100644
--- a/drivers/net/wireless/iwl-3945.h
+++ b/drivers/net/wireless/iwl-3945.h
@@ -47,6 +47,7 @@ static inline u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
 /*
  * Forward declare iwl-3945.c functions for iwl-base.c
  */
+extern int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv);
 extern int iwl3945_get_antenna_flags(const struct iwl_priv *priv);
 extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv);
 extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index 5586b4c..a333204 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -4763,4 +4763,33 @@ struct pci_device_id iwl_hw_card_ids[] = {
 	{0}
 };
 
+int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv)
+{
+	u16 count;
+	int rc;
+
+	for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
+		iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+			CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
+		rc = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
+					CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
+					CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
+					EEPROM_SEM_TIMEOUT);
+		if (rc >= 0) {
+			IWL_DEBUG_IO("Aqcuired semaphore after %d tries.\n",
+				count+1);
+			return rc;
+		}
+	}
+
+	return rc;
+}
+
+inline void iwl_eeprom_release_semaphore(struct iwl_priv *priv)
+{
+	iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
+		CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
+}
+
+
 MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
diff --git a/drivers/net/wireless/iwl-4965.h b/drivers/net/wireless/iwl-4965.h
index 1f832e7..9e4a663 100644
--- a/drivers/net/wireless/iwl-4965.h
+++ b/drivers/net/wireless/iwl-4965.h
@@ -34,6 +34,8 @@ struct sta_ht_info;
  * In non IWL == 4965 builds, these must build to nothing in order to allow
  * the common code to not have several #if IWL == XXXX / #endif blocks
  */
+static inline void iwl_eeprom_release_semaphore(struct iwl_priv *priv) {}
+
 static inline void iwl4965_add_station(struct iwl_priv *priv, const u8 * addr,
 				       int is_ap) {}
 static inline void iwl4965_set_rxon_ht(struct iwl_priv *priv,
@@ -69,6 +71,9 @@ static inline void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) {}
 /*
  * Forward declare iwl-4965.c functions for iwl-base.c
  */
+extern int iwl_eeprom_aqcuire_semaphore(struct iwl_priv *priv);
+extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv);
+
 extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
 					  struct iwl_tx_queue *txq,
 					  u16 byte_cnt);
@@ -355,5 +360,8 @@ struct iwl_chain_noise_data {
 #define RATE_MCS_SGI_POS 13
 #define RATE_MCS_SGI_MSK 0x2000
 
+#define	EEPROM_SEM_TIMEOUT 10
+#define EEPROM_SEM_RETRY_LIMIT 1000
+
 #endif				/* IWL == 4965 */
 #endif				/* __iwl_4965_h__ */
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 1adcdbe..92c21d1 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -1549,35 +1549,42 @@ int iwl_eeprom_init(struct iwl_priv *priv)
 		IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp);
 		return -ENOENT;
 	}
-#if IWL == 3945
-	_iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_OWNER);
-#endif
+
+	rc = iwl_eeprom_aqcuire_semaphore(priv);
+	if (rc < 0) {
+		IWL_ERROR("Failed to aqcuire EEPROM semaphore.\n");
+		return -ENOENT;
+	}
 
 	for (addr = 0, r = 0; addr < sz; addr += 2) {
 		_iwl_write32(priv, CSR_EEPROM_REG, addr << 1);
 		_iwl_clear_bit(priv, CSR_EEPROM_REG, 0x00000002);
 		rc = _iwl_grab_restricted_access(priv);
 		if (rc)
-			return rc;
+			goto done;
 
-		for (to = 0; to < 10; to++) {
+		for (to = 0; to < 50; to++) {
 			r = _iwl_read_restricted(priv, CSR_EEPROM_REG);
 			if (r & 1)
 				break;
-			udelay(5);
+			udelay(10);
 		}
 
 		_iwl_release_restricted_access(priv);
 
 		if (!(r & 1)) {
 			IWL_ERROR("Time out reading EEPROM[%d]", addr);
-			return -ETIMEDOUT;
+			rc = -ETIMEDOUT;
+			goto done;
 		}
 
 		e[addr / 2] = le16_to_cpu(r >> 16);
 	}
+	rc = 0;
 
-	return 0;
+done:
+	iwl_eeprom_release_semaphore(priv);
+	return rc;
 }
 
 /******************************************************************************
diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h
index 49ad71b..7512fc7 100644
--- a/drivers/net/wireless/iwl-hw.h
+++ b/drivers/net/wireless/iwl-hw.h
@@ -893,6 +893,7 @@ struct statistics {
 #define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE         (0x00000800)
 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A    (0x00000000)
 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B    (0x00001000)
+#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM	    (0x00200000)
 
 #define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP             (0x00000001)
 #define CSR_UCODE_SW_BIT_RFKILL                     (0x00000002)
@@ -907,7 +908,6 @@ struct statistics {
 
 #define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT         (0x80000000)
 
-
 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
  * acknowledged (reset) by host writing "1" to flagged bits. */
 #define BIT_INT_FH_RX        (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */
-- 
1.5.2

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

* [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd
  2007-07-27  9:26                 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Zhu Yi
@ 2007-07-27  9:26                   ` Zhu Yi
  2007-07-27  9:26                     ` [PATCH 11/17] iwlwifi: endianity cleanup for QoS host command Zhu Yi
  2007-07-27 11:22                   ` [PATCH 09/17] iwlwifi: EEPROM reading fix Michael Buesch
  1 sibling, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

This patches cleans up endianity issues in iwl_print_rx_config_cmd,
which produced a lot of spares errors.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 92c21d1..8f9714f 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -4664,11 +4664,13 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)
 {
 	IWL_DEBUG_RADIO("RX CONFIG:\n");
 	printk_buf(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
-	IWL_DEBUG_RADIO("u16 channel: 0x%x\n", rxon->channel);
+	IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
 	IWL_DEBUG_RADIO("u32 flags: 0x%08X " BIT_FMT32 "\n",
-			rxon->flags, BIT_ARG32(rxon->flags));
+			le32_to_cpu(rxon->flags),
+			BIT_ARG32(le32_to_cpu(rxon->flags)));
 	IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x " BIT_FMT32 "\n",
-			rxon->filter_flags, BIT_ARG32(rxon->filter_flags));
+			le32_to_cpu(rxon->filter_flags),
+			BIT_ARG32(le32_to_cpu(rxon->filter_flags)));
 	IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
 	IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x " BIT_FMT8 "\n",
 			rxon->ofdm_basic_rates,
@@ -4679,7 +4681,7 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)
 			MAC_ARG(rxon->node_addr));
 	IWL_DEBUG_RADIO("u8[6] bssid_addr: " MAC_FMT "\n",
 			MAC_ARG(rxon->bssid_addr));
-	IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", rxon->assoc_id);
+	IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
 }
 
 #endif
-- 
1.5.2

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

* [PATCH 11/17] iwlwifi: endianity cleanup for QoS host command
  2007-07-27  9:26                   ` [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd Zhu Yi
@ 2007-07-27  9:26                     ` Zhu Yi
  2007-07-27  9:26                       ` [PATCH 12/17] iwlwifi: endianity cleanup for power table " Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

This patch cleans up endianity issues in QoS host command.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c |   54 ++++++++++++++++----------------------
 drivers/net/wireless/iwl-hw.h   |   12 +++------
 2 files changed, 27 insertions(+), 39 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 8f9714f..d56360c 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -1898,7 +1898,6 @@ static void iwl_reset_qos(struct iwl_priv *priv)
 	u16 cw_min = 15;
 	u16 cw_max = 1023;
 	u8 aifs = 2;
-	u16 burst_time = 0;
 	u8 is_legacy = 0;
 	unsigned long flags;
 	int i;
@@ -1923,63 +1922,56 @@ static void iwl_reset_qos(struct iwl_priv *priv)
 	if (priv->qos_data.qos_active)
 		aifs = 3;
 
-	priv->qos_data.def_qos_parm.ac[0].cw_min = (__le16)
-	    cpu_to_le16(cw_min);
-	priv->qos_data.def_qos_parm.ac[0].cw_max = (__le16)
-	    cpu_to_le16(cw_max);
+	priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min);
+	priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max);
 	priv->qos_data.def_qos_parm.ac[0].aifsn = aifs;
-	priv->qos_data.def_qos_parm.ac[0].edca_txop = (__le16)
-	    cpu_to_le16(burst_time);
+	priv->qos_data.def_qos_parm.ac[0].edca_txop = 0;
 	priv->qos_data.def_qos_parm.ac[0].reserved1 = 0;
 
 	if (priv->qos_data.qos_active) {
 		i = 1;
-		priv->qos_data.def_qos_parm.ac[i].cw_min = (__le16)
-		    cpu_to_le16(cw_min);
-		priv->qos_data.def_qos_parm.ac[i].cw_max = (__le16)
-		    cpu_to_le16(cw_max);
+		priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min);
+		priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max);
 		priv->qos_data.def_qos_parm.ac[i].aifsn = 7;
-		priv->qos_data.def_qos_parm.ac[i].edca_txop = (__le16)
-		    cpu_to_le16(burst_time);
+		priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
 		priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
 
 		i = 2;
-		priv->qos_data.def_qos_parm.ac[i].cw_min = (__le16)
+		priv->qos_data.def_qos_parm.ac[i].cw_min =
 		    cpu_to_le16((cw_min + 1) / 2 - 1);
-		priv->qos_data.def_qos_parm.ac[i].cw_max = (__le16)
+		priv->qos_data.def_qos_parm.ac[i].cw_max =
 		    cpu_to_le16(cw_max);
 		priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
 		if (is_legacy)
-			priv->qos_data.def_qos_parm.ac[i].edca_txop = (__le16)
-			    cpu_to_le16(6016);
+			priv->qos_data.def_qos_parm.ac[i].edca_txop =
+				cpu_to_le16(6016);
 		else
-			priv->qos_data.def_qos_parm.ac[i].edca_txop = (__le16)
-			    cpu_to_le16(3008);
+			priv->qos_data.def_qos_parm.ac[i].edca_txop =
+				cpu_to_le16(3008);
 		priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
 
 		i = 3;
-		priv->qos_data.def_qos_parm.ac[i].cw_min = (__le16)
+		priv->qos_data.def_qos_parm.ac[i].cw_min =
 		    cpu_to_le16((cw_min + 1) / 4 - 1);
-		priv->qos_data.def_qos_parm.ac[i].cw_max = (__le16)
+		priv->qos_data.def_qos_parm.ac[i].cw_max =
 		    cpu_to_le16((cw_max + 1) / 2 - 1);
 		priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
 		priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
 		if (is_legacy)
-			priv->qos_data.def_qos_parm.ac[i].edca_txop = (__le16)
-			    cpu_to_le16(3264);
+			priv->qos_data.def_qos_parm.ac[i].edca_txop =
+				cpu_to_le16(3264);
 		else
-			priv->qos_data.def_qos_parm.ac[i].edca_txop = (__le16)
-			    cpu_to_le16(1504);
+			priv->qos_data.def_qos_parm.ac[i].edca_txop =
+				cpu_to_le16(1504);
 
 	} else {
 		for (i = 1; i < 4; i++) {
-			priv->qos_data.def_qos_parm.ac[i].cw_min = (__le16)
-			    cpu_to_le16(cw_min);
-			priv->qos_data.def_qos_parm.ac[i].cw_max = (__le16)
-			    cpu_to_le16(cw_max);
+			priv->qos_data.def_qos_parm.ac[i].cw_min =
+				cpu_to_le16(cw_min);
+			priv->qos_data.def_qos_parm.ac[i].cw_max =
+				cpu_to_le16(cw_max);
 			priv->qos_data.def_qos_parm.ac[i].aifsn = aifs;
-			priv->qos_data.def_qos_parm.ac[i].edca_txop = (__le16)
-			    cpu_to_le16(burst_time);
+			priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
 			priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
 		}
 	}
diff --git a/drivers/net/wireless/iwl-hw.h b/drivers/net/wireless/iwl-hw.h
index 7512fc7..e73cf88 100644
--- a/drivers/net/wireless/iwl-hw.h
+++ b/drivers/net/wireless/iwl-hw.h
@@ -254,19 +254,15 @@ struct iwl_ac_qos {
 } __attribute__ ((packed));
 
 /* QoS flags defines */
-#define MH_QOS_TXOP_TYPE_MSK 0x10
-#define QOS_PARAM_FLG_UPDATE_EDCA_MSK 0x1
-#define QOS_PARAM_FLG_TGN_MSK 0x2
-#define QOS_PARAM_FLG_TXOP_TYPE_MSK MH_QOS_TXOP_TYPE_MSK
+#define QOS_PARAM_FLG_UPDATE_EDCA_MSK	__constant_cpu_to_le32(0x01)
+#define QOS_PARAM_FLG_TGN_MSK		__constant_cpu_to_le32(0x02)
+#define QOS_PARAM_FLG_TXOP_TYPE_MSK	__constant_cpu_to_le32(0x10)
 
 /*
  *  TXFIFO Queue number defines
  */
 /* number of Access categories (AC) (EDCA), queues 0..3 */
 #define AC_NUM                4
-/* total number of queues */
-#define QUEUE_NUM             7
-/* command queue number */
 
 struct iwl_qosparam_cmd {
 	__le32 qos_flags;
@@ -893,7 +889,7 @@ struct statistics {
 #define CSR_HW_IF_CONFIG_REG_BIT_BOARD_TYPE         (0x00000800)
 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A    (0x00000000)
 #define CSR_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B    (0x00001000)
-#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM	    (0x00200000)
+#define CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM     (0x00200000)
 
 #define CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP             (0x00000001)
 #define CSR_UCODE_SW_BIT_RFKILL                     (0x00000002)
-- 
1.5.2

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

* [PATCH 12/17] iwlwifi: endianity cleanup for power table host command
  2007-07-27  9:26                     ` [PATCH 11/17] iwlwifi: endianity cleanup for QoS host command Zhu Yi
@ 2007-07-27  9:26                       ` Zhu Yi
  2007-07-27  9:26                         ` [PATCH 13/17] iwlwifi: fix 11n on 2.4 channel Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Tomas Winkler

This patch cleans up endianity issues in power table host command.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c     |   58 ++++++++++++++++++++---------------
 drivers/net/wireless/iwl-commands.h |   23 +++++++------
 2 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index d56360c..111e51b 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -2029,26 +2029,33 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
 #define NOSLP 0, 0, 0
 #define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0
 #endif
+#define SLP_TIMEOUT(T)  __constant_cpu_to_le32((T) * MSEC_TO_USEC)
+#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
+				     __constant_cpu_to_le32(X1), \
+				     __constant_cpu_to_le32(X2), \
+				     __constant_cpu_to_le32(X3), \
+				     __constant_cpu_to_le32(X4)}
+
 
 /* default power management (not Tx power) table values */
 /* for tim  0-10 */
 static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = {
-	{{NOSLP, 0 * MSEC_TO_USEC, 0 * MSEC_TO_USEC, {0, 0, 0, 0, 0}}, 0},
-	{{SLP, 200 * MSEC_TO_USEC, 500 * MSEC_TO_USEC, {1, 2, 3, 4, 4}}, 0},
-	{{SLP, 200 * MSEC_TO_USEC, 300 * MSEC_TO_USEC, {2, 4, 6, 7, 7}}, 0},
-	{{SLP, 50 * MSEC_TO_USEC, 100 * MSEC_TO_USEC, {2, 6, 9, 9, 10}}, 0},
-	{{SLP, 50 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {2, 7, 9, 9, 10}}, 1},
-	{{SLP, 25 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {4, 7, 10, 10, 10}}, 1}
+	{{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
+	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
+	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
+	{{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), SLP_VEC(2, 6, 9, 9, 10)}, 0},
+	{{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 10)}, 1},
+	{{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 10)}, 1}
 };
 
 /* for tim > 10 */
 static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = {
-	{{NOSLP, 0 * MSEC_TO_USEC, 0 * MSEC_TO_USEC, {0, 0, 0, 0, 0}}, 0},
-	{{SLP, 200 * MSEC_TO_USEC, 500 * MSEC_TO_USEC, {1, 2, 3, 4, 0xFF}}, 0},
-	{{SLP, 200 * MSEC_TO_USEC, 300 * MSEC_TO_USEC, {2, 4, 6, 7, 0xFF}}, 0},
-	{{SLP, 50 * MSEC_TO_USEC, 100 * MSEC_TO_USEC, {2, 6, 9, 9, 0xFF}}, 0},
-	{{SLP, 50 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {2, 7, 9, 9, 0xFF}}, 0},
-	{{SLP, 25 * MSEC_TO_USEC, 25 * MSEC_TO_USEC, {4, 7, 10, 10, 0xFF}}, 0}
+	{{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
+	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
+	{{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0},
+	{{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), SLP_VEC(2, 6, 9, 9, 0xFF)}, 0},
+	{{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 0xFF)}, 0},
+	{{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
 };
 
 int iwl_power_init_handle(struct iwl_priv *priv)
@@ -2119,7 +2126,7 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
 
 		period = priv->assoc_network->tim.tim_period;
 	}
-#endif				/*IWL_MAC80211_DISABLE */
+#endif	/*IWL_MAC80211_DISABLE */
 	skip = range[mode].no_dtim;
 
 	if (period == 0) {
@@ -2131,24 +2138,25 @@ static int iwl_update_power_cmd(struct iwl_priv *priv,
 		max_sleep = period;
 		cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
 	} else {
-		max_sleep = (cmd->sleep_interval[IWL_POWER_TABLE_SIZE - 1] /
-			     period) * period;
+		__le32 slp_itrvl = cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1];
+		max_sleep = (le32_to_cpu(slp_itrvl) / period) * period;
 		cmd->flags |= IWL_POWER_SLEEP_OVER_DTIM_MSK;
 	}
 
-	for (i = 0; i < IWL_POWER_TABLE_SIZE; i++) {
-		if (cmd->sleep_interval[i] > max_sleep)
-			cmd->sleep_interval[i] = max_sleep;
+	for (i = 0; i < IWL_POWER_VEC_SIZE; i++) {
+		if (le32_to_cpu(cmd->sleep_interval[i]) > max_sleep)
+			cmd->sleep_interval[i] = cpu_to_le32(max_sleep);
 	}
 
 	IWL_DEBUG_POWER("Flags value = 0x%08X\n", cmd->flags);
-	IWL_DEBUG_POWER("Tx timeout = %u\n", cmd->tx_data_timeout);
-	IWL_DEBUG_POWER("Rx timeout = %u\n", cmd->rx_data_timeout);
-	IWL_DEBUG_POWER
-	    ("Sleep interval vector = { %d , %d , %d , %d , %d }\n",
-	     cmd->sleep_interval[0], cmd->sleep_interval[1],
-	     cmd->sleep_interval[2], cmd->sleep_interval[3],
-	     cmd->sleep_interval[4]);
+	IWL_DEBUG_POWER("Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout));
+	IWL_DEBUG_POWER("Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout));
+	IWL_DEBUG_POWER("Sleep interval vector = { %d , %d , %d , %d , %d }\n",
+			le32_to_cpu(cmd->sleep_interval[0]),
+			le32_to_cpu(cmd->sleep_interval[1]),
+			le32_to_cpu(cmd->sleep_interval[2]),
+			le32_to_cpu(cmd->sleep_interval[3]),
+			le32_to_cpu(cmd->sleep_interval[4]));
 
 	return rc;
 }
diff --git a/drivers/net/wireless/iwl-commands.h b/drivers/net/wireless/iwl-commands.h
index bd4011d..297d24a 100644
--- a/drivers/net/wireless/iwl-commands.h
+++ b/drivers/net/wireless/iwl-commands.h
@@ -648,29 +648,30 @@ struct iwl_add_sta_resp {
  * ucode assume sleep over DTIM is allowed and we don't need to wakeup
  * for every DTIM.
  */
-#define IWL_POWER_TABLE_SIZE 5
+#define IWL_POWER_VEC_SIZE 5
 
-enum {
-	IWL_POWER_DRIVER_ALLOW_SLEEP_MSK = (1<<0),
-	IWL_POWER_SLEEP_OVER_DTIM_MSK = (1<<2),
-	IWL_POWER_PCI_PM_MSK = (1<<3),
-};
+#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK	__constant_cpu_to_le32(1<<0)
+#define IWL_POWER_SLEEP_OVER_DTIM_MSK		__constant_cpu_to_le32(1<<2)
+#define IWL_POWER_PCI_PM_MSK			__constant_cpu_to_le32(1<<3)
 
-struct iwl_powertable_cmd {
 #if IWL == 3945
+struct iwl_powertable_cmd {
 	__le32 flags;
+	__le32 rx_data_timeout;
+	__le32 tx_data_timeout;
+	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
+} __attribute__((packed));
 #elif IWL == 4965
+struct iwl_powertable_cmd {
 	__le16 flags;
 	u8 keep_alive_seconds;
 	u8 debug_flags;
-#endif
 	__le32 rx_data_timeout;
 	__le32 tx_data_timeout;
-	__le32 sleep_interval[IWL_POWER_TABLE_SIZE];
-#if IWL == 4965
+	__le32 sleep_interval[IWL_POWER_VEC_SIZE];
 	__le32 keep_alive_beacons;
-#endif
 } __attribute__ ((packed));
+#endif
 
 
 struct iwl_rate_scaling_info {
-- 
1.5.2

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

* [PATCH 13/17] iwlwifi: fix 11n on 2.4 channel
  2007-07-27  9:26                       ` [PATCH 12/17] iwlwifi: endianity cleanup for power table " Zhu Yi
@ 2007-07-27  9:26                         ` Zhu Yi
  2007-07-27  9:26                           ` [PATCH 14/17] iwlwifi: fix channel switch assert Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Mohamed Abbas

When tuned to 2.4 network we should not use FAT channel. This patch
sets supported_chan_width_set to 0 in association request if we are
going to join B/G band networks.

Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-4965.c |    8 ++++++--
 drivers/net/wireless/iwl-base.c |   38 ++++++++++++++++++++++++++++++--------
 2 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index a333204..fcee3f5 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -4478,6 +4478,7 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv,
 		rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK;
 		break;
 	default:
+		rxon->flags &= ~RXON_FLG_CHANNEL_MODE_MIXED_MSK;
 		break;
 	}
 
@@ -4490,9 +4491,12 @@ void iwl4965_set_rxon_ht(struct iwl_priv *priv,
 	iwl4965_set_rxon_chain(priv);
 
 	IWL_DEBUG_ASSOC("supported HT rate 0x%X %X "
-			"falgs 0x%X operation 0x%X\n",
+			"rxon flags 0x%X operation mode :0x%X "
+			"extension channel offset 0x%x "
+			"control chan %d\n",
 			priv->active_rate_ht[0], priv->active_rate_ht[1],
-			rxon->flags, ht_info->operating_mode);
+			rxon->flags, ht_info->operating_mode,
+			ht_info->extension_chan_offset, ht_info->control_chan);
 	return;
 }
 void iwl4965_set_ht_add_station(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 111e51b..a17fbd9 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -1780,8 +1780,9 @@ static u16 iwl_supported_rate_to_ie(u8 * ie, u16 supported_rate,
 
 #if IWL == 4965
 #ifdef CONFIG_IWLWIFI_HT
-void static iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
-				 struct ieee80211_ht_capability *ht_cap);
+void static iwl_set_ht_capab(struct ieee80211_hw *hw,
+			     struct ieee80211_ht_capability *ht_cap,
+			     u8 use_wide_chan);
 #endif
 #endif
 
@@ -1868,10 +1869,15 @@ static int iwl_fill_probe_req(struct iwl_priv *priv,
 #if IWL == 4965
 #ifdef CONFIG_IWLWIFI_HT
 	if (is_direct && priv->is_ht_enabled) {
+		u8 use_wide_chan = 1;
+
+		if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ)
+			use_wide_chan = 0;
 		pos += (*pos) + 1;
 		*pos++ = WLAN_EID_HT_CAPABILITY;
 		*pos++ = sizeof(struct ieee80211_ht_capability);
-		iwl_mac_get_ht_capab(NULL, (struct ieee80211_ht_capability *)pos);
+		iwl_set_ht_capab(NULL, (struct ieee80211_ht_capability *)pos,
+				 use_wide_chan);
 		len += 2 + sizeof(struct ieee80211_ht_capability);
 	}
 #endif  /*CONFIG_IWLWIFI_HT */
@@ -8120,13 +8126,13 @@ static int iwl_mac_conf_ht(struct ieee80211_hw *hw,
 
 }
 
-static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
-				 struct ieee80211_ht_capability *ht_cap)
+static void iwl_set_ht_capab(struct ieee80211_hw *hw,
+			     struct ieee80211_ht_capability *ht_cap,
+			     u8 use_wide_chan)
 {
 	union ht_cap_info cap;
 	union ht_param_info param_info;
 
-	IWL_DEBUG_MAC80211("enter: \n");
 	memset(&cap, 0, sizeof(union ht_cap_info));
 	memset(&param_info, 0, sizeof(union ht_param_info));
 
@@ -8134,7 +8140,7 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
 	cap.green_field = 1;
 	cap.short_GI20 = 1;
 	cap.short_GI40 = 1;
-	cap.supported_chan_width_set = 1;
+	cap.supported_chan_width_set = use_wide_chan;
 	cap.mimo_power_save_mode = 0x3;
 
 	param_info.max_rx_ampdu_factor = CFG_HT_RX_AMPDU_FACTOR_DEF;
@@ -8146,10 +8152,26 @@ static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
 	ht_cap->supported_mcs_set[1] = 0xff;
 	ht_cap->supported_mcs_set[4] =
 	    (cap.supported_chan_width_set) ? 0x1: 0x0;
+}
+
+static void iwl_mac_get_ht_capab(struct ieee80211_hw *hw,
+				 struct ieee80211_ht_capability *ht_cap)
+{
+	u8 use_wide_channel = 1;
+	struct iwl_priv *priv = hw->priv;
 
+	IWL_DEBUG_MAC80211("enter: \n");
+	if (priv->channel_width != IWL_CHANNEL_WIDTH_40MHZ)
+		use_wide_channel = 0;
+
+	/* no fat tx allowed on 2.4GHZ */
+	if ((priv->phymode != MODE_IEEE80211A) &&
+	    (priv->phymode != MODE_ATHEROS_TURBO))
+		use_wide_channel = 0;
+
+	iwl_set_ht_capab(hw, ht_cap, use_wide_channel);
 	IWL_DEBUG_MAC80211("leave: \n");
 }
-
 #endif /*CONFIG_IWLWIFI_HT*/
 #endif /*IWL == 4965*/
 /*****************************************************************************
-- 
1.5.2

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

* [PATCH 14/17] iwlwifi: fix channel switch assert
  2007-07-27  9:26                         ` [PATCH 13/17] iwlwifi: fix 11n on 2.4 channel Zhu Yi
@ 2007-07-27  9:26                           ` Zhu Yi
  2007-07-27  9:26                             ` [PATCH 15/17] iwlwifi: fix scaing watchdog time out Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Mohamed Abbas

Fix the system freeze when do channel switch to radar channel.
If we are switching to a radar channel then we need to set
expect_beacon. Otherwise we get assert from ucode. we still
see assert if we do more than one channel switch currently,
fix will be coming next.

Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-4965.c |    7 +++++++
 drivers/net/wireless/iwl-base.c |    8 ++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwl-4965.c b/drivers/net/wireless/iwl-4965.c
index fcee3f5..da3e9a7 100644
--- a/drivers/net/wireless/iwl-4965.c
+++ b/drivers/net/wireless/iwl-4965.c
@@ -2607,11 +2607,14 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u8 channel)
 	u8 is_fat = 0;
 	u8 ctrl_chan_high = 0;
 	struct iwl_channel_switch_cmd cmd = { 0 };
+	const struct iwl_channel_info *ch_info;
 
 	band = ((priv->phymode == MODE_IEEE80211B) ||
 		(priv->phymode == MODE_IEEE80211G) ||
 		(priv->phymode == MODE_ATHEROS_TURBOG)) ? 1 : 0;
 
+	ch_info = iwl_get_channel_info(priv, priv->phymode, channel);
+
 	is_fat = is_fat_channel(priv->staging_rxon.flags);
 
 	if (is_fat &&
@@ -2624,6 +2627,10 @@ int iwl_hw_channel_switch(struct iwl_priv *priv, u8 channel)
 	cmd.rxon_flags = priv->active_rxon.flags;
 	cmd.rxon_filter_flags = priv->active_rxon.filter_flags;
 	cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
+	if (ch_info)
+		cmd.expect_beacon = is_channel_radar(ch_info);
+	else
+		cmd.expect_beacon = 1;
 
 	rc = iwl4965_fill_txpower_tbl(priv, band, channel, is_fat,
 				      ctrl_chan_high, &cmd.tx_power);
diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index a17fbd9..c28a56a 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -7484,8 +7484,12 @@ static int iwl_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
 	/* if we are switching fron ht to 2.4 clear flags
 	 * from any ht related info since 2.4 does not
 	 * support ht */
-	if (is_channel_bg_band(ch_info) &&
-	    (priv->staging_rxon.channel != conf->channel))
+	if ((priv->staging_rxon.channel != conf->channel)
+#ifdef IEEE80211_CONF_CHANNEL_SWITCH
+	    && !(conf->flags & IEEE80211_CONF_CHANNEL_SWITCH))
+#else
+	    )
+#endif
 		priv->staging_rxon.flags = 0;
 #endif /* CONFIG_IWLWIFI_HT */
 #endif /* IWL == 4965 */
-- 
1.5.2

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

* [PATCH 15/17] iwlwifi: fix scaing watchdog time out
  2007-07-27  9:26                           ` [PATCH 14/17] iwlwifi: fix channel switch assert Zhu Yi
@ 2007-07-27  9:26                             ` Zhu Yi
  2007-07-27  9:26                               ` [PATCH 16/17] iwlwifi: Add uCode/driver compatibility version number Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Mohamed Abbas

Fix the scan watchdog time out when we associated to non-exist
network. Basically if we issue:

    $ iwconfig wlan0 ap xx:xx:xx:xx:xx:xx

and the mac address is a non-exist AP then we scan. We get scan
watchdog timeout and restart.

Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index c28a56a..8558ea8 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -7018,26 +7018,26 @@ static void iwl_bg_request_scan(struct work_struct *data)
 
 		scan->suspend_time = 0;
 		scan->max_out_time = 600 * 1024;
-		if (interval) {
+		if (!interval)
+			interval = suspend_time;
 #if IWL == 3945
-			/*
-			 * suspend time format:
-			 *  0-19: beacon interval in usec (time before exec.)
-			 * 20-23: 0
-			 * 24-31: number of beacons (suspend between channels)
-			 */
+		/*
+		 * suspend time format:
+		 *  0-19: beacon interval in usec (time before exec.)
+		 * 20-23: 0
+		 * 24-31: number of beacons (suspend between channels)
+		 */
 
-			extra = (suspend_time / interval) << 24;
-			scan->suspend_time = 0xFF0FFFFF &
-			    (extra | ((suspend_time % interval) * 1024));
+		extra = (suspend_time / interval) << 24;
+		scan->suspend_time = 0xFF0FFFFF &
+		    (extra | ((suspend_time % interval) * 1024));
 #else
-			extra = (suspend_time / interval) << 22;
-			scan->suspend_time = (extra |
-			    ((suspend_time % interval) * 1024));
-			IWL_DEBUG_SCAN("suspend_time 0x%X beacon interval %d\n",
-				       scan->suspend_time, interval);
+		extra = (suspend_time / interval) << 22;
+		scan->suspend_time = (extra |
+		    ((suspend_time % interval) * 1024));
+		IWL_DEBUG_SCAN("suspend_time 0x%X beacon interval %d\n",
+			       scan->suspend_time, interval);
 #endif
-		}
 	}
 
 	/* We should add the ability for user to lock to PASSIVE ONLY */
-- 
1.5.2

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

* [PATCH 16/17] iwlwifi: Add uCode/driver compatibility version number
  2007-07-27  9:26                             ` [PATCH 15/17] iwlwifi: fix scaing watchdog time out Zhu Yi
@ 2007-07-27  9:26                               ` Zhu Yi
  2007-07-27  9:26                                 ` [PATCH 17/17] iwlwifi: update version stamp to 0.1.5 Zhu Yi
  0 siblings, 1 reply; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi, Ben Cahill

Add uCode/driver compatibility version number in firmware
filename, to enable compatibility enforcement and coexistence
of old/new drivers.

Signed-off-by: Ben Cahill <ben.m.cahill@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwl-base.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index 8558ea8..e3cd459 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -110,6 +110,13 @@ BUILD_BUG()
 #define DRV_COPYRIGHT	"Copyright(c) 2003-2007 Intel Corporation"
 #define DRV_VERSION     IWLWIFI_VERSION
 
+/* Change firmware file name, using "-" and incrementing number,
+ *   *only* when uCode interface or architecture changes so that it
+ *   is not compatible with earlier drivers.
+ * This number will also appear in << 8 position of 1st dword of uCode file */
+#define IWL3945_UCODE_API "-1"
+#define IWL4965_UCODE_API "-1"
+
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
 MODULE_VERSION(DRV_VERSION);
 MODULE_AUTHOR(DRV_COPYRIGHT);
@@ -6191,21 +6198,17 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 	int rc = 0;
 	const struct firmware *ucode_raw;
 #if IWL == 3945
-	const char *name = "iwlwifi-3945.ucode";	/* firmware file name */
+	/* firmware file name contains uCode/driver compatibility version */
+	const char *name = "iwlwifi-3945" IWL3945_UCODE_API ".ucode";
 #elif IWL == 4965
-	const char *name = "iwlwifi-4965.ucode";	/* firmware file name */
+	const char *name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode";
 #endif
 	u8 *src;
 	size_t len;
 	u32 ver, inst_size, data_size, init_size, init_data_size, boot_size;
 
 	/* Ask kernel firmware_class module to get the boot firmware off disk.
-	 * request_firmware() is synchronous call, file is in memory on return.
-	 * TODO:  Would it be more polite to use asynchronous
-	 *        request_firmware_nowait()??  If so, put request back into
-	 *        iwl_pci_probe(), and rest of this function would serve as
-	 *        the callback for request_firmware_nowait().  Also need to
-	 *        make sure everything waits for this callback to complete! */
+	 * request_firmware() is synchronous, file is in memory on return. */
 	rc = request_firmware(&ucode_raw, name, &priv->pci_dev->dev);
 	if (rc < 0) {
 		IWL_ERROR("%s firmware file req failed: Reason %d\n", name, rc);
-- 
1.5.2

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

* [PATCH 17/17] iwlwifi: update version stamp to 0.1.5
  2007-07-27  9:26                               ` [PATCH 16/17] iwlwifi: Add uCode/driver compatibility version number Zhu Yi
@ 2007-07-27  9:26                                 ` Zhu Yi
  0 siblings, 0 replies; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:26 UTC (permalink / raw)
  To: linville, ipwpatch; +Cc: linux-wireless, Zhu Yi

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

diff --git a/drivers/net/wireless/iwl-base.c b/drivers/net/wireless/iwl-base.c
index e3cd459..87ad5d8 100644
--- a/drivers/net/wireless/iwl-base.c
+++ b/drivers/net/wireless/iwl-base.c
@@ -106,7 +106,7 @@ BUILD_BUG()
 #define VS
 #endif
 
-#define IWLWIFI_VERSION "0.1.3k" VD VS
+#define IWLWIFI_VERSION "0.1.5k" VD VS
 #define DRV_COPYRIGHT	"Copyright(c) 2003-2007 Intel Corporation"
 #define DRV_VERSION     IWLWIFI_VERSION
 
-- 
1.5.2

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

* Re: [PATCH 00/17] iwlwifi driver updated to version 0.1.5
       [not found] <11855284012123-git-send-email-yi.zhu@intel.com>
  2007-07-27  9:26 ` [PATCH 01/17] iwlwifi: provide frequency to radiotap monitor not channel index Zhu Yi
@ 2007-07-27  9:30 ` Zhu Yi
  1 sibling, 0 replies; 21+ messages in thread
From: Zhu Yi @ 2007-07-27  9:30 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless

On Fri, 2007-07-27 at 17:26 +0800, Zhu Yi wrote:
> 
> Here are a series of patches to update iwlwifi driver to 0.1.5. 

Forgot to mention, since 0.1.5 we add the multiple firmware images
support (ucode image filename is renamed). So please use the new uCodes
we just released:

iwlwifi-4965-ucode-4.44.1.18
iwlwifi-3945-ucode-2.14.1.5

http://intellinuxwireless.org/index.php?n=Downloads

Thanks,
-yi

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

* Re: [PATCH 09/17] iwlwifi: EEPROM reading fix
  2007-07-27  9:26                 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Zhu Yi
  2007-07-27  9:26                   ` [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd Zhu Yi
@ 2007-07-27 11:22                   ` Michael Buesch
  2007-07-27 22:24                     ` Tomas Winkler
  1 sibling, 1 reply; 21+ messages in thread
From: Michael Buesch @ 2007-07-27 11:22 UTC (permalink / raw)
  To: Zhu Yi; +Cc: linville, ipwpatch, linux-wireless, Gregory Greenman,
	Tomas Winkler

On Friday 27 July 2007 11:26:33 Zhu Yi wrote:
>  		if (!(r & 1)) {
>  			IWL_ERROR("Time out reading EEPROM[%d]", addr);
> -			return -ETIMEDOUT;
> +			rc = -ETIMEDOUT;
> +			goto done;
>  		}
>  
>  		e[addr / 2] = le16_to_cpu(r >> 16);

Seems like you really want cpu_to_le16() here, as "r" should better
be CPU-endian when shifting it by >>.

Though, I don't see enough code context here to judge if the
endianess conversion is correct at all or not.

-- 
Greetings Michael.

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

* Re: [PATCH 09/17] iwlwifi: EEPROM reading fix
  2007-07-27 11:22                   ` [PATCH 09/17] iwlwifi: EEPROM reading fix Michael Buesch
@ 2007-07-27 22:24                     ` Tomas Winkler
  2007-07-27 22:32                       ` Michael Buesch
  0 siblings, 1 reply; 21+ messages in thread
From: Tomas Winkler @ 2007-07-27 22:24 UTC (permalink / raw)
  To: Michael Buesch
  Cc: Zhu Yi, linville, ipwpatch, linux-wireless, Gregory Greenman

On 7/27/07, Michael Buesch <mb@bu3sch.de> wrote:
> On Friday 27 July 2007 11:26:33 Zhu Yi wrote:
> >               if (!(r & 1)) {
> >                       IWL_ERROR("Time out reading EEPROM[%d]", addr);
> > -                     return -ETIMEDOUT;
> > +                     rc = -ETIMEDOUT;
> > +                     goto done;
> >               }
> >
> >               e[addr / 2] = le16_to_cpu(r >> 16);
>
> Seems like you really want cpu_to_le16() here, as "r" should better
> be CPU-endian when shifting it by >>.
>
> Though, I don't see enough code context here to judge if the
> endianess conversion is correct at all or not.
>
This line is empirically correct. The value r is indeed cpu ordered 32
bit value  I agree that it is a bit awkward but  the reason is in how
the register value is composed in the HW.

Thanks for the comment.
Tomas

> --
> Greetings Michael.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: [PATCH 09/17] iwlwifi: EEPROM reading fix
  2007-07-27 22:24                     ` Tomas Winkler
@ 2007-07-27 22:32                       ` Michael Buesch
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Buesch @ 2007-07-27 22:32 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Zhu Yi, linville, ipwpatch, linux-wireless, Gregory Greenman

On Saturday 28 July 2007 00:24:42 Tomas Winkler wrote:
> On 7/27/07, Michael Buesch <mb@bu3sch.de> wrote:
> > On Friday 27 July 2007 11:26:33 Zhu Yi wrote:
> > >               if (!(r & 1)) {
> > >                       IWL_ERROR("Time out reading EEPROM[%d]", addr);
> > > -                     return -ETIMEDOUT;
> > > +                     rc = -ETIMEDOUT;
> > > +                     goto done;
> > >               }
> > >
> > >               e[addr / 2] = le16_to_cpu(r >> 16);
> >
> > Seems like you really want cpu_to_le16() here, as "r" should better
> > be CPU-endian when shifting it by >>.
> >
> > Though, I don't see enough code context here to judge if the
> > endianess conversion is correct at all or not.
> >
> This line is empirically correct.

No, you need cpu_to_le16 here, instead of le16_to_cpu.
I know that these generate the same code, but it makes
a difference for sparse.

-- 
Greetings Michael.

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

end of thread, other threads:[~2007-07-27 22:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <11855284012123-git-send-email-yi.zhu@intel.com>
2007-07-27  9:26 ` [PATCH 01/17] iwlwifi: provide frequency to radiotap monitor not channel index Zhu Yi
2007-07-27  9:26   ` [PATCH 02/17] iwlwifi: Calculate and report noise level while associated Zhu Yi
2007-07-27  9:26     ` [PATCH 03/17] iwlwifi: modify station fix Zhu Yi
2007-07-27  9:26       ` [PATCH 04/17] iwlwifi: cleanup tx queue allocation Zhu Yi
2007-07-27  9:26         ` [PATCH 05/17] iwlwifi: rxon filter_flags endianity fix Zhu Yi
2007-07-27  9:26           ` [PATCH 06/17] iwlwifi: rename base.c to iwl-base.c Zhu Yi
2007-07-27  9:26             ` [PATCH 07/17] iwilwifi: removed unused constant Zhu Yi
2007-07-27  9:26               ` [PATCH 08/17] iwlwifi: QoS control endianity fixes Zhu Yi
2007-07-27  9:26                 ` [PATCH 09/17] iwlwifi: EEPROM reading fix Zhu Yi
2007-07-27  9:26                   ` [PATCH 10/17] iwlwifi: endianity cleaning of iwl_print_rx_config_cmd Zhu Yi
2007-07-27  9:26                     ` [PATCH 11/17] iwlwifi: endianity cleanup for QoS host command Zhu Yi
2007-07-27  9:26                       ` [PATCH 12/17] iwlwifi: endianity cleanup for power table " Zhu Yi
2007-07-27  9:26                         ` [PATCH 13/17] iwlwifi: fix 11n on 2.4 channel Zhu Yi
2007-07-27  9:26                           ` [PATCH 14/17] iwlwifi: fix channel switch assert Zhu Yi
2007-07-27  9:26                             ` [PATCH 15/17] iwlwifi: fix scaing watchdog time out Zhu Yi
2007-07-27  9:26                               ` [PATCH 16/17] iwlwifi: Add uCode/driver compatibility version number Zhu Yi
2007-07-27  9:26                                 ` [PATCH 17/17] iwlwifi: update version stamp to 0.1.5 Zhu Yi
2007-07-27 11:22                   ` [PATCH 09/17] iwlwifi: EEPROM reading fix Michael Buesch
2007-07-27 22:24                     ` Tomas Winkler
2007-07-27 22:32                       ` Michael Buesch
2007-07-27  9:30 ` [PATCH 00/17] iwlwifi driver updated to version 0.1.5 Zhu Yi

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).