Add central regulatory domain agent - Patchset I
cover Add central regulatory domain agent - Patchset I
Patchset I - Add central regulatory domain agent
This is patchset I of II which adds a central regulatory domain agent onto the wireless subsystem. I've split it into two patchsets in order to introduce the agent before affecting mac80211 drivers. This allows work to continue on the central reg agent independant of mac80211 advancements.
Patch series I adds the central regulatory domain agent and integrates it with cfg80211. The central reg agent consists of 2 main modules:
* ISO3166-1
* Regdomains
Additionally, changing regulatory domains can be acomplished through the use of a new configfs module which will be introduced for the wireless subsystem.
Patch series II will add support for the centreal reglatory agent onto mac80211, remove mac80211's simple regulatory control and and replace each driver's own regulatory domain implementation with the central one.
Luis
Quoted 12 lines · Luis R. Rodriguez
Patchset I - Add central regulatory domain agent
This is patchset I of II which adds a central regulatory domain agent onto the wireless subsystem. I've split it into two patchsets in order to introduce the agent before affecting mac80211 drivers. This allows work to continue on the central reg agent independant of mac80211 advancements.
Patch series I adds the central regulatory domain agent and integrates it with cfg80211. The central reg agent consists of 2 main modules:
Quoted 6 lines
* ISO3166-1
* RegdomainsAdditionally, changing regulatory domains can be acomplished through the use of a new configfs module which will be introduced for the wireless subsystem.
Can we _also_ make it accessible through cfg80211/nl80211 in some fashion?
Dan
Quoted 6 lines
Patch series II will add support for the centreal reglatory agent onto mac80211, remove mac80211's simple regulatory control and and replace each driver's own regulatory domain implementation with the central one.
Luis
Quoted 11 lines · Luis R. Rodriguez
Patchset I - Add central regulatory domain agent
This is patchset I of II which adds a central regulatory domain agent onto the wireless subsystem. I've split it into two patchsets in order to introduce the agent before affecting mac80211 drivers. This allows work to continue on the central reg agent independant of mac80211 advancements.
Patch series I adds the central regulatory domain agent and integrates it with cfg80211. The central reg agent consists of 2 main modules:
My bad, my reading was too quick. I see cfg80211 above now :)
Dan
Quoted 13 lines
* ISO3166-1
* RegdomainsAdditionally, changing regulatory domains can be acomplished through the use of a new configfs module which will be introduced for the wireless subsystem.
Patch series II will add support for the centreal reglatory agent onto mac80211, remove mac80211's simple regulatory control and and replace each driver's own regulatory domain implementation with the central one.
Luis
PATCH 1/5 Move standard wireless defintions out of mac80211
In reply to Luis R. RodriguezI tried moving the common stuff to a few already existing files and in all of them I had dependency issues. Adding a wireless_common hoping we can later clean out net/ieee80211.h and linux/ieee80211.h
* Move standard wireless structs and definitions out of mac80211 and into a wireless_common.h.
* Move IEEE80211_CHAN_W_* flags, struct ieee80211_channel, IEEE80211_RATE_* flags, struct ieee80211_rate, and enum ieee80211_phymode out to wireless_common.h
* Move IEEE80211_CHAN_W_* defines to enum channel_flags, add documenation
* Move IEEE80211_RATE_* defines to enum rate_flags, add documenation
* Add documenation for ieee80211_channel
* Add documenation for ieee80211_rate
* Remove unused min_rssi_ack, and min_rssi_ack_delta from struct ieee80211_rate as its unused
* Remove usage of min_rssi_ack and min_rssi_ack_delta from Ralink driver (rt2x00dev.c), it just initialized it unnesariily to 0 (as the struct was kzalloc'd anyway). But mac80211 never used this.
--- drivers/net/wireless/rt2x00/rt2x00dev.c | 2 - include/net/mac80211.h | 63 +------------ include/net/wireless_common.h | 154 +++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+), 64 deletions(-) create mode 100644 include/net/wireless_common.h
drivers/net/wireless/rt2x00/rt2x00dev.c +0 -2
@@ -559,8 +559,6 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry, entry->val2 = entry->val;if (entry->flags &IEEE80211_RATE_PREAMBLE2 ) entry->val2 |=DEVICE_SET_RATE_FIELD (1 ,PREAMBLE ); - entry->min_rssi_ack =0 ; - entry->min_rssi_ack_delta =0 ; } static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
include/net/mac80211.h +1 -62
75 lines not on this page · raw message
include/net/wireless_common.h new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
1.5.2.4
PATCH 3/5 Wireless: add IEEE-802.11 regualtory domain module
In reply to Luis R. RodriguezThis adds the regulatory domain module. It provides a way to allocate and construct a regulatory domain based on the current map. This module provides no enforcement, it just does the actual building of the regdomain and returns it as defined in ieee80211_regdomains.h
This module depends on the ISO3166-1 module.
--- include/net/ieee80211_regdomains.h | 196 ++++++++ net/wireless/Kconfig | 16 + net/wireless/Makefile | 1 + net/wireless/reg_common.h | 138 ++++++ net/wireless/regdomains.c | 751 ++++++++++++++++++++++++++++++ net/wireless/regulatory_map.h | 887 ++++++++++++++++++++++++++++++++++++ 6 files changed, 1989 insertions(+), 0 deletions(-) create mode 100644 include/net/ieee80211_regdomains.h create mode 100644 net/wireless/reg_common.h create mode 100644 net/wireless/regdomains.c create mode 100644 net/wireless/regulatory_map.h
include/net/ieee80211_regdomains.h new file +196 -0
@@ -0,0 +1,196 @@ +#ifndef _IEEE80211_REGDOMAIN_H +#define _IEEE80211_REGDOMAIN_H +/* +* Copyright (C) 2006-2007 Luis R. Rodriguez <[email protected]> +* +* Permission to use, copy, modify, and distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +* +*/ + +#include <linux/kernel.h> +#include <net/wireless_common.h> +#include <net/iso3166-1.h> + +#define REGDOMAINS_VERSION "1.0" +#define REGNAMSIZ 22 +#define REGSBNAMSIZ 30 + +/* Changing this will change the default regulatory domain +* for countries we don't have a map for. Use World as default */ +#define DEFAULT_REG_ISO3166_1 "00" + +/* XXX: <net/ieee80211.h> has two band defs bellow */ +#ifndef IEEE80211_24GHZ_BAND +#define IEEE80211_24GHZ_BAND (1<<0) +#define IEEE80211_52GHZ_BAND (1<<1) +#endif + +#define MAX_NUM_MODE_A_CHANS 220 +#define MAX_NUM_MODE_B_CHANS 26 +#define MAX_NUM_MODE_G_CHANS 26 + +#define REG_NUM_SUBBANDS 7 + +/** +* struct ieee80211_subband_restrictions - defines a regulatory domain +* subband restrictions list +* +* @band: which band we this subband belongs to, could be either IEEE80211_24GHZ_BAND +* or IEEE80211_52GHZ_BAND +* @name: name for this subband. +* @min_freq: minimum frequency for this subband, in MHz. This represents the +* center of frequency of a channel. +* @max_freq: maximum frequency for this subband, in MHz. This represents the +* center of frequency of a channel. +* @modulation_cap: modulations this subband is capable of handling. This can be +* IEEE80211_RATE_OFDM, IEEE80211_RATE_CCK +* @environment_cap: defines indoor/outdoor capability for subband as defined by +* the 802.11d Country Information element char. This can be +* Indoor REG_CAP_INDOOR ('I'), REG_CAP_OUTDOOR ('O'), or both +* REG_CAP_INOUT (' '). +* @max_antenna_gain: defines the maximum antenna gain set by regulatory +* agencies for this subband. This is expressed in dBi, which is +* dB relative to isotropic, used to measure antenna gain compared to an +* isotropic antenna on which radiation is distributed uniformly on the +* surface of a sphere. This can be used to define mac80211's +* conf.antenna_max and channel.antenna_max for example. +* @max_ir_ptmp: maximum allowed Intentional Radiated power on the transmitter +* for Point to Multi Points, given in dBm. This applies to stations, +* Access Points and PtMP bridges. +* @max_ir_ptmp: maximum allowed Intentional Radiated power on the transmitter +* for Point to Point links such as PtP Bridges, given in dBm. +* @max_eirp_ptmp: maximum allowed Equivalent Isotropically Radiated Power on +* the transmitter for Point to Point to Multi Points links, given in dBm +* @max_eirp_ptp: maximum allowed Equivalent Isotropically Radiated Power on +* the transmitter for Point to Point links such as PtP Bridges, given in +* dBm. +* @num_channels: number of channels in channel_list. +* @channel_list: linked list of all channels on this subband. These are of +* type @ieee80211_channel +* +* This structure contains the regualtory power restrictions on this subband +* and has a linked list of all possible channels. Wireless drivers can compute +* their maximum allowed TX power as follows: +* +* Max TX Power = Max EIRP - passive gain of antenna +* +* Keep in mind that the passive gain of the standard dipole antenna is approx +* 2.2 dBi. You can use this value for most wireless setups. Please note that +* some regulatory domains also have rules to which change the max IR if you +* change the antenna, such as the 1:1 and 3:1 rule for the FCC. For more +* information please refer to the Documentation/ieee80211_regdomains.txt +* documentation. +*/ +struct ieee80211_subband_restrictions { +u8 band; +char name[REGSBNAMSIZ ]; +u16 min_freq; +u16 max_freq; +u32 modulation_cap; +u8 max_antenna_gain; +u8 max_ir_ptmp; +u8 max_ir_ptp; +#define REG_DIPOLE_ANTENNA_GAIN 2 +u8 max_eirp_ptmp; +u8 max_eirp_ptp; +#define REG_CAP_INDOOR 'I' +#define REG_CAP_OUTDOOR 'O' +#define REG_CAP_INOUT ' ' +char environment_cap; +u8 num_channels; +struct list_head channel_list; +}; + +/** +* struct ieee80211_regdomain - defines a regulatory domain +* +* @regdomain_id: ID of this regulatory domain. Some come from +* http://standards.ieee.org/getieee802/download/802.11b-1999_Cor1-2001.pdf +* @regdomain_name: name of this regulatory domain. +* @list: node, part of band_restrictions_list +* +* This structure defines a regulatory domain, which consists of channel and +* power restrictions. Some regulatory domains come from +* 802.11b-1999_Cor1-2001, the rest are based on Reyk Floeter's ar5k. If +* there is need to add more values here, please add one that is either +* defined in a standard or that many hardware devices have adopted. Also +* note that multiple countries can map to the same @regdomain_id +*/ +struct ieee80211_regdomain { +u32 regdomain_id; +char regdomain_name[REGNAMSIZ ]; +struct ieee80211_subband_restrictions subbands[REG_NUM_SUBBANDS ]; +}; + +/** +* struct ieee80211_iso3166_reg_map - map of an ISO3166-1 country to a regdomain +* +* @alpha2: the ISO-3166-1 alpha2 country code string. Example: 'CR' for +* Costa Rica. +* +* @regdomain_id: a regualtory domain ID this country maps to. +* +* This structure holds the mapping of the country to a specific regulatory +* domain. Keep in mind more than one country can map to the same regulatory +* domain. The ISO-3166-1 alpha2 country code also happens to be used in the +* 802.11d Country Information Element on the string for the country. It +* should be noted, however, that in that the size of this string, is +* three octects while our string is only 2. The third octet is used to +* indicate Indoor/outdoor capabilities which we set in +* @ieee80211_subband_restrictions environment_cap. +*/ +struct ieee80211_iso3166_reg_map { +char alpha2[ISOCOUNTRYSIZ2 ]; +u32 regdomain_id;/* stack-aware value */ +/* XXX: shall we just use an array? */ +struct list_head list;/* node, part of iso3166_reg_map_list */ +}; + +/** +* regdomain_mhz2ieee - convert a frequency to an IEEE-80211 channel number +* @freq: center of frequency in MHz. We support a range: +* 2412 - 2732 MHz (Channel 1 - 26) in the 2GHz band and +* 5005 - 6100 MHz (Channel 1 - 220) in the 5GHz band. +* +* Given a frequency in MHz returns the respective IEEE-80211 channel +* number. You are expected to provide the center of freqency in MHz. +*/ +u16 regdomain_mhz2ieee (u16 freq); + +/** +* regdomain_ieee2mhz - convert an IEEE-80211 channel number to frequency +* @chan: An IEEE-802.11 channel number we support the range: +* Channel 1 - 26 in the 2GHz band and +* Channel 1 - 220 in the 5GHz band +* +* @band: Which band we want the frequency in, could be either +* IEEE80211_24GHZ_BAND or IEEE80211_52GHZ_BAND. +* +* Given an IEEE-802.11 channel number and band returns the respective center +* of frequency in MHz. +*/ +u16 regdomain_ieee2mhz (u16 chan,u8 band); + +void print_regdomain (struct ieee80211_regdomain *); +void print_iso3166_reg_map (void ); + +int get_ieee80211_regname (u32 ,char *); + +int iso3166_to_reg_exists (char *); +int iso3166_to_reg (char *,u32 *); + +int regdomain_build (u32 ,struct ieee80211_regdomain **); +void free_regdomain (struct ieee80211_regdomain *); +u32 ieee80211_mode_modulation (u8 mode); + +#endif /* _IEEE80211_REGDOMAIN_H_ */
net/wireless/Kconfig +16 -0
@@ -14,6 +14,22 @@ config NL80211 If unsure, say Y. +config IEEE80211_REGDOMAINS + tristate "Central IEEE 802.11 regulatory domain agent" + select ISO3166_1 + ---help--- + This option enables the a regdomains part of the central + regulatory domain agent for the kernel. If added as a module + the module will be called regdomains.ko. + + If unsure, you can safely say Y. + +config IEEE80211_REGDOMAINS_DBG + bool "Enables debugging output for the regulatory domain agent" + depends on IEEE80211_REGDOMAINS + ---help--- + This option enables debug for the central regulatory domain agent + config ISO3166_1 tristate "ISO 3166-1 support (for 802.11d and regulatory)" ---help---
net/wireless/Makefile +1 -0
@@ -4,4 +4,5 @@ obj-$(CONFIG_CFG80211) += cfg80211.o cfg80211-y += core.o sysfs.o radiotap.o cfg80211-$(CONFIG_NL80211) += nl80211.o +obj-$(CONFIG_IEEE80211_REGDOMAINS) += regdomains.o obj-$(CONFIG_ISO3166_1) += iso3166-1.o
net/wireless/reg_common.h new file +138 -0
138 lines not on this page · raw message
net/wireless/regdomains.c new file +751 -0
751 lines not on this page · raw message
net/wireless/regulatory_map.h new file +887 -0
887 lines not on this page · raw message
Signature · 1 line
1.5.2.4
PATCH 4/5 Wireless: Add regdomain support to cfg80211
In reply to Luis R. RodriguezThis patch makes cfg80211 provide an interface for defining a central regulatory domain all cfg80211 wireless drivers should adhere to.
Now when cfg80211 starts up and you will see this:
ieee80211_regdomains: regulatory domain WORLD created
Regulatory Domain: WORLD Regulatory Domain ID: 0x03
IEEE 802.11g 2GHz ISM subband
max_ir_ptmp: 20 dBm max_eirp_ptmp: 20 dBm
max_ir_ptp: 0 dBm max_eirp_ptp: 0 dBm
max_antenna_gain: 6 dBi
Environment capability: Indoor & Outdoor
Channel Freq (MHz)
5 2432
6 2437
7 2442--- include/net/cfg80211.h | 72 ++++++++++++++++++++++++++ net/wireless/Kconfig | 1 + net/wireless/core.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+), 0 deletions(-)
include/net/cfg80211.h +72 -0
@@ -5,11 +5,13 @@#include <linux/skbuff.h> #include <linux/nl80211.h> #include <net/genetlink.h> +#include <net/ieee80211_regdomains.h> /* * 802.11 configuration in-kernel interface * * Copyright 2006 Johannes Berg <[email protected]> +* Copyright 2007 Luis R. Rodriguez <[email protected]> */ /**
@@ -117,6 +119,73 @@ extern int ieee80211_radiotap_iterator_next(struct wiphy ;/** +* enum regdom_set_by - the different ways by which the central regulatory +* domain can be set +* +* @REG_SET_BY_INIT: indicates regdomain was set by regdomain_init() +* @REG_SET_BY_DRIVER: indicates regdomain was set by a driver +* through cfg80211_set_regdomain(). This type of settings is ignored if +* the regdomain was already set by userspace (%REG_SET_BY_USER). If +* userspace never set the regdomain and two drivers are found trying to +* set the regdomain to two different regdomains then the world regulatory +* domain will be set by cfg80211_set_regdomain(). +* @REG_SET_BY_USER: indicates regdomain was set by userspace. +* @REG_SET_BY_80211D: indicates an 802.11d frame was received with a valid +* country information element to which the wireless stack is going to +* adhere to. +* @REG_SET_BY_CONFLICT: indicates a conflict was found and regdomain was +* therefore set to the world regulatory domain by +* cfg80211_set_regdomain(). +*/ +enum regdom_set_by { +REG_SET_BY_INIT =1 , +REG_SET_BY_DRIVER , +REG_SET_BY_USER , +REG_SET_BY_80211D , +REG_SET_BY_CONFLICT +}; + +/** +* struct cfg80211_regdomain_settings - central regulatory domain settings +* +* @regdomain: central regulatory domain, an &ieee80211_regdomain +* +* @country: country to which this regulatory domain corresponds in the +* last setting. This must be a valid ISO3166-1 country or one of the +* accepted exceptions, such as 00 for the world regulatory domain or +* UK for the United Kingdom. +* +* @set_by: tells us who set last the regualtory domain. This can be any of +* %regdom_set_by +* +* @wiphy: wiphy of driver who last set the regdomain, if set by +* driver. This used to determine conflicts of driver regulatory domains +* settings if more than one wirless card is present and to simply keep +* record if a driver set the regulatory domain which driver set it. +* +* This structure defines the cfg80211 central wireless regulatory domain +* structure which all cfg80211 drivers should adhere to. It is initialized to +* the world regulatory domain by cfg80211 by default (%REG_SET_BY_INIT). If a +* wireless driver present has a built-in regulatory domain set either in the +* EEPROM or firmware it can inform cfg80211 about this and change the +* regulatory domain as such (%REG_SET_BY_DRIVER). If a second wireless card +* is present and if there is a conflict between regulatory domains then the +* world regulatory domain is set (%REG_SET_BY_CONFLICT). The regulatory domain +* can also be changed by receiving an 802.11d frame with a valid country code +* (%REG_SET_BY_80211D). Finally, If the regulatory domain was set by userspace +* (%REG_SET_BY_USER) then driver specific setting of regulatory domains +* (%REG_SET_BY_DRIVER) and 802.11d frames for changing the regulatory domain +* (%REG_SET_BY_80211D) will be ignored. +*/ +struct cfg80211_regdomain_settings { +struct ieee80211_regdomain *regdomain; +enum regdom_set_by set_by; +struct wiphy *wiphy; +char country[ISOCOUNTRYSIZ2 ]; +}; + + +/** * struct cfg80211_ops - backend description for wireless configuration * * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -183,6 +252,9 @@ struct cfg80211_ops { struct key_params *params); }; +extern int cfg80211_set_regdomain (char *country,u32 , +enum regdom_set_by set_by, +struct wiphy *wiphy_reg_set);/* helper functions specific to nl80211 */ extern void *nl80211hdr_put(struct sk_buff *skb, u32 pid,
net/wireless/Kconfig +1 -0
@@ -1,5 +1,6 @@ config CFG80211 tristate "Improved wireless configuration API" + select IEEE80211_REGDOMAINS config NL80211 bool "nl80211 new netlink interface support"
net/wireless/core.c +133 -0
163 lines not on this page · raw message
Signature · 1 line
1.5.2.4
PATCH 5/5 Wireless: add wireless configfs module
In reply to Luis R. RodriguezThis patch adds a wireless configfs module. Currently we only add support for changing the central regulatory domain. The idea is not to replace nl80211 interface but to supplement it and also to give home for a place for configuring wireless kobjects. We can move add_interface / remove_interface from sysfs to configfs, for example.
Example usage of using wireles configfs:
mkdir /config/
modprobe configfs_wireless
mount -t configfs none /config
echo US > /config/wireless/country
dmesg -c
You will see:
Userspace changed regulatory domainieee80211_regdomains: regulatory domain FCC1A created
Regulatory Domain: FCC1A Regulatory Domain ID: 0x10
IEEE 802.11g 2GHz ISM subband
max_ir_ptmp: 30 dBm max_ir_ptp: 30 dBm
max_eirp_ptmp: 36 dBm max_eirp_ptp: 255 dBm
max_antenna_gain: 6 dBi
Environment capability: Indoor & Outdoor
Channel Freq (MHz)
1 2412
2 2417
3 2422
4 2427
5 2432
6 2437
7 2442
8 2447
9 2452
10 2457
11 2462
---
net/wireless/Kconfig | 11 +++++++++++
net/wireless/Makefile | 1 +
2 files changed, 12 insertions(+), 0 deletions(-)net/wireless/Kconfig +11 -0
@@ -15,6 +15,17 @@ config NL80211 If unsure, say Y. +config CONFIGFS_WIRELESS + depends CFG80211 && IEEE80211_REGDOMAINS + tristate "Configfs interface for configuring central wireless settings" + ---help--- + You can configure central wireless settings through this subsystem. + It currently only has an ISO3166-1 alpha2 country regulatory domain + settings used to define frequency and power regulatory restrictions + for all wireless cards. + + If unsure, you can safely say Y. + config IEEE80211_REGDOMAINS tristate "Central IEEE 802.11 regulatory domain agent" select ISO3166_1
net/wireless/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_WIRELESS_EXT) += wext.o obj-$(CONFIG_CFG80211) += cfg80211.o +obj-$(CONFIG_CONFIGFS_WIRELESS) += configfs_wireless.o cfg80211-y += core.o sysfs.o radiotap.o cfg80211-$(CONFIG_NL80211) += nl80211.o
Signature · 1 line
1.5.2.4
Johannes Berg
maintainerRe: [PATCH 1/5] Move standard wireless defintions out of mac80211
In reply to Luis R. RodriguezOn Fri, 2007-09-21 at 17:00 -0400, Luis R. Rodriguez wrote:
Ok one thing up front: I'm looking at this basically as "new code", iow something we should do right from the start. mac80211 stuff is a mess, so imho we should clean it up at this point when we break things anyway.
Quoted 2 lines
+ * @IEEE80211_CHAN_W_SCAN: if this flag is set it informs the lower layer that
+ * this channel can be passively scanned for.
Are there really channels that don't have _SCAN?
Quoted 7 lines
+/**
+ *ieee80211_channel- internal structure definiton for an IEEE-802.11 channel
+ *
+ * This defines anieee80211_channel. The IEEE-802.11 regulatory domain agent
+ * is in charge of filling most of these fields out. The low-level driver
+ * is expected to fill in, if needed, the val field. Note that val is already
+ * set by the regulatory agent to the same channel as in chan.
Shouldn't you also set chan and freq in the driver?
Quoted 1 line
+ * @modulation_cap: could be IEEE80211_RATE_*
Could be?
Quoted 1 line
+ * @list: lets you make this structure part of a linked list
What do we need this for?
include/net/wireless_common.h line 55
Quoted 3 lines
include/net/wireless_common.h new file +3
-0+struct ieee80211_channel { +/* XXX change to u8 */ +short chan;
Not sure, is a u8 always enough? I thought 802.11a had huge channel numbers?
Quoted 1 line
+/* XXX consider removing the holes bellow */
I think these flags are shared with hostapd right now... :(
Quoted 5 lines
+/**
+ * enumrate_flags- internal&ieee80211_rateflags+ * Use these flags to indicate to the lower layers details about an
+ *&ieee80211_rate.
^ struct ieee80211_rate, for kernel-doc
Quoted 5 lines
+ * @IEEE80211_RATE_ERP: indicates if the rate is an Extended Rate PHY (ERP)
+ * @IEEE80211_RATE_BASIC: indicates the rate is a basic rate for the
+ * currently used mode
+ * @IEEE80211_RATE_PREAMBLE2: used to indicates that the rate for short
+ * preamble is to be used. This is set in &ieee80211_rate's @val2.
Couldn't we just call it SHORT_PREAMBLE? :)
Quoted 1 line
+ * @IEEE80211_RATE_SUPPORTED: indicates if rate is supported by the given mode
What do we use this for?
Quoted 2 lines
+ * @IEEE80211_RATE_OFDM: indicates support for ODFM modulation
+ * @IEEE80211_RATE_CCK: indicates support for CCK modulation
I think this should be called "this rate is an OFDM/CCK rate"
Quoted 2 lines
+ * @IEEE80211_RATE_MANDATORY: indicates if this rate is mandatory for the
+ * currently used mode
I think this is wrong. Isn't the "mandatory" flag something for an AP to ask it's stations for?
Quoted 2 lines
+/* XXX move to inline and add documenation, kernel-doc can't doc defines */
Why don't you just do that then? :)
Quoted 3 lines
+ * Low-level driver should set PREAMBLE2, OFDM and CCK flags.
+ * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
+ * configuration.
Oh come on. There hasn't been 80211.o for a loong time :)
Quoted 4 lines
+ * @flags: IEEE80211_RATE_* flags
+ * @val2: hw specific value for the rate when using short preamble
+ * (only whenIEEE80211_RATE_PREAMBLE2flag is set, i.e., for
+ * 2, 5.5, and 11 Mbps)
Can't we just get rid of this field? Does anybody use it?
Quoted 2 lines
+ * @min_rssi_ack: Minimum required RSSI of packet to generate an ACK ??
+ * @min_rssi_ack_delta: ??
I thought we didn't use these fields.
include/net/wireless_common.h line 129
Quoted 1 line
include/net/wireless_common.h new file +1
-0+/* the following fields are set by 80211.o and need not be filled by the
80211.o again :)
johannes
PATCH 5/5 Wireless: add wireless configfs module - v2
In reply to Luis R. RodriguezOops, this patch actually adds congifs_wireless.c ;)
This patch adds a wireless configfs module. Currently we only add support for changing the central regulatory domain. The idea is not to replace nl80211 interface but to supplement it and also to give home for a place for configuring wireless kobjects. We can move add_interface / remove_interface from sysfs to configfs, for example.
Example usage of using wireles configfs:
mkdir /config/
modprobe configfs_wireless
mount -t configfs none /config
echo US > /config/wireless/country
dmesg -c
You will see:
Userspace changed regulatory domainieee80211_regdomains: regulatory domain FCC1A created
Regulatory Domain: FCC1A Regulatory Domain ID: 0x10
IEEE 802.11g 2GHz ISM subband
max_ir_ptmp: 30 dBm max_ir_ptp: 30 dBm
max_eirp_ptmp: 36 dBm max_eirp_ptp: 255 dBm
max_antenna_gain: 6 dBi
Environment capability: Indoor & Outdoor
Channel Freq (MHz)
1 2412
2 2417
3 2422
4 2427
5 2432
6 2437
7 2442
8 2447
9 2452
10 2457
11 2462
---
net/wireless/Kconfig | 11 +++++++++++
net/wireless/Makefile | 1 +
2 files changed, 12 insertions(+), 0 deletions(-)net/wireless/Kconfig +11 -0
@@ -15,6 +15,17 @@ config NL80211 If unsure, say Y. +config CONFIGFS_WIRELESS + depends CFG80211 && IEEE80211_REGDOMAINS + tristate "Configfs interface for configuring central wireless settings" + ---help--- + You can configure central wireless settings through this subsystem. + It currently only has an ISO3166-1 alpha2 country regulatory domain + settings used to define frequency and power regulatory restrictions + for all wireless cards. + + If unsure, you can safely say Y. + config IEEE80211_REGDOMAINS tristate "Central IEEE 802.11 regulatory domain agent" select ISO3166_1
net/wireless/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_WIRELESS_EXT) += wext.o obj-$(CONFIG_CFG80211) += cfg80211.o +obj-$(CONFIG_CONFIGFS_WIRELESS) += configfs_wireless.o cfg80211-y += core.o sysfs.o radiotap.o cfg80211-$(CONFIG_NL80211) += nl80211.o
net/wireless/configfs_wireless.c new file +178 -0
178 lines not on this page · raw message
Johannes Berg
maintainerRe: [PATCH 3/5] Wireless: add IEEE-802.11 regualtory domain module
In reply to Luis R. Rodriguezinclude/net/ieee80211_regdomains.h line 36
Quoted 5 lines · Luis R. Rodriguez
include/net/ieee80211_regdomains.h new file +5
-0+/* XXX: <net/ieee80211.h> has two band defs bellow */ +#ifndef IEEE80211_24GHZ_BAND +#define IEEE80211_24GHZ_BAND (1<<0) +#define IEEE80211_52GHZ_BAND (1<<1) +#endif
Hmm. Could we make a new definition with just an enum?
enum ieee80211_band {
IEEE80211_BAND_24GHZ,
IEEE80211_BAND_52GHZ,
};Then we can use "enum ieee80211_band" below in the structs and get type checking. Generally, no new stuff has anything to do with include/net/ieee80211.h, that's just for the old "stack".
Quoted 3 lines
+/**
+ * structieee80211_subband_restrictions- defines a regulatory domain
+ * subband restrictions list
I think the docs should include where this structure is used.
Quoted 1 line
+ * @name: name for this subband.
Why does it need a name?
Quoted 4 lines
+ * @min_freq: minimum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.
+ * @max_freq: maximum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.
How can both be center freq?
Quoted 5 lines
include/net/ieee80211_regdomains.h new file +5
-0+struct ieee80211_subband_restrictions { +u8 band; +char name[REGSBNAMSIZ ]; +u16 min_freq; +u16 max_freq;
include/net/ieee80211_regdomains.h line 108
Quoted 10 lines
include/net/ieee80211_regdomains.h new file +10
-0+u32 modulation_cap; +u8 max_antenna_gain; +u8 max_ir_ptmp; +u8 max_ir_ptp; +#define REG_DIPOLE_ANTENNA_GAIN 2 +u8 max_eirp_ptmp; +u8 max_eirp_ptp; +#define REG_CAP_INDOOR 'I' +#define REG_CAP_OUTDOOR 'O' +#define REG_CAP_INOUT ' '
Did you actually run kernel-doc? it's rather unhappy with such things :)
Quoted 6 lines
+/**
+ * structieee80211_regdomain- defines a regulatory domain
+ *
+ * @regdomain_id: ID of this regulatory domain. Some come from
+ * http://standards.ieee.org/getieee802/download/802.11b-1999_Cor1-2001.pdf
+ * @regdomain_name: name of this regulatory domain.
Quoted 8 lines
+ * @list: node, part of
band_restrictions_list
+ *
+ * This structure defines a regulatory domain, which consists of channel and
+ * power restrictions. Some regulatory domains come from
+ * 802.11b-1999_Cor1-2001, the rest are based on Reyk Floeter's ar5k. If
+ * there is need to add more values here, please add one that is either
+ * defined in a standard or that many hardware devices have adopted. Also
+ * note that multiple countries can map to the same @regdomain_id
There's no table here where you could add values, is there?.
include/net/ieee80211_regdomains.h line 132
Quoted 5 lines
+ */
include/net/ieee80211_regdomains.h new file +4
-0+struct ieee80211_regdomain { +u32 regdomain_id; +char regdomain_name[REGNAMSIZ ]; +struct ieee80211_subband_restrictions subbands[REG_NUM_SUBBANDS ];
Why is that not a variable length array with the number of items given in an extra var?
Quoted 9 lines
+ * This structure holds the mapping of the country to a specific regulatory
+ * domain. Keep in mind more than one country can map to the same regulatory
+ * domain. The ISO-3166-1 alpha2 country code also happens to be used in the
+ * 802.11d Country Information Element on the string for the country. It
+ * should be noted, however, that in that the size of this string, is
+ * three octects while our string is only 2. The third octet is used to
+ * indicate Indoor/outdoor capabilities which we set in
+ * @ieee80211_subband_restrictionsenvironment_cap.
+ */
include/net/ieee80211_regdomains.h line 157
Quoted 6 lines
include/net/ieee80211_regdomains.h new file +6
-0+struct ieee80211_iso3166_reg_map { +char alpha2[ISOCOUNTRYSIZ2 ]; +u32 regdomain_id;/* stack-aware value */ +/* XXX: shall we just use an array? */ +struct list_head list;/* node, part of iso3166_reg_map_list */ +};
Why does this need a list if it's a static mapping? Why does it need to be visible outside of net/wireless/?
include/net/ieee80211_regdomains.h line 168
Quoted 10 lines
include/net/ieee80211_regdomains.h new file +10
-0+/** +* regdomain_mhz2ieee - convert a frequency to an IEEE-80211 channel number +* @freq: center of frequency in MHz. We support a range: +* 2412 - 2732 MHz (Channel 1 - 26) in the 2GHz band and +* 5005 - 6100 MHz (Channel 1 - 220) in the 5GHz band. +* +* Given a frequency in MHz returns the respective IEEE-80211 channel +* number. You are expected to provide the center of freqency in MHz. +*/ +u16 regdomain_mhz2ieee (u16 freq);
Ok this I can see being necessary for drivers/stacks.
Quoted 1 line
+u16
regdomain_ieee2mhz(u16 chan, u8 band);
Same here.
Quoted 1 line
+void
print_regdomain(struct ieee80211_regdomain *);
Ssame.
Quoted 1 line
+void
print_iso3166_reg_map(void);
But why does this need to be exported?
Quoted 1 line
+int
get_ieee80211_regname(u32, char *);
What are the arguments?
Hrm. I need to step back from the actual code.
johannes
Re: [PATCH 1/5] Move standard wireless defintions out of mac80211
In reply to Johannes BergQuoted 5 lines · Johannes Berg
On Fri, 2007-09-21 at 17:00 -0400, Luis R. Rodriguez wrote:
Ok one thing up front: I'm looking at this basically as "new code", iow something we should do right from the start. mac80211 stuff is a mess, so imho we should clean it up at this point when we break things anyway.
ACK. Hence the reason why I separated this into two patch series. The first one allows integration so we can simply hack on it at will. The idea is to clean this up really well for when it goes upstream.
Quoted 4 lines
Quoted 2 lines
+ * @IEEE80211_CHAN_W_SCAN: if this flag is set it informs the lower layer that
+ * this channel can be passively scanned for.Are there really channels that don't have
_SCAN?
Yup, as you will see, for example for Japan regdomains we disable SCAN for 5170, 5190, 5210 and 5230 MHz.
Quoted 9 lines
Quoted 7 lines
+/**
+ *ieee80211_channel- internal structure definiton for an IEEE-802.11 channel
+ *
+ * This defines anieee80211_channel. The IEEE-802.11 regulatory domain agent
+ * is in charge of filling most of these fields out. The low-level driver
+ * is expected to fill in, if needed, the val field. Note that val is already
+ * set by the regulatory agent to the same channel as in chan.Shouldn't you also set chan and freq in the driver?
Sure, later (patch series II) mac80211 util.c will have a routine which can build the array of channels for each mode. The reg agent will just set everything to the most common values most drivers uses, which is to keep using the same channel mapping and the same freq mapping. Drivers will each have their own channel arrays, for example. The central reg agent will just be used by the higher subsystems to enable/disable channels and update power restrictions.
Quoted 3 lines
Quoted 1 line
+ * @modulation_cap: could be IEEE80211_RATE_*
Could be?
We can define our own if we can't borrow those.
Quoted 3 lines
Quoted 1 line
+ * @list: lets you make this structure part of a linked list
What do we need this for?
Initially I wanted to move mac80211 to use a linked list of channels instead of an array for each mode. As we discussed it over (you, me and a few others) we determined it wasn't best to do this (I have a patch that allows this just in case we later change our mind). But -- previous to doing this I had a wrapper on ieee80211_channel as I wanted the central regdomain to have a linked list of reg domain channels. If we don't want a wrapper we have to add this to the ieee8021_channel struct. Otherwise I need to define my own channel struct which wraps around ieee80211_channel.
Quoted 6 lines
include/net/wireless_common.h line 55
Quoted 3 lines
include/net/wireless_common.h new file +3
-0+struct ieee80211_channel { +/* XXX change to u8 */ +short chan;Not sure, is a u8 always enough? I thought 802.11a had huge channel numbers?
Not that huge :-) Highest I've heard is 220. u8 should suffice.
Quoted 3 lines
Quoted 1 line
+/* XXX consider removing the holes bellow */
I think these flags are shared with hostapd right now... :(
Then more reasons to move this out of mac80211 and later consolidate into one place. That is the idea with this move. To start this.
Quoted 7 lines
Quoted 5 lines
+/**
+ * enumrate_flags- internal&ieee80211_rateflags+ * Use these flags to indicate to the lower layers details about an
+ *&ieee80211_rate.^ struct
ieee80211_rate, for kernel-doc
Quoted 7 lines
Quoted 5 lines
+ * @IEEE80211_RATE_ERP: indicates if the rate is an Extended Rate PHY (ERP)
+ * @IEEE80211_RATE_BASIC: indicates the rate is a basic rate for the
+ * currently used mode
+ * @IEEE80211_RATE_PREAMBLE2: used to indicates that the rate for short
+ * preamble is to be used. This is set in &ieee80211_rate's @val2.Couldn't we just call it
SHORT_PREAMBLE? :)
Sure, I just went with what was on mac80211. If this is added to everything branch we can then clean it up as a subsequent patch.
Quoted 8 lines
Quoted 1 line
+ * @IEEE80211_RATE_SUPPORTED: indicates if rate is supported by the given mode
What do we use this for?
Quoted 2 lines
+ * @IEEE80211_RATE_OFDM: indicates support for ODFM modulation
+ * @IEEE80211_RATE_CCK: indicates support for CCK modulationI think this should be called "this rate is an OFDM/CCK rate"
Sure, good point.
Quoted 5 lines
Quoted 2 lines
+ * @IEEE80211_RATE_MANDATORY: indicates if this rate is mandatory for the
+ * currently used modeI think this is wrong. Isn't the "mandatory" flag something for an AP to ask it's stations for?
I'm not too sure, if so this can be fixed by a following patch.
Quoted 4 lines
Quoted 2 lines
+/* XXX move to inline and add documenation, kernel-doc can't doc defines */
Why don't you just do that then? :)
Hehe, I was, but I got tired of hogging this code up, and wanted to post it for more review. A quick patch can fix this too ;)
Quoted 5 lines
Quoted 3 lines
+ * Low-level driver should set PREAMBLE2, OFDM and CCK flags.
+ * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
+ * configuration.Oh come on. There hasn't been 80211.o for a loong time :)
Sorry, I moved docs from mac80211, I should have caught that :-P
Quoted 6 lines
Quoted 4 lines
+ * @flags: IEEE80211_RATE_* flags
+ * @val2: hw specific value for the rate when using short preamble
+ * (only whenIEEE80211_RATE_PREAMBLE2flag is set, i.e., for
+ * 2, 5.5, and 11 Mbps)Can't we just get rid of this field? Does anybody use it?
Not too sure. Anyone?
Quoted 4 lines
Quoted 2 lines
+ * @min_rssi_ack: Minimum required RSSI of packet to generate an ACK ??
+ * @min_rssi_ack_delta: ??I thought we didn't use these fields.
Oops.. that was supposed to be removed, yes.
Quoted 3 lines
Quoted 1 line
+ /* the following fields are set by 80211.o and need not be filled by the
80211.o again :)
Oopsy :-)
Luis
Quoted 8 lines · Luis R. Rodriguez
Patchset I - Add central regulatory domain agent
This is patchset I of II which adds a central regulatory domain agent onto the wireless subsystem. I've split it into two patchsets in order to introduce the agent before affecting mac80211 drivers. This allows work to continue on the central reg agent independant of mac80211 advancements.
Quoted 6 lines
Patch series I adds the central regulatory domain agent and integrates it with cfg80211. The central reg agent consists of 2 main modules:
* ISO3166-1
* Regdomains
Also, if you could make sure this stuff is completely separate conceptually and architecturally from mac80211 itself, but have mac80211 _rely_ on it, then we can rip the bits out of the fullmac drivers that do regdomain stuff and plug them into this framework too. I think that's a real win. There's not a pile of code in the fullmac drivers for this, but there's enough that it sucks having to have these defines all over the place.
Also having somewhere that has standard functions that map channels to frequencies and back would rock (if you do, please use u32 here for frequencies not floats of course, like 2412000 and such unless you think u64 would work better to specify down to the single Hz level).
Dan
Quoted 10 lines
Additionally, changing regulatory domains can be acomplished through the use of a new configfs module which will be introduced for the wireless subsystem.
Patch series II will add support for the centreal reglatory agent onto mac80211, remove mac80211's simple regulatory control and and replace each driver's own regulatory domain implementation with the central one.
Luis
Johannes Berg
maintainerQuoted 5 lines · Dan Williams
Also, if you could make sure this stuff is completely separate conceptually and architecturally from mac80211 itself, but have mac80211 _rely_ on it, then we can rip the bits out of the fullmac drivers that do regdomain stuff and plug them into this framework too. I think that's a real win.
Yeah, I think that's the plan. In fact, I always consider mac80211 to be on the the same level like fullmac _drivers_ and mac80211-based drivers somewhere below that (at a level that with fullmac drivers doesn't exist)
johannes
Re: [PATCH 3/5] Wireless: add IEEE-802.11 regualtory domain module
In reply to Johannes BergQuoted 10 lines · Johannes Berg
include/net/ieee80211_regdomains.h line 36
Quoted 5 lines · Luis R. Rodriguez
include/net/ieee80211_regdomains.h new file +5
-0+/* XXX: <net/ieee80211.h> has two band defs bellow */ +#ifndef IEEE80211_24GHZ_BAND +#define IEEE80211_24GHZ_BAND (1<<0) +#define IEEE80211_52GHZ_BAND (1<<1) +#endif Hmm. Could we make a new definition with just an enum?
Quoted 8 lines
enum ieee80211_band { IEEE80211_BAND_24GHZ, IEEE80211_BAND_52GHZ, };Then we can use "enum
ieee80211_band" below in the structs and get type checking. Generally, no new stuff has anything to do withinclude/net/ieee80211.h, that's just for the old "stack".
Sure, I just wanted to point out the band def existed in another header. My hopes is we can address all common header stuff once in for all. I guess it'll have to wait a bit more.
Quoted 5 lines
Quoted 3 lines
+/**
+ * structieee80211_subband_restrictions- defines a regulatory domain
+ * subband restrictions listI think the docs should include where this structure is used.
Point taken.
Quoted 3 lines
Quoted 1 line
+ * @name: name for this subband.
Why does it need a name?
Well to distinguish it.
Quoted 6 lines
Quoted 4 lines
+ * @min_freq: minimum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.
+ * @max_freq: maximum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.How can both be center freq?
min_freq is the center of frequency for the minimum channel on the subband. max_freq is the center of frequency for the max channel on the subband. I guess I should clear that up a little more huh.
Quoted 9 lines
Quoted 9 lines
include/net/ieee80211_regdomains.h new file +9
-0+struct ieee80211_subband_restrictions { +u8 band; +char name[REGSBNAMSIZ ]; +u16 min_freq; +u16 max_freq; +u32 modulation_cap; +u8 max_antenna_gain; +u8 max_ir_ptmp; +u8 max_ir_ptp;
Quoted 8 lines
include/net/ieee80211_regdomains.h line 108
Quoted 6 lines
include/net/ieee80211_regdomains.h new file +6
-0+#define REG_DIPOLE_ANTENNA_GAIN 2 +u8 max_eirp_ptmp; +u8 max_eirp_ptp; +#define REG_CAP_INDOOR 'I' +#define REG_CAP_OUTDOOR 'O' +#define REG_CAP_INOUT ' 'Did you actually run kernel-doc? it's rather unhappy with such things :)
Nope, sorry.
Quoted 15 lines
Quoted 6 lines
+/**
+ * structieee80211_regdomain- defines a regulatory domain
+ *
+ * @regdomain_id: ID of this regulatory domain. Some come from
+ * http://standards.ieee.org/getieee802/download/802.11b-1999_Cor1-2001.pdf
+ * @regdomain_name: name of this regulatory domain.Quoted 8 lines
+ * @list: node, part of
band_restrictions_list
+ *
+ * This structure defines a regulatory domain, which consists of channel and
+ * power restrictions. Some regulatory domains come from
+ * 802.11b-1999_Cor1-2001, the rest are based on Reyk Floeter's ar5k. If
+ * there is need to add more values here, please add one that is either
+ * defined in a standard or that many hardware devices have adopted. Also
+ * note that multiple countries can map to the same @regdomain_id
Quoted 1 line
There's no table here where you could add values, is there?.
There is a lot of them.. but we can add few to show as an example.
Quoted 8 lines
include/net/ieee80211_regdomains.h line 132
Quoted 5 lines
+ */
include/net/ieee80211_regdomains.h new file +4
-0+struct ieee80211_regdomain { +u32 regdomain_id; +char regdomain_name[REGNAMSIZ ]; +struct ieee80211_subband_restrictions subbands[REG_NUM_SUBBANDS ];Why is that not a variable length array with the number of items given in an extra var?
I should have explained that too. Well, if you may recall in my last implementation of this I actually used a linked list. I then decided we weren't going to add new 2.4GHz or 5GHz subbands unless a big IEEE-802.11 change occurs. That doesn't happen so often to either use linked list or a variable length array.
Quoted 10 lines
Quoted 10 lines
+ * This structure holds the mapping of the country to a specific regulatory
+ * domain. Keep in mind more than one country can map to the same regulatory
+ * domain. The ISO-3166-1 alpha2 country code also happens to be used in the
+ * 802.11d Country Information Element on the string for the country. It
+ * should be noted, however, that in that the size of this string, is
+ * three octects while our string is only 2. The third octet is used to
+ * indicate Indoor/outdoor capabilities which we set in
+ * @ieee80211_subband_restrictionsenvironment_cap.
+ */
+structieee80211_iso3166_reg_map{
Quoted 8 lines
include/net/ieee80211_regdomains.h line 157
Quoted 5 lines
include/net/ieee80211_regdomains.h new file +5
-0+char alpha2[ISOCOUNTRYSIZ2 ]; +u32 regdomain_id;/* stack-aware value */ +/* XXX: shall we just use an array? */ +struct list_head list;/* node, part of iso3166_reg_map_list */ +};Why does this need a list if it's a static mapping? Why does it need to be visible outside of
net/wireless/?
As you can notice I also considered this. This *should* only change in case of an ISO-3166 change or a new regulatory agency rule enforcement change. Neither of which are really that common, I think so you're right, we can leave this static.
Quoted 17 lines
include/net/ieee80211_regdomains.h line 168
Quoted 10 lines
include/net/ieee80211_regdomains.h new file +10
-0+/** +* regdomain_mhz2ieee - convert a frequency to an IEEE-80211 channel number +* @freq: center of frequency in MHz. We support a range: +* 2412 - 2732 MHz (Channel 1 - 26) in the 2GHz band and +* 5005 - 6100 MHz (Channel 1 - 220) in the 5GHz band. +* +* Given a frequency in MHz returns the respective IEEE-80211 channel +* number. You are expected to provide the center of freqency in MHz. +*/ +u16 regdomain_mhz2ieee (u16 freq);Ok this I can see being necessary for
drivers/stacks.Quoted 1 line
+u16
regdomain_ieee2mhz(u16 chan, u8 band);Same here.
Quoted 7 lines
Quoted 1 line
+void
print_regdomain(struct ieee80211_regdomain *);Ssame.
Quoted 1 line
+void
print_iso3166_reg_map(void);But why does this need to be exported?
Point taken.
Quoted 3 lines
Quoted 1 line
+int
get_ieee80211_regname(u32, char *);What are the arguments?
This can be removed.
Luis
Johannes Berg
maintainerRe: [PATCH 3/5] Wireless: add IEEE-802.11 regualtory domain module
Quoted 7 lines · Luis R. Rodriguez
Quoted 3 lines
Then we can use "enum
ieee80211_band" below in the structs and get type checking. Generally, no new stuff has anything to do withinclude/net/ieee80211.h, that's just for the old "stack".Sure, I just wanted to point out the band def existed in another header. My hopes is we can address all common header stuff once in for all. I guess it'll have to wait a bit more.
Oh ok. But I think we should start using sane values (these bits look awfully like you could OR them which is totally bogus) and convert the other stack over.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+ * @name: name for this subband.
Why does it need a name?
Well to distinguish it.
But why do we need to distinguish subbands by name? What do we use them for anyway?
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
+ * @min_freq: minimum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.
+ * @max_freq: maximum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.How can both be center freq?
min_freqis the center of frequency for the minimum channel on the subband.max_freqis the center of frequency for the max channel on the subband. I guess I should clear that up a little more huh.
Uh ok, no, I just need to read better :)
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
+/**
+ * structieee80211_regdomain- defines a regulatory domain
+ *
+ * @regdomain_id: ID of this regulatory domain. Some come from
+ * http://standards.ieee.org/getieee802/download/802.11b-1999_Cor1-2001.pdf
+ * @regdomain_name: name of this regulatory domain.
+ * @list: node, part ofband_restrictions_list
+ *
+ * This structure defines a regulatory domain, which consists of channel and
+ * power restrictions. Some regulatory domains come from
+ * 802.11b-1999_Cor1-2001, the rest are based on Reyk Floeter's ar5k. If
+ * there is need to add more values here, please add one that is either
+ * defined in a standard or that many hardware devices have adopted. Also
+ * note that multiple countries can map to the same @regdomain_id
Quoted 3 lines
Quoted 1 line
There's no table here where you could add values, is there?.
There is a lot of them.. but we can add few to show as an example.
Then again. Why do we have this struct in a header file?
Quoted 5 lines
I should have explained that too. Well, if you may recall in my last implementation of this I actually used a linked list. I then decided we weren't going to add new 2.4GHz or 5GHz subbands unless a big IEEE-802.11 change occurs. That doesn't happen so often to either use linked list or a variable length array.
Ok I just don't understand why you have this information in a struct. Shouldn't all of this information be essentially internal to the regulatory code, and people who use it simply query it and get back a pointer to the subband that applies to their query? I don't see why everybody needs to see this huge array.
johannes
Quoted 8 lines · Johannes Berg
Quoted 5 lines · Dan Williams
Also, if you could make sure this stuff is completely separate conceptually and architecturally from mac80211 itself, but have mac80211 _rely_ on it, then we can rip the bits out of the fullmac drivers that do regdomain stuff and plug them into this framework too. I think that's a real win.
Quoted 4 lines
Yeah, I think that's the plan. In fact, I always consider mac80211 to be on the the same level like fullmac _drivers_ and mac80211-based drivers somewhere below that (at a level that with fullmac drivers doesn't exist)
Correct, the only way this touches mac80211 is ripping common wireless stuff out from it and putting it into a wireless_common.h. other than that all of this so far is 100% independent of mac80211.
In fact, you can apply each patch, one by one, and compile the kernel and all modules and you should have no issues independently. However each subsequent patch depends on the previous patch. The idea with this was to try to get this regulatory work into the 'everything' wireless-dev branch so we can address any small issues before we start hacking away on mac80211 and its drivers.
At first I wanted to send all of the patches together but this was just taking too long... My hope now was to speed the development process up by separating the required work into two patches series.
Luis
Re: [PATCH 3/5] Wireless: add IEEE-802.11 regualtory domain module
In reply to Johannes BergQuoted 6 lines · Johannes Berg
Quoted 4 lines · Luis R. Rodriguez
Quoted 3 lines
Then we can use "enum
ieee80211_band" below in the structs and get type checking. Generally, no new stuff has anything to do withinclude/net/ieee80211.h, that's just for the old "stack".
Quoted 7 lines
Quoted 3 lines
Sure, I just wanted to point out the band def existed in another header. My hopes is we can address all common header stuff once in for all. I guess it'll have to wait a bit more.
Oh ok. But I think we should start using sane values (these bits look awfully like you could OR them which is totally bogus) and convert the other stack over.
ACK -- we can define any value we want into this. Point taken though.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+ * @name: name for this subband.
Why does it need a name?
Well to distinguish it.
But why do we need to distinguish subbands by name? What do we use them for anyway?
We use it in:
u16 regdomain_ieee2mhz(u16 chan, u8 band)
freq_band_id() returns it
print_regdomain() uses it to distinguish the band the subband is in.
static int __alloc_band_channels(u32 regdomain_id,
struct ieee80211_regdomain *reg, u8 band, u32 sb_chan_domain)
uses it internally to determine from what what regmap array it should use to build channels from. That is, it either uses reg_2ghz_channels or reg_5ghz_channels.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
+ * @min_freq: minimum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.
+ * @max_freq: maximum frequency for this subband, in MHz. This represents the
+ * center of frequency of a channel.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
How can both be center freq?
min_freqis the center of frequency for the minimum channel on the subband.max_freqis the center of frequency for the max channel on the subband. I guess I should clear that up a little more huh.Uh ok, no, I just need to read better :)
:-P
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
+/**
+ * structieee80211_regdomain- defines a regulatory domain
+ *
+ * @regdomain_id: ID of this regulatory domain. Some come from
+ * http://standards.ieee.org/getieee802/download/802.11b-1999_Cor1-2001.pdf
+ * @regdomain_name: name of this regulatory domain.
+ * @list: node, part ofband_restrictions_list
+ *
+ * This structure defines a regulatory domain, which consists of channel and
+ * power restrictions. Some regulatory domains come from
+ * 802.11b-1999_Cor1-2001, the rest are based on Reyk Floeter's ar5k. If
+ * there is need to add more values here, please add one that is either
+ * defined in a standard or that many hardware devices have adopted. Also
+ * note that multiple countries can map to the same @regdomain_id
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
There's no table here where you could add values, is there?.
There is a lot of them.. but we can add few to show as an example.
Then again. Why do we have this struct in a header file?
cfg80211 uses it. This is how we create a central regulatory domain. cfg80211 creates its own struct based on this.
Quoted 10 lines
Quoted 5 lines
I should have explained that too. Well, if you may recall in my last implementation of this I actually used a linked list. I then decided we weren't going to add new 2.4GHz or 5GHz subbands unless a big IEEE-802.11 change occurs. That doesn't happen so often to either use linked list or a variable length array.
Ok I just don't understand why you have this information in a struct. Shouldn't all of this information be essentially internal to the regulatory code, and people who use it simply query it and get back a pointer to the subband that applies to their query?
In order to build things and make things concretely. cfg80211 will have a ieee80211_regdomain, but well this ieee80211_regdomain has some structs we might as well define to make it easier to build from a map.
Quoted 2 lines
I don't see why
everybody needs to see this huge array.
Well you are welcome to provide an alternative solution. I first started with a linked list, but then that seemed silly as this remains constant.. so I think a static array of subbands is easier. Hmm, I think I had even tried a variable length array too..
Luis
As Johill pointed out to me, these patches are signed and therefore can't be applied, if you want to give them a run, you can wget them from here:
http://www.kernel.org/pub/linux/kernel/people/mcgrof/v2-regdomain-patches/
Luis
Quoted 1 line · Luis R. Rodriguez
http://www.kernel.org/pub/linux/kernel/people/mcgrof/v2-regdomain-pat=
ches/
Oh and bellow inline is the Documenation/networking/regdomains.txt I have so far.. its not much but its a start:
Luis
---
Linux central regulatory domain agent
-------------------------------------
The central reg agent consists of two main parts:
* ISO3166-1 module (iso3166-1.ko)
* Regulatory module (regdomains.ko)
Integration with the kernel wireless subsystem is done by extending cfg= 80211
to support a central regulatory domain to which all devices should adhe= re to.
Then, mac80211 is expanded to allow devices to indicate their deivice i= s
configured to a specific regulatory domain domain, set set either in it= s EEPROM
or firmware. Helper routines are also provided for mac80211 to build th= e=20ieee80211_channel array of hardware supported channels.
After a regulatory domain is set all cfg80211 devices are scanned for a= nd
their channels are iterated over, only channels which the regulatory do= main
indicates are valid for its current regulatory domain are enabled. Powe= r
restriction for PtP and PtMP type of connections are also considered=20 and set.
Each country can be mapped to one regulatory domain. Each regulatory do= main=20
has two maps for channels, one on the 2.4GHz band and another on the 5G= Hz band.
Power restrictions are a little more complicated -- we break both the 2= GHz band
and the 5GHz band into 7 logical subbands as follows:
Subband name Min (MHz) Max (MHz) IEEE-802.11 Channel range
ISM-2.4 2412 2732 1-26
Telec 5005 5145 1-29
UNII-1 5150 5245 30-49
UNII-2 5250 5350 50-70
ETSI 5355 5720 71-144
UNII-3 5725 5825 145-165
AAD 5830 6100 166-220
Note that ETSI also operates on UNII-2, we split this into logical name= s just
to be pragmatic. Then for each subband we define specific power restric= tions.
The current regualtory map is found in regulatory_map.h A userspace dae= mon can
later be provided to update the regulatory map. At the very least the k= ernel
should have the world regulatory domain but note that due to large amou= nt of
varied restrictions this means only enabling 3 channels on the 2GHz ban= d=20
(5, 6 and 7) and no channels on the 5GHz band with minimal PtMP power restrictions.
=46or further implementation details please refer kerneldoc of iso3166-= 1,=20
regdomains, cfg80211, and mac80211.=20
---
Wireles regulatory primer:
PtMP - Point to Multipoint
PtP - Point to Point
EIRP - Equivalent Isotropically Radiated Power
IR - Intentional Radiator, transmitter
dBm - dB milliwatt (mW), the base says that 1mW =3D 0 dBm
dBi - dB relative to isotropic, used to measure antenna gain compared t=
o an
isotropic antenna on which radiation is distributed uniformly on the surface of a sphere=20
EIRP =3D IR - loss in transmission line + passive gain of the antenna
---
Some information based on:=20
http://university.cyberarmy.net/kb/tiki-index.php?page=3DThe+Power+of+8=
02.11
Bellow is an example for FCC.
In the 2.4Ghz ISM band the FCC stipulates that the creation of PtMP=20 links be subject to the following restrictions:
- EIRP must not exceed 36 dBm (4W)
- IR must not exceed 30 dBm (1W)
- For every 3 dBi of antenna gain after the first 6 =E2=80=9Cfree=E2=80= =9D dBi the IR must=20
be decreased by 3 dBi (the 1:1 rule)
Example (without considering loss) of possible settings if Max EIRP is=20 defined as 36 dBm and we are using the 1:1 rule:
TX power (dBm) Antenna Gain (dBi) Max EIRP (dBm)
30-------------------6----------------------36
29-------------------7----------------------36
28-------------------8----------------------36
27-------------------9----------------------36=20
=46or PtP links that rule is augmented:
- No Maximum EIRP
- IR is limited to 30 dBm (1W)
- For every 3 dBi after the first 6 of antenna gain the IR must be=20 decreased by 1 dBi (the 3:1 rule)
Example, where IR limit is 30, and has the 3:1 rule above for gain:
TX power (dBm) Antenna Gain (dBi) Effective EIRP (dBm)
29-------------------6-----------------------35 30-------------------6-----------------------36 29-------------------9-----------------------38 28-------------------12----------------------40 27-------------------15----------------------42 26-------------------18----------------------44 25-------------------21----------------------46=20
In the 5GHz band the FCC stipulates for PtMP:
- UNII-1: Maximum IR power may not exceed 40mW (16dBm)
- UNII-1: EIRP may not exceed 160mW (22dBm)
- UNII-2: Maximum IR power may not exceed 200mW (23dBm)
- UNII-2: EIRP may not exceed 800mW (29dBm)
- UNII-3: Maximum IR power may not exceed 800mW (29dBm)
- UNII-3: EIRP may not exceed 3.2W (35dBm)
- All three bands utilize the 1:1 rule
=46or PtP:
- UNII-1 Follows the same rules as the PtMP links
- UNII-2 Follows the same rules as the PtMP links
- UNII-3 May use an antenna with up to 23dBi of gain before the 1:1 rul= e=20
becomes effective. (Giving a maximum EIRP of 200W!!)
-
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/5] Move standard wireless defintions out of mac80211
In reply to Luis R. RodriguezQuoted 8 lines · Luis R. Rodriguez
Quoted 8 lines
Quoted 6 lines
+ *
ieee80211_channel- internal structure definiton for an IEEE-802.11 channel
+ *
+ * This defines anieee80211_channel. The IEEE-802.11 regulatory domain agent
+ * is in charge of filling most of these fields out. The low-level driver
+ * is expected to fill in, if needed, the val field. Note that val is already
+ * set by the regulatory agent to the same channel as in chan.Shouldn't you also set chan and freq in the driver?
[...]
Quoted 10 lines
Initially I wanted to move mac80211 to use a linked list of channels instead of an array for each mode. As we discussed it over (you, me and a few others) we determined it wasn't best to do this (I have a patch that allows this just in case we later change our mind). But -- previous to doing this I had a wrapper on
ieee80211_channelas I wanted the central regdomain to have a linked list of reg domain channels. If we don't want a wrapper we have to add this to theieee8021_channelstruct. Otherwise I need to define my own channel struct which wraps aroundieee80211_channel.
Quoted 8 lines
Quoted 6 lines
include/net/wireless_common.h line 55
Quoted 3 lines
include/net/wireless_common.h new file +3
-0+struct ieee80211_channel { +/* XXX change to u8 */ +short chan;Not sure, is a u8 always enough? I thought 802.11a had huge channel numbers?
Not that huge :-) Highest I've heard is 220. u8 should suffice.
What's the idea of working with channels? Channels are non-uniq numbers. Internally everything should work with center frequency and not with channels. If necessary, information should be converted from channels by the driver when reporting it into the stack. That way there also won't be any problems if there ever is a channel 417.
ciao
Joerg
Re: [PATCH 1/5] Move standard wireless defintions out of mac80211
Quoted 27 lines · Joerg Mayer
Quoted 8 lines · Luis R. Rodriguez
Quoted 8 lines
Quoted 6 lines
+ *
ieee80211_channel- internal structure definiton for an IEEE-802.11 channel
+ *
+ * This defines anieee80211_channel. The IEEE-802.11 regulatory domain agent
+ * is in charge of filling most of these fields out. The low-level driver
+ * is expected to fill in, if needed, the val field. Note that val is already
+ * set by the regulatory agent to the same channel as in chan.Shouldn't you also set chan and freq in the driver?
[...]
Quoted 17 lines
Initially I wanted to move mac80211 to use a linked list of channels instead of an array for each mode. As we discussed it over (you, me and a few others) we determined it wasn't best to do this (I have a patch that allows this just in case we later change our mind). But -- previous to doing this I had a wrapper on
ieee80211_channelas I wanted the central regdomain to have a linked list of reg domain channels. If we don't want a wrapper we have to add this to theieee8021_channelstruct. Otherwise I need to define my own channel struct which wraps aroundieee80211_channel.Quoted 6 lines
include/net/wireless_common.h line 55
Quoted 3 lines
include/net/wireless_common.h new file +3
-0+struct ieee80211_channel { +/* XXX change to u8 */ +short chan;Not sure, is a u8 always enough? I thought 802.11a had huge channel numbers?
Quoted 7 lines
Quoted 1 line
Not that huge :-) Highest I've heard is 220. u8 should suffice.
What's the idea of working with channels? Channels are non-uniq numbers. Internally everything should work with center frequency and not with channels. If necessary, information should be converted from channels by the driver when reporting it into the stack. That way there also won't be any problems if there ever is a channel 417.
I agree. I'm OK with just having center of freq. Right now WE supports channel or freqs and the value is passed directly to the driver (for FullMAC) or mac80211 (for SoftMAC). For nl80211 we can just support channel passing onto the kernel, if the user supplies a channel we'll do the conversion to freq in userspace. On step at a time.
Luis
Re: [PATCH 1/5] Move standard wireless defintions out of mac80211
Quoted 36 lines · Luis R. Rodriguez
Quoted 27 lines · Joerg Mayer
Quoted 8 lines · Luis R. Rodriguez
Quoted 8 lines
Quoted 6 lines
+ *
ieee80211_channel- internal structure definiton for an IEEE-802.11 channel
+ *
+ * This defines anieee80211_channel. The IEEE-802.11 regulatory domain agent
+ * is in charge of filling most of these fields out. The low-level driver
+ * is expected to fill in, if needed, the val field. Note that val is already
+ * set by the regulatory agent to the same channel as in chan.Shouldn't you also set chan and freq in the driver?
[...]
Quoted 17 lines
Initially I wanted to move mac80211 to use a linked list of channels instead of an array for each mode. As we discussed it over (you, me and a few others) we determined it wasn't best to do this (I have a patch that allows this just in case we later change our mind). But -- previous to doing this I had a wrapper on
ieee80211_channelas I wanted the central regdomain to have a linked list of reg domain channels. If we don't want a wrapper we have to add this to theieee8021_channelstruct. Otherwise I need to define my own channel struct which wraps aroundieee80211_channel.Quoted 6 lines
include/net/wireless_common.h line 55
Quoted 3 lines
include/net/wireless_common.h new file +3
-0+struct ieee80211_channel { +/* XXX change to u8 */ +short chan;Not sure, is a u8 always enough? I thought 802.11a had huge channel numbers?
Quoted 7 lines
Quoted 1 line
Not that huge :-) Highest I've heard is 220. u8 should suffice.
What's the idea of working with channels? Channels are non-uniq numbers. Internally everything should work with center frequency and not with channels. If necessary, information should be converted from channels by the driver when reporting it into the stack. That way there also won't be any problems if there ever is a channel 417.
Quoted 5 lines
I agree. I'm OK with just having center of freq. Right now WE supports channel or freqs and the value is passed directly to the driver (for FullMAC) or mac80211 (for SoftMAC). For nl80211 we can just support channel passing onto the kernel, if the user supplies a channel we'll do the conversion to freq in userspace. On step at a time.
Definitely need to use freq and not channel. Channels are not unique (they just _happen_ to be so right now). Of course remember that we can't just pass channel really, we need to pass the tuple of (channel, band) or maybe even (channel, [A|B|G|N]) or something.
Dan
Re: [PATCH 1/5] Move standard wireless defintions out of mac80211
Quoted 43 lines · Dan Williams
Quoted 36 lines · Luis R. Rodriguez
Quoted 27 lines · Joerg Mayer
Quoted 8 lines · Luis R. Rodriguez
Quoted 8 lines
Quoted 6 lines
+ *
ieee80211_channel- internal structure definiton for an IEEE-802.11 channel
+ *
+ * This defines anieee80211_channel. The IEEE-802.11 regulatory domain agent
+ * is in charge of filling most of these fields out. The low-level driver
+ * is expected to fill in, if needed, the val field. Note that val is already
+ * set by the regulatory agent to the same channel as in chan.Shouldn't you also set chan and freq in the driver?
[...]
Quoted 17 lines
Initially I wanted to move mac80211 to use a linked list of channels instead of an array for each mode. As we discussed it over (you, me and a few others) we determined it wasn't best to do this (I have a patch that allows this just in case we later change our mind). But -- previous to doing this I had a wrapper on
ieee80211_channelas I wanted the central regdomain to have a linked list of reg domain channels. If we don't want a wrapper we have to add this to theieee8021_channelstruct. Otherwise I need to define my own channel struct which wraps aroundieee80211_channel.Quoted 6 lines
include/net/wireless_common.h line 55
Quoted 3 lines
include/net/wireless_common.h new file +3
-0+struct ieee80211_channel { +/* XXX change to u8 */ +short chan;Not sure, is a u8 always enough? I thought 802.11a had huge channel numbers?
Quoted 7 lines
Quoted 1 line
Not that huge :-) Highest I've heard is 220. u8 should suffice.
What's the idea of working with channels? Channels are non-uniq numbers. Internally everything should work with center frequency and not with channels. If necessary, information should be converted from channels by the driver when reporting it into the stack. That way there also won't be any problems if there ever is a channel 417.
Quoted 5 lines
I agree. I'm OK with just having center of freq. Right now WE supports channel or freqs and the value is passed directly to the driver (for FullMAC) or mac80211 (for SoftMAC). For nl80211 we can just support channel passing onto the kernel, if the user supplies a channel we'll do the conversion to freq in userspace. On step at a time.
Quoted 4 lines
Definitely need to use freq and not channel. Channels are not unique (they just _happen_ to be so right now). Of course remember that we can't just pass channel really, we need to pass the tuple of (channel, band) or maybe even (channel, [A|B|G|N]) or something.
AFAICT channels are unique per 2GHz and 5GHz band. As far as the regulatory code I have is concerned we have:
2GHz: 2412 - 2732 (ch 1 - 26)
5GHz: 5005 - 6100 (ch 1 - 220)
However, the problem really is with some channels which have its center of frequency below this range. Only special hardware can go out of this range. An example is the Atheros device's transceiver which supports frequencies in the range of 4920 to 6100 MHz and 2312 to 2732 MHz. In this case 2312MHz would be channel -19... Regulatory-wise I have read only about MKK allowing frequencies in the 4.8GHz range, I am not 100% certain though and the current regulatory agency does allow for its use, I'll ask. In the current regulatory work we don't allow for those channels. If it is the case that some reg agencies allow for it we'll need to need to figure out a way to map this lower bound frequency range.
Kernel-wise I think we should stick to center of frequencies. If new userspace wants to speak in terms of channels we should just have userspace do the conversion to freq. The exception here would be old Wireless-Extensions which already supports passing channel numbers. For WE we can just not support the lower freqs as new userspace utilities should use the new nl80211 interface.
Luis