2013-12-05 09:02:29

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH v2 1/3] nl80211: back to default bitrate_mask correctly

In case of empty NL80211_ATTR_TX_RATES attribute
in nl80211_set_tx_bitrate_mask() function back to
default bitrate mask, to be able to reset the
state.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
net/wireless/nl80211.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c6401a8..072b60d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7311,9 +7311,6 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
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;

@@ -7331,6 +7328,10 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
sizeof(mask.control[i].mcs));
}

+ /* Back to default settings */
+ if (info->attrs[NL80211_ATTR_TX_RATES] == NULL)
+ goto out;
+
/*
* The nested attribute uses enum nl80211_band as the index. This maps
* directly to the enum ieee80211_band values used in cfg80211.
@@ -7380,6 +7381,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
}
}

+out:
return rdev_set_bitrate_mask(rdev, dev, NULL, &mask);
}

--
1.7.9.5



2013-12-05 17:30:49

by Karl Beldan

[permalink] [raw]
Subject: Re: [PATCH v2] iw: add VHT MCS/NSS set support to set bitrates

On Thu, Dec 05, 2013 at 10:02:17AM +0100, Janusz Dziedzic wrote:
> mcs-2.4/mcs-5 rename to ht-mcs-2.4/ht-mcs-5
> vht-mcs-2.4/vht-mcs-5 added
>
Are 256-QAM MCSes regular on 2.4G ?

Karl

2013-12-05 15:42:39

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] nl80211: add VHT support for set_bitrate_mask

On Thu, 2013-12-05 at 10:02 +0100, Janusz Dziedzic wrote:

> + switch (vht_mcs_map & 0x03) {

I think that should be in the caller.

> + case IEEE80211_VHT_MCS_NOT_SUPPORTED:
> + break;
> + case IEEE80211_VHT_MCS_SUPPORT_0_7:
> + mcs_mask = 0x00FF;
> + break;
> + case IEEE80211_VHT_MCS_SUPPORT_0_8:
> + mcs_mask = 0x01FF;
> + break;
> + case IEEE80211_VHT_MCS_SUPPORT_0_9:
> + mcs_mask = 0x03FF;
> + break;
> + }
> +
> + return mcs_mask;
> +}
> +
> +static void vht_build_mcs_mask(u16 vht_mcs_map,
> + u16 vht_mcs_mask[NL80211_VHT_NSS_MAX])
> +{
> + u8 nss;
> +
> + for (nss = 0; nss < NL80211_VHT_NSS_MAX; nss++) {
> + vht_mcs_mask[nss] = vht_mcs_map_to_mcs_mask(vht_mcs_map);
> + vht_mcs_map >>= 2;
> + }

> @@ -7364,20 +7430,31 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
> mask.control[band].ht_mcs))
> return -EINVAL;
> }
> + if (tb[NL80211_TXRATE_VHT]) {
> + if (!vht_set_mcs_mask(
> + sband,
> + nla_data(tb[NL80211_TXRATE_VHT]),
> + mask.control[band].vht_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)
> + /* don't allow empty legacy rates if HT or VHT
> + * are not even supported. */

comment style

johannes


2013-12-05 09:02:32

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH v2] iw: add VHT MCS/NSS set support to set bitrates

mcs-2.4/mcs-5 rename to ht-mcs-2.4/ht-mcs-5
vht-mcs-2.4/vht-mcs-5 added

Format for vht-mcs-*, eg:
1 - MCS=1, NSS=1
9 - MCS=9, NSS=1
10 - MCS=0, NSS=2
19 - MCS=9, NSS=2
20 - MCS=0, NSS=3
29 - MCS=9, NSS=3

Signed-off-by: Janusz Dziedzic <[email protected]>
---
bitrate.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 76 insertions(+), 25 deletions(-)

diff --git a/bitrate.c b/bitrate.c
index 4da246f..cc80003 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -4,6 +4,26 @@
#include "iw.h"


