From: Reinette Chatre <reinette.chatre@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
ipw3945-devel@lists.sourceforge.net,
Reinette Chatre <reinette.chatre@intel.com>
Subject: [PATCH 13/47] iwlwifi: make bcast LQ command available for later restore actions
Date: Mon, 10 May 2010 15:27:44 -0700 [thread overview]
Message-ID: <1273530498-11876-14-git-send-email-reinette.chatre@intel.com> (raw)
In-Reply-To: <1273530498-11876-1-git-send-email-reinette.chatre@intel.com>
From: Reinette Chatre <reinette.chatre@intel.com>
When adding the broadcast station the link quality command is
generated on demand, sent to device, and disappears. It is thus not
available for later cases when we need to restore stations and need
to send the link quality command afterwards. Now, when first adding the
broadcast station, also generate its link quality command to always be
available for later restoring.
Also fix an issue when adding local stations where the "in progress" state
is never cleared.
Reported-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
drivers/net/wireless/iwlwifi/iwl-core.c | 4 +-
drivers/net/wireless/iwlwifi/iwl-core.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-sta.c | 91 ++++++++++++++++++++++---------
drivers/net/wireless/iwlwifi/iwl-sta.h | 7 ++-
4 files changed, 75 insertions(+), 29 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index d609414..e8c9bca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2042,7 +2042,9 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
goto out_err;
/* Add the broadcast address so we can send broadcast frames */
- priv->cfg->ops->lib->add_bcast_station(priv);
+ err = priv->cfg->ops->lib->add_bcast_station(priv);
+ if (err)
+ goto out_err;
goto out;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index f66c1c1..8d53fc9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -201,7 +201,7 @@ struct iwl_lib_ops {
/* temperature */
struct iwl_temp_ops temp_ops;
/* station management */
- void (*add_bcast_station)(struct iwl_priv *priv);
+ int (*add_bcast_station)(struct iwl_priv *priv);
/* recover from tx queue stall */
void (*recover_from_tx_stall)(unsigned long data);
/* check for plcp health */
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index db93447..5c6b326 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -418,15 +418,19 @@ int iwl_add_station_common(struct iwl_priv *priv, const u8 *addr,
}
EXPORT_SYMBOL(iwl_add_station_common);
-static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap)
+static struct iwl_link_quality_cmd *iwl_sta_init_lq(struct iwl_priv *priv,
+ const u8 *addr, bool is_ap)
{
int i, r;
- struct iwl_link_quality_cmd link_cmd = {
- .reserved1 = 0,
- };
+ struct iwl_link_quality_cmd *link_cmd;
u32 rate_flags;
int ret = 0;
+ link_cmd = kzalloc(sizeof(struct iwl_link_quality_cmd), GFP_KERNEL);
+ if (!link_cmd) {
+ IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
+ return NULL;
+ }
/* Set up the rate scaling to start at selected rate, fall back
* all the way down to 1M in IEEE order, and then spin on 1M */
if (is_ap)
@@ -444,35 +448,36 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap)
rate_flags |= first_antenna(priv->hw_params.valid_tx_ant) <<
RATE_MCS_ANT_POS;
- link_cmd.rs_table[i].rate_n_flags =
+ link_cmd->rs_table[i].rate_n_flags =
iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
r = iwl_get_prev_ieee_rate(r);
}
- link_cmd.general_params.single_stream_ant_msk =
+ link_cmd->general_params.single_stream_ant_msk =
first_antenna(priv->hw_params.valid_tx_ant);
- link_cmd.general_params.dual_stream_ant_msk =
+ link_cmd->general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant &
~first_antenna(priv->hw_params.valid_tx_ant);
- if (!link_cmd.general_params.dual_stream_ant_msk) {
- link_cmd.general_params.dual_stream_ant_msk = ANT_AB;
+ if (!link_cmd->general_params.dual_stream_ant_msk) {
+ link_cmd->general_params.dual_stream_ant_msk = ANT_AB;
} else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
- link_cmd.general_params.dual_stream_ant_msk =
+ link_cmd->general_params.dual_stream_ant_msk =
priv->hw_params.valid_tx_ant;
}
- link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
- link_cmd.agg_params.agg_time_limit =
+ link_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
+ link_cmd->agg_params.agg_time_limit =
cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
/* Update the rate scaling for control frame Tx to AP */
- link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id;
+ link_cmd->sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id;
- ret = iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD,
- sizeof(link_cmd), &link_cmd);
+ ret = iwl_send_lq_cmd(priv, link_cmd, CMD_SYNC, true);
if (ret)
- IWL_ERR(priv, "REPLY_TX_LINK_QUALITY_CMD failed (%d)\n", ret);
+ IWL_ERR(priv, "Link quality command failed (%d)\n", ret);
+
+ return link_cmd;
}
/*
@@ -487,6 +492,8 @@ int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs)
{
int ret;
u8 sta_id;
+ struct iwl_link_quality_cmd *link_cmd;
+ unsigned long flags;
ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id);
if (ret) {
@@ -494,9 +501,23 @@ int iwl_add_local_station(struct iwl_priv *priv, const u8 *addr, bool init_rs)
return ret;
}
- if (init_rs)
+ spin_lock_irqsave(&priv->sta_lock, flags);
+ priv->stations[sta_id].used |= IWL_STA_LOCAL;
+ spin_unlock_irqrestore(&priv->sta_lock, flags);
+
+ if (init_rs) {
/* Set up default rate scaling table in device's station table */
- iwl_sta_init_lq(priv, addr, false);
+ link_cmd = iwl_sta_init_lq(priv, addr, false);
+ if (!link_cmd) {
+ IWL_ERR(priv, "Unable to initialize rate scaling for station %pM.\n",
+ addr);
+ return -ENOMEM;
+ }
+ spin_lock_irqsave(&priv->sta_lock, flags);
+ priv->stations[sta_id].lq = link_cmd;
+ spin_unlock_irqrestore(&priv->sta_lock, flags);
+ }
+
return 0;
}
EXPORT_SYMBOL(iwl_add_local_station);
@@ -509,7 +530,8 @@ EXPORT_SYMBOL(iwl_add_local_station);
static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, u8 sta_id)
{
/* Ucode must be active and driver must be non active */
- if (priv->stations[sta_id].used != IWL_STA_UCODE_ACTIVE)
+ if ((priv->stations[sta_id].used &
+ (IWL_STA_UCODE_ACTIVE | IWL_STA_DRIVER_ACTIVE)) != IWL_STA_UCODE_ACTIVE)
IWL_ERR(priv, "removed non active STA %u\n", sta_id);
priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE;
@@ -676,8 +698,23 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force)
spin_lock_irqsave(&priv->sta_lock, flags_spin);
if (force) {
IWL_DEBUG_INFO(priv, "Clearing all station information in driver\n");
+ /*
+ * The station entry contains a link to the LQ command. For
+ * all stations managed by mac80211 this memory will be
+ * managed by it also. For local stations (broadcast and
+ * bssid station when in adhoc mode) we need to maintain
+ * this lq command separately. This memory is created when
+ * these stations are added.
+ */
+ for (i = 0; i < priv->hw_params.max_stations; i++) {
+ if (priv->stations[i].used & IWL_STA_LOCAL) {
+ kfree(priv->stations[i].lq);
+ priv->stations[i].lq = NULL;
+ }
+ }
priv->num_stations = 0;
memset(priv->stations, 0, sizeof(priv->stations));
+ cleared = true;
} else {
for (i = 0; i < priv->hw_params.max_stations; i++) {
if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) {
@@ -1207,7 +1244,8 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
BUG_ON(init && (cmd.flags & CMD_ASYNC));
ret = iwl_send_cmd(priv, &cmd);
- if (ret || (cmd.flags & CMD_ASYNC))
+
+ if (cmd.flags & CMD_ASYNC)
return ret;
if (init) {
@@ -1217,33 +1255,36 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS;
spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
}
- return 0;
+ return ret;
}
EXPORT_SYMBOL(iwl_send_lq_cmd);
/**
* iwl_add_bcast_station - add broadcast station into station table.
*/
-void iwl_add_bcast_station(struct iwl_priv *priv)
+int iwl_add_bcast_station(struct iwl_priv *priv)
{
IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n");
- iwl_add_local_station(priv, iwl_bcast_addr, true);
+ return iwl_add_local_station(priv, iwl_bcast_addr, true);
}
EXPORT_SYMBOL(iwl_add_bcast_station);
/**
* iwl3945_add_bcast_station - add broadcast station into station table.
*/
-void iwl3945_add_bcast_station(struct iwl_priv *priv)
+int iwl3945_add_bcast_station(struct iwl_priv *priv)
{
+ int ret;
+
IWL_DEBUG_INFO(priv, "Adding broadcast station to station table\n");
- iwl_add_local_station(priv, iwl_bcast_addr, false);
+ ret = iwl_add_local_station(priv, iwl_bcast_addr, false);
/*
* It is assumed that when station is added more initialization
* needs to be done, but for 3945 it is not the case and we can
* just release station table access right here.
*/
priv->stations[priv->hw_params.bcast_sta_id].used &= ~IWL_STA_UCODE_INPROGRESS;
+ return ret;
}
EXPORT_SYMBOL(iwl3945_add_bcast_station);
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index 42cd2f4..b0ed2eb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -36,6 +36,9 @@
#define IWL_STA_UCODE_ACTIVE BIT(1) /* ucode entry is active */
#define IWL_STA_UCODE_INPROGRESS BIT(2) /* ucode entry is in process of
being activated */
+#define IWL_STA_LOCAL BIT(3) /* station state not directed by mac80211
+ this is for bcast and bssid (when adhoc)
+ stations */
/**
@@ -57,8 +60,8 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
struct ieee80211_key_conf *keyconf,
const u8 *addr, u32 iv32, u16 *phase1key);
-void iwl_add_bcast_station(struct iwl_priv *priv);
-void iwl3945_add_bcast_station(struct iwl_priv *priv);
+int iwl_add_bcast_station(struct iwl_priv *priv);
+int iwl3945_add_bcast_station(struct iwl_priv *priv);
void iwl_restore_stations(struct iwl_priv *priv);
void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force);
int iwl_get_free_ucode_key_index(struct iwl_priv *priv);
--
1.6.3.3
next prev parent reply other threads:[~2010-05-10 22:28 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-10 22:27 [PATCH 00/47] iwlwifi updates for 2.6.35 Reinette Chatre
2010-05-10 22:27 ` [PATCH 01/47] iwlwifi: rename 6000 series Gen2 devices to Gen2a Reinette Chatre
2010-05-10 22:46 ` Gábor Stefanik
2010-05-10 22:52 ` Zhao, Shanyu
2010-05-10 22:27 ` [PATCH 02/47] iwl3945: fix scan races Reinette Chatre
2010-05-10 22:27 ` [PATCH 03/47] iwlwifi: remove powersave debugfs if it is not supported Reinette Chatre
2010-05-10 22:27 ` [PATCH 04/47] iwlwifi: rename "tx_power" to "chain_tx_power" Reinette Chatre
2010-05-10 22:27 ` [PATCH 05/47] iwlwifi: use vif iwl_bss_info_changed Reinette Chatre
2010-05-10 22:27 ` [PATCH 06/47] iwlwifi: remove device type checking for tx power in debugfs Reinette Chatre
2010-05-10 22:27 ` [PATCH 07/47] iwlwifi: use .cfg to enable/disable continuous ucode trace Reinette Chatre
2010-05-10 22:27 ` [PATCH 08/47] iwlwifi: use cfg to configure calibration operation Reinette Chatre
2010-05-10 22:27 ` [PATCH 09/47] iwlwifi: give correct return information for tx power debugfs Reinette Chatre
2010-05-10 22:27 ` [PATCH 10/47] iwlwifi: wimax co-exist code clean up Reinette Chatre
2010-05-10 22:27 ` [PATCH 11/47] iwlwifi: checking for all the possible failure cases Reinette Chatre
2010-05-10 22:27 ` [PATCH 12/47] iwlwifi: dump firmware build info in error case Reinette Chatre
2010-05-10 22:27 ` Reinette Chatre [this message]
2010-05-10 22:27 ` [PATCH 14/47] iwl3945: use iwl3945_add_bcast_station Reinette Chatre
2010-05-10 22:27 ` [PATCH 15/47] iwlwifi: pass address to iwl_remove_station Reinette Chatre
2010-05-10 22:27 ` [PATCH 16/47] iwlwifi: manage IBSS station properly Reinette Chatre
2010-05-10 22:27 ` [PATCH 17/47] iwlagn: show and store firmware build number Reinette Chatre
2010-05-10 22:27 ` [PATCH 18/47] iwl3945: remove ucode access indirection Reinette Chatre
2010-05-10 22:27 ` [PATCH 19/47] iwlwifi: remove ucode virtual functions Reinette Chatre
2010-05-10 22:27 ` [PATCH 20/47] iwlwifi: move eeprom version printout to eeprom init Reinette Chatre
2010-05-10 22:27 ` [PATCH 21/47] iwlagn: prepare for new firmware file format Reinette Chatre
2010-05-10 22:27 ` [PATCH 22/47] iwlagn: implement loading a new firmware file type Reinette Chatre
2010-05-10 22:27 ` [PATCH 23/47] iwl3945: add plcp error checking Reinette Chatre
2010-05-10 22:27 ` [PATCH 24/47] iwlwifi: remove rts_threshold Reinette Chatre
2010-05-10 22:27 ` [PATCH 25/47] iwlagn: move iwl_get_ra_sta_id to 4965 Reinette Chatre
2010-05-10 22:27 ` [PATCH 26/47] iwlagn: use vif->type to check station Reinette Chatre
2010-05-10 22:27 ` [PATCH 27/47] iwlwifi: apply filter flags directly Reinette Chatre
2010-05-10 22:27 ` [PATCH 28/47] iwlwifi: push virtual interface through Reinette Chatre
2010-05-10 22:28 ` [PATCH 29/47] iwlagn: use virtual interface in TX aggregation handling Reinette Chatre
2010-05-10 22:28 ` [PATCH 30/47] iwlwifi: remove useless priv->vif check Reinette Chatre
2010-05-10 22:28 ` [PATCH 31/47] iwlwifi: use vif in iwl_ht_conf Reinette Chatre
2010-05-10 22:28 ` [PATCH 32/47] iwlwifi: note that priv->bssid is used only by 3945 Reinette Chatre
2010-05-10 22:28 ` [PATCH 33/47] iwlwifi: fix iwl_sta_init_lq station ID Reinette Chatre
2010-05-10 22:28 ` [PATCH 34/47] iwlwifi: split allocation/sending local station LQ Reinette Chatre
2010-05-10 22:28 ` [PATCH 35/47] iwlwifi: rework broadcast station management Reinette Chatre
2010-05-10 22:28 ` [PATCH 36/47] iwlagn: work around rate scaling reset delay Reinette Chatre
2010-05-10 22:28 ` [PATCH 37/47] iwlwifi: "tx power per chain" are part of ucode_tx_stats Reinette Chatre
2010-05-10 22:28 ` [PATCH 38/47] iwlwifi: provide more comments for cfg structure Reinette Chatre
2010-05-10 22:28 ` [PATCH 39/47] iwlwifi: track station IDs Reinette Chatre
2010-05-10 22:28 ` [PATCH 40/47] iwlwifi: add iwl_sta_id() Reinette Chatre
2010-05-10 22:28 ` [PATCH 41/47] iwlwifi: use iwl_find_station less Reinette Chatre
2010-05-10 22:28 ` [PATCH 42/47] iwlagn: use iwl_sta_id() for aggregation Reinette Chatre
2010-05-10 22:28 ` [PATCH 43/47] iwlwifi: use iwl_sta_id() for TKIP key update Reinette Chatre
2010-05-10 22:28 ` [PATCH 44/47] iwlwifi: move iwl_find_station() to 4965 Reinette Chatre
2010-05-10 22:28 ` [PATCH 45/47] iwlwifi: rename iwl_add_local_station Reinette Chatre
2010-05-10 22:28 ` [PATCH 46/47] iwlwifi: remove pointless HT check Reinette Chatre
2010-05-10 22:28 ` [PATCH 47/47] iwlwifi: clear driver stations when going down Reinette Chatre
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=1273530498-11876-14-git-send-email-reinette.chatre@intel.com \
--to=reinette.chatre@intel.com \
--cc=ipw3945-devel@lists.sourceforge.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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