linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Purushottam Kushwaha <pkushwah@qti.qualcomm.com>
Cc: linux-wireless@vger.kernel.org, jouni@qca.qualcomm.com,
	usdutt@qti.qualcomm.com, amarnath@qca.qualcomm.com
Subject: Re: [PATCH v3] cfg80211: Add support to configure a beacon data rate
Date: Mon, 12 Sep 2016 12:26:13 +0200	[thread overview]
Message-ID: <1473675973.29016.19.camel@sipsolutions.net> (raw)
In-Reply-To: <1472814834-2728-1-git-send-email-pkushwah@qti.qualcomm.com>


> +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,
> &params.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

  reply	other threads:[~2016-09-12 10:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 11:13 [PATCH v3] cfg80211: Add support to configure a beacon data rate Purushottam Kushwaha
2016-09-12 10:26 ` Johannes Berg [this message]
2016-09-13  9:04   ` Kushwaha, Purushottam

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=1473675973.29016.19.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=amarnath@qca.qualcomm.com \
    --cc=jouni@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkushwah@qti.qualcomm.com \
    --cc=usdutt@qti.qualcomm.com \
    /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).