+static int setup_vht(struct nl80211_txrate_vht *txrate_vht,
+ uint8_t *mcs_table, int n_mcs)
+{
+ int nss, mcs, i;
+
+ memset(txrate_vht, 0, sizeof(*txrate_vht));
+
+ for (i = 0; i < n_mcs; i++) {
+ nss = mcs_table[i] / 10;
+ mcs = 1 << (mcs_table[i] % 10);
+
+ if ((nss < 0) || (nss >= NL80211_VHT_NSS_MAX))
+ return 0;
+
+ txrate_vht->mcs[nss] |= mcs;
+ }
+
+ return 1;
+}
+
static int handle_bitrates(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
@@ -17,15 +37,19 @@ static int handle_bitrates(struct nl80211_state *state,
int n_legacy_24 = 0, n_legacy_5 = 0;
uint8_t *legacy = NULL;
int *n_legacy = NULL;
- bool have_mcs_24 = false, have_mcs_5 = false;
- uint8_t mcs_24[77], mcs_5[77];
- int n_mcs_24 = 0, n_mcs_5 = 0;
+ bool have_ht_mcs_24 = false, have_ht_mcs_5 = false;
+ bool have_vht_mcs_24 = false, have_vht_mcs_5 = false;
+ uint8_t ht_mcs_24[77], ht_mcs_5[77], vht_mcs_24[80], vht_mcs_5[80];
+ int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0, n_vht_mcs_24 = 0, n_vht_mcs_5 = 0;
+ struct nl80211_txrate_vht txrate_vht_24 = {};
+ struct nl80211_txrate_vht txrate_vht_5 = {};
uint8_t *mcs = NULL;
int *n_mcs = NULL;
enum {
S_NONE,
S_LEGACY,
- S_MCS,
+ S_HT,
+ S_VHT,
} parser_state = S_NONE;

for (i = 0; i < argc; i++) {
@@ -48,20 +72,34 @@ static int handle_bitrates(struct nl80211_state *state,
n_legacy = &n_legacy_5;
have_legacy_5 = true;
}
- else if (strcmp(argv[i], "mcs-2.4") == 0) {
- if (have_mcs_24)
+ else if (strcmp(argv[i], "ht-mcs-2.4") == 0) {
+ if (have_ht_mcs_24)
+ return 1;
+ parser_state = S_HT;
+ mcs = ht_mcs_24;
+ n_mcs = &n_ht_mcs_24;
+ have_ht_mcs_24 = true;
+ } else if (strcmp(argv[i], "ht-mcs-5") == 0) {
+ if (have_ht_mcs_5)
return 1;
- parser_state = S_MCS;
- mcs = mcs_24;
- n_mcs = &n_mcs_24;
- have_mcs_24 = true;
- } else if (strcmp(argv[i], "mcs-5") == 0) {
- if (have_mcs_5)
+ parser_state = S_HT;
+ mcs = ht_mcs_5;
+ n_mcs = &n_ht_mcs_5;
+ have_ht_mcs_5 = true;
+ } else if (strcmp(argv[i], "vht-mcs-2.4") == 0) {
+ if (have_vht_mcs_24)
return 1;
- parser_state = S_MCS;
- mcs = mcs_5;
- n_mcs = &n_mcs_5;
- have_mcs_5 = true;
+ parser_state = S_VHT;
+ mcs = vht_mcs_24;
+ n_mcs = &n_vht_mcs_24;
+ have_vht_mcs_24 = true;
+ } else if (strcmp(argv[i], "vht-mcs-5") == 0) {
+ if (have_vht_mcs_5)
+ return 1;
+ parser_state = S_VHT;
+ mcs = vht_mcs_5;
+ n_mcs = &n_vht_mcs_5;
+ have_vht_mcs_5 = true;
}
else switch (parser_state) {
case S_LEGACY:
@@ -72,7 +110,8 @@ static int handle_bitrates(struct nl80211_state *state,
return 1;
legacy[(*n_legacy)++] = tmpd * 2;
break;
- case S_MCS:
+ case S_HT:
+ case S_VHT:
tmpl = strtol(argv[i], &end, 0);
if (*end != '\0')
return 1;
@@ -85,29 +124,41 @@ static int handle_bitrates(struct nl80211_state *state,
}
}

+ if (have_vht_mcs_24)
+ if(!setup_vht(&txrate_vht_24, vht_mcs_24, n_vht_mcs_24))
+ return -EINVAL;
+
+ if (have_vht_mcs_5)
+ if(!setup_vht(&txrate_vht_5, vht_mcs_5, n_vht_mcs_5))
+ return -EINVAL;
+
nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
if (!nl_rates)
goto nla_put_failure;

- if (have_legacy_24 || have_mcs_24) {
+ if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24) {
nl_band = nla_nest_start(msg, NL80211_BAND_2GHZ);
if (!nl_band)
goto nla_put_failure;
if (have_legacy_24)
nla_put(msg, NL80211_TXRATE_LEGACY, n_legacy_24, legacy_24);
- if (have_mcs_24)
- nla_put(msg, NL80211_TXRATE_MCS, n_mcs_24, mcs_24);
+ if (have_ht_mcs_24)
+ nla_put(msg, NL80211_TXRATE_HT, n_ht_mcs_24, ht_mcs_24);
+ if (have_vht_mcs_24)
+ nla_put(msg, NL80211_TXRATE_VHT, sizeof(txrate_vht_24), &txrate_vht_24);
nla_nest_end(msg, nl_band);
}

- if (have_legacy_5 || have_mcs_5) {
+ if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5) {
nl_band = nla_nest_start(msg, NL80211_BAND_5GHZ);
if (!nl_band)
goto nla_put_failure;
if (have_legacy_5)
nla_put(msg, NL80211_TXRATE_LEGACY, n_legacy_5, legacy_5);
- if (have_mcs_5)
- nla_put(msg, NL80211_TXRATE_MCS, n_mcs_5, mcs_5);
+ if (have_ht_mcs_5)
+ nla_put(msg, NL80211_TXRATE_HT, n_ht_mcs_5, ht_mcs_5);
+ if (have_vht_mcs_5)
+ nla_put(msg, NL80211_TXRATE_VHT, sizeof(txrate_vht_5), &txrate_vht_5);
nla_nest_end(msg, nl_band);
}

@@ -119,9 +170,9 @@ static int handle_bitrates(struct nl80211_state *state,
}

#define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
-#define DESCR DESCR_LEGACY " [mcs-<2.4|5> <MCS index>*]"
+#define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> <MCS index>*]"

-COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [mcs-<2.4|5> <MCS index>*]",
+COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> <MCS index>*]",
NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates,
"Sets up the specified rate masks.\n"
"Not passing any arguments would clear the existing mask (if any).");
--
1.7.9.5


2013-12-05 15:40:45

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] nl80211: back to default bitrate_mask correctly

On Thu, 2013-12-05 at 10:02 +0100, Janusz Dziedzic wrote:
> In case of empty NL80211_ATTR_TX_RATES attribute
> in nl80211_set_tx_bitrate_mask() function back to
> default bitrate mask, to be able to reset the
> state.

Applied 1 and 2.

johannes


2013-12-05 09:02:31

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH v2 3/3] nl80211: add VHT support for set_bitrate_mask

Add VHT MCS/NSS set support for nl80211_set_tx_bitrate_mask().
This should be used mainly for test purpose, to check
different MCS/NSS VHT combinations.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
include/net/cfg80211.h | 1 +
include/uapi/linux/nl80211.h | 12 ++++++
net/wireless/nl80211.c | 89 +++++++++++++++++++++++++++++++++++++++---
3 files changed, 96 insertions(+), 6 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 626087b..d5bb243 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1764,6 +1764,7 @@ struct cfg80211_bitrate_mask {
struct {
u32 legacy;
u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
+ u16 vht_mcs[NL80211_VHT_NSS_MAX];
} control[IEEE80211_NUM_BANDS];
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 59d65e3..63c39bd 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3060,6 +3060,8 @@ enum nl80211_key_attributes {
* %NL80211_MAX_SUPP_RATES in a single array).
* @NL80211_TXRATE_HT: HT (MCS) rates allowed for TX rate selection
* in an array of MCS numbers.
+ * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection,
+ * see &struct nl80211_txrate_vht
* @__NL80211_TXRATE_AFTER_LAST: internal
* @NL80211_TXRATE_MAX: highest TX rate attribute
*/
@@ -3067,6 +3069,7 @@ enum nl80211_tx_rate_attributes {
__NL80211_TXRATE_INVALID,
NL80211_TXRATE_LEGACY,
NL80211_TXRATE_HT,
+ NL80211_TXRATE_VHT,

/* keep last */
__NL80211_TXRATE_AFTER_LAST,
@@ -3074,6 +3077,15 @@ enum nl80211_tx_rate_attributes {
};

#define NL80211_TXRATE_MCS NL80211_TXRATE_HT
+#define NL80211_VHT_NSS_MAX 8
+
+/**
+ * struct nl80211_txrate_vht - VHT MCS/NSS txrate bitmap
+ * @mcs: MCS bitmap table for each NSS
+ */
+struct nl80211_txrate_vht {
+ __u16 mcs[NL80211_VHT_NSS_MAX];
+};

/**
* enum nl80211_band - Frequency band
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cc43374..3b0b510 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7293,11 +7293,70 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband,
return true;
}

+static u16 vht_mcs_map_to_mcs_mask(u8 vht_mcs_map)
+{
+ u16 mcs_mask = 0;
+
+ switch (vht_mcs_map & 0x03) {
+ case IEEE80211_VHT_MCS_NOT_SUPPORTED:
+ break;
+ case IEEE80211_VHT_MCS_SUPPORT_0_7:
+ mcs_mask = 0x00FF;
+ break;
+ case IEEE80211_VHT_MCS_SUPPORT_0_8:
+ mcs_mask = 0x01FF;
+ break;
+ case IEEE80211_VHT_MCS_SUPPORT_0_9:
+ mcs_mask = 0x03FF;
+ break;
+ }
+
+ return mcs_mask;
+}
+
+static void vht_build_mcs_mask(u16 vht_mcs_map,
+ u16 vht_mcs_mask[NL80211_VHT_NSS_MAX])
+{
+ u8 nss;
+
+ for (nss = 0; nss < NL80211_VHT_NSS_MAX; nss++) {
+ vht_mcs_mask[nss] = vht_mcs_map_to_mcs_mask(vht_mcs_map);
+ vht_mcs_map >>= 2;
+ }
+}
+
+static bool vht_set_mcs_mask(struct ieee80211_supported_band *sband,
+ struct nl80211_txrate_vht *txrate,
+ u16 mcs[NL80211_VHT_NSS_MAX])
+{
+ u16 tx_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map);
+ u16 tx_mcs_mask[NL80211_VHT_NSS_MAX] = {};
+ u8 i;
+
+ if (!sband->vht_cap.vht_supported)
+ return false;
+
+ memset(mcs, 0, sizeof(mcs));
+
+ /* Build vht_mcs_mask from VHT capabilities */
+ vht_build_mcs_mask(tx_mcs_map, tx_mcs_mask);
+
+ for (i = 0; i < NL80211_VHT_NSS_MAX; i++) {
+ if ((tx_mcs_mask[i] & txrate->mcs[i]) == txrate->mcs[i])
+ mcs[i] = txrate->mcs[i];
+ else
+ return false;
+ }
+
+ return true;
+}
+
static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
[NL80211_TXRATE_LEGACY] = { .type = NLA_BINARY,
.len = NL80211_MAX_SUPP_RATES },
[NL80211_TXRATE_HT] = { .type = NLA_BINARY,
.len = NL80211_MAX_SUPP_HT_RATES },
+ [NL80211_TXRATE_VHT] = { .len = sizeof(struct nl80211_txrate_vht)},
};

static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
@@ -7310,6 +7369,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
struct net_device *dev = info->user_ptr[1];
struct nlattr *tx_rates;
struct ieee80211_supported_band *sband;
+ u16 vht_tx_mcs_map;

if (!rdev->ops->set_bitrate_mask)
return -EOPNOTSUPP;
@@ -7326,6 +7386,12 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
memcpy(mask.control[i].ht_mcs,
sband->ht_cap.mcs.rx_mask,
sizeof(mask.control[i].ht_mcs));
+
+ if (!sband->vht_cap.vht_supported)
+ continue;
+
+ vht_tx_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map);
+ vht_build_mcs_mask(vht_tx_mcs_map, mask.control[i].vht_mcs);
}

