2009-03-18 04:46:58

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 0/13] iwlwifi driver updates 03/17/2009

This series contains various fixes, cleanup and extra debugging for
a problems not yet identified.

[PATCH 01/13] iwlagn: use changed in mac_config
[PATCH 02/13] iwl3945: use changed in iwl3945_mac_config
[PATCH 03/13] iwlwifi: return 0 for AMPDU_TX/RX_STOP request if NIC is going down
[PATCH 04/13] iwlagn: allow power level setting all the times
[PATCH 05/13] iwlcore: dont commit power command if interface is not up
[PATCH 06/13] iwlcore: Fix scan problem, resource busy
[PATCH 07/13] iwlwifi: support 11h
[PATCH 08/13] iwl3945: set TFD_QUEUE_MAX to correct value
[PATCH 09/13] iwl3945: use iwl_cmd_queue_free
[PATCH 10/13] iwl3945: fix checkpatch.pl errors
[PATCH 11/13] iwl3945: control rate decrease
[PATCH 12/13] iwlwifi: report error when detect failure during stop agg queue
[PATCH 13/13] iwl3945: replace stations with stations_39


Thank you

Reinette


2009-03-18 04:46:58

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 01/13] iwlagn: use changed in mac_config

From: Mohames Abbas <[email protected]>

In function iwl_mac_config use changed flag to call only
the affected functions. This patch also allow user to cache
channel, txpower and power value when the interface is not
ready and apply the changes once the interface ready.

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 161 ++++++++++++++++---------------
drivers/net/wireless/iwlwifi/iwl-core.c | 4 +
2 files changed, 85 insertions(+), 80 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0db3bc0..4d2ed52 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1567,9 +1567,8 @@ static void iwl_alive_start(struct iwl_priv *priv)
if (iwl_is_associated(priv)) {
struct iwl_rxon_cmd *active_rxon =
(struct iwl_rxon_cmd *)&priv->active_rxon;
-
- memcpy(&priv->staging_rxon, &priv->active_rxon,
- sizeof(priv->staging_rxon));
+ /* apply any changes in staging */
+ priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
} else {
/* Initialize our rx_config data */
@@ -2184,110 +2183,112 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
struct iwl_priv *priv = hw->priv;
const struct iwl_channel_info *ch_info;
struct ieee80211_conf *conf = &hw->conf;
- unsigned long flags;
+ unsigned long flags = 0;
int ret = 0;
- u16 channel;
+ u16 ch;
+ int scan_active = 0;

mutex_lock(&priv->mutex);
- IWL_DEBUG_MAC80211(priv, "enter to channel %d\n", conf->channel->hw_value);
-
- priv->current_ht_config.is_ht = conf_is_ht(conf);
+ IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n",
+ conf->channel->hw_value, changed);

- if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - waiting for uCode\n");
- goto out;
+ if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
+ test_bit(STATUS_SCANNING, &priv->status))) {
+ scan_active = 1;
+ IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
}

- if (!conf->radio_enabled)
- iwl_radio_kill_sw_disable_radio(priv);

- if (!iwl_is_ready(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
- ret = -EIO;
- goto out;
- }
+ /* during scanning mac80211 will delay channel setting until
+ * scan finish with changed = 0
+ */
+ if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
+ if (scan_active)
+ goto set_ch_out;
+
+ ch = ieee80211_frequency_to_channel(conf->channel->center_freq);
+ ch_info = iwl_get_channel_info(priv, conf->channel->band, ch);
+ if (!is_channel_valid(ch_info)) {
+ IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
+ ret = -EINVAL;
+ goto set_ch_out;
+ }

- if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
- test_bit(STATUS_SCANNING, &priv->status))) {
- IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
- mutex_unlock(&priv->mutex);
- return 0;
- }
+ if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
+ !is_channel_ibss(ch_info)) {
+ IWL_ERR(priv, "channel %d in band %d not "
+ "IBSS channel\n",
+ conf->channel->hw_value, conf->channel->band);
+ ret = -EINVAL;
+ goto set_ch_out;
+ }

- channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
- ch_info = iwl_get_channel_info(priv, conf->channel->band, channel);
- if (!is_channel_valid(ch_info)) {
- IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
- ret = -EINVAL;
- goto out;
- }
+ priv->current_ht_config.is_ht = conf_is_ht(conf);

- if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
- !is_channel_ibss(ch_info)) {
- IWL_ERR(priv, "channel %d in band %d not IBSS channel\n",
- conf->channel->hw_value, conf->channel->band);
- ret = -EINVAL;
- goto out;
- }
+ spin_lock_irqsave(&priv->lock, flags);

- spin_lock_irqsave(&priv->lock, flags);

