From: Matthias May <matthias.may@neratec.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCHv2 1/4] cfg80211: handle minimum bandwidth for quarter and half rates
Date: Thu, 11 Jun 2015 14:46:23 +0200 [thread overview]
Message-ID: <5579831F.3020304@neratec.com> (raw)
In-Reply-To: <1434023059.1915.12.camel@sipsolutions.net>
On 11/06/15 13:44, Johannes Berg wrote:
> On Thu, 2015-06-11 at 13:06 +0200, Matthias May wrote:
>
>> const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
>> - u32 center_freq)
>> + u32 center_freq, u32 min_bw)
>> {
>> const struct ieee80211_regdomain *regd;
>> + const struct ieee80211_reg_rule *rr_tmp = NULL;
>> + const struct ieee80211_reg_rule *reg_rule = NULL;
>> + u32 bw;
>>
>> regd = reg_get_regdomain(wiphy);
>>
>> - return freq_reg_info_regd(wiphy, center_freq, regd);
>> + for(bw=min_bw; bw <= MHZ_TO_KHZ(20); bw=bw*2) {
>> + rr_tmp = freq_reg_info_regd(wiphy, center_freq, bw, regd);
>> + if(!reg_rule || !IS_ERR(rr_tmp))
>> + reg_rule = rr_tmp;
>> + }
>> +
>> + return reg_rule;
> This makes no sense to me.
>
> You have the same code below, but why would you care? You can just look
> at the reg_rule's max_bandwidth, no?
>
> johannes
>
Using the dummy country code:
country XS: DFS-UNSET
(5170 - 5180 @ 5), (N/A, 14), (N/A)
(5175 - 5185 @ 10), (N/A, 17), (N/A)
(5170 - 5190 @ 20), (N/A, 20), (N/A)
For a center freq of 5175
The first loop finds the first rule. --> we want this.
The second loop doesn't find anything.
The third loop doesn't find anything.
However for a center freq of 5180
The first loop find the first rule
The second loop find the second rule
The third loop find the third rule. --> We want this
If there are different overlapping rules for the different bandwidths
different results can be returned, especially at the border of a
frequency range.
A work colleague pointed out that it could be done more efficiently:
const struct ieee80211_regdomain *regd;
const struct ieee80211_reg_rule *reg_rule = NULL;
u32 bw;
regd = reg_get_regdomain(wiphy);
for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
reg_rule = freq_reg_info_regd(wiphy, center_freq, bw, regd);
if (!IS_ERR(reg_rule))
return reg_rule;
}
return reg_rule;
However after some more discussion we noticed, that this again would
allow to start 20MHz wide operation at the border
This is because when setting the flags we only look at the max_bandwidth
of the returned rule.
I guess we would have to recheck if a certain width fits a center freq
when setting this flags.
Will have to think a bit more how to solve this without having to
recheck everything again...
Matthias
next prev parent reply other threads:[~2015-06-11 12:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 11:06 [PATCHv2 0/4] Handle minimum bandwidth for quarter and half rates Matthias May
2015-06-11 11:06 ` [PATCHv2 1/4] cfg80211: handle " Matthias May
2015-06-11 11:33 ` Johannes Berg
2015-06-11 11:44 ` Johannes Berg
2015-06-11 12:46 ` Matthias May [this message]
2015-06-11 15:22 ` Johannes Berg
2015-06-11 11:06 ` [PATCHv2 2/4] ath: send minimum bandwidth to handle Matthias May
2015-06-11 11:06 ` [PATCHv2 3/4] brcm80211: " Matthias May
2015-06-11 11:06 ` [PATCHv2 4/4] rtlwifi: " Matthias May
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=5579831F.3020304@neratec.com \
--to=matthias.may@neratec.com \
--cc=johannes@sipsolutions.net \
--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).