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

Johannes Berg
2013-12-05T15:42:39Z

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