linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] iwlwifi: do not set tx power when channel is changing
@ 2011-01-28 15:47 Stanislaw Gruszka
  2011-01-28 15:47 ` [PATCH 2/8] iwl3945: set STATUS_READY before commit_rxon Stanislaw Gruszka
                   ` (7 more replies)
  0 siblings, 8 replies; 29+ messages in thread
From: Stanislaw Gruszka @ 2011-01-28 15:47 UTC (permalink / raw)
  To: Wey-Yi Guy, Intel Linux Wireless; +Cc: linux-wireless, Stanislaw Gruszka

Mac80211 can request for tx power and channel change in one ->config
call. If that happens, *_send_tx_power functions will try to setup tx
power for old channel, what can be not correct because we already change
the band. I.e  error  "Failed to get channel info for channel 140 [0]",
can be printed frequently when operating in software scanning mode.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945.c     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c     |    2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c |    5 ++---
 drivers/net/wireless/iwlwifi/iwl-core.c     |   13 ++++++++++---
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 1d9dcd7..294221b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1890,7 +1890,7 @@ int iwl3945_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
 
 	/* If we issue a new RXON command which required a tune then we must
 	 * send a new TXPOWER command or we won't be able to Tx any frames */
-	rc = priv->cfg->ops->lib->send_tx_power(priv);
+	rc = iwl_set_tx_power(priv, priv->tx_power_next, true);
 	if (rc) {
 		IWL_ERR(priv, "Error setting Tx power (%d).\n", rc);
 		return rc;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 313e92e..7c14eb3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1571,7 +1571,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c
 
 	/* If we issue a new RXON command which required a tune then we must
 	 * send a new TXPOWER command or we won't be able to Tx any frames */
-	ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
+	ret = iwl_set_tx_power(priv, priv->tx_power_next, true);
 	if (ret) {
 		IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
 		return ret;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 2a4ff83..6c2adc5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -316,10 +316,9 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
 	 * If we issue a new RXON command which required a tune then we must
 	 * send a new TXPOWER command or we won't be able to Tx any frames.
 	 *
-	 * FIXME: which RXON requires a tune? Can we optimise this out in
-	 *        some cases?
+	 * It's expected we set power here if channel is changing.
 	 */
-	ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
+	ret = iwl_set_tx_power(priv, priv->tx_power_next, true);
 	if (ret) {
 		IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
 		return ret;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index a46ad60..92724cb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1162,6 +1162,8 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
 {
 	int ret;
 	s8 prev_tx_power;
+	bool defer;
+	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
 
 	lockdep_assert_held(&priv->mutex);
 
@@ -1189,10 +1191,15 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
 	if (!iwl_is_ready_rf(priv))
 		return -EIO;
 
-	/* scan complete use tx_power_next, need to be updated */
+	/* scan complete and commit_rxon use tx_power_next value,
+	 * it always need to be updated for newest request */
 	priv->tx_power_next = tx_power;
-	if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
-		IWL_DEBUG_INFO(priv, "Deferring tx power set while scanning\n");
+
+	/* do not set tx power when scanning or channel changing */
+	defer = test_bit(STATUS_SCANNING, &priv->status) ||
+		memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
+	if (defer && !force) {
+		IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
 		return 0;
 	}
 
-- 
1.7.1


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

end of thread, other threads:[~2011-01-31 15:26 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-28 15:47 [PATCH 1/8] iwlwifi: do not set tx power when channel is changing Stanislaw Gruszka
2011-01-28 15:47 ` [PATCH 2/8] iwl3945: set STATUS_READY before commit_rxon Stanislaw Gruszka
2011-01-28 16:04   ` wwguy
2011-01-28 15:47 ` [PATCH 3/8] iwlwifi: remove unneeded __packed Stanislaw Gruszka
2011-01-28 16:05   ` wwguy
2011-01-28 15:47 ` [PATCH 4/8] iwlwifi: introduce iwl_advanced_bt_coexist() Stanislaw Gruszka
2011-01-28 16:13   ` wwguy
2011-01-28 15:47 ` [PATCH 5/8] iwlwifi: remove unneeded disable_hw_scan check Stanislaw Gruszka
2011-01-28 16:14   ` wwguy
2011-01-28 15:47 ` [PATCH 6/8] iwl3945: do not use agn specific IWL_RATE_COUNT Stanislaw Gruszka
2011-01-28 16:20   ` wwguy
2011-01-28 16:33     ` Stanislaw Gruszka
2011-01-28 16:42       ` wwguy
2011-01-31 14:54   ` wwguy
2011-01-28 15:47 ` [PATCH 7/8] iwlagn: remove CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE Stanislaw Gruszka
2011-01-28 16:23   ` wwguy
2011-01-28 16:41     ` Stanislaw Gruszka
2011-01-28 23:20       ` wwguy
2011-01-31  9:46         ` Stanislaw Gruszka
2011-01-31 10:23           ` Rafał Miłecki
2011-01-31 11:29             ` Stanislaw Gruszka
2011-01-31 15:01               ` wwguy
2011-01-31 15:26                 ` Stanislaw Gruszka
2011-01-31 14:57             ` wwguy
2011-01-28 15:47 ` [PATCH 8/8] iwlwifi: introduce iwl_bt_statistics Stanislaw Gruszka
2011-01-28 16:24   ` wwguy
2011-01-28 16:03 ` [PATCH 1/8] iwlwifi: do not set tx power when channel is changing wwguy
2011-01-28 16:27   ` Stanislaw Gruszka
2011-01-28 16:38     ` wwguy

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