+ /* if we are switching from ht to 2.4 clear flags
+ * from any ht related info since 2.4 does not
+ * support ht */
+ if ((le16_to_cpu(priv->staging_rxon.channel) != ch))
+ priv->staging_rxon.flags = 0;

- /* if we are switching from ht to 2.4 clear flags
- * from any ht related info since 2.4 does not
- * support ht */
- if ((le16_to_cpu(priv->staging_rxon.channel) != channel)
-#ifdef IEEE80211_CONF_CHANNEL_SWITCH
- && !(conf->flags & IEEE80211_CONF_CHANNEL_SWITCH)
-#endif
- )
- priv->staging_rxon.flags = 0;
+ iwl_set_rxon_channel(priv, conf->channel);
+
+ iwl_set_flags_for_band(priv, conf->channel->band);
+ spin_unlock_irqrestore(&priv->lock, flags);
+ set_ch_out:
+ /* The list of supported rates and rate mask can be different
+ * for each band; since the band may have changed, reset
+ * the rate mask to what mac80211 lists */
+ iwl_set_rate(priv);
+ }

- iwl_set_rxon_channel(priv, conf->channel);
+ if (changed & IEEE80211_CONF_CHANGE_PS) {
+ if (conf->flags & IEEE80211_CONF_PS)
+ ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3);
+ else
+ ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
+ if (ret)
+ IWL_DEBUG_MAC80211(priv, "Error setting power level\n");

- iwl_set_flags_for_band(priv, conf->channel->band);
+ }

- /* The list of supported rates and rate mask can be different
- * for each band; since the band may have changed, reset
- * the rate mask to what mac80211 lists */
- iwl_set_rate(priv);
+ if (changed & IEEE80211_CONF_CHANGE_POWER) {
+ IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
+ priv->tx_power_user_lmt, conf->power_level);

- spin_unlock_irqrestore(&priv->lock, flags);
+ iwl_set_tx_power(priv, conf->power_level, false);
+ }

-#ifdef IEEE80211_CONF_CHANNEL_SWITCH
- if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
- iwl_hw_channel_switch(priv, conf->channel);
- goto out;
+ /* call to ensure that 4965 rx_chain is set properly in monitor mode */
+ iwl_set_rxon_chain(priv);
+
+ if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
+ if (conf->radio_enabled &&
+ iwl_radio_kill_sw_enable_radio(priv)) {
+ IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
+ "waiting for uCode\n");
+ goto out;
+ }
+
+ if (!conf->radio_enabled)
+ iwl_radio_kill_sw_disable_radio(priv);
}
-#endif

if (!conf->radio_enabled) {
IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
goto out;
}

- if (iwl_is_rfkill(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - RF kill\n");
- ret = -EIO;
+ if (!iwl_is_ready(priv)) {
+ IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
goto out;
}

- if (conf->flags & IEEE80211_CONF_PS)
- ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3);
- else
- ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
- if (ret)
- IWL_DEBUG_MAC80211(priv, "Error setting power level\n");
-
- IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
- priv->tx_power_user_lmt, conf->power_level);
-
- iwl_set_tx_power(priv, conf->power_level, false);
-
- iwl_set_rate(priv);
-
- /* call to ensure that 4965 rx_chain is set properly in monitor mode */
- iwl_set_rxon_chain(priv);
+ if (scan_active)
+ goto out;

if (memcmp(&priv->active_rxon,
&priv->staging_rxon, sizeof(priv->staging_rxon)))
@@ -2295,9 +2296,9 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
else
IWL_DEBUG_INFO(priv, "No re-sending same RXON configuration.\n");

- IWL_DEBUG_MAC80211(priv, "leave\n");

out:
+ IWL_DEBUG_MAC80211(priv, "leave\n");
mutex_unlock(&priv->mutex);
return ret;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 085e9cf..bcdecb1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1437,6 +1437,10 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)

priv->tx_power_user_lmt = tx_power;

+ /* if nic is not up don't send command */
+ if (!iwl_is_ready_rf(priv))
+ return ret;
+
if (force && priv->cfg->ops->lib->send_tx_power)
ret = priv->cfg->ops->lib->send_tx_power(priv);

--
1.5.6.3


2009-03-19 19:00:41

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 06/13] iwlcore: Fix scan problem, resource busy

