Skip to contentSkip to conversation

Override Minstrel HT RC to set an MCS bitrate (mask)

ath9k-devel kcilc.dragos at mamber.net 2 participants 2 messages Jun 1, 2011

lore
Share & tools
lore
#0 lore raw

Newbie here as well. I managed to fix the MCS, using an older message on this list, but when the signal gets weaker, it dips into legacy rates.

To fix the MCS, you can go to ath_buf_set_rate() in xmit.c:

                 if (!rates[i].count || (rates[i].idx < 0))
                         continue;
              	rix = rates[i].idx;

Use values rix = 0..15 to fix the MCS.

Now please tell me how to mask or disable the legacy rates altogether - I really want to measure@a known rate, and not have some algorithm interfere with my measurements. With 'iw wlan0 set bitrates legacy-2.4 54' for example you can limit the use of legacy to 54Mbps, but I want it disabled altogether and only use 11n MCS.

thanks,

Signature · 1 line
D.
Quoted 13 lines

Hi all,

I would be grateful if anyone can advise on setting/masking a fixed MCS HT rate (ath9k) at runtime, as I am only able to mask legacy rates..

If this is not yet implemented, can anyone please advise on how to implement this as I am in urgent need of this functionality.

Thank you all in advance!

On Tue, Mar 15, 2011 at 5:02 AM, Mohammed Shafi <[email protected]>

Quoted 22 lines · wrote:
Quoted 22 lines · M. A.
Quoted 7 lines

Hi all,

My question is how can I modify Minstrel HT rate control to be able to override it (by a boolean or otherwise) to select an MCS or specific rate index from user space (such that once set it driver will only try sending at that rate until unset then driver will resort back to Minstrel RC).

I don't think we can fix the MCS rate index from user space, may be we need a hack.
iw dev <devname> set bitrates [legacy-<2.4|5> <legacy rate in Mbps>*] and this is only for legacy rates.

Quoted 6 lines

I have been able to change other kernel parameters at runtime(echo /sys/kernel/debug/ieee80211/...) by passing them through (fops) to DebugFs. however I am unsure of what parameters to pass through in the case of MCS rate fixing and what modifications to the code are required to achieve this.

Quoted 8 lines
Quoted 8 lines

don't know and I am not sure whether this can be easily done.

Quoted 6 lines

Also I have been told that these sections of code facilitate the masking of rates;

=========================================================================

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

include/net/cfg80211.h: cfg80211_bitrate_mask

-------------------------------------------------------------------------------------------------------

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

/*
* cfg80211_bitrate_mask - masks for bitrate control */

struct cfg80211_bitrate_mask {
       struct {
               u32 legacy;
               /* TODO: add support for masking MCS rates; e.g.: */
               /* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */
       } control[IEEE80211_NUM_BANDS];
};

-------------------------------------------------------------------------------------------------------

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

net/mac80211/cfg.c ieee80211_set_bitrate_mask

-------------------------------------------------------------------------------------------------------

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
struct net_device *dev, const u8 *addr, const struct

cfg80211_bitrate_mask *mask)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
{
       struct ieee80211_sub_if_data *sdata = 

IEEE80211_DEV_TO_SUB_IF(dev);

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
       int i;

       /*
        * This _could_ be supported by providing a hook for
        * drivers for this function, but at this point it
        * doesn't seem worth bothering.
        */
       if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)
               return -EOPNOTSUPP;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
       for (i = 0; i < IEEE80211_NUM_BANDS; i++)
               sdata->rc_rateidx_mask[i] = mask->control[i].legacy;

       return 0;
}

-------------------------------------------------------------------------------------------------------

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

net/wireless/nl80211.c: nl80211_set_tx_bitrate_mask

-------------------------------------------------------------------------------------------------------

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
struct genl_info *info)

{
       struct nlattr *tb[NL80211_TXRATE_MAX + 1];
       struct cfg80211_registered_device *rdev = info->user_ptr[0];
       struct cfg80211_bitrate_mask mask;
       int rem, i;
       struct net_device *dev = info->user_ptr[1];
       struct nlattr *tx_rates;
       struct ieee80211_supported_band *sband;

       if (info->attrs[NL80211_ATTR_TX_RATES] == NULL)
               return -EINVAL;

       if (!rdev->ops->set_bitrate_mask)
               return -EOPNOTSUPP;

