From: Johannes Berg <johannes@sipsolutions.net>
To: Ashok Raj Nagarajan <arnagara@qti.qualcomm.com>,
linux-wireless@vger.kernel.org
Cc: ath10k@lists.infradead.org, arnagara@codeaurora.org
Subject: Re: [PATCH v3 1/2] cfg80211: Add support to set tx power for a station associated
Date: Wed, 15 Feb 2017 08:53:38 +0100 [thread overview]
Message-ID: <1487145218.4026.3.camel@sipsolutions.net> (raw)
In-Reply-To: <1486554984-25097-1-git-send-email-arnagara@qti.qualcomm.com>
> + * @txpwr: tx power (in mBm) to be used for sending data traffic. If
> tx power
> + * is not provided, the default per-interface tx power
> setting will be
> + * overriding. Driver should be picking up the lowest tx
> power, either tx
> + * power per-interface or per-station.
> */
> struct station_parameters {
> const u8 *supported_rates;
> @@ -876,6 +881,7 @@ struct station_parameters {
> u8 opmode_notif;
> bool opmode_notif_used;
> int support_p2p_ps;
> + u16 txpwr;
> };
Wouldn't it be better to add the tx power type (limited/automatic) here
as well? That way, we don't have to play games with 0 meaning automatic
(which you didn't even document, but seems to be the case), when in
fact 0dBm could technically be a valid TX power as well.
> + idx = NL80211_ATTR_STA_TX_POWER_SETTING;
> + type = nla_get_u32(info->attrs[idx]);
> +
> + if (!info->attrs[NL80211_ATTR_STA_TX_POWER] &&
> + (type != NL80211_TX_POWER_AUTOMATIC))
> + return -EINVAL;
> +
> + if (type != NL80211_TX_POWER_AUTOMATIC) {
> + if (type == NL80211_TX_POWER_LIMITED) {
> + idx = NL80211_ATTR_STA_TX_POWER;
> + params->txpwr = nla_get_u32(info-
> >attrs[idx]);
> + } else {
> + return -EINVAL;
> + }
> + } else {
> + params->txpwr = 0;
> + }
This could be nicer using a switch on the type, perhaps?
> + if (info->attrs[NL80211_ATTR_STA_TX_POWER_SETTING]) {
> + err = nl80211_parse_sta_txpower_setting(info,
¶ms);
> + if (err)
> + return err;
> + }
Why not move the check that the attribute exists into the function?
johannes
prev parent reply other threads:[~2017-02-15 7:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 11:56 [PATCH v3 1/2] cfg80211: Add support to set tx power for a station associated Ashok Raj Nagarajan
2017-02-15 7:53 ` Johannes Berg [this message]
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=1487145218.4026.3.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=arnagara@codeaurora.org \
--cc=arnagara@qti.qualcomm.com \
--cc=ath10k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
/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).