All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crda: handle AUTO bw setting in db2rd
@ 2014-02-12 17:43 Janusz Dziedzic
  2014-02-19  0:33 ` Luis R. Rodriguez
  0 siblings, 1 reply; 11+ messages in thread
From: Janusz Dziedzic @ 2014-02-12 17:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, mcgrof, linville, Janusz Dziedzic

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(-)

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)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-12 17:43 [PATCH] crda: handle AUTO bw setting in db2rd Janusz Dziedzic
@ 2014-02-19  0:33 ` Luis R. Rodriguez
  2014-02-19  6:12   ` Janusz Dziedzic
  0 siblings, 1 reply; 11+ messages in thread
From: Luis R. Rodriguez @ 2014-02-19  0:33 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless, Johannes Berg, John W. Linville

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-19  0:33 ` Luis R. Rodriguez
@ 2014-02-19  6:12   ` Janusz Dziedzic
  2014-02-19 22:00     ` Luis R. Rodriguez
  0 siblings, 1 reply; 11+ messages in thread
From: Janusz Dziedzic @ 2014-02-19  6:12 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Janusz Dziedzic, linux-wireless, Johannes Berg, John W. Linville

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-19  6:12   ` Janusz Dziedzic
@ 2014-02-19 22:00     ` Luis R. Rodriguez
  2014-02-20  7:27       ` Janusz Dziedzic
  0 siblings, 1 reply; 11+ messages in thread
From: Luis R. Rodriguez @ 2014-02-19 22:00 UTC (permalink / raw)
  To: Janusz Dziedzic
  Cc: Janusz Dziedzic, linux-wireless, Johannes Berg, John W. Linville

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-19 22:00     ` Luis R. Rodriguez
@ 2014-02-20  7:27       ` Janusz Dziedzic
  2014-02-20  7:51         ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Janusz Dziedzic @ 2014-02-20  7:27 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Janusz Dziedzic, linux-wireless, Johannes Berg, John W. Linville

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-20  7:27       ` Janusz Dziedzic
@ 2014-02-20  7:51         ` Johannes Berg
  2014-02-20  7:57           ` Janusz Dziedzic
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2014-02-20  7:51 UTC (permalink / raw)
  To: Janusz Dziedzic
  Cc: Luis R. Rodriguez, Janusz Dziedzic, linux-wireless, John W. Linville

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-20  7:51         ` Johannes Berg
@ 2014-02-20  7:57           ` Janusz Dziedzic
  2014-02-20  7:59             ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Janusz Dziedzic @ 2014-02-20  7:57 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Luis R. Rodriguez, Janusz Dziedzic, linux-wireless, John W. Linville

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-20  7:57           ` Janusz Dziedzic
@ 2014-02-20  7:59             ` Johannes Berg
  2014-02-20  8:03               ` Janusz Dziedzic
  0 siblings, 1 reply; 11+ messages in thread
From: Johannes Berg @ 2014-02-20  7:59 UTC (permalink / raw)
  To: Janusz Dziedzic
  Cc: Luis R. Rodriguez, Janusz Dziedzic, linux-wireless, John W. Linville

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-20  7:59             ` Johannes Berg
@ 2014-02-20  8:03               ` Janusz Dziedzic
  2014-02-20  9:31                 ` Janusz Dziedzic
  0 siblings, 1 reply; 11+ messages in thread
From: Janusz Dziedzic @ 2014-02-20  8:03 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Luis R. Rodriguez, Janusz Dziedzic, linux-wireless, John W. Linville

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-20  8:03               ` Janusz Dziedzic
@ 2014-02-20  9:31                 ` Janusz Dziedzic
  2014-02-20  9:54                   ` Johannes Berg
  0 siblings, 1 reply; 11+ messages in thread
From: Janusz Dziedzic @ 2014-02-20  9:31 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Luis R. Rodriguez, Janusz Dziedzic, linux-wireless, John W. Linville

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
-

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] crda: handle AUTO bw setting in db2rd
  2014-02-20  9:31                 ` Janusz Dziedzic
@ 2014-02-20  9:54                   ` Johannes Berg
  0 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2014-02-20  9:54 UTC (permalink / raw)
  To: Janusz Dziedzic
  Cc: Luis R. Rodriguez, Janusz Dziedzic, linux-wireless, John W. Linville

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-02-20  9:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-12 17:43 [PATCH] crda: handle AUTO bw setting in db2rd Janusz Dziedzic
2014-02-19  0:33 ` Luis R. Rodriguez
2014-02-19  6:12   ` Janusz Dziedzic
2014-02-19 22:00     ` Luis R. Rodriguez
2014-02-20  7:27       ` Janusz Dziedzic
2014-02-20  7:51         ` Johannes Berg
2014-02-20  7:57           ` Janusz Dziedzic
2014-02-20  7:59             ` Johannes Berg
2014-02-20  8:03               ` Janusz Dziedzic
2014-02-20  9:31                 ` Janusz Dziedzic
2014-02-20  9:54                   ` Johannes Berg

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.