linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: Jonathan Guerin <jonathan@guerin.id.au>
Cc: Bob Copeland <me@bobcopeland.com>,
	"linux-wireless" <linux-wireless@vger.kernel.org>,
	"ath5k-devel" <ath5k-devel@lists.ath5k.org>
Subject: Re: [ath5k-devel] [support] ath5k contention windows
Date: Wed, 15 Sep 2010 10:47:38 +0900	[thread overview]
Message-ID: <201009151047.38880.br1@einfach.org> (raw)
In-Reply-To: <AANLkTimfyZ4N9LWXi-Tbk-xsVisa3C=B=n4s3S6Lf5HV@mail.gmail.com>

On Wed September 15 2010 09:44:09 Jonathan Guerin wrote:
> The timings I used were from the 802.11-2007 spec.
> SIFS, DIFS & Slot Time: Table 17-15—OFDM PHY characteristics
> NDPS values: Table 17-3—Modulation-dependent parameters
> txtime calculations: Section 17.4.3 OFDM TXTIME calculation
> 
> Here are the functions I use to do the basics:
> int16_t ndbps(uint8_t rate_Mbps)
> {
>   //Radiotap returns rate in 500kbps units
>   rate_Mbps/=2;
> 
>    static const uint8_t rate_nsyms[][2] = {
>       {  6,  24 },
>       {  9,  36 },
>       { 12,  48 },
>       { 18,  72 },
>       { 24,  96 },
>       { 36, 144 },
>       { 48, 192 },
>       { 54, 216 }

this is rate * 4

>    };
>    static const size_t nof_rate_nsyms = sizeof(rate_nsyms) /
> sizeof(rate_nsyms[0]);
>    for(size_t i = 0; i < nof_rate_nsyms; ++i) {
>       if(rate_Mbps == rate_nsyms[i][0]) {
>          return rate_nsyms[i][1];
>       }
>    }
>    return -1;
> }
> 
> int getTXTime(int rate, int noctets) {
>   uint16_t usecs = 0;
>   const int16_t nof_bps = ndbps(rate);
> 
>   int chan_rate = 1;
> 
>   if(-1 != nof_bps) {
>     const uint16_t preamble = 16 * chan_rate;
>     const uint16_t signal = 4 * chan_rate;
>     const uint16_t tsym = 4 * chan_rate;
>     const uint16_t nsyms = ceill((16.0 + 8.0 * (noctets) + 6.0) / nof_bps);
>     usecs = preamble + signal + tsym * nsyms;
>   }
> 
>   return(usecs);

if you compare that to the code in mac80211/util.c ieee80211_frame_duration():

		dur = 16; /* SIFS + signal ext */
		dur += 16; /* 17.3.2.3: T_PREAMBLE = 16 usec */
		dur += 4; /* 17.3.2.3: T_SIGNAL = 4 usec */
		dur += 4 * DIV_ROUND_UP((16 + 8 * (len + 4) + 6) * 10,
					4 * rate); /* T_SYM x N_SYM */

it is equivalent, except that you don't add 16 /* SIFS + signal ext */. is 
this intended?

bruno

  reply	other threads:[~2010-09-15  1:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=azJS6bn7-=Bbb--ibACaQWqv4ZGLMUpfxynm7@mail.gmail.com>
2010-09-14  5:53 ` [support] ath5k contention windows Jonathan Guerin
2010-09-15  3:40   ` Jonathan Guerin
2010-09-15  3:48     ` [ath5k-devel] " Bruno Randolf
2010-09-14 17:39 ` Bob Copeland
2010-09-14 23:07   ` Jonathan Guerin
2010-09-15  0:44     ` Jonathan Guerin
2010-09-15  1:47       ` Bruno Randolf [this message]
2010-09-15  1:58         ` Jonathan Guerin
2010-09-14 22:48 ` Nick Kossifidis
2010-09-14 23:07   ` Jonathan Guerin
2010-09-15  0:58     ` Bruno Randolf
2010-09-15  1:06       ` Jonathan Guerin
2010-09-15  3:04         ` Bob Copeland
2010-09-15  3:20           ` Jonathan Guerin

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=201009151047.38880.br1@einfach.org \
    --to=br1@einfach.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=jonathan@guerin.id.au \
    --cc=linux-wireless@vger.kernel.org \
    --cc=me@bobcopeland.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).