/* Back to default settings */
@@ -7364,20 +7430,31 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
mask.control[band].ht_mcs))
return -EINVAL;
}
+ if (tb[NL80211_TXRATE_VHT]) {
+ if (!vht_set_mcs_mask(
+ sband,
+ nla_data(tb[NL80211_TXRATE_VHT]),
+ mask.control[band].vht_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)
+ /* don't allow empty legacy rates if HT or VHT
+ * are not even supported. */
+ if (!(rdev->wiphy.bands[band]->ht_cap.ht_supported ||
+ rdev->wiphy.bands[band]->vht_cap.vht_supported))
return -EINVAL;

for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
if (mask.control[band].ht_mcs[i])
- break;
+ goto out;
+
+ for (i = 0; i < NL80211_VHT_NSS_MAX; i++)
+ if (mask.control[band].vht_mcs[i])
+ goto out;

/* legacy and mcs rates may not be both empty */
- if (i == IEEE80211_HT_MCS_MASK_LEN)
- return -EINVAL;
+ return -EINVAL;
}
}

--
1.7.9.5


2013-12-06 09:08:50

by Karl Beldan

[permalink] [raw]
Subject: Re: [PATCH v2] iw: add VHT MCS/NSS set support to set bitrates

On Thu, Dec 05, 2013 at 06:30:13PM +0100, Karl Beldan wrote:
> On Thu, Dec 05, 2013 at 10:02:17AM +0100, Janusz Dziedzic wrote:
> > mcs-2.4/mcs-5 rename to ht-mcs-2.4/ht-mcs-5
> > vht-mcs-2.4/vht-mcs-5 added
> >
> Are 256-QAM MCSes regular on 2.4G ?
>
For example, in
https://android.googlesource.com/kernel/common/+/a2951d66120cbd5ec6e8ea5cba81c107bc6382e8/drivers/net/wireless/bcmdhd/dhd_linux.c
there is:

