Skip to contentSkip to conversation

Fixing Minstrel Rate

ath9k-devel Shinnazar 2 participants 2 messages Oct 14, 2013

lore
Share & tools
lore
#1 lore raw

Thank you Shinnazar for your reply.

Hard coding the rate is not an option for me as I am planning to analyze the effects of changing the rate in my experiments. Actually, aggregation was enabled when fixing the rate through debugfs in the 3.3.4 kernel, and I managed to send A-MPDUs as long as 32 subframes. However, compiling the 3.9 kernel using the old rc80211_minstrel_ht.c file results in disabling aggregation even if minstrel rate control is active i.e. rate is not fixed.

Ahmad

Quoted 326 lines · Shinnazar

If you set the rate through debugfs, it will disable the aggregation, so you have 35 mbps throughput. Instead, I suggest to set the rate through the Minstrel HT sourcecode.

Shinnazar

--- Original Message ---
*From : *Ahmad Showail< [email protected] >
*To : *ath9k-devel at lists.ath9k.org
*CC : *
*Sent : *2013-10-13 21:38:53
*Subject : *[ath9k-devel] Fixing Minstrel Rate

_______________________________________________
ath9k-devel mailing listath9k-devel at lists.ath9k.orghttps://lists.ath9k.org/mailman/listinfo/ath9k-devel

Using Linux kernel version 3.3.4, I was able to fix minstrel rate by writing static MCS index to debugfs:ieee80211/phyX/rc/fixed_rate_idx. However, after updating my kernel to version 3.9.10, this method does not fix the rate any more. Below is the difference between the old and recent rc80211_minstrel_ht.c. I tried compiling the 3.9 kernel using the old rc80211_minstrel_ht.c file and found out that the rate fixing is working again. However, a simple netperf test shows a huge drop in throughput (from 150 to 35 Mb/s) before and after this change.

Any ideas how to fix minstrel rate in recent kernel versions?

---------------------------------------------------------------------------------
[xxxx at m70 mac80211]$ diff rc80211_minstrel_ht.c original_rc80211_minstrel_ht.c
128a129,131

Quoted 2 lines

static void
minstrel_ht_update_rates(struct minstrel_priv *mp, struct

minstrel_ht_sta *mi);

Quoted 1 line

204a208

Quoted 1 line
    unsigned int prob;

206a211

Quoted 1 line
    prob = mr->probability;

208c213
< if (mr->probability < MINSTREL_FRAC(1, 10)) {
---

Quoted 1 line
    if (prob < MINSTREL_FRAC(1, 10)) {

212a218,224

Quoted 2 lines

/*
* For the throughput calculation, limit the probability value to

90% to

Quoted 5 lines
     * account for collision related packet error rate fluctuation
     */
    if (prob > MINSTREL_FRAC(9, 10))
        prob = MINSTREL_FRAC(9, 10);

237a250

Quoted 1 line
    bool mi_rates_valid = false;

248,250d260

<     mi->max_tp_rate = 0;
<     mi->max_tp_rate2 = 0;
<     mi->max_prob_rate = 0;

252a263,264

Quoted 2 lines
        bool mg_rates_valid = false;

262,264d273

<         mg->max_tp_rate = 0;
<         mg->max_tp_rate2 = 0;
<         mg->max_prob_rate = 0;

270a280,291

Quoted 12 lines
            /* initialize rates selections starting indexes */
            if (!mg_rates_valid) {
                mg->max_tp_rate = mg->max_tp_rate2 =
                    mg->max_prob_rate = i;
                if (!mi_rates_valid) {
                    mi->max_tp_rate = mi->max_tp_rate2 =
                        mi->max_prob_rate = i;
                    mi_rates_valid = true;
                }
                mg_rates_valid = true;
            }

450c471
< bool last;
---

Quoted 1 line
    bool last, update = false;

499c520
< MINSTREL_FRAC(20, 100))
---

Quoted 1 line
        MINSTREL_FRAC(20, 100)) {

500a522,523

Quoted 2 lines
        update = true;
    }

505c528
< MINSTREL_FRAC(20, 100))
---

Quoted 1 line
        MINSTREL_FRAC(20, 100)) {

506a530,531

Quoted 2 lines
        update = true;
    }

508a534

Quoted 1 line
        update = true;

513a540,542

Quoted 3 lines
    if (update)
        minstrel_ht_update_rates(mp, mi);

577,578c606
< struct ieee80211_tx_rate *rate, int index,
< bool sample, bool rtscts)
---

Quoted 1 line

struct ieee80211_sta_rates *ratetbl, int offset,

int index)
581a610,611

Quoted 2 lines
    u8 idx;
    u16 flags;

587,598c617,625
< if (sample)
< rate->count = 1;
< else if (mr->probability < MINSTREL_FRAC(20, 100))
< rate->count = 2;
< else if (rtscts)
< rate->count = mr->retry_count_rtscts;
< else
< rate->count = mr->retry_count;
<
< rate->flags = 0;
< if (rtscts)
< rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS;
---

Quoted 9 lines
    if (mr->probability < MINSTREL_FRAC(20, 100) || !mr->retry_count) {
        ratetbl->rate[offset].count = 2;
        ratetbl->rate[offset].count_rts = 2;
        ratetbl->rate[offset].count_cts = 2;
    } else {
        ratetbl->rate[offset].count = mr->retry_count;
        ratetbl->rate[offset].count_cts = mr->retry_count;
        ratetbl->rate[offset].count_rts = mr->retry_count_rtscts;
    }

601c628,652
< rate->idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)];
---

