LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de> To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes <jmforbes@linuxtx.org>, Zwane Mwaikambo <zwane@arm.linux.org.uk>, "Theodore Ts'o" <tytso@mit.edu>, Randy Dunlap <rdunlap@xenotime.net>, Dave Jones <davej@redhat.com>, Chuck Wolber <chuckw@quantumlinux.com>, Chris Wedgwood <reviews@ml.cw.f00f.org>, Michael Krufky <mkrufky@linuxtv.org>, Chuck Ebbert <cebbert@redhat.com>, Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>, Rodrigo Rubira Branco <rbranco@la.checkpoint.com>, Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Tomas Winkler <tomas.winkler@intel.com>, Emmanuel Grumbach <emmanuel.grumbach@intel.com>, Zhu Yi <yi.zhu@intel.com>, "John W. Linville" <linville@tuxdriver.com> Subject: [patch 34/49] iwlwifi: generic init calibrations framework Date: Tue, 11 Nov 2008 16:24:04 -0800 [thread overview] Message-ID: <20081112002404.GI10989@kroah.com> (raw) In-Reply-To: <20081112002215.GA10989@kroah.com> [-- Attachment #1: iwlwifi-generic-init-calibrations-framework.patch --] [-- Type: text/plain, Size: 9474 bytes --] 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Tomas Winkler <tomas.winkler@intel.com> commit 6e21f2c109edd746a10e08186484bae8168cdd0c upstream 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- 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(-) --- 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(struc 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(stru 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 i iwl5000_send_Xtal_calib(priv); if (priv->ucode_type == UCODE_RT) - iwl5000_send_calib_results(priv); + iwl_send_calib_results(priv); return 0; } --- 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__ */ --- 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 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c @@ -956,22 +956,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; @@ -999,10 +983,9 @@ int iwl_set_tx_power(struct iwl_priv *pr } 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); --- 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(struc 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 *p 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 * *****************************************************/ --- 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; --
next prev parent reply other threads:[~2008-11-12 0:39 UTC|newest] Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20081112001401.926965113@mini.kroah.org> 2008-11-12 0:22 ` [patch 00/49] 2.6.27.5 stable review Greg KH 2008-11-12 0:22 ` [patch 01/49] ext3: wait on all pending commits in ext3_sync_fs Greg KH 2008-11-12 0:22 ` [patch 02/49] x86: add DMI quirk for AMI BIOS which corrupts address 0xc000 during resume Greg KH 2008-11-12 0:22 ` [patch 03/49] x86: reserve low 64K on AMI and Phoenix BIOS boxen Greg KH 2008-11-12 0:22 ` [patch 04/49] x86: add X86_RESERVE_LOW_64K Greg KH 2008-11-12 0:23 ` [patch 05/49] x86: fix CONFIG_X86_RESERVE_LOW_64K=y Greg KH 2008-11-12 0:23 ` [patch 06/49] x86: fix macro with bad_bios_dmi_table Greg KH 2008-11-12 0:23 ` [patch 07/49] cgroups: fix invalid cgrp->dentry before cgroup has been completely removed Greg KH 2008-11-12 0:23 ` [patch 08/49] hugetlb: pull gigantic page initialisation out of the default path Greg KH 2008-11-12 0:23 ` [patch 09/49] hugetlbfs: handle pages higher order than MAX_ORDER Greg KH 2008-11-12 0:23 ` [patch 10/49] cciss: fix regression firmware not displayed in procfs Greg KH 2008-11-12 0:23 ` [patch 11/49] cciss: fix sysfs broken symlink regression Greg KH 2008-11-12 0:23 ` [patch 12/49] cciss: new hardware support Greg KH 2008-11-12 0:23 ` [patch 13/49] md: linear: Fix a division by zero bug for very small arrays Greg KH 2008-11-12 0:23 ` [patch 14/49] md: fix bug in raid10 recovery Greg KH 2008-11-12 0:23 ` [patch 15/49] JFFS2: fix race condition in jffs2_lzo_compress() Greg KH 2008-11-12 0:23 ` [patch 16/49] JFFS2: Fix lack of locking in thread_should_wake() Greg KH 2008-11-12 0:23 ` [patch 17/49] ARM: xsc3: fix xsc3_l2_inv_range Greg KH 2008-11-12 0:23 ` [patch 18/49] MTD: Fix cfi_send_gen_cmd handling of x16 devices in x8 mode (v4) Greg KH 2008-11-12 0:23 ` [patch 19/49] x86: dont use tsc_khz to calculate lpj if notsc is passed Greg KH 2008-11-12 0:23 ` [patch 20/49] net: unix: fix inflight counting bug in garbage collector Greg KH 2008-11-12 0:23 ` [patch 21/49] r8169: get ethtool settings through the generic mii helper Greg KH 2008-11-12 0:23 ` [patch 22/49] r8169: fix RxMissed register access Greg KH 2008-11-12 0:23 ` [patch 23/49] r8169: wake up the PHY of the 8168 Greg KH 2008-11-12 0:23 ` [patch 24/49] I/OAT: fix channel resources free for not allocated channels Greg KH 2008-11-12 0:23 ` [patch 25/49] I/OAT: fix dma_pin_iovec_pages() error handling Greg KH 2008-11-12 0:23 ` [patch 26/49] I/OAT: fix async_tx.callback checking Greg KH 2008-11-12 0:23 ` [patch 27/49] dca: fixup initialization dependency Greg KH 2008-11-12 0:23 ` [patch 28/49] iwlwifi: allow consecutive scans in unassociated state Greg KH 2008-11-12 0:23 ` [patch 29/49] iwlwifi: allow association on radar channel in power save Greg KH 2008-11-12 0:23 ` [patch 30/49] iwlwifi: remove HT flags from RXON when not in HT anymore Greg KH 2008-11-12 0:23 ` [patch 31/49] iwlwifi: dont fail if scan is issued too early Greg KH 2008-11-12 0:24 ` [patch 32/49] iwlwifi: use correct DMA_MASK Greg KH 2008-11-12 0:24 ` [patch 33/49] iwlwifi: fix suspend to RAM in iwlwifi Greg KH 2008-11-12 0:24 ` Greg KH [this message] 2008-11-12 0:24 ` [patch 35/49] zd1211rw: Add 2 device IDs Greg KH 2008-11-12 0:24 ` [patch 36/49] iwl3945: fix deadlock on suspend Greg KH 2008-11-12 0:24 ` [patch 37/49] iwl3945: do not send scan command if channel count zero Greg KH 2008-11-12 0:24 ` [patch 38/49] cpqarry: fix return value of cpqarray_init() Greg KH 2008-11-12 0:24 ` [patch 39/49] ACPI: dock: avoid check _STA method Greg KH 2008-11-12 0:24 ` [patch 40/49] ARM: 5300/1: fixup spitz reset during boot Greg KH 2008-11-12 0:24 ` [patch 41/49] KEYS: Make request key instantiate the per-user keyrings Greg KH 2008-11-12 0:24 ` [patch 42/49] libata: fix last_reset timestamp handling Greg KH 2008-11-12 0:24 ` [patch 43/49] ALSA: hda: make a STAC_DELL_EQ option Greg KH 2008-11-12 0:24 ` [patch 44/49] Fix __pfn_to_page(pfn) for CONFIG_DISCONTIGMEM=y Greg KH 2008-11-12 0:24 ` [patch 45/49] mmc: increase SD write timeout for crappy cards Greg KH 2008-11-12 0:24 ` [patch 46/49] hfsplus: fix Buffer overflow with a corrupted image (CVE-2008-4933) Greg KH 2008-11-12 0:24 ` [patch 47/49] hfsplus: check read_mapping_page() return value (CVE-2008-4934) Greg KH 2008-11-12 0:24 ` [patch 48/49] hfs: fix namelength memory corruption (CVE-2008-5025) Greg KH 2008-11-12 0:24 ` [patch 49/49] HID: fix incorrent length condition in hidraw_write() Greg KH 2008-11-12 0:44 ` [patch 00/49] 2.6.27.5 stable review Gabriel C 2008-11-12 1:07 ` Greg KH 2008-11-12 0:54 ` Willy Tarreau 2008-11-12 14:08 ` Frans Pop 2008-11-12 17:03 ` [stable] " Greg KH 2008-11-13 22:07 ` Greg KH
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20081112002404.GI10989@kroah.com \ --to=gregkh@suse.de \ --cc=akpm@linux-foundation.org \ --cc=alan@lxorguk.ukuu.org.uk \ --cc=cavokz@gmail.com \ --cc=cebbert@redhat.com \ --cc=chuckw@quantumlinux.com \ --cc=davej@redhat.com \ --cc=emmanuel.grumbach@intel.com \ --cc=eteo@redhat.com \ --cc=jake@lwn.net \ --cc=jmforbes@linuxtx.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linville@tuxdriver.com \ --cc=mkrufky@linuxtv.org \ --cc=rbranco@la.checkpoint.com \ --cc=rdunlap@xenotime.net \ --cc=reviews@ml.cw.f00f.org \ --cc=stable@kernel.org \ --cc=tomas.winkler@intel.com \ --cc=torvalds@linux-foundation.org \ --cc=tytso@mit.edu \ --cc=w@1wt.eu \ --cc=yi.zhu@intel.com \ --cc=zwane@arm.linux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).