1692eebe0SSam Leffler.\" 2692eebe0SSam Leffler.\" Copyright (c) 2009 Sam Leffler, Errno Consulting 3692eebe0SSam Leffler.\" All rights reserved. 4692eebe0SSam Leffler.\" 5692eebe0SSam Leffler.\" Redistribution and use in source and binary forms, with or without 6692eebe0SSam Leffler.\" modification, are permitted provided that the following conditions 7692eebe0SSam Leffler.\" are met: 8692eebe0SSam Leffler.\" 1. Redistributions of source code must retain the above copyright 9692eebe0SSam Leffler.\" notice, this list of conditions and the following disclaimer. 10692eebe0SSam Leffler.\" 2. Redistributions in binary form must reproduce the above copyright 11692eebe0SSam Leffler.\" notice, this list of conditions and the following disclaimer in the 12692eebe0SSam Leffler.\" documentation and/or other materials provided with the distribution. 13692eebe0SSam Leffler.\" 14692eebe0SSam Leffler.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15692eebe0SSam Leffler.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16692eebe0SSam Leffler.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17692eebe0SSam Leffler.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18692eebe0SSam Leffler.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19692eebe0SSam Leffler.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20692eebe0SSam Leffler.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21692eebe0SSam Leffler.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22692eebe0SSam Leffler.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23692eebe0SSam Leffler.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24692eebe0SSam Leffler.\" SUCH DAMAGE. 25692eebe0SSam Leffler.\" 26692eebe0SSam Leffler.Dd August 4, 2009 27692eebe0SSam Leffler.Dt IEEE80211_REGDOMAIN 9 28692eebe0SSam Leffler.Os 29692eebe0SSam Leffler.Sh NAME 30692eebe0SSam Leffler.Nm ieee80211_regdomain 31692eebe0SSam Leffler.Nd 802.11 regulatory support 32692eebe0SSam Leffler.Sh SYNOPSIS 33692eebe0SSam Leffler.In net80211/ieee80211_var.h 34692eebe0SSam Leffler.In net80211/ieee80211_regdomain.h 35692eebe0SSam Leffler.Pp 36692eebe0SSam Leffler.Ft int 37692eebe0SSam Leffler.Fo ieee80211_init_channels 38692eebe0SSam Leffler.Fa "struct ieee80211com *" 39692eebe0SSam Leffler.Fa "const struct ieee80211_regdomain *" 40692eebe0SSam Leffler.Fa "const uint8_t bands[]" 41692eebe0SSam Leffler.Fc 42692eebe0SSam Leffler.\" 43692eebe0SSam Leffler.Ft void 44692eebe0SSam Leffler.Fo ieee80211_sort_channels 45692eebe0SSam Leffler.Fa "struct ieee80211_channel *" 46692eebe0SSam Leffler.Fa "int nchans" 47692eebe0SSam Leffler.Fc 48692eebe0SSam Leffler.\" 49692eebe0SSam Leffler.Ft "struct ieee80211_appie *" 50692eebe0SSam Leffler.Fn ieee80211_alloc_countryie "struct ieee80211com *" 51692eebe0SSam Leffler.Sh DESCRIPTION 52692eebe0SSam LefflerThe 53692eebe0SSam Leffler.Nm net80211 54692eebe0SSam Lefflersoftware layer provides a support framework for drivers that includes 55692eebe0SSam Lefflercomprehensive regulatory support. 56692eebe0SSam Leffler.Nm net80211 57692eebe0SSam Lefflerprovides mechanisms that enforce 58692eebe0SSam Leffler.Em "regulatory policy" 59692eebe0SSam Lefflerby privileged user applications. 60692eebe0SSam Leffler.Pp 61692eebe0SSam LefflerDrivers define a device's capabilities and can 62692eebe0SSam Lefflerintercept and control regulatory changes requested through 63692eebe0SSam Leffler.Nm net80211 . 64692eebe0SSam LefflerThe initial regulatory state, including the channel list, must be 65692eebe0SSam Lefflerfilled in by the driver before calling 66692eebe0SSam Leffler.Fn ieee80211_ifattach . 67692eebe0SSam LefflerThe channel list should reflect the set of channels the device is 68692eebe0SSam Leffler.Em calibrated 69692eebe0SSam Lefflerfor use on. 70692eebe0SSam LefflerThis list may also be requested later through the 71692eebe0SSam Leffler.Vt ic_getradiocaps 72692eebe0SSam Lefflermethod in the 73692eebe0SSam Leffler.Vt ieee80211com 74692eebe0SSam Lefflerstructure. 75692eebe0SSam LefflerThe 76692eebe0SSam Leffler.Fn ieee80211_init_channels 77692eebe0SSam Lefflerfunction is provided as a rudimentary fallback for drivers that do not 78692eebe0SSam Leffler(or cannot) fill in a proper channel list. 79692eebe0SSam LefflerDefault regulatory state is supplied such as the regulatory SKU, 80692eebe0SSam LefflerISO country code, location (e.g. indoor, outdoor), and a set of 81692eebe0SSam Lefflerfrequency bands the device is capable of operating on. 82692eebe0SSam Leffler.Nm net80211 83692eebe0SSam Lefflerpopulates the channel table in 84692eebe0SSam Leffler.Vt ic_channels 85692eebe0SSam Lefflerwith a default set of channels and capabilities. 86692eebe0SSam LefflerNote this mechanism should be used with care as any mismatch between 87692eebe0SSam Lefflerthe channel list created and the device's capabilities can result 88692eebe0SSam Lefflerin runtime errors (e.g. a request to operate on a channel the device 89692eebe0SSam Lefflerdoes not support). 90692eebe0SSam LefflerThe SKU and country information are used for generating 802.11h protocol 91692eebe0SSam Lefflerelements and related operation such as for 802.11d; mis-setup by a 92692eebe0SSam Lefflerdriver is not fatal, only potentially confusing. 93692eebe0SSam Leffler.Pp 94692eebe0SSam LefflerDevices that do not have a fixed/default regulatory state can set 95692eebe0SSam Lefflerthe regulatory SKU to 96692eebe0SSam Leffler.Dv SKU_DEBUG 97692eebe0SSam Lefflerand country code to 98692eebe0SSam Leffler.Dv CTRY_DEFAULT 99692eebe0SSam Lefflerand leave proper setup to user applications. 100692eebe0SSam LefflerIf default settings are known they can be installed and/or an event 101692eebe0SSam Lefflercan be dispatched to user space using 102692eebe0SSam Leffler.Fn ieee80211_notify_country 103692eebe0SSam Lefflerso that 104692eebe0SSam Leffler.Xr devd 8 105692eebe0SSam Lefflerwill do the appropriate setup work at system boot (or device insertion). 106692eebe0SSam Leffler.Pp 107692eebe0SSam LefflerThe channel table is sorted to optimize lookups using the 108692eebe0SSam Leffler.Fn ieee80211_sort_channels 109692eebe0SSam Lefflerroutine. 110692eebe0SSam LefflerThis should be done whenever the channel table contents are modified. 111692eebe0SSam Leffler.Pp 112692eebe0SSam LefflerThe 113ace02a6dSChristian Brueffer.Fn ieee80211_alloc_countryie 114692eebe0SSam Lefflerfunction allocates an information element as specified by 802.11h. 115692eebe0SSam LefflerBecause this is expensive to generate it is cached in 116692eebe0SSam Leffler.Vt ic_countryie 117692eebe0SSam Lefflerand generated only when regulatory state changes. 118692eebe0SSam LefflerDrivers that call 119692eebe0SSam Leffler.Fn ieee80211_alloc_countryie 120692eebe0SSam Lefflerdirectly should not help with this caching; doing so may confuse the 121692eebe0SSam Leffler.Nm net80211 122692eebe0SSam Lefflerlayer. 123692eebe0SSam Leffler.Sh DRIVER REGULATORY CONTROL 124692eebe0SSam LefflerDrivers can control regulatory change requests by overriding the 125692eebe0SSam Leffler.Vt ic_setregdomain 126692eebe0SSam Lefflermethod that checks change requests. 127692eebe0SSam LefflerWhile drivers can reject any request that does not meet its requirements 128692eebe0SSam Lefflerit is recommended that one be lenient in what is accepted and, whenever 129692eebe0SSam Lefflerpossible, instead of rejecting a request, alter it to be correct. 130692eebe0SSam LefflerFor example, if the transmit power cap for a channel is too high the 131692eebe0SSam Lefflerdriver can either reject the request or (better) reduce the cap to be 132692eebe0SSam Lefflercompliant. 133692eebe0SSam LefflerRequests that include unacceptable channels should cause the request 134692eebe0SSam Lefflerto be rejected as otherwise a mismatch may be created between application 135692eebe0SSam Lefflerstate and the state managed by 136692eebe0SSam Leffler.Nm net80211 . 137692eebe0SSam LefflerThe exact rules by which to operate are still being codified. 138692eebe0SSam Leffler.Sh SEE ALSO 139692eebe0SSam Leffler.Xr regdomain 5 , 140692eebe0SSam Leffler.Xr ifconfig 8 , 141ace02a6dSChristian Brueffer.Xr ieee80211 9 142