From patchwork Tue Jun 1 15:21:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sedat Dilek X-Patchwork-Id: 103568 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o51FLC1x032431 for ; Tue, 1 Jun 2010 15:21:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756653Ab0FAPVL (ORCPT ); Tue, 1 Jun 2010 11:21:11 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:63570 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756460Ab0FAPVJ (ORCPT ); Tue, 1 Jun 2010 11:21:09 -0400 Received: by wyi11 with SMTP id 11so1069836wyi.19 for ; Tue, 01 Jun 2010 08:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to :in-reply-to:references:date:message-id:subject:from:to:cc :content-type; bh=fslTHYMcuEH4AIKaifdidcdKRloU6vN3Z3DeXlj8wbI=; b=NV2/t7nU4WgfQC+B3jNfw0zBYbQioiJWw5sx2/izYfYtCFZJweA6Mm85/2Opoxcbx0 iFJZZM3aA6nRXnPttgV2lEF0S+pplsV8svJM+rFM7C7waj4kvhVnpGiaSF0fKTCfdpjq EP4dS9nQarayvQ2Yi9uzHVOhsdyV96aXwYa58= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=uL4FmE2+QzCPzXI6fDcFlInijIqZ+IWoSSXUM1CYTNo2m3BQnfdUh2yOcRsgCmSBIK BIm0p6i4TuxCK+AfAUZRzoEbGd0jrdoB7UAZZWexIyKQ4LBUpM2tD5hlehYVV4lnsI1s 2v9WgHrUb9aVkblOHiptvqrKtqC0AZ10quLUs= MIME-Version: 1.0 Received: by 10.216.163.79 with SMTP id z57mr5505449wek.17.1275405668061; Tue, 01 Jun 2010 08:21:08 -0700 (PDT) Received: by 10.216.7.7 with HTTP; Tue, 1 Jun 2010 08:21:07 -0700 (PDT) Reply-To: sedat.dilek@gmail.com In-Reply-To: <1275404221.2839.2.camel@maxim-laptop> References: <1275395142.14385.6.camel@maxim-laptop> <1275404221.2839.2.camel@maxim-laptop> Date: Tue, 1 Jun 2010 17:21:07 +0200 Message-ID: Subject: Re: IWL3945 problems in 2.6.35-rc1 From: Sedat Dilek To: Maxim Levitsky Cc: linux-wireless , iwlwifi maling list Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 01 Jun 2010 15:21:13 +0000 (UTC) diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 71aebbb..6e53154 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -1783,6 +1783,74 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) #endif } +static int iwl3945_get_single_channel_for_scan(struct iwl_priv *priv, + struct ieee80211_vif *vif, + enum ieee80211_band band, + struct iwl3945_scan_channel *scan_ch) +{ + const struct ieee80211_supported_band *sband; + const struct iwl_channel_info *ch_info; + u16 passive_dwell = 0; + u16 active_dwell = 0; + int i, added = 0; + u16 channel = 0; + + sband = iwl_get_hw_mode(priv, band); + if (!sband) { + IWL_ERR(priv, "invalid band\n"); + return added; + } + + active_dwell = iwl_get_active_dwell_time(priv, band, 0); + passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); + + if (passive_dwell <= active_dwell) + passive_dwell = active_dwell + 1; + + /* only scan single channel, good enough to reset the RF */ + /* pick the first valid not in-use channel */ + if (band == IEEE80211_BAND_5GHZ) { + for (i = 14; i < priv->channel_count; i++) { + if (priv->channel_info[i].channel != + le16_to_cpu(priv->staging_rxon.channel)) { + channel = priv->channel_info[i].channel; + ch_info = iwl_get_channel_info(priv, + band, channel); + if (is_channel_valid(ch_info)) + break; + } + } + } else { + for (i = 0; i < 14; i++) { + if (priv->channel_info[i].channel != + le16_to_cpu(priv->staging_rxon.channel)) { + channel = + priv->channel_info[i].channel; + ch_info = iwl_get_channel_info(priv, + band, channel); + if (is_channel_valid(ch_info)) + break; + } + } + } + + if (channel) { + scan_ch->channel = cpu_to_le16(channel); + scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; + scan_ch->active_dwell = cpu_to_le16(active_dwell); + scan_ch->passive_dwell = cpu_to_le16(passive_dwell); + /* Set txpower levels to defaults */ + scan_ch->tpc.dsp_atten = 110; + if (band == IEEE80211_BAND_5GHZ) + scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; + else + scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); + added++; + } else + IWL_ERR(priv, "no valid channel found\n"); + return added; +} + static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, enum ieee80211_band band, u8 is_active, u8 n_probes, @@ -2933,10 +3001,23 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) /* select Rx antennas */ scan->flags |= iwl3945_get_antenna_flags(priv); - scan->channel_count = + if (priv->is_internal_short_scan) { + scan->channel_count = + iwl3945_get_single_channel_for_scan(priv, vif, band, + (void *)&scan->data[le16_to_cpu( + scan->tx_cmd.len)]); + } else { + scan->channel_count = + iwl3945_get_channels_for_scan(priv, band, + is_active, n_probes, + (void *)&scan->data[le16_to_cpu( + scan->tx_cmd.len)], vif); + } + + /*scan->channel_count = iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); - +*/ if (scan->channel_count == 0) { IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); goto done;