iwlwifi: avoid ucode assert for LQ cmd call
PATCH 1/8 iwlwifi: avoid ucode assert for LQ cmd call
In reply to a message not in the archiveFrom: Mohamed Abbas <[email protected]>
This patch make sure we don't call any Link Quality commands until the station is added, otherwise ucode will assert.
--- drivers/net/wireless/iwl-4965-rs.c | 61 +++++++++++++++--------------------- drivers/net/wireless/iwl-4965.h | 1 + drivers/net/wireless/iwl-base.c | 1 + 3 files changed, 27 insertions(+), 36 deletions(-)
drivers/net/wireless/iwl-4965-rs.c +25 -36
@@ -110,7 +110,6 @@ struct iwl_rate_scale_priv {u8 is_green;u8 is_dup;u8 phymode; -u8 ready;u8 ibss_sta_added;u16 active_rate;u16 active_siso_rate;
@@ -183,7 +182,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv,#ifdef CONFIG_IWLWIFI_DEBUG int i;#endif -int rc =0 ; +int rc =-1 ;struct iwl_host_cmd cmd = { .id =REPLY_TX_LINK_QUALITY_CMD ,
@@ -194,7 +193,7 @@ static int rs_send_lq_cmd(struct iwl_priv *priv,if ((lq->sta_id ==0xFF ) && (priv->iw_mode ==IEEE80211_IF_TYPE_IBSS )) -return -1 ; +return rc;if (lq->sta_id ==0xFF ) lq->sta_id =IWL_AP_ID ;
@@ -212,7 +211,8 @@ static int rs_send_lq_cmd(struct iwl_priv *priv,if (flags &CMD_ASYNC ) cmd.meta.u.callback = iwl_lq_sync_callback; - rc =iwl_send_cmd (priv, &cmd); +if (iwl_is_associated (priv) && priv->lq_mngr.lq_ready) + rc =iwl_send_cmd (priv, &cmd);return rc; }
@@ -635,6 +635,9 @@ static void rs_tx_status(void *priv_rate, lq = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; +if (!priv->lq_mngr.lq_ready) +return ; +if ((priv->iw_mode ==IEEE80211_IF_TYPE_IBSS ) && !lq->ibss_sta_added)return ;
@@ -1374,11 +1377,11 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,if (!sta || !sta->rate_ctrl_priv)return ; - lq_data = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv; -if (!lq_data->ready) { +if (!priv->lq_mngr.lq_ready) {IWL_DEBUG_RATE ("still rate scaling not ready\n" );return ; } + lq_data = (struct iwl_rate_scale_priv *)sta->rate_ctrl_priv;if (!lq_data->search_better_tbl) active_tbl = lq_data->active_tbl;
@@ -1449,6 +1452,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, &(lq_data->lq), sta);if (!rs_send_lq_cmd (priv, &lq_data->lq,CMD_ASYNC )) lq_data->commit_lq =0 ; +else + lq_data->commit_lq =1 ; } goto out;
@@ -1577,6 +1582,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,rs_fill_link_cmd (lq_data, &mcs_rate, &(lq_data->lq), sta);if (!rs_send_lq_cmd (priv, &lq_data->lq,CMD_ASYNC )) lq_data->commit_lq =0 ; +else + lq_data->commit_lq =1 ; }rs_stay_in_table (lq_data); if (!update_lq
@@ -1603,6 +1610,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, &(lq_data->lq), sta);if (!rs_send_lq_cmd (priv, &lq_data->lq,CMD_ASYNC )) lq_data->commit_lq =0 ; +else + lq_data->commit_lq =1 ; } tbl1 = &(lq_data->lq_info[lq_data->active_tbl]); if (is_legacy(tbl1->lq_type) &&
@@ -1650,8 +1659,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,static void rs_initialize_lq (struct iwl_priv *priv, -struct sta_info *sta, -int flg) +struct sta_info *sta) {int i;struct iwl_rate_scale_priv *lq;
@@ -1769,18 +1777,18 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate, lq->lq.sta_id = sta_id; lq->lq.rate_scale_table[0 ].rate_n_flags =0 ; lq->ibss_sta_added =1 ; - lq->ready =1 ; lq->commit_lq =1 ; -rs_initialize_lq (priv, sta,CMD_ASYNC ); +rs_initialize_lq (priv, sta); }if (!lq->ibss_sta_added) goto done; } -if (lq->commit_lq && lq->ready) { +if (lq->commit_lq) { lq->commit_lq =0 ; -rs_send_lq_cmd (priv, &lq->lq,CMD_ASYNC ); +if (rs_send_lq_cmd (priv, &lq->lq,CMD_ASYNC )) + lq->commit_lq =1 ; } done:
@@ -1855,7 +1863,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, crl->lq.sta_id = sta_id; crl->lq.rate_scale_table[0 ].rate_n_flags =0 ; } - crl->ready =1 ; + priv->lq_mngr.lq_ready =1 ; }for (i =0 ; i < mode->num_rates; i++) {
@@ -1891,13 +1899,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, crl->active_mimo_rate = crl->active_mimo_rate <<IWL_FIRST_OFDM_RATE ;#endif /*CONFIG_IWLWIFI_HT*/ -if (priv && (priv->iw_mode !=IEEE80211_IF_TYPE_IBSS )) { -mutex_lock (&priv->mutex); -rs_initialize_lq (priv, sta,0 ); -mutex_unlock (&priv->mutex); - }else -rs_initialize_lq (priv, sta,CMD_ASYNC ); - +if (priv) +rs_initialize_lq (priv, sta); } static int rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
@@ -2012,6 +2015,7 @@ static void rs_clear(void *priv_rate)IWL_DEBUG_RATE ("NOP\n" ); + priv->lq_mngr.lq_ready =0 ;#ifdef CONFIG_IWLWIFI_HT #ifdef CONFIG_IWLWIFI_HT_AGG if (priv->lq_mngr.agg_ctrl.granted_ba)
@@ -2133,24 +2137,9 @@ int iwl_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id)void iwl_rate_scale_init (struct ieee80211_hw *hw,s32 sta_id) { -struct ieee80211_local *local =hw_to_local (hw);struct iwl_priv *priv = hw->priv; -struct iwl_rate_scale_priv *rs_priv; -struct sta_info *sta; - sta =sta_info_get (local, priv->stations[sta_id].sta.sta.addr); -if (!sta || !sta->rate_ctrl_priv) { -if (sta) { -sta_info_put (sta); -IWL_DEBUG_RATE ("leave - no private rate data!\n" ); - }else -IWL_DEBUG_RATE ("leave - no station!\n" ); -return ; - } - - rs_priv = (void *)sta->rate_ctrl_priv; - rs_priv->ready =1 ; -sta_info_put (sta); + priv->lq_mngr.lq_ready =1 ; }void iwl_rate_control_register (void )
drivers/net/wireless/iwl-4965.h +1 -0
@@ -196,6 +196,7 @@ struct iwl_lq_mngr {unsigned long stamp_last;u32 flush_time;u32 tx_packets; +u8 lq_ready; };
drivers/net/wireless/iwl-base.c +1 -0
@@ -7878,6 +7878,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)IWL_DEBUG_MAC80211 ("enter\n" );#if IWL ==4965 + priv->lq_mngr.lq_ready =0 ;#ifdef CONFIG_IWLWIFI_HT spin_lock_irqsave (&priv->lock, flags);memset (&priv->current_assoc_ht,0 ,sizeof (struct sta_ht_info ));
Signature · 1 line
1.5.2
PATCH 2/8 iwlwifi: call QoS command on QoS data change
From: Mohamed Abbas <[email protected]>
The driver issues QoS command from post association, some time post_assoc will be called before mac80211 sets QoS data. This patch makes sure the QoS command will be called with new QoS data.
--- drivers/net/wireless/iwl-base.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/wireless/iwl-base.c +8 -0
@@ -7811,6 +7811,14 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, int queue,spin_unlock_irqrestore (&priv->lock, flags); +mutex_lock (&priv->mutex); + +/* we wait for the last queue then call qos ucode command */ +if (priv->assoc_id &&iwl_is_associated (priv) && (i == (AC_NUM -1 ))) +iwl_activate_qos (priv,0 ); + +mutex_unlock (&priv->mutex); +#endif /*CONFIG_IWLWIFI_QOS */ IWL_DEBUG_MAC80211 ("leave\n" );
Signature · 1 line
1.5.2
PATCH 3/8 iwlwifi: Endainity Fix for scan host command
From: Tomas Winkler <[email protected]>
This patch fixes endianity issues in scan host command.
--- drivers/net/wireless/iwl-3945.c | 2 +- drivers/net/wireless/iwl-3945.h | 4 ++-- drivers/net/wireless/iwl-base.c | 18 ++++++++++-------- drivers/net/wireless/iwl-commands.h | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-)
drivers/net/wireless/iwl-3945.c +1 -1
@@ -195,7 +195,7 @@ void iwl_disable_events(struct iwl_priv *priv)* IWL_ANTENNA_MAIN - Force MAIN antenna * IWL_ANTENNA_AUX - Force AUX antenna */ -int iwl3945_get_antenna_flags (const struct iwl_priv *priv) +__le32 iwl3945_get_antenna_flags (const struct iwl_priv *priv) {switch (priv->antenna) {case IWL_ANTENNA_DIVERSITY :
drivers/net/wireless/iwl-3945.h +2 -2
@@ -32,7 +32,7 @@* In non IWL == 3945 builds, these must build to nothing in order to allow * the common code to not have several #if IWL == XXXX / #endif blocks */ -static inline int iwl3945_get_antenna_flags (const struct iwl_priv *priv) +static inline __le32 iwl3945_get_antenna_flags (const struct iwl_priv *priv) {return 0 ; }static inline int iwl3945_init_hw_rate_table (struct iwl_priv *priv) {return 0 ; }
@@ -48,7 +48,7 @@ static inline u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,* Forward declare iwl-3945.c functions for iwl-base.c */ extern int iwl_eeprom_aqcuire_semaphore (struct iwl_priv *priv); -extern int iwl3945_get_antenna_flags (const struct iwl_priv *priv); +extern __le32 iwl3945_get_antenna_flags (const struct iwl_priv *priv);extern int iwl3945_init_hw_rate_table (struct iwl_priv *priv);extern void iwl3945_reg_txpower_periodic (struct iwl_priv *priv);extern void iwl3945_bg_reg_txpower_periodic (struct work_struct *work);
drivers/net/wireless/iwl-base.c +10 -8
@@ -3355,7 +3355,7 @@ static int iwl_get_measurement(struct iwl_priv *priv,memset (&spectrum,0 ,sizeof (spectrum)); - spectrum.channel_count =1 ; + spectrum.channel_count =cpu_to_le32 (1 ); spectrum.flags =RXON_FLG_TSF2HOST_MSK |RXON_FLG_ANT_A_MSK |RXON_FLG_DIS_DIV_MSK ; spectrum.filter_flags =MEASUREMENT_FILTER_FLAG ;
@@ -5480,8 +5480,8 @@ static int iwl_init_channel_map(struct iwl_priv *priv)* time if it's a quiet channel (nothing responded to our probe, and there's * no other traffic). * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ -#define IWL_PLCP_QUIET_THRESH (1)/* packets */ -#define IWL_ACTIVE_QUIET_TIME (5)/* msec */ +#define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1)/* packets */ +#define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(5)/* msec */ /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. * Must be set longer than active dwell time.
@@ -7011,6 +7011,7 @@ static void iwl_bg_request_scan(struct work_struct *data)u16 interval =0 ;u32 extra;u32 suspend_time =100 ; +u32 scan_suspend_time =100 ;unsigned long flags;IWL_DEBUG_INFO ("Scanning while associated...\n" );
@@ -7020,7 +7021,7 @@ static void iwl_bg_request_scan(struct work_struct *data)spin_unlock_irqrestore (&priv->lock, flags); scan->suspend_time =0 ; - scan->max_out_time =600 *1024 ; + scan->max_out_time =cpu_to_le32 (600 *1024 );if (!interval) interval = suspend_time;#if IWL ==3945
@@ -7032,15 +7033,16 @@ static void iwl_bg_request_scan(struct work_struct *data)*/ extra = (suspend_time / interval) <<24 ; - scan->suspend_time =0xFF0FFFFF & + scan_suspend_time =0xFF0FFFFF & (extra | ((suspend_time % interval) *1024 ));#else extra = (suspend_time / interval) <<22 ; - scan->suspend_time = (extra | + scan_suspend_time = (extra | ((suspend_time % interval) *1024 )); -IWL_DEBUG_SCAN ("suspend_time 0x%X beacon interval %d\n" , - scan->suspend_time, interval);#endif + scan->suspend_time =cpu_to_le32 (scan_suspend_time); +IWL_DEBUG_SCAN ("suspend_time 0x%X beacon interval %d\n" , + scan_suspend_time, interval); }/* We should add the ability for user to lock to PASSIVE ONLY */
drivers/net/wireless/iwl-commands.h +1 -1
@@ -443,7 +443,7 @@ struct iwl_ssid_ie {#define PROBE_OPTION_MAX 0x4#define TX_CMD_FLG_SEQ_CTL_MSK 0x2000#define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF -#define IWL_GOOD_CRC_TH (1) +#define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1)#define IWL_MAX_SCAN_SIZE 1024struct iwl_scan_cmd {
Signature · 1 line
1.5.2
PATCH 4/8 iwliwif: Eidianity fix for calibration host commands
From: Tomas Winkler <[email protected]>
This patch fixes endianity issues in calibration host commands.
--- drivers/net/wireless/iwl-4965-hw.h | 8 ++-- drivers/net/wireless/iwl-4965.c | 78 ++++++++++++++++++++---------------- drivers/net/wireless/iwl-4965.h | 5 +- 3 files changed, 50 insertions(+), 41 deletions(-)
drivers/net/wireless/iwl-4965-hw.h +4 -4
@@ -738,10 +738,10 @@ struct iwl_link_quality_cmd {#define STATISTICS_FLG_CLEAR (0x1)#define STATISTICS_FLG_DISABLE_NOTIFICATION (0x2) -#define STATISTICS_REPLY_FLG_CLEAR (0x1) -#define STATISTICS_REPLY_FLG_BAND_24G_MSK (0x2) -#define STATISTICS_REPLY_FLG_TGJ_NARROW_BAND_MSK (0x4) -#define STATISTICS_REPLY_FLG_FAT_MODE_MSK (0x8) +#define STATISTICS_REPLY_FLG_CLEAR __constant_cpu_to_le32(0x1) +#define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) +#define STATISTICS_REPLY_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(0x4) +#define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8)#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
drivers/net/wireless/iwl-4965.c +43 -35
148 lines not on this page · raw message
drivers/net/wireless/iwl-4965.h +3 -2
@@ -201,6 +201,7 @@ struct iwl_lq_mngr {/* Sensitivity and chain noise calibration */ +#define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1)#define INITIALIZATION_VALUE 0xFFFF#define CAL_NUM_OF_BEACONS 20#define MAXIMUM_ALLOWED_PATHLOSS 15
@@ -218,8 +219,8 @@ struct iwl_lq_mngr {#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)#define HD_OFDM_ENERGY_TH_IN_INDEX (10) -#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE (0) -#define SENSITIVITY_CMD_CONTROL_WORK_TABLE (1) +#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE __constant_cpu_to_le16(0) +#define SENSITIVITY_CMD_CONTROL_WORK_TABLE __constant_cpu_to_le16(1)#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
Signature · 1 line
1.5.2
PATCH 5/8 iwlwifi: Fix compilation conditional
From: Tomas Winkler <[email protected]>
Fixing compilation conditional:CONFIG_IWLWIFI_HT -> CONFIG_IWLWIFI_HT_AGG
--- drivers/net/wireless/iwl-4965.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwl-4965.c +2 -2
@@ -3826,9 +3826,9 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, .antenna = 0, .rate = iwl4965_get_rate(rx_start->rate_n_flags), .flag =le16_to_cpu (rx_start->phy_flags), -#ifdef CONFIG_IWLWIFI_HT +#ifdef CONFIG_IWLWIFI_HT_AGG .ordered =0 -#endif +#endif /* CONFIG_IWLWIFI_HT_AGG */ };u8 network_packet;
Signature · 1 line
1.5.2
PATCH 6/8 iwlwifi: fix compile error when CONFIG_IWLWIFI_HT is not selected
--- drivers/net/wireless/iwl-4965-rs.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/net/wireless/iwl-4965-rs.c +0 -4
@@ -2007,11 +2007,7 @@ static void rs_free(void *data)static void rs_clear (void *priv_rate) { -#ifdef CONFIG_IWLWIFI_HT -#ifdef CONFIG_IWLWIFI_HT_AGG struct iwl_priv *priv = (struct iwl_priv *) priv_rate; -#endif /*CONFIG_IWLWIFI_HT_AGG */ -#endif /* CONFIG_IWLWIFI_HT */ IWL_DEBUG_RATE ("NOP\n" );
Signature · 1 line
1.5.2
PATCH 7/8 iwlwifi: workaround uCode REPLY_4965_RX cmd bug
This patch workarounds iwl4965 uCode bug that it doesn't set the SEQ_RX_FRAME flag for command REPLY_4965_RX, which will trigger a driver BUG_ON assertion.
--- drivers/net/wireless/iwl-base.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/iwl-base.c +1 -0
@@ -4576,6 +4576,7 @@ static void iwl_rx_handle(struct iwl_priv *priv) reclaim = !(pkt->hdr.sequence &SEQ_RX_FRAME ) && #if IWL == 4965 (pkt->hdr.cmd !=REPLY_RX_PHY_CMD ) && + (pkt->hdr.cmd !=REPLY_4965_RX ) && #endif (pkt->hdr.cmd !=STATISTICS_NOTIFICATION ) && (pkt->hdr.cmd !=REPLY_TX );
Signature · 1 line
1.5.2
PATCH 8/8 Update version iwl-base.c stamp to 0.1.6
--- drivers/net/wireless/iwl-base.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwl-base.c +1 -1
@@ -106,7 +106,7 @@ BUILD_BUG()#define VS #endif -#define IWLWIFI_VERSION "0.1.5k" VD VS +#define IWLWIFI_VERSION "0.1.6k" VD VS#define DRV_COPYRIGHT "Copyright(c) 2003-2007 Intel Corporation"#define DRV_VERSION IWLWIFI_VERSION
Signature · 1 line
1.5.2