Message ID | 1392226988-3878-1-git-send-email-janusz.dziedzic@tieto.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Wed, Feb 12, 2014 at 9:43 AM, Janusz Dziedzic <janusz.dziedzic@tieto.com> wrote: > Handle AUTO bandwidth setting in db2rd. > Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute > in case of AUTO bw calculation. > > Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> Please elaborate more on this. Who deals with the automatic math on the bandwidth? Luis -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2014-02-19 1:33 GMT+01:00 Luis R. Rodriguez <mcgrof@do-not-panic.com>: > On Wed, Feb 12, 2014 at 9:43 AM, Janusz Dziedzic > <janusz.dziedzic@tieto.com> wrote: >> Handle AUTO bandwidth setting in db2rd. >> Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute >> in case of AUTO bw calculation. >> >> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> > > Please elaborate more on this. Who deals with the automatic math on > the bandwidth? > cfg80211, Please check patch: cfg80211: regulatory introduce maximum bandwidth calculation BR Janusz -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Feb 18, 2014 at 10:12 PM, Janusz Dziedzic <janusz.dziedzic@gmail.com> wrote: > 2014-02-19 1:33 GMT+01:00 Luis R. Rodriguez <mcgrof@do-not-panic.com>: >> On Wed, Feb 12, 2014 at 9:43 AM, Janusz Dziedzic >> <janusz.dziedzic@tieto.com> wrote: >>> Handle AUTO bandwidth setting in db2rd. >>> Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute >>> in case of AUTO bw calculation. >>> >>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> >> >> Please elaborate more on this. Who deals with the automatic math on >> the bandwidth? >> > cfg80211, > > Please check patch: > cfg80211: regulatory introduce maximum bandwidth calculation OK, so we don't send the max bandwidth attribute now, what about support for older kernels? Luis -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 19 February 2014 23:00, Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote: > On Tue, Feb 18, 2014 at 10:12 PM, Janusz Dziedzic > <janusz.dziedzic@gmail.com> wrote: >> 2014-02-19 1:33 GMT+01:00 Luis R. Rodriguez <mcgrof@do-not-panic.com>: >>> On Wed, Feb 12, 2014 at 9:43 AM, Janusz Dziedzic >>> <janusz.dziedzic@tieto.com> wrote: >>>> Handle AUTO bandwidth setting in db2rd. >>>> Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute >>>> in case of AUTO bw calculation. >>>> >>>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> >>> >>> Please elaborate more on this. Who deals with the automatic math on >>> the bandwidth? >>> >> cfg80211, >> >> Please check patch: >> cfg80211: regulatory introduce maximum bandwidth calculation > > OK, so we don't send the max bandwidth attribute now, what about > support for older kernels? > Yes, seems we should send this even this is 0. Next for old kernel, all channels where BW=0 will be HT20 only. BR Janusz -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2014-02-20 at 08:27 +0100, Janusz Dziedzic wrote: > On 19 February 2014 23:00, Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote: > > On Tue, Feb 18, 2014 at 10:12 PM, Janusz Dziedzic > > <janusz.dziedzic@gmail.com> wrote: > >> 2014-02-19 1:33 GMT+01:00 Luis R. Rodriguez <mcgrof@do-not-panic.com>: > >>> On Wed, Feb 12, 2014 at 9:43 AM, Janusz Dziedzic > >>> <janusz.dziedzic@tieto.com> wrote: > >>>> Handle AUTO bandwidth setting in db2rd. > >>>> Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute > >>>> in case of AUTO bw calculation. > >>>> > >>>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> > >>> > >>> Please elaborate more on this. Who deals with the automatic math on > >>> the bandwidth? > >>> > >> cfg80211, > >> > >> Please check patch: > >> cfg80211: regulatory introduce maximum bandwidth calculation > > > > OK, so we don't send the max bandwidth attribute now, what about > > support for older kernels? > > > Yes, seems we should send this even this is 0. > Next for old kernel, all channels where BW=0 will be HT20 only. Is that really a good idea? Maybe crda should just get the logic to determine maximum bandwidth, like you did in the kernel, and then we can even revert the kernel code again? johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 20 February 2014 08:51, Johannes Berg <johannes@sipsolutions.net> wrote: > On Thu, 2014-02-20 at 08:27 +0100, Janusz Dziedzic wrote: >> On 19 February 2014 23:00, Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote: >> > On Tue, Feb 18, 2014 at 10:12 PM, Janusz Dziedzic >> > <janusz.dziedzic@gmail.com> wrote: >> >> 2014-02-19 1:33 GMT+01:00 Luis R. Rodriguez <mcgrof@do-not-panic.com>: >> >>> On Wed, Feb 12, 2014 at 9:43 AM, Janusz Dziedzic >> >>> <janusz.dziedzic@tieto.com> wrote: >> >>>> Handle AUTO bandwidth setting in db2rd. >> >>>> Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute >> >>>> in case of AUTO bw calculation. >> >>>> >> >>>> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> >> >>> >> >>> Please elaborate more on this. Who deals with the automatic math on >> >>> the bandwidth? >> >>> >> >> cfg80211, >> >> >> >> Please check patch: >> >> cfg80211: regulatory introduce maximum bandwidth calculation >> > >> > OK, so we don't send the max bandwidth attribute now, what about >> > support for older kernels? >> > >> Yes, seems we should send this even this is 0. >> Next for old kernel, all channels where BW=0 will be HT20 only. > > Is that really a good idea? > > Maybe crda should just get the logic to determine maximum bandwidth, > like you did in the kernel, and then we can even revert the kernel code > again? > Yes, this is possible to calculate this in crda (or even set this manually). In such case we have to remove this bw check in the kernel code: is_valid_reg_rule(...) freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; if (freq_range->max_bandwidth_khz > freq_diff) return false; BR Janusz -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2014-02-20 at 08:57 +0100, Janusz Dziedzic wrote: > >> Yes, seems we should send this even this is 0. > >> Next for old kernel, all channels where BW=0 will be HT20 only. > > > > Is that really a good idea? > > > > Maybe crda should just get the logic to determine maximum bandwidth, > > like you did in the kernel, and then we can even revert the kernel code > > again? > > > Yes, this is possible to calculate this in crda (or even set this manually). Ok. Would that help older kernels? How would we handle genregdb.awk? johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 20 February 2014 08:59, Johannes Berg <johannes@sipsolutions.net> wrote: > On Thu, 2014-02-20 at 08:57 +0100, Janusz Dziedzic wrote: > >> >> Yes, seems we should send this even this is 0. >> >> Next for old kernel, all channels where BW=0 will be HT20 only. >> > >> > Is that really a good idea? >> > >> > Maybe crda should just get the logic to determine maximum bandwidth, >> > like you did in the kernel, and then we can even revert the kernel code >> > again? >> > >> Yes, this is possible to calculate this in crda (or even set this manually). > > Ok. Would that help older kernels? How would we handle genregdb.awk? > In case of older kernels we will fail (end_freq - start_freq < bw) with -EINVAL. So, bw=0 (cfg calculation) seems like best idea - will work with new and old kernels. BR Janusz -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 20 February 2014 09:03, Janusz Dziedzic <janusz.dziedzic@tieto.com> wrote: > On 20 February 2014 08:59, Johannes Berg <johannes@sipsolutions.net> wrote: >> On Thu, 2014-02-20 at 08:57 +0100, Janusz Dziedzic wrote: >> >>> >> Yes, seems we should send this even this is 0. >>> >> Next for old kernel, all channels where BW=0 will be HT20 only. >>> > >>> > Is that really a good idea? >>> > >>> > Maybe crda should just get the logic to determine maximum bandwidth, >>> > like you did in the kernel, and then we can even revert the kernel code >>> > again? >>> > >>> Yes, this is possible to calculate this in crda (or even set this manually). >> >> Ok. Would that help older kernels? How would we handle genregdb.awk? >> > In case of older kernels we will fail (end_freq - start_freq < bw) with -EINVAL. > So, bw=0 (cfg calculation) seems like best idea - will work with new > and old kernels. > Seems cfg80211 max bandwidth calculation is best option here. We should set BW as is in old regulatory (skip this BW=0 patches) - will work fine with old kernels. And in new regulatory add RULE flag NL80211_RRF_AUTO_BW, which will be checked in newer kernels and if AUTO_BW flag we will skip (end_freq - start_freq < bw) check and calculate maximum available bandwidth. What you think? BR Janusz - -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2014-02-20 at 10:31 +0100, Janusz Dziedzic wrote: > On 20 February 2014 09:03, Janusz Dziedzic <janusz.dziedzic@tieto.com> wrote: > > On 20 February 2014 08:59, Johannes Berg <johannes@sipsolutions.net> wrote: > >> On Thu, 2014-02-20 at 08:57 +0100, Janusz Dziedzic wrote: > >> > >>> >> Yes, seems we should send this even this is 0. > >>> >> Next for old kernel, all channels where BW=0 will be HT20 only. > >>> > > >>> > Is that really a good idea? > >>> > > >>> > Maybe crda should just get the logic to determine maximum bandwidth, > >>> > like you did in the kernel, and then we can even revert the kernel code > >>> > again? > >>> > > >>> Yes, this is possible to calculate this in crda (or even set this manually). > >> > >> Ok. Would that help older kernels? How would we handle genregdb.awk? > >> > > In case of older kernels we will fail (end_freq - start_freq < bw) with -EINVAL. > > So, bw=0 (cfg calculation) seems like best idea - will work with new > > and old kernels. > > > Seems cfg80211 max bandwidth calculation is best option here. > > We should set BW as is in old regulatory (skip this BW=0 patches) - > will work fine with old kernels. > And in new regulatory add RULE flag NL80211_RRF_AUTO_BW, which will be > checked in newer kernels and if AUTO_BW flag we will skip (end_freq - > start_freq < bw) check and calculate maximum available bandwidth. What > you think? Yeah that seems reasonable. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/crda.c b/crda.c index 0bf83a1..2fc5bce 100644 --- a/crda.c +++ b/crda.c @@ -127,7 +127,8 @@ static int put_reg_rule(const struct ieee80211_reg_rule *rule, struct nl_msg *ms NLA_PUT_U32(msg, NL80211_ATTR_REG_RULE_FLAGS, rule->flags); NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_START, freq_range->start_freq_khz); NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_END, freq_range->end_freq_khz); - NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW, freq_range->max_bandwidth_khz); + if (freq_range->max_bandwidth_khz) + NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW, freq_range->max_bandwidth_khz); NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, power_rule->max_antenna_gain); NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_EIRP, power_rule->max_eirp); diff --git a/reglib.c b/reglib.c index af38fe7..bb8ce96 100644 --- a/reglib.c +++ b/reglib.c @@ -1116,7 +1116,7 @@ reglib_parse_rule_args_cac(char *line, struct ieee80211_reg_rule *reg_rule) static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule) { char line[1024]; - char *line_p; + char *line_p, *auto_p; unsigned int i; int r = 0; struct reglib_rule_parse_list *reglib_rule_parsers; @@ -1150,6 +1150,13 @@ static int reglib_parse_rule(FILE *fp, struct ieee80211_reg_rule *reg_rule) return -EINVAL; } + auto_p = strstr(line_p, "@ AUTO"); + if (auto_p) { + /* This will be much easier instead of adding new parser! */ + memcpy(&auto_p[0], "@ 0", 3); + memcpy(&auto_p[3], &auto_p[6], strlen(line_p) + 1 - (auto_p + 3 - line_p)); + } + for (i = 0; i < reglib_rule_parsers->n_parsers; i++) { r = reglib_rule_parsers->rule_parsers[i](line, reg_rule); if (r == 0)
Handle AUTO bandwidth setting in db2rd. Don't add NL80211_ATTR_FREQ_RANGE_MAX_BW attribute in case of AUTO bw calculation. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> --- crda.c | 3 ++- reglib.c | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-)