       memset(&mask, 0, sizeof(mask));
       /* Default to all rates enabled */
       for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
               sband = rdev->wiphy.bands[i];
               mask.control[i].legacy =
                       sband ? (1 << sband->n_bitrates) - 1 : 0;
       }
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

/*
* The nested attribute uses enum nl80211_band as the index.

This maps

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

* directly to the enum ieee80211_band values used in cfg80211. */
nla_for_each_nested(tx_rates,

info->attrs[NL80211_ATTR_TX_RATES], rem)

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
       {
               enum ieee80211_band band = nla_type(tx_rates);
               if (band < 0 || band >= IEEE80211_NUM_BANDS)
                       return -EINVAL;
               sband = rdev->wiphy.bands[band];
               if (sband == NULL)
                       return -EINVAL;
               nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates),
                         nla_len(tx_rates), nl80211_txattr_policy);
               if (tb[NL80211_TXRATE_LEGACY]) {
                       mask.control[band].legacy = rateset_to_mask(
                               sband,
                               nla_data(tb[NL80211_TXRATE_LEGACY]),
                               nla_len(tb[NL80211_TXRATE_LEGACY]));
                       if (mask.control[band].legacy == 0)
                               return -EINVAL;
               }
       }
Quoted 1 line
Quoted 1 line
Quoted 1 line
       return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, NULL, 

&mask);

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

}

As you see everything is for legacy thing and for MCS it's a TODO

section.

Quoted 1 line
Quoted 1 line
#1 lore raw

This begs the question - why not write your own rate control module that lets you fix the TX rates?

Adrian

Quoted 183 lines · On 1 June 2011 17:55, <[email protected]> wrote:

Newbie here as well. I managed to fix the MCS, using an older message on this list, but when the signal gets weaker, it dips into legacy rates.

To fix the MCS, you can go to ath_buf_set_rate() in xmit.c:

? ? ? ? ? ? ? ? if (!rates[i].count || (rates[i].idx < 0)) ? ? ? ? ? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? ? ?rix = rates[i].idx;

Use values rix = 0..15 to fix the MCS.

Now please tell me how to mask or disable the legacy rates altogether - I really want to measure at a known rate, and not have some algorithm interfere with my measurements. With 'iw wlan0 set bitrates legacy-2.4 54' for example you can limit the use of legacy to 54Mbps, but I want it disabled altogether and only use 11n MCS.

thanks,
--
D.

Quoted 13 lines

Hi all,

I would be grateful if anyone can advise on setting/masking a fixed MCS HT rate (ath9k) at runtime, as I am only able to mask legacy rates..

If this is not yet implemented, can anyone please advise on how to implement this as I am in urgent need of this functionality.

Thank you all in advance!

On Tue, Mar 15, 2011 at 5:02 AM, Mohammed Shafi <[email protected]>

Quoted 22 lines · wrote:
Quoted 22 lines · M. A.
Quoted 7 lines

Hi all,

My question is how can I modify Minstrel HT rate control to be able to override it (by a boolean or otherwise) to select an MCS or specific rate index from user space (such that once set it driver will only try sending at that rate until unset then driver will resort back to Minstrel RC).

I don't think we can fix the MCS rate index from user space, may be we need a hack.
iw ?dev <devname> set bitrates [legacy-<2.4|5> <legacy rate in Mbps>*] and this is only for legacy rates.

Quoted 6 lines

I have been able to change other kernel parameters at runtime(echo /sys/kernel/debug/ieee80211/...) by passing them through (fops) to DebugFs. however I am unsure of what parameters to pass through in the case of MCS rate fixing and what modifications to the code are required to achieve this.

Quoted 8 lines
Quoted 8 lines

don't know and I am not sure whether this can be easily done.

Quoted 6 lines

Also I have been told that these sections of code facilitate the masking of rates;

=========================================================================

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

include/net/cfg80211.h: cfg80211_bitrate_mask

-------------------------------------------------------------------------------------------------------

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

/*
?* cfg80211_bitrate_mask - masks for bitrate control
?*/
struct cfg80211_bitrate_mask {
? ? ? ?struct {
? ? ? ? ? ? ? ?u32 legacy;
? ? ? ? ? ? ? ?/* TODO: add support for masking MCS rates; e.g.: */ ? ? ? ? ? ? ? ?/* u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; */ ? ? ? ?} control[IEEE80211_NUM_BANDS];
};

