* [PATCH 0/2] iwlwifi fixes for stable 2.6.27 @ 2008-11-09 0:51 Tomas Winkler 2008-11-09 0:51 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler 2008-11-09 4:18 ` [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Greg KH 0 siblings, 2 replies; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 0:51 UTC (permalink / raw) To: stable, rjw, linville, reinette.chatre; +Cc: linux-wireless First one didn't make it into the stable due to type in emails Second is important bug fix that was kept out 2.6.27 merging window. There is no visible kernel bug but w/o this patch the 5000 iwlwifi HW is left un-calibrated which is critical --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] iwlwifi: generic init calibrations framework 2008-11-09 0:51 [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Tomas Winkler @ 2008-11-09 0:51 ` Tomas Winkler 2008-11-09 0:51 ` [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi Tomas Winkler 2008-11-09 4:18 ` [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Greg KH 1 sibling, 1 reply; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 0:51 UTC (permalink / raw) To: stable, rjw, linville, reinette.chatre; +Cc: linux-wireless, Tomas Winkler This patch allows variable number of init calibrations and allows addition new HW. This patch also fixes critical bug. Only last calibration result was applied. On reception of one calibration result all the calibration was freed. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/iwlwifi/iwl-5000-hw.h | 7 +++ drivers/net/wireless/iwlwifi/iwl-5000.c | 63 ++++------------------------ drivers/net/wireless/iwlwifi/iwl-calib.c | 60 ++++++++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-core.c | 19 +-------- drivers/net/wireless/iwlwifi/iwl-core.h | 8 +++- drivers/net/wireless/iwlwifi/iwl-dev.h | 14 +++---- 6 files changed, 90 insertions(+), 81 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 17d4f31..c479ee2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h @@ -129,6 +129,13 @@ struct iwl5000_shared { __le32 padding2; } __attribute__ ((packed)); +/* calibrations defined for 5000 */ +/* defines the order in which results should be sent to the runtime uCode */ +enum iwl5000_calib { + IWL5000_CALIB_LO, + IWL5000_CALIB_TX_IQ, + IWL5000_CALIB_TX_IQ_PERD, +}; #endif /* __iwl_5000_hw_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index b08036a..79ff288 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c @@ -445,48 +445,6 @@ static int iwl5000_send_Xtal_calib(struct iwl_priv *priv) sizeof(cal_cmd), &cal_cmd); } -static int iwl5000_send_calib_results(struct iwl_priv *priv) -{ - int ret = 0; - - struct iwl_host_cmd hcmd = { - .id = REPLY_PHY_CALIBRATION_CMD, - .meta.flags = CMD_SIZE_HUGE, - }; - - if (priv->calib_results.lo_res) { - hcmd.len = priv->calib_results.lo_res_len; - hcmd.data = priv->calib_results.lo_res; - ret = iwl_send_cmd_sync(priv, &hcmd); - - if (ret) - goto err; - } - - if (priv->calib_results.tx_iq_res) { - hcmd.len = priv->calib_results.tx_iq_res_len; - hcmd.data = priv->calib_results.tx_iq_res; - ret = iwl_send_cmd_sync(priv, &hcmd); - - if (ret) - goto err; - } - - if (priv->calib_results.tx_iq_perd_res) { - hcmd.len = priv->calib_results.tx_iq_perd_res_len; - hcmd.data = priv->calib_results.tx_iq_perd_res; - ret = iwl_send_cmd_sync(priv, &hcmd); - - if (ret) - goto err; - } - - return 0; -err: - IWL_ERROR("Error %d\n", ret); - return ret; -} - static int iwl5000_send_calib_cfg(struct iwl_priv *priv) { struct iwl5000_calib_cfg_cmd calib_cfg_cmd; @@ -511,33 +469,30 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv, struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; - - iwl_free_calib_results(priv); + int index; /* reduce the size of the length field itself */ len -= 4; + /* Define the order in which the results will be sent to the runtime + * uCode. iwl_send_calib_results sends them in a row according to their + * index. We sort them here */ switch (hdr->op_code) { case IWL5000_PHY_CALIBRATE_LO_CMD: - priv->calib_results.lo_res = kzalloc(len, GFP_ATOMIC); - priv->calib_results.lo_res_len = len; - memcpy(priv->calib_results.lo_res, pkt->u.raw, len); + index = IWL5000_CALIB_LO; break; case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: - priv->calib_results.tx_iq_res = kzalloc(len, GFP_ATOMIC); - priv->calib_results.tx_iq_res_len = len; - memcpy(priv->calib_results.tx_iq_res, pkt->u.raw, len); + index = IWL5000_CALIB_TX_IQ; break; case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: - priv->calib_results.tx_iq_perd_res = kzalloc(len, GFP_ATOMIC); - priv->calib_results.tx_iq_perd_res_len = len; - memcpy(priv->calib_results.tx_iq_perd_res, pkt->u.raw, len); + index = IWL5000_CALIB_TX_IQ_PERD; break; default: IWL_ERROR("Unknown calibration notification %d\n", hdr->op_code); return; } + iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len); } static void iwl5000_rx_calib_complete(struct iwl_priv *priv, @@ -832,7 +787,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) iwl5000_send_Xtal_calib(priv); if (priv->ucode_type == UCODE_RT) - iwl5000_send_calib_results(priv); + iwl_send_calib_results(priv); return 0; } diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c index ef49440..35fb4a4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-calib.c @@ -66,6 +66,66 @@ #include "iwl-core.h" #include "iwl-calib.h" +/***************************************************************************** + * INIT calibrations framework + *****************************************************************************/ + + int iwl_send_calib_results(struct iwl_priv *priv) +{ + int ret = 0; + int i = 0; + + struct iwl_host_cmd hcmd = { + .id = REPLY_PHY_CALIBRATION_CMD, + .meta.flags = CMD_SIZE_HUGE, + }; + + for (i = 0; i < IWL_CALIB_MAX; i++) + if (priv->calib_results[i].buf) { + hcmd.len = priv->calib_results[i].buf_len; + hcmd.data = priv->calib_results[i].buf; + ret = iwl_send_cmd_sync(priv, &hcmd); + if (ret) + goto err; + } + + return 0; +err: + IWL_ERROR("Error %d iteration %d\n", ret, i); + return ret; +} +EXPORT_SYMBOL(iwl_send_calib_results); + +int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len) +{ + if (res->buf_len != len) { + kfree(res->buf); + res->buf = kzalloc(len, GFP_ATOMIC); + } + if (unlikely(res->buf == NULL)) + return -ENOMEM; + + res->buf_len = len; + memcpy(res->buf, buf, len); + return 0; +} +EXPORT_SYMBOL(iwl_calib_set); + +void iwl_calib_free_results(struct iwl_priv *priv) +{ + int i; + + for (i = 0; i < IWL_CALIB_MAX; i++) { + kfree(priv->calib_results[i].buf); + priv->calib_results[i].buf = NULL; + priv->calib_results[i].buf_len = 0; + } +} + +/***************************************************************************** + * RUNTIME calibrations framework + *****************************************************************************/ + /* "false alarms" are signals that our DSP tries to lock onto, * but then determines that they are either noise, or transmissions * from a distant wireless network (also "noise", really) that get diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 80f2f84..444e262 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c @@ -950,22 +950,6 @@ err: } EXPORT_SYMBOL(iwl_init_drv); -void iwl_free_calib_results(struct iwl_priv *priv) -{ - kfree(priv->calib_results.lo_res); - priv->calib_results.lo_res = NULL; - priv->calib_results.lo_res_len = 0; - - kfree(priv->calib_results.tx_iq_res); - priv->calib_results.tx_iq_res = NULL; - priv->calib_results.tx_iq_res_len = 0; - - kfree(priv->calib_results.tx_iq_perd_res); - priv->calib_results.tx_iq_perd_res = NULL; - priv->calib_results.tx_iq_perd_res_len = 0; -} -EXPORT_SYMBOL(iwl_free_calib_results); - int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) { int ret = 0; @@ -993,10 +977,9 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) } EXPORT_SYMBOL(iwl_set_tx_power); - void iwl_uninit_drv(struct iwl_priv *priv) { - iwl_free_calib_results(priv); + iwl_calib_free_results(priv); iwlcore_free_geos(priv); iwl_free_channel_map(priv); kfree(priv->scan); diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 64f139e..51b36b1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h @@ -186,7 +186,6 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, void iwl_hw_detect(struct iwl_priv *priv); void iwl_clear_stations_table(struct iwl_priv *priv); -void iwl_free_calib_results(struct iwl_priv *priv); void iwl_reset_qos(struct iwl_priv *priv); void iwl_set_rxon_chain(struct iwl_priv *priv); int iwl_set_rxon_channel(struct iwl_priv *priv, @@ -291,6 +290,13 @@ int iwl_scan_initiate(struct iwl_priv *priv); void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); void iwl_setup_scan_deferred_work(struct iwl_priv *priv); +/******************************************************************************* + * Calibrations - implemented in iwl-calib.c + ******************************************************************************/ +int iwl_send_calib_results(struct iwl_priv *priv); +int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len); +void iwl_calib_free_results(struct iwl_priv *priv); + /***************************************************** * S e n d i n g H o s t C o m m a n d s * *****************************************************/ diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index cdfb343..deec634 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h @@ -745,13 +745,10 @@ struct statistics_general_data { u32 beacon_energy_c; }; -struct iwl_calib_results { - void *tx_iq_res; - void *tx_iq_perd_res; - void *lo_res; - u32 tx_iq_res_len; - u32 tx_iq_perd_res_len; - u32 lo_res_len; +/* Opaque calibration results */ +struct iwl_calib_result { + void *buf; + size_t buf_len; }; enum ucode_type { @@ -813,6 +810,7 @@ enum { #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ +#define IWL_CALIB_MAX 3 struct iwl_priv { @@ -857,7 +855,7 @@ struct iwl_priv { s32 last_temperature; /* init calibration results */ - struct iwl_calib_results calib_results; + struct iwl_calib_result calib_results[IWL_CALIB_MAX]; /* Scan related variables */ unsigned long last_scan_jiffies; -- 1.5.4.3 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi 2008-11-09 0:51 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler @ 2008-11-09 0:51 ` Tomas Winkler 2008-11-10 1:26 ` Zhu Yi 0 siblings, 1 reply; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 0:51 UTC (permalink / raw) To: stable, rjw, linville, reinette.chatre; +Cc: linux-wireless, Tomas Winkler This patch fixes suspend to RAM after by moving notify_mac out of iwlwifi mutex http://bugzilla.kernel.org/show_bug.cgi?id=11845 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Tested-by: Carlos R. Mafra <crmafra2@gmail.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index e01f048..edab202 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c @@ -2090,7 +2090,6 @@ static void iwl_alive_start(struct iwl_priv *priv) iwl4965_error_recovery(priv); iwl_power_update_mode(priv, 1); - ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) iwl4965_set_mode(priv, priv->iw_mode); @@ -2342,6 +2341,7 @@ static void iwl_bg_alive_start(struct work_struct *data) mutex_lock(&priv->mutex); iwl_alive_start(priv); mutex_unlock(&priv->mutex); + ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); } static void iwl4965_bg_rf_kill(struct work_struct *work) -- 1.5.4.3 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi 2008-11-09 0:51 ` [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi Tomas Winkler @ 2008-11-10 1:26 ` Zhu Yi 2008-11-11 20:04 ` [stable] " Greg KH 0 siblings, 1 reply; 9+ messages in thread From: Zhu Yi @ 2008-11-10 1:26 UTC (permalink / raw) To: Tomas Winkler, greg Cc: stable@kernel.org, rjw@sisk.pl, linville@tuxdriver.com, Chatre, Reinette, linux-wireless@vger.kernel.org On Sun, 2008-11-09 at 08:51 +0800, Tomas Winkler wrote: > This patch fixes suspend to RAM after by moving > notify_mac out of iwlwifi mutex > > http://bugzilla.kernel.org/show_bug.cgi?id=11845 Greg, please also merge the iwl3945 counterpart for this problem. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d54bc4e3fc5c56600a13c9ebc0a7e1077ac05d59 Thanks, -yi > Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > Tested-by: Carlos R. Mafra <crmafra2@gmail.com> > Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> > Cc: Rafael J. Wysocki <rjw@sisk.pl> > Signed-off-by: John W. Linville <linville@tuxdriver.com> > --- > drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c > index e01f048..edab202 100644 > --- a/drivers/net/wireless/iwlwifi/iwl-agn.c > +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c > @@ -2090,7 +2090,6 @@ static void iwl_alive_start(struct iwl_priv *priv) > iwl4965_error_recovery(priv); > > iwl_power_update_mode(priv, 1); > - ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); > > if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) > iwl4965_set_mode(priv, priv->iw_mode); > @@ -2342,6 +2341,7 @@ static void iwl_bg_alive_start(struct work_struct *data) > mutex_lock(&priv->mutex); > iwl_alive_start(priv); > mutex_unlock(&priv->mutex); > + ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); > } > > static void iwl4965_bg_rf_kill(struct work_struct *work) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [stable] [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi 2008-11-10 1:26 ` Zhu Yi @ 2008-11-11 20:04 ` Greg KH 0 siblings, 0 replies; 9+ messages in thread From: Greg KH @ 2008-11-11 20:04 UTC (permalink / raw) To: Zhu Yi Cc: Tomas Winkler, rjw@sisk.pl, Chatre, Reinette, linux-wireless@vger.kernel.org, stable@kernel.org, linville@tuxdriver.com On Mon, Nov 10, 2008 at 09:26:16AM +0800, Zhu Yi wrote: > On Sun, 2008-11-09 at 08:51 +0800, Tomas Winkler wrote: > > This patch fixes suspend to RAM after by moving > > notify_mac out of iwlwifi mutex > > > > http://bugzilla.kernel.org/show_bug.cgi?id=11845 > > Greg, please also merge the iwl3945 counterpart for this problem. > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d54bc4e3fc5c56600a13c9ebc0a7e1077ac05d59 I've added this now. thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 2008-11-09 0:51 [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Tomas Winkler 2008-11-09 0:51 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler @ 2008-11-09 4:18 ` Greg KH 2008-11-09 7:13 ` Tomas Winkler 1 sibling, 1 reply; 9+ messages in thread From: Greg KH @ 2008-11-09 4:18 UTC (permalink / raw) To: Tomas Winkler; +Cc: stable, rjw, linville, reinette.chatre, linux-wireless On Sun, Nov 09, 2008 at 02:51:05AM +0200, Tomas Winkler wrote: > First one didn't make it into the stable due to type in emails > Second is important bug fix that was kept out 2.6.27 merging window. > There is no visible kernel bug but w/o this patch the 5000 iwlwifi HW > is left un-calibrated which is critical Are these already in Linus's tree? If so, do you have a git commit id for them? thanks, greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 2008-11-09 4:18 ` [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Greg KH @ 2008-11-09 7:13 ` Tomas Winkler 2008-11-11 20:03 ` Greg KH 0 siblings, 1 reply; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 7:13 UTC (permalink / raw) To: Greg KH; +Cc: stable, rjw, linville, reinette.chatre, linux-wireless On Sun, Nov 9, 2008 at 6:18 AM, Greg KH <greg@kroah.com> wrote: > On Sun, Nov 09, 2008 at 02:51:05AM +0200, Tomas Winkler wrote: >> First one didn't make it into the stable due to type in emails >> Second is important bug fix that was kept out 2.6.27 merging window. >> There is no visible kernel bug but w/o this patch the 5000 iwlwifi HW >> is left un-calibrated which is critical > > Are these already in Linus's tree? If so, do you have a git commit id > for them? iwlwifi: fix suspend to RAM in iwlwifi 10d0bd56966571d0324dfd9bbb8aa913a60bef5f iwlwifi: generic init calibrations framework 6e21f2c109edd746a10e08186484bae8168cdd0c Thanks Tomas ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 2008-11-09 7:13 ` Tomas Winkler @ 2008-11-11 20:03 ` Greg KH 0 siblings, 0 replies; 9+ messages in thread From: Greg KH @ 2008-11-11 20:03 UTC (permalink / raw) To: Tomas Winkler; +Cc: stable, rjw, linville, reinette.chatre, linux-wireless On Sun, Nov 09, 2008 at 09:13:56AM +0200, Tomas Winkler wrote: > On Sun, Nov 9, 2008 at 6:18 AM, Greg KH <greg@kroah.com> wrote: > > On Sun, Nov 09, 2008 at 02:51:05AM +0200, Tomas Winkler wrote: > >> First one didn't make it into the stable due to type in emails > >> Second is important bug fix that was kept out 2.6.27 merging window. > >> There is no visible kernel bug but w/o this patch the 5000 iwlwifi HW > >> is left un-calibrated which is critical > > > > Are these already in Linus's tree? If so, do you have a git commit id > > for them? > > iwlwifi: fix suspend to RAM in iwlwifi 10d0bd56966571d0324dfd9bbb8aa913a60bef5f > iwlwifi: generic init calibrations framework > 6e21f2c109edd746a10e08186484bae8168cdd0c Thanks, I've now added them, and a few others that were asked for by other developers. greg k-h ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/2] iwlwifi fixes for stable 2.6.27 @ 2008-11-09 0:46 Tomas Winkler 2008-11-09 0:46 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler 0 siblings, 1 reply; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 0:46 UTC (permalink / raw) To: stable, rjw, linville, reinette.chatre; +Cc: linux-wireless First one didn't make it into the stable due to type in emails Second is important bug fix that was kept out 2.6.27 merging window. There is no visible kernel bug but w/o this patch the 5000 iwlwifi HW is left un-calibrated which is critical. --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] iwlwifi: generic init calibrations framework 2008-11-09 0:46 Tomas Winkler @ 2008-11-09 0:46 ` Tomas Winkler 2008-11-09 0:46 ` [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi Tomas Winkler 0 siblings, 1 reply; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 0:46 UTC (permalink / raw) To: stable, rjw, linville, reinette.chatre; +Cc: linux-wireless, Tomas Winkler This patch allows variable number of init calibrations and allows addition new HW. This patch also fixes critical bug. Only last calibration result was applied. On reception of one calibration result all the calibration was freed. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/iwlwifi/iwl-5000-hw.h | 7 +++ drivers/net/wireless/iwlwifi/iwl-5000.c | 63 ++++------------------------ drivers/net/wireless/iwlwifi/iwl-calib.c | 60 ++++++++++++++++++++++++++ drivers/net/wireless/iwlwifi/iwl-core.c | 19 +-------- drivers/net/wireless/iwlwifi/iwl-core.h | 8 +++- drivers/net/wireless/iwlwifi/iwl-dev.h | 14 +++---- 6 files changed, 90 insertions(+), 81 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h index 17d4f31..c479ee2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h +++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h @@ -129,6 +129,13 @@ struct iwl5000_shared { __le32 padding2; } __attribute__ ((packed)); +/* calibrations defined for 5000 */ +/* defines the order in which results should be sent to the runtime uCode */ +enum iwl5000_calib { + IWL5000_CALIB_LO, + IWL5000_CALIB_TX_IQ, + IWL5000_CALIB_TX_IQ_PERD, +}; #endif /* __iwl_5000_hw_h__ */ diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index b08036a..79ff288 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c @@ -445,48 +445,6 @@ static int iwl5000_send_Xtal_calib(struct iwl_priv *priv) sizeof(cal_cmd), &cal_cmd); } -static int iwl5000_send_calib_results(struct iwl_priv *priv) -{ - int ret = 0; - - struct iwl_host_cmd hcmd = { - .id = REPLY_PHY_CALIBRATION_CMD, - .meta.flags = CMD_SIZE_HUGE, - }; - - if (priv->calib_results.lo_res) { - hcmd.len = priv->calib_results.lo_res_len; - hcmd.data = priv->calib_results.lo_res; - ret = iwl_send_cmd_sync(priv, &hcmd); - - if (ret) - goto err; - } - - if (priv->calib_results.tx_iq_res) { - hcmd.len = priv->calib_results.tx_iq_res_len; - hcmd.data = priv->calib_results.tx_iq_res; - ret = iwl_send_cmd_sync(priv, &hcmd); - - if (ret) - goto err; - } - - if (priv->calib_results.tx_iq_perd_res) { - hcmd.len = priv->calib_results.tx_iq_perd_res_len; - hcmd.data = priv->calib_results.tx_iq_perd_res; - ret = iwl_send_cmd_sync(priv, &hcmd); - - if (ret) - goto err; - } - - return 0; -err: - IWL_ERROR("Error %d\n", ret); - return ret; -} - static int iwl5000_send_calib_cfg(struct iwl_priv *priv) { struct iwl5000_calib_cfg_cmd calib_cfg_cmd; @@ -511,33 +469,30 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv, struct iwl_rx_packet *pkt = (void *)rxb->skb->data; struct iwl5000_calib_hdr *hdr = (struct iwl5000_calib_hdr *)pkt->u.raw; int len = le32_to_cpu(pkt->len) & FH_RSCSR_FRAME_SIZE_MSK; - - iwl_free_calib_results(priv); + int index; /* reduce the size of the length field itself */ len -= 4; + /* Define the order in which the results will be sent to the runtime + * uCode. iwl_send_calib_results sends them in a row according to their + * index. We sort them here */ switch (hdr->op_code) { case IWL5000_PHY_CALIBRATE_LO_CMD: - priv->calib_results.lo_res = kzalloc(len, GFP_ATOMIC); - priv->calib_results.lo_res_len = len; - memcpy(priv->calib_results.lo_res, pkt->u.raw, len); + index = IWL5000_CALIB_LO; break; case IWL5000_PHY_CALIBRATE_TX_IQ_CMD: - priv->calib_results.tx_iq_res = kzalloc(len, GFP_ATOMIC); - priv->calib_results.tx_iq_res_len = len; - memcpy(priv->calib_results.tx_iq_res, pkt->u.raw, len); + index = IWL5000_CALIB_TX_IQ; break; case IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD: - priv->calib_results.tx_iq_perd_res = kzalloc(len, GFP_ATOMIC); - priv->calib_results.tx_iq_perd_res_len = len; - memcpy(priv->calib_results.tx_iq_perd_res, pkt->u.raw, len); + index = IWL5000_CALIB_TX_IQ_PERD; break; default: IWL_ERROR("Unknown calibration notification %d\n", hdr->op_code); return; } + iwl_calib_set(&priv->calib_results[index], pkt->u.raw, len); } static void iwl5000_rx_calib_complete(struct iwl_priv *priv, @@ -832,7 +787,7 @@ static int iwl5000_alive_notify(struct iwl_priv *priv) iwl5000_send_Xtal_calib(priv); if (priv->ucode_type == UCODE_RT) - iwl5000_send_calib_results(priv); + iwl_send_calib_results(priv); return 0; } diff --git a/drivers/net/wireless/iwlwifi/iwl-calib.c b/drivers/net/wireless/iwlwifi/iwl-calib.c index ef49440..35fb4a4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-calib.c +++ b/drivers/net/wireless/iwlwifi/iwl-calib.c @@ -66,6 +66,66 @@ #include "iwl-core.h" #include "iwl-calib.h" +/***************************************************************************** + * INIT calibrations framework + *****************************************************************************/ + + int iwl_send_calib_results(struct iwl_priv *priv) +{ + int ret = 0; + int i = 0; + + struct iwl_host_cmd hcmd = { + .id = REPLY_PHY_CALIBRATION_CMD, + .meta.flags = CMD_SIZE_HUGE, + }; + + for (i = 0; i < IWL_CALIB_MAX; i++) + if (priv->calib_results[i].buf) { + hcmd.len = priv->calib_results[i].buf_len; + hcmd.data = priv->calib_results[i].buf; + ret = iwl_send_cmd_sync(priv, &hcmd); + if (ret) + goto err; + } + + return 0; +err: + IWL_ERROR("Error %d iteration %d\n", ret, i); + return ret; +} +EXPORT_SYMBOL(iwl_send_calib_results); + +int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len) +{ + if (res->buf_len != len) { + kfree(res->buf); + res->buf = kzalloc(len, GFP_ATOMIC); + } + if (unlikely(res->buf == NULL)) + return -ENOMEM; + + res->buf_len = len; + memcpy(res->buf, buf, len); + return 0; +} +EXPORT_SYMBOL(iwl_calib_set); + +void iwl_calib_free_results(struct iwl_priv *priv) +{ + int i; + + for (i = 0; i < IWL_CALIB_MAX; i++) { + kfree(priv->calib_results[i].buf); + priv->calib_results[i].buf = NULL; + priv->calib_results[i].buf_len = 0; + } +} + +/***************************************************************************** + * RUNTIME calibrations framework + *****************************************************************************/ + /* "false alarms" are signals that our DSP tries to lock onto, * but then determines that they are either noise, or transmissions * from a distant wireless network (also "noise", really) that get diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 80f2f84..444e262 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c @@ -950,22 +950,6 @@ err: } EXPORT_SYMBOL(iwl_init_drv); -void iwl_free_calib_results(struct iwl_priv *priv) -{ - kfree(priv->calib_results.lo_res); - priv->calib_results.lo_res = NULL; - priv->calib_results.lo_res_len = 0; - - kfree(priv->calib_results.tx_iq_res); - priv->calib_results.tx_iq_res = NULL; - priv->calib_results.tx_iq_res_len = 0; - - kfree(priv->calib_results.tx_iq_perd_res); - priv->calib_results.tx_iq_perd_res = NULL; - priv->calib_results.tx_iq_perd_res_len = 0; -} -EXPORT_SYMBOL(iwl_free_calib_results); - int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) { int ret = 0; @@ -993,10 +977,9 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) } EXPORT_SYMBOL(iwl_set_tx_power); - void iwl_uninit_drv(struct iwl_priv *priv) { - iwl_free_calib_results(priv); + iwl_calib_free_results(priv); iwlcore_free_geos(priv); iwl_free_channel_map(priv); kfree(priv->scan); diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 64f139e..51b36b1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h @@ -186,7 +186,6 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, void iwl_hw_detect(struct iwl_priv *priv); void iwl_clear_stations_table(struct iwl_priv *priv); -void iwl_free_calib_results(struct iwl_priv *priv); void iwl_reset_qos(struct iwl_priv *priv); void iwl_set_rxon_chain(struct iwl_priv *priv); int iwl_set_rxon_channel(struct iwl_priv *priv, @@ -291,6 +290,13 @@ int iwl_scan_initiate(struct iwl_priv *priv); void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); void iwl_setup_scan_deferred_work(struct iwl_priv *priv); +/******************************************************************************* + * Calibrations - implemented in iwl-calib.c + ******************************************************************************/ +int iwl_send_calib_results(struct iwl_priv *priv); +int iwl_calib_set(struct iwl_calib_result *res, const u8 *buf, int len); +void iwl_calib_free_results(struct iwl_priv *priv); + /***************************************************** * S e n d i n g H o s t C o m m a n d s * *****************************************************/ diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index cdfb343..deec634 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h @@ -745,13 +745,10 @@ struct statistics_general_data { u32 beacon_energy_c; }; -struct iwl_calib_results { - void *tx_iq_res; - void *tx_iq_perd_res; - void *lo_res; - u32 tx_iq_res_len; - u32 tx_iq_perd_res_len; - u32 lo_res_len; +/* Opaque calibration results */ +struct iwl_calib_result { + void *buf; + size_t buf_len; }; enum ucode_type { @@ -813,6 +810,7 @@ enum { #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ +#define IWL_CALIB_MAX 3 struct iwl_priv { @@ -857,7 +855,7 @@ struct iwl_priv { s32 last_temperature; /* init calibration results */ - struct iwl_calib_results calib_results; + struct iwl_calib_result calib_results[IWL_CALIB_MAX]; /* Scan related variables */ unsigned long last_scan_jiffies; -- 1.5.4.3 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi 2008-11-09 0:46 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler @ 2008-11-09 0:46 ` Tomas Winkler 0 siblings, 0 replies; 9+ messages in thread From: Tomas Winkler @ 2008-11-09 0:46 UTC (permalink / raw) To: stable, rjw, linville, reinette.chatre; +Cc: linux-wireless, Tomas Winkler This patch fixes suspend to RAM after by moving notify_mac out of iwlwifi mutex http://bugzilla.kernel.org/show_bug.cgi?id=11845 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Tested-by: Carlos R. Mafra <crmafra2@gmail.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: John W. Linville <linville@tuxdriver.com> --- drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index e01f048..edab202 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c @@ -2090,7 +2090,6 @@ static void iwl_alive_start(struct iwl_priv *priv) iwl4965_error_recovery(priv); iwl_power_update_mode(priv, 1); - ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) iwl4965_set_mode(priv, priv->iw_mode); @@ -2342,6 +2341,7 @@ static void iwl_bg_alive_start(struct work_struct *data) mutex_lock(&priv->mutex); iwl_alive_start(priv); mutex_unlock(&priv->mutex); + ieee80211_notify_mac(priv->hw, IEEE80211_NOTIFY_RE_ASSOC); } static void iwl4965_bg_rf_kill(struct work_struct *work) -- 1.5.4.3 --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-11-11 20:14 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-11-09 0:51 [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Tomas Winkler 2008-11-09 0:51 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler 2008-11-09 0:51 ` [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi Tomas Winkler 2008-11-10 1:26 ` Zhu Yi 2008-11-11 20:04 ` [stable] " Greg KH 2008-11-09 4:18 ` [stable] [PATCH 0/2] iwlwifi fixes for stable 2.6.27 Greg KH 2008-11-09 7:13 ` Tomas Winkler 2008-11-11 20:03 ` Greg KH -- strict thread matches above, loose matches on Subject: below -- 2008-11-09 0:46 Tomas Winkler 2008-11-09 0:46 ` [PATCH 1/2] iwlwifi: generic init calibrations framework Tomas Winkler 2008-11-09 0:46 ` [PATCH 2/2] iwlwifi: fix suspend to RAM in iwlwifi Tomas Winkler
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).