Date: Mon, 22 Jul 2013 11:28:31 +0800 From: Chenchong Qin <qinchenchong@gmail.com> To: freebsd-wireless@freebsd.org Subject: Chenchong's work on net80211_ratectl Message-ID: <CAFnsE3dYdPf5yGTFH683Q1Zh0mc-g%2B_YtCTraNNt28z2vBoSKw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
--089e013d06fa51aaaf04e2114524 Content-Type: text/plain; charset=ISO-8859-1 Hi, there! Attachment is the diff that contains my work on net80211_ratectl done these days. I've done the fllowing things: 1) Add some rc options. Chip can tell some options (i.e. whether mrr and mrrprot is support, whether have more than 1 txchain, etc.) to rc code when rc is initializing. Then rc algo can calc rates with these options in mind and do the right things. 2) Support multi-rate attempt. Instead of returning just one rate, let rc return up to 4 rates. I add ieee80211_rc_series. Basically, it's just a copy of ath_rc_series but drop max4msframelen filed (it seems that max4msframelen is not used to setup the rc stuffs). And at each rate lookup, rc can get shortPreamble and frameLen info from the caller. 3) Support some 11n features. Add some 11n features (i.e. cw40, short-gi, stbc) to net80211 rc stuffs. To be frankly, I just let the rc algo decide whether to use the 11n features. But I do provide rc algo with some abilities to know whether particular feature can be used. Then, rc algo can do rate decisions based on these cap info. Besides, I use iv_htcaps other than ic_htcaps to decide the 11n features capabilities. I think iv_htcaps is more relevant to per vap rc operations and I found iv_htcaps is just a copy of ic_htcaps at first (but some caps may to be disabled by some vaps). But I'm not sure whether this can operate properly by now. Once the rc algo decides to use one 11n feature for some rate attemps, it must set corresponding rate flags. This is not the same as before. For now, the rc algo get more power and then it comes more responsibility. 4) Complete the rc flags After the rate lookup, we have an opportunity to make sure that rc code doesn't mess it up. I blank tries 1, 2, 3 if rts/cts is enabled and it's a pre-802.11n scenario. It's also the chance to fill some rate options/flags that the rc algo may not be interested by now. Looking forward to your feedbacks! Thanks! Chenchong --089e013d06fa51aaaf04e2114524 Content-Type: application/octet-stream; name="20130722-net80211-ratectl.diff" Content-Disposition: attachment; filename="20130722-net80211-ratectl.diff" Content-Transfer-Encoding: base64 X-Att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SB0aGUgVFggYW5kIGNvbXBsZXRpb24gY29kZQorCQkgKi8KKwkJcmNbaV0ucmF0ZWNvZGUg PSByYXRlOworCisJCS8qIE9ubHkgZW5hYmxlIHNob3J0Z2ksIDIwNDAsIGR1YWwtc3RyZWFtIGlm IEhUIGlzIHNldCAqLworCQlpZiAoSVNfSFRfUkFURShyYXRlKSkgeworCQkJcmNbaV0uZmxhZ3Mg fD0gSUVFRTgwMjExX1JBVEVDVExfSFRfRkxBRzsKKworCQkJLyoKKwkJCSAqIFhYWCBUT0RPOiBM RFBDCisJCQkgKi8KKworCQkJLyoKKwkJCSAqIER1YWwgLyBUcmlwbGUgc3RyZWFtIHJhdGU/CisJ CQkgKi8KKwkJCWlmIChIVF9SQ18yX1NUUkVBTVMocmF0ZSkgPT0gMikKKwkJCQlyY1tpXS5mbGFn cyB8PSBJRUVFODAyMTFfUkFURUNUTF9EU19GTEFHOworCQkJZWxzZSBpZiAoSFRfUkNfMl9TVFJF QU1TKHJhdGUpID09IDMpCisJCQkJcmNbaV0uZmxhZ3MgfD0gSUVFRTgwMjExX1JBVEVDVExfVFNf RkxBRzsKKwkJfQorCisJCS8qCisJCSAqIENhbGN1bGF0ZSB0aGUgbWF4aW11bSBUWCBwb3dlciBj YXAgZm9yIHRoZSBjdXJyZW50CisJCSAqIG5vZGUuIAorCQkgKiBSYXRlIGNvbnRyb2wgYWxnbyBj YW4ndCBjb250cm9sIFRYIHBvd2VyIGJ5IG5vdy4KKwkJICovCisJCXJjW2ldLnR4X3Bvd2VyX2Nh cCA9IGllZWU4MDIxMV9nZXRfbm9kZV90eHBvd2VyKG5pKTsKKwl9Cit9Cg== --089e013d06fa51aaaf04e2114524--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFnsE3dYdPf5yGTFH683Q1Zh0mc-g%2B_YtCTraNNt28z2vBoSKw>