From: "Guy, Wey-Yi" <wey-yi.w.guy@intel.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: "stable@kernel.org" <stable@kernel.org>,
"kernel@lists.fedoraproject.org" <kernel@lists.fedoraproject.org>,
Kyle McMartin <kmcmartin@redhat.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 2.6.38 1/4] iwlwifi: do not set tx power when channel is changing
Date: Thu, 28 Apr 2011 07:42:32 -0700 [thread overview]
Message-ID: <1304001752.14995.206.camel@wwguy-huron> (raw)
In-Reply-To: <1303992495-7337-2-git-send-email-sgruszka@redhat.com>
On Thu, 2011-04-28 at 05:08 -0700, Stanislaw Gruszka wrote:
> commit f844a709a7d8f8be61a571afc31dfaca9e779621 upstream.
>
> 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>
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.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 39b6f16..4e7b58b 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-3945.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
> @@ -1823,7 +1823,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 91a9f52..992caa0 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 6d140bd..ee802fe 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
> @@ -288,10 +288,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 efbde1f..91cac6f 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-core.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-core.c
> @@ -1161,6 +1161,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);
>
> @@ -1188,10 +1190,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;
> }
>
next prev parent reply other threads:[~2011-04-28 15:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 12:08 [PATCH 2.6.38 0/4] iwlwifi: fix hw scan related problems Stanislaw Gruszka
2011-04-28 12:08 ` [PATCH 2.6.38 1/4] iwlwifi: do not set tx power when channel is changing Stanislaw Gruszka
2011-04-28 14:42 ` Guy, Wey-Yi [this message]
2011-04-28 12:08 ` [PATCH 2.6.38 2/4] iwl3945: do not deprecate software scan Stanislaw Gruszka
2011-04-28 12:08 ` [PATCH 2.6.38 3/4] iwl3945: disable hw scan by default Stanislaw Gruszka
2011-04-29 17:41 ` Dan Williams
2011-04-28 12:08 ` [PATCH 2.6.38 4/4] iwlwifi: fix tx_power initialization Stanislaw Gruszka
2011-04-29 16:23 ` [stable] [PATCH 2.6.38 0/4] iwlwifi: fix hw scan related problems Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304001752.14995.206.camel@wwguy-huron \
--to=wey-yi.w.guy@intel.com \
--cc=kernel@lists.fedoraproject.org \
--cc=kmcmartin@redhat.com \
--cc=linux-wireless@vger.kernel.org \
--cc=sgruszka@redhat.com \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).