linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* API to regulatory control (1)
@ 2007-09-22 10:22 Johannes Berg
  2007-09-22 10:32 ` API to regulatory control (2) Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Johannes Berg @ 2007-09-22 10:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luis R. Rodriguez

[-- Attachment #1: Type: text/plain, Size: 4001 bytes --]

Ok since I'm having trouble communicating this via IRC and other people
may have input too, let me summarise how I think regulatory control
should be implemented. This is a high-level overview and maybe Luis's
stuff actually implements things this way, but I can't really tell
because the interesting information (i.e. the API) is buried in
thousands of lines of code of boring definitions. Not to dismiss the
effort to collect all this info, but I think it's rather unimportant at
this stage.

So let me first explain how I see a mac80211-based driver communicating
with mac80211/cfg80211 on regulatory info.

I think each driver should include a few arrays that define which
channels the hardware is capable of operating in. These arrays may be
statically or dynamically allocated depending on the needs. This
basically consists of:

struct ieee80211_channel {
	/* first part set by driver */
	u16 freq;		/* in MHz */
	int hardware_value;	/* arbitrary */
	enum ieee80211_modulation modulation; /* CCK, OFDM */

	u8 supp_dbm_power_max;	/* maximum TX power device supports */

	/* second part updated by regulatory agent */
	u32 flags;		/* disabled, active scan, passive scan, IBSS, DFS, ... */
	u8 perm_dbm_ptmp_power_max; /* permitted pmtp power */
	u8 perm_dbm_ptp_power_max;  /* permitted ptp power */
};

[NOTE: I think there's a restriction on OFDM somewhere so we must have a
channel struct for each modulation to be able to disable OFDM/force
lower power with OFDM]

These are aggregated into an array as such:
struct ieee80211_channels {
	struct ieee80211_channel *band2ghz;
	struct ieee80211_channel *band5ghz;
	int num_band2ghz, num_band5ghz;
};

It would not really be necessary to have a separate list for the two
bands currently in use but it is definitely a lot easier on the code
later.

Now, the driver (say b43) has defined a struct ieee80211_channels it may
call say b43_supported_channels.

Next, the driver needs to say which modulations/bitrates it supports:
struct ieee80211_rate {
	/* stuff from the driver */
	enum ieee80211_modulation modulation; /* OFDM, CCK, CCK_SHORTPRE */
	u32 rate; /* in units of 100 Kbps */
	/* internal stuff */
	TBD;
};

Again, it's stuffed together into an array:
struct ieee80211_rates {
	struct ieee80211_rate *rates;
	int num_rates;
};

so let's say we now have a b43_supported_rates variable although we
really have one for A, B, BG and ABG devices.

NOTE: All this rate stuff is *NOT* interesting for regulatory. *IFF*
there are regulatory restrictions on bitrates anywhere then we need to
make this part of the channels array!

Ok enough of the declarations.

Now, before the driver registers it's hardware struct, it puts both
&b43_supported_channels into the "struct wiphy". This is how both
mac80211 and cfg80211 get told about it. &b43_supported_rates is put
into struct ieee80211_hw, only mac80211 needs to know about it, fullmac
drivers never need to show this information to anything outside except
maybe for some cfg80211 *hooks*.

**For mac80211 drivers, this is it!**

Internally, mac80211 or fullmac drivers of course need to check the
channel structs internally when they are asked to move to a different
channel or change TX power.

At this point, however, the regulatory agent API only starts. First of
all, the channel list has already been registered with cfg80211 because
a pointer is part of struct wiphy. Then, when by any way possible, the
regulatory restrictions change (user setting, ...) the fields marked
"second part updated by regulatory agent" are updated for each wiphy and
a notifier chain is invoked that drivers may register on to get updates.
I'm not sure how important this notifier chain is but it can't hurt to
have it.

From what I can see, this finishes the channel restrictions API. Since
none of the information in the channels list is specific to some device,
it may be allocated statically.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: API to regulatory control (1)
@ 2007-09-25 14:43 Joerg Pommnitz
  2007-09-25 15:11 ` Johannes Berg
  0 siblings, 1 reply; 18+ messages in thread
From: Joerg Pommnitz @ 2007-09-25 14:43 UTC (permalink / raw)
  To: linux-wireless

 > From what I can see, this finishes the channel restrictions API. Since
 > none of the information in the channels list is specific to some device,
 > it may be allocated statically.

Well, I beg to differ. I'm working on a system were we have regulatory
approval to use a TX power of up to 4W in certain channels. This means
that the regulatory settings (e.g. allowed channels) are different for
cards with amplifier and those without, even on the same machine.
--  Regards
 
       Joerg
 






      __________________________________  
Yahoo! Clever: Sie haben Fragen? Yahoo! Nutzer antworten Ihnen. www.yahoo.de/clever


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

end of thread, other threads:[~2007-09-25 16:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22 10:22 API to regulatory control (1) Johannes Berg
2007-09-22 10:32 ` API to regulatory control (2) Johannes Berg
2007-09-22 16:33   ` Luis R. Rodriguez
2007-09-24  8:43     ` Johannes Berg
2007-09-22 21:16 ` API to regulatory control (1) Luis R. Rodriguez
2007-09-24  9:02   ` Johannes Berg
2007-09-24 19:55     ` Luis R. Rodriguez
2007-09-24 21:36       ` Johannes Berg
2007-09-24 22:18         ` Luis R. Rodriguez
2007-09-25 13:40           ` Johannes Berg
2007-09-25 16:13             ` Luis R. Rodriguez
2007-09-25 16:23               ` Johannes Berg
2007-09-24 12:59 ` Pavel Roskin
2007-09-24 13:07   ` Christoph Hellwig
2007-09-24 13:11     ` Johannes Berg
2007-09-24 13:24       ` Pavel Roskin
  -- strict thread matches above, loose matches on Subject: below --
2007-09-25 14:43 Joerg Pommnitz
2007-09-25 15:11 ` Johannes Berg

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