This series contains various fixes and improvements to the iwlwifi driver.
It applies to wireless-2.6#everything.
[PATCH 01/12] iwl4965: Remove redundant code in iwl4965_tx_cmd
[PATCH 02/12] iwlwifi: move iwl4965_get_dma_hi_address function to iwl-helpers.h
[PATCH 03/12] iwlwifi: remove iwl4965_tx_cmd
[PATCH 04/12] iwlwifi: document scan command
[PATCH 05/12] iwlwifi: delay firmware loading from pci_probe to network interface open
[PATCH 06/12] iwlwifi: fix problem when rf_killswitch change during suspend/resume
[PATCH 07/12] iwlwifi: move uCode helper functions to iwl-helpers.h
[PATCH 08/12] iwlwifi: 4965 unify rate scale variable names for station data
[PATCH 09/12] iwlwifi: 3954 renames iwl3945_rate_scale_priv to iwl3945_rs_sta
[PATCH 10/12] iwlwifi: Update iwlwifi version stamp to 1.2.23
[PATCH 11/12] iwlwifi: remove reference to non-existent documentation
[PATCH 12/12] iwlwifi: style fixes to usage of << and >> operators
Thank you
Reinette
> > iwl4965 will transmit a probe request and go to the next
> > channel before hostapd sends the probe response, iwl4965
> > still sees the response, but the b43 card never sees the ACK
> > because it's receiver isn't quite as good as the iwl4965 receiver.
>
> I'm not sure of the history of the dwell time values, but it's an
> attempt to balance reliability of scan vs. speed of scan. The active
> dwell times are, of course, more speed-aggressive than the passive ones.
> Would you be willing to experiment with your setup, and try some
> different values?
Sure, can do that next week, do I just change the defines at the top of
the file?
johannes
From: Tomas Winkler <[email protected]>
This patch moves iwl4965_get_dma_hi_address function to iwl-headers.h
as iwl_get_dma_hi_address. This function will be used in more chipsets
than only 4965.
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965.c | 9 ++-------
drivers/net/wireless/iwlwifi/iwl-helpers.h | 5 +++++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index b913c6b..a945788 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2797,11 +2797,6 @@ int iwl4965_hw_tx_queue_init(struct iwl4965_priv *priv, struct iwl4965_tx_queue
return 0;
}
-static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr)
-{
- return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0;
-}
-
int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *ptr,
dma_addr_t addr, u16 len)
{
@@ -2822,7 +2817,7 @@ int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl4965_priv *priv, void *ptr,
if (!is_odd) {
tfd->pa[index].tb1_addr = cpu_to_le32(addr);
IWL_SET_BITS(tfd->pa[index], tb1_addr_hi,
- iwl4965_get_dma_hi_address(addr));
+ iwl_get_dma_hi_address(addr));
IWL_SET_BITS(tfd->pa[index], tb1_len, len);
} else {
IWL_SET_BITS(tfd->pa[index], tb2_addr_lo16,
@@ -3289,7 +3284,7 @@ int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
offsetof(struct iwl4965_tx_cmd, scratch);
tx->dram_lsb_ptr = cpu_to_le32(scratch_phys);
- tx->dram_msb_ptr = iwl4965_get_dma_hi_address(scratch_phys);
+ tx->dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys);
/* Hard coded to start at the highest retry fallback position
* until the 4965 specific rate control algorithm is tied in */
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index e2a8d95..5228834 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -252,4 +252,9 @@ static inline unsigned long elapsed_jiffies(unsigned long start,
return end + (MAX_JIFFY_OFFSET - start);
}
+static inline u8 iwl_get_dma_hi_address(dma_addr_t addr)
+{
+ return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0;
+}
+
#endif /* __iwl_helpers_h__ */
--
1.5.3.4
From: Tomas Winkler <[email protected]>
1, This patch renames iwl4965_rate_scale_priv to iwl4965_lq_sta.
This type represents a station's link quality.
2. The names of the variables of this type were rs_priv, lq_data, lq, crl
across the file. All are now unified under the name lq_sta.
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 609 ++++++++++++++--------------
1 files changed, 308 insertions(+), 301 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 5081e28..d064622 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -103,7 +103,7 @@ struct iwl4965_scale_tbl_info {
*
* Pointer to this gets passed back and forth between driver and mac80211.
*/
-struct iwl4965_rate_scale_priv {
+struct iwl4965_lq_sta {
u8 active_tbl; /* index of active table, range 0-1 */
u8 enable_counter; /* indicates HT mode */
u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */
@@ -148,16 +148,16 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
struct net_device *dev,
struct ieee80211_hdr *hdr,
struct sta_info *sta);
-static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
+static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_rate *tx_mcs,
struct iwl4965_link_quality_cmd *tbl);
#ifdef CONFIG_MAC80211_DEBUGFS
-static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
+static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_rate *mcs, int index);
#else
-static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
+static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_rate *mcs, int index)
{}
#endif
@@ -516,23 +516,24 @@ static inline u8 rs_use_green(struct iwl4965_priv *priv,
* basic available rates.
*
*/
-static void rs_get_supported_rates(struct iwl4965_rate_scale_priv *lq_data,
+static void rs_get_supported_rates(struct iwl4965_lq_sta *lq_sta,
struct ieee80211_hdr *hdr,
enum iwl4965_table_type rate_type,
u16 *data_rate)
{
if (is_legacy(rate_type))
- *data_rate = lq_data->active_rate;
+ *data_rate = lq_sta->active_rate;
else {
if (is_siso(rate_type))
- *data_rate = lq_data->active_siso_rate;
+ *data_rate = lq_sta->active_siso_rate;
else
- *data_rate = lq_data->active_mimo_rate;
+ *data_rate = lq_sta->active_mimo_rate;
}
if (hdr && is_multicast_ether_addr(hdr->addr1) &&
- lq_data->active_rate_basic)
- *data_rate = lq_data->active_rate_basic;
+ lq_sta->active_rate_basic) {
+ *data_rate = lq_sta->active_rate_basic;
+ }
}
static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
@@ -590,7 +591,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type)
return (high << 8) | low;
}
-static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
+static void rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_scale_tbl_info *tbl, u8 scale_index,
u8 ht_possible, struct iwl4965_rate *mcs_rate)
{
@@ -598,7 +599,7 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
u16 rate_mask;
u16 high_low;
u8 switch_to_legacy = 0;
- u8 is_green = lq_data->is_green;
+ u8 is_green = lq_sta->is_green;
/* check if we need to switch from HT to legacy rates.
* assumption is that mandatory rates (1Mbps or 6Mbps)
@@ -606,7 +607,7 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) {
switch_to_legacy = 1;
scale_index = rs_ht_to_legacy[scale_index];
- if (lq_data->phymode == MODE_IEEE80211A)
+ if (lq_sta->phymode == MODE_IEEE80211A)
tbl->lq_type = LQ_A;
else
tbl->lq_type = LQ_G;
@@ -619,16 +620,16 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
tbl->is_SGI = 0;
}
- rs_get_supported_rates(lq_data, NULL, tbl->lq_type, &rate_mask);
+ rs_get_supported_rates(lq_sta, NULL, tbl->lq_type, &rate_mask);
/* Mask with station rate restriction */
if (is_legacy(tbl->lq_type)) {
/* supp_rates has no CCK bits in A mode */
- if (lq_data->phymode == (u8) MODE_IEEE80211A)
+ if (lq_sta->phymode == (u8) MODE_IEEE80211A)
rate_mask = (u16)(rate_mask &
- (lq_data->supp_rates << IWL_FIRST_OFDM_RATE));
+ (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE));
else
- rate_mask = (u16)(rate_mask & lq_data->supp_rates);
+ rate_mask = (u16)(rate_mask & lq_sta->supp_rates);
}
/* If we switched from HT to legacy, check current rate */
@@ -649,15 +650,14 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data,
/*
* mac80211 sends us Tx status
*/
-static void rs_tx_status(void *priv_rate,
- struct net_device *dev,
+static void rs_tx_status(void *priv_rate, struct net_device *dev,
struct sk_buff *skb,
struct ieee80211_tx_status *tx_resp)
{
int status;
u8 retries;
int rs_index, index = 0;
- struct iwl4965_rate_scale_priv *lq;
+ struct iwl4965_lq_sta *lq_sta;
struct iwl4965_link_quality_cmd *table;
struct sta_info *sta;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -691,27 +691,29 @@ static void rs_tx_status(void *priv_rate,
return;
}
- lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
+ lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
if (!priv->lq_mngr.lq_ready)
return;
- if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added)
+ if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
+ !lq_sta->ibss_sta_added)
return;
- table = &lq->lq;
- active_index = lq->active_tbl;
+ table = &lq_sta->lq;
+ active_index = lq_sta->active_tbl;
/* Get mac80211 antenna info */
- lq->antenna = (lq->valid_antenna & local->hw.conf.antenna_sel_tx);
- if (!lq->antenna)
- lq->antenna = lq->valid_antenna;
+ lq_sta->antenna =
+ (lq_sta->valid_antenna & local->hw.conf.antenna_sel_tx);
+ if (!lq_sta->antenna)
+ lq_sta->antenna = lq_sta->valid_antenna;
/* Ignore mac80211 antenna info for now */
- lq->antenna = lq->valid_antenna;
+ lq_sta->antenna = lq_sta->valid_antenna;
- curr_tbl = &(lq->lq_info[active_index]);
- search_tbl = &(lq->lq_info[(1 - active_index)]);
+ curr_tbl = &(lq_sta->lq_info[active_index]);
+ search_tbl = &(lq_sta->lq_info[(1 - active_index)]);
window = (struct iwl4965_rate_scale_data *)
&(curr_tbl->win[0]);
search_win = (struct iwl4965_rate_scale_data *)
@@ -780,8 +782,8 @@ static void rs_tx_status(void *priv_rate,
/* If not searching for a new mode, increment failed counter
* ... this helps determine when to start searching again */
- if (lq->stay_in_tbl)
- lq->total_failed++;
+ if (lq_sta->stay_in_tbl)
+ lq_sta->total_failed++;
--retries;
index++;
@@ -833,11 +835,11 @@ static void rs_tx_status(void *priv_rate,
/* If not searching for new mode, increment success/failed counter
* ... these help determine when to start searching again */
- if (lq->stay_in_tbl) {
+ if (lq_sta->stay_in_tbl) {
if (status)
- lq->total_success++;
+ lq_sta->total_success++;
else
- lq->total_failed++;
+ lq_sta->total_failed++;
}
/* See if there's a better rate or modulation mode to try. */
@@ -879,28 +881,28 @@ static u8 rs_is_other_ant_connected(u8 valid_antenna,
* searching for a new mode.
*/
static void rs_set_stay_in_table(u8 is_legacy,
- struct iwl4965_rate_scale_priv *lq_data)
+ struct iwl4965_lq_sta *lq_sta)
{
IWL_DEBUG_HT("we are staying in the same table\n");
- lq_data->stay_in_tbl = 1; /* only place this gets set */
+ lq_sta->stay_in_tbl = 1; /* only place this gets set */
if (is_legacy) {
- lq_data->table_count_limit = IWL_LEGACY_TABLE_COUNT;
- lq_data->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT;
- lq_data->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT;
+ lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT;
+ lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT;
+ lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT;
} else {
- lq_data->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT;
- lq_data->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT;
- lq_data->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT;
+ lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT;
+ lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT;
+ lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT;
}
- lq_data->table_count = 0;
- lq_data->total_failed = 0;
- lq_data->total_success = 0;
+ lq_sta->table_count = 0;
+ lq_sta->total_failed = 0;
+ lq_sta->total_success = 0;
}
/*
* Find correct throughput table for given mode of modulation
*/
-static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data,
+static void rs_get_expected_tpt_table(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_scale_tbl_info *tbl)
{
if (is_legacy(tbl->lq_type)) {
@@ -909,7 +911,7 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data,
else
tbl->expected_tpt = expected_tpt_A;
} else if (is_siso(tbl->lq_type)) {
- if (tbl->is_fat && !lq_data->is_dup)
+ if (tbl->is_fat && !lq_sta->is_dup)
if (tbl->is_SGI)
tbl->expected_tpt = expected_tpt_siso40MHzSGI;
else
@@ -920,7 +922,7 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data,
tbl->expected_tpt = expected_tpt_siso20MHz;
} else if (is_mimo(tbl->lq_type)) {
- if (tbl->is_fat && !lq_data->is_dup)
+ if (tbl->is_fat && !lq_sta->is_dup)
if (tbl->is_SGI)
tbl->expected_tpt = expected_tpt_mimo40MHzSGI;
else
@@ -947,13 +949,13 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data,
* bit rate will typically need to increase, but not if performance was bad.
*/
static s32 rs_get_best_rate(struct iwl4965_priv *priv,
- struct iwl4965_rate_scale_priv *lq_data,
+ struct iwl4965_lq_sta *lq_sta,
struct iwl4965_scale_tbl_info *tbl, /* "search" */
u16 rate_mask, s8 index, s8 rate)
{
/* "active" values */
struct iwl4965_scale_tbl_info *active_tbl =
- &(lq_data->lq_info[lq_data->active_tbl]);
+ &(lq_sta->lq_info[lq_sta->active_tbl]);
s32 active_sr = active_tbl->win[index].success_ratio;
s32 active_tpt = active_tbl->expected_tpt[index];
@@ -986,7 +988,7 @@ static s32 rs_get_best_rate(struct iwl4965_priv *priv,
* conditions) at candidate rate is above expected
* "active" throughput (under perfect conditions).
*/
- if ((((100 * tpt_tbl[rate]) > lq_data->last_tpt) &&
+ if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) &&
((active_sr > IWL_RATE_DECREASE_TH) &&
(active_sr <= IWL_RATE_HIGH_TH) &&
(tpt_tbl[rate] <= active_tpt))) ||
@@ -1045,7 +1047,7 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna)
* Set up search table for MIMO
*/
static int rs_switch_to_mimo(struct iwl4965_priv *priv,
- struct iwl4965_rate_scale_priv *lq_data,
+ struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
struct iwl4965_scale_tbl_info *tbl, int index)
@@ -1053,7 +1055,7 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv,
#ifdef CONFIG_IWL4965_HT
u16 rate_mask;
s32 rate;
- s8 is_green = lq_data->is_green;
+ s8 is_green = lq_sta->is_green;
if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) ||
!sta->ht_info.ht_supported)
@@ -1061,17 +1063,17 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv,
IWL_DEBUG_HT("LQ: try to switch to MIMO\n");
tbl->lq_type = LQ_MIMO;
- rs_get_supported_rates(lq_data, NULL, tbl->lq_type,
+ rs_get_supported_rates(lq_sta, NULL, tbl->lq_type,
&rate_mask);
if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC)
return -1;
/* Need both Tx chains/antennas to support MIMO */
- if (!rs_is_both_ant_supp(lq_data->antenna))
+ if (!rs_is_both_ant_supp(lq_sta->antenna))
return -1;
- tbl->is_dup = lq_data->is_dup;
+ tbl->is_dup = lq_sta->is_dup;
tbl->action = 0;
if (priv->current_ht_config.supported_chan_width
== IWL_CHANNEL_WIDTH_40MHZ)
@@ -1089,9 +1091,9 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv,
else
tbl->is_SGI = 0;
- rs_get_expected_tpt_table(lq_data, tbl);
+ rs_get_expected_tpt_table(lq_sta, tbl);
- rate = rs_get_best_rate(priv, lq_data, tbl, rate_mask, index, index);
+ rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index, index);
IWL_DEBUG_HT("LQ: MIMO best rate %d mask %X\n", rate, rate_mask);
if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask))
@@ -1110,14 +1112,14 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv,
* Set up search table for SISO
*/
static int rs_switch_to_siso(struct iwl4965_priv *priv,
- struct iwl4965_rate_scale_priv *lq_data,
+ struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
struct iwl4965_scale_tbl_info *tbl, int index)
{
#ifdef CONFIG_IWL4965_HT
u16 rate_mask;
- u8 is_green = lq_data->is_green;
+ u8 is_green = lq_sta->is_green;
s32 rate;
IWL_DEBUG_HT("LQ: try to switch to SISO\n");
@@ -1125,10 +1127,10 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv,
!sta->ht_info.ht_supported)
return -1;
- tbl->is_dup = lq_data->is_dup;
+ tbl->is_dup = lq_sta->is_dup;
tbl->lq_type = LQ_SISO;
tbl->action = 0;
- rs_get_supported_rates(lq_data, NULL, tbl->lq_type,
+ rs_get_supported_rates(lq_sta, NULL, tbl->lq_type,
&rate_mask);
if (priv->current_ht_config.supported_chan_width
@@ -1150,8 +1152,8 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv,
if (is_green)
tbl->is_SGI = 0;
- rs_get_expected_tpt_table(lq_data, tbl);
- rate = rs_get_best_rate(priv, lq_data, tbl, rate_mask, index, index);
+ rs_get_expected_tpt_table(lq_sta, tbl);
+ rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index, index);
IWL_DEBUG_HT("LQ: get best rate %d mask %X\n", rate, rate_mask);
if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
@@ -1173,16 +1175,16 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv,
* Try to switch to new modulation mode from legacy
*/
static int rs_move_legacy_other(struct iwl4965_priv *priv,
- struct iwl4965_rate_scale_priv *lq_data,
+ struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
int index)
{
int ret = 0;
struct iwl4965_scale_tbl_info *tbl =
- &(lq_data->lq_info[lq_data->active_tbl]);
+ &(lq_sta->lq_info[lq_sta->active_tbl]);
struct iwl4965_scale_tbl_info *search_tbl =
- &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
+ &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
(sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
@@ -1194,14 +1196,14 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
IWL_DEBUG_HT("LQ Legacy switch Antenna\n");
search_tbl->lq_type = LQ_NONE;
- lq_data->action_counter++;
+ lq_sta->action_counter++;
/* Don't change antenna if success has been great */
if (window->success_ratio >= IWL_RS_GOOD_RATIO)
break;
/* Don't change antenna if other one is not connected */
- if (!rs_is_other_ant_connected(lq_data->antenna,
+ if (!rs_is_other_ant_connected(lq_sta->antenna,
tbl->antenna_type))
break;
@@ -1210,8 +1212,8 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
rs_toggle_antenna(&(search_tbl->current_rate),
search_tbl);
- rs_get_expected_tpt_table(lq_data, search_tbl);
- lq_data->search_better_tbl = 1;
+ rs_get_expected_tpt_table(lq_sta, search_tbl);
+ lq_sta->search_better_tbl = 1;
goto out;
case IWL_LEGACY_SWITCH_SISO:
@@ -1222,11 +1224,11 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
search_tbl->lq_type = LQ_SISO;
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
- ret = rs_switch_to_siso(priv, lq_data, conf, sta,
+ ret = rs_switch_to_siso(priv, lq_sta, conf, sta,
search_tbl, index);
if (!ret) {
- lq_data->search_better_tbl = 1;
- lq_data->action_counter = 0;
+ lq_sta->search_better_tbl = 1;
+ lq_sta->action_counter = 0;
goto out;
}
@@ -1240,11 +1242,11 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
search_tbl->antenna_type = ANT_BOTH;
- ret = rs_switch_to_mimo(priv, lq_data, conf, sta,
+ ret = rs_switch_to_mimo(priv, lq_sta, conf, sta,
search_tbl, index);
if (!ret) {
- lq_data->search_better_tbl = 1;
- lq_data->action_counter = 0;
+ lq_sta->search_better_tbl = 1;
+ lq_sta->action_counter = 0;
goto out;
}
break;
@@ -1271,31 +1273,31 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv,
* Try to switch to new modulation mode from SISO
*/
static int rs_move_siso_to_other(struct iwl4965_priv *priv,
- struct iwl4965_rate_scale_priv *lq_data,
+ struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
int index)
{
int ret;
- u8 is_green = lq_data->is_green;
+ u8 is_green = lq_sta->is_green;
struct iwl4965_scale_tbl_info *tbl =
- &(lq_data->lq_info[lq_data->active_tbl]);
+ &(lq_sta->lq_info[lq_sta->active_tbl]);
struct iwl4965_scale_tbl_info *search_tbl =
- &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
+ &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
struct iwl4965_rate_scale_data *window = &(tbl->win[index]);
u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
(sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action = tbl->action;
for (;;) {
- lq_data->action_counter++;
+ lq_sta->action_counter++;
switch (tbl->action) {
case IWL_SISO_SWITCH_ANTENNA:
IWL_DEBUG_HT("LQ: SISO SWITCH ANTENNA SISO\n");
search_tbl->lq_type = LQ_NONE;
if (window->success_ratio >= IWL_RS_GOOD_RATIO)
break;
- if (!rs_is_other_ant_connected(lq_data->antenna,
+ if (!rs_is_other_ant_connected(lq_sta->antenna,
tbl->antenna_type))
break;
@@ -1303,7 +1305,7 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv,
search_tbl->action = IWL_SISO_SWITCH_MIMO;
rs_toggle_antenna(&(search_tbl->current_rate),
search_tbl);
- lq_data->search_better_tbl = 1;
+ lq_sta->search_better_tbl = 1;
goto out;
@@ -1314,10 +1316,10 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv,
search_tbl->is_SGI = 0;
search_tbl->is_fat = 0;
search_tbl->antenna_type = ANT_BOTH;
- ret = rs_switch_to_mimo(priv, lq_data, conf, sta,
+ ret = rs_switch_to_mimo(priv, lq_sta, conf, sta,
search_tbl, index);
if (!ret) {
- lq_data->search_better_tbl = 1;
+ lq_sta->search_better_tbl = 1;
goto out;
}
break;
@@ -1331,17 +1333,17 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv,
search_tbl->is_SGI = 1;
else
break;
- lq_data->search_better_tbl = 1;
+ lq_sta->search_better_tbl = 1;
if ((tbl->lq_type == LQ_SISO) &&
(tbl->is_SGI)) {
- s32 tpt = lq_data->last_tpt / 100;
+ s32 tpt = lq_sta->last_tpt / 100;
if (((!tbl->is_fat) &&
(tpt >= expected_tpt_siso20MHz[index])) ||
((tbl->is_fat) &&
(tpt >= expected_tpt_siso40MHz[index])))
- lq_data->search_better_tbl = 0;
+ lq_sta->search_better_tbl = 0;
}
- rs_get_expected_tpt_table(lq_data, search_tbl);
+ rs_get_expected_tpt_table(lq_sta, search_tbl);
rs_mcs_from_tbl(&search_tbl->current_rate,
search_tbl, index, is_green);
goto out;
@@ -1366,23 +1368,23 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv,
* Try to switch to new modulation mode from MIMO
*/
static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
- struct iwl4965_rate_scale_priv *lq_data,
+ struct iwl4965_lq_sta *lq_sta,
struct ieee80211_conf *conf,
struct sta_info *sta,
int index)
{
int ret;
- s8 is_green = lq_data->is_green;
+ s8 is_green = lq_sta->is_green;
struct iwl4965_scale_tbl_info *tbl =
- &(lq_data->lq_info[lq_data->active_tbl]);
+ &(lq_sta->lq_info[lq_sta->active_tbl]);
struct iwl4965_scale_tbl_info *search_tbl =
- &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
+ &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
u32 sz = (sizeof(struct iwl4965_scale_tbl_info) -
(sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT));
u8 start_action = tbl->action;
for (;;) {
- lq_data->action_counter++;
+ lq_sta->action_counter++;
switch (tbl->action) {
case IWL_MIMO_SWITCH_ANTENNA_A:
case IWL_MIMO_SWITCH_ANTENNA_B:
@@ -1398,10 +1400,10 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
else
search_tbl->antenna_type = ANT_AUX;
- ret = rs_switch_to_siso(priv, lq_data, conf, sta,
+ ret = rs_switch_to_siso(priv, lq_sta, conf, sta,
search_tbl, index);
if (!ret) {
- lq_data->search_better_tbl = 1;
+ lq_sta->search_better_tbl = 1;
goto out;
}
break;
@@ -1418,7 +1420,7 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
search_tbl->is_SGI = 0;
else
search_tbl->is_SGI = 1;
- lq_data->search_better_tbl = 1;
+ lq_sta->search_better_tbl = 1;
/*
* If active table already uses the fastest possible
@@ -1428,14 +1430,14 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
*/
if ((tbl->lq_type == LQ_MIMO) &&
(tbl->is_SGI)) {
- s32 tpt = lq_data->last_tpt / 100;
+ s32 tpt = lq_sta->last_tpt / 100;
if (((!tbl->is_fat) &&
(tpt >= expected_tpt_mimo20MHz[index])) ||
((tbl->is_fat) &&
(tpt >= expected_tpt_mimo40MHz[index])))
- lq_data->search_better_tbl = 0;
+ lq_sta->search_better_tbl = 0;
}
- rs_get_expected_tpt_table(lq_data, search_tbl);
+ rs_get_expected_tpt_table(lq_sta, search_tbl);
rs_mcs_from_tbl(&search_tbl->current_rate,
search_tbl, index, is_green);
goto out;
@@ -1465,25 +1467,25 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv,
* 2) # times calling this function
* 3) elapsed time in this mode (not used, for now)
*/
-static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data)
+static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta)
{
struct iwl4965_scale_tbl_info *tbl;
int i;
int active_tbl;
int flush_interval_passed = 0;
- active_tbl = lq_data->active_tbl;
+ active_tbl = lq_sta->active_tbl;
- tbl = &(lq_data->lq_info[active_tbl]);
+ tbl = &(lq_sta->lq_info[active_tbl]);
/* If we've been disallowing search, see if we should now allow it */
- if (lq_data->stay_in_tbl) {
+ if (lq_sta->stay_in_tbl) {
/* Elapsed time using current modulation mode */
- if (lq_data->flush_timer)
+ if (lq_sta->flush_timer)
flush_interval_passed =
time_after(jiffies,
- (unsigned long)(lq_data->flush_timer +
+ (unsigned long)(lq_sta->flush_timer +
IWL_RATE_SCALE_FLUSH_INTVL));
/* For now, disable the elapsed time criterion */
@@ -1497,20 +1499,20 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data)
* allow a new search. Also (below) reset all bitmaps and
* stats in active history.
*/
- if ((lq_data->total_failed > lq_data->max_failure_limit) ||
- (lq_data->total_success > lq_data->max_success_limit) ||
- ((!lq_data->search_better_tbl) && (lq_data->flush_timer)
+ if ((lq_sta->total_failed > lq_sta->max_failure_limit) ||
+ (lq_sta->total_success > lq_sta->max_success_limit) ||
+ ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer)
&& (flush_interval_passed))) {
IWL_DEBUG_HT("LQ: stay is expired %d %d %d\n:",
- lq_data->total_failed,
- lq_data->total_success,
+ lq_sta->total_failed,
+ lq_sta->total_success,
flush_interval_passed);
/* Allow search for new mode */
- lq_data->stay_in_tbl = 0; /* only place reset */
- lq_data->total_failed = 0;
- lq_data->total_success = 0;
- lq_data->flush_timer = 0;
+ lq_sta->stay_in_tbl = 0; /* only place reset */
+ lq_sta->total_failed = 0;
+ lq_sta->total_success = 0;
+ lq_sta->flush_timer = 0;
/*
* Else if we've used this modulation mode enough repetitions
@@ -1519,10 +1521,10 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data)
* active table.
*/
} else {
- lq_data->table_count++;
- if (lq_data->table_count >=
- lq_data->table_count_limit) {
- lq_data->table_count = 0;
+ lq_sta->table_count++;
+ if (lq_sta->table_count >=
+ lq_sta->table_count_limit) {
+ lq_sta->table_count = 0;
IWL_DEBUG_HT("LQ: stay in table clear win\n");
for (i = 0; i < IWL_RATE_COUNT; i++)
@@ -1534,7 +1536,7 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data)
/* If transitioning to allow "search", reset all history
* bitmaps and stats in active table (this will become the new
* "search" table). */
- if (!lq_data->stay_in_tbl) {
+ if (!lq_sta->stay_in_tbl) {
for (i = 0; i < IWL_RATE_COUNT; i++)
rs_rate_scale_clear_window(&(tbl->win[i]));
}
@@ -1564,7 +1566,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
s8 scale_action = 0;
u16 fc, rate_mask;
u8 update_lq = 0;
- struct iwl4965_rate_scale_priv *lq_data;
+ struct iwl4965_lq_sta *lq_sta;
struct iwl4965_scale_tbl_info *tbl, *tbl1;
u16 rate_scale_index_msk = 0;
struct iwl4965_rate mcs_rate;
@@ -1590,20 +1592,20 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
IWL_DEBUG_RATE("still rate scaling not ready\n");
return;
}
- lq_data = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
+ lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
/*
* Select rate-scale / modulation-mode table to work with in
* the rest of this function: "search" if searching for better
* modulation mode, or "active" if doing rate scaling within a mode.
*/
- if (!lq_data->search_better_tbl)
- active_tbl = lq_data->active_tbl;
+ if (!lq_sta->search_better_tbl)
+ active_tbl = lq_sta->active_tbl;
else
- active_tbl = 1 - lq_data->active_tbl;
+ active_tbl = 1 - lq_sta->active_tbl;
- tbl = &(lq_data->lq_info[active_tbl]);
- is_green = lq_data->is_green;
+ tbl = &(lq_sta->lq_info[active_tbl]);
+ is_green = lq_sta->is_green;
/* current tx rate */
index = sta->last_txrate;
@@ -1612,20 +1614,20 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
tbl->lq_type);
/* rates available for this association, and for modulation mode */
- rs_get_supported_rates(lq_data, hdr, tbl->lq_type,
+ rs_get_supported_rates(lq_sta, hdr, tbl->lq_type,
&rate_mask);
IWL_DEBUG_RATE("mask 0x%04X \n", rate_mask);
/* mask with station rate restriction */
if (is_legacy(tbl->lq_type)) {
- if (lq_data->phymode == (u8) MODE_IEEE80211A)
+ if (lq_sta->phymode == (u8) MODE_IEEE80211A)
/* supp_rates has no CCK bits in A mode */
rate_scale_index_msk = (u16) (rate_mask &
- (lq_data->supp_rates << IWL_FIRST_OFDM_RATE));
+ (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE));
else
rate_scale_index_msk = (u16) (rate_mask &
- lq_data->supp_rates);
+ lq_sta->supp_rates);
} else
rate_scale_index_msk = rate_mask;
@@ -1653,7 +1655,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
/* Get expected throughput table and history window for current rate */
if (!tbl->expected_tpt)
- rs_get_expected_tpt_table(lq_data, tbl);
+ rs_get_expected_tpt_table(lq_sta, tbl);
window = &(tbl->win[index]);
@@ -1677,13 +1679,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
/* Should we stay with this modulation mode,
* or search for a new one? */
- rs_stay_in_table(lq_data);
+ rs_stay_in_table(lq_sta);
/* Set up new rate table in uCode, if needed */
if (update_lq) {
rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green);
- rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq);
- rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC);
+ rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq);
+ rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
}
goto out;
@@ -1694,25 +1696,25 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
tbl->expected_tpt[index] + 64) / 128);
/* If we are searching for better modulation mode, check success. */
- if (lq_data->search_better_tbl) {
+ if (lq_sta->search_better_tbl) {
int success_limit = IWL_RATE_SCALE_SWITCH;
/* If good success, continue using the "search" mode;
* no need to send new link quality command, since we're
* continuing to use the setup that we've been trying. */
if ((window->success_ratio > success_limit) ||
- (window->average_tpt > lq_data->last_tpt)) {
+ (window->average_tpt > lq_sta->last_tpt)) {
if (!is_legacy(tbl->lq_type)) {
IWL_DEBUG_HT("LQ: we are switching to HT"
" rate suc %d current tpt %d"
" old tpt %d\n",
window->success_ratio,
window->average_tpt,
- lq_data->last_tpt);
- lq_data->enable_counter = 1;
+ lq_sta->last_tpt);
+ lq_sta->enable_counter = 1;
}
/* Swap tables; "search" becomes "active" */
- lq_data->active_tbl = active_tbl;
+ lq_sta->active_tbl = active_tbl;
current_tpt = window->average_tpt;
/* Else poor success; go back to mode in "active" table */
@@ -1721,13 +1723,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
tbl->lq_type = LQ_NONE;
/* Revert to "active" table */
- active_tbl = lq_data->active_tbl;
- tbl = &(lq_data->lq_info[active_tbl]);
+ active_tbl = lq_sta->active_tbl;
+ tbl = &(lq_sta->lq_info[active_tbl]);
/* Revert to "active" rate and throughput info */
index = iwl4965_rate_index_from_plcp(
tbl->current_rate.rate_n_flags);
- current_tpt = lq_data->last_tpt;
+ current_tpt = lq_sta->last_tpt;
/* Need to set up a new rate table in uCode */
update_lq = 1;
@@ -1736,7 +1738,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
/* Either way, we've made a decision; modulation mode
* search is done, allow rate adjustment next time. */
- lq_data->search_better_tbl = 0;
+ lq_sta->search_better_tbl = 0;
done_search = 1; /* Don't switch modes below! */
goto lq_update;
}
@@ -1847,12 +1849,12 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
/* Replace uCode's rate table for the destination station. */
if (update_lq) {
rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green);
- rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq);
- rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC);
+ rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq);
+ rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
}
/* Should we stay with this modulation mode, or search for a new one? */
- rs_stay_in_table(lq_data);
+ rs_stay_in_table(lq_sta);
/*
* Search for new modulation mode if we're:
@@ -1860,23 +1862,23 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
* 2) Not just finishing up a search
* 3) Allowing a new search
*/
- if (!update_lq && !done_search && !lq_data->stay_in_tbl) {
+ if (!update_lq && !done_search && !lq_sta->stay_in_tbl) {
/* Save current throughput to compare with "search" throughput*/
- lq_data->last_tpt = current_tpt;
+ lq_sta->last_tpt = current_tpt;
/* Select a new "search" modulation mode to try.
* If one is found, set up the new "search" table. */
if (is_legacy(tbl->lq_type))
- rs_move_legacy_other(priv, lq_data, conf, sta, index);
+ rs_move_legacy_other(priv, lq_sta, conf, sta, index);
else if (is_siso(tbl->lq_type))
- rs_move_siso_to_other(priv, lq_data, conf, sta, index);
+ rs_move_siso_to_other(priv, lq_sta, conf, sta, index);
else
- rs_move_mimo_to_other(priv, lq_data, conf, sta, index);
+ rs_move_mimo_to_other(priv, lq_sta, conf, sta, index);
/* If new "search" mode was selected, set up in uCode table */
- if (lq_data->search_better_tbl) {
+ if (lq_sta->search_better_tbl) {
/* Access the "search" table, clear its history. */
- tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]);
+ tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
for (i = 0; i < IWL_RATE_COUNT; i++)
rs_rate_scale_clear_window(&(tbl->win[i]));
@@ -1886,9 +1888,9 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
IWL_DEBUG_HT("Switch current mcs: %X index: %d\n",
tbl->current_rate.rate_n_flags, index);
- rs_fill_link_cmd(lq_data, &tbl->current_rate,
- &lq_data->lq);
- rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC);
+ rs_fill_link_cmd(lq_sta, &tbl->current_rate,
+ &lq_sta->lq);
+ rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
}
/* If the "active" (non-search) mode was legacy,
@@ -1896,33 +1898,33 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
* but we haven't been able to try HT modes (not available),
* stay with best antenna legacy modulation for a while
* before next round of mode comparisons. */
- tbl1 = &(lq_data->lq_info[lq_data->active_tbl]);
+ tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]);
if (is_legacy(tbl1->lq_type) &&
#ifdef CONFIG_IWL4965_HT
(!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) &&
#endif
- (lq_data->action_counter >= 1)) {
- lq_data->action_counter = 0;
+ (lq_sta->action_counter >= 1)) {
+ lq_sta->action_counter = 0;
IWL_DEBUG_HT("LQ: STAY in legacy table\n");
- rs_set_stay_in_table(1, lq_data);
+ rs_set_stay_in_table(1, lq_sta);
}
/* If we're in an HT mode, and all 3 mode switch actions
* have been tried and compared, stay in this best modulation
* mode for a while before next round of mode comparisons. */
- if (lq_data->enable_counter &&
- (lq_data->action_counter >= IWL_ACTION_LIMIT)) {
+ if (lq_sta->enable_counter &&
+ (lq_sta->action_counter >= IWL_ACTION_LIMIT)) {
#ifdef CONFIG_IWL4965_HT_AGG
/* If appropriate, set up aggregation! */
- if ((lq_data->last_tpt > TID_AGG_TPT_THREHOLD) &&
+ if ((lq_sta->last_tpt > TID_AGG_TPT_THREHOLD) &&
(priv->lq_mngr.agg_ctrl.auto_agg)) {
priv->lq_mngr.agg_ctrl.tid_retry =
TID_ALL_SPECIFIED;
schedule_work(&priv->agg_work);
}
#endif /*CONFIG_IWL4965_HT_AGG */
- lq_data->action_counter = 0;
- rs_set_stay_in_table(0, lq_data);
+ lq_sta->action_counter = 0;
+ rs_set_stay_in_table(0, lq_sta);
}
/*
@@ -1933,8 +1935,8 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv,
* 3) flush timer is empty
*/
} else {
- if ((!update_lq) && (!done_search) && (!lq_data->flush_timer))
- lq_data->flush_timer = jiffies;
+ if ((!update_lq) && (!done_search) && (!lq_sta->flush_timer))
+ lq_sta->flush_timer = jiffies;
}
out:
@@ -1945,7 +1947,7 @@ out:
/* sta->txrate is an index to A mode rates which start
* at IWL_FIRST_OFDM_RATE
*/
- if (lq_data->phymode == (u8) MODE_IEEE80211A)
+ if (lq_sta->phymode == (u8) MODE_IEEE80211A)
sta->txrate = i - IWL_FIRST_OFDM_RATE;
else
sta->txrate = i;
@@ -1959,7 +1961,7 @@ static void rs_initialize_lq(struct iwl4965_priv *priv,
struct sta_info *sta)
{
int i;
- struct iwl4965_rate_scale_priv *lq;
+ struct iwl4965_lq_sta *lq_sta;
struct iwl4965_scale_tbl_info *tbl;
u8 active_tbl = 0;
int rate_idx;
@@ -1969,19 +1971,19 @@ static void rs_initialize_lq(struct iwl4965_priv *priv,
if (!sta || !sta->rate_ctrl_priv)
goto out;
- lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
+ lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
i = sta->last_txrate;
- if ((lq->lq.sta_id == 0xff) &&
+ if ((lq_sta->lq.sta_id == 0xff) &&
(priv->iw_mode == IEEE80211_IF_TYPE_IBSS))
goto out;
- if (!lq->search_better_tbl)
- active_tbl = lq->active_tbl;
+ if (!lq_sta->search_better_tbl)
+ active_tbl = lq_sta->active_tbl;
else
- active_tbl = 1 - lq->active_tbl;
+ active_tbl = 1 - lq_sta->active_tbl;
- tbl = &(lq->lq_info[active_tbl]);
+ tbl = &(lq_sta->lq_info[active_tbl]);
if ((i < 0) || (i >= IWL_RATE_COUNT))
i = 0;
@@ -2000,9 +2002,9 @@ static void rs_initialize_lq(struct iwl4965_priv *priv,
rs_mcs_from_tbl(&mcs_rate, tbl, rate_idx, use_green);
tbl->current_rate.rate_n_flags = mcs_rate.rate_n_flags;
- rs_get_expected_tpt_table(lq, tbl);
- rs_fill_link_cmd(lq, &mcs_rate, &lq->lq);
- rs_send_lq_cmd(priv, &lq->lq, CMD_ASYNC);
+ rs_get_expected_tpt_table(lq_sta, tbl);
+ rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq);
+ rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
out:
return;
}
@@ -2019,7 +2021,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
struct sta_info *sta;
u16 fc;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
- struct iwl4965_rate_scale_priv *lq;
+ struct iwl4965_lq_sta *lq_sta;
IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
@@ -2036,10 +2038,11 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
return;
}
- lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv;
+ lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
i = sta->last_txrate;
- if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) {
+ if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
+ !lq_sta->ibss_sta_added) {
u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1);
DECLARE_MAC_BUF(mac);
@@ -2050,12 +2053,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
0, CMD_ASYNC, NULL);
}
if ((sta_id != IWL_INVALID_STATION)) {
- lq->lq.sta_id = sta_id;
- lq->lq.rs_table[0].rate_n_flags = 0;
- lq->ibss_sta_added = 1;
+ lq_sta->lq.sta_id = sta_id;
+ lq_sta->lq.rs_table[0].rate_n_flags = 0;
+ lq_sta->ibss_sta_added = 1;
rs_initialize_lq(priv, conf, sta);
}
- if (!lq->ibss_sta_added)
+ if (!lq_sta->ibss_sta_added)
goto done;
}
@@ -2071,23 +2074,23 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
static void *rs_alloc_sta(void *priv, gfp_t gfp)
{
- struct iwl4965_rate_scale_priv *crl;
+ struct iwl4965_lq_sta *lq_sta;
int i, j;
IWL_DEBUG_RATE("create station rate scale window\n");
- crl = kzalloc(sizeof(struct iwl4965_rate_scale_priv), gfp);
+ lq_sta = kzalloc(sizeof(struct iwl4965_lq_sta), gfp);
- if (crl == NULL)
+ if (lq_sta == NULL)
return NULL;
- crl->lq.sta_id = 0xff;
+ lq_sta->lq.sta_id = 0xff;
for (j = 0; j < LQ_SIZE; j++)
for (i = 0; i < IWL_RATE_COUNT; i++)
- rs_rate_scale_clear_window(&(crl->lq_info[j].win[i]));
+ rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i]));
- return crl;
+ return lq_sta;
}
static void rs_rate_init(void *priv_rate, void *priv_sta,
@@ -2098,14 +2101,14 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
struct ieee80211_conf *conf = &local->hw.conf;
struct ieee80211_hw_mode *mode = local->oper_hw_mode;
struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate;
- struct iwl4965_rate_scale_priv *crl = priv_sta;
+ struct iwl4965_lq_sta *lq_sta = priv_sta;
- crl->flush_timer = 0;
- crl->supp_rates = sta->supp_rates;
+ lq_sta->flush_timer = 0;
+ lq_sta->supp_rates = sta->supp_rates;
sta->txrate = 3;
for (j = 0; j < LQ_SIZE; j++)
for (i = 0; i < IWL_RATE_COUNT; i++)
- rs_rate_scale_clear_window(&(crl->lq_info[j].win[i]));
+ rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i]));
IWL_DEBUG_RATE("rate scale global init\n");
/* TODO: what is a good starting rate for STA? About middle? Maybe not
@@ -2113,7 +2116,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
* previous packets? Need to have IEEE 802.1X auth succeed immediately
* after assoc.. */
- crl->ibss_sta_added = 0;
+ lq_sta->ibss_sta_added = 0;
if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
u8 sta_id = iwl4965_hw_find_station(priv, sta->addr);
DECLARE_MAC_BUF(mac);
@@ -2129,8 +2132,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
0, CMD_ASYNC, NULL);
}
if ((sta_id != IWL_INVALID_STATION)) {
- crl->lq.sta_id = sta_id;
- crl->lq.rs_table[0].rate_n_flags = 0;
+ lq_sta->lq.sta_id = sta_id;
+ lq_sta->lq.rs_table[0].rate_n_flags = 0;
}
/* FIXME: this is w/a remove it later */
priv->assoc_station_added = 1;
@@ -2147,36 +2150,39 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
if (local->hw.conf.phymode == MODE_IEEE80211A)
sta->last_txrate += IWL_FIRST_OFDM_RATE;
- crl->is_dup = 0;
- crl->valid_antenna = priv->valid_antenna;
- crl->antenna = priv->antenna;
- crl->is_green = rs_use_green(priv, conf);
- crl->active_rate = priv->active_rate;
- crl->active_rate &= ~(0x1000);
- crl->active_rate_basic = priv->active_rate_basic;
- crl->phymode = priv->phymode;
+ lq_sta->is_dup = 0;
+ lq_sta->valid_antenna = priv->valid_antenna;
+ lq_sta->antenna = priv->antenna;
+ lq_sta->is_green = rs_use_green(priv, conf);
+ lq_sta->active_rate = priv->active_rate;
+ lq_sta->active_rate &= ~(0x1000);
+ lq_sta->active_rate_basic = priv->active_rate_basic;
+ lq_sta->phymode = priv->phymode;
#ifdef CONFIG_IWL4965_HT
/*
* active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3),
* supp_rates[] does not; shift to convert format, force 9 MBits off.
*/
- crl->active_siso_rate = (priv->current_ht_config.supp_mcs_set[0] << 1);
- crl->active_siso_rate |=
+ lq_sta->active_siso_rate = (priv->current_ht_config.supp_mcs_set[0] << 1);
+ lq_sta->active_siso_rate |=
(priv->current_ht_config.supp_mcs_set[0] & 0x1);
- crl->active_siso_rate &= ~((u16)0x2);
- crl->active_siso_rate = crl->active_siso_rate << IWL_FIRST_OFDM_RATE;
+ lq_sta->active_siso_rate &= ~((u16)0x2);
+ lq_sta->active_siso_rate =
+ lq_sta->active_siso_rate << IWL_FIRST_OFDM_RATE;
/* Same here */
- crl->active_mimo_rate = (priv->current_ht_config.supp_mcs_set[1] << 1);
- crl->active_mimo_rate |=
+ lq_sta->active_mimo_rate = (priv->current_ht_config.supp_mcs_set[1] << 1);
+ lq_sta->active_mimo_rate |=
(priv->current_ht_config.supp_mcs_set[1] & 0x1);
- crl->active_mimo_rate &= ~((u16)0x2);
- crl->active_mimo_rate = crl->active_mimo_rate << IWL_FIRST_OFDM_RATE;
- IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate,
- crl->active_mimo_rate);
+ lq_sta->active_mimo_rate &= ~((u16)0x2);
+ lq_sta->active_mimo_rate =
+ lq_sta->active_mimo_rate << IWL_FIRST_OFDM_RATE;
+ IWL_DEBUG_HT("SISO RATE 0x%X MIMO RATE 0x%X\n",
+ lq_sta->active_siso_rate,
+ lq_sta->active_mimo_rate);
#endif /*CONFIG_IWL4965_HT*/
#ifdef CONFIG_MAC80211_DEBUGFS
- crl->drv = priv;
+ lq_sta->drv = priv;
#endif
if (priv->assoc_station_added)
@@ -2185,7 +2191,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
rs_initialize_lq(priv, conf, sta);
}
-static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
+static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_rate *tx_mcs,
struct iwl4965_link_quality_cmd *lq_cmd)
{
@@ -2198,10 +2204,10 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
struct iwl4965_scale_tbl_info tbl_type = { 0 };
/* Override starting rate (index 0) if needed for debug purposes */
- rs_dbgfs_set_mcs(lq_data, tx_mcs, index);
+ rs_dbgfs_set_mcs(lq_sta, tx_mcs, index);
/* Interpret rate_n_flags */
- rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode,
+ rs_get_tbl_info_from_mcs(tx_mcs, lq_sta->phymode,
&tbl_type, &rate_idx);
/* How many times should we repeat the initial rate? */
@@ -2246,7 +2252,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
}
/* Override next rate if needed for debug purposes */
- rs_dbgfs_set_mcs(lq_data, &new_rate, index);
+ rs_dbgfs_set_mcs(lq_sta, &new_rate, index);
/* Fill next table entry */
lq_cmd->rs_table[index].rate_n_flags =
@@ -2255,7 +2261,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
index++;
}
- rs_get_tbl_info_from_mcs(&new_rate, lq_data->phymode, &tbl_type,
+ rs_get_tbl_info_from_mcs(&new_rate, lq_sta->phymode, &tbl_type,
&rate_idx);
/* Indicate to uCode which entries might be MIMO.
@@ -2265,7 +2271,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
lq_cmd->general_params.mimo_delimiter = index;
/* Get next rate */
- rs_get_lower_rate(lq_data, &tbl_type, rate_idx,
+ rs_get_lower_rate(lq_sta, &tbl_type, rate_idx,
use_ht_possible, &new_rate);
/* How many times should we repeat the next rate? */
@@ -2285,7 +2291,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data,
use_ht_possible = 0;
/* Override next rate if needed for debug purposes */
- rs_dbgfs_set_mcs(lq_data, &new_rate, index);
+ rs_dbgfs_set_mcs(lq_sta, &new_rate, index);
/* Fill next table entry */
lq_cmd->rs_table[index].rate_n_flags =
@@ -2329,10 +2335,10 @@ static void rs_clear(void *priv_rate)
static void rs_free_sta(void *priv, void *priv_sta)
{
- struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
+ struct iwl4965_lq_sta *lq_sta = priv_sta;
IWL_DEBUG_RATE("enter\n");
- kfree(rs_priv);
+ kfree(lq_sta);
IWL_DEBUG_RATE("leave\n");
}
@@ -2343,19 +2349,19 @@ static int open_file_generic(struct inode *inode, struct file *file)
file->private_data = inode->i_private;
return 0;
}
-static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
+static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta,
struct iwl4965_rate *mcs, int index)
{
u32 base_rate;
- if (rs_priv->phymode == (u8) MODE_IEEE80211A)
+ if (lq_sta->phymode == (u8) MODE_IEEE80211A)
base_rate = 0x800D;
else
base_rate = 0x820A;
- if (rs_priv->dbg_fixed.rate_n_flags) {
+ if (lq_sta->dbg_fixed.rate_n_flags) {
if (index < 12)
- mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags;
+ mcs->rate_n_flags = lq_sta->dbg_fixed.rate_n_flags;
else
mcs->rate_n_flags = base_rate;
IWL_DEBUG_RATE("Fixed rate ON\n");
@@ -2368,7 +2374,7 @@ static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv,
static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos)
{
- struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
+ struct iwl4965_lq_sta *lq_sta = file->private_data;
char buf[64];
int buf_size;
u32 parsed_rate;
@@ -2379,20 +2385,20 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
return -EFAULT;
if (sscanf(buf, "%x", &parsed_rate) == 1)
- rs_priv->dbg_fixed.rate_n_flags = parsed_rate;
+ lq_sta->dbg_fixed.rate_n_flags = parsed_rate;
else
- rs_priv->dbg_fixed.rate_n_flags = 0;
+ lq_sta->dbg_fixed.rate_n_flags = 0;
- rs_priv->active_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */
- rs_priv->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
- rs_priv->active_mimo_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
+ lq_sta->active_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */
+ lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
+ lq_sta->active_mimo_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
IWL_DEBUG_RATE("sta_id %d rate 0x%X\n",
- rs_priv->lq.sta_id, rs_priv->dbg_fixed.rate_n_flags);
+ lq_sta->lq.sta_id, lq_sta->dbg_fixed.rate_n_flags);
- if (rs_priv->dbg_fixed.rate_n_flags) {
- rs_fill_link_cmd(rs_priv, &rs_priv->dbg_fixed, &rs_priv->lq);
- rs_send_lq_cmd(rs_priv->drv, &rs_priv->lq, CMD_ASYNC);
+ if (lq_sta->dbg_fixed.rate_n_flags) {
+ rs_fill_link_cmd(lq_sta, &lq_sta->dbg_fixed, &lq_sta->lq);
+ rs_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC);
}
return count;
@@ -2405,38 +2411,38 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
int desc = 0;
int i = 0;
- struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
+ struct iwl4965_lq_sta *lq_sta = file->private_data;
- desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id);
+ desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id);
desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
- rs_priv->total_failed, rs_priv->total_success,
- rs_priv->active_rate);
+ lq_sta->total_failed, lq_sta->total_success,
+ lq_sta->active_rate);
desc += sprintf(buff+desc, "fixed rate 0x%X\n",
- rs_priv->dbg_fixed.rate_n_flags);
+ lq_sta->dbg_fixed.rate_n_flags);
desc += sprintf(buff+desc, "general:"
"flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n",
- rs_priv->lq.general_params.flags,
- rs_priv->lq.general_params.mimo_delimiter,
- rs_priv->lq.general_params.single_stream_ant_msk,
- rs_priv->lq.general_params.dual_stream_ant_msk);
+ lq_sta->lq.general_params.flags,
+ lq_sta->lq.general_params.mimo_delimiter,
+ lq_sta->lq.general_params.single_stream_ant_msk,
+ lq_sta->lq.general_params.dual_stream_ant_msk);
desc += sprintf(buff+desc, "agg:"
"time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n",
- le16_to_cpu(rs_priv->lq.agg_params.agg_time_limit),
- rs_priv->lq.agg_params.agg_dis_start_th,
- rs_priv->lq.agg_params.agg_frame_cnt_limit);
+ le16_to_cpu(lq_sta->lq.agg_params.agg_time_limit),
+ lq_sta->lq.agg_params.agg_dis_start_th,
+ lq_sta->lq.agg_params.agg_frame_cnt_limit);
desc += sprintf(buff+desc,
"Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n",
- rs_priv->lq.general_params.start_rate_index[0],
- rs_priv->lq.general_params.start_rate_index[1],
- rs_priv->lq.general_params.start_rate_index[2],
- rs_priv->lq.general_params.start_rate_index[3]);
+ lq_sta->lq.general_params.start_rate_index[0],
+ lq_sta->lq.general_params.start_rate_index[1],
+ lq_sta->lq.general_params.start_rate_index[2],
+ lq_sta->lq.general_params.start_rate_index[3]);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
desc += sprintf(buff+desc, " rate[%d] 0x%X\n",
- i, le32_to_cpu(rs_priv->lq.rs_table[i].rate_n_flags));
+ i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags));
return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
}
@@ -2453,22 +2459,22 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
int desc = 0;
int i, j;
- struct iwl4965_rate_scale_priv *rs_priv = file->private_data;
+ struct iwl4965_lq_sta *lq_sta = file->private_data;
for (i = 0; i < LQ_SIZE; i++) {
desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n"
"rate=0x%X\n",
- rs_priv->active_tbl == i?"*":"x",
- rs_priv->lq_info[i].lq_type,
- rs_priv->lq_info[i].is_SGI,
- rs_priv->lq_info[i].is_fat,
- rs_priv->lq_info[i].is_dup,
- rs_priv->lq_info[i].current_rate.rate_n_flags);
+ lq_sta->active_tbl == i?"*":"x",
+ lq_sta->lq_info[i].lq_type,
+ lq_sta->lq_info[i].is_SGI,
+ lq_sta->lq_info[i].is_fat,
+ lq_sta->lq_info[i].is_dup,
+ lq_sta->lq_info[i].current_rate.rate_n_flags);
for (j = 0; j < IWL_RATE_COUNT; j++) {
desc += sprintf(buff+desc,
- "counter=%d success=%d %%=%d\n",
- rs_priv->lq_info[i].win[j].counter,
- rs_priv->lq_info[i].win[j].success_counter,
- rs_priv->lq_info[i].win[j].success_ratio);
+ "counter=%d success=%d %%=%d\n",
+ lq_sta->lq_info[i].win[j].counter,
+ lq_sta->lq_info[i].win[j].success_counter,
+ lq_sta->lq_info[i].win[j].success_ratio);
}
}
return simple_read_from_buffer(user_buf, count, ppos, buff, desc);
@@ -2482,20 +2488,20 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
static void rs_add_debugfs(void *priv, void *priv_sta,
struct dentry *dir)
{
- struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
- rs_priv->rs_sta_dbgfs_scale_table_file =
+ struct iwl4965_lq_sta *lq_sta = priv_sta;
+ lq_sta->rs_sta_dbgfs_scale_table_file =
debugfs_create_file("rate_scale_table", 0600, dir,
- rs_priv, &rs_sta_dbgfs_scale_table_ops);
- rs_priv->rs_sta_dbgfs_stats_table_file =
+ lq_sta, &rs_sta_dbgfs_scale_table_ops);
+ lq_sta->rs_sta_dbgfs_stats_table_file =
debugfs_create_file("rate_stats_table", 0600, dir,
- rs_priv, &rs_sta_dbgfs_stats_table_ops);
+ lq_sta, &rs_sta_dbgfs_stats_table_ops);
}
static void rs_remove_debugfs(void *priv, void *priv_sta)
{
- struct iwl4965_rate_scale_priv *rs_priv = priv_sta;
- debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file);
- debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file);
+ struct iwl4965_lq_sta *lq_sta = priv_sta;
+ debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file);
+ debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
}
#endif
@@ -2520,9 +2526,9 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
{
struct ieee80211_local *local = hw_to_local(hw);
struct iwl4965_priv *priv = hw->priv;
- struct iwl4965_rate_scale_priv *rs_priv;
+ struct iwl4965_lq_sta *lq_sta;
struct sta_info *sta;
- int count = 0, i;
+ int cnt = 0, i;
u32 samples = 0, success = 0, good = 0;
unsigned long now = jiffies;
u32 max_time = 0;
@@ -2538,10 +2544,10 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
return sprintf(buf, "station %d not found\n", sta_id);
}
- rs_priv = (void *)sta->rate_ctrl_priv;
+ lq_sta = (void *)sta->rate_ctrl_priv;
- lq_type = rs_priv->lq_info[rs_priv->active_tbl].lq_type;
- antenna = rs_priv->lq_info[rs_priv->active_tbl].antenna_type;
+ lq_type = lq_sta->lq_info[lq_sta->active_tbl].lq_type;
+ antenna = lq_sta->lq_info[lq_sta->active_tbl].antenna_type;
if (is_legacy(lq_type))
i = IWL_RATE_54M_INDEX;
@@ -2550,33 +2556,33 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
while (1) {
u64 mask;
int j;
- int active = rs_priv->active_tbl;
+ int active = lq_sta->active_tbl;
- count +=
- sprintf(&buf[count], " %2dMbs: ", iwl4965_rates[i].ieee / 2);
+ cnt +=
+ sprintf(&buf[cnt], " %2dMbs: ", iwl4965_rates[i].ieee / 2);
mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
- buf[count++] =
- (rs_priv->lq_info[active].win[i].data & mask)
+ buf[cnt++] =
+ (lq_sta->lq_info[active].win[i].data & mask)
? '1' : '0';
- samples += rs_priv->lq_info[active].win[i].counter;
- good += rs_priv->lq_info[active].win[i].success_counter;
- success += rs_priv->lq_info[active].win[i].success_counter *
+ samples += lq_sta->lq_info[active].win[i].counter;
+ good += lq_sta->lq_info[active].win[i].success_counter;
+ success += lq_sta->lq_info[active].win[i].success_counter *
iwl4965_rates[i].ieee;
- if (rs_priv->lq_info[active].win[i].stamp) {
+ if (lq_sta->lq_info[active].win[i].stamp) {
int delta =
jiffies_to_msecs(now -
- rs_priv->lq_info[active].win[i].stamp);
+ lq_sta->lq_info[active].win[i].stamp);
if (delta > max_time)
max_time = delta;
- count += sprintf(&buf[count], "%5dms\n", delta);
+ cnt += sprintf(&buf[cnt], "%5dms\n", delta);
} else
- buf[count++] = '\n';
+ buf[cnt++] = '\n';
j = iwl4965_get_prev_ieee_rate(i);
if (j == i)
@@ -2589,19 +2595,20 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
* NOTE: We multiply # of samples by 2 since the IEEE measurement
* added from iwl4965_rates is actually 2X the rate */
if (samples)
- count += sprintf(&buf[count],
+ cnt += sprintf(&buf[cnt],
"\nAverage rate is %3d.%02dMbs over last %4dms\n"
"%3d%% success (%d good packets over %d tries)\n",
success / (2 * samples), (success * 5 / samples) % 10,
max_time, good * 100 / samples, good, samples);
else
- count += sprintf(&buf[count], "\nAverage rate: 0Mbs\n");
- count += sprintf(&buf[count], "\nrate scale type %d antenna %d "
+ cnt += sprintf(&buf[cnt], "\nAverage rate: 0Mbs\n");
+
+ cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d "
"active_search %d rate index %d\n", lq_type, antenna,
- rs_priv->search_better_tbl, sta->last_txrate);
+ lq_sta->search_better_tbl, sta->last_txrate);
sta_info_put(sta);
- return count;
+ return cnt;
}
void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
--
1.5.3.4
From: Zhu Yi <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +-
drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c834e69..d35c0bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -91,7 +91,7 @@ int iwl3945_param_queues_num = IWL_MAX_NUM_QUEUES; /* def: 8 Tx queues */
#define VS
#endif
-#define IWLWIFI_VERSION "1.2.22k" VD VS
+#define IWLWIFI_VERSION "1.2.23k" VD VS
#define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation"
#define DRV_VERSION IWLWIFI_VERSION
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index ca7a175..b300e61 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -90,7 +90,7 @@ int iwl4965_param_amsdu_size_8K; /* def: enable 8K amsdu size */
#define VS
#endif
-#define IWLWIFI_VERSION "1.2.22k" VD VS
+#define IWLWIFI_VERSION "1.2.23k" VD VS
#define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation"
#define DRV_VERSION IWLWIFI_VERSION
--
1.5.3.4
From: Ben Cahill <[email protected]>
Document scan command.
Signed-off-by: Ben Cahill <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-commands.h | 143 +++++++++++++++++----
drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 147 +++++++++++++++++-----
2 files changed, 234 insertions(+), 56 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
index 3cac2c8..0c80ed5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
@@ -1020,6 +1020,10 @@ struct iwl3945_rate_scaling_cmd {
/*
* REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
+ *
+ * 3945 and 4965 support hardware handshake with Bluetooth device on
+ * same platform. Bluetooth device alerts wireless device when it will Tx;
+ * wireless device can delay or kill its own Tx to accomodate.
*/
struct iwl3945_bt_cmd {
u8 flags;
@@ -1258,20 +1262,47 @@ struct iwl3945_ct_kill_config {
*
*****************************************************************************/
+/**
+ * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
+ *
+ * One for each channel in the scan list.
+ * Each channel can independently select:
+ * 1) SSID for directed active scans
+ * 2) Txpower setting (for rate specified within Tx command)
+ * 3) How long to stay on-channel (behavior may be modified by quiet_time,
+ * quiet_plcp_th, good_CRC_th)
+ *
+ * To avoid uCode errors, make sure the following are true (see comments
+ * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
+ * 1) If using passive_dwell (i.e. passive_dwell != 0):
+ * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
+ * 2) quiet_time <= active_dwell
+ * 3) If restricting off-channel time (i.e. max_out_time !=0):
+ * passive_dwell < max_out_time
+ * active_dwell < max_out_time
+ */
struct iwl3945_scan_channel {
- /* type is defined as:
- * 0:0 active (0 - passive)
- * 1:4 SSID direct
- * If 1 is set then corresponding SSID IE is transmitted in probe
+ /*
+ * type is defined as:
+ * 0:0 1 = active, 0 = passive
+ * 1:4 SSID direct bit map; if a bit is set, then corresponding
+ * SSID IE is transmitted in probe request.
* 5:7 reserved
*/
u8 type;
- u8 channel;
+ u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
struct iwl3945_tx_power tpc;
- __le16 active_dwell;
- __le16 passive_dwell;
+ __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
+ __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
} __attribute__ ((packed));
+/**
+ * struct iwl3945_ssid_ie - directed scan network information element
+ *
+ * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
+ * in struct iwl3945_scan_channel; each channel may select different ssids from
+ * among the 4 entries. SSID IEs get transmitted in reverse order of entry.
+ */
struct iwl3945_ssid_ie {
u8 id;
u8 len;
@@ -1285,40 +1316,98 @@ struct iwl3945_ssid_ie {
/*
* REPLY_SCAN_CMD = 0x80 (command)
+ *
+ * The hardware scan command is very powerful; the driver can set it up to
+ * maintain (relatively) normal network traffic while doing a scan in the
+ * background. The max_out_time and suspend_time control the ratio of how
+ * long the device stays on an associated network channel ("service channel")
+ * vs. how long it's away from the service channel, tuned to other channels
+ * for scanning.
+ *
+ * max_out_time is the max time off-channel (in usec), and suspend_time
+ * is how long (in "extended beacon" format) that the scan is "suspended"
+ * after returning to the service channel. That is, suspend_time is the
+ * time that we stay on the service channel, doing normal work, between
+ * scan segments. The driver may set these parameters differently to support
+ * scanning when associated vs. not associated, and light vs. heavy traffic
+ * loads when associated.
+ *
+ * After receiving this command, the device's scan engine does the following;
+ *
+ * 1) Sends SCAN_START notification to driver
+ * 2) Checks to see if it has time to do scan for one channel
+ * 3) Sends NULL packet, with power-save (PS) bit set to 1,
+ * to tell AP that we're going off-channel
+ * 4) Tunes to first channel in scan list, does active or passive scan
+ * 5) Sends SCAN_RESULT notification to driver
+ * 6) Checks to see if it has time to do scan on *next* channel in list
+ * 7) Repeats 4-6 until it no longer has time to scan the next channel
+ * before max_out_time expires
+ * 8) Returns to service channel
+ * 9) Sends NULL packet with PS=0 to tell AP that we're back
+ * 10) Stays on service channel until suspend_time expires
+ * 11) Repeats entire process 2-10 until list is complete
+ * 12) Sends SCAN_COMPLETE notification
+ *
+ * For fast, efficient scans, the scan command also has support for staying on
+ * a channel for just a short time, if doing active scanning and getting no
+ * responses to the transmitted probe request. This time is controlled by
+ * quiet_time, and the number of received packets below which a channel is
+ * considered "quiet" is controlled by quiet_plcp_threshold.
+ *
+ * For active scanning on channels that have regulatory restrictions against
+ * blindly transmitting, the scan can listen before transmitting, to make sure
+ * that there is already legitimate activity on the channel. If enough
+ * packets are cleanly received on the channel (controlled by good_CRC_th,
+ * typical value 1), the scan engine starts transmitting probe requests.
+ *
+ * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
+ *
+ * To avoid uCode errors, see timing restrictions described under
+ * struct iwl3945_scan_channel.
*/
struct iwl3945_scan_cmd {
__le16 len;
u8 reserved0;
- u8 channel_count;
- __le16 quiet_time; /* dwell only this long on quiet chnl
- * (active scan) */
- __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
- __le16 good_CRC_th; /* passive -> active promotion threshold */
+ u8 channel_count; /* # channels in channel list */
+ __le16 quiet_time; /* dwell only this # millisecs on quiet channel
+ * (only for active scan) */
+ __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
+ __le16 good_CRC_th; /* passive -> active promotion threshold */
__le16 reserved1;
- __le32 max_out_time; /* max usec to be out of associated (service)
- * chnl */
- __le32 suspend_time; /* pause scan this long when returning to svc
- * chnl.
- * 3945 -- 31:24 # beacons, 19:0 additional usec,
- * 4965 -- 31:22 # beacons, 21:0 additional usec.
- */
- __le32 flags;
- __le32 filter_flags;
-
+ __le32 max_out_time; /* max usec to be away from associated (service)
+ * channel */
+ __le32 suspend_time; /* pause scan this long (in "extended beacon
+ * format") when returning to service channel:
+ * 3945; 31:24 # beacons, 19:0 additional usec,
+ * 4965; 31:22 # beacons, 21:0 additional usec.
+ */
+ __le32 flags; /* RXON_FLG_* */
+ __le32 filter_flags; /* RXON_FILTER_* */
+
+ /* For active scans (set to all-0s for passive scans).
+ * Does not include payload. Must specify Tx rate; no rate scaling. */
struct iwl3945_tx_cmd tx_cmd;
+
+ /* For directed active scans (set to all-0s otherwise) */
struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
- u8 data[0];
/*
- * The channels start after the probe request payload and are of type:
+ * Probe request frame, followed by channel list.
+ *
+ * Size of probe request frame is specified by byte count in tx_cmd.
+ * Channel list follows immediately after probe request frame.
+ * Number of channels in list is specified by channel_count.
+ * Each channel in list is of type:
*
* struct iwl3945_scan_channel channels[0];
*
* NOTE: Only one band of channels can be scanned per pass. You
- * can not mix 2.4GHz channels and 5.2GHz channels and must
- * request a scan multiple times (not concurrently)
- *
+ * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
+ * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
+ * before requesting another scan.
*/
+ u8 data[0];
} __attribute__ ((packed));
/* Can abort will notify by complete notification with abort status. */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index 7988c75..9237f8b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -1615,6 +1615,10 @@ struct iwl4965_link_quality_cmd {
/*
* REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
+ *
+ * 3945 and 4965 support hardware handshake with Bluetooth device on
+ * same platform. Bluetooth device alerts wireless device when it will Tx;
+ * wireless device can delay or kill its own Tx to accomodate.
*/
struct iwl4965_bt_cmd {
u8 flags;
@@ -1857,20 +1861,47 @@ struct iwl4965_ct_kill_config {
*
*****************************************************************************/
+/**
+ * struct iwl4965_scan_channel - entry in REPLY_SCAN_CMD channel table
+ *
+ * One for each channel in the scan list.
+ * Each channel can independently select:
+ * 1) SSID for directed active scans
+ * 2) Txpower setting (for rate specified within Tx command)
+ * 3) How long to stay on-channel (behavior may be modified by quiet_time,
+ * quiet_plcp_th, good_CRC_th)
+ *
+ * To avoid uCode errors, make sure the following are true (see comments
+ * under struct iwl4965_scan_cmd about max_out_time and quiet_time):
+ * 1) If using passive_dwell (i.e. passive_dwell != 0):
+ * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
+ * 2) quiet_time <= active_dwell
+ * 3) If restricting off-channel time (i.e. max_out_time !=0):
+ * passive_dwell < max_out_time
+ * active_dwell < max_out_time
+ */
struct iwl4965_scan_channel {
- /* type is defined as:
- * 0:0 active (0 - passive)
- * 1:4 SSID direct
- * If 1 is set then corresponding SSID IE is transmitted in probe
+ /*
+ * type is defined as:
+ * 0:0 1 = active, 0 = passive
+ * 1:4 SSID direct bit map; if a bit is set, then corresponding
+ * SSID IE is transmitted in probe request.
* 5:7 reserved
*/
u8 type;
- u8 channel;
+ u8 channel; /* band is selected by iwl4965_scan_cmd "flags" field */
struct iwl4965_tx_power tpc;
- __le16 active_dwell;
- __le16 passive_dwell;
+ __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
+ __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
} __attribute__ ((packed));
+/**
+ * struct iwl4965_ssid_ie - directed scan network information element
+ *
+ * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
+ * in struct iwl4965_scan_channel; each channel may select different ssids from
+ * among the 4 entries. SSID IEs get transmitted in reverse order of entry.
+ */
struct iwl4965_ssid_ie {
u8 id;
u8 len;
@@ -1884,40 +1915,98 @@ struct iwl4965_ssid_ie {
/*
* REPLY_SCAN_CMD = 0x80 (command)
+ *
+ * The hardware scan command is very powerful; the driver can set it up to
+ * maintain (relatively) normal network traffic while doing a scan in the
+ * background. The max_out_time and suspend_time control the ratio of how
+ * long the device stays on an associated network channel ("service channel")
+ * vs. how long it's away from the service channel, i.e. tuned to other channels
+ * for scanning.
+ *
+ * max_out_time is the max time off-channel (in usec), and suspend_time
+ * is how long (in "extended beacon" format) that the scan is "suspended"
+ * after returning to the service channel. That is, suspend_time is the
+ * time that we stay on the service channel, doing normal work, between
+ * scan segments. The driver may set these parameters differently to support
+ * scanning when associated vs. not associated, and light vs. heavy traffic
+ * loads when associated.
+ *
+ * After receiving this command, the device's scan engine does the following;
+ *
+ * 1) Sends SCAN_START notification to driver
+ * 2) Checks to see if it has time to do scan for one channel
+ * 3) Sends NULL packet, with power-save (PS) bit set to 1,
+ * to tell AP that we're going off-channel
+ * 4) Tunes to first channel in scan list, does active or passive scan
+ * 5) Sends SCAN_RESULT notification to driver
+ * 6) Checks to see if it has time to do scan on *next* channel in list
+ * 7) Repeats 4-6 until it no longer has time to scan the next channel
+ * before max_out_time expires
+ * 8) Returns to service channel
+ * 9) Sends NULL packet with PS=0 to tell AP that we're back
+ * 10) Stays on service channel until suspend_time expires
+ * 11) Repeats entire process 2-10 until list is complete
+ * 12) Sends SCAN_COMPLETE notification
+ *
+ * For fast, efficient scans, the scan command also has support for staying on
+ * a channel for just a short time, if doing active scanning and getting no
+ * responses to the transmitted probe request. This time is controlled by
+ * quiet_time, and the number of received packets below which a channel is
+ * considered "quiet" is controlled by quiet_plcp_threshold.
+ *
+ * For active scanning on channels that have regulatory restrictions against
+ * blindly transmitting, the scan can listen before transmitting, to make sure
+ * that there is already legitimate activity on the channel. If enough
+ * packets are cleanly received on the channel (controlled by good_CRC_th,
+ * typical value 1), the scan engine starts transmitting probe requests.
+ *
+ * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
+ *
+ * To avoid uCode errors, see timing restrictions described under
+ * struct iwl4965_scan_channel.
*/
struct iwl4965_scan_cmd {
__le16 len;
u8 reserved0;
- u8 channel_count;
- __le16 quiet_time; /* dwell only this long on quiet chnl
- * (active scan) */
- __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
- __le16 good_CRC_th; /* passive -> active promotion threshold */
- __le16 rx_chain;
- __le32 max_out_time; /* max usec to be out of associated (service)
- * chnl */
- __le32 suspend_time; /* pause scan this long when returning to svc
- * chnl.
- * 3945 -- 31:24 # beacons, 19:0 additional usec,
- * 4965 -- 31:22 # beacons, 21:0 additional usec.
- */
- __le32 flags;
- __le32 filter_flags;
-
+ u8 channel_count; /* # channels in channel list */
+ __le16 quiet_time; /* dwell only this # millisecs on quiet channel
+ * (only for active scan) */
+ __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
+ __le16 good_CRC_th; /* passive -> active promotion threshold */
+ __le16 rx_chain; /* RXON_RX_CHAIN_* */
+ __le32 max_out_time; /* max usec to be away from associated (service)
+ * channel */
+ __le32 suspend_time; /* pause scan this long (in "extended beacon
+ * format") when returning to service chnl:
+ * 3945; 31:24 # beacons, 19:0 additional usec,
+ * 4965; 31:22 # beacons, 21:0 additional usec.
+ */
+ __le32 flags; /* RXON_FLG_* */
+ __le32 filter_flags; /* RXON_FILTER_* */
+
+ /* For active scans (set to all-0s for passive scans).
+ * Does not include payload. Must specify Tx rate; no rate scaling. */
struct iwl4965_tx_cmd tx_cmd;
+
+ /* For directed active scans (set to all-0s otherwise) */
struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
- u8 data[0];
/*
- * The channels start after the probe request payload and are of type:
+ * Probe request frame, followed by channel list.
+ *
+ * Size of probe request frame is specified by byte count in tx_cmd.
+ * Channel list follows immediately after probe request frame.
+ * Number of channels in list is specified by channel_count.
+ * Each channel in list is of type:
*
* struct iwl4965_scan_channel channels[0];
*
* NOTE: Only one band of channels can be scanned per pass. You
- * can not mix 2.4GHz channels and 5.2GHz channels and must
- * request a scan multiple times (not concurrently)
- *
+ * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
+ * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
+ * before requesting another scan.
*/
+ u8 data[0];
} __attribute__ ((packed));
/* Can abort will notify by complete notification with abort status. */
@@ -2087,7 +2176,7 @@ struct statistics_rx_non_phy {
__le32 interference_data_flag; /* flag for interference data
* availability. 1 when data is
* available. */
- __le32 channel_load; /* counts RX Enable time */
+ __le32 channel_load; /* counts RX Enable time in uSec */
__le32 dsp_false_alarms; /* DSP false alarm (both OFDM
* and CCK) counter */
__le32 beacon_rssi_a;
--
1.5.3.4
From: Tomas Winkler <[email protected]>
This patch adds iwl_free_fw_desc ucode helper function.
It also moves ucode helper functions to iwl-helpers.h.
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-helpers.h | 18 +++++++
drivers/net/wireless/iwlwifi/iwl3945-base.c | 66 +++++----------------------
drivers/net/wireless/iwlwifi/iwl4965-base.c | 65 +++++---------------------
3 files changed, 42 insertions(+), 107 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index 5228834..cd2eb18 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -257,4 +257,22 @@ static inline u8 iwl_get_dma_hi_address(dma_addr_t addr)
return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0;
}
+/* TODO: Move fw_desc functions to iwl-pci.ko */
+static inline void iwl_free_fw_desc(struct pci_dev *pci_dev,
+ struct fw_desc *desc)
+{
+ if (desc->v_addr)
+ pci_free_consistent(pci_dev, desc->len,
+ desc->v_addr, desc->p_addr);
+ desc->v_addr = NULL;
+ desc->len = 0;
+}
+
+static inline int iwl_alloc_fw_desc(struct pci_dev *pci_dev,
+ struct fw_desc *desc)
+{
+ desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr);
+ return (desc->v_addr != NULL) ? 0 : -ENOMEM;
+}
+
#endif /* __iwl_helpers_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index d5d40bf..c834e69 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -5479,48 +5479,12 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv)
static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
{
- if (priv->ucode_code.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_code.len,
- priv->ucode_code.v_addr,
- priv->ucode_code.p_addr);
- priv->ucode_code.v_addr = NULL;
- }
- if (priv->ucode_data.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_data.len,
- priv->ucode_data.v_addr,
- priv->ucode_data.p_addr);
- priv->ucode_data.v_addr = NULL;
- }
- if (priv->ucode_data_backup.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_data_backup.len,
- priv->ucode_data_backup.v_addr,
- priv->ucode_data_backup.p_addr);
- priv->ucode_data_backup.v_addr = NULL;
- }
- if (priv->ucode_init.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_init.len,
- priv->ucode_init.v_addr,
- priv->ucode_init.p_addr);
- priv->ucode_init.v_addr = NULL;
- }
- if (priv->ucode_init_data.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_init_data.len,
- priv->ucode_init_data.v_addr,
- priv->ucode_init_data.p_addr);
- priv->ucode_init_data.v_addr = NULL;
- }
- if (priv->ucode_boot.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_boot.len,
- priv->ucode_boot.v_addr,
- priv->ucode_boot.p_addr);
- priv->ucode_boot.v_addr = NULL;
- }
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
}
/**
@@ -5817,12 +5781,6 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv)
iwl3945_write32(priv, CSR_RESET, 0);
}
-static int iwl3945_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc)
-{
- desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr);
- return (desc->v_addr != NULL) ? 0 : -ENOMEM;
-}
-
/**
* iwl3945_read_ucode - Read uCode images from disk file.
*
@@ -5925,13 +5883,13 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
* 1) unmodified from disk
* 2) backup cache for save/restore during power-downs */
priv->ucode_code.len = inst_size;
- iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
priv->ucode_data.len = data_size;
- iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
priv->ucode_data_backup.len = data_size;
- iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
if (!priv->ucode_code.v_addr || !priv->ucode_data.v_addr ||
!priv->ucode_data_backup.v_addr)
@@ -5940,10 +5898,10 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
/* Initialization instructions and data */
if (init_size && init_data_size) {
priv->ucode_init.len = init_size;
- iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
priv->ucode_init_data.len = init_data_size;
- iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
goto err_pci_alloc;
@@ -5952,7 +5910,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
/* Bootstrap (instructions only, no data) */
if (boot_size) {
priv->ucode_boot.len = boot_size;
- iwl3945_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
if (!priv->ucode_boot.v_addr)
goto err_pci_alloc;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 621871d..ca7a175 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -5917,48 +5917,12 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv)
static void iwl4965_dealloc_ucode_pci(struct iwl4965_priv *priv)
{
- if (priv->ucode_code.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_code.len,
- priv->ucode_code.v_addr,
- priv->ucode_code.p_addr);
- priv->ucode_code.v_addr = NULL;
- }
- if (priv->ucode_data.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_data.len,
- priv->ucode_data.v_addr,
- priv->ucode_data.p_addr);
- priv->ucode_data.v_addr = NULL;
- }
- if (priv->ucode_data_backup.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_data_backup.len,
- priv->ucode_data_backup.v_addr,
- priv->ucode_data_backup.p_addr);
- priv->ucode_data_backup.v_addr = NULL;
- }
- if (priv->ucode_init.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_init.len,
- priv->ucode_init.v_addr,
- priv->ucode_init.p_addr);
- priv->ucode_init.v_addr = NULL;
- }
- if (priv->ucode_init_data.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_init_data.len,
- priv->ucode_init_data.v_addr,
- priv->ucode_init_data.p_addr);
- priv->ucode_init_data.v_addr = NULL;
- }
- if (priv->ucode_boot.v_addr != NULL) {
- pci_free_consistent(priv->pci_dev,
- priv->ucode_boot.len,
- priv->ucode_boot.v_addr,
- priv->ucode_boot.p_addr);
- priv->ucode_boot.v_addr = NULL;
- }
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_init_data);
+ iwl_free_fw_desc(priv->pci_dev, &priv->ucode_boot);
}
/**
@@ -6257,11 +6221,6 @@ static void iwl4965_nic_start(struct iwl4965_priv *priv)
iwl4965_write32(priv, CSR_RESET, 0);
}
-static int iwl4965_alloc_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc)
-{
- desc->v_addr = pci_alloc_consistent(pci_dev, desc->len, &desc->p_addr);
- return (desc->v_addr != NULL) ? 0 : -ENOMEM;
-}
/**
* iwl4965_read_ucode - Read uCode images from disk file.
@@ -6372,21 +6331,21 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv)
* 1) unmodified from disk
* 2) backup cache for save/restore during power-downs */
priv->ucode_code.len = inst_size;
- iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_code);
priv->ucode_data.len = data_size;
- iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data);
priv->ucode_data_backup.len = data_size;
- iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_data_backup);
/* Initialization instructions and data */
if (init_size && init_data_size) {
priv->ucode_init.len = init_size;
- iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init);
priv->ucode_init_data.len = init_data_size;
- iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_init_data);
if (!priv->ucode_init.v_addr || !priv->ucode_init_data.v_addr)
goto err_pci_alloc;
@@ -6395,7 +6354,7 @@ static int iwl4965_read_ucode(struct iwl4965_priv *priv)
/* Bootstrap (instructions only, no data) */
if (boot_size) {
priv->ucode_boot.len = boot_size;
- iwl4965_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
+ iwl_alloc_fw_desc(priv->pci_dev, &priv->ucode_boot);
if (!priv->ucode_boot.v_addr)
goto err_pci_alloc;
--
1.5.3.4
> +/**
> + * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
> + *
> + * One for each channel in the scan list.
> + * Each channel can independently select:
> + * 1) SSID for directed active scans
> + * 2) Txpower setting (for rate specified within Tx command)
> + * 3) How long to stay on-channel (behavior may be modified by quiet_time,
> + * quiet_plcp_th, good_CRC_th)
This reminds me. How did you arrive at the dwell time? With hostapd
running on b43 I've frequently seen the dwell time being too low:
iwl4965 will transmit a probe request and go to the next channel before
hostapd sends the probe response, iwl4965 still sees the response, but
the b43 card never sees the ACK because it's receiver isn't quite as
good as the iwl4965 receiver.
Are there any restrictions in IEEE 802.11 on how fast probe responses
must be transmitted?
johannes
From: Zhu Yi <[email protected]>
This patch moves the firmware loading (read firmware from disk and load
it into the device SRAM) from pci_probe time to the first network
interface open time. There are two reasons for doing this:
1. To support kernel buildin iwlwifi drivers. Because kernel initializes
network devices subsystem before hard disk and SATA subsystem, it is
impossible to get the firmware image from hard disk in the PCI probe
handler. Thus delaying the firmware loading into the network
interface open time is the way to go. Note, we only read the firmware
image from hard disk the first time the interface is open. After this
is succeeded, we cache the firmware image into the host memory. This
is a performance gain when user open and close the interface multiple
times and is necessary for device suspend and resume.
2. For better power saving. When the iwlwifi modules are loaded (or
buildin the kernel) but the wireless network interface is not being
used, it is a good practice the wireless device consumes as less
power as possible. Unloading the firmware from the wireless device
and unregister the driver's interrupt handler in the network
interface close handler provides users a way to achieve this. User
space network configuration tools (i.e NetworkManager) can also
contribute here when it detects a wired cable is connected and
close the wireless interface automatically.
This patch also includes the pci_save/restore_state() fixed by Ian Schram
upon the first version.
Signed-off-by: Zhu Yi <[email protected]>
Signed-off-by: Ian Schram <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945.c | 8 -
drivers/net/wireless/iwlwifi/iwl-4965.c | 5 -
drivers/net/wireless/iwlwifi/iwl3945-base.c | 183 +++++++++++++++-----------
drivers/net/wireless/iwlwifi/iwl4965-base.c | 187 ++++++++++++++++-----------
4 files changed, 217 insertions(+), 166 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 77e7202..0779a23 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -1004,14 +1004,6 @@ int iwl3945_hw_nic_init(struct iwl3945_priv *priv)
CSR_HW_IF_CONFIG_REG_BIT_ALMAGOR_MM);
}
- spin_unlock_irqrestore(&priv->lock, flags);
-
- /* Initialize the EEPROM */
- rc = iwl3945_eeprom_init(priv);
- if (rc)
- return rc;
-
- spin_lock_irqsave(&priv->lock, flags);
if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) {
IWL_DEBUG_INFO("SKU OP mode is mrc\n");
iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index e6a0397..5fcc2a6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -506,11 +506,6 @@ int iwl4965_hw_nic_init(struct iwl4965_priv *priv)
spin_unlock_irqrestore(&priv->lock, flags);
- /* Read the EEPROM */
- rc = iwl4965_eeprom_init(priv);
- if (rc)
- return rc;
-
if (priv->eeprom.calib_version < EEPROM_TX_POWER_VERSION_NEW) {
IWL_ERROR("Older EEPROM detected! Aborting.\n");
return -EINVAL;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index cb05ab5..1a01475 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6179,31 +6179,12 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
}
iwl3945_init_geos(priv);
+ iwl3945_reset_channel_flag(priv);
if (iwl3945_is_rfkill(priv))
return;
- if (!priv->mac80211_registered) {
- /* Unlock so any user space entry points can call back into
- * the driver without a deadlock... */
- mutex_unlock(&priv->mutex);
- iwl3945_rate_control_register(priv->hw);
- rc = ieee80211_register_hw(priv->hw);
- priv->hw->conf.beacon_int = 100;
- mutex_lock(&priv->mutex);
-
- if (rc) {
- iwl3945_rate_control_unregister(priv->hw);
- IWL_ERROR("Failed to register network "
- "device (error %d)\n", rc);
- return;
- }
-
- priv->mac80211_registered = 1;
-
- iwl3945_reset_channel_flag(priv);
- } else
- ieee80211_start_queues(priv->hw);
+ ieee80211_start_queues(priv->hw);
priv->active_rate = priv->rates_mask;
priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
@@ -6236,6 +6217,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
iwl3945_reg_txpower_periodic(priv);
IWL_DEBUG_INFO("ALIVE processing complete.\n");
+ wake_up_interruptible(&priv->wait_command_queue);
if (priv->error_recovering)
iwl3945_error_recovery(priv);
@@ -6348,7 +6330,6 @@ static void iwl3945_down(struct iwl3945_priv *priv)
static int __iwl3945_up(struct iwl3945_priv *priv)
{
- DECLARE_MAC_BUF(mac);
int rc, i;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
@@ -6387,7 +6368,7 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
* This will be used to initialize the on-board processor's
* data SRAM for a clean start when the runtime program first loads. */
memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr,
- priv->ucode_data.len);
+ priv->ucode_data.len);
for (i = 0; i < MAX_HW_RESTARTS; i++) {
@@ -6406,13 +6387,6 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
/* start card; "initialize" will load runtime ucode */
iwl3945_nic_start(priv);
- /* MAC Address location in EEPROM is same for 3945/4965 */
- get_eeprom_mac(priv, priv->mac_addr);
- IWL_DEBUG_INFO("MAC address: %s\n",
- print_mac(mac, priv->mac_addr));
-
- SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
-
IWL_DEBUG_INFO(DRV_NAME " is coming up\n");
return 0;
@@ -6901,23 +6875,73 @@ static void iwl3945_bg_scan_completed(struct work_struct *work)
*
*****************************************************************************/
+#define UCODE_READY_TIMEOUT (2 * HZ)
+
static int iwl3945_mac_start(struct ieee80211_hw *hw)
{
struct iwl3945_priv *priv = hw->priv;
+ int ret;
IWL_DEBUG_MAC80211("enter\n");
+ if (pci_enable_device(priv->pci_dev)) {
+ IWL_ERROR("Fail to pci_enable_device\n");
+ return -ENODEV;
+ }
+ pci_restore_state(priv->pci_dev);
+ pci_enable_msi(priv->pci_dev);
+
+ ret = request_irq(priv->pci_dev->irq, iwl3945_isr, IRQF_SHARED,
+ DRV_NAME, priv);
+ if (ret) {
+ IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq);
+ goto out_disable_msi;
+ }
+
/* we should be verifying the device is ready to be opened */
mutex_lock(&priv->mutex);
- priv->is_open = 1;
+ memset(&priv->staging_rxon, 0, sizeof(struct iwl3945_rxon_cmd));
+ /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
+ * ucode filename and max sizes are card-specific. */
- if (!iwl3945_is_rfkill(priv))
- ieee80211_start_queues(priv->hw);
+ if (!priv->ucode_code.len) {
+ ret = iwl3945_read_ucode(priv);
+ if (ret) {
+ IWL_ERROR("Could not read microcode: %d\n", ret);
+ mutex_unlock(&priv->mutex);
+ goto out_release_irq;
+ }
+ }
+ IWL_DEBUG_INFO("Start UP work.\n");
+ __iwl3945_up(priv);
+
+ priv->is_open = 1;
mutex_unlock(&priv->mutex);
+
+ /* Wait for START_ALIVE from ucode. Otherwise callbacks from
+ * mac80211 will not be run successfully. */
+ ret = wait_event_interruptible_timeout(priv->wait_command_queue,
+ test_bit(STATUS_READY, &priv->status),
+ UCODE_READY_TIMEOUT);
+ if (!ret) {
+ if (!test_bit(STATUS_READY, &priv->status)) {
+ IWL_ERROR("Wait for START_ALIVE timeout after %dms.\n",
+ jiffies_to_msecs(UCODE_READY_TIMEOUT));
+ ret = -ETIMEDOUT;
+ goto out_release_irq;
+ }
+ }
+
IWL_DEBUG_MAC80211("leave\n");
return 0;
+
+out_release_irq:
+ free_irq(priv->pci_dev->irq, priv);
+out_disable_msi:
+ pci_disable_msi(priv->pci_dev);
+ return ret;
}
static void iwl3945_mac_stop(struct ieee80211_hw *hw)
@@ -6926,23 +6950,25 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
IWL_DEBUG_MAC80211("enter\n");
-
- mutex_lock(&priv->mutex);
/* stop mac, cancel any scan request and clear
* RXON_FILTER_ASSOC_MSK BIT
*/
priv->is_open = 0;
- if (!iwl3945_is_ready_rf(priv)) {
- IWL_DEBUG_MAC80211("leave - RF not ready\n");
+
+ if (iwl3945_is_ready_rf(priv)) {
+ mutex_lock(&priv->mutex);
+ iwl3945_scan_cancel_timeout(priv, 100);
+ cancel_delayed_work(&priv->post_associate);
mutex_unlock(&priv->mutex);
- return;
}
- iwl3945_scan_cancel_timeout(priv, 100);
- cancel_delayed_work(&priv->post_associate);
- priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
- iwl3945_commit_rxon(priv);
- mutex_unlock(&priv->mutex);
+ iwl3945_down(priv);
+
+ flush_workqueue(priv->workqueue);
+ free_irq(priv->pci_dev->irq, priv);
+ pci_disable_msi(priv->pci_dev);
+ pci_save_state(priv->pci_dev);
+ pci_disable_device(priv->pci_dev);
IWL_DEBUG_MAC80211("leave\n");
}
@@ -6995,11 +7021,12 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
}
- iwl3945_set_mode(priv, conf->type);
+ if (iwl3945_is_ready(priv))
+ iwl3945_set_mode(priv, conf->type);
- IWL_DEBUG_MAC80211("leave\n");
mutex_unlock(&priv->mutex);
+ IWL_DEBUG_MAC80211("leave\n");
return 0;
}
@@ -7173,6 +7200,9 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
return 0;
}
+ if (!iwl3945_is_alive(priv))
+ return -EAGAIN;
+
mutex_lock(&priv->mutex);
if (conf->bssid)
@@ -8385,6 +8415,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
struct iwl3945_priv *priv;
struct ieee80211_hw *hw;
int i;
+ DECLARE_MAC_BUF(mac);
/* Disabling hardware scan means that mac80211 will perform scans
* "the hard way", rather than using device's scan. */
@@ -8537,7 +8568,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
/* Device-specific setup */
if (iwl3945_hw_set_hw_setting(priv)) {
IWL_ERROR("failed to set hw settings\n");
- mutex_unlock(&priv->mutex);
goto out_iounmap;
}
@@ -8562,50 +8592,53 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
iwl3945_disable_interrupts(priv);
- pci_enable_msi(pdev);
-
- err = request_irq(pdev->irq, iwl3945_isr, IRQF_SHARED, DRV_NAME, priv);
- if (err) {
- IWL_ERROR("Error allocating IRQ %d\n", pdev->irq);
- goto out_disable_msi;
- }
-
- mutex_lock(&priv->mutex);
-
err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group);
if (err) {
IWL_ERROR("failed to create sysfs device attributes\n");
- mutex_unlock(&priv->mutex);
goto out_release_irq;
}
- /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
- * ucode filename and max sizes are card-specific. */
- err = iwl3945_read_ucode(priv);
+ /* nic init */
+ iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
+ CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
+
+ iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+ err = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
+ CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
+ CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
+ if (err < 0) {
+ IWL_DEBUG_INFO("Failed to init the card\n");
+ goto out_remove_sysfs;
+ }
+ /* Read the EEPROM */
+ err = iwl3945_eeprom_init(priv);
if (err) {
- IWL_ERROR("Could not read microcode: %d\n", err);
- mutex_unlock(&priv->mutex);
- goto out_pci_alloc;
+ IWL_ERROR("Unable to init EEPROM\n");
+ goto out_remove_sysfs;
}
+ /* MAC Address location in EEPROM same for 3945/4965 */
+ get_eeprom_mac(priv, priv->mac_addr);
+ IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr));
+ SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
- mutex_unlock(&priv->mutex);
-
- IWL_DEBUG_INFO("Queueing UP work.\n");
+ iwl3945_rate_control_register(priv->hw);
+ err = ieee80211_register_hw(priv->hw);
+ if (err) {
+ IWL_ERROR("Failed to register network device (error %d)\n", err);
+ goto out_remove_sysfs;
+ }
- queue_work(priv->workqueue, &priv->up);
+ priv->hw->conf.beacon_int = 100;
+ priv->mac80211_registered = 1;
+ pci_save_state(pdev);
+ pci_disable_device(pdev);
return 0;
- out_pci_alloc:
- iwl3945_dealloc_ucode_pci(priv);
-
+ out_remove_sysfs:
sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
out_release_irq:
- free_irq(pdev->irq, priv);
-
- out_disable_msi:
- pci_disable_msi(pdev);
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
iwl3945_unset_hw_setting(priv);
@@ -8671,8 +8704,6 @@ static void iwl3945_pci_remove(struct pci_dev *pdev)
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
- free_irq(pdev->irq, priv);
- pci_disable_msi(pdev);
pci_iounmap(pdev, priv->hw_base);
pci_release_regions(pdev);
pci_disable_device(pdev);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 4d3ae28..090f883 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6608,31 +6608,12 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv)
}
iwl4965_init_geos(priv);
+ iwl4965_reset_channel_flag(priv);
if (iwl4965_is_rfkill(priv))
return;
- if (!priv->mac80211_registered) {
- /* Unlock so any user space entry points can call back into
- * the driver without a deadlock... */
- mutex_unlock(&priv->mutex);
- iwl4965_rate_control_register(priv->hw);
- rc = ieee80211_register_hw(priv->hw);
- priv->hw->conf.beacon_int = 100;
- mutex_lock(&priv->mutex);
-
- if (rc) {
- iwl4965_rate_control_unregister(priv->hw);
- IWL_ERROR("Failed to register network "
- "device (error %d)\n", rc);
- return;
- }
-
- priv->mac80211_registered = 1;
-
- iwl4965_reset_channel_flag(priv);
- } else
- ieee80211_start_queues(priv->hw);
+ ieee80211_start_queues(priv->hw);
priv->active_rate = priv->rates_mask;
priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
@@ -6663,7 +6644,9 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv)
set_bit(STATUS_READY, &priv->status);
iwl4965_rf_kill_ct_config(priv);
+
IWL_DEBUG_INFO("ALIVE processing complete.\n");
+ wake_up_interruptible(&priv->wait_command_queue);
if (priv->error_recovering)
iwl4965_error_recovery(priv);
@@ -6777,7 +6760,6 @@ static void iwl4965_down(struct iwl4965_priv *priv)
static int __iwl4965_up(struct iwl4965_priv *priv)
{
- DECLARE_MAC_BUF(mac);
int rc, i;
u32 hw_rf_kill = 0;
@@ -6817,7 +6799,7 @@ static int __iwl4965_up(struct iwl4965_priv *priv)
* This will be used to initialize the on-board processor's
* data SRAM for a clean start when the runtime program first loads. */
memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr,
- priv->ucode_data.len);
+ priv->ucode_data.len);
/* If platform's RF_KILL switch is set to KILL,
* wait for BIT_INT_RF_KILL interrupt before loading uCode
@@ -6848,13 +6830,6 @@ static int __iwl4965_up(struct iwl4965_priv *priv)
/* start card; "initialize" will load runtime ucode */
iwl4965_nic_start(priv);
- /* MAC Address location in EEPROM is same for 3945/4965 */
- get_eeprom_mac(priv, priv->mac_addr);
- IWL_DEBUG_INFO("MAC address: %s\n",
- print_mac(mac, priv->mac_addr));
-
- SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
-
IWL_DEBUG_INFO(DRV_NAME " is coming up\n");
return 0;
@@ -7360,23 +7335,73 @@ static void iwl4965_bg_scan_completed(struct work_struct *work)
*
*****************************************************************************/
+#define UCODE_READY_TIMEOUT (2 * HZ)
+
static int iwl4965_mac_start(struct ieee80211_hw *hw)
{
struct iwl4965_priv *priv = hw->priv;
+ int ret;
IWL_DEBUG_MAC80211("enter\n");
+ if (pci_enable_device(priv->pci_dev)) {
+ IWL_ERROR("Fail to pci_enable_device\n");
+ return -ENODEV;
+ }
+ pci_restore_state(priv->pci_dev);
+ pci_enable_msi(priv->pci_dev);
+
+ ret = request_irq(priv->pci_dev->irq, iwl4965_isr, IRQF_SHARED,
+ DRV_NAME, priv);
+ if (ret) {
+ IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq);
+ goto out_disable_msi;
+ }
+
/* we should be verifying the device is ready to be opened */
mutex_lock(&priv->mutex);
- priv->is_open = 1;
+ memset(&priv->staging_rxon, 0, sizeof(struct iwl4965_rxon_cmd));
+ /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
+ * ucode filename and max sizes are card-specific. */
- if (!iwl4965_is_rfkill(priv))
- ieee80211_start_queues(priv->hw);
+ if (!priv->ucode_code.len) {
+ ret = iwl4965_read_ucode(priv);
+ if (ret) {
+ IWL_ERROR("Could not read microcode: %d\n", ret);
+ mutex_unlock(&priv->mutex);
+ goto out_release_irq;
+ }
+ }
+ IWL_DEBUG_INFO("Start UP work.\n");
+ __iwl4965_up(priv);
+
+ priv->is_open = 1;
mutex_unlock(&priv->mutex);
+
+ /* Wait for START_ALIVE from ucode. Otherwise callbacks from
+ * mac80211 will not be run successfully. */
+ ret = wait_event_interruptible_timeout(priv->wait_command_queue,
+ test_bit(STATUS_READY, &priv->status),
+ UCODE_READY_TIMEOUT);
+ if (!ret) {
+ if (!test_bit(STATUS_READY, &priv->status)) {
+ IWL_ERROR("Wait for START_ALIVE timeout after %dms.\n",
+ jiffies_to_msecs(UCODE_READY_TIMEOUT));
+ ret = -ETIMEDOUT;
+ goto out_release_irq;
+ }
+ }
+
IWL_DEBUG_MAC80211("leave\n");
return 0;
+
+out_release_irq:
+ free_irq(priv->pci_dev->irq, priv);
+out_disable_msi:
+ pci_disable_msi(priv->pci_dev);
+ return ret;
}
static void iwl4965_mac_stop(struct ieee80211_hw *hw)
@@ -7385,23 +7410,25 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
IWL_DEBUG_MAC80211("enter\n");
-
- mutex_lock(&priv->mutex);
/* stop mac, cancel any scan request and clear
* RXON_FILTER_ASSOC_MSK BIT
*/
priv->is_open = 0;
- if (!iwl4965_is_ready_rf(priv)) {
- IWL_DEBUG_MAC80211("leave - RF not ready\n");
+
+ if (iwl4965_is_ready_rf(priv)) {
+ mutex_lock(&priv->mutex);
+ iwl4965_scan_cancel_timeout(priv, 100);
+ cancel_delayed_work(&priv->post_associate);
mutex_unlock(&priv->mutex);
- return;
}
- iwl4965_scan_cancel_timeout(priv, 100);
- cancel_delayed_work(&priv->post_associate);
- priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
- iwl4965_commit_rxon(priv);
- mutex_unlock(&priv->mutex);
+ iwl4965_down(priv);
+
+ flush_workqueue(priv->workqueue);
+ free_irq(priv->pci_dev->irq, priv);
+ pci_disable_msi(priv->pci_dev);
+ pci_save_state(priv->pci_dev);
+ pci_disable_device(priv->pci_dev);
IWL_DEBUG_MAC80211("leave\n");
}
@@ -7453,11 +7480,13 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
IWL_DEBUG_MAC80211("Set %s\n", print_mac(mac, conf->mac_addr));
memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
}
- iwl4965_set_mode(priv, conf->type);
- IWL_DEBUG_MAC80211("leave\n");
+ if (iwl4965_is_ready(priv))
+ iwl4965_set_mode(priv, conf->type);
+
mutex_unlock(&priv->mutex);
+ IWL_DEBUG_MAC80211("leave\n");
return 0;
}
@@ -7559,9 +7588,9 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
IWL_DEBUG_MAC80211("leave\n");
- mutex_unlock(&priv->mutex);
out:
clear_bit(STATUS_CONF_PENDING, &priv->status);
+ mutex_unlock(&priv->mutex);
return ret;
}
@@ -7646,6 +7675,9 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw,
return 0;
}
+ if (!iwl4965_is_alive(priv))
+ return -EAGAIN;
+
mutex_lock(&priv->mutex);
if (conf->bssid)
@@ -8990,6 +9022,7 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
struct iwl4965_priv *priv;
struct ieee80211_hw *hw;
int i;
+ DECLARE_MAC_BUF(mac);
/* Disabling hardware scan means that mac80211 will perform scans
* "the hard way", rather than using device's scan. */
@@ -9131,7 +9164,6 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
/* Device-specific setup */
if (iwl4965_hw_set_hw_setting(priv)) {
IWL_ERROR("failed to set hw settings\n");
- mutex_unlock(&priv->mutex);
goto out_iounmap;
}
@@ -9156,50 +9188,53 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
iwl4965_disable_interrupts(priv);
- pci_enable_msi(pdev);
-
- err = request_irq(pdev->irq, iwl4965_isr, IRQF_SHARED, DRV_NAME, priv);
- if (err) {
- IWL_ERROR("Error allocating IRQ %d\n", pdev->irq);
- goto out_disable_msi;
- }
-
- mutex_lock(&priv->mutex);
-
err = sysfs_create_group(&pdev->dev.kobj, &iwl4965_attribute_group);
if (err) {
IWL_ERROR("failed to create sysfs device attributes\n");
- mutex_unlock(&priv->mutex);
goto out_release_irq;
}
- /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
- * ucode filename and max sizes are card-specific. */
- err = iwl4965_read_ucode(priv);
+ /* nic init */
+ iwl4965_set_bit(priv, CSR_GIO_CHICKEN_BITS,
+ CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
+
+ iwl4965_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+ err = iwl4965_poll_bit(priv, CSR_GP_CNTRL,
+ CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
+ CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
+ if (err < 0) {
+ IWL_DEBUG_INFO("Failed to init the card\n");
+ goto out_remove_sysfs;
+ }
+ /* Read the EEPROM */
+ err = iwl4965_eeprom_init(priv);
if (err) {
- IWL_ERROR("Could not read microcode: %d\n", err);
- mutex_unlock(&priv->mutex);
- goto out_pci_alloc;
+ IWL_ERROR("Unable to init EEPROM\n");
+ goto out_remove_sysfs;
}
+ /* MAC Address location in EEPROM same for 3945/4965 */
+ get_eeprom_mac(priv, priv->mac_addr);
+ IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr));
+ SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
- mutex_unlock(&priv->mutex);
-
- IWL_DEBUG_INFO("Queueing UP work.\n");
+ iwl4965_rate_control_register(priv->hw);
+ err = ieee80211_register_hw(priv->hw);
+ if (err) {
+ IWL_ERROR("Failed to register network device (error %d)\n", err);
+ goto out_remove_sysfs;
+ }
- queue_work(priv->workqueue, &priv->up);
+ priv->hw->conf.beacon_int = 100;
+ priv->mac80211_registered = 1;
+ pci_save_state(pdev);
+ pci_disable_device(pdev);
return 0;
- out_pci_alloc:
- iwl4965_dealloc_ucode_pci(priv);
-
+ out_remove_sysfs:
sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
out_release_irq:
- free_irq(pdev->irq, priv);
-
- out_disable_msi:
- pci_disable_msi(pdev);
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
iwl4965_unset_hw_setting(priv);
@@ -9265,8 +9300,6 @@ static void iwl4965_pci_remove(struct pci_dev *pdev)
destroy_workqueue(priv->workqueue);
priv->workqueue = NULL;
- free_irq(pdev->irq, priv);
- pci_disable_msi(pdev);
pci_iounmap(pdev, priv->hw_base);
pci_release_regions(pdev);
pci_disable_device(pdev);
--
1.5.3.4
> -----Original Message-----
> From: Johannes Berg [mailto:[email protected]]
> Sent: Friday, January 18, 2008 3:40 PM
> To: Cahill, Ben M
> Cc: Chatre, Reinette; [email protected];
> [email protected]; Zhu, Yi
> Subject: RE: [PATCH 04/12] iwlwifi: document scan command
>
>
> > > iwl4965 will transmit a probe request and go to the next channel
> > > before hostapd sends the probe response, iwl4965 still sees the
> > > response, but the b43 card never sees the ACK because
> it's receiver
> > > isn't quite as good as the iwl4965 receiver.
> >
> > I'm not sure of the history of the dwell time values, but it's an
> > attempt to balance reliability of scan vs. speed of scan.
> The active
> > dwell times are, of course, more speed-aggressive than the
> passive ones.
> > Would you be willing to experiment with your setup, and try some
> > different values?
>
> Sure, can do that next week, do I just change the defines at
> the top of the file?
Yes.
-- Ben --
>
> johannes
>
> -----Original Message-----
> From: Johannes Berg [mailto:[email protected]]
> Sent: Tuesday, January 15, 2008 7:03 PM
> To: Chatre, Reinette
> Cc: [email protected]; [email protected];
> Cahill, Ben M; Zhu, Yi
> Subject: Re: [PATCH 04/12] iwlwifi: document scan command
>
>
> > +/**
> > + * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel
> > +table
> > + *
> > + * One for each channel in the scan list.
> > + * Each channel can independently select:
> > + * 1) SSID for directed active scans
> > + * 2) Txpower setting (for rate specified within Tx command)
> > + * 3) How long to stay on-channel (behavior may be
> modified by quiet_time,
> > + * quiet_plcp_th, good_CRC_th)
>
> This reminds me. How did you arrive at the dwell time? With
> hostapd running on b43 I've frequently seen the dwell time
> being too low:
>
> iwl4965 will transmit a probe request and go to the next
> channel before hostapd sends the probe response, iwl4965
> still sees the response, but the b43 card never sees the ACK
> because it's receiver isn't quite as good as the iwl4965 receiver.
I'm not sure of the history of the dwell time values, but it's an
attempt to balance reliability of scan vs. speed of scan. The active
dwell times are, of course, more speed-aggressive than the passive ones.
Would you be willing to experiment with your setup, and try some
different values?
-- Ben --
> johannes
>
From: Tomas Winkler <[email protected]>
This function removes redundant code in iwl4965_tx_cmd
function, leftovers of previous design.
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965.c | 23 +----------------------
1 files changed, 1 insertions(+), 22 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index ed3f119..b913c6b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -3267,8 +3267,7 @@ int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
struct ieee80211_hdr *hdr, u8 hdr_len,
struct ieee80211_tx_control *ctrl, void *sta_in)
{
- struct iwl4965_tx_cmd cmd;
- struct iwl4965_tx_cmd *tx = (struct iwl4965_tx_cmd *)&out_cmd->cmd.payload[0];
+ struct iwl4965_tx_cmd *tx = &out_cmd->cmd.tx;
dma_addr_t scratch_phys;
u8 unicast = 0;
u8 is_data = 1;
@@ -3287,26 +3286,6 @@ int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)
is_data = 0;
- memcpy(&cmd, &(out_cmd->cmd.tx), sizeof(struct iwl4965_tx_cmd));
- memset(tx, 0, sizeof(struct iwl4965_tx_cmd));
- memcpy(tx->hdr, hdr, hdr_len);
-
- tx->len = cmd.len;
- tx->driver_txop = cmd.driver_txop;
- tx->stop_time.life_time = cmd.stop_time.life_time;
- tx->tx_flags = cmd.tx_flags;
- tx->sta_id = cmd.sta_id;
- tx->tid_tspec = cmd.tid_tspec;
- tx->timeout.pm_frame_timeout = cmd.timeout.pm_frame_timeout;
- tx->next_frame_len = cmd.next_frame_len;
-
- tx->sec_ctl = cmd.sec_ctl;
- memcpy(&(tx->key[0]), &(cmd.key[0]), 16);
- tx->tx_flags = cmd.tx_flags;
-
- tx->rts_retry_limit = cmd.rts_retry_limit;
- tx->data_retry_limit = cmd.data_retry_limit;
-
scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
offsetof(struct iwl4965_tx_cmd, scratch);
tx->dram_lsb_ptr = cpu_to_le32(scratch_phys);
--
1.5.3.4
The external iwlwifi driver comes with a README file that is
referenced by the Kconfig. This README is not present in the
driver included in the kernel. Remove references to this
documentation.
Signed-off-by: Reinette Chatre <[email protected]>
Acked-by: Tomas Winkler <[email protected]>
---
drivers/net/wireless/iwlwifi/Kconfig | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 66ca942..d1af938 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -9,17 +9,15 @@ config IWL4965
This driver uses the kernel's mac80211 subsystem.
- See <file:Documentation/networking/README.iwlwifi> for
- information on the capabilities currently enabled in this
- driver and for tips for debugging any issues or problems.
-
In order to use this driver, you will need a microcode (uCode)
image for it. You can obtain the microcode from:
<http://intellinuxwireless.org/>.
- See the above referenced README.iwlwifi for information on where
- to install the microcode images.
+ The microcode is typically installed in /lib/firmware. You can
+ look in the hotplug script /etc/hotplug/firmware.agent to
+ determine which directory FIRMWARE_DIR is set to when the script
+ runs.
If you want to compile the driver as a module ( = code which can be
inserted in and remvoed from the running kernel whenever you want),
@@ -92,17 +90,15 @@ config IWL3945
This driver uses the kernel's mac80211 subsystem.
- See <file:Documentation/networking/README.iwlwifi> for
- information on the capabilities currently enabled in this
- driver and for tips for debugging any issues or problems.
-
In order to use this driver, you will need a microcode (uCode)
image for it. You can obtain the microcode from:
<http://intellinuxwireless.org/>.
- See the above referenced README.iwlwifi for information on where
- to install the microcode images.
+ The microcode is typically installed in /lib/firmware. You can
+ look in the hotplug script /etc/hotplug/firmware.agent to
+ determine which directory FIRMWARE_DIR is set to when the script
+ runs.
If you want to compile the driver as a module ( = code which can be
inserted in and remvoed from the running kernel whenever you want),
--
1.5.3.4
From: Zhu Yi <[email protected]>
After we delay device initialization until interface up, there are more
conditions for the hardware rf_kill switch states during suspend and
resume. For example, before suspend we can have interface up or down,
rf_kill enable or disable; before resume we can have rf_kill enable or
disable. So there are totally 2^3 = 8 conditions to handle. This patch
addressed this problem and makes sure every condition works correctly.
This patch also merges the device suspend and resume handlers with the
mac_start and mac_stop code since they are basically doing the same
thing.
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl3945-base.c | 124 +++++++++----------------
drivers/net/wireless/iwlwifi/iwl4965-base.c | 133 +++++++++------------------
2 files changed, 90 insertions(+), 167 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 1a01475..d5d40bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6340,7 +6340,19 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
IWL_WARNING("Radio disabled by SW RF kill (module "
"parameter)\n");
- return 0;
+ return -ENODEV;
+ }
+
+ /* If platform's RF_KILL switch is NOT set to KILL */
+ if (iwl3945_read32(priv, CSR_GP_CNTRL) &
+ CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
+ clear_bit(STATUS_RF_KILL_HW, &priv->status);
+ else {
+ set_bit(STATUS_RF_KILL_HW, &priv->status);
+ if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) {
+ IWL_WARNING("Radio disabled by HW RF Kill switch\n");
+ return -ENODEV;
+ }
}
iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
@@ -6370,6 +6382,10 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr,
priv->ucode_data.len);
+ /* We return success when we resume from suspend and rf_kill is on. */
+ if (test_bit(STATUS_RF_KILL_HW, &priv->status))
+ return 0;
+
for (i = 0; i < MAX_HW_RESTARTS; i++) {
iwl3945_clear_stations_table(priv);
@@ -6914,12 +6930,18 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
}
}
- IWL_DEBUG_INFO("Start UP work.\n");
- __iwl3945_up(priv);
+ ret = __iwl3945_up(priv);
- priv->is_open = 1;
mutex_unlock(&priv->mutex);
+ if (ret)
+ goto out_release_irq;
+
+ IWL_DEBUG_INFO("Start UP work.\n");
+
+ if (test_bit(STATUS_IN_SUSPEND, &priv->status))
+ return 0;
+
/* Wait for START_ALIVE from ucode. Otherwise callbacks from
* mac80211 will not be run successfully. */
ret = wait_event_interruptible_timeout(priv->wait_command_queue,
@@ -6934,6 +6956,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
}
}
+ priv->is_open = 1;
IWL_DEBUG_MAC80211("leave\n");
return 0;
@@ -6941,6 +6964,9 @@ out_release_irq:
free_irq(priv->pci_dev->irq, priv);
out_disable_msi:
pci_disable_msi(priv->pci_dev);
+ pci_disable_device(priv->pci_dev);
+ priv->is_open = 0;
+ IWL_DEBUG_MAC80211("leave - failed\n");
return ret;
}
@@ -6950,12 +6976,17 @@ static void iwl3945_mac_stop(struct ieee80211_hw *hw)
IWL_DEBUG_MAC80211("enter\n");
- /* stop mac, cancel any scan request and clear
- * RXON_FILTER_ASSOC_MSK BIT
- */
+ if (!priv->is_open) {
+ IWL_DEBUG_MAC80211("leave - skip\n");
+ return;
+ }
+
priv->is_open = 0;
if (iwl3945_is_ready_rf(priv)) {
+ /* stop mac, cancel any scan request and clear
+ * RXON_FILTER_ASSOC_MSK BIT
+ */
mutex_lock(&priv->mutex);
iwl3945_scan_cancel_timeout(priv, 100);
cancel_delayed_work(&priv->post_associate);
@@ -7329,7 +7360,6 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
mutex_unlock(&priv->mutex);
IWL_DEBUG_MAC80211("leave\n");
-
}
static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
@@ -8726,89 +8756,27 @@ static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct iwl3945_priv *priv = pci_get_drvdata(pdev);
- set_bit(STATUS_IN_SUSPEND, &priv->status);
-
- /* Take down the device; powers it off, etc. */
- iwl3945_down(priv);
-
- if (priv->mac80211_registered)
- ieee80211_stop_queues(priv->hw);
+ if (priv->is_open) {
+ set_bit(STATUS_IN_SUSPEND, &priv->status);
+ iwl3945_mac_stop(priv->hw);
+ priv->is_open = 1;
+ }
- pci_save_state(pdev);
- pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
return 0;
}
-static void iwl3945_resume(struct iwl3945_priv *priv)
-{
- unsigned long flags;
-
- /* The following it a temporary work around due to the
- * suspend / resume not fully initializing the NIC correctly.
- * Without all of the following, resume will not attempt to take
- * down the NIC (it shouldn't really need to) and will just try
- * and bring the NIC back up. However that fails during the
- * ucode verification process. This then causes iwl3945_down to be
- * called *after* iwl3945_hw_nic_init() has succeeded -- which
- * then lets the next init sequence succeed. So, we've
- * replicated all of that NIC init code here... */
-
- iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
-
- iwl3945_hw_nic_init(priv);
-
- iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
- iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR,
- CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
- iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
- iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
- iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
-
- /* tell the device to stop sending interrupts */
- iwl3945_disable_interrupts(priv);
-
- spin_lock_irqsave(&priv->lock, flags);
- iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-
- if (!iwl3945_grab_nic_access(priv)) {
- iwl3945_write_prph(priv, APMG_CLK_DIS_REG,
- APMG_CLK_VAL_DMA_CLK_RQT);
- iwl3945_release_nic_access(priv);
- }
- spin_unlock_irqrestore(&priv->lock, flags);
-
- udelay(5);
-
- iwl3945_hw_nic_reset(priv);
-
- /* Bring the device back up */
- clear_bit(STATUS_IN_SUSPEND, &priv->status);
- queue_work(priv->workqueue, &priv->up);
-}
-
static int iwl3945_pci_resume(struct pci_dev *pdev)
{
struct iwl3945_priv *priv = pci_get_drvdata(pdev);
- int err;
-
- printk(KERN_INFO "Coming out of suspend...\n");
pci_set_power_state(pdev, PCI_D0);
- err = pci_enable_device(pdev);
- pci_restore_state(pdev);
- /*
- * Suspend/Resume resets the PCI configuration space, so we have to
- * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
- * from interfering with C3 CPU state. pci_restore_state won't help
- * here since it only restores the first 64 bytes pci config header.
- */
- pci_write_config_byte(pdev, 0x41, 0x00);
-
- iwl3945_resume(priv);
+ if (priv->is_open)
+ iwl3945_mac_start(priv->hw);
+ clear_bit(STATUS_IN_SUSPEND, &priv->status);
return 0;
}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 090f883..621871d 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6761,7 +6761,6 @@ static void iwl4965_down(struct iwl4965_priv *priv)
static int __iwl4965_up(struct iwl4965_priv *priv)
{
int rc, i;
- u32 hw_rf_kill = 0;
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
IWL_WARNING("Exit pending; will not bring the NIC up\n");
@@ -6771,7 +6770,19 @@ static int __iwl4965_up(struct iwl4965_priv *priv)
if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
IWL_WARNING("Radio disabled by SW RF kill (module "
"parameter)\n");
- return 0;
+ return -ENODEV;
+ }
+
+ /* If platform's RF_KILL switch is NOT set to KILL */
+ if (iwl4965_read32(priv, CSR_GP_CNTRL) &
+ CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
+ clear_bit(STATUS_RF_KILL_HW, &priv->status);
+ else {
+ set_bit(STATUS_RF_KILL_HW, &priv->status);
+ if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) {
+ IWL_WARNING("Radio disabled by HW RF Kill switch\n");
+ return -ENODEV;
+ }
}
iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
@@ -6801,17 +6812,9 @@ static int __iwl4965_up(struct iwl4965_priv *priv)
memcpy(priv->ucode_data_backup.v_addr, priv->ucode_data.v_addr,
priv->ucode_data.len);
- /* If platform's RF_KILL switch is set to KILL,
- * wait for BIT_INT_RF_KILL interrupt before loading uCode
- * and getting things started */
- if (!(iwl4965_read32(priv, CSR_GP_CNTRL) &
- CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
- hw_rf_kill = 1;
-
- if (test_bit(STATUS_RF_KILL_HW, &priv->status) || hw_rf_kill) {
- IWL_WARNING("Radio disabled by HW RF Kill switch\n");
+ /* We return success when we resume from suspend and rf_kill is on. */
+ if (test_bit(STATUS_RF_KILL_HW, &priv->status))
return 0;
- }
for (i = 0; i < MAX_HW_RESTARTS; i++) {
@@ -7374,12 +7377,18 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
}
}
- IWL_DEBUG_INFO("Start UP work.\n");
- __iwl4965_up(priv);
+ ret = __iwl4965_up(priv);
- priv->is_open = 1;
mutex_unlock(&priv->mutex);
+ if (ret)
+ goto out_release_irq;
+
+ IWL_DEBUG_INFO("Start UP work done.\n");
+
+ if (test_bit(STATUS_IN_SUSPEND, &priv->status))
+ return 0;
+
/* Wait for START_ALIVE from ucode. Otherwise callbacks from
* mac80211 will not be run successfully. */
ret = wait_event_interruptible_timeout(priv->wait_command_queue,
@@ -7394,6 +7403,7 @@ static int iwl4965_mac_start(struct ieee80211_hw *hw)
}
}
+ priv->is_open = 1;
IWL_DEBUG_MAC80211("leave\n");
return 0;
@@ -7401,6 +7411,9 @@ out_release_irq:
free_irq(priv->pci_dev->irq, priv);
out_disable_msi:
pci_disable_msi(priv->pci_dev);
+ pci_disable_device(priv->pci_dev);
+ priv->is_open = 0;
+ IWL_DEBUG_MAC80211("leave - failed\n");
return ret;
}
@@ -7410,12 +7423,17 @@ static void iwl4965_mac_stop(struct ieee80211_hw *hw)
IWL_DEBUG_MAC80211("enter\n");
- /* stop mac, cancel any scan request and clear
- * RXON_FILTER_ASSOC_MSK BIT
- */
+ if (!priv->is_open) {
+ IWL_DEBUG_MAC80211("leave - skip\n");
+ return;
+ }
+
priv->is_open = 0;
if (iwl4965_is_ready_rf(priv)) {
+ /* stop mac, cancel any scan request and clear
+ * RXON_FILTER_ASSOC_MSK BIT
+ */
mutex_lock(&priv->mutex);
iwl4965_scan_cancel_timeout(priv, 100);
cancel_delayed_work(&priv->post_associate);
@@ -8147,7 +8165,6 @@ static void iwl4965_mac_reset_tsf(struct ieee80211_hw *hw)
mutex_unlock(&priv->mutex);
IWL_DEBUG_MAC80211("leave\n");
-
}
static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
@@ -9322,89 +9339,27 @@ static int iwl4965_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct iwl4965_priv *priv = pci_get_drvdata(pdev);
- set_bit(STATUS_IN_SUSPEND, &priv->status);
-
- /* Take down the device; powers it off, etc. */
- iwl4965_down(priv);
-
- if (priv->mac80211_registered)
- ieee80211_stop_queues(priv->hw);
+ if (priv->is_open) {
+ set_bit(STATUS_IN_SUSPEND, &priv->status);
+ iwl4965_mac_stop(priv->hw);
+ priv->is_open = 1;
+ }
- pci_save_state(pdev);
- pci_disable_device(pdev);
pci_set_power_state(pdev, PCI_D3hot);
return 0;
}
-static void iwl4965_resume(struct iwl4965_priv *priv)
-{
- unsigned long flags;
-
- /* The following it a temporary work around due to the
- * suspend / resume not fully initializing the NIC correctly.
- * Without all of the following, resume will not attempt to take
- * down the NIC (it shouldn't really need to) and will just try
- * and bring the NIC back up. However that fails during the
- * ucode verification process. This then causes iwl4965_down to be
- * called *after* iwl4965_hw_nic_init() has succeeded -- which
- * then lets the next init sequence succeed. So, we've
- * replicated all of that NIC init code here... */
-
- iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
-
- iwl4965_hw_nic_init(priv);
-
- iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
- iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR,
- CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
- iwl4965_write32(priv, CSR_INT, 0xFFFFFFFF);
- iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
- iwl4965_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
-
- /* tell the device to stop sending interrupts */
- iwl4965_disable_interrupts(priv);
-
- spin_lock_irqsave(&priv->lock, flags);
- iwl4965_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-
- if (!iwl4965_grab_nic_access(priv)) {
- iwl4965_write_prph(priv, APMG_CLK_DIS_REG,
- APMG_CLK_VAL_DMA_CLK_RQT);
- iwl4965_release_nic_access(priv);
- }
- spin_unlock_irqrestore(&priv->lock, flags);
-
- udelay(5);
-
- iwl4965_hw_nic_reset(priv);
-
- /* Bring the device back up */
- clear_bit(STATUS_IN_SUSPEND, &priv->status);
- queue_work(priv->workqueue, &priv->up);
-}
-
static int iwl4965_pci_resume(struct pci_dev *pdev)
{
struct iwl4965_priv *priv = pci_get_drvdata(pdev);
- int err;
-
- printk(KERN_INFO "Coming out of suspend...\n");
pci_set_power_state(pdev, PCI_D0);
- err = pci_enable_device(pdev);
- pci_restore_state(pdev);
- /*
- * Suspend/Resume resets the PCI configuration space, so we have to
- * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
- * from interfering with C3 CPU state. pci_restore_state won't help
- * here since it only restores the first 64 bytes pci config header.
- */
- pci_write_config_byte(pdev, 0x41, 0x00);
-
- iwl4965_resume(priv);
+ if (priv->is_open)
+ iwl4965_mac_start(priv->hw);
+ clear_bit(STATUS_IN_SUSPEND, &priv->status);
return 0;
}
--
1.5.3.4
The << and >> operators need space on each side.
Cc: Stefano Brivio <[email protected]>
Signed-off-by: Reinette Chatre <[email protected]>
Acked-by: Tomas Winkler <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-commands.h | 12 ++--
drivers/net/wireless/iwlwifi/iwl-3945-debug.h | 58 +++++++++++-----------
drivers/net/wireless/iwlwifi/iwl-3945-hw.h | 46 +++++++++---------
drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 26 +++++-----
drivers/net/wireless/iwlwifi/iwl-4965-commands.h | 40 ++++++++--------
drivers/net/wireless/iwlwifi/iwl-4965-debug.h | 58 +++++++++++-----------
drivers/net/wireless/iwlwifi/iwl-4965-hw.h | 36 +++++++-------
drivers/net/wireless/iwlwifi/iwl-4965-rs.h | 28 +++++-----
drivers/net/wireless/iwlwifi/iwl-4965.c | 12 ++--
drivers/net/wireless/iwlwifi/iwl3945-base.c | 2 +-
drivers/net/wireless/iwlwifi/iwl4965-base.c | 2 +-
11 files changed, 160 insertions(+), 160 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
index 0c80ed5..46bb2c7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
@@ -508,8 +508,8 @@ struct iwl3945_qosparam_cmd {
#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
#define IWL_INVALID_STATION 255
-#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);
-#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
+#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1 << 2);
+#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8);
/* Use in mode field. 1: modify existing entry, 0: add new station entry */
#define STA_CONTROL_MODIFY_MSK 0x01
@@ -1010,7 +1010,7 @@ struct iwl3945_rate_scaling_info {
* For example, if you set 9MB (PLCP 0x0f) as the first
* rate in the rate table, the bit mask for that rate
* when passed through ofdm_basic_rates on the REPLY_RXON
- * command would be bit 0 (1<<0)
+ * command would be bit 0 (1 << 0)
*/
struct iwl3945_rate_scaling_cmd {
u8 table_id;
@@ -1190,9 +1190,9 @@ struct iwl3945_spectrum_notification {
*/
#define IWL_POWER_VEC_SIZE 5
-#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)
+#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 iwl3945_powertable_cmd {
__le32 flags;
__le32 rx_data_timeout;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
index ebf0168..f853c6b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
@@ -75,44 +75,44 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
*
*/
-#define IWL_DL_INFO (1<<0)
-#define IWL_DL_MAC80211 (1<<1)
-#define IWL_DL_HOST_COMMAND (1<<2)
-#define IWL_DL_STATE (1<<3)
+#define IWL_DL_INFO (1 << 0)
+#define IWL_DL_MAC80211 (1 << 1)
+#define IWL_DL_HOST_COMMAND (1 << 2)
+#define IWL_DL_STATE (1 << 3)
-#define IWL_DL_RADIO (1<<7)
-#define IWL_DL_POWER (1<<8)
-#define IWL_DL_TEMP (1<<9)
+#define IWL_DL_RADIO (1 << 7)
+#define IWL_DL_POWER (1 << 8)
+#define IWL_DL_TEMP (1 << 9)
-#define IWL_DL_NOTIF (1<<10)
-#define IWL_DL_SCAN (1<<11)
-#define IWL_DL_ASSOC (1<<12)
-#define IWL_DL_DROP (1<<13)
+#define IWL_DL_NOTIF (1 << 10)
+#define IWL_DL_SCAN (1 << 11)
+#define IWL_DL_ASSOC (1 << 12)
+#define IWL_DL_DROP (1 << 13)
-#define IWL_DL_TXPOWER (1<<14)
+#define IWL_DL_TXPOWER (1 << 14)
-#define IWL_DL_AP (1<<15)
+#define IWL_DL_AP (1 << 15)
-#define IWL_DL_FW (1<<16)
-#define IWL_DL_RF_KILL (1<<17)
-#define IWL_DL_FW_ERRORS (1<<18)
+#define IWL_DL_FW (1 << 16)
+#define IWL_DL_RF_KILL (1 << 17)
+#define IWL_DL_FW_ERRORS (1 << 18)
-#define IWL_DL_LED (1<<19)
+#define IWL_DL_LED (1 << 19)
-#define IWL_DL_RATE (1<<20)
+#define IWL_DL_RATE (1 << 20)
-#define IWL_DL_CALIB (1<<21)
-#define IWL_DL_WEP (1<<22)
-#define IWL_DL_TX (1<<23)
-#define IWL_DL_RX (1<<24)
-#define IWL_DL_ISR (1<<25)
-#define IWL_DL_HT (1<<26)
-#define IWL_DL_IO (1<<27)
-#define IWL_DL_11H (1<<28)
+#define IWL_DL_CALIB (1 << 21)
+#define IWL_DL_WEP (1 << 22)
+#define IWL_DL_TX (1 << 23)
+#define IWL_DL_RX (1 << 24)
+#define IWL_DL_ISR (1 << 25)
+#define IWL_DL_HT (1 << 26)
+#define IWL_DL_IO (1 << 27)
+#define IWL_DL_11H (1 << 28)
-#define IWL_DL_STATS (1<<29)
-#define IWL_DL_TX_REPLY (1<<30)
-#define IWL_DL_QOS (1<<31)
+#define IWL_DL_STATS (1 << 29)
+#define IWL_DL_TX_REPLY (1 << 30)
+#define IWL_DL_QOS (1 << 31)
#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index 3020e5d..e4e4a85 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -369,17 +369,17 @@ struct iwl3945_eeprom {
/* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
* acknowledged (reset) by host writing "1" to flagged bits. */
-#define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */
-#define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */
-#define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */
-#define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */
-#define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */
-#define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */
-#define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */
-#define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */
-#define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */
-#define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */
-#define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */
+#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
+#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
+#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */
+#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
+#define CSR_INT_BIT_MAC_CLK_ACTV (1 << 26) /* NIC controller's clock toggled on/off */
+#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
+#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
+#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
+#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */
+#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */
+#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */
#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
CSR_INT_BIT_HW_ERR | \
@@ -391,14 +391,14 @@ struct iwl3945_eeprom {
CSR_INT_BIT_ALIVE)
/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
-#define CSR_FH_INT_BIT_ERR (1<<31) /* Error */
-#define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */
-#define CSR_FH_INT_BIT_RX_CHNL2 (1<<18) /* Rx channel 2 (3945 only) */
-#define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */
-#define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */
-#define CSR_FH_INT_BIT_TX_CHNL6 (1<<6) /* Tx channel 6 (3945 only) */
-#define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */
-#define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */
+#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */
+#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */
+#define CSR_FH_INT_BIT_RX_CHNL2 (1 << 18) /* Rx channel 2 (3945 only) */
+#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */
+#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */
+#define CSR_FH_INT_BIT_TX_CHNL6 (1 << 6) /* Tx channel 6 (3945 only) */
+#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */
+#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */
#define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
CSR_FH_INT_BIT_RX_CHNL2 | \
@@ -629,10 +629,10 @@ struct iwl3945_eeprom {
#define U32_PAD(n) ((4-(n))&0x3)
-#define TFD_CTL_COUNT_SET(n) (n<<24)
-#define TFD_CTL_COUNT_GET(ctl) ((ctl>>24) & 7)
-#define TFD_CTL_PAD_SET(n) (n<<28)
-#define TFD_CTL_PAD_GET(ctl) (ctl>>28)
+#define TFD_CTL_COUNT_SET(n) (n << 24)
+#define TFD_CTL_COUNT_GET(ctl) ((ctl >> 24) & 7)
+#define TFD_CTL_PAD_SET(n) (n << 28)
+#define TFD_CTL_PAD_GET(ctl) (ctl >> 28)
#define TFD_TX_CMD_SLOTS 256
#define TFD_CMD_SLOTS 32
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
index e21a5ba..d5e9220 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
@@ -86,18 +86,18 @@ enum {
};
/* #define vs. enum to keep from defaulting to 'large integer' */
-#define IWL_RATE_6M_MASK (1<<IWL_RATE_6M_INDEX)
-#define IWL_RATE_9M_MASK (1<<IWL_RATE_9M_INDEX)
-#define IWL_RATE_12M_MASK (1<<IWL_RATE_12M_INDEX)
-#define IWL_RATE_18M_MASK (1<<IWL_RATE_18M_INDEX)
-#define IWL_RATE_24M_MASK (1<<IWL_RATE_24M_INDEX)
-#define IWL_RATE_36M_MASK (1<<IWL_RATE_36M_INDEX)
-#define IWL_RATE_48M_MASK (1<<IWL_RATE_48M_INDEX)
-#define IWL_RATE_54M_MASK (1<<IWL_RATE_54M_INDEX)
-#define IWL_RATE_1M_MASK (1<<IWL_RATE_1M_INDEX)
-#define IWL_RATE_2M_MASK (1<<IWL_RATE_2M_INDEX)
-#define IWL_RATE_5M_MASK (1<<IWL_RATE_5M_INDEX)
-#define IWL_RATE_11M_MASK (1<<IWL_RATE_11M_INDEX)
+#define IWL_RATE_6M_MASK (1 << IWL_RATE_6M_INDEX)
+#define IWL_RATE_9M_MASK (1 << IWL_RATE_9M_INDEX)
+#define IWL_RATE_12M_MASK (1 << IWL_RATE_12M_INDEX)
+#define IWL_RATE_18M_MASK (1 << IWL_RATE_18M_INDEX)
+#define IWL_RATE_24M_MASK (1 << IWL_RATE_24M_INDEX)
+#define IWL_RATE_36M_MASK (1 << IWL_RATE_36M_INDEX)
+#define IWL_RATE_48M_MASK (1 << IWL_RATE_48M_INDEX)
+#define IWL_RATE_54M_MASK (1 << IWL_RATE_54M_INDEX)
+#define IWL_RATE_1M_MASK (1 << IWL_RATE_1M_INDEX)
+#define IWL_RATE_2M_MASK (1 << IWL_RATE_2M_INDEX)
+#define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX)
+#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX)
/* 3945 uCode API values for (legacy) bit rates, both OFDM and CCK */
enum {
@@ -157,7 +157,7 @@ enum {
(IWL_OFDM_BASIC_RATES_MASK | \
IWL_CCK_BASIC_RATES_MASK)
-#define IWL_RATES_MASK ((1<<IWL_RATE_COUNT)-1)
+#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1)
#define IWL_INVALID_VALUE -1
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index 9237f8b..f3470c8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -492,18 +492,18 @@ enum {
};
-#define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0)
-#define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1)
+#define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1 << 0)
+#define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7 << 1)
#define RXON_RX_CHAIN_VALID_POS (1)
-#define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7<<4)
+#define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7 << 4)
#define RXON_RX_CHAIN_FORCE_SEL_POS (4)
-#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7<<7)
+#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7 << 7)
#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
-#define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3<<10)
+#define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3 << 10)
#define RXON_RX_CHAIN_CNT_POS (10)
-#define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3<<12)
+#define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3 << 12)
#define RXON_RX_CHAIN_MIMO_CNT_POS (12)
-#define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1<<14)
+#define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1 << 14)
#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
/* rx_config flags */
@@ -532,17 +532,17 @@ enum {
/* HT flags */
#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
-#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK __constant_cpu_to_le32(0x1<<22)
+#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK __constant_cpu_to_le32(0x1 << 22)
#define RXON_FLG_HT_OPERATING_MODE_POS (23)
-#define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1<<23)
-#define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2<<23)
+#define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1 << 23)
+#define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2 << 23)
#define RXON_FLG_CHANNEL_MODE_POS (25)
-#define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3<<25)
-#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1<<25)
-#define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2<<25)
+#define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3 << 25)
+#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1 << 25)
+#define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2 << 25)
/* rx_config filter flags */
/* accept all data frames */
@@ -713,7 +713,7 @@ struct iwl4965_qosparam_cmd {
#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
#define IWL_INVALID_STATION 255
-#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);
+#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8);
#define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17)
#define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18)
#define STA_FLG_MAX_AGG_SIZE_POS (19)
@@ -1333,7 +1333,7 @@ struct iwl4965_txpowertable_cmd {
} __attribute__ ((packed));
/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
-#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1<<0)
+#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
/* # of EDCA prioritized tx fifos */
#define LINK_QUAL_AC_NUM AC_NUM
@@ -1342,8 +1342,8 @@ struct iwl4965_txpowertable_cmd {
#define LINK_QUAL_MAX_RETRY_NUM 16
/* Tx antenna selection values */
-#define LINK_QUAL_ANT_A_MSK (1<<0)
-#define LINK_QUAL_ANT_B_MSK (1<<1)
+#define LINK_QUAL_ANT_A_MSK (1 << 0)
+#define LINK_QUAL_ANT_B_MSK (1 << 1)
#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
@@ -1785,9 +1785,9 @@ struct iwl4965_spectrum_notification {
*/
#define IWL_POWER_VEC_SIZE 5
-#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1<<0)
-#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1<<2)
-#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1<<3)
+#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1 << 0)
+#define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1 << 2)
+#define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3)
struct iwl4965_powertable_cmd {
__le16 flags;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h
index 00bc1fa..36696bb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-debug.h
@@ -75,44 +75,44 @@ static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
*
*/
-#define IWL_DL_INFO (1<<0)
-#define IWL_DL_MAC80211 (1<<1)
-#define IWL_DL_HOST_COMMAND (1<<2)
-#define IWL_DL_STATE (1<<3)
+#define IWL_DL_INFO (1 << 0)
+#define IWL_DL_MAC80211 (1 << 1)
+#define IWL_DL_HOST_COMMAND (1 << 2)
+#define IWL_DL_STATE (1 << 3)
-#define IWL_DL_RADIO (1<<7)
-#define IWL_DL_POWER (1<<8)
-#define IWL_DL_TEMP (1<<9)
+#define IWL_DL_RADIO (1 << 7)
+#define IWL_DL_POWER (1 << 8)
+#define IWL_DL_TEMP (1 << 9)
-#define IWL_DL_NOTIF (1<<10)
-#define IWL_DL_SCAN (1<<11)
-#define IWL_DL_ASSOC (1<<12)
-#define IWL_DL_DROP (1<<13)
+#define IWL_DL_NOTIF (1 << 10)
+#define IWL_DL_SCAN (1 << 11)
+#define IWL_DL_ASSOC (1 << 12)
+#define IWL_DL_DROP (1 << 13)
-#define IWL_DL_TXPOWER (1<<14)
+#define IWL_DL_TXPOWER (1 << 14)
-#define IWL_DL_AP (1<<15)
+#define IWL_DL_AP (1 << 15)
-#define IWL_DL_FW (1<<16)
-#define IWL_DL_RF_KILL (1<<17)
-#define IWL_DL_FW_ERRORS (1<<18)
+#define IWL_DL_FW (1 << 16)
+#define IWL_DL_RF_KILL (1 << 17)
+#define IWL_DL_FW_ERRORS (1 << 18)
-#define IWL_DL_LED (1<<19)
+#define IWL_DL_LED (1 << 19)
-#define IWL_DL_RATE (1<<20)
+#define IWL_DL_RATE (1 << 20)
-#define IWL_DL_CALIB (1<<21)
-#define IWL_DL_WEP (1<<22)
-#define IWL_DL_TX (1<<23)
-#define IWL_DL_RX (1<<24)
-#define IWL_DL_ISR (1<<25)
-#define IWL_DL_HT (1<<26)
-#define IWL_DL_IO (1<<27)
-#define IWL_DL_11H (1<<28)
+#define IWL_DL_CALIB (1 << 21)
+#define IWL_DL_WEP (1 << 22)
+#define IWL_DL_TX (1 << 23)
+#define IWL_DL_RX (1 << 24)
+#define IWL_DL_ISR (1 << 25)
+#define IWL_DL_HT (1 << 26)
+#define IWL_DL_IO (1 << 27)
+#define IWL_DL_11H (1 << 28)
-#define IWL_DL_STATS (1<<29)
-#define IWL_DL_TX_REPLY (1<<30)
-#define IWL_DL_QOS (1<<31)
+#define IWL_DL_STATS (1 << 29)
+#define IWL_DL_TX_REPLY (1 << 30)
+#define IWL_DL_QOS (1 << 31)
#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index 7e7d6e4..ff71c09 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -461,17 +461,17 @@ struct iwl4965_eeprom {
/* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
* acknowledged (reset) by host writing "1" to flagged bits. */
-#define CSR_INT_BIT_FH_RX (1<<31) /* Rx DMA, cmd responses, FH_INT[17:16] */
-#define CSR_INT_BIT_HW_ERR (1<<29) /* DMA hardware error FH_INT[31] */
-#define CSR_INT_BIT_DNLD (1<<28) /* uCode Download */
-#define CSR_INT_BIT_FH_TX (1<<27) /* Tx DMA FH_INT[1:0] */
-#define CSR_INT_BIT_MAC_CLK_ACTV (1<<26) /* NIC controller's clock toggled on/off */
-#define CSR_INT_BIT_SW_ERR (1<<25) /* uCode error */
-#define CSR_INT_BIT_RF_KILL (1<<7) /* HW RFKILL switch GP_CNTRL[27] toggled */
-#define CSR_INT_BIT_CT_KILL (1<<6) /* Critical temp (chip too hot) rfkill */
-#define CSR_INT_BIT_SW_RX (1<<3) /* Rx, command responses, 3945 */
-#define CSR_INT_BIT_WAKEUP (1<<1) /* NIC controller waking up (pwr mgmt) */
-#define CSR_INT_BIT_ALIVE (1<<0) /* uCode interrupts once it initializes */
+#define CSR_INT_BIT_FH_RX (1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
+#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
+#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */
+#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
+#define CSR_INT_BIT_MAC_CLK_ACTV (1 << 26) /* NIC controller's clock toggled on/off */
+#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
+#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
+#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
+#define CSR_INT_BIT_SW_RX (1 << 3) /* Rx, command responses, 3945 */
+#define CSR_INT_BIT_WAKEUP (1 << 1) /* NIC controller waking up (pwr mgmt) */
+#define CSR_INT_BIT_ALIVE (1 << 0) /* uCode interrupts once it initializes */
#define CSR_INI_SET_MASK (CSR_INT_BIT_FH_RX | \
CSR_INT_BIT_HW_ERR | \
@@ -483,12 +483,12 @@ struct iwl4965_eeprom {
CSR_INT_BIT_ALIVE)
/* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
-#define CSR_FH_INT_BIT_ERR (1<<31) /* Error */
-#define CSR_FH_INT_BIT_HI_PRIOR (1<<30) /* High priority Rx, bypass coalescing */
-#define CSR_FH_INT_BIT_RX_CHNL1 (1<<17) /* Rx channel 1 */
-#define CSR_FH_INT_BIT_RX_CHNL0 (1<<16) /* Rx channel 0 */
-#define CSR_FH_INT_BIT_TX_CHNL1 (1<<1) /* Tx channel 1 */
-#define CSR_FH_INT_BIT_TX_CHNL0 (1<<0) /* Tx channel 0 */
+#define CSR_FH_INT_BIT_ERR (1 << 31) /* Error */
+#define CSR_FH_INT_BIT_HI_PRIOR (1 << 30) /* High priority Rx, bypass coalescing */
+#define CSR_FH_INT_BIT_RX_CHNL1 (1 << 17) /* Rx channel 1 */
+#define CSR_FH_INT_BIT_RX_CHNL0 (1 << 16) /* Rx channel 0 */
+#define CSR_FH_INT_BIT_TX_CHNL1 (1 << 1) /* Tx channel 1 */
+#define CSR_FH_INT_BIT_TX_CHNL0 (1 << 0) /* Tx channel 0 */
#define CSR_FH_INT_RX_MASK (CSR_FH_INT_BIT_HI_PRIOR | \
CSR_FH_INT_BIT_RX_CHNL1 | \
@@ -1683,7 +1683,7 @@ enum {
/* Mask to enable contiguous Tx DMA/FIFO channels between "lo" and "hi". */
#define SCD_TXFACT_REG_TXFIFO_MASK(lo, hi) \
- ((1<<(hi))|((1<<(hi))-(1<<(lo))))
+ ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
/*
* Queue (x) Write Pointers (indexes, really!), one for each Tx queue.
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
index 31e21e2..55f7073 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
@@ -73,19 +73,19 @@ enum {
};
/* #define vs. enum to keep from defaulting to 'large integer' */
-#define IWL_RATE_6M_MASK (1<<IWL_RATE_6M_INDEX)
-#define IWL_RATE_9M_MASK (1<<IWL_RATE_9M_INDEX)
-#define IWL_RATE_12M_MASK (1<<IWL_RATE_12M_INDEX)
-#define IWL_RATE_18M_MASK (1<<IWL_RATE_18M_INDEX)
-#define IWL_RATE_24M_MASK (1<<IWL_RATE_24M_INDEX)
-#define IWL_RATE_36M_MASK (1<<IWL_RATE_36M_INDEX)
-#define IWL_RATE_48M_MASK (1<<IWL_RATE_48M_INDEX)
-#define IWL_RATE_54M_MASK (1<<IWL_RATE_54M_INDEX)
-#define IWL_RATE_60M_MASK (1<<IWL_RATE_60M_INDEX)
-#define IWL_RATE_1M_MASK (1<<IWL_RATE_1M_INDEX)
-#define IWL_RATE_2M_MASK (1<<IWL_RATE_2M_INDEX)
-#define IWL_RATE_5M_MASK (1<<IWL_RATE_5M_INDEX)
-#define IWL_RATE_11M_MASK (1<<IWL_RATE_11M_INDEX)
+#define IWL_RATE_6M_MASK (1 << IWL_RATE_6M_INDEX)
+#define IWL_RATE_9M_MASK (1 << IWL_RATE_9M_INDEX)
+#define IWL_RATE_12M_MASK (1 << IWL_RATE_12M_INDEX)
+#define IWL_RATE_18M_MASK (1 << IWL_RATE_18M_INDEX)
+#define IWL_RATE_24M_MASK (1 << IWL_RATE_24M_INDEX)
+#define IWL_RATE_36M_MASK (1 << IWL_RATE_36M_INDEX)
+#define IWL_RATE_48M_MASK (1 << IWL_RATE_48M_INDEX)
+#define IWL_RATE_54M_MASK (1 << IWL_RATE_54M_INDEX)
+#define IWL_RATE_60M_MASK (1 << IWL_RATE_60M_INDEX)
+#define IWL_RATE_1M_MASK (1 << IWL_RATE_1M_INDEX)
+#define IWL_RATE_2M_MASK (1 << IWL_RATE_2M_INDEX)
+#define IWL_RATE_5M_MASK (1 << IWL_RATE_5M_INDEX)
+#define IWL_RATE_11M_MASK (1 << IWL_RATE_11M_INDEX)
/* 4965 uCode API values for legacy bit rates, both OFDM and CCK */
enum {
@@ -169,7 +169,7 @@ enum {
(IWL_OFDM_BASIC_RATES_MASK | \
IWL_CCK_BASIC_RATES_MASK)
-#define IWL_RATES_MASK ((1<<IWL_RATE_COUNT)-1)
+#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1)
#define IWL_INVALID_VALUE -1
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 5fcc2a6..04db34b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -815,11 +815,11 @@ static int iwl4965_sens_energy_cck(struct iwl4965_priv *priv,
* This is background noise, which may include transmissions from other
* networks, measured during silence before our network's beacon */
silence_rssi_a = (u8)((rx_info->beacon_silence_rssi_a &
- ALL_BAND_FILTER)>>8);
+ ALL_BAND_FILTER) >> 8);
silence_rssi_b = (u8)((rx_info->beacon_silence_rssi_b &
- ALL_BAND_FILTER)>>8);
+ ALL_BAND_FILTER) >> 8);
silence_rssi_c = (u8)((rx_info->beacon_silence_rssi_c &
- ALL_BAND_FILTER)>>8);
+ ALL_BAND_FILTER) >> 8);
val = max(silence_rssi_b, silence_rssi_c);
max_silence_rssi = max(silence_rssi_a, (u8) val);
@@ -4233,14 +4233,14 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl4965_priv *priv,
IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->ba_seq_ctl);
/* Calculate shift to align block-ack bits with our Tx window bits */
- sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl>>4);
+ sh = agg->start_idx - SEQ_TO_INDEX(ba_seq_ctl >> 4);
if (sh < 0) /* tbw something is wrong with indices */
sh += 0x100;
/* don't use 64-bit values for now */
bitmap0 = resp_bitmap0 >> sh;
bitmap1 = resp_bitmap1 >> sh;
- bitmap0 |= (resp_bitmap1 & ((1<<sh)|((1<<sh)-1))) << (32 - sh);
+ bitmap0 |= (resp_bitmap1 & ((1 << sh) | ((1 << sh) - 1))) << (32 - sh);
if (agg->frame_count > (64 - sh)) {
IWL_DEBUG_TX_REPLY("more frames than bitmap size");
@@ -4425,7 +4425,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl4965_priv *priv, int txq_id,
iwl4965_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
/* Set this queue as a chain-building queue */
- iwl4965_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1<<txq_id));
+ iwl4965_set_bits_prph(priv, KDR_SCD_QUEUECHAIN_SEL, (1 << txq_id));
/* Place first TFD at index corresponding to start sequence number.
* Assumes that ssn_idx is valid (!= 0xFFF) */
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index d35c0bf..d2a8df4 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -5267,7 +5267,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, int phymode,
scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3));
/* NOTE: if we were doing 6Mb OFDM for scans we'd use
* power level:
- * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3;
+ * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3;
*/
}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index b300e61..9ae071e 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -5698,7 +5698,7 @@ static int iwl4965_get_channels_for_scan(struct iwl4965_priv *priv, int phymode,
scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3));
/* NOTE: if we were doing 6Mb OFDM for scans we'd use
* power level:
- * scan_ch->tpc.tx_gain = ((1<<5) | (2 << 3)) | 3;
+ * scan_ch->tpc.tx_gain = ((1 << 5) | (2 << 3)) | 3;
*/
}
--
1.5.3.4
From: Tomas Winkler <[email protected]>
This patch renames iwl3945_rate_scale_priv to iwl3945_rs_sta as it
better represents the purpose of this variable.
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 204 ++++++++++++++--------------
1 files changed, 103 insertions(+), 101 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 4b475e9..80d31ae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -52,7 +52,7 @@ struct iwl3945_rate_scale_data {
unsigned long stamp;
};
-struct iwl3945_rate_scale_priv {
+struct iwl3945_rs_sta {
spinlock_t lock;
s32 *expected_tpt;
unsigned long last_partial_flush;
@@ -181,7 +181,7 @@ static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window)
* not flushed. If there were any that were not flushed, then
* reschedule the rate flushing routine.
*/
-static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_priv)
+static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
{
int unflushed = 0;
int i;
@@ -193,19 +193,19 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_p
* since we flushed, clear out the gathered statistics
*/
for (i = 0; i < IWL_RATE_COUNT; i++) {
- if (!rs_priv->win[i].counter)
+ if (!rs_sta->win[i].counter)
continue;
- spin_lock_irqsave(&rs_priv->lock, flags);
- if (time_after(jiffies, rs_priv->win[i].stamp +
+ spin_lock_irqsave(&rs_sta->lock, flags);
+ if (time_after(jiffies, rs_sta->win[i].stamp +
IWL_RATE_WIN_FLUSH)) {
IWL_DEBUG_RATE("flushing %d samples of rate "
"index %d\n",
- rs_priv->win[i].counter, i);
- iwl3945_clear_window(&rs_priv->win[i]);
+ rs_sta->win[i].counter, i);
+ iwl3945_clear_window(&rs_sta->win[i]);
} else
unflushed++;
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
}
return unflushed;
@@ -216,28 +216,28 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rate_scale_priv *rs_p
static void iwl3945_bg_rate_scale_flush(unsigned long data)
{
- struct iwl3945_rate_scale_priv *rs_priv = (void *)data;
+ struct iwl3945_rs_sta *rs_sta = (void *)data;
int unflushed = 0;
unsigned long flags;
u32 packet_count, duration, pps;
IWL_DEBUG_RATE("enter\n");
- unflushed = iwl3945_rate_scale_flush_windows(rs_priv);
+ unflushed = iwl3945_rate_scale_flush_windows(rs_sta);
- spin_lock_irqsave(&rs_priv->lock, flags);
+ spin_lock_irqsave(&rs_sta->lock, flags);
- rs_priv->flush_pending = 0;
+ rs_sta->flush_pending = 0;
/* Number of packets Rx'd since last time this timer ran */
- packet_count = (rs_priv->tx_packets - rs_priv->last_tx_packets) + 1;
+ packet_count = (rs_sta->tx_packets - rs_sta->last_tx_packets) + 1;
- rs_priv->last_tx_packets = rs_priv->tx_packets + 1;
+ rs_sta->last_tx_packets = rs_sta->tx_packets + 1;
if (unflushed) {
duration =
- jiffies_to_msecs(jiffies - rs_priv->last_partial_flush);
-/* duration = jiffies_to_msecs(rs_priv->flush_time); */
+ jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
+/* duration = jiffies_to_msecs(rs_sta->flush_time); */
IWL_DEBUG_RATE("Tx'd %d packets in %dms\n",
packet_count, duration);
@@ -255,23 +255,23 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
} else
duration = IWL_RATE_FLUSH_MAX;
- rs_priv->flush_time = msecs_to_jiffies(duration);
+ rs_sta->flush_time = msecs_to_jiffies(duration);
IWL_DEBUG_RATE("new flush period: %d msec ave %d\n",
duration, packet_count);
- mod_timer(&rs_priv->rate_scale_flush, jiffies +
- rs_priv->flush_time);
+ mod_timer(&rs_sta->rate_scale_flush, jiffies +
+ rs_sta->flush_time);
- rs_priv->last_partial_flush = jiffies;
+ rs_sta->last_partial_flush = jiffies;
}
/* If there weren't any unflushed entries, we don't schedule the timer
* to run again */
- rs_priv->last_flush = jiffies;
+ rs_sta->last_flush = jiffies;
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
IWL_DEBUG_RATE("leave\n");
}
@@ -283,7 +283,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
* at this rate. window->data contains the bitmask of successful
* packets.
*/
-static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
+static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
struct iwl3945_rate_scale_data *window,
int success, int retries)
{
@@ -295,7 +295,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
}
while (retries--) {
- spin_lock_irqsave(&rs_priv->lock, flags);
+ spin_lock_irqsave(&rs_sta->lock, flags);
/* If we have filled up the window then subtract one from the
* success counter if the high-bit is counting toward
@@ -323,7 +323,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rate_scale_priv *rs_priv,
/* Tag this window as having been updated */
window->stamp = jiffies;
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
}
}
@@ -373,49 +373,49 @@ static void rs_clear(void *priv)
static void *rs_alloc_sta(void *priv, gfp_t gfp)
{
- struct iwl3945_rate_scale_priv *rs_priv;
+ struct iwl3945_rs_sta *rs_sta;
int i;
IWL_DEBUG_RATE("enter\n");
- rs_priv = kzalloc(sizeof(struct iwl3945_rate_scale_priv), gfp);
- if (!rs_priv) {
+ rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp);
+ if (!rs_sta) {
IWL_DEBUG_RATE("leave: ENOMEM\n");
return NULL;
}
- spin_lock_init(&rs_priv->lock);
+ spin_lock_init(&rs_sta->lock);
- rs_priv->start_rate = IWL_RATE_INVALID;
+ rs_sta->start_rate = IWL_RATE_INVALID;
/* default to just 802.11b */
- rs_priv->expected_tpt = iwl3945_expected_tpt_b;
+ rs_sta->expected_tpt = iwl3945_expected_tpt_b;
- rs_priv->last_partial_flush = jiffies;
- rs_priv->last_flush = jiffies;
- rs_priv->flush_time = IWL_RATE_FLUSH;
- rs_priv->last_tx_packets = 0;
- rs_priv->ibss_sta_added = 0;
+ rs_sta->last_partial_flush = jiffies;
+ rs_sta->last_flush = jiffies;
+ rs_sta->flush_time = IWL_RATE_FLUSH;
+ rs_sta->last_tx_packets = 0;
+ rs_sta->ibss_sta_added = 0;
- init_timer(&rs_priv->rate_scale_flush);
- rs_priv->rate_scale_flush.data = (unsigned long)rs_priv;
- rs_priv->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;
+ init_timer(&rs_sta->rate_scale_flush);
+ rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
+ rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;
for (i = 0; i < IWL_RATE_COUNT; i++)
- iwl3945_clear_window(&rs_priv->win[i]);
+ iwl3945_clear_window(&rs_sta->win[i]);
IWL_DEBUG_RATE("leave\n");
- return rs_priv;
+ return rs_sta;
}
static void rs_free_sta(void *priv, void *priv_sta)
{
- struct iwl3945_rate_scale_priv *rs_priv = priv_sta;
+ struct iwl3945_rs_sta *rs_sta = priv_sta;
IWL_DEBUG_RATE("enter\n");
- del_timer_sync(&rs_priv->rate_scale_flush);
- kfree(rs_priv);
+ del_timer_sync(&rs_sta->rate_scale_flush);
+ kfree(rs_sta);
IWL_DEBUG_RATE("leave\n");
}
@@ -464,7 +464,7 @@ static void rs_tx_status(void *priv_rate,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
- struct iwl3945_rate_scale_priv *rs_priv;
+ struct iwl3945_rs_sta *rs_sta;
IWL_DEBUG_RATE("enter\n");
@@ -485,9 +485,9 @@ static void rs_tx_status(void *priv_rate,
return;
}
- rs_priv = (void *)sta->rate_ctrl_priv;
+ rs_sta = (void *)sta->rate_ctrl_priv;
- rs_priv->tx_packets++;
+ rs_sta->tx_packets++;
scale_rate_index = first_index;
last_index = first_index;
@@ -514,8 +514,8 @@ static void rs_tx_status(void *priv_rate,
/* Update this rate accounting for as many retries
* as was used for it (per current_count) */
- iwl3945_collect_tx_data(rs_priv,
- &rs_priv->win[scale_rate_index],
+ iwl3945_collect_tx_data(rs_sta,
+ &rs_sta->win[scale_rate_index],
0, current_count);
IWL_DEBUG_RATE("Update rate %d for %d retries.\n",
scale_rate_index, current_count);
@@ -533,25 +533,25 @@ static void rs_tx_status(void *priv_rate,
last_index,
(tx_resp->flags & IEEE80211_TX_STATUS_ACK) ?
"success" : "failure");
- iwl3945_collect_tx_data(rs_priv,
- &rs_priv->win[last_index],
+ iwl3945_collect_tx_data(rs_sta,
+ &rs_sta->win[last_index],
tx_resp->flags & IEEE80211_TX_STATUS_ACK, 1);
/* We updated the rate scale window -- if its been more than
* flush_time since the last run, schedule the flush
* again */
- spin_lock_irqsave(&rs_priv->lock, flags);
+ spin_lock_irqsave(&rs_sta->lock, flags);
- if (!rs_priv->flush_pending &&
- time_after(jiffies, rs_priv->last_partial_flush +
- rs_priv->flush_time)) {
+ if (!rs_sta->flush_pending &&
+ time_after(jiffies, rs_sta->last_partial_flush +
+ rs_sta->flush_time)) {
- rs_priv->flush_pending = 1;
- mod_timer(&rs_priv->rate_scale_flush,
- jiffies + rs_priv->flush_time);
+ rs_sta->flush_pending = 1;
+ mod_timer(&rs_sta->rate_scale_flush,
+ jiffies + rs_sta->flush_time);
}
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
sta_info_put(sta);
@@ -560,7 +560,7 @@ static void rs_tx_status(void *priv_rate,
return;
}
-static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
+static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
u8 index, u16 rate_mask, int phymode)
{
u8 high = IWL_RATE_INVALID;
@@ -595,7 +595,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
low = index;
while (low != IWL_RATE_INVALID) {
- if (rs_priv->tgg)
+ if (rs_sta->tgg)
low = iwl3945_rates[low].prev_rs_tgg;
else
low = iwl3945_rates[low].prev_rs;
@@ -608,7 +608,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rate_scale_priv *rs_priv,
high = index;
while (high != IWL_RATE_INVALID) {
- if (rs_priv->tgg)
+ if (rs_sta->tgg)
high = iwl3945_rates[high].next_rs_tgg;
else
high = iwl3945_rates[high].next_rs;
@@ -646,7 +646,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
u8 high = IWL_RATE_INVALID;
u16 high_low;
int index;
- struct iwl3945_rate_scale_priv *rs_priv;
+ struct iwl3945_rs_sta *rs_sta;
struct iwl3945_rate_scale_data *window = NULL;
int current_tpt = IWL_INVALID_VALUE;
int low_tpt = IWL_INVALID_VALUE;
@@ -684,10 +684,10 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
if (priv->phymode == (u8) MODE_IEEE80211A)
rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
- rs_priv = (void *)sta->rate_ctrl_priv;
+ rs_sta = (void *)sta->rate_ctrl_priv;
if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) &&
- !rs_priv->ibss_sta_added) {
+ !rs_sta->ibss_sta_added) {
u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
if (sta_id == IWL_INVALID_STATION) {
@@ -697,24 +697,24 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
hdr->addr1, 0, CMD_ASYNC);
}
if (sta_id != IWL_INVALID_STATION)
- rs_priv->ibss_sta_added = 1;
+ rs_sta->ibss_sta_added = 1;
}
- spin_lock_irqsave(&rs_priv->lock, flags);
+ spin_lock_irqsave(&rs_sta->lock, flags);
- if (rs_priv->start_rate != IWL_RATE_INVALID) {
- index = rs_priv->start_rate;
- rs_priv->start_rate = IWL_RATE_INVALID;
+ if (rs_sta->start_rate != IWL_RATE_INVALID) {
+ index = rs_sta->start_rate;
+ rs_sta->start_rate = IWL_RATE_INVALID;
}
- window = &(rs_priv->win[index]);
+ window = &(rs_sta->win[index]);
fail_count = window->counter - window->success_counter;
if (((fail_count <= IWL_RATE_MIN_FAILURE_TH) &&
(window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) {
window->average_tpt = IWL_INVALID_VALUE;
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
IWL_DEBUG_RATE("Invalid average_tpt on rate %d: "
"counter: %d, success_counter: %d, "
@@ -722,27 +722,27 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev,
index,
window->counter,
window->success_counter,
- rs_priv->expected_tpt ? "not " : "");
+ rs_sta->expected_tpt ? "not " : "");
goto out;
}
window->average_tpt = ((window->success_ratio *
- rs_priv->expected_tpt[index] + 64) / 128);
+ rs_sta->expected_tpt[index] + 64) / 128);
current_tpt = window->average_tpt;
- high_low = iwl3945_get_adjacent_rate(rs_priv, index, rate_mask,
+ high_low = iwl3945_get_adjacent_rate(rs_sta, index, rate_mask,
local->hw.conf.phymode);
low = high_low & 0xff;
high = (high_low >> 8) & 0xff;
if (low != IWL_RATE_INVALID)
- low_tpt = rs_priv->win[low].average_tpt;
+ low_tpt = rs_sta->win[low].average_tpt;
if (high != IWL_RATE_INVALID)
- high_tpt = rs_priv->win[high].average_tpt;
+ high_tpt = rs_sta->win[high].average_tpt;
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
scale_action = 1;
@@ -840,7 +840,7 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
{
struct ieee80211_local *local = hw_to_local(hw);
struct iwl3945_priv *priv = hw->priv;
- struct iwl3945_rate_scale_priv *rs_priv;
+ struct iwl3945_rs_sta *rs_sta;
struct sta_info *sta;
unsigned long flags;
int count = 0, i;
@@ -858,8 +858,8 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
return sprintf(buf, "station %d not found\n", sta_id);
}
- rs_priv = (void *)sta->rate_ctrl_priv;
- spin_lock_irqsave(&rs_priv->lock, flags);
+ rs_sta = (void *)sta->rate_ctrl_priv;
+ spin_lock_irqsave(&rs_sta->lock, flags);
i = IWL_RATE_54M_INDEX;
while (1) {
u64 mask;
@@ -871,15 +871,16 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1));
for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1)
buf[count++] =
- (rs_priv->win[i].data & mask) ? '1' : '0';
+ (rs_sta->win[i].data & mask) ? '1' : '0';
- samples += rs_priv->win[i].counter;
- good += rs_priv->win[i].success_counter;
- success += rs_priv->win[i].success_counter * iwl3945_rates[i].ieee;
+ samples += rs_sta->win[i].counter;
+ good += rs_sta->win[i].success_counter;
+ success += rs_sta->win[i].success_counter *
+ iwl3945_rates[i].ieee;
- if (rs_priv->win[i].stamp) {
+ if (rs_sta->win[i].stamp) {
int delta =
- jiffies_to_msecs(now - rs_priv->win[i].stamp);
+ jiffies_to_msecs(now - rs_sta->win[i].stamp);
if (delta > max_time)
max_time = delta;
@@ -893,7 +894,7 @@ int iwl3945_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)
break;
i = j;
}
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
sta_info_put(sta);
/* Display the average rate of all samples taken.
@@ -919,7 +920,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
s32 rssi = 0;
unsigned long flags;
struct ieee80211_local *local = hw_to_local(hw);
- struct iwl3945_rate_scale_priv *rs_priv;
+ struct iwl3945_rs_sta *rs_sta;
struct sta_info *sta;
IWL_DEBUG_RATE("enter\n");
@@ -939,33 +940,33 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
return;
}
- rs_priv = (void *)sta->rate_ctrl_priv;
+ rs_sta = (void *)sta->rate_ctrl_priv;
- spin_lock_irqsave(&rs_priv->lock, flags);
+ spin_lock_irqsave(&rs_sta->lock, flags);
- rs_priv->tgg = 0;
+ rs_sta->tgg = 0;
switch (priv->phymode) {
case MODE_IEEE80211G:
if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) {
- rs_priv->tgg = 1;
- rs_priv->expected_tpt = iwl3945_expected_tpt_g_prot;
+ rs_sta->tgg = 1;
+ rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
} else
- rs_priv->expected_tpt = iwl3945_expected_tpt_g;
+ rs_sta->expected_tpt = iwl3945_expected_tpt_g;
break;
case MODE_IEEE80211A:
- rs_priv->expected_tpt = iwl3945_expected_tpt_a;
+ rs_sta->expected_tpt = iwl3945_expected_tpt_a;
break;
default:
IWL_WARNING("Invalid phymode. Defaulting to 802.11b\n");
case MODE_IEEE80211B:
- rs_priv->expected_tpt = iwl3945_expected_tpt_b;
+ rs_sta->expected_tpt = iwl3945_expected_tpt_b;
break;
}
sta_info_put(sta);
- spin_unlock_irqrestore(&rs_priv->lock, flags);
+ spin_unlock_irqrestore(&rs_sta->lock, flags);
rssi = priv->last_rx_rssi;
if (rssi == 0)
@@ -973,11 +974,12 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi);
- rs_priv->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->phymode);
+ rs_sta->start_rate =
+ iwl3945_get_rate_index_by_rssi(rssi, priv->phymode);
IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
- "%d (plcp 0x%x)\n", rssi, rs_priv->start_rate,
- iwl3945_rates[rs_priv->start_rate].plcp);
+ "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
+ iwl3945_rates[rs_sta->start_rate].plcp);
}
void iwl3945_rate_control_register(struct ieee80211_hw *hw)
--
1.5.3.4
From: Tomas Winkler <[email protected]>
This patch removes iwl4965_tx_cmd function and splits its content to
iwl4965_hw_build_tx_cmd_rate, iwl4965_build_tx_cmd_basic,
and iwl4965_tl_get_stats function. The latest one will be deprecated
when traffic load will move to rate scale module.
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Zhu Yi <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-4965.c | 112 +++++++++------------------
drivers/net/wireless/iwlwifi/iwl-4965.h | 6 +-
drivers/net/wireless/iwlwifi/iwl4965-base.c | 19 ++++-
3 files changed, 55 insertions(+), 82 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a945788..e6a0397 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2673,19 +2673,23 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
struct ieee80211_hdr *hdr, int sta_id,
int is_hcca)
{
- u8 rate;
+ struct iwl4965_tx_cmd *tx = &cmd->cmd.tx;
u8 rts_retry_limit = 0;
u8 data_retry_limit = 0;
- __le32 tx_flags;
u16 fc = le16_to_cpu(hdr->frame_control);
+ u8 rate_plcp;
+ u16 rate_flags = 0;
+ int rate_idx = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1);
- tx_flags = cmd->cmd.tx.tx_flags;
-
- rate = iwl4965_rates[ctrl->tx_rate].plcp;
+ rate_plcp = iwl4965_rates[rate_idx].plcp;
rts_retry_limit = (is_hcca) ?
RTS_HCCA_RETRY_LIMIT : RTS_DFAULT_RETRY_LIMIT;
+ if ((rate_idx >= IWL_FIRST_CCK_RATE) && (rate_idx <= IWL_LAST_CCK_RATE))
+ rate_flags |= RATE_MCS_CCK_MSK;
+
+
if (ieee80211_is_probe_response(fc)) {
data_retry_limit = 3;
if (data_retry_limit < rts_retry_limit)
@@ -2696,26 +2700,38 @@ void iwl4965_hw_build_tx_cmd_rate(struct iwl4965_priv *priv,
if (priv->data_retry_limit != -1)
data_retry_limit = priv->data_retry_limit;
- if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) {
+
+ if (ieee80211_is_data(fc)) {
+ tx->initial_rate_index = 0;
+ tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
+ } else {
switch (fc & IEEE80211_FCTL_STYPE) {
case IEEE80211_STYPE_AUTH:
case IEEE80211_STYPE_DEAUTH:
case IEEE80211_STYPE_ASSOC_REQ:
case IEEE80211_STYPE_REASSOC_REQ:
- if (tx_flags & TX_CMD_FLG_RTS_MSK) {
- tx_flags &= ~TX_CMD_FLG_RTS_MSK;
- tx_flags |= TX_CMD_FLG_CTS_MSK;
+ if (tx->tx_flags & TX_CMD_FLG_RTS_MSK) {
+ tx->tx_flags &= ~TX_CMD_FLG_RTS_MSK;
+ tx->tx_flags |= TX_CMD_FLG_CTS_MSK;
}
break;
default:
break;
}
+
+ /* Alternate between antenna A and B for successive frames */
+ if (priv->use_ant_b_for_management_frame) {
+ priv->use_ant_b_for_management_frame = 0;
+ rate_flags |= RATE_MCS_ANT_B_MSK;
+ } else {
+ priv->use_ant_b_for_management_frame = 1;
+ rate_flags |= RATE_MCS_ANT_A_MSK;
+ }
}
- cmd->cmd.tx.rts_retry_limit = rts_retry_limit;
- cmd->cmd.tx.data_retry_limit = data_retry_limit;
- cmd->cmd.tx.rate_n_flags = iwl4965_hw_set_rate_n_flags(rate, 0);
- cmd->cmd.tx.tx_flags = tx_flags;
+ tx->rts_retry_limit = rts_retry_limit;
+ tx->data_retry_limit = data_retry_limit;
+ tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags);
}
int iwl4965_hw_get_rx_read(struct iwl4965_priv *priv)
@@ -3254,69 +3270,13 @@ static void iwl4965_bg_agg_work(struct work_struct *work)
spin_unlock_irqrestore(&priv->lq_mngr.lock, flags);
return;
}
-#endif /*CONFIG_IWL4965_HT_AGG */
-#endif /* CONFIG_IWL4965_HT */
-int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
- u8 sta_id, dma_addr_t txcmd_phys,
- struct ieee80211_hdr *hdr, u8 hdr_len,
- struct ieee80211_tx_control *ctrl, void *sta_in)
+/* TODO: move this functionality to rate scaling */
+void iwl4965_tl_get_stats(struct iwl4965_priv *priv,
+ struct ieee80211_hdr *hdr)
{
- struct iwl4965_tx_cmd *tx = &out_cmd->cmd.tx;
- dma_addr_t scratch_phys;
- u8 unicast = 0;
- u8 is_data = 1;
- u16 fc;
- u16 rate_flags;
- int rate_index = min(ctrl->tx_rate & 0xffff, IWL_RATE_COUNT - 1);
-#ifdef CONFIG_IWL4965_HT
-#ifdef CONFIG_IWL4965_HT_AGG
- __le16 *qc;
-#endif /*CONFIG_IWL4965_HT_AGG */
-#endif /* CONFIG_IWL4965_HT */
-
- unicast = !is_multicast_ether_addr(hdr->addr1);
-
- fc = le16_to_cpu(hdr->frame_control);
- if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA)
- is_data = 0;
+ __le16 *qc = ieee80211_get_qos_ctrl(hdr);
- scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
- offsetof(struct iwl4965_tx_cmd, scratch);
- tx->dram_lsb_ptr = cpu_to_le32(scratch_phys);
- tx->dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys);
-
- /* Hard coded to start at the highest retry fallback position
- * until the 4965 specific rate control algorithm is tied in */
- tx->initial_rate_index = LINK_QUAL_MAX_RETRY_NUM - 1;
-
- /* Alternate between antenna A and B for successive frames */
- if (priv->use_ant_b_for_management_frame) {
- priv->use_ant_b_for_management_frame = 0;
- rate_flags = RATE_MCS_ANT_B_MSK;
- } else {
- priv->use_ant_b_for_management_frame = 1;
- rate_flags = RATE_MCS_ANT_A_MSK;
- }
-
- if (!unicast || !is_data) {
- if ((rate_index >= IWL_FIRST_CCK_RATE) &&
- (rate_index <= IWL_LAST_CCK_RATE))
- rate_flags |= RATE_MCS_CCK_MSK;
- } else {
- tx->initial_rate_index = 0;
- tx->tx_flags |= TX_CMD_FLG_STA_RATE_MSK;
- }
-
- tx->rate_n_flags = iwl4965_hw_set_rate_n_flags(iwl4965_rates[rate_index].plcp,
- rate_flags);
-
- if (ieee80211_is_back_request(fc))
- tx->tx_flags |= TX_CMD_FLG_ACK_MSK |
- TX_CMD_FLG_IMM_BA_RSP_MASK;
-#ifdef CONFIG_IWL4965_HT
-#ifdef CONFIG_IWL4965_HT_AGG
- qc = ieee80211_get_qos_ctrl(hdr);
if (qc &&
(priv->iw_mode != IEEE80211_IF_TYPE_IBSS)) {
u8 tid = 0;
@@ -3334,11 +3294,11 @@ int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
spin_unlock_irqrestore(&priv->lq_mngr.lock, flags);
schedule_work(&priv->agg_work);
}
-#endif
-#endif
- return 0;
}
+#endif /*CONFIG_IWL4965_HT_AGG */
+#endif /* CONFIG_IWL4965_HT */
+
/**
* sign_extend - Sign extend a value using specified bit as sign-bit
*
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index c386482..78bc148 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -758,10 +758,6 @@ extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr,
int is_ap);
extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv);
-extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
- u8 sta_id, dma_addr_t txcmd_phys,
- struct ieee80211_hdr *hdr, u8 hdr_len,
- struct ieee80211_tx_control *ctrl, void *sta_in);
extern int iwl4965_alive_notify(struct iwl4965_priv *priv);
extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
@@ -789,6 +785,8 @@ extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da,
u16 tid, int generator);
extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid);
+extern void iwl4965_tl_get_stats(struct iwl4965_priv *priv,
+ struct ieee80211_hdr *hdr);
#endif /* CONFIG_IWL4965_HT_AGG */
#endif /*CONFIG_IWL4965_HT */
/* Structures, enum, and defines specific to the 4965 */
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index ef5f4ef..4d3ae28 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2772,6 +2772,10 @@ static void iwl4965_build_tx_cmd_basic(struct iwl4965_priv *priv,
tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
}
+ if (ieee80211_is_back_request(fc))
+ tx_flags |= TX_CMD_FLG_ACK_MSK | TX_CMD_FLG_IMM_BA_RSP_MASK;
+
+
cmd->cmd.tx.sta_id = std_id;
if (ieee80211_get_morefrag(hdr))
tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
@@ -2880,6 +2884,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
struct iwl4965_queue *q = NULL;
dma_addr_t phys_addr;
dma_addr_t txcmd_phys;
+ dma_addr_t scratch_phys;
struct iwl4965_cmd *out_cmd = NULL;
u16 len, idx, len_org;
u8 id, hdr_len, unicast;
@@ -3053,8 +3058,18 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
/* set is_hcca to 0; it probably will never be implemented */
iwl4965_hw_build_tx_cmd_rate(priv, out_cmd, ctl, hdr, sta_id, 0);
- iwl4965_tx_cmd(priv, out_cmd, sta_id, txcmd_phys,
- hdr, hdr_len, ctl, NULL);
+ scratch_phys = txcmd_phys + sizeof(struct iwl4965_cmd_header) +
+ offsetof(struct iwl4965_tx_cmd, scratch);
+ out_cmd->cmd.tx.dram_lsb_ptr = cpu_to_le32(scratch_phys);
+ out_cmd->cmd.tx.dram_msb_ptr = iwl_get_dma_hi_address(scratch_phys);
+
+#ifdef CONFIG_IWL4965_HT_AGG
+#ifdef CONFIG_IWL4965_HT
+ /* TODO: move this functionality to rate scaling */
+ iwl4965_tl_get_stats(priv, hdr);
+#endif /* CONFIG_IWL4965_HT_AGG */
+#endif /*CONFIG_IWL4965_HT */
+
if (!ieee80211_get_morefrag(hdr)) {
txq->need_update = 1;
--
1.5.3.4
> This patch moves the firmware loading (read firmware from disk and load
> it into the device SRAM) from pci_probe time to the first network
> interface open time. There are two reasons for doing this:
I have a bit of a problem with this patch...
You're supposed to register your hw modes before registering the hw,
that is no longer the case after this patch!
That's actually totally killing my cfg80211 rate API patch because that
complains if the bands in the registered hw/wiphy aren't assigned
properly.
Can you call *_init_geos() before registering the hw, i.e. before
initialising the firmware?
johannes
On Friday, January 18, 2008 4:35 AM, Johannes Berg wrote:
> Can you call *_init_geos() before registering the hw, i.e. before
> initialising the firmware?
Yes we can. I am working on this. The _init_geos relies on information
from eeprom, not firmware, so we can do it during probe time.
Reinette