On Thu, Mar 19, 2009 at 05:12:00PM +0100, Helmut Schaa wrote:
> Hi,
>=20
> Am Mittwoch, 18. M=E4rz 2009 schrieb Reinette Chatre:
> > From: Mohamed Abbas <[email protected]>
> >=20
> > when mac80211 issues scan request to lower driver, it always expect
> > a scan_complete notification from the driver, this driver make sure
> > we call scan_completed on all exit path in iwl_mac_hw_scan.
>=20
> It should suffice to return an error in iwl_mac_hw_scan (as done with=
out
> this patch). The problem was mac80211 not calling cfg80211 in case of=
a
> failure. [1] should fix that. Hence, this workaround in iwlwifi shoul=
d
> not be needed.
>=20
> Helmut
>=20
> [1] http://git.kernel.org/?p=3Dlinux/kernel/git/linville/wireless-tes=
ting.git;a=3Dcommit;h=3Da3fa954ddc4509721a691dd685c3d102cba0b58e

I think Helmut is right. I'm dropping patch 6/13.

John
--=20
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2009-03-18 04:46:56

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 08/13] iwl3945: set TFD_QUEUE_MAX to correct value

From: Abhijeet Kolekar <[email protected]>

Total number of queues is 8 but only 7 of them are TX queues.
4 AC(Data) queue ,1 CMD and 2 HCCA. The HCCA queues are not used.
max_txq_num is set to maximum usable TX queues.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-3945.c | 9 ++++++---
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index 205603d..73f93a0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -233,7 +233,7 @@ struct iwl3945_eeprom {
#define PCI_CFG_REV_ID_BIT_RTP (0x80) /* bit 7 */

#define TFD_QUEUE_MIN 0
-#define TFD_QUEUE_MAX 6
+#define TFD_QUEUE_MAX 5 /* 4 DATA + 1 CMD */

#define IWL_NUM_SCAN_RATES (2)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index ba7e720..99bb48e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1046,7 +1046,7 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
goto error;

/* Tx queue(s) */
- for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
+ for (txq_id = 0; txq_id <= priv->hw_params.max_txq_num; 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[txq_id], slots_num,
@@ -1239,7 +1239,7 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)
int txq_id;

/* Tx queues */
- for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++)
+ for (txq_id = 0; txq_id <= priv->hw_params.max_txq_num; txq_id++)
iwl_tx_queue_free(priv, txq_id);
}

@@ -1259,7 +1259,7 @@ void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
iwl_write_prph(priv, ALM_SCD_MODE_REG, 0);

/* reset TFD queues */
- for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
+ for (txq_id = 0; txq_id <= priv->hw_params.max_txq_num; txq_id++) {
iwl_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0);
iwl_poll_direct_bit(priv, FH39_TSSR_TX_STATUS,
FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id),
@@ -2488,6 +2488,9 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
return -ENOMEM;
}

+ /* Assign number of Usable TX queues */
+ priv->hw_params.max_txq_num = TFD_QUEUE_MAX;
+
priv->hw_params.tfd_size = sizeof(struct iwl3945_tfd);
priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_3K;
priv->hw_params.max_pkt_size = 2342;
--
1.5.6.3


2009-03-19 19:58:47

by Abbas, Mohamed

[permalink] [raw]
Subject: RE: [PATCH 06/13] iwlcore: Fix scan problem, resource busy

Yes if mac80211 is fixed to accept failure then this patch not needed. =
I did not get is there us a patch that already fix this or I need to do=
it myself.
Mohamed

-----Original Message-----
=46rom: Helmut Schaa [mailto:[email protected]]=20
Sent: Thursday, March 19, 2009 9:12 AM
To: Chatre, Reinette
Cc: [email protected]; [email protected]; ipw3945-dev=
[email protected]; Abbas, Mohamed
Subject: Re: [PATCH 06/13] iwlcore: Fix scan problem, resource busy

Hi,

Am Mittwoch, 18. M=E4rz 2009 schrieb Reinette Chatre:
> From: Mohamed Abbas <[email protected]>
>=20
> when mac80211 issues scan request to lower driver, it always expect
> a scan_complete notification from the driver, this driver make sure
> we call scan_completed on all exit path in iwl_mac_hw_scan.

It should suffice to return an error in iwl_mac_hw_scan (as done withou=
t
this patch). The problem was mac80211 not calling cfg80211 in case of a
failure. [1] should fix that. Hence, this workaround in iwlwifi should
not be needed.

Helmut

[1] http://git.kernel.org/?p=3Dlinux/kernel/git/linville/wireless-testi=
ng.git;a=3Dcommit;h=3Da3fa954ddc4509721a691dd685c3d102cba0b58e

2009-03-18 04:46:57

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 13/13] iwl3945: replace stations with stations_39

From: Abhijeet Kolekar <[email protected]>

A *leftover* stations is replaced with stations_39.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index ab6a7d5..279d10c 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -485,14 +485,14 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
memcpy(priv->stations_39[sta_id].sta.key.key, keyconf->key,
keyconf->keylen);

