* [PATCH] wireless: reg: restore previous behaviour of chan->max_power calculations
@ 2012-07-24 6:35 Stanislaw Gruszka
2012-07-24 14:53 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2012-07-24 6:35 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless, users, Hong Wu, Luis R. Rodriguez
commit eccc068e8e84c8fe997115629925e0422a98e4de
Author: Hong Wu <Hong.Wu@dspg.com>
Date: Wed Jan 11 20:33:39 2012 +0200
wireless: Save original maximum regulatory transmission power for the calucation of the local maximum transmit pow
changed the way we calculate chan->max_power as min(chan->max_power,
chan->max_reg_power). That broke rt2x00 (and perhaps some other
drivers) that do not set chan->max_power. It is not so easy to fix this
problem correctly in rt2x00.
According to commit eccc068e8 changelog, change claim only to save
maximum regulatory power - changing setting of chan->max_power was side
effect. This patch restore previous calculations of chan->max_power and
do not touch chan->max_reg_power.
Cc: stable@vger.kernel.org # 3.4+
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
net/wireless/reg.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index b2b3222..4a47878 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -894,7 +894,21 @@ static void handle_channel(struct wiphy *wiphy,
chan->max_antenna_gain = min(chan->orig_mag,
(int) MBI_TO_DBI(power_rule->max_antenna_gain));
chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
- chan->max_power = min(chan->max_power, chan->max_reg_power);
+ if (chan->orig_mpwr) {
+ /*
+ * Devices that have their own custom regulatory domain
+ * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
+ * passed country IE power settings.
+ */
+ if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
+ wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
+ wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
+ chan->max_power = chan->max_reg_power;
+ else
+ chan->max_power = min(chan->orig_mpwr,
+ chan->max_reg_power);
+ } else
+ chan->max_power = chan->max_reg_power;
}
static void handle_band(struct wiphy *wiphy,
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wireless: reg: restore previous behaviour of chan->max_power calculations
2012-07-24 6:35 [PATCH] wireless: reg: restore previous behaviour of chan->max_power calculations Stanislaw Gruszka
@ 2012-07-24 14:53 ` Johannes Berg
2012-07-24 19:28 ` Luis R. Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2012-07-24 14:53 UTC (permalink / raw)
To: Stanislaw Gruszka
Cc: John W. Linville, linux-wireless, users, Hong Wu,
Luis R. Rodriguez
On Tue, 2012-07-24 at 08:35 +0200, Stanislaw Gruszka wrote:
> commit eccc068e8e84c8fe997115629925e0422a98e4de
> Author: Hong Wu <Hong.Wu@dspg.com>
> Date: Wed Jan 11 20:33:39 2012 +0200
>
> wireless: Save original maximum regulatory transmission power for the calucation of the local maximum transmit pow
>
> changed the way we calculate chan->max_power as min(chan->max_power,
> chan->max_reg_power). That broke rt2x00 (and perhaps some other
> drivers) that do not set chan->max_power. It is not so easy to fix this
> problem correctly in rt2x00.
>
> According to commit eccc068e8 changelog, change claim only to save
> maximum regulatory power - changing setting of chan->max_power was side
> effect. This patch restore previous calculations of chan->max_power and
> do not touch chan->max_reg_power.
Applied, but I'll wait for Luis's comments before I push it out.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wireless: reg: restore previous behaviour of chan->max_power calculations
2012-07-24 14:53 ` Johannes Berg
@ 2012-07-24 19:28 ` Luis R. Rodriguez
0 siblings, 0 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2012-07-24 19:28 UTC (permalink / raw)
To: Johannes Berg
Cc: Stanislaw Gruszka, John W. Linville, linux-wireless, users,
Hong Wu
On Tue, Jul 24, 2012 at 04:53:06PM +0200, Johannes Berg wrote:
> On Tue, 2012-07-24 at 08:35 +0200, Stanislaw Gruszka wrote:
> > commit eccc068e8e84c8fe997115629925e0422a98e4de
> > Author: Hong Wu <Hong.Wu@dspg.com>
> > Date: Wed Jan 11 20:33:39 2012 +0200
> >
> > wireless: Save original maximum regulatory transmission power for the calucation of the local maximum transmit pow
> >
> > changed the way we calculate chan->max_power as min(chan->max_power,
> > chan->max_reg_power). That broke rt2x00 (and perhaps some other
> > drivers) that do not set chan->max_power. It is not so easy to fix this
> > problem correctly in rt2x00.
> >
> > According to commit eccc068e8 changelog, change claim only to save
> > maximum regulatory power - changing setting of chan->max_power was side
> > effect. This patch restore previous calculations of chan->max_power and
> > do not touch chan->max_reg_power.
>
> Applied, but I'll wait for Luis's comments before I push it out.
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Makes sense, thanks for catching this.
Luis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-24 19:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24 6:35 [PATCH] wireless: reg: restore previous behaviour of chan->max_power calculations Stanislaw Gruszka
2012-07-24 14:53 ` Johannes Berg
2012-07-24 19:28 ` Luis R. Rodriguez
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).