#ifdef SUPPORT_2G_VHT
uint32 vht_features = 0x3; /* 2G enable | rates all */


Karl

2013-12-05 15:43:46

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2] iw: add VHT MCS/NSS set support to set bitrates

On Thu, 2013-12-05 at 10:02 +0100, Janusz Dziedzic wrote:
> mcs-2.4/mcs-5 rename to ht-mcs-2.4/ht-mcs-5
> vht-mcs-2.4/vht-mcs-5 added
>
> Format for vht-mcs-*, eg:
> 1 - MCS=1, NSS=1
> 9 - MCS=9, NSS=1
> 10 - MCS=0, NSS=2
> 19 - MCS=9, NSS=2
> 20 - MCS=0, NSS=3
> 29 - MCS=9, NSS=3

I totally don't like that format, can't we parse something like

1:0-9 2:0-7 3:2,4,6

or so?

johannes


2013-12-05 09:02:30

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH v2 2/3] nl80211/cfg80211: bitrate_mask, rename mcs to ht_mcs

Rename NL80211_TXRATE_MCS into NL80211_TXRATE_HT.
Rename mcs to ht_mcs in cfg80211_bitrate_mask structure.
This is cleanup before we will introduce NL80211_TXRATE_VHT.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
drivers/net/wireless/ath/ath6kl/wmi.c | 6 +++---
drivers/net/wireless/mwifiex/cfg80211.c | 6 +++---
include/net/cfg80211.h | 2 +-
include/uapi/linux/nl80211.h | 6 ++++--
net/mac80211/cfg.c | 4 ++--
net/wireless/nl80211.c | 18 +++++++++---------
6 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 546d5da..4f16d79 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -2754,9 +2754,9 @@ static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx,
mask->control[band].legacy << 4;

