> +static u32 rateset_to_mask(struct ieee80211_supported_band *sband,
> + u8 *rates, u8 rates_len)
All of these just move around, right?
> + if (info->attrs[NL80211_ATTR_TX_RATES]) {
> + u32 rate, count_ht, count_vht, i;
> + enum nl80211_band band;
> +
> + err = nl80211_parse_tx_bitrate_mask(info,
> ¶ms.beacon_rate);
> + if (err)
> + return err;
> +
> + band = params.chandef.chan->band;
> + rate = params.beacon_rate.control[band].legacy;
> + /* Allow only one rate */
> + if (rate) {
> + if (rate & (rate - 1))
> + return -EINVAL;
> + } else {
> + count_ht = 0;
> + for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN;
> i++) {
> + if
> (params.beacon_rate.control[band].ht_mcs[i]) {
> + count_ht++;
> + if (count_ht > 1)
> + return -EINVAL;
> + }
> + }
> + count_vht = 0;
> + for (i = 0; i < NL80211_VHT_NSS_MAX; i++) {
> + if
> (params.beacon_rate.control[band].vht_mcs[i]) {
> + count_vht++;
> + if (count_vht > 1)
> + return -EINVAL;
> + }
> + }
> + if (!count_ht && !count_vht)
> + return -EINVAL;
> + }
> + }
>
I think it would be good to split out this "single rate" thing into a
helper function.
Thanks,
johannes