Skip to contentSkip to conversation

iwlwifi need to correct channels info

BUG Stanislaw Gruszka 3 participants 6 messages Jan 28, 2011 – Jan 31, 2011 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

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):

Channel 1 Freq=2412[2.4GHz] valid flag=0x20 Channel 2 Freq=2417[2.4GHz] valid flag=0x20 Channel 3 Freq=2422[2.4GHz] valid flag=0x20 Channel 4 Freq=2427[2.4GHz] valid flag=0x20 Channel 5 Freq=2432[2.4GHz] valid flag=0x0 Channel 6 Freq=2437[2.4GHz] valid flag=0x0 Channel 7 Freq=2442[2.4GHz] valid flag=0x0 Channel 8 Freq=2447[2.4GHz] valid flag=0x10 Channel 9 Freq=2452[2.4GHz] valid flag=0x10 Channel 10 Freq=2457[2.4GHz] valid flag=0x10 Channel 11 Freq=2462[2.4GHz] valid flag=0x10 Channel 12 Freq=2467[2.4GHz] valid flag=0x36 Channel 13 Freq=2472[2.4GHz] valid flag=0x36 Channel 36 Freq=0[5.2GHz] valid flag=0x26 Channel 40 Freq=0[5.2GHz] valid flag=0x16 Channel 44 Freq=0[5.2GHz] valid flag=0x26 Channel 48 Freq=0[5.2GHz] valid flag=0x16 Channel 52 Freq=0[5.2GHz] valid flag=0x2E Channel 56 Freq=0[5.2GHz] valid flag=0x1E Channel 60 Freq=0[5.2GHz] valid flag=0x2E Channel 64 Freq=0[5.2GHz] valid flag=0x1E Channel 100 Freq=0[5.2GHz] valid flag=0x2E Channel 104 Freq=0[5.2GHz] valid flag=0x1E Channel 108 Freq=0[5.2GHz] valid flag=0x2E Channel 112 Freq=0[5.2GHz] valid flag=0x1E Channel 116 Freq=0[5.2GHz] valid flag=0x2E Channel 120 Freq=0[5.2GHz] valid flag=0x1E Channel 124 Freq=0[5.2GHz] valid flag=0x2E Channel 128 Freq=0[5.2GHz] valid flag=0x1E Channel 132 Freq=0[5.2GHz] valid flag=0x2E Channel 136 Freq=0[5.2GHz] valid flag=0x1E Channel 140 Freq=0[5.2GHz] valid flag=0x3E Channel 149 Freq=0[5.2GHz] valid flag=0x26 Channel 153 Freq=0[5.2GHz] valid flag=0x16 Channel 157 Freq=0[5.2GHz] valid flag=0x26 Channel 161 Freq=0[5.2GHz] valid flag=0x16 Channel 165 Freq=0[5.2GHz] valid flag=0x36

maintainer
#1 lore raw
Quoted 6 lines · Stanislaw Gruszka

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. Does this fix it?

Bruno can you please verify you haven't made that mistake elsewhere?

johannes

drivers/net/wireless/iwlwifi/iwl-core.c +6 -4
@@ -213,6 +213,8 @@ int iwlcore_init_geos(struct iwl_priv *p
 	priv->ieee_rates = rates;
 
 	for (i = 0;  i < priv->channel_count; i++) {
+		enum ieee80211_band band;
+
 		ch = &priv->channel_info[i];
 
 		/* FIXME: might be removed if scan is OK */
@@ -220,15 +222,15 @@ int iwlcore_init_geos(struct iwl_priv *p
 			continue;
 
 		if (is_channel_a_band(ch))
-			sband =  &priv->bands[IEEE80211_BAND_5GHZ];
+			band = IEEE80211_BAND_5GHZ;
 		else
-			sband =  &priv->bands[IEEE80211_BAND_2GHZ];
+			band = IEEE80211_BAND_2GHZ;
+		sband =  &priv->bands[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, band);
 		geo_ch->max_power = ch->max_power_avg;
 		geo_ch->max_antenna_gain = 0xff;
 		geo_ch->hw_value = ch->channel;
#2 lore raw
Quoted 10 lines · Johannes Berg
Quoted 6 lines · Stanislaw Gruszka

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 */ ?

Quoted 1 line

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.

drivers/net/wireless/iwlwifi/iwl-core.c +4 -6
index 92724cb..1c1da6f 100644
@@ -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;
maintainer
#3 lore raw
Quoted 4 lines · Stanislaw Gruszka
Quoted 2 lines

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

Yes, but it'll be set by cfg80211 when you register the wiphy as well. This code is just special because it's before registration.

Quoted 3 lines

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

Huh, not sure.

Quoted 1 line

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

Not sure either.

Quoted 5 lines
Quoted 1 line

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.

Sure, looks fine too.

johannes

#4 lore raw
Quoted 5 lines · Johannes Berg
Quoted 3 lines

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.

Sure, looks fine too.

I'll remove sband->band assignments since cfg80211 initialize this and post it.

Stanislaw

#5 lore raw
In reply to Johannes Berg
Quoted 5 lines · On Saturday 29 January 2011 03:06:09 Johannes Berg wrote:
Quoted 4 lines · Stanislaw Gruszka

After commit 59eb21a6504731fc16db4cf9463065dd61093e08 "cfg80211: Extend channel to frequency mapping for 802.11j" 5GHz networks are not seen on scan results.

Quoted 7 lines
Quoted 3 lines

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. Does this fix it?

Bruno can you please verify you haven't made that mistake elsewhere?

Honestly, I can't. Really sorry.

bruno