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 v4] cfg80211: Add support to configure a beacon data rate
Date: Tue, 13 Sep 2016 20:43:07 +0200 [thread overview]
Message-ID: <1473792187.5622.7.camel@sipsolutions.net> (raw)
In-Reply-To: <1473759726-14425-1-git-send-email-pkushwah@qti.qualcomm.com>
Hi,
Thanks for the new version. I was going to apply it but while changing
something small - see below - found what I think is another issue?
> +static int validate_beacon_tx_rate(struct cfg80211_ap_settings
> *params)
> +{
> + u32 rate, count_ht, count_vht, i;
> + enum nl80211_band band;
> +
> + band = params->chandef.chan->band;
> + rate = params->beacon_rate.control[band].legacy;
> +
> + /* Allow only one rate */
> + if (rate && (rate & (rate - 1)))
> + return -EINVAL;
I was going to change that to just
if (hweight32(rate) > 1)
return -EINVAL;
I realize that your code is equivalent, but I doubt that we need to be
really efficient here, and IMHO hweight32() is easier to understand.
> + 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;
> + }
> + }
But this is where I got confused - this seems wrong, you should be
checking the hweight8() of each of the ht_mcs[i] values?
Similarly, the VHT one, but with hweight16() of course, no?
I was going to move a "if (rate) return -EINVAL;" check into this and
the VHT loop, so that we only need the count_ht && count_vht and the
"all empty" portion of this:
> + if ((rate && count_ht) ||
> + (rate && count_vht) ||
> + (count_ht && count_vht) ||
> + (!rate && !count_ht && !count_vht))
> + return -EINVAL;
> +
> + return 0;
> +}
johannes
next prev parent reply other threads:[~2016-09-13 18:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 9:42 [PATCH v4] cfg80211: Add support to configure a beacon data rate Purushottam Kushwaha
2016-09-13 18:43 ` Johannes Berg [this message]
2016-09-14 12:02 ` 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=1473792187.5622.7.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.