- if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
+ if ((priv->stations_39[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
== STA_KEY_FLG_NO_ENC)
- priv->stations[sta_id].sta.key.key_offset =
+ priv->stations_39[sta_id].sta.key.key_offset =
iwl_get_free_ucode_key_index(priv);
/* else, we are overriding an existing key => no need to allocated room
* in uCode. */

- WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
+ WARN(priv->stations_39[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
"no space for a new key");

priv->stations_39[sta_id].sta.key.key_flags = key_flags;
--
1.5.6.3


2009-03-18 04:46:56

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 05/13] iwlcore: dont commit power command if interface is not up

From: Mohamed Abbas <[email protected]>

If user set new power level, accept the new power level and only
send command to host if the interface is up and radio on.

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-power.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 18b7e41..47c8945 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -273,7 +273,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
if (priv->iw_mode != NL80211_IFTYPE_STATION)
final_mode = IWL_POWER_MODE_CAM;

- if (!iwl_is_rfkill(priv) && !setting->power_disabled &&
+ if (iwl_is_ready_rf(priv) && !setting->power_disabled &&
((setting->power_mode != final_mode) || force)) {
struct iwl_powertable_cmd cmd;

--
1.5.6.3


2009-03-18 04:46:57

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 11/13] iwl3945: control rate decrease

From: Abhijeet Kolekar <[email protected]>

Control the rate decrease. Do not decrease the rate fast.
Use success_ratio for rate scaling :)

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index f65c308..af6b9d4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -124,7 +124,7 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = {
#define IWL39_RATE_HIGH_TH 11520
#define IWL_SUCCESS_UP_TH 8960
#define IWL_SUCCESS_DOWN_TH 10880
-#define IWL_RATE_MIN_FAILURE_TH 8
+#define IWL_RATE_MIN_FAILURE_TH 6
#define IWL_RATE_MIN_SUCCESS_TH 8
#define IWL_RATE_DECREASE_TH 1920
#define IWL_RATE_RETRY_TH 15
@@ -488,7 +488,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband

IWL_DEBUG_RATE(priv, "enter\n");

- retries = info->status.rates[0].count - 1;
+ retries = info->status.rates[0].count;
/* Sanity Check for retries */
if (retries > IWL_RATE_RETRY_TH)
retries = IWL_RATE_RETRY_TH;
@@ -791,16 +791,15 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) {
IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
scale_action = -1;
-
/* No throughput measured yet for adjacent rates,
* try increase */
} else if ((low_tpt == IWL_INVALID_VALUE) &&
(high_tpt == IWL_INVALID_VALUE)) {

- if (high != IWL_RATE_INVALID && window->success_counter >= IWL_RATE_INCREASE_TH)
+ if (high != IWL_RATE_INVALID && window->success_ratio >= IWL_RATE_INCREASE_TH)
scale_action = 1;
else if (low != IWL_RATE_INVALID)
- scale_action = -1;
+ scale_action = 0;

/* Both adjacent throughputs are measured, but neither one has
* better throughput; we're using the best rate, don't change
@@ -826,14 +825,14 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
else {
IWL_DEBUG_RATE(priv,
"decrease rate because of high tpt\n");
- scale_action = -1;
+ scale_action = 0;
}
} else if (low_tpt != IWL_INVALID_VALUE) {
if (low_tpt > current_tpt) {
IWL_DEBUG_RATE(priv,
"decrease rate because of low tpt\n");
scale_action = -1;
- } else if (window->success_counter >= IWL_RATE_INCREASE_TH) {
+ } else if (window->success_ratio >= IWL_RATE_INCREASE_TH) {
/* Lower rate has better
* throughput,decrease rate */
scale_action = 1;
--
1.5.6.3


2009-03-18 04:54:07

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 01/13 v2] iwlagn: use changed in mac_config

From: Mohamed Abbas <[email protected]>

In function iwl_mac_config use changed flag to call only
the affected functions. This patch also allow user to cache
channel, txpower and power value when the interface is not
ready and apply the changes once the interface ready.

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
v2 fix "From:" email address

drivers/net/wireless/iwlwifi/iwl-agn.c | 161 ++++++++++++++++---------------
drivers/net/wireless/iwlwifi/iwl-core.c | 4 +
2 files changed, 85 insertions(+), 80 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0db3bc0..4d2ed52 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1567,9 +1567,8 @@ static void iwl_alive_start(struct iwl_priv *priv)
if (iwl_is_associated(priv)) {
struct iwl_rxon_cmd *active_rxon =
(struct iwl_rxon_cmd *)&priv->active_rxon;
-
- memcpy(&priv->staging_rxon, &priv->active_rxon,
- sizeof(priv->staging_rxon));
+ /* apply any changes in staging */
+ priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
} else {
/* Initialize our rx_config data */
@@ -2184,110 +2183,112 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
struct iwl_priv *priv = hw->priv;
const struct iwl_channel_info *ch_info;
struct ieee80211_conf *conf = &hw->conf;
- unsigned long flags;
+ unsigned long flags = 0;
int ret = 0;
- u16 channel;
+ u16 ch;
+ int scan_active = 0;

mutex_lock(&priv->mutex);
- IWL_DEBUG_MAC80211(priv, "enter to channel %d\n", conf->channel->hw_value);
-
- priv->current_ht_config.is_ht = conf_is_ht(conf);
+ IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n",
+ conf->channel->hw_value, changed);

- if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - waiting for uCode\n");
- goto out;
+ if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
+ test_bit(STATUS_SCANNING, &priv->status))) {
+ scan_active = 1;
+ IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
}

