Date: Tue, 13 Aug 2013 20:21:58 +0800 From: Chenchong Qin <qinchenchong@gmail.com> To: Adrian Chadd <adrian@freebsd.org> Cc: freebsd-wireless@freebsd.org Subject: Re: Chenchong's work on net80211_ratectl Message-ID: <CAFnsE3df=1WEuLZh5355v_K2eBgcuBbpoza74Y-5vvNupBz22A@mail.gmail.com> In-Reply-To: <CAJ-Vmo=mzvS0UBC7fGx2t501%2Bfioi4DJcw8qobOpbYOUiraqGg@mail.gmail.com> References: <CAFnsE3dYdPf5yGTFH683Q1Zh0mc-g%2B_YtCTraNNt28z2vBoSKw@mail.gmail.com> <CAJ-Vmom4sY7jcNwWmJkrDwfWjsok2fk8UEwTi5A=egj1JyerLw@mail.gmail.com> <CAFnsE3cyg=msBfQqqKUMmLABSL=j24VoMBwbBjxQ6b7Dyy7Mqg@mail.gmail.com> <CAJ-Vmo=k8NddAYyAJCkx4eOaA_8XsSxg6uKrdddx%2BgmeT%2BX9KA@mail.gmail.com> <CAFnsE3eaOyRcO3LXSi3L=jbzpyMv5Nt_jRGKt_mmA0WV-EV5vA@mail.gmail.com> <CAJ-VmokdxLhK5x6kO=jJzk-dv61EDK-ZgmndOimoyWWf76HiZA@mail.gmail.com> <CAJ-VmonMjR5iVTMVN9532d%2BPqOXWNUoZvxPtQir5h=yGxU-XdQ@mail.gmail.com> <CAFnsE3d9nG-X2b=z1srKfTtpxC3w5L%2B6Hg3TbOnAQrJN%2Bt19GA@mail.gmail.com> <CAJ-VmokF6hPtg9FoEdeJXLLaZRNhzd=nr_o6nHE%2BjYiQKTg3zQ@mail.gmail.com> <CAFnsE3eMwX-GiRzJt8jk4r9mxwSAQkcrDwk%2BnWVG7q6dabeA3A@mail.gmail.com> <CAJ-Vmo=mzvS0UBC7fGx2t501%2Bfioi4DJcw8qobOpbYOUiraqGg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--047d7b3434b695a01504e3d34963 Content-Type: text/plain; charset=ISO-8859-1 Hi! Here is an update of work these days. I've added a new struct called ieee80211_rc_info to the ratectl API. It contains tx completing information, i.e. txcnt, retrycnt, finaltsi, etc, which can be provided to ratectl algo during the __complete__ period. ir_rates, ieee80211_ratectl_rates and ieee80211_ratectl_complete_rcflags are adapted to accept the ieee80211_rc_info pointer through which framelen and shortpreamble can also be reached. Then I added __complete__ stuff and ir_rates to ieee80211_rc_sample. Thanks! Chenchong On Tue, Aug 6, 2013 at 12:03 AM, Adrian Chadd <adrian@freebsd.org> wrote: > Hi! > > Great! > > So what's the problem with complete? Linux just provides all the > information that the NIC supplies - how many attempts were made, how > many attempts failed, which rate suceeded, etc. It looks a lot like it > was designed around the requirements for the atheros driver (that has > the most interesting information available) and other NICs just have > to fake it somehow. > > > > -adrian > > On 5 August 2013 08:58, Chenchong Qin <qinchenchong@gmail.com> wrote: > > Hi! > > > > Here is my work done these days on porting ath_rate_sample to net80211. > It > > has not been finished yet. _complete_ and _update_ are to be added. > > > > _complete_ is really a tricky thing. We have to provide rc algos with rc > > information > > during the frame completion period. Different rc algos may need > different rc > > information. What makes things more thornier is that different drivers > > provide > > different rc information in different ways. So, it seems we need a > unified > > way to > > provide the rc information during completion of a frame. > > > > I'm browsing mac80211 these days to see what Linux do about _complete_. > And, > > looking forward to your commets! > > > > Thanks! > > > > Chenchong > > > > > > On Sat, Aug 3, 2013 at 1:30 AM, Adrian Chadd <adrian@freebsd.org> wrote: > >> > >> Well just remember you can always ask me/us questions! > >> > >> What's your latest diff against -HEAD? Maybe I can start looking at > >> including parts of it in the tree. > >> > >> > >> > >> > >> -adrian > >> > >> On 2 August 2013 09:17, Chenchong Qin <qinchenchong@gmail.com> wrote: > >> > Hi! > >> > > >> > These days, I'm taking a further look at what Linux done for the > >> > _completion_ of a > >> > frame. Some updates will be posted here later. > >> > > >> > And, with ir_rates, we can return/fill an rc array rather than just > >> > returning the rix. > >> > > >> > Thanks! > >> > > >> > Chenchong > >> > > >> > > >> > > >> > > >> > > >> > On Thu, Aug 1, 2013 at 12:21 AM, Adrian Chadd <adrian@freebsd.org> > >> > wrote: > >> >> > >> >> Boo! > >> >> > >> >> Do you have another update? > >> >> > >> >> > >> >> > >> >> -adrian > >> >> > >> >> On 24 July 2013 06:44, Adrian Chadd <adrian@freebsd.org> wrote: > >> >> > On 24 July 2013 06:38, Chenchong Qin <qinchenchong@gmail.com> > wrote: > >> >> >> > >> >> >> My pleasure! > >> >> >> > >> >> >> It's also against HEAD. > >> >> >> > >> >> >> Thanks! > >> >> > > >> >> > Ok. This is looking great! > >> >> > > >> >> > Next - we need to update the rate control API to now populate an rc > >> >> > array rather than just returning the rix. > >> >> > > >> >> > This is the tricky part - as we're going to have to modify all the > >> >> > drivers that use the rate control API to use this. > >> >> > Which is fine, as there's only a handful. It's just annoying. > >> >> > > >> >> > Then we have to provide the rate control information during frame > >> >> > _completion_, so the rate control code knows which transmission > rates > >> >> > succeeded or failed. I'm still not sure what to do about it here. > >> >> > Maybe do something like Linux and attach TX rate control and > >> >> > completion information as an mbuf tag? > >> >> > > >> >> > _Then_ we can start doing interesting thing with it. :) > >> >> > > >> >> > > >> >> > > >> >> > -adrian > >> > > >> > > > > > > --047d7b3434b695a01504e3d34963 Content-Type: application/octet-stream; name="20130812-net80211-ratectl.diff" Content-Disposition: attachment; filename="20130812-net80211-ratectl.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hkb2x1090 SW5kZXg6IHN5cy9uZXQ4MDIxMS9pZWVlODAyMTFfcmNfc2FtcGxlLmMKPT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0g c3lzL25ldDgwMjExL2llZWU4MDIxMV9yY19zYW1wbGUuYwkocmV2aXNpb24gMCkKKysrIHN5cy9u ZXQ4MDIxMS9pZWVlODAyMTFfcmNfc2FtcGxlLmMJKHJldmlzaW9uIDI1NTg3MikKQEAgLTAsMCAr MSwxMTYyIEBACisvKiAkRnJlZUJTRDogaGVhZC9zeXMvZGV2L2F0aC9hdGhfc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XZfc3lzY3RsLCB2YXAtPml2X29pZCk7Cit9 CisKK3N0YXRpYyB2b2lkCitzYW1wbGVfZGVpbml0KHN0cnVjdCBpZWVlODAyMTF2YXAgKnZhcCkK K3sKKwlmcmVlKHZhcC0+aXZfcnMsIE1fODAyMTFfUkFURUNUTCk7Cit9CisKKy8vIFhYWCBzaG91 bGQgYmUgc2hhcmVkIGJ5IHJhdGVjdGwgYWxnb3MKK3N0YXRpYyBpbnQKK3NhbXBsZV9ub2RlX2lz XzExbihzdHJ1Y3QgaWVlZTgwMjExX25vZGUgKm5pKQoreworCisJaWYgKG5pLT5uaV9jaGFuID09 IE5VTEwpCisJCXJldHVybiAoMCk7CisJaWYgKG5pLT5uaV9jaGFuID09IElFRUU4MDIxMV9DSEFO X0FOWUMpCisJCXJldHVybiAoMCk7CisJcmV0dXJuIChJRUVFODAyMTFfSVNfQ0hBTl9IVChuaS0+ bmlfY2hhbikpOworfQorCitzdGF0aWMgY29uc3Qgc3RydWN0IHR4c2NoZWR1bGUgKm1ycl9zY2hl ZHVsZXNbSUVFRTgwMjExX01PREVfTUFYKzJdID0geworCU5VTEwsCQkvKiBJRUVFODAyMTFfTU9E RV9BVVRPICovCisJc2VyaWVzXzExYSwJLyogSUVFRTgwMjExX01PREVfMTFBICovCisJc2VyaWVz XzExZywJLyogSUVFRTgwMjExX01PREVfMTFCICovCisJc2VyaWVzXzExZywJLyogSUVFRTgwMjEx X01PREVfMTFHICovCisJTlVMTCwJCS8qIElFRUU4MDIxMV9NT0RFX0ZIICovCisJc2VyaWVzXzEx YSwJLyogSUVFRTgwMjExX01PREVfVFVSQk9fQSAqLworCXNlcmllc18xMWcsCS8qIElFRUU4MDIx MV9NT0RFX1RVUkJPX0cgKi8KKwlzZXJpZXNfMTFhLAkvKiBJRUVFODAyMTFfTU9ERV9TVFVSQk9f QSAqLworCXNlcmllc18xMW5hLAkvKiBJRUVFODAyMTFfTU9ERV8xMU5BICovCisJc2VyaWVzXzEx bmcsCS8qIElFRU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xjbnQ7CisKKwlmcmFtZV9zaXplID0gcmNfaW5m by0+cmlfZnJhbWVsZW47CisJbXJyID0gMDsKKworCWlmIChuZnJhbWVzID09IDApIHsKKwkJcmV0 dXJuOworCX0KKworCWlmIChmcmFtZV9zaXplID09IDApCQkgICAgLyogTkI6IHNob3VsZCBub3Qg aGFwcGVuICovCisJCWZyYW1lX3NpemUgPSAxNTAwOworCisJaWYgKHNhbi0+cmF0ZW1hc2sgPT0g MCkgeworCQlyZXR1cm47CisJfQorCQorCWlmICh2YXAtPml2X3JhdGUtPmlyX2NhcGFiaWxpdGll cyAmIElFRUU4MDIxMV9SQVRFQ1RMX0NBUF9NUlIpCisJCW1yciA9IDE7CisJLyogWFhYIGNoZWNr IEhUIHByb3Rtb2RlIHRvbyAqLworCWlmIChtcnIgJiYgISh2YXAtPml2X3JhdGUtPmlyX2NhcGFi aWxpdGllcyAmIElFRUU4MDIxMV9SQVRFQ1RMX0NBUF9NUlJQUk9UKSkKKwkJbXJyID0gMDsKKwor CWlmICghbXJyIHx8IHJjX2luZm8tPnJpX2ZpbmFsdHNpID09IDApIHsKKwkJaWYgKCFJU19SQVRF X0RFRklORUQoc2FuLCBmaW5hbF9yaXgpKSB7CisJCQlyZXR1cm47CisJCX0KKwkJLyoKKwkJICog T25seSBvbmUgcmF0ZSB3YXMgdXNlZDsgb3B0aW1pemUgd29yay4KKwkJICovCisJCXVwZGF0ZV9z dGF0cyh2YXAsIG5pLCBmcmFtZV9zaXplLCAKKwkJCSAgICAgZmluYWxfcml4LCBsb25nX3RyaWVz LAorCQkJICAgICAwLCAwLAorCQkJICAgICAwLCAwLAorCQkJICAgICAwLCAwLAorCQkJICAgICBz aG9ydF90cmllcywgbG9uZ190cmllcywKKwkJCSAgICAgbmZyYW1lcywgbmJhZCk7CisKKwl9IGVs c2UgeworCQlpbnQgZmluYWxUU0lkeCA9IHJjX2luZm8tPnJpX2ZpbmFsdHNpOworCQlpbnQgaTsK KworCQkvKgorCQkgKiBOQjogc2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1tdID0g eworCXsgMyxHKCAxKSwgMyxHKCAgMSksIDAsRyggIDEpLCAwLEcoIDEpIH0sICAgICAgIC8qICAg MU1iL3MgKi8KKwl7IDQsRyggMiksIDMsRyggIDEpLCA0LEcoICAxKSwgMCxHKCAxKSB9LCAgICAg ICAvKiAgIDJNYi9zICovCisJeyA0LEcoNS41KSwzLEcoICAyKSwgNCxHKCAgMSksIDIsRyggMSkg fSwgICAgICAgLyogNS41TWIvcyAqLworCXsgNCxHKDExKSwgMyxHKDUuNSksIDQsRyggIDIpLCAy LEcoIDEpIH0sICAgICAgIC8qICAxMU1iL3MgKi8KKwl7IDQsRyggNiksIDMsRyg1LjUpLCA0LEco ICAyKSwgMixHKCAxKSB9LCAgICAgICAvKiAgIDZNYi9zICovCisJeyA0LEcoIDkpLCAzLEcoICA2 KSwgNCxHKDUuNSksIDIsRyggMSkgfSwgICAgICAgLyogICA5TWIvcyAqLworCXsgNCxHKDEyKSwg MyxHKCAxMSksIDQsRyg1LjUpLCAyLEcoIDEpIH0sICAgICAgIC8qICAxMk1iL3MgKi8KKwl7IDQs RygxOCksIDMsRyggMTIpLCA0LEcoIDExKSwgMixHKCAxKSB9LCAgICAgICAvKiAgMThNYi9zICov CisJeyA0LEcoMjQpLCAzLEcoIDE4KSwgNCxHKCAxMiksIDIsRyggMSkgfSwgICAgICAgLyogIDI0 TWIvcyAqLworCXsgNCxHKDM2KSwgMyxHKCAyNCksIDQsRyggMTgpLCAyLEcoIDEpIH0sICAgICAg IC8qICAzNk1iL3MgKi8KKwl7IDQsRyg0OCksIDMsRyggMzYpLCA0LEcoIDI0KSwgMixHKCAxKSB9 LCAgICAgICAvKiAgNDhNYi9zICovCisJeyA0LEcoNTQpLCAzLEcoIDQ4KSwgNCxHKCAzNiksIDIs RyggMSkgfSwgICAgICAgLyogIDU0TWIvcyAqLworCisJLyogMSBzdHJlYW0gcmF0ZXMgKi8KKwor CXsgMyxORzEoIDYuNSksIDMsTkcxKCA2LjUpLCAwLE5HMSggNi41KSwgMCxORzEoNi41KSB9LCAg LyogNi41TWIvcyAqLworCXsgNCxORzEoICAxMyksIDMsTkcxKCA2LjUpLCA0LE5HMSggNi41KSwg MCxORzEoNi41KSB9LCAgLyogIDEzTWIvcyAqLworCXsgNCxORzEoMTkuNSksIDMsTkcxKCA2LjUp LCA0LE5HMSggNi41KSwgMCxORzEoNi41KSB9LCAgLyoxOS41TWIvcyAqLworCXsgNCxORzEoICAy NiksIDMsTkcxKDE5LjUpLCA0LE5HMSggNi41KSwgMixORzEoNi41KSB9LCAgLyogIDI2TWIvcyAq LworCXsgNCxORzEoICAzOSksIDMsTkcxKCAgMjYpLCA0LE5HMSgxOS41KSwgMixORzEoNi41KSB9 LCAgLyogIDM5TWIvcyAqLworCXsgNCxORzEoICA1MiksIDMsTkcxKCAgMzkpLCA0LE5HMSggIDI2 KSwgMixORzEoNi41KSB9LCAgLyogIDUyTWIvcyAqLworCXsgNCxORzEoNTguNSksIDMsTkcxKCAg NTIpLCA0LE5HMSggIDM5KSwgMixORzEoIDEzKSB9LCAgLyo1OC41TWIvcyAqLworCXsgNCxORzEo ICA2NSksIDMsTkcxKDU4LjUpLCA0LE5HMSggIDUyKSwgMixORzEoIDEzKSB9LCAgLyogIDY1TWIv cyAqLworCisJLyogMiBzdHJlYW0gcmF0ZXMgKi8KKworCXsgMyxORzIoICAxMyksIDMsTkcyKCAg MTMpLCAwLE5HMiggIDEzKSwgMCxORzIoIDEzKSB9LCAgLyogIDEzTWIvcyAqLworCXsgNCxORzIo ICAyNiksIDMsTkcyKCAgMTMpLCA0LE5HMiggIDEzKSwgMCxORzIoIDEzKSB9LCAgLyogIDI2TWIv cyAqLworCXsgNCxORzIoICAzOSksIDMsTkcyKCAgMjYpLCA0LE5HMiggIDEzKSwgMixORzIoIDEz KSB9LCAgLyogIDM5TWIvcyAqLworCXsgNCxORzIoICA1MiksIDMsTkcyKCAgMzkpLCA0LE5HMigg IDI2KSwgMixORzIoIDEzKSB9LCAgLyogIDUyTWIvcyAqLworCXsgNCxORzIoICA3OCksIDMsTkcy KCAgNTIpLCA0LE5HMiggIDM5KSwgMixORzIoIDEzKSB9LCAgLyogIDc4TWIvcyAqLworCXsgNCxO RzIoIDEwNCksIDMsTkcyKCAgNzgpLCA0LE5HMiggIDUyKSwgMixORzIoIDEzKSB9LCAgLyogMTA0 TWIvcyAqLworCXsgNCxORzIoIDExNyksIDMsTkcyKCAxMDQpLCA0LE5HMiggIDc4KSwgMixORzIo IDI2KSB9LCAgLyogMTE3TWIvcyAqLworCXsgNCxORzIoIDEzMCksIDMsTkcyKCAxMTcpLCA0LE5H MiggMTA0KSwgMixORzIoIDI2KSB9LCAgLyogMTMwTWIvcyAqLworCisJLyogMyBzdHJlYW0gcmF0 ZXMgKi8KKworCXsgMyxORzMoMTkuNSksIDMsTkczKDE5LjUpLCAwLE5HMygxOS41KSwgMCxORzMo MTkuNSkgfSwgIC8qICAxOU1iL3MgKi8KKwl7IDMsTkczKCAgMzkpLCAzLE5HMygxOS41KSwgMCxO RzMoMTkuNSksIDAsTkczKDE5LjUpIH0sICAvKiAgMzlNYi9zICovCisJeyAzLE5HMyg1OC41KSwg MyxORzMoICAzOSksIDAsTkczKDE5LjUpLCAwLE5HMygxOS41KSB9LCAgLyogIDU4TWIvcyAqLwor CXsgMyxORzMoICA3OCksIDMsTkczKDU4LjUpLCAwLE5HMyggIDM5KSwgMCxORzMoMTkuNSkgfSwg IC8qICA3OE1iL3MgKi8KKwl7IDMsTkczKCAxMTcpLCAzLE5HMyggIDc4KSwgMCxORzMoNTguNSks IDAsTkczKDE5LjUpIH0sICAvKiAxMTdNYi9zICovCisJeyAzLE5HMyggMTU2KSwgMyxORzMoIDEx NyksIDAsTkczKCAgNzgpLCAwLE5HMygxOS41KSB9LCAgLyogIDE1Nk1iL3MgKi8KKwl7IDMsTkcz KDE3NS41KSwgMyxORzMoIDE1NiksIDAsTkczKCAxMTcpLCAwLE5HMyggIDM5KSB9LCAgLyogIDE3 NU1iL3MgK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orCisKK2V4dGVybiBp bnQgbWF4XzRtc19mcmFtZWxlbls0XVszMl07CisKK3N0cnVjdCBpZWVlODAyMTFfcmNfc2VyaWVz IHsKKwl1aW50OF90IHJpeDsJCS8qIHJhdGV0YWJsZSBpbmRleCwgbm90IHJhdGUgY29kZSAqLwor CXVpbnQ4X3QgcmF0ZWNvZGU7CS8qIGhhcmR3YXJlIHJhdGUgY29kZSAqLworCXVpbnQ4X3QgdHJp ZXM7CisJdWludDhfdCB0eF9wb3dlcl9jYXA7CisJdWludDE2X3QgZmxhZ3M7CisJdWludDE2X3Qg bWF4NG1zZnJhbWVsZW47Cit9OworCisvKiAgKi8KK3N0cnVjdCBpZWVlODAyMTFfcmNfaW5mbyB7 CisJc3RydWN0IGllZWU4MDIxMV9yY19zZXJpZXMgcmlfcmNbSUVFRTgwMjExX1JBVEVDVExfTlVN XTsKKwlpbnQgcmlfZnJhbWVsZW47CisJaW50IHJpX3Nob3J0UHJlYW1ibGU7CisKKwkvKiBUWCBp bmZvICovCisJaW50IHJpX3N1Y2Nlc3M7CQkvKiBUWCBzdWNjZXNzIG9yIG5vdCAqLworCWludCBy aV9va2NudDsJCS8qIFRYIG9rIHdpdGggb3Igd2l0aG91dCByZXRyeSAqLworCWludCByaV9mYWls Y250OwkJLyogVFggcmV0cnktZmFpbCBjb3VudCAqLworCWludCByaV90eGNudDsJCS8qIFRYIGNv dW50ICovCisJaW50IHJpX3JldHJ5Y250OwkvKiBUWCByZXRyeSBjb3VudCAqLworCWludCByaV9z aG9ydHJldHJ5OworCWludCByaV9sb25ncmV0cnk7CisJaW50IHJpX2ZpbmFsdHNpOworCWludCBy aV90eHJhdGU7CQkvKiBodyB0eCByYXRlICovCit9OworCiBzdHJ1Y3QgaWVlZTgwMjExX3JhdGVj dGwgewogCWNvbnN0IGNoYXIgKmlyX25hbWU7CisJdWludDMyX3QgaXJfY2FwYWJpbGl0aWVzOwkJ LyogaGFyZHdhcmUgY2FwYWJpbGl0aWVzIG9mZmVyZW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X1JYU1RCQ18xU1RSRUFNKSAmJgorCQkJICAgICh2YXAtPml2X3JhdGUtPmlyX2Nh cGFiaWxpdGllcyAmIElFRUU4MDIxMV9SQVRFQ1RMX0NBUF9NVUxUWENIQUlOKTsKK30KKworI2Vu ZGlmCg== --047d7b3434b695a01504e3d34963--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFnsE3df=1WEuLZh5355v_K2eBgcuBbpoza74Y-5vvNupBz22A>