From: Wen Gong <wgong@codeaurora.org>
To: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>,
Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
Johannes Berg <johannes@sipsolutions.net>,
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>,
Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>,
linux-wireless-owner@vger.kernel.org, ath10k@lists.infradead.org,
ath11k@lists.infradead.org
Subject: Re: [PATCHv3 1/2] nl80211: add support for mcs masks
Date: Thu, 12 Nov 2020 18:38:27 +0800 [thread overview]
Message-ID: <b7a64b13d38792a97708675dcd8e5f69@codeaurora.org> (raw)
In-Reply-To: <1327767935-16984-2-git-send-email-siwu@hrz.tu-chemnitz.de> (sfid-20120128_172604_145461_197131DD)
On 2012-01-29 00:25, Simon Wunderlich wrote:
> Allow to set mcs masks through nl80211. We also allow to set MCS
> rates but no legacy rates (and vice versa).
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> Signed-off-by: Mathias Kretschmer
> <mathias.kretschmer@fokus.fraunhofer.de>
> ---
> include/linux/nl80211.h | 4 +++
> include/net/cfg80211.h | 3 +-
> net/wireless/nl80211.c | 61
> ++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 65 insertions(+), 3 deletions(-)
>
...
> @@ -5421,12 +5451,20 @@ static int nl80211_set_tx_bitrate_mask(struct
> sk_buff *skb,
> sband = rdev->wiphy.bands[i];
> mask.control[i].legacy =
> sband ? (1 << sband->n_bitrates) - 1 : 0;
> + if (sband)
> + memcpy(mask.control[i].mcs,
> + sband->ht_cap.mcs.rx_mask,
> + sizeof(mask.control[i].mcs));
when use command: "iw wlan0 set bitrates legacy-5 6", I want to set it
fixed in 6M rate.
this copy mcs rate will add the mcs rate here and condition "if
(tb[NL80211_TXRATE_MCS])"
is false, then mcs rate will not clear and lead a mistake result.
> + else
> + memset(mask.control[i].mcs, 0,
> + sizeof(mask.control[i].mcs));
> }
>
> /*
> * The nested attribute uses enum nl80211_band as the index. This
> maps
> * directly to the enum ieee80211_band values used in cfg80211.
> */
> + BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN *
> 8);
> nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES],
> rem)
> {
> enum ieee80211_band band = nla_type(tx_rates);
> @@ -5442,7 +5480,28 @@ static int nl80211_set_tx_bitrate_mask(struct
> sk_buff *skb,
> sband,
> nla_data(tb[NL80211_TXRATE_LEGACY]),
> nla_len(tb[NL80211_TXRATE_LEGACY]));
> - if (mask.control[band].legacy == 0)
> + }
> + if (tb[NL80211_TXRATE_MCS]) {
false for "iw wlan0 set bitrates legacy-5 6", so ht_rateset_to_mask will
not enter and mcs rate will not clear.
> + if (!ht_rateset_to_mask(
> + sband,
> + nla_data(tb[NL80211_TXRATE_MCS]),
> + nla_len(tb[NL80211_TXRATE_MCS]),
> + mask.control[band].mcs))
> + return -EINVAL;
> + }
> +
> + if (mask.control[band].legacy == 0) {
> + /* don't allow empty legacy rates if HT
> + * is not even supported. */
> + if (!rdev->wiphy.bands[band]->ht_cap.ht_supported)
> + return -EINVAL;
> +
> + for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
> + if (mask.control[band].mcs[i])
> + break;
> +
> + /* legacy and mcs rates may not be both empty */
> + if (i == IEEE80211_HT_MCS_MASK_LEN)
> return -EINVAL;
> }
> }
next prev parent reply other threads:[~2020-11-12 10:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-28 16:25 [PATCHv3 0/2] [RESEND] add support for mcs masks Simon Wunderlich
2012-01-28 16:25 ` [PATCHv3 1/2] nl80211: " Simon Wunderlich
2020-11-12 10:38 ` Wen Gong [this message]
2020-11-13 8:55 ` Wen Gong
2012-01-28 16:25 ` [PATCHv3 2/2] mac80211: " Simon Wunderlich
2012-01-28 16:25 ` [PATCH 1/2] iw: add nl80211 bitrates Simon Wunderlich
2012-01-28 16:25 ` [PATCH 2/2] iw: remove ifdefs for mcs mask Simon Wunderlich
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=b7a64b13d38792a97708675dcd8e5f69@codeaurora.org \
--to=wgong@codeaurora.org \
--cc=ath10k@lists.infradead.org \
--cc=ath11k@lists.infradead.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless-owner@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mathias.kretschmer@fokus.fraunhofer.de \
--cc=simon.wunderlich@s2003.tu-chemnitz.de \
--cc=siwu@hrz.tu-chemnitz.de \
/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).