- if (!conf->radio_enabled)
- iwl_radio_kill_sw_disable_radio(priv);

- if (!iwl_is_ready(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
- ret = -EIO;
- goto out;
- }
+ /* during scanning mac80211 will delay channel setting until
+ * scan finish with changed = 0
+ */
+ if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
+ if (scan_active)
+ goto set_ch_out;
+
+ ch = ieee80211_frequency_to_channel(conf->channel->center_freq);
+ ch_info = iwl_get_channel_info(priv, conf->channel->band, ch);
+ if (!is_channel_valid(ch_info)) {
+ IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
+ ret = -EINVAL;
+ goto set_ch_out;
+ }

- if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
- test_bit(STATUS_SCANNING, &priv->status))) {
- IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
- mutex_unlock(&priv->mutex);
- return 0;
- }
+ if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
+ !is_channel_ibss(ch_info)) {
+ IWL_ERR(priv, "channel %d in band %d not "
+ "IBSS channel\n",
+ conf->channel->hw_value, conf->channel->band);
+ ret = -EINVAL;
+ goto set_ch_out;
+ }

- channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
- ch_info = iwl_get_channel_info(priv, conf->channel->band, channel);
- if (!is_channel_valid(ch_info)) {
- IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
- ret = -EINVAL;
- goto out;
- }
+ priv->current_ht_config.is_ht = conf_is_ht(conf);

- if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
- !is_channel_ibss(ch_info)) {
- IWL_ERR(priv, "channel %d in band %d not IBSS channel\n",
- conf->channel->hw_value, conf->channel->band);
- ret = -EINVAL;
- goto out;
- }
+ spin_lock_irqsave(&priv->lock, flags);

- spin_lock_irqsave(&priv->lock, flags);

+ /* if we are switching from ht to 2.4 clear flags
+ * from any ht related info since 2.4 does not
+ * support ht */
+ if ((le16_to_cpu(priv->staging_rxon.channel) != ch))
+ priv->staging_rxon.flags = 0;

- /* if we are switching from ht to 2.4 clear flags
- * from any ht related info since 2.4 does not
- * support ht */
- if ((le16_to_cpu(priv->staging_rxon.channel) != channel)
-#ifdef IEEE80211_CONF_CHANNEL_SWITCH
- && !(conf->flags & IEEE80211_CONF_CHANNEL_SWITCH)
-#endif
- )
- priv->staging_rxon.flags = 0;
+ iwl_set_rxon_channel(priv, conf->channel);
+
+ iwl_set_flags_for_band(priv, conf->channel->band);
+ spin_unlock_irqrestore(&priv->lock, flags);
+ set_ch_out:
+ /* The list of supported rates and rate mask can be different
+ * for each band; since the band may have changed, reset
+ * the rate mask to what mac80211 lists */
+ iwl_set_rate(priv);
+ }

- iwl_set_rxon_channel(priv, conf->channel);
+ if (changed & IEEE80211_CONF_CHANGE_PS) {
+ if (conf->flags & IEEE80211_CONF_PS)
+ ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3);
+ else
+ ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
+ if (ret)
+ IWL_DEBUG_MAC80211(priv, "Error setting power level\n");

- iwl_set_flags_for_band(priv, conf->channel->band);
+ }

- /* The list of supported rates and rate mask can be different
- * for each band; since the band may have changed, reset
- * the rate mask to what mac80211 lists */
- iwl_set_rate(priv);
+ if (changed & IEEE80211_CONF_CHANGE_POWER) {
+ IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
+ priv->tx_power_user_lmt, conf->power_level);

- spin_unlock_irqrestore(&priv->lock, flags);
+ iwl_set_tx_power(priv, conf->power_level, false);
+ }

