⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 minstrel.txt

📁 madwifi driver, linux system
💻 TXT
📖 第 1 页 / 共 2 页
字号:
MinstrelIntroduction==================================================================This code is called minstrel, because we have taken a wandering minstrelapproach. Wander around the different rates, singing wherever youcan. And then, look at the performance, and make a choice. Note that thewandering minstrel will always wander in directions where he/she feels he/shewill get paid the best for his/her work.The Minstrel autorate selection algorithm is an EWMA based algorithm and isderived from  1)An initial rate module we released in 2005,  http://sourceforge.net/mailarchive/forum.php?forum_id=33966&max_rows=25&style=flat&viewmonth=200501&viewday=5 2)the "sample" module in the madwifi-ng source tree. The code released in 2005 had some algorithmic and implementationflaws (one of which was that it was based on the old madwifi codebase)and was shown to be unstable. Performance of the sample module is poor(http://www.madwifi.org/ticket/989), and we have observed similarissues.We noted: 1)The rate chosen by sample did not alter to match changes in the radio    environment. 2)Higher throughput (between two nodes) could often be achieved by fixing the    bitrate of both nodes to some value. 3)After a long period of operation, "sample" appeared to be stuck in a low    data rate, and would not move to a higher data rate.We examined the code in sample, and decided the best approach was arewrite based on sample and the module we released in January 2005.Theory of operation==================================================================We defined the measure of successfulness (of packet transmission)  as                                  mega-bits-transmitted    Prob_success_transmission *  ----------------------	     		             elapsed timeThis measure of successfulness will therefore adjust the transmission speed to get the maximum number of data bits through the radio interface. Further, itmeans that the 1mb/sec rate (which has a very high probability of successfultransmission) will not be used in preference to the 11mb/sec rate.We decided that the module should record the successfulness of all packetsthat are transmitted. From this data, the module has sufficient information todecide which packets are more successful than others. However, a variabilityelement was required. We had to force the module to examine bit rates otherthan optimal. Consequently, some percent of the packets have to be sent atrates regarded as non optimal.10 times a second (this frequency is alterable by changing the driver code)a timer fires, which evaluates the statistics table. EWMA calculations(described below) are used to process the success history of each rate. Oncompletion of the calculation, a decision is made as to the rate which has thebest throughput, second best throughput, and  highest probability of success.This data is used for populating the retry chain during the next 100 ms.As stated above, the minstrel algorithm collects statistics from all packetattempts.  Minstrel spends a particular percentage of frames, doing "lookaround" i.e. randomly trying other rates, to gather statistics. Thepercentage of "look around" frames, is set at boot time via the moduleparameter "ath_lookaround_rate" and defaults to 10%. The distribution oflookaround frames is also randomised somewhat to avoid any potential"strobing" of lookaround between similar nodes. TCP theory tells us that each packet sent must be delivered in under 26ms. Anylonger duration, and the TCP network layers will start to back off. A delay of26ms implies that there is congestion in the network, and that fewer packetsshould be injected to the device. Our conclusion was to adjust the retry chainof each packet so the retry chain was guaranteed to be finished in under 26ms.Retry Chain==================================================================The HAL provides a multirate retry chain - which consists of foursegments. Each segment is an advisement to the HAL to try to send the currentpacket at some rate, with a fixed number of retry attempts. Once the packet issuccessfully transmitted, the remainder of the retry chain isignored. Selection of the number of retry attempts was based on the desire toget the packet out in under 26ms, or fail. We provided a module parameter,ath_segment_size, which has units of microseconds, and specifies the maximumduration one segment in the retry chain can last. This module parameter has adefault of 6000. Our view is that a segment size of between 4000 and 6000seems to fit most situations.There is some room for movement here - if the traffic is UDP then the limit of26ms for the retry chain length is "meaningless".  However, one may argue thatif the packet was not transmitted after some time period, it shouldfail. Further, one does expect UDP packets to fail in transmission. We leaveit as an area for future improvement.The (re)try segment chain is calculated in two possible manners. If thispacket is a normal tranmission packet (90% of packets are this) then the retrycount is best throughput, next best throughput, best probability, lowestbaserate. If it is a sample packet (10% of packets are this), then the retrychain is random lookaround, best throughput, best probability, lowest baserate. In tabular format:        Try | Lookaround rate    | Normal rate                 ------------------------------------------------         1  | Random lookaround  | Best throughput              2  | Best throughput    | Next best throughput         3  | Best probability   | Best probability             4  | Lowest Baserate    | Lowest Baserate     The retry count is adjusted so that the transmission time for that section ofthe retry chain is less than 26 ms.After some discussion, we have adjusted the code so that the lowest rate isnever used for the lookaround packet. Our view is that since this rate is usedfor management packets, this rate must be working. - Alternatively, the linkis set up with management packets, data packets are acknowledged withmanagement packets. Should the lowest rate stop working, the link is going todie reasonably soon.Analysis of information in the /proc/net/madwifi/athX/rate_info fileshowed that the system was sampling too hard at some rates. For thoserates that never work (54mb, 500m range) there is no point in sending10 sample packets (<6ms time). Consequently, for the very very lowprobability rates, we sample at most twice.The retry chain above does "work", but performance is suboptimal. Thekey problem being that when the link is good, too much time is spentsampling the slower rates. Thus, for two nodes adjacent to each other,the throughput between them was several megabits/sec below using afixed rate. The view was that minstrel should not sample at the slowerrates if the link is doing well. However, if the link deteriorates,minstrel should immediately sample at the lower rates.Some time later, we realised that the only way to code this reliablywas to use the retry chain as the method of determining if the slowerrates are sampled. The retry chain was modified as:Try |         Lookaround rate              | Normal rate             | random < best    | random > best     |-------------------------------------------------------------- 1  | Best throughput  | Random rate       | Best throughput      2  | Random rate      | Best throughput   | Next best throughput 3  | Best probability | Best probability  | Best probability     4  | Lowest Baserate  | Lowest baserate   | Lowest baserate     With this retry chain, if the randomly selected rate is slower than thecurrent best throughput, the randomly selected rate is placed second in thechain. If the link is not good, then there will be data collected at therandomly selected rate.  Thus, if the best throughput rate is currently 54mbs,the only time slower rates are sampled is when a packet fails intransmission. Consequently, if the link is ideal, all packets will be sent atthe full rate of 54mbs. Which is good.EWMA==================================================================The EWMA calculation is carried out 10 times a second, and is run for eachrate. This calculation has a smoothing effect, so that new results havea reasonable (but not large) influence on the selected rate. However, withtime, a series of new results in some particular direction will predominate. Given this smoothing, we can use words like inertia to describe the EWMA.By "new results", we mean the results collected in the just completed 100msinterval. Old results are the EWMA scaling values from before the justcompleted 100ms interval.EWMA scaling is set by the module parameter ath_ewma_level, and defaults to75%. A value of 0% means use only the new results, ignore the old results.A value of 99% means use the old results, with a tiny influence from the newresults. The calculation (performed for each rate, at each timer interrupt) of the         probability of success is:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -