On Thu, Mar 26, 2009 at 3:57 AM, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote: > On Sun, 2009-03-22 at 10:02 +0100, Johannes Berg wrote: >> Ok, so I'm thinking about the interpretation rules for the regulatory >> information. I even dreamt about this tonight, unfortunately... > > [...] > >> Now how should you interpret this? I'll propose the following >> interpretation rules (and show how you arrive at the required >> interpretation from above): >> >> 1) MIN values are really something like MIN+, i.e. approaching the MIN >> from above, that means that the value "2452 MHz" falls into the >> first of the ranges, not the second [3] >> >> 2) The entire band a channel occupies needs to be covered by (any >> number of) contiguous rules. >> >> 3) The MAXBW value specifies what maximum bandwidth a channel can use >> which has its center frequency (!) falling into the given range. >> >> 4) The FLAGS specify restrictions that any channel _overlapping_ the >> given range has to operate under. >> >> That is all. Now let me show how to interpret this. > > Let me rewrite those rules, more formally. > > Let's take an example regdomain with "n" rules: > > country EX: > (MIN_1 - MAX_1 @ BW_1), (MAXAG_1, TXPWR_1), FLAGS_1 > ... > (MIN_n - MAX_n @ BW_n), (MAXAG_n, TXPWR_n), FLAGS_n > > And let's say we need to determine whether a channel, which > (disregarding modulation for a moment) is determined by its center > frequency and bandwidth: > CHANNEL = (CENTER, BW) > > Then the rules are as follows, now using the notation outlined here: > http://en.wikipedia.org/wiki/Interval_(mathematics)#Notations_for_intervals (I'd use latex notation if I knew everybody was familiar with it, you have to do with some words instead) > > 0) (stated outside rules before) for all 1 <= k < n : MAX_k <= MIN_{k+1} > [1] > > 1) each rule in the regdomain covers the frequency range (MIN_1, MAX_1] > [2] > > 2) given C = union (over all k = 1 .. n) of (MIN_k, MAX_k] it must be > true that (CENTER - BW/2, CENTER + BW/2) is a subset of C > > 3) it must be true for all 1 <= k <= n: > if CENTER in (MIN_k, MAX_k] : BW <= BW_k [3] > > 4) This is easier to formulate algorithmically: > USE_FLAGS = 0 > for k = 1 .. n > if CENTER in (MIN_k, MAX_k]: > USE_FLAGS |= FLAGS_k > > johannes > > [1] this says "no overlap" but also "must be sorted" which can be > beneficial > [2] this is a useless rule given the way I formulated rules 3 and 4, but > it helps think about how it works > [3] given rule 0) the if only matches (at most) once This helps a lot :), looks good to me! If anyone has a case where overlapping regulatory rules _should_ exist now would be a great time to give an example. Otherwise they go away. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html