-#ifdef IEEE80211_CONF_CHANNEL_SWITCH
- if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
- iwl_hw_channel_switch(priv, conf->channel);
- goto out;
+ /* call to ensure that 4965 rx_chain is set properly in monitor mode */
+ iwl_set_rxon_chain(priv);
+
+ if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
+ if (conf->radio_enabled &&
+ iwl_radio_kill_sw_enable_radio(priv)) {
+ IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
+ "waiting for uCode\n");
+ goto out;
+ }
+
+ if (!conf->radio_enabled)
+ iwl_radio_kill_sw_disable_radio(priv);
}
-#endif

if (!conf->radio_enabled) {
IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
goto out;
}

- if (iwl_is_rfkill(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - RF kill\n");
- ret = -EIO;
+ if (!iwl_is_ready(priv)) {
+ IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
goto out;
}

- if (conf->flags & IEEE80211_CONF_PS)
- ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3);
- else
- ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
- if (ret)
- IWL_DEBUG_MAC80211(priv, "Error setting power level\n");
-
- IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
- priv->tx_power_user_lmt, conf->power_level);
-
- iwl_set_tx_power(priv, conf->power_level, false);
-
- iwl_set_rate(priv);
-
- /* call to ensure that 4965 rx_chain is set properly in monitor mode */
- iwl_set_rxon_chain(priv);
+ if (scan_active)
+ goto out;

if (memcmp(&priv->active_rxon,
&priv->staging_rxon, sizeof(priv->staging_rxon)))
@@ -2295,9 +2296,9 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
else
IWL_DEBUG_INFO(priv, "No re-sending same RXON configuration.\n");

- IWL_DEBUG_MAC80211(priv, "leave\n");

out:
+ IWL_DEBUG_MAC80211(priv, "leave\n");
mutex_unlock(&priv->mutex);
return ret;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 085e9cf..bcdecb1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1437,6 +1437,10 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)

priv->tx_power_user_lmt = tx_power;

+ /* if nic is not up don't send command */
+ if (!iwl_is_ready_rf(priv))
+ return ret;
+
if (force && priv->cfg->ops->lib->send_tx_power)
ret = priv->cfg->ops->lib->send_tx_power(priv);

--
1.5.6.3




2009-03-20 14:45:42

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 06/13] iwlcore: Fix scan problem, resource busy

On Thu, Mar 19, 2009 at 12:58:43PM -0700, Abbas, Mohamed wrote:
> Yes if mac80211 is fixed to accept failure then this patch not
> needed. I did not get is there us a patch that already fix this or
> I need to do it myself.

I think it is fixed already.

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2009-03-18 04:46:58

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 04/13] iwlagn: allow power level setting all the times

From: Mohamed Abbas <[email protected]>

allow user to set power level at all times

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 5 -----
drivers/net/wireless/iwlwifi/iwl3945-base.c | 5 -----
2 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index c148285..663dc83 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3093,11 +3093,6 @@ static ssize_t store_power_level(struct device *d,

mutex_lock(&priv->mutex);

- if (!iwl_is_ready(priv)) {
- ret = -EAGAIN;
- goto out;
- }
-
ret = strict_strtoul(buf, 10, &mode);
if (ret)
goto out;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 215d3f6..33bdd86 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4550,11 +4550,6 @@ static ssize_t store_power_level(struct device *d,

mutex_lock(&priv->mutex);

- if (!iwl_is_ready(priv)) {
- ret = -EAGAIN;
- goto out;
- }
-
ret = strict_strtoul(buf, 10, &mode);
if (ret)
goto out;
--
1.5.6.3


2009-03-18 04:46:56

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 10/13] iwl3945: fix checkpatch.pl errors

From: Abhijeet Kolekar <[email protected]>

Patch fixes two checkpatch.pl errors.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 2 +-
drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 50c61ed..d03f553 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1179,7 +1179,7 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv)
IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id);

rc = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
- if(rc)
+ if (rc)
return rc;

priv->cfg->ops->lib->apm_ops.config(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index d653ff8..ab6a7d5 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -560,7 +560,7 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv,
ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id);
break;
default:
- IWL_ERR(priv,"Unknown alg: %s alg = %d\n", __func__, keyconf->alg);
+ IWL_ERR(priv, "Unknown alg: %s alg = %d\n", __func__, keyconf->alg);
ret = -EINVAL;
}

--
1.5.6.3


2009-03-18 04:46:59

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 03/13] iwlwifi: return 0 for AMPDU_TX/RX_STOP request if NIC is going down

From: Wey-Yi Guy <[email protected]>

When receive IEEE80211_AMPDU_RX_STOP or IEEE80211_AMPDU_TX_STOP request
in iwl_mac_ampdu_action() from mac80211; check STATUS_EXIT_PENDING bit,
if NIC is on the way out, then return 0 back to mac80211, this can
prevent mac80211 report HW error incorrectly.