/* copy mcs rate mask */
- mcsrate = mask->control[band].mcs[1];
+ mcsrate = mask->control[band].ht_mcs[1];
mcsrate <<= 8;
- mcsrate |= mask->control[band].mcs[0];
+ mcsrate |= mask->control[band].ht_mcs[0];
ratemask[band] |= mcsrate << 12;
ratemask[band] |= mcsrate << 28;
}
@@ -2806,7 +2806,7 @@ static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx,
mask->control[band].legacy << 4;

/* copy mcs rate mask */
- mcsrate = mask->control[band].mcs[0];
+ mcsrate = mask->control[band].ht_mcs[0];
ratemask[band] |= mcsrate << 12;
ratemask[band] |= mcsrate << 20;
}
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index fbad00a..27033ab 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1170,10 +1170,10 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
else
bitmap_rates[1] = mask->control[band].legacy;

- /* Fill MCS rates */
- bitmap_rates[2] = mask->control[band].mcs[0];
+ /* Fill HT MCS rates */
+ bitmap_rates[2] = mask->control[band].ht_mcs[0];
if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2)
- bitmap_rates[2] |= mask->control[band].mcs[1] << 8;
+ bitmap_rates[2] |= mask->control[band].ht_mcs[1] << 8;

return mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG,
HostCmd_ACT_GEN_SET, 0, bitmap_rates);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f07840e..626087b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1763,7 +1763,7 @@ enum wiphy_params_flags {
struct cfg80211_bitrate_mask {
struct {
u32 legacy;
- u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
+ u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
} control[IEEE80211_NUM_BANDS];
};
/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index f752e98..59d65e3 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3058,7 +3058,7 @@ enum nl80211_key_attributes {
* in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with
* 1 = 500 kbps) but without the IE length restriction (at most
* %NL80211_MAX_SUPP_RATES in a single array).
- * @NL80211_TXRATE_MCS: HT (MCS) rates allowed for TX rate selection
+ * @NL80211_TXRATE_HT: HT (MCS) rates allowed for TX rate selection
* in an array of MCS numbers.
* @__NL80211_TXRATE_AFTER_LAST: internal
* @NL80211_TXRATE_MAX: highest TX rate attribute
@@ -3066,13 +3066,15 @@ enum nl80211_key_attributes {
enum nl80211_tx_rate_attributes {
__NL80211_TXRATE_INVALID,
NL80211_TXRATE_LEGACY,
- NL80211_TXRATE_MCS,
+ NL80211_TXRATE_HT,

/* keep last */
__NL80211_TXRATE_AFTER_LAST,
NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1
};

+#define NL80211_TXRATE_MCS NL80211_TXRATE_HT
+
/**
* enum nl80211_band - Frequency band
* @NL80211_BAND_2GHZ: 2.4 GHz ISM band
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5232b01..57d25a0 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2565,8 +2565,8 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
int j;

sdata->rc_rateidx_mask[i] = mask->control[i].legacy;
- memcpy(sdata->rc_rateidx_mcs_mask[i], mask->control[i].mcs,
- sizeof(mask->control[i].mcs));
+ memcpy(sdata->rc_rateidx_mcs_mask[i], mask->control[i].ht_mcs,
+ sizeof(mask->control[i].ht_mcs));

sdata->rc_has_mcs_mask[i] = false;
if (!sband)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 072b60d..cc43374 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7296,8 +7296,8 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband,
static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
[NL80211_TXRATE_LEGACY] = { .type = NLA_BINARY,
.len = NL80211_MAX_SUPP_RATES },
- [NL80211_TXRATE_MCS] = { .type = NLA_BINARY,
- .len = NL80211_MAX_SUPP_HT_RATES },
+ [NL80211_TXRATE_HT] = { .type = NLA_BINARY,
+ .len = NL80211_MAX_SUPP_HT_RATES },
};

static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
@@ -7323,9 +7323,9 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
continue;

mask.control[i].legacy = (1 << sband->n_bitrates) - 1;
- memcpy(mask.control[i].mcs,
+ memcpy(mask.control[i].ht_mcs,
sband->ht_cap.mcs.rx_mask,
- sizeof(mask.control[i].mcs));
+ sizeof(mask.control[i].ht_mcs));
}

/* Back to default settings */
@@ -7356,12 +7356,12 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
nla_len(tb[NL80211_TXRATE_LEGACY]))
return -EINVAL;
}
- if (tb[NL80211_TXRATE_MCS]) {
+ if (tb[NL80211_TXRATE_HT]) {
if (!ht_rateset_to_mask(
sband,
- nla_data(tb[NL80211_TXRATE_MCS]),
- nla_len(tb[NL80211_TXRATE_MCS]),
- mask.control[band].mcs))
+ nla_data(tb[NL80211_TXRATE_HT]),
+ nla_len(tb[NL80211_TXRATE_HT]),
+ mask.control[band].ht_mcs))
return -EINVAL;
}

@@ -7372,7 +7372,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
return -EINVAL;

for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
- if (mask.control[band].mcs[i])
+ if (mask.control[band].ht_mcs[i])
break;

/* legacy and mcs rates may not be both empty */
--
1.7.9.5