linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "M. A." <jdiq123@googlemail.com>
To: ath9k-devel@lists.ath9k.org, linux-wireless@vger.kernel.org
Subject: Override Minstrel HT RC to set an MCS bitrate (mask)
Date: Tue, 8 Mar 2011 17:40:30 +0000	[thread overview]
Message-ID: <AANLkTin2ob-EOmY_iqxZbQ98dTA6_vAGsGWrMNKBZTVV@mail.gmail.com> (raw)

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 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.


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

=========================================================================
include/net/cfg80211.h: cfg80211_bitrate_mask
-------------------------------------------------------------------------------------------------------
/*
 * 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];
};
-------------------------------------------------------------------------------------------------------
net/mac80211/cfg.c ieee80211_set_bitrate_mask
-------------------------------------------------------------------------------------------------------
static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
				      struct net_device *dev,
				      const u8 *addr,
				      const struct cfg80211_bitrate_mask *mask)
{
	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
	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;


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

	return 0;
}
-------------------------------------------------------------------------------------------------------
net/wireless/nl80211.c: nl80211_set_tx_bitrate_mask
-------------------------------------------------------------------------------------------------------
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;
	}

	/*
	 * The nested attribute uses enum nl80211_band as the index. This maps
	 * directly to the enum ieee80211_band values used in cfg80211.
	 */
	nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem)
	{
		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;
		}
	}

	return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, NULL, &mask);
}
====================================================================================================================


Any help is much appreciated!

Thank you all very much

             reply	other threads:[~2011-03-08 17:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 17:40 M. A. [this message]
2011-03-14 17:11 ` Override Minstrel HT RC to set an MCS bitrate (mask) M. A.
2011-03-15  5:02 ` [ath9k-devel] " Mohammed Shafi
2011-04-07 21:56   ` M. A.
2011-05-31 17:06     ` M. A.
2011-06-01  8:35       ` Zefir Kurtisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTin2ob-EOmY_iqxZbQ98dTA6_vAGsGWrMNKBZTVV@mail.gmail.com \
    --to=jdiq123@googlemail.com \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).