Signed-off-by: Wey-Yi Guy <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 4d2ed52..c148285 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2683,6 +2683,7 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_sta *sta, u16 tid, u16 *ssn)
{
struct iwl_priv *priv = hw->priv;
+ int ret;

IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
sta->addr, tid);
@@ -2696,13 +2697,21 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
return iwl_sta_rx_agg_start(priv, sta->addr, tid, *ssn);
case IEEE80211_AMPDU_RX_STOP:
IWL_DEBUG_HT(priv, "stop Rx\n");
- return iwl_sta_rx_agg_stop(priv, sta->addr, tid);
+ ret = iwl_sta_rx_agg_stop(priv, sta->addr, tid);
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+ return 0;
+ else
+ return ret;
case IEEE80211_AMPDU_TX_START:
IWL_DEBUG_HT(priv, "start Tx\n");
return iwl_tx_agg_start(priv, sta->addr, tid, ssn);
case IEEE80211_AMPDU_TX_STOP:
IWL_DEBUG_HT(priv, "stop Tx\n");
- return iwl_tx_agg_stop(priv, sta->addr, tid);
+ ret = iwl_tx_agg_stop(priv, sta->addr, tid);
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+ return 0;
+ else
+ return ret;
default:
IWL_DEBUG_HT(priv, "unknown\n");
return -EINVAL;
--
1.5.6.3


2009-03-18 04:46:56

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 07/13] iwlwifi: support 11h

From: Mohamed Abbas <[email protected]>

Set IEEE80211_HW_SPECTRUM_MGMT bit in hw->flags, this tell mac80211
we support spectrum mgmt.

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-core.c | 1 +
drivers/net/wireless/iwlwifi/iwl3945-base.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index bcdecb1..4b1298c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1298,6 +1298,7 @@ int iwl_setup_mac(struct iwl_priv *priv)
hw->flags = IEEE80211_HW_SIGNAL_DBM |
IEEE80211_HW_NOISE_DBM |
IEEE80211_HW_AMPDU_AGGREGATION |
+ IEEE80211_HW_SPECTRUM_MGMT |
IEEE80211_HW_SUPPORTS_PS;
hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 33bdd86..d653ff8 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4904,7 +4904,8 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)

/* Tell mac80211 our characteristics */
hw->flags = IEEE80211_HW_SIGNAL_DBM |
- IEEE80211_HW_NOISE_DBM;
+ IEEE80211_HW_NOISE_DBM |
+ IEEE80211_HW_SPECTRUM_MGMT;

hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) |
--
1.5.6.3


2009-03-18 04:46:58

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 09/13] iwl3945: use iwl_cmd_queue_free

From: Abhijeet Kolekar <[email protected]>

iwl_cmd_queue_free needs to be used to free up the cmd_queue,
as TFD slots for cmd_queue and tx_queue are different.

Signed-off-by: Abhijeet Kolekar <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 11 +++++------
drivers/net/wireless/iwlwifi/iwl-core.h | 1 +
drivers/net/wireless/iwlwifi/iwl-tx.c | 6 ++++--
3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 99bb48e..50c61ed 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -747,11 +747,6 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
int i;
int counter;

- /* classify bd */
- if (txq->q.id == IWL_CMD_QUEUE_NUM)
- /* nothing to cleanup after for host commands */
- return;
-
/* sanity check */
counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
if (counter > NUM_TFD_CHUNKS) {
@@ -1240,7 +1235,11 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)

/* Tx queues */
for (txq_id = 0; txq_id <= priv->hw_params.max_txq_num; txq_id++)
- iwl_tx_queue_free(priv, txq_id);
+ if (txq_id == IWL_CMD_QUEUE_NUM)
+ iwl_cmd_queue_free(priv);
+ else
+ iwl_tx_queue_free(priv, txq_id);
+
}

void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 27310fe..a8eac8c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -264,6 +264,7 @@ void iwl_rx_reply_error(struct iwl_priv *priv,
* RX
******************************************************/
void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
+void iwl_cmd_queue_free(struct iwl_priv *priv);
int iwl_rx_queue_alloc(struct iwl_priv *priv);
void iwl_rx_handle(struct iwl_priv *priv);
int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index dff60fb..9e83ee2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -174,7 +174,7 @@ EXPORT_SYMBOL(iwl_tx_queue_free);
* Free all buffers.
* 0-fill, but do not free "txq" descriptor structure.
*/
-static void iwl_cmd_queue_free(struct iwl_priv *priv)
+void iwl_cmd_queue_free(struct iwl_priv *priv)
{
struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
struct iwl_queue *q = &txq->q;
@@ -193,12 +193,14 @@ static void iwl_cmd_queue_free(struct iwl_priv *priv)

/* De-alloc circular buffer of TFDs */
if (txq->q.n_bd)
- pci_free_consistent(dev, sizeof(struct iwl_tfd) *
+ pci_free_consistent(dev, priv->hw_params.tfd_size *
txq->q.n_bd, txq->tfds, txq->q.dma_addr);

/* 0-fill queue descriptor structure */
memset(txq, 0, sizeof(*txq));
}
+EXPORT_SYMBOL(iwl_cmd_queue_free);
+
/*************** DMA-QUEUE-GENERAL-FUNCTIONS *****
* DMA services
*
--
1.5.6.3


2009-03-18 04:46:55

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 06/13] iwlcore: Fix scan problem, resource busy

From: Mohamed Abbas <[email protected]>

when mac80211 issues scan request to lower driver, it always expect
a scan_complete notification from the driver, this driver make sure
we call scan_completed on all exit path in iwl_mac_hw_scan.

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-scan.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 23644cf..f557f38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -462,8 +462,9 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
spin_lock_irqsave(&priv->lock, flags);

if (!iwl_is_ready_rf(priv)) {
- ret = -EIO;
+ ret = 0;
IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
+ queue_work(priv->workqueue, &priv->scan_completed);
goto out_unlock;
}

--
1.5.6.3


2009-03-19 16:12:15

by Helmut Schaa

[permalink] [raw]
Subject: Re: [PATCH 06/13] iwlcore: Fix scan problem, resource busy

Hi,

Am Mittwoch, 18. M=E4rz 2009 schrieb Reinette Chatre:
> From: Mohamed Abbas <[email protected]>
>=20
> when mac80211 issues scan request to lower driver, it always expect
> a scan_complete notification from the driver, this driver make sure
> we call scan_completed on all exit path in iwl_mac_hw_scan.

It should suffice to return an error in iwl_mac_hw_scan (as done withou=
t
this patch). The problem was mac80211 not calling cfg80211 in case of a
failure. [1] should fix that. Hence, this workaround in iwlwifi should
not be needed.

Helmut

[1] http://git.kernel.org/?p=3Dlinux/kernel/git/linville/wireless-testi=
ng.git;a=3Dcommit;h=3Da3fa954ddc4509721a691dd685c3d102cba0b58e

2009-03-18 04:46:58

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 12/13] iwlwifi: report error when detect failure during stop agg queue

From: Wey-Yi Guy <[email protected]>

This fix related to bug 1921 at
http://www.intellinuxwireless.org/bugzilla/show_bug.cgi?id=1921

when detect error during stopping tx aggregation queue, report the error to
help identify the problem.

Signed-off-by: Wey-Yi Guy <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-5000.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-sta.c | 4 +++-
drivers/net/wireless/iwlwifi/iwl-tx.c | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 08c19be..a3d9a95 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1077,7 +1077,7 @@ static int iwl5000_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,

if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
(IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) {
- IWL_WARN(priv,
+ IWL_ERR(priv,
"queue number out of range: %d, must be %d to %d\n",
txq_id, IWL50_FIRST_AMPDU_QUEUE,
IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1);
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 1684490..5798fe4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -1138,8 +1138,10 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid)
int sta_id;

sta_id = iwl_find_station(priv, addr);
- if (sta_id == IWL_INVALID_STATION)
+ if (sta_id == IWL_INVALID_STATION) {
+ IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
return -ENXIO;
+ }

spin_lock_irqsave(&priv->sta_lock, flags);
priv->stations[sta_id].sta.station_flags_msk = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 9e83ee2..b13862a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -1223,8 +1223,10 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)

sta_id = iwl_find_station(priv, ra);

- if (sta_id == IWL_INVALID_STATION)
+ if (sta_id == IWL_INVALID_STATION) {
+ IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
return -ENXIO;
+ }

if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON)
IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n");
--
1.5.6.3


2009-03-18 04:46:59

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH 02/13] iwl3945: use changed in iwl3945_mac_config

From: Mohamed Abbas <[email protected]>

In function iwl3945_mac_config use changed flag to call only
the affected functions.

Signed-off-by: Mohamed Abbas <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 93f70df..215d3f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3773,15 +3773,19 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
}
#endif

- if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) {
- IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - waiting for uCode\n");
- goto out;
- }
+ if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
+ if (conf->radio_enabled &&
+ iwl_radio_kill_sw_enable_radio(priv)) {
+ IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
+ "waiting for uCode\n");
+ goto out;
+ }

- if (!conf->radio_enabled) {
- iwl_radio_kill_sw_disable_radio(priv);
- IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
- goto out;
+ if (!conf->radio_enabled) {
+ iwl_radio_kill_sw_disable_radio(priv);
+ IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
+ goto out;
+ }
}

if (iwl_is_rfkill(priv)) {
--
1.5.6.3