All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
Cc: linux-wireless@vger.kernel.org,
	Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>,
	Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: Re: [PATCHv3 06/18] mac80211: select and adjust bitrates according for channel mode
Date: Tue, 18 Jun 2013 16:25:05 +0200	[thread overview]
Message-ID: <1371565505.8318.24.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1368702045-27598-7-git-send-email-siwu@hrz.tu-chemnitz.de>

On Thu, 2013-05-16 at 13:00 +0200, Simon Wunderlich wrote:
> The various components accessing the bitrates table must use consider
> the used channel bandwidth to select only available rates or calculate
> the bitrate correctly.
> 
> There are some rates in reduced bandwidth modes which can't be
> represented as multiples of 500kbps, like 2.25 MBit/s in 5 MHz mode. The
> standard suggests to round up to the next multiple of 500kbps, just do
> that in mac80211 as well.

"suggests", heh ...

> @@ -4238,7 +4238,6 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
>  		  struct ieee80211_sta *sta)
>  {
>  	int i;
> -
>  	for (i = 0; i < sband->n_bitrates; i++)

please don't do that.

>  		for (i = 0; i < params->supported_rates_len; i++) {
>  			int rate = (params->supported_rates[i] & 0x7f) * 5;
> +			int brate;
>  			for (j = 0; j < sband->n_bitrates; j++) {
> -				if (sband->bitrates[j].bitrate == rate)
> +				brate = sband->bitrates[j].bitrate;
> +				brate = DIV_ROUND_UP(brate, divisor);
> +				if ((rate_flags & sband->bitrates[i].flags)
> +				    != rate_flags)
> +					continue;
> +
> +				if (brate == rate)
>  					rates |= BIT(j);
>  			}

some refactoring might be useful ... having != at the start of a line is
a really good sign for that ;-)

johannes


  reply	other threads:[~2013-06-18 14:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 11:00 [PATCHv3 00/18] Add support for 5 and 10 MHz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 01/18] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 02/18] nl80211: add rate flags for 5/10 Mhz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 03/18] mac80211: Fix rate control mask matching call Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 04/18] mac80211: fix various components for the new 5 and 10 MHz widths Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 05/18] mac80211: fix timing for 5 MHz and 10 MHz channels Simon Wunderlich
2013-06-18 14:21   ` Johannes Berg
2013-06-18 16:27     ` Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 06/18] mac80211: select and adjust bitrates according for channel mode Simon Wunderlich
2013-06-18 14:25   ` Johannes Berg [this message]
2013-05-16 11:00 ` [PATCHv3 07/18] mac80211: add radiotap flag and handling for 5/10 MHz Simon Wunderlich
2013-06-18 14:27   ` Johannes Berg
2013-06-18 15:50     ` Simon Wunderlich
2013-06-18 15:53       ` Johannes Berg
2013-05-16 11:00 ` [PATCHv3 08/18] cfg80211/mac80211: use reduced txpower for 5 and 10 MHz Simon Wunderlich
2013-05-16 11:49   ` Felix Fietkau
2013-05-16 11:00 ` [PATCHv3 09/18] mac80211: change IBSS channel state to chandef Simon Wunderlich
2013-06-18 14:28   ` Johannes Berg
2013-08-21  9:35   ` Johannes Berg
2013-05-16 11:00 ` [PATCHv3 10/18] nl80211: allow 5 and 10 MHz channels for IBSS Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 11/18] ath9k: always use SIFS times from OFDM for 5/10 MHz Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 12/18] ath9k: use chandef instead of channel_type Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 13/18] ath9k: report 5/10 MHz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 14/18] ath9k: set 5/10 MHz supported channels and fix bitrate Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 15/18] ath9k: announce that ath9k supports 5/10 MHz Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 16/18] ath5k: report 5/10 MHz channels Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 17/18] ath5k: set 5/10 MHz supported channels and fix duration Simon Wunderlich
2013-05-16 11:00 ` [PATCHv3 18/18] ath5k: enable support for 5 MHz and 10 MHz channels Simon Wunderlich
2013-05-28 10:41 ` [PATCHv3 00/18] Add support for 5 " Simon Wunderlich

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=1371565505.8318.24.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mathias.kretschmer@fokus.fraunhofer.de \
    --cc=simon.wunderlich@s2003.tu-chemnitz.de \
    --cc=siwu@hrz.tu-chemnitz.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.