-------------------------------------------------------------------------------------------------------

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

net/mac80211/cfg.c ieee80211_set_bitrate_mask

-------------------------------------------------------------------------------------------------------

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?struct net_device *dev, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const u8 *addr, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const struct

cfg80211_bitrate_mask *mask)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

{
? ? ? ?struct ieee80211_sub_if_data *sdata =

IEEE80211_DEV_TO_SUB_IF(dev);

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

? ? ? ?struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); ? ? ? ?int i;

? ? ? ?/*
? ? ? ? * This _could_ be supported by providing a hook for ? ? ? ? * drivers for this function, but at this point it ? ? ? ? * doesn't seem worth bothering.
? ? ? ? */
? ? ? ?if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) ? ? ? ? ? ? ? ?return -EOPNOTSUPP;

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

? ? ? ?for (i = 0; i < IEEE80211_NUM_BANDS; i++)
? ? ? ? ? ? ? ?sdata->rc_rateidx_mask[i] = mask->control[i].legacy;

? ? ? ?return 0;
}

-------------------------------------------------------------------------------------------------------

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

net/wireless/nl80211.c: nl80211_set_tx_bitrate_mask

-------------------------------------------------------------------------------------------------------

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct genl_info *info) {
? ? ? ?struct nlattr *tb[NL80211_TXRATE_MAX + 1];
? ? ? ?struct cfg80211_registered_device *rdev = info->user_ptr[0]; ? ? ? ?struct cfg80211_bitrate_mask mask;
? ? ? ?int rem, i;
? ? ? ?struct net_device *dev = info->user_ptr[1];
? ? ? ?struct nlattr *tx_rates;
? ? ? ?struct ieee80211_supported_band *sband;

? ? ? ?if (info->attrs[NL80211_ATTR_TX_RATES] == NULL) ? ? ? ? ? ? ? ?return -EINVAL;

? ? ? ?if (!rdev->ops->set_bitrate_mask)
? ? ? ? ? ? ? ?return -EOPNOTSUPP;

? ? ? ?memset(&mask, 0, sizeof(mask));
? ? ? ?/* Default to all rates enabled */
? ? ? ?for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
? ? ? ? ? ? ? ?sband = rdev->wiphy.bands[i];
? ? ? ? ? ? ? ?mask.control[i].legacy =
? ? ? ? ? ? ? ? ? ? ? ?sband ? (1 << sband->n_bitrates) - 1 : 0; ? ? ? ?}

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

? ? ? ?/*
? ? ? ? * The nested attribute uses enum nl80211_band as the index.

This maps

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

? ? ? ? * directly to the enum ieee80211_band values used in cfg80211. ? ? ? ? */
? ? ? ?nla_for_each_nested(tx_rates,

info->attrs[NL80211_ATTR_TX_RATES], rem)

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

? ? ? ?{
? ? ? ? ? ? ? ?enum ieee80211_band band = nla_type(tx_rates); ? ? ? ? ? ? ? ?if (band < 0 || band >= IEEE80211_NUM_BANDS) ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL;
? ? ? ? ? ? ? ?sband = rdev->wiphy.bands[band];
? ? ? ? ? ? ? ?if (sband == NULL)
? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL;
? ? ? ? ? ? ? ?nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates), ? ? ? ? ? ? ? ? ? ? ? ? ?nla_len(tx_rates), nl80211_txattr_policy); ? ? ? ? ? ? ? ?if (tb[NL80211_TXRATE_LEGACY]) {
? ? ? ? ? ? ? ? ? ? ? ?mask.control[band].legacy = rateset_to_mask( ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sband,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nla_data(tb[NL80211_TXRATE_LEGACY]), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nla_len(tb[NL80211_TXRATE_LEGACY])); ? ? ? ? ? ? ? ? ? ? ? ?if (mask.control[band].legacy == 0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL;
? ? ? ? ? ? ? ?}
? ? ? ?}

Quoted 1 line
Quoted 1 line
Quoted 1 line

? ? ? ?return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, NULL,

&mask);

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

}

As you see everything is for legacy thing and for MCS it's a TODO

section.

Quoted 1 line
Quoted 1 line

_______________________________________________
ath9k-devel mailing list
ath9k-devel at lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel