linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helmut Schaa <helmut.schaa@googlemail.com>
To: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	Ivo van Doorn <IvDoorn@gmail.com>,
	linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com
Subject: Re: [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800.
Date: Wed, 19 May 2010 17:51:10 +0200	[thread overview]
Message-ID: <201005191751.10567.helmut.schaa@googlemail.com> (raw)
In-Reply-To: <1274282769-19244-8-git-send-email-gwingerde@gmail.com>

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.

Awesome, I'll give it a shot tomorrow.

Helmut

> Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
> ---
>  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,30 @@ 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;
> +
> +	BUG();
> +}
> 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 */
>  
>  /*
> 


  reply	other threads:[~2010-05-19 15:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 15:26 [PATCH 0/7] rt2x00: Further cleanups and fixes Gertjan van Wingerde
2010-05-19 15:26 ` [PATCH 1/7] rt2x00: Remove RT2870 chipset identification Gertjan van Wingerde
2010-05-19 18:09   ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 2/7] rt2x00: Move all register definitions for rt2800 to rt2800.h Gertjan van Wingerde
2010-05-19 18:10   ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 3/7] rt2x00: Introduce separate interface type for PCI-express Gertjan van Wingerde
2010-05-19 18:10   ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 4/7] rt2x00: Simplify check for external LNA in rt2800_init_rfcsr Gertjan van Wingerde
2010-05-19 18:11   ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 5/7] rt2x00: Move PCI/USB specific register initializations to rt2800{pci,usb} Gertjan van Wingerde
2010-05-19 18:12   ` Ivo Van Doorn
2010-05-19 18:26   ` Ivo van Doorn
2010-05-19 18:33     ` Gertjan van Wingerde
2010-05-19 15:26 ` [PATCH 6/7] rt2x00: Sync rt2800 MCU boot signal with Ralink driver Gertjan van Wingerde
2010-05-19 18:12   ` Ivo Van Doorn
2010-05-19 15:26 ` [PATCH 7/7] rt2x00: Fix HT40 operation in rt2800 Gertjan van Wingerde
2010-05-19 15:51   ` Helmut Schaa [this message]
2010-05-19 18:14   ` Ivo Van Doorn
2010-05-19 19:08     ` Gertjan van Wingerde

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=201005191751.10567.helmut.schaa@googlemail.com \
    --to=helmut.schaa@googlemail.com \
    --cc=IvDoorn@gmail.com \
    --cc=gwingerde@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.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).