Quoted 17 lines
        idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)];
        flags = 0;
    } else {
        idx = index % MCS_GROUP_RATES +
              (group->streams - 1) * MCS_GROUP_RATES;
        flags = IEEE80211_TX_RC_MCS | group->flags;
    }

    if (offset > 0) {
        ratetbl->rate[offset].count = ratetbl->rate[offset].count_rts;
        flags |= IEEE80211_TX_RC_USE_RTS_CTS;
    }

    ratetbl->rate[offset].idx = idx;
    ratetbl->rate[offset].flags = flags;
}
Quoted 2 lines

static void
minstrel_ht_update_rates(struct minstrel_priv *mp, struct

minstrel_ht_sta *mi)

Quoted 6 lines
{
    struct ieee80211_sta_rates *rates;
    int i = 0;

    rates = kzalloc(sizeof(*rates), GFP_ATOMIC);
    if (!rates)

602a654,660

Quoted 7 lines
    /* Start with max_tp_rate */
    minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate);

    if (mp->hw->max_rates >= 3) {
        /* At least 3 tx rates supported, use max_tp_rate2 next */
        minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_tp_rate2);

605,606c663,670
< rate->flags |= IEEE80211_TX_RC_MCS | group->flags;
< rate->idx = index % MCS_GROUP_RATES + (group->streams - 1) *
MCS_GROUP_RATES;
---

Quoted 8 lines
    if (mp->hw->max_rates >= 2) {
        /*
         * At least 2 tx rates supported, use max_prob_rate next */
        minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
    }

    rates->rate[i].idx = -1;
    rate_control_set_rates(mp->hw, mi->sta, rates);

642c706
< * used max TP rate.
---

Quoted 1 line

* used rates.

644c708,710
< if (sample_idx == mi->max_tp_rate)
---

Quoted 3 lines
    if (sample_idx == mi->max_tp_rate ||
        sample_idx == mi->max_tp_rate2 ||
        sample_idx == mi->max_prob_rate)

645a712

Quoted 1 line

647,648c714,715
< * When not using MRR, do not sample if the probability is already
< * higher than 95% to avoid wasting airtime
---

Quoted 2 lines

* Do not sample if the probability is already higher than 95%
* to avoid wasting airtime.

650c717
< if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100)))
---

Quoted 1 line
    if (mr->probability > MINSTREL_FRAC(95, 100))

692a760

Quoted 1 line
    const struct mcs_group *sample_group;

694c762
< struct ieee80211_tx_rate *ar = info->status.rates;
---

Quoted 1 line
    struct ieee80211_tx_rate *rate = &info->status.rates[0];

699d766
< bool sample = false;
717c784
< #ifdef CONFIG_MAC80211_DEBUGFS
---

Quoted 1 line

#ifdef CPTCFG_MAC80211_DEBUGFS

727,771d793
< if (sample_idx >= 0) {
< sample = true;
< minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx,
< true, false);
< info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
< } else {
< minstrel_ht_set_rate(mp, mi, &ar[0], mi->max_tp_rate,
< false, false);
< }
<
< if (mp->hw->max_rates >= 3) {
< /*

<          * At least 3 tx rates supported, use
<          * sample_rate -> max_tp_rate -> max_prob_rate for sampling and
<          * max_tp_rate -> max_tp_rate2 -> max_prob_rate by default.
<          */

< if (sample_idx >= 0)
< minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate,
< false, false);
< else
< minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2,
< false, true);
<
< minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate,
< false, !sample);
<
< ar[3].count = 0;
< ar[3].idx = -1;
< } else if (mp->hw->max_rates == 2) {
< /*

<          * Only 2 tx rates supported, use
<          * sample_rate -> max_prob_rate for sampling and
<          * max_tp_rate -> max_prob_rate by default.
<          */

< minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_prob_rate,
< false, !sample);
<
< ar[2].count = 0;
< ar[2].idx = -1;
< } else {

<         /* Not using MRR, only use the first rate */
<         ar[1].count = 0;
<         ar[1].idx = -1;

< }
<
778a801,810

Quoted 10 lines
    if (sample_idx < 0)
        return;

    sample_group = &minstrel_mcs_groups[sample_idx / MCS_GROUP_RATES];
    info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
    rate->idx = sample_idx % MCS_GROUP_RATES +
            (sample_group->streams - 1) * MCS_GROUP_RATES;
    rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags;
    rate->count = 1;

827a860,861

Quoted 2 lines
    mi->sta = sta;

888a923,926

Quoted 4 lines
    /* create an initial rate table with the lowest supported rates */
    minstrel_ht_update_stats(mp, mi);
    minstrel_ht_update_rates(mp, mi);

983c1021
< #ifdef CONFIG_MAC80211_DEBUGFS
---

Quoted 1 line

#ifdef CPTCFG_MAC80211_DEBUGFS

---------------------------------------------------------
Maybe it is worth mentioning that I am getting the following warnings when compiling the kernel:

----------------------------------------------------------------
WARNING: /lib/modules/3.9.10web10g/kernel/drivers/net/wireless/b43/b43.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/iwlwifi/mvm/iwlmvm.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/iwlegacy/iwl4965.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/iwlegacy/iwl3945.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/rt2x00/rt2x00lib.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/ath/ath5k/ath5k.ko needs unknown symbol ieee80211_rx
WARNING:
/lib/modules/3.9.10web10g/kernel/drivers/net/wireless/ath/carl9170/carl9170.ko needs unknown symbol ieee80211_rx
------------------------------------------------------------------

Regards,
Ahmad

Signature · 6 lines
All the Best,

Ahmad Showail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20131014/9ed389cb/attachment.htm