From owner-freebsd-wireless@FreeBSD.ORG Sun Dec 11 19:35:51 2011 Return-Path: Delivered-To: freebsd-wireless@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B461F1065675 for ; Sun, 11 Dec 2011 19:35:51 +0000 (UTC) (envelope-from hapvbk@yahoo.co.uk) Received: from nm6.bullet.mail.ukl.yahoo.com (nm6.bullet.mail.ukl.yahoo.com [217.146.182.227]) by mx1.freebsd.org (Postfix) with SMTP id 146268FC0C for ; Sun, 11 Dec 2011 19:35:50 +0000 (UTC) Received: from [217.146.183.184] by nm6.bullet.mail.ukl.yahoo.com with NNFMP; 11 Dec 2011 19:35:49 -0000 Received: from [77.238.184.76] by tm15.bullet.mail.ukl.yahoo.com with NNFMP; 11 Dec 2011 19:35:49 -0000 Received: from [127.0.0.1] by smtp145.mail.ukl.yahoo.com with NNFMP; 11 Dec 2011 19:35:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1323632149; bh=SWJts2PdpOMLoWnskHJxnR8Z6ZlKy1OmVDZCtXAzZsI=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:From:To:Cc:References:In-Reply-To:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:Importance:X-Mailer:X-MimeOLE; b=KkLnNojLWjcyg3CWZNlCdRWOuruvvoC/YF27F57XrbzC1C+c/RvTGzQA5COcTO5681y+xFrJYolC2qrgWzEp0DwqQAb0kHKsKEfBk4JdDRlPSe11LYyYDAXU+V0vsKmtyYjzBSbbjNMh8tU5M/9O6+RJiOpdCvZjcUEQex0Zv8A= X-Yahoo-Newman-Id: 326605.83470.bm@smtp145.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: XvUiSKYVM1nYjA3JnfFyDkxGBv7p2VvLHPRCZDmQjMzwxRt _xGHrcfEmQISrTk4MdC.gIIjukv_ZdG1Yl86Mz0sHOV8FubD0HG3QQRq5vW_ g4JU2DpnFiGAfkQYwZ7DB3sGQZS9cLr.GMmpEfuD1IUAC6vEQxkkdP_zXlti XinR0eTELZi__RIikdky4xYrGk7v.eQwzWoShUWif1AjDK88hLKgewXp8Ro2 GnO0x.kCj0K2JPyWd.oIDcyfCbWlhtjOosyXhsO5MWuzIDIAJKMnU5XbV854 szY7H45tQmzzf4U6lFJJcqmMmSG_5.Ahobk0pciFPQ4ypo9IHCcjdYpGIU40 MgFlNa8r0v9qLyGegV4Y_ipKyKAv6Vi7aMPuHBm8- X-Yahoo-SMTP: xBpCc9iswBApASleyiIs9lcZMA-- Received: from PC (hapvbk@66.11.191.2 with login) by smtp145.mail.ukl.yahoo.com with SMTP; 11 Dec 2011 19:35:48 +0000 GMT Message-ID: From: "Viet-Ha Pham" To: "Adrian Chadd" References: <3d4d2d249836fafc6acd885693c02198@webmail.entel.upc.edu><4ECFCDAB.1080407@entel.upc.edu><4ED3B4D1.3020701@entel.upc.edu><4EDA4BBA.6010203@entel.upc.edu><4EDA609F.2080401@entel.upc.edu> In-Reply-To: Date: Sun, 11 Dec 2011 14:35:43 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 Cc: Freebsd Wireless Subject: Re: Rate index for 11 Mbps X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Dec 2011 19:35:51 -0000 Hi Adrian, Sorry for this late reply. The message goes to my junk box. I found it today. I checked with the source code, do some test by printing our the rate index at different stages in the kernel and found the issue. In the HAL, the rate order is: cck1 - cck2 - cck5.5 - cck11 - ofdm6 - ofdm9 - ofdm 12 In the 802.11, the rate order is: cck1 - cck2 - cck5.5 - ofdm6 - ofdm9 - cck11 - ofdm 12 So, the rate index for 6, 9 and 11 in the HAL and in 802.11 are actually different. When we select the rate, we need to pay attention to this and select the correct one. Here is my test codes: snprintf(log_str, MAX_LOG_MSG_LEN, "rate index: %u %u %u \n", ni->ni_rates.rs_rates[5], GET_RATE_AND_CLEAR_BASIC_BIT(5), sc->sc_rixmap[GET_RATE_AND_CLEAR_BASIC_BIT(5)]); usr_write_log(log_str); GET_RATE_AND_CLEAR_BASIC_BIT is a macro to clear the basic_rate bit, equally to remove 128 from the rate index. usr_write_log() is a user-defined function to write the input string to a separate user-defined log file. The output is: "rate index: 150 22 3" So the rate index number 5 in 802.11 is equally assigned to the rate index number 3 in the HAL. This is not a big thing but hopefully it helps the newbies like me and also ppl who work closely with the transmission rates. Viet-Ha -----Original Message----- From: Adrian Chadd Sent: Sunday, December 04, 2011 12:56 AM To: Viet-Ha Pham Cc: Freebsd Wireless Subject: Re: Rate index for 11 Mbps On 4 December 2011 13:36, Viet-Ha Pham wrote: > Hi there, > > I am working with the rate adaptation algorithm and at the very beginning > point of testing/programing. I have a concern with the rate index used in > the HAL. > > I wonder if the rate order in the rate table for 802.11g is 1 - 2 - 5.5 - > 6 > - 9 - 11 - 12 .... or 1 - 2 - 5.5 - 11 - 6 -9 - 12 ... ? The order of rate table entries is what you see: [for 11g]: /* short ctrl */ /* valid rateCode Preamble dot11Rate Rate */ /* 1 Mb */ { AH_TRUE, CCK, 1000, 0x1b, 0x00, (0x80| 2), 0 }, /* 2 Mb */ { AH_TRUE, CCK, 2000, 0x1a, 0x04, (0x80| 4), 1 }, /* 5.5 Mb */ { AH_TRUE, CCK, 5500, 0x19, 0x04, (0x80|11), 2 }, /* 11 Mb */ { AH_TRUE, CCK, 11000, 0x18, 0x04, (0x80|22), 3 }, /* remove rates 6, 9 from rate ctrl */ /* 6 Mb */ { AH_FALSE, OFDM, 6000, 0x0b, 0x00, 12, 4 }, /* 9 Mb */ { AH_FALSE, OFDM, 9000, 0x0f, 0x00, 18, 4 }, /* 12 Mb */ { AH_TRUE, OFDM, 12000, 0x0a, 0x00, 24, 6 }, .. so it's cck 1, cck 2, cck 5.5, cck 11, ofdm 6, ofdm 9, ofdm 12, ofdm 18 .. ofdm 54. > I read the source code (ar5212_phy.c) but I am still confused. Also there > is > a comment with the rate table for 802.11g: > > /* Venice TODO: roundUpRate() is broken when the rate table does not > represent rates > * in increasing order e.g. 5.5, 11, 6, 9. > * An average rate of 6 Mbps will currently map to 11 Mbps. > */ I don't know where roundUpRate() is - but yes, if your function tries to map a throughput to a rate table index, it'll have problems if it simply finds the first rate greater than your specified bit rate. HTH, Adrian