linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com>,
	Intel Linux Wireless <ilw@linux.intel.com>,
	linux-wireless@vger.kernel.org, bruno randolf <br1@einfach.org>
Subject: Re: [BUG] iwlwifi need to correct channels info
Date: Mon, 31 Jan 2011 10:38:43 +0100	[thread overview]
Message-ID: <20110131093840.GA20613@redhat.com> (raw)
In-Reply-To: <1296237969.5118.12.camel@jlt3.sipsolutions.net>

On Fri, Jan 28, 2011 at 07:06:09PM +0100, Johannes Berg wrote:
> On Fri, 2011-01-28 at 16:41 +0100, Stanislaw Gruszka wrote:
> > After commit 59eb21a6504731fc16db4cf9463065dd61093e08
> > "cfg80211: Extend channel to frequency mapping for 802.11j"
> > 5GHz networks are not seen on scan results.
> > 
> > I think above commit is correct, but we have broken channel
> > information on iwlwifi (freq is 0 on 5GHz channels):
> 
> No, the above commit is buggy -- it assumes sband->band is set when it
> isn't. 
But it should be, no? It seems we initialize it nowhere, but it's
used in iwl-*-rs.c

BTW:
Is iwl_eeprom_band_2[] array correct? It have 7, 8, 11, 12 channels entries
on 5GHz.

Can we get rid of /* FIXME: might be removed if scan is OK */ ?

> Does this fix it?

I tested on 3945, it fix freq=0 on messages. But what about something
slightly different? Use ch->band already set in iwl_init_channel_map()
and initialize sband->band.

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 92724cb..1c1da6f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -190,6 +190,7 @@ int iwlcore_init_geos(struct iwl_priv *priv)
 
 	/* 5.2GHz channels start after the 2.4GHz channels */
 	sband = &priv->bands[IEEE80211_BAND_5GHZ];
+	sband->band = IEEE80211_BAND_5GHZ;
 	sband->channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)];
 	/* just OFDM */
 	sband->bitrates = &rates[IWL_FIRST_OFDM_RATE];
@@ -200,6 +201,7 @@ int iwlcore_init_geos(struct iwl_priv *priv)
 					 IEEE80211_BAND_5GHZ);
 
 	sband = &priv->bands[IEEE80211_BAND_2GHZ];
+	sband->band = IEEE80211_BAND_2GHZ;
 	sband->channels = channels;
 	/* OFDM & CCK */
 	sband->bitrates = rates;
@@ -219,16 +221,12 @@ int iwlcore_init_geos(struct iwl_priv *priv)
 		if (!is_channel_valid(ch))
 			continue;
 
-		if (is_channel_a_band(ch))
-			sband =  &priv->bands[IEEE80211_BAND_5GHZ];
-		else
-			sband =  &priv->bands[IEEE80211_BAND_2GHZ];
+		sband =  &priv->bands[ch->band];
 
 		geo_ch = &sband->channels[sband->n_channels++];
 
 		geo_ch->center_freq =
-				ieee80211_channel_to_frequency(ch->channel,
-							       sband->band);
+			ieee80211_channel_to_frequency(ch->channel, ch->band);
 		geo_ch->max_power = ch->max_power_avg;
 		geo_ch->max_antenna_gain = 0xff;
 		geo_ch->hw_value = ch->channel;

  reply	other threads:[~2011-01-31  9:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-28 15:41 [BUG] iwlwifi need to correct channels info Stanislaw Gruszka
2011-01-28 18:06 ` Johannes Berg
2011-01-31  9:38   ` Stanislaw Gruszka [this message]
2011-01-31 10:53     ` Johannes Berg
2011-01-31 11:33       ` Stanislaw Gruszka
2011-01-31 10:44   ` Bruno Randolf

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=20110131093840.GA20613@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=br1@einfach.org \
    --cc=ilw@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wey-yi.w.guy@intel.com \
    /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: link
Be 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).