Closer inspection of the legacy Ralink driver reveals that in case of HT40+
or HT40- we must adjust the frequency settings that we program to the device.
Implement the same adjustment in the rt2x00 code.
With this HT40 seems to work for all devices supported by rt2800pci and
rt2800usb.
Signed-off-by: Gertjan van Wingerde <[email protected]>
---
v2: Handled feedback from Ivo.
---
drivers/net/wireless/rt2x00/rt2800lib.c | 5 +----
drivers/net/wireless/rt2x00/rt2x00config.c | 12 ++++++++----
drivers/net/wireless/rt2x00/rt2x00ht.c | 27 +++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00lib.h | 9 +++++++++
4 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 8ffbc3c..15322f0 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2530,11 +2530,8 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
else
spec->ht.ht_supported = false;
- /*
- * Don't set IEEE80211_HT_CAP_SUP_WIDTH_20_40 for now as it causes
- * reception problems with HT40 capable 11n APs
- */
spec->ht.cap =
+ IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
IEEE80211_HT_CAP_GRN_FLD |
IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_SGI_40 |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 098315a..8dbd634 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -170,23 +170,27 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
unsigned int ieee80211_flags)
{
struct rt2x00lib_conf libconf;
+ u16 hw_value;
memset(&libconf, 0, sizeof(libconf));
libconf.conf = conf;
if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) {
- if (conf_is_ht40(conf))
+ if (conf_is_ht40(conf)) {
__set_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
- else
+ hw_value = rt2x00ht_center_channel(rt2x00dev, conf);
+ } else {
__clear_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags);
+ hw_value = conf->channel->hw_value;
+ }
memcpy(&libconf.rf,
- &rt2x00dev->spec.channels[conf->channel->hw_value],
+ &rt2x00dev->spec.channels[hw_value],
sizeof(libconf.rf));
memcpy(&libconf.channel,
- &rt2x00dev->spec.channels_info[conf->channel->hw_value],
+ &rt2x00dev->spec.channels_info[hw_value],
sizeof(libconf.channel));
}
diff --git a/drivers/net/wireless/rt2x00/rt2x00ht.c b/drivers/net/wireless/rt2x00/rt2x00ht.c
index 5a40760..588c766 100644
--- a/drivers/net/wireless/rt2x00/rt2x00ht.c
+++ b/drivers/net/wireless/rt2x00/rt2x00ht.c
@@ -84,3 +84,31 @@ void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
else
txdesc->txop = TXOP_HTTXOP;
}
+
+u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
+ struct ieee80211_conf *conf)
+{
+ struct hw_mode_spec *spec = &rt2x00dev->spec;
+ int center_channel;
+ u16 i;
+
+ /*
+ * Initialize center channel to current channel.
+ */
+ center_channel = spec->channels[conf->channel->hw_value].channel;
+
+ /*
+ * Adjust center channel to HT40+ and HT40- operation.
+ */
+ if (conf_is_ht40_plus(conf))
+ center_channel += 2;
+ else if (conf_is_ht40_minus(conf))
+ center_channel -= (center_channel == 14) ? 1 : 2;
+
+ for (i = 0; i < spec->num_channels; i++)
+ if (spec->channels[i].channel == center_channel)
+ return i;
+
+ WARN_ON(1);
+ return conf->channel->hw_value;
+}
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index 822affc..ed27de1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -367,12 +367,21 @@ static inline void rt2x00crypto_rx_insert_iv(struct sk_buff *skb,
void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
struct txentry_desc *txdesc,
const struct rt2x00_rate *hwrate);
+
+u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
+ struct ieee80211_conf *conf);
#else
static inline void rt2x00ht_create_tx_descriptor(struct queue_entry *entry,
struct txentry_desc *txdesc,
const struct rt2x00_rate *hwrate)
{
}
+
+static inline u16 rt2x00ht_center_channel(struct rt2x00_dev *rt2x00dev,
+ struct ieee80211_conf *conf)
+{
+ return conf->channel->hw_value;
+}
#endif /* CONFIG_RT2X00_LIB_HT */
/*
--
1.7.1
Dear Bob,
> > It looks like a bug. Even if something is preventing scanning, the
> > error code should be -EBUSY (device busy).
> >
> > The same is true for ath9k, but I cannot test ath5k at the moment.
> > mac80211 does a considerable effort to allow scanning while associated.
>
> It's certainly something that used to work, but I haven't tried in
> a recent kernel. So yes probably a bug.
BTW: I do not have recent kernel. I am using:
linux-2.6.32.11 together with compat-wireless-2.6.34-rc4
Anyway, wlan1 returns different error when associated:
#root@dvouramenna:~# iwlist wlan1 scanning
#wlan1 Failed to read scan data : Resource temporarily unavailable
regards
J.Fojtik
> --
> Bob Copeland %% http://www.bobcopeland.com
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 19, 2010 at 9:17 PM, Gertjan van Wingerde
<[email protected]> wrote:
> Closer inspection of the legacy Ralink driver reveals that in case of HT40+
> or HT40- we must adjust the frequency settings that we program to the device.
> Implement the same adjustment in the rt2x00 code.
>
> With this HT40 seems to work for all devices supported by rt2800pci and
> rt2800usb.
>
> Signed-off-by: Gertjan van Wingerde <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
On Sun, May 23, 2010 at 4:21 AM, Jaroslav Fojtik <[email protected]> wrote:
> Dear Bob,
>
> it looks that compat-wireless-2010-05-21 scans when associated.
> But compat-wireless-2010-05-21 seems to be so defective that I cannot
> use it.
http://wireless.kernel.org/en/users/Documentation/Reporting_bugs
Being a little more descriptive would help.
Luis
Am Mittwoch 19 Mai 2010 schrieb Gertjan van Wingerde:
> Closer inspection of the legacy Ralink driver reveals that in case of HT40+
> or HT40- we must adjust the frequency settings that we program to the device.
> Implement the same adjustment in the rt2x00 code.
>
> With this HT40 seems to work for all devices supported by rt2800pci and
> rt2800usb.
>
> Signed-off-by: Gertjan van Wingerde <[email protected]>
Yeah, that does the trick. Thanks for figuring this out.
Tested-by: Helmut Schaa <[email protected]>
Dear Bob,
it looks that compat-wireless-2010-05-21 scans when associated.
But compat-wireless-2010-05-21 seems to be so defective that I cannot
use it.
regards
Jara
> > > It looks like a bug. Even if something is preventing scanning, the
> > > error code should be -EBUSY (device busy).
> > >
> > > The same is true for ath9k, but I cannot test ath5k at the moment.
> > > mac80211 does a considerable effort to allow scanning while associated.
> >
> > It's certainly something that used to work, but I haven't tried in
> > a recent kernel. So yes probably a bug.
>
> BTW: I do not have recent kernel. I am using:
> linux-2.6.32.11 together with compat-wireless-2.6.34-rc4
>
>
> Anyway, wlan1 returns different error when associated:
>
> #root@dvouramenna:~# iwlist wlan1 scanning
> #wlan1 Failed to read scan data : Resource temporarily unavailable
>
> regards
> J.Fojtik
>
>
> > --
> > Bob Copeland %% http://www.bobcopeland.com
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Dears,
I have a problem with AP scanning:
root@dvouramenna:/tmp# iwlist "wlan0" scanning
wlan0 Interface doesn't support scanning : Operation not supported
root@dvouramenna:/tmp# iwlist "wlan1" scanning
wlan1 Failed to read scan data : Resource temporarily unavailable
I am testing "compat-wireless-2.6.34-rc4".
I hope that this is a defect and should be reported somewhere into bugzilla.
regards
Jara
PS: this is my wireless devices:
02:08.0 Ethernet controller: Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
Subsystem: Atheros Communications Inc. TP-Link TL-WN510G Wireless CardBus Adapter
Flags: bus master, medium devsel, latency 168, IRQ 17
Memory at fdef0000 (32-bit, non-prefetchable) [size=64K]
Capabilities: [44] Power Management version 2
02:0a.0 Ethernet controller: Atheros Communications Inc. AR5212/AR5213 Multiprotocol MAC/baseband processor (rev 01)
Subsystem: Wistron NeWeb Corp. CM9 Wireless a/b/g MiniPCI Adapter
Flags: bus master, medium devsel, latency 168, IRQ 19
Memory at fdee0000 (32-bit, non-prefetchable) [size=64K]
Capabilities: [44] Power Management version 2
On Thu, 2010-05-20 at 21:28 +0200, Jaroslav Fojtik wrote:
> Dear Bob,
>
> > $ sudo ifconfig wlan0 up
> > $ sudo iw dev wlan0 scan
>
> I have typed:
>
> ifconfig wlan0 down
> ifconfig wlan0 up
> iwlist wlan0 scanning
> (I do not have installed iw)
I think you should install iw and use it instead. Ideally, iwlist
should work as well, but iw would provide a useful datapoint.
> But when an interface wlan0 become associated, it refuses scanning.
>
> root@dvouramenna:~# iwlist wlan0 scanning
> wlan0 Interface doesn't support scanning : Operation not supported
>
>
> Is this bug or feature?
It looks like a bug. Even if something is preventing scanning, the
error code should be -EBUSY (device busy).
> MadWifi can scan even when interface is associated.
> ipw2200bg can also scan when it is associated.
The same is true for ath9k, but I cannot test ath5k at the moment.
mac80211 does a considerable effort to allow scanning while associated.
--
Regards,
Pavel Roskin
Dear Bob,
> $ sudo ifconfig wlan0 up
> $ sudo iw dev wlan0 scan
I have typed:
ifconfig wlan0 down
ifconfig wlan0 up
iwlist wlan0 scanning
(I do not have installed iw)
and it works:
wlan1 Scan completed :
Cell 01 - Address: 00:15:6D:D6:2A:9D
Channel:36
Frequency:5.18 GHz (Channel 36)
Quality=38/70 Signal level=-72 dBm
Encryption key:off
ESSID:"dvrmn.heaven-czfree.net"
Bit Rate:6 Mb/s
Bit Rate:9 Mb/s
Bit Rate:12 Mb/s
Bit Rate:18 Mb/s
Bit Rate:24 Mb/s
Bit Rate:36 Mb/s
Bit Rate:48 Mb/s
Bit Rate:54 Mb/s
Mode:Master
Extra:tsf=000000949a880598
Extra: Last beacon: 1533ms ago
(Unknown Wireless Token 0x8C05)
Cell 02 - Address: 00:19:E0:84:E1:4C
Channel:2
Frequency:2.417 GHz (Channel 2)
.............................................
But when an interface wlan0 become associated, it refuses scanning.
root@dvouramenna:~# iwlist wlan0 scanning
wlan0 Interface doesn't support scanning : Operation not supported
Is this bug or feature?
MadWifi can scan even when interface is associated.
ipw2200bg can also scan when it is associated.
regards
J.Fojtik
>
> --
> Bob Copeland %% http://www.bobcopeland.com
On Thu, May 20, 2010 at 05:53:31PM -0400, Pavel Roskin wrote:
> On Thu, 2010-05-20 at 21:28 +0200, Jaroslav Fojtik wrote:
> It looks like a bug. Even if something is preventing scanning, the
> error code should be -EBUSY (device busy).
>
> The same is true for ath9k, but I cannot test ath5k at the moment.
> mac80211 does a considerable effort to allow scanning while associated.
It's certainly something that used to work, but I haven't tried in
a recent kernel. So yes probably a bug.
--
Bob Copeland %% http://www.bobcopeland.com