update for 2.6.37
cover update for 2.6.37
We do more code cleanup to prepare for P2P support
We also do more cleanup to prepare separate the legacy and advance devices
Johannes Berg (6):
iwlwifi: allow probe-after-rx on 2.4 GHz
iwlwifi: rename ibss_beacon variable
iwlwifi: clean up some beacon handling
iwlwifi: rewrite RXON checks
iwlwifi: blink LED in IBSS mode
iwlagn: check beacon frame size
Wey-Yi Guy (3):
iwlagn: need longer tx queue stuck timer for coex devices
iwlagn: 6050 ops should be used;
iwlwifi: move agn only eeprom functions to separate file
these patches are also available from wireless-next-2.6 branch on
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6.git
drivers/net/wireless/iwlwifi/Makefile | 2 +- drivers/net/wireless/iwlwifi/iwl-6000.c | 40 ++- drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | 454 +++++++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 40 ++-- drivers/net/wireless/iwlwifi/iwl-agn.c | 39 +-- drivers/net/wireless/iwlwifi/iwl-agn.h | 6 + drivers/net/wireless/iwlwifi/iwl-core.c | 130 ++++---- drivers/net/wireless/iwlwifi/iwl-dev.h | 4 +- drivers/net/wireless/iwlwifi/iwl-eeprom.c | 374 +-------------------- drivers/net/wireless/iwlwifi/iwl-eeprom.h | 7 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 42 ++-- 11 files changed, 632 insertions(+), 506 deletions(-) create mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
PATCH 1/9 iwlagn: need longer tx queue stuck timer for coex devices
For BT/WiFi combo devices, need longer tx stuck queue timer, so those devices won't reload firmware too often.
--- drivers/net/wireless/iwlwifi/iwl-6000.c | 38 ++++++++++++++++++++++++------ drivers/net/wireless/iwlwifi/iwl-core.c | 11 +++----- 2 files changed, 34 insertions(+), 15 deletions(-)
drivers/net/wireless/iwlwifi/iwl-6000.c +30 -8
@@ -509,6 +509,28 @@ static struct iwl_base_params iwl6050_base_params = { .sensitivity_calib_by_driver = true, .chain_noise_calib_by_driver = true, }; +static struct iwl_base_params iwl6000_coex_base_params = { + .eeprom_size =OTP_LOW_IMAGE_SIZE , + .num_of_queues =IWLAGN_NUM_QUEUES , + .num_of_ampdu_queues =IWLAGN_NUM_AMPDU_QUEUES , + .pll_cfg_val =0 , + .set_l0s = true, + .use_bsm = false, + .max_ll_items = OTP_MAX_LL_ITEMS_6x00, + .shadow_ram_support = true, + .led_compensation =51 , + .chain_noise_num_beacons =IWL_CAL_NUM_BEACONS , + .supports_idle = true, + .adv_thermal_throttle = true, + .support_ct_kill_exit = true, + .plcp_delta_threshold =IWL_MAX_PLCP_ERR_THRESHOLD_DEF , + .chain_noise_scale =1000 , + .monitor_recover_period =IWL_LONG_MONITORING_PERIOD , + .max_event_log_size =512 , + .ucode_tracing = true, + .sensitivity_calib_by_driver = true, + .chain_noise_calib_by_driver = true, +};static struct iwl_ht_params iwl6000_ht_params = { .ht_greenfield_support = true,
@@ -587,7 +609,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .ht_params = &iwl6000_ht_params, .need_dc_calib = true,
@@ -608,7 +630,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .need_dc_calib = true, .need_temp_offset_calib = true,
@@ -628,7 +650,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .ht_params = &iwl6000_ht_params, .need_dc_calib = true,
@@ -649,7 +671,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .need_dc_calib = true, .need_temp_offset_calib = true,
@@ -669,7 +691,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .ht_params = &iwl6000_ht_params, .need_dc_calib = true,
@@ -690,7 +712,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .need_dc_calib = true, .need_temp_offset_calib = true,
@@ -829,7 +851,7 @@ struct iwl_cfg iwl130_bgn_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .ht_params = &iwl6000_ht_params, .need_dc_calib = true,
@@ -849,7 +871,7 @@ struct iwl_cfg iwl130_bg_cfg = { .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION, .ops = &iwl6000g2b_ops, .mod_params = &iwlagn_mod_params, - .base_params = &iwl6000_base_params, + .base_params = &iwl6000_coex_base_params, .bt_params = &iwl6000_bt_params, .need_dc_calib = true,/* Due to bluetooth, we transmit 2.4 GHz probes only on antenna A */
drivers/net/wireless/iwlwifi/iwl-core.c +4 -7
@@ -2483,13 +2483,10 @@ static int iwl_check_stuck_queue(struct iwl_priv *priv, int cnt)"queue %d, not read %d time\n" , q->id, q->repeat_same_read_ptr); -if (priv->cfg->bt_params && - !priv->cfg->bt_params->advanced_bt_coexist) { -mod_timer (&priv->monitor_recover, - jiffies +msecs_to_jiffies ( -IWL_ONE_HUNDRED_MSECS )); -return 1 ; - } +mod_timer (&priv->monitor_recover, + jiffies +msecs_to_jiffies ( +IWL_ONE_HUNDRED_MSECS )); +return 1 ; } }else { q->last_read_ptr = q->read_ptr;
Signature · 1 line
1.7.0.4
Re: [PATCH 1/9] iwlagn: need longer tx queue stuck timer for coex devices
Wey,
Quoted 2 lines · Wey-Yi Guy
For BT/WiFi combo devices, need longer tx stuck queue timer, so those devices won't reload firmware too often.
Seeing how many tweaking queue hung monitoring we need, I started to think that the watchdog design is not so good. Currently we compare q->read_ptr with q->last_read_ptr, and if they match 3 times in a row during 200ms, we assume firmware hung. But maybe 200ms of no read_ptr activity is too small time for device. Moreover we have unlikely but possible situation when device is fully functional, but read_ptr will wrap by accident to q->last_read_ptr on every check.
I think, better solution would be something like in rt2x00 or in net/sched/sch_generic.c (however rt2x00 is easier to understand). It is based on time stamp. When we get tx complete notification from hardware (and incise read_ptr) mark the time stamp. In watchdog, which tick periodically, check if queue is not empty and if current time is bigger than time_stamp + time_out, if it is - firmware hung. More smaller watchog tick give more precise hung detect (with disadvantage of more cpu usage).
Stanislaw
RE: [PATCH 1/9] iwlagn: need longer tx queue stuck timer for coex devices
Hi Stanislaw,
-----Original Message-----
From: Stanislaw Gruszka [mailto:[email protected]]
Sent: Friday, October 15, 2010 9:45 AM
To: Guy, Wey-Yi W
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/9] iwlagn: need longer tx queue stuck timer for coex devices
Wey,
Quoted 2 lines · Wey-Yi Guy
For BT/WiFi combo devices, need longer tx stuck queue timer, so those devices won't reload firmware too often.
Seeing how many tweaking queue hung monitoring we need, I started to think that the watchdog design is not so good. Currently we compare q->read_ptr with q->last_read_ptr, and if they match 3 times in a row during 200ms, we assume firmware hung. But maybe 200ms of no read_ptr activity is too small time for device. Moreover we have unlikely but possible situation when device is fully functional, but read_ptr will wrap by accident to q->last_read_ptr on every check.
I think, better solution would be something like in rt2x00 or in net/sched/sch_generic.c (however rt2x00 is easier to understand). It is based on time stamp. When we get tx complete notification from hardware (and incise read_ptr) mark the time stamp. In watchdog, which tick periodically, check if queue is not empty and if current time is bigger than time_stamp + time_out, if it is - firmware hung. More smaller watchog tick give more precise hung detect (with disadvantage of more cpu usage).
Me too not really like the current "monitor" approach, some thought about the design you propose.
1. "time_out" is something need to be define and has the similar problem like what we have today since different devices has different behavior. For example, in WiFi/BT combo case, the queue might not move for a while if BT traffic load is high
2. I don't really see much of "cpu usage" impact if we have a reasonable watchdog timer. But it is all relative.
By saying that, I think using timestamp might give more cleaner design, but still has the similar issues.
Thanks
Wey
Re: [PATCH 1/9] iwlagn: need longer tx queue stuck timer for coex devices
Hi Wey
Quoted 14 lines
activity is too small time for device. Moreover we have unlikely but possible situation when device is fully functional, but
read_ptrwill wrap by accident toq->last_read_ptron every check.I think, better solution would be something like in rt2x00 or in
net/sched/sch_generic.c(however rt2x00 is easier to understand). It is based on time stamp. When we get tx complete notification from hardware (and inciseread_ptr) mark the time stamp. In watchdog, which tick periodically, check if queue is not empty and if current time is bigger thantime_stamp+time_out, if it is - firmware hung. More smaller watchog tick give more precise hung detect (with disadvantage of more cpu usage).
Quoted 3 lines
Me too not really like the current "monitor" approach, some thought about the design you propose.
1. "
time_out" is something need to be define and has the similar problem like what we have today since different devices has different behavior. For example, in WiFi/BT combo case, the queue might not move for a while if BT traffic load is high
Sure.
However new watchdog could be more precise. Currently if hung will happen just after watchdog tick we are detecting it in time about 2 ticks i.e. 10s, or when happen just before the tick we detect the hang in 1 tick i.e. 5s, what gives 100% inaccuracy. New design can be much more precise.
Quoted 1 line
2. I don't really see much of "cpu usage" impact if we have a reasonable watchdog timer. But it is all relative.
Ohh, I was talking about cpu usage in new design I described.
Quoted 2 lines
By saying that, I think using timestamp might give more cleaner design, but still has the similar issues.
Ok, if Intel have no plan to change the monitor recovery and have nothing against my watchdog approach, I'm going to cook some patches.
Stanislaw
Re: [PATCH 1/9] iwlagn: need longer tx queue stuck timer for coex devices
Hi Stanislaw,
Quoted 30 lines · Stanislaw Gruszka
Hi Wey
Quoted 14 lines
activity is too small time for device. Moreover we have unlikely but possible situation when device is fully functional, but
read_ptrwill wrap by accident toq->last_read_ptron every check.I think, better solution would be something like in rt2x00 or in
net/sched/sch_generic.c(however rt2x00 is easier to understand). It is based on time stamp. When we get tx complete notification from hardware (and inciseread_ptr) mark the time stamp. In watchdog, which tick periodically, check if queue is not empty and if current time is bigger thantime_stamp+time_out, if it is - firmware hung. More smaller watchog tick give more precise hung detect (with disadvantage of more cpu usage).Quoted 3 lines
Me too not really like the current "monitor" approach, some thought about the design you propose.
1. "
time_out" is something need to be define and has the similar problem like what we have today since different devices has different behavior. For example, in WiFi/BT combo case, the queue might not move for a while if BT traffic load is highSure.
However new watchdog could be more precise. Currently if hung will happen just after watchdog tick we are detecting it in time about 2 ticks i.e. 10s, or when happen just before the tick we detect the hang in 1 tick i.e. 5s, what gives 100% inaccuracy. New design can be much more precise.
Quoted 1 line
2. I don't really see much of "cpu usage" impact if we have a reasonable watchdog timer. But it is all relative.
Quoted 7 lines
Ohh, I was talking about cpu usage in new design I described.
Quoted 2 lines
By saying that, I think using timestamp might give more cleaner design, but still has the similar issues.
Ok, if Intel have no plan to change the monitor recovery and have nothing against my watchdog approach, I'm going to cook some patches.
Pleas do so and please do let us review it. I am very happy having you looking at the iwlwifi driver and give great improvement.
Thank you very much
Wey
PATCH 2/9 iwlwifi: allow probe-after-rx on 2.4 GHz
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
There are two passive 2.4 GHz channels: 12 and 13. If you have a hidden SSID on those, you will not be able to connect to it because we don't send out probe requests there. We can allow this by using the firmware's probe-after-rx functionality on those channels as well.
This fixes
https://bugzilla.kernel.org/show_bug.cgi?id=16462
--- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 40 +++++++++++++------------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 16 +++++----- 2 files changed, 28 insertions(+), 28 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-lib.c +20 -20
@@ -1447,35 +1447,35 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) scan->tx_cmd.tx_flags |=TX_CMD_FLG_IGNORE_BT ; - scan->good_CRC_th =IWL_GOOD_CRC_TH_DISABLED ;break ;case IEEE80211_BAND_5GHZ : rate =IWL_RATE_6M_PLCP ; -/* -* If active scanning is requested but a certain channel is -* marked passive, we can do active scanning if we detect -* transmissions. -* -* There is an issue with some firmware versions that triggers -* a sysassert on a "good CRC threshold" of zero (== disabled), -* on a radar channel even though this means that we should NOT -* send probes. -* -* The "good CRC threshold" is the number of frames that we -* need to receive during our dwell time on a channel before -* sending out probes -- setting this to a huge value will -* mean we never reach it, but at the same time work around -* the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER -* here instead of IWL_GOOD_CRC_TH_DISABLED. -*/ - scan->good_CRC_th = is_active ?IWL_GOOD_CRC_TH_DEFAULT : -IWL_GOOD_CRC_TH_NEVER ;break ;default :IWL_WARN (priv,"Invalid scan band\n" );return -EIO ; } +/* +* If active scanning is requested but a certain channel is +* marked passive, we can do active scanning if we detect +* transmissions. +* +* There is an issue with some firmware versions that triggers +* a sysassert on a "good CRC threshold" of zero (== disabled), +* on a radar channel even though this means that we should NOT +* send probes. +* +* The "good CRC threshold" is the number of frames that we +* need to receive during our dwell time on a channel before +* sending out probes -- setting this to a huge value will +* mean we never reach it, but at the same time work around +* the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER +* here instead of IWL_GOOD_CRC_TH_DISABLED. +*/ + scan->good_CRC_th = is_active ?IWL_GOOD_CRC_TH_DEFAULT : +IWL_GOOD_CRC_TH_NEVER ; + band = priv->scan_band;if (priv->cfg->scan_rx_antennas[band])
drivers/net/wireless/iwlwifi/iwl3945-base.c +8 -8
@@ -2938,18 +2938,10 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)case IEEE80211_BAND_2GHZ : scan->flags =RXON_FLG_BAND_24G_MSK |RXON_FLG_AUTO_DETECT_MSK ; scan->tx_cmd.rate =IWL_RATE_1M_PLCP ; - scan->good_CRC_th =0 ; band =IEEE80211_BAND_2GHZ ;break ;case IEEE80211_BAND_5GHZ : scan->tx_cmd.rate =IWL_RATE_6M_PLCP ; -/* -* If active scaning is requested but a certain channel -* is marked passive, we can do active scanning if we -* detect transmissions. -*/ - scan->good_CRC_th = is_active ?IWL_GOOD_CRC_TH_DEFAULT : -IWL_GOOD_CRC_TH_DISABLED ; band =IEEE80211_BAND_5GHZ ;break ;default :
@@ -2957,6 +2949,14 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)return -EIO ; } +/* +* If active scaning is requested but a certain channel +* is marked passive, we can do active scanning if we +* detect transmissions. +*/ + scan->good_CRC_th = is_active ?IWL_GOOD_CRC_TH_DEFAULT : +IWL_GOOD_CRC_TH_DISABLED ; +if (!priv->is_internal_short_scan) { scan->tx_cmd.len = cpu_to_le16( iwl_fill_probe_req(priv,
Signature · 1 line
1.7.0.4
PATCH 3/9 iwlwifi: rename ibss_beacon variable
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
Since we're also going to support AP (GO) mode, the variable isn't used for just IBSS beacons any more -- rename it to not mislead readers.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 26 +++++++++++++------------- drivers/net/wireless/iwlwifi/iwl-core.c | 16 ++++++++-------- drivers/net/wireless/iwlwifi/iwl-dev.h | 4 ++-- drivers/net/wireless/iwlwifi/iwl3945-base.c | 26 +++++++++++++------------- 4 files changed, 36 insertions(+), 36 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +13 -13
@@ -317,15 +317,15 @@ static u32 iwl_fill_beacon_frame(struct iwl_priv *priv, struct ieee80211_hdr *hdr, int left) { -if (!priv->ibss_beacon) +if (!priv->beacon_skb)return 0 ; -if (priv->ibss_beacon->len > left) +if (priv->beacon_skb->len > left)return 0 ; -memcpy (hdr, priv->ibss_beacon->data, priv->ibss_beacon->len); +memcpy (hdr, priv->beacon_skb->data, priv->beacon_skb->len); -return priv->ibss_beacon->len; +return priv->beacon_skb->len; }/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */
@@ -653,10 +653,10 @@ static void iwl_bg_beacon_update(struct work_struct *work) }/* new beacon skb is allocated every time; dispose previous.*/ -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb); - priv->ibss_beacon = beacon; + priv->beacon_skb = beacon;iwl_send_beacon_cmd (priv); out:
@@ -2993,9 +2993,9 @@ static void __iwl_down(struct iwl_priv *priv) exit:memset (&priv->card_alive,0 ,sizeof (struct iwl_alive_resp )); -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); - priv->ibss_beacon =NULL ; +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb); + priv->beacon_skb =NULL ;/* clear out any free frames */ iwl_clear_free_frames (priv);
@@ -4131,7 +4131,7 @@ static int iwl_init_drv(struct iwl_priv *priv) {int ret; - priv->ibss_beacon =NULL ; + priv->beacon_skb =NULL ;spin_lock_init (&priv->sta_lock);spin_lock_init (&priv->hcmd_lock);
@@ -4645,8 +4645,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)iwl_free_isr_ict (priv); -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb);ieee80211_free_hw (priv->hw); }
drivers/net/wireless/iwlwifi/iwl-core.c +8 -8
@@ -1552,10 +1552,10 @@ static void iwlcore_beacon_update(struct ieee80211_hw *hw,spin_lock_irqsave (&priv->lock, flags); -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb); - priv->ibss_beacon = skb; + priv->beacon_skb = skb; timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; priv->timestamp =le64_to_cpu (timestamp);
@@ -1610,8 +1610,8 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, }if (changes &BSS_CHANGED_BEACON && vif->type ==NL80211_IFTYPE_AP ) { -dev_kfree_skb (priv->ibss_beacon); - priv->ibss_beacon =ieee80211_beacon_get (hw, vif); +dev_kfree_skb (priv->beacon_skb); + priv->beacon_skb =ieee80211_beacon_get (hw, vif); }if (changes &BSS_CHANGED_BEACON_INT && vif->type ==NL80211_IFTYPE_AP )
@@ -2060,10 +2060,10 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw)spin_lock_irqsave (&priv->lock, flags);/* new association get rid of ibss beacon skb */ -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb); - priv->ibss_beacon =NULL ; + priv->beacon_skb =NULL ; priv->timestamp =0 ;
drivers/net/wireless/iwlwifi/iwl-dev.h +2 -2
@@ -1383,8 +1383,6 @@ struct iwl_priv {enum nl80211_iftype iw_mode; -struct sk_buff *ibss_beacon; -/* Last Rx'd beacon timestamp */ u64 timestamp;
@@ -1496,8 +1494,10 @@ struct iwl_priv {struct work_struct scan_completed;struct work_struct rx_replenish;struct work_struct abort_scan; +struct work_struct beacon_update;struct iwl_rxon_context *beacon_ctx; +struct sk_buff *beacon_skb;struct work_struct tt_work;struct work_struct ct_enter;
drivers/net/wireless/iwlwifi/iwl3945-base.c +13 -13
@@ -317,15 +317,15 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv, int left) { -if (!iwl_is_associated (priv,IWL_RXON_CTX_BSS ) || !priv->ibss_beacon) +if (!iwl_is_associated (priv,IWL_RXON_CTX_BSS ) || !priv->beacon_skb)return 0 ; -if (priv->ibss_beacon->len > left) +if (priv->beacon_skb->len > left)return 0 ; -memcpy (hdr, priv->ibss_beacon->data, priv->ibss_beacon->len); +memcpy (hdr, priv->beacon_skb->data, priv->beacon_skb->len); -return priv->ibss_beacon->len; +return priv->beacon_skb->len; }static int iwl3945_send_beacon_cmd (struct iwl_priv *priv)
@@ -813,10 +813,10 @@ static void iwl3945_bg_beacon_update(struct work_struct *work)mutex_lock (&priv->mutex);/* new beacon skb is allocated every time; dispose previous.*/ -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb); - priv->ibss_beacon = beacon; + priv->beacon_skb = beacon;mutex_unlock (&priv->mutex);iwl3945_send_beacon_cmd (priv);
@@ -2642,9 +2642,9 @@ static void __iwl3945_down(struct iwl_priv *priv) exit:memset (&priv->card_alive,0 ,sizeof (struct iwl_alive_resp )); -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); - priv->ibss_beacon =NULL ; +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb); + priv->beacon_skb =NULL ;/* clear out any free frames */ iwl3945_clear_free_frames (priv);
@@ -3848,7 +3848,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv)struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom; priv->retry_rate =1 ; - priv->ibss_beacon =NULL ; + priv->beacon_skb =NULL ;spin_lock_init (&priv->sta_lock);spin_lock_init (&priv->hcmd_lock);
@@ -4256,8 +4256,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)iwl_free_channel_map (priv);iwlcore_free_geos (priv);kfree (priv->scan_cmd); -if (priv->ibss_beacon) -dev_kfree_skb (priv->ibss_beacon); +if (priv->beacon_skb) +dev_kfree_skb (priv->beacon_skb);ieee80211_free_hw (priv->hw); }
Signature · 1 line
1.7.0.4
PATCH 4/9 iwlwifi: clean up some beacon handling
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
There's no need to check for NULL before
calling dev_kfree_skb() since it is valid
to call it on NULL -- it becomes a no-op.
There's also no need to initialise thebeacon_skb variable to NULL just after
the memory it is in has been kzalloc'ed.
Some minor whitespace cleanups, and a
lock assertion in a function that needs
the mutex (to access the beacon_skb var)
complete the patch.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +11 -14
@@ -314,9 +314,11 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) }static u32 iwl_fill_beacon_frame (struct iwl_priv *priv, -struct ieee80211_hdr *hdr, -int left) +struct ieee80211_hdr *hdr, +int left) { +lockdep_assert_held (&priv->mutex); +if (!priv->beacon_skb)return 0 ;
@@ -330,8 +332,8 @@ static u32 iwl_fill_beacon_frame(struct iwl_priv *priv,/* Parse the beacon frame to find the TIM element and set tim_idx & tim_size */ static void iwl_set_beacon_tim (struct iwl_priv *priv, -struct iwl_tx_beacon_cmd *tx_beacon_cmd, -u8 *beacon,u32 frame_size) +struct iwl_tx_beacon_cmd *tx_beacon_cmd, +u8 *beacon,u32 frame_size) {u16 tim_idx;struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)beacon;
@@ -393,7 +395,7 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,/* Set up TX beacon command fields */ iwl_set_beacon_tim (priv, tx_beacon_cmd, (u8 *)tx_beacon_cmd->frame, - frame_size); + frame_size);/* Set up packet rate and flags */ rate =iwl_rate_get_lowest_plcp (priv, priv->beacon_ctx);
@@ -648,13 +650,12 @@ static void iwl_bg_beacon_update(struct work_struct *work)/* Pull updated AP beacon from mac80211. will fail if not in AP mode */ beacon =ieee80211_beacon_get (priv->hw, priv->beacon_ctx->vif);if (!beacon) { -IWL_ERR (priv,"update beacon failed\n" ); +IWL_ERR (priv,"update beacon failed -- keeping old\n" ); goto out; }/* new beacon skb is allocated every time; dispose previous.*/ -if (priv->beacon_skb) -dev_kfree_skb (priv->beacon_skb); +dev_kfree_skb (priv->beacon_skb); priv->beacon_skb = beacon;
@@ -2993,8 +2994,7 @@ static void __iwl_down(struct iwl_priv *priv) exit:memset (&priv->card_alive,0 ,sizeof (struct iwl_alive_resp )); -if (priv->beacon_skb) -dev_kfree_skb (priv->beacon_skb); +dev_kfree_skb (priv->beacon_skb); priv->beacon_skb =NULL ;/* clear out any free frames */
@@ -4131,8 +4131,6 @@ static int iwl_init_drv(struct iwl_priv *priv) {int ret; - priv->beacon_skb =NULL ; -spin_lock_init (&priv->sta_lock);spin_lock_init (&priv->hcmd_lock);
@@ -4645,8 +4643,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)iwl_free_isr_ict (priv); -if (priv->beacon_skb) -dev_kfree_skb (priv->beacon_skb); +dev_kfree_skb (priv->beacon_skb);ieee80211_free_hw (priv->hw); }
Signature · 1 line
1.7.0.4
PATCH 5/9 iwlagn: 6050 ops should be used;
In reply to Wey-Yi GuyFor 6050 series of devices, 6050 ops should be used; One of the 6050 config still use 6000 ops, fix it.
--- drivers/net/wireless/iwlwifi/iwl-6000.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-6000.c +1 -1
@@ -780,7 +780,7 @@ struct iwl_cfg iwl6050_2agn_cfg = { .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, .valid_tx_ant = ANT_AB, .valid_rx_ant = ANT_AB, - .ops = &iwl6000_ops, + .ops = &iwl6050_ops, .eeprom_ver = EEPROM_6050_EEPROM_VERSION, .eeprom_calib_ver = EEPROM_6050_TX_POWER_VERSION, .mod_params = &iwlagn_mod_params,
Signature · 1 line
1.7.0.4
PATCH 6/9 iwlwifi: rewrite RXON checks
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
The RXON checking is a bit magical, and prints out too much information if something goes wrong. Make it less magical and print out only the items that were actually wrong.
Also remove the comment about removing it -- the driver is constantly changing so these checks are useful.
--- drivers/net/wireless/iwlwifi/iwl-core.c | 100 +++++++++++++++---------------- 1 files changed, 49 insertions(+), 51 deletions(-)
drivers/net/wireless/iwlwifi/iwl-core.c +50 -52
@@ -510,76 +510,74 @@ void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx, }EXPORT_SYMBOL (iwl_set_rxon_hwcrypto); -/** -* iwl_check_rxon_cmd - validate RXON structure is valid -* -* NOTE: This is really only useful during development and can eventually -* be #ifdef'd out once the driver is stable and folks aren't actively -* making changes -*/ +/* validate RXON structure is valid */ int iwl_check_rxon_cmd (struct iwl_priv *priv,struct iwl_rxon_context *ctx) { -int error =0 ; -int counter =1 ;struct iwl_rxon_cmd *rxon = &ctx->staging; +bool error = false;if (rxon->flags &RXON_FLG_BAND_24G_MSK ) { - error |=le32_to_cpu (rxon->flags & - (RXON_FLG_TGJ_NARROW_BAND_MSK | -RXON_FLG_RADAR_DETECT_MSK )); -if (error) -IWL_WARN (priv,"check 24G fields %d | %d\n" , - counter++, error); +if (rxon->flags &RXON_FLG_TGJ_NARROW_BAND_MSK ) { +IWL_WARN (priv,"check 2.4G: wrong narrow\n" ); + error = true; + } +if (rxon->flags &RXON_FLG_RADAR_DETECT_MSK ) { +IWL_WARN (priv,"check 2.4G: wrong radar\n" ); + error = true; + } }else { - error |= (rxon->flags &RXON_FLG_SHORT_SLOT_MSK ) ? -0 :le32_to_cpu (RXON_FLG_SHORT_SLOT_MSK ); -if (error) -IWL_WARN (priv,"check 52 fields %d | %d\n" , - counter++, error); - error |=le32_to_cpu (rxon->flags &RXON_FLG_CCK_MSK ); -if (error) -IWL_WARN (priv,"check 52 CCK %d | %d\n" , - counter++, error); - } - error |= (rxon->node_addr[0 ] | rxon->bssid_addr[0 ]) &0x1 ; -if (error) -IWL_WARN (priv,"check mac addr %d | %d\n" , counter++, error); +if (!(rxon->flags &RXON_FLG_SHORT_SLOT_MSK )) { +IWL_WARN (priv,"check 5.2G: not short slot!\n" ); + error = true; + } +if (rxon->flags &RXON_FLG_CCK_MSK ) { +IWL_WARN (priv,"check 5.2G: CCK!\n" ); + error = true; + } + } +if ((rxon->node_addr[0 ] | rxon->bssid_addr[0 ]) &0x1 ) { +IWL_WARN (priv,"mac/bssid mcast!\n" ); + error = true; + }/* make sure basic rates 6Mbps and 1Mbps are supported */ - error |= (((rxon->ofdm_basic_rates &IWL_RATE_6M_MASK ) ==0 ) && - ((rxon->cck_basic_rates &IWL_RATE_1M_MASK ) ==0 )); -if (error) -IWL_WARN (priv,"check basic rate %d | %d\n" , counter++, error); +if ((rxon->ofdm_basic_rates &IWL_RATE_6M_MASK ) ==0 && + (rxon->cck_basic_rates &IWL_RATE_1M_MASK ) ==0 ) { +IWL_WARN (priv,"neither 1 nor 6 are basic\n" ); + error = true; + } - error |= (le16_to_cpu (rxon->assoc_id) >2007 ); -if (error) -IWL_WARN (priv,"check assoc id %d | %d\n" , counter++, error); +if (le16_to_cpu (rxon->assoc_id) >2007 ) { +IWL_WARN (priv,"aid > 2007\n" ); + error = true; + } - error |= ((rxon->flags & (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )) - == (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )); -if (error) -IWL_WARN (priv,"check CCK and short slot %d | %d\n" , - counter++, error); +if ((rxon->flags & (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )) + == (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )) { +IWL_WARN (priv,"CCK and short slot\n" ); + error = true; + } - error |= ((rxon->flags & (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK )) - == (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK )); -if (error) -IWL_WARN (priv,"check CCK & auto detect %d | %d\n" , - counter++, error); +if ((rxon->flags & (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK )) + == (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK )) { +IWL_WARN (priv,"CCK and auto detect" ); + error = true; + } - error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | -RXON_FLG_TGG_PROTECT_MSK )) ==RXON_FLG_TGG_PROTECT_MSK ); -if (error) -IWL_WARN (priv,"check TGG and auto detect %d | %d\n" , - counter++, error); +if ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | +RXON_FLG_TGG_PROTECT_MSK )) == +RXON_FLG_TGG_PROTECT_MSK ) { +IWL_WARN (priv,"TGg but no auto-detect\n" ); + error = true; + }if (error)IWL_WARN (priv,"Tuning to channel %d\n" ,le16_to_cpu (rxon->channel));if (error) { -IWL_ERR (priv,"Not a valid iwl_rxon_assoc_cmd field values\n" ); -return -1 ; +IWL_ERR (priv,"Invalid RXON\n" ); +return -EINVAL ; }return 0 ; }
Signature · 1 line
1.7.0.4
PATCH 7/9 iwlwifi: blink LED in IBSS mode
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
We recently found that contrary to expectations,
the LED is not blinking in IBSS mode. Fix this.
--- drivers/net/wireless/iwlwifi/iwl-core.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/iwlwifi/iwl-core.c +1 -0
@@ -1727,6 +1727,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,memcpy (ctx->staging.bssid_addr, bss_conf->bssid,ETH_ALEN );memcpy (priv->bssid, bss_conf->bssid,ETH_ALEN ); +iwl_led_associate (priv);iwlcore_config_ap (priv, vif); }else iwl_set_no_assoc (priv, vif);
Signature · 1 line
1.7.0.4
PATCH 8/9 iwlagn: check beacon frame size
In reply to Wey-Yi GuyFrom: Johannes Berg <[email protected]>
When the beacon_skb is NULL, we might still attempt to use it in this code path (if we ever get here) -- make the code a bit more defensive and check the return value of iwl_fill_beacon_frame() against zero.
--- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +2 -0
@@ -385,6 +385,8 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, sizeof(frame->u) - sizeof(*tx_beacon_cmd));if (WARN_ON_ONCE (frame_size >MAX_MPDU_SIZE ))return 0 ; +if (!frame_size) +return 0 ;/* Set up TX command fields */ tx_beacon_cmd->tx.len =cpu_to_le16 ((u16 )frame_size);
Signature · 1 line
1.7.0.4
PATCH 9/9 iwlwifi: move agn only eeprom functions to separate file
In reply to Wey-Yi GuySome of the functions in iwl-eeprom.c file are for agn devices only, Those functions do not have to be part of iwlcore.ko, so move those to iwl-agn-eeprom.c file.
--- drivers/net/wireless/iwlwifi/Makefile | 2 +- drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c | 454 +++++++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-agn.h | 6 + drivers/net/wireless/iwlwifi/iwl-eeprom.c | 374 +-------------------- drivers/net/wireless/iwlwifi/iwl-eeprom.h | 7 +- 5 files changed, 476 insertions(+), 367 deletions(-) create mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
drivers/net/wireless/iwlwifi/Makefile +1 -1
@@ -12,7 +12,7 @@ obj-$(CONFIG_IWLAGN) += iwlagn.o iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o iwl-agn-ict.o iwlagn-objs += iwl-agn-ucode.o iwl-agn-hcmd.o iwl-agn-tx.o iwlagn-objs += iwl-agn-lib.o iwl-agn-rx.o iwl-agn-calib.o -iwlagn-objs += iwl-agn-tt.o iwl-agn-sta.o +iwlagn-objs += iwl-agn-tt.o iwl-agn-sta.o iwl-agn-eeprom.o iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c new file +454 -0
454 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-agn.h +6 -0
@@ -312,4 +312,10 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) return cpu_to_le32(flags|(u32)rate); } +/* eeprom */ +void iwlcore_eeprom_enhanced_txpower (struct iwl_priv *priv); +void iwl_eeprom_get_mac (const struct iwl_priv *priv,u8 *mac); +int iwlcore_eeprom_acquire_semaphore (struct iwl_priv *priv); +void iwlcore_eeprom_release_semaphore (struct iwl_priv *priv); +#endif /* __iwl_agn_h__ */
drivers/net/wireless/iwlwifi/iwl-eeprom.c +14 -360
413 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-eeprom.h +1 -6
@@ -501,18 +501,13 @@ struct iwl_eeprom_ops { }; -void iwl_eeprom_get_mac (const struct iwl_priv *priv,u8 *mac);int iwl_eeprom_init (struct iwl_priv *priv);void iwl_eeprom_free (struct iwl_priv *priv);int iwl_eeprom_check_version (struct iwl_priv *priv);const u8 *iwl_eeprom_query_addr (const struct iwl_priv *priv,size_t offset); -u16 iwl_eeprom_query16 (const struct iwl_priv *priv,size_t offset); -int iwlcore_eeprom_verify_signature (struct iwl_priv *priv); -int iwlcore_eeprom_acquire_semaphore (struct iwl_priv *priv); -void iwlcore_eeprom_release_semaphore (struct iwl_priv *priv); +u16 iwl_eeprom_query16 (const struct iwl_priv *priv,size_t offset);const u8 *iwlcore_eeprom_query_addr (const struct iwl_priv *priv,size_t offset); -void iwlcore_eeprom_enhanced_txpower (struct iwl_priv *priv);int iwl_init_channel_map (struct iwl_priv *priv);void iwl_free_channel_map (struct iwl_priv *priv); const struct iwl_channel_info *iwl_get_channel_info(
Signature · 1 line
1.7.0.4