| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 1 | #ifndef __NET_WIRELESS_H | 
 | 2 | #define __NET_WIRELESS_H | 
 | 3 |  | 
 | 4 | /* | 
 | 5 |  * 802.11 device management | 
 | 6 |  * | 
 | 7 |  * Copyright 2007	Johannes Berg <johannes@sipsolutions.net> | 
 | 8 |  */ | 
 | 9 |  | 
 | 10 | #include <linux/netdevice.h> | 
 | 11 | #include <linux/debugfs.h> | 
 | 12 | #include <linux/list.h> | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 13 | #include <linux/ieee80211.h> | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 14 | #include <net/cfg80211.h> | 
 | 15 |  | 
 | 16 | /** | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 17 |  * enum ieee80211_band - supported frequency bands | 
 | 18 |  * | 
 | 19 |  * The bands are assigned this way because the supported | 
 | 20 |  * bitrates differ in these bands. | 
 | 21 |  * | 
 | 22 |  * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band | 
 | 23 |  * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) | 
 | 24 |  */ | 
 | 25 | enum ieee80211_band { | 
 | 26 | 	IEEE80211_BAND_2GHZ, | 
 | 27 | 	IEEE80211_BAND_5GHZ, | 
 | 28 |  | 
 | 29 | 	/* keep last */ | 
 | 30 | 	IEEE80211_NUM_BANDS | 
 | 31 | }; | 
 | 32 |  | 
 | 33 | /** | 
 | 34 |  * enum ieee80211_channel_flags - channel flags | 
 | 35 |  * | 
 | 36 |  * Channel flags set by the regulatory control code. | 
 | 37 |  * | 
 | 38 |  * @IEEE80211_CHAN_DISABLED: This channel is disabled. | 
 | 39 |  * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted | 
 | 40 |  *	on this channel. | 
 | 41 |  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. | 
 | 42 |  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. | 
| Emmanuel Grumbach | 9306102 | 2008-05-29 16:35:23 +0800 | [diff] [blame] | 43 |  * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel | 
 | 44 |  * 	is not permitted. | 
 | 45 |  * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel | 
 | 46 |  * 	is not permitted. | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 47 |  */ | 
 | 48 | enum ieee80211_channel_flags { | 
 | 49 | 	IEEE80211_CHAN_DISABLED		= 1<<0, | 
 | 50 | 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1, | 
 | 51 | 	IEEE80211_CHAN_NO_IBSS		= 1<<2, | 
 | 52 | 	IEEE80211_CHAN_RADAR		= 1<<3, | 
| Emmanuel Grumbach | 9306102 | 2008-05-29 16:35:23 +0800 | [diff] [blame] | 53 | 	IEEE80211_CHAN_NO_FAT_ABOVE	= 1<<4, | 
 | 54 | 	IEEE80211_CHAN_NO_FAT_BELOW	= 1<<5, | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 55 | }; | 
 | 56 |  | 
 | 57 | /** | 
 | 58 |  * struct ieee80211_channel - channel definition | 
 | 59 |  * | 
 | 60 |  * This structure describes a single channel for use | 
 | 61 |  * with cfg80211. | 
 | 62 |  * | 
 | 63 |  * @center_freq: center frequency in MHz | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 64 |  * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 65 |  * @hw_value: hardware-specific value for the channel | 
 | 66 |  * @flags: channel flags from &enum ieee80211_channel_flags. | 
 | 67 |  * @orig_flags: channel flags at registration time, used by regulatory | 
 | 68 |  *	code to support devices with additional restrictions | 
 | 69 |  * @band: band this channel belongs to. | 
 | 70 |  * @max_antenna_gain: maximum antenna gain in dBi | 
 | 71 |  * @max_power: maximum transmission power (in dBm) | 
 | 72 |  * @orig_mag: internal use | 
 | 73 |  * @orig_mpwr: internal use | 
 | 74 |  */ | 
 | 75 | struct ieee80211_channel { | 
 | 76 | 	enum ieee80211_band band; | 
 | 77 | 	u16 center_freq; | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 78 | 	u8 max_bandwidth; | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 79 | 	u16 hw_value; | 
 | 80 | 	u32 flags; | 
 | 81 | 	int max_antenna_gain; | 
 | 82 | 	int max_power; | 
 | 83 | 	u32 orig_flags; | 
 | 84 | 	int orig_mag, orig_mpwr; | 
 | 85 | }; | 
 | 86 |  | 
 | 87 | /** | 
 | 88 |  * enum ieee80211_rate_flags - rate flags | 
 | 89 |  * | 
 | 90 |  * Hardware/specification flags for rates. These are structured | 
 | 91 |  * in a way that allows using the same bitrate structure for | 
 | 92 |  * different bands/PHY modes. | 
 | 93 |  * | 
 | 94 |  * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short | 
 | 95 |  *	preamble on this bitrate; only relevant in 2.4GHz band and | 
 | 96 |  *	with CCK rates. | 
 | 97 |  * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate | 
 | 98 |  *	when used with 802.11a (on the 5 GHz band); filled by the | 
 | 99 |  *	core code when registering the wiphy. | 
 | 100 |  * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate | 
 | 101 |  *	when used with 802.11b (on the 2.4 GHz band); filled by the | 
 | 102 |  *	core code when registering the wiphy. | 
 | 103 |  * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate | 
 | 104 |  *	when used with 802.11g (on the 2.4 GHz band); filled by the | 
 | 105 |  *	core code when registering the wiphy. | 
 | 106 |  * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. | 
 | 107 |  */ | 
 | 108 | enum ieee80211_rate_flags { | 
 | 109 | 	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0, | 
 | 110 | 	IEEE80211_RATE_MANDATORY_A	= 1<<1, | 
 | 111 | 	IEEE80211_RATE_MANDATORY_B	= 1<<2, | 
 | 112 | 	IEEE80211_RATE_MANDATORY_G	= 1<<3, | 
 | 113 | 	IEEE80211_RATE_ERP_G		= 1<<4, | 
 | 114 | }; | 
 | 115 |  | 
 | 116 | /** | 
 | 117 |  * struct ieee80211_rate - bitrate definition | 
 | 118 |  * | 
 | 119 |  * This structure describes a bitrate that an 802.11 PHY can | 
 | 120 |  * operate with. The two values @hw_value and @hw_value_short | 
 | 121 |  * are only for driver use when pointers to this structure are | 
 | 122 |  * passed around. | 
 | 123 |  * | 
 | 124 |  * @flags: rate-specific flags | 
 | 125 |  * @bitrate: bitrate in units of 100 Kbps | 
 | 126 |  * @hw_value: driver/hardware value for this rate | 
 | 127 |  * @hw_value_short: driver/hardware value for this rate when | 
 | 128 |  *	short preamble is used | 
 | 129 |  */ | 
 | 130 | struct ieee80211_rate { | 
 | 131 | 	u32 flags; | 
 | 132 | 	u16 bitrate; | 
 | 133 | 	u16 hw_value, hw_value_short; | 
 | 134 | }; | 
 | 135 |  | 
 | 136 | /** | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 137 |  * struct ieee80211_sta_ht_cap - STA's HT capabilities | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 138 |  * | 
 | 139 |  * This structure describes most essential parameters needed | 
 | 140 |  * to describe 802.11n HT capabilities for an STA. | 
 | 141 |  * | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 142 |  * @ht_supported: is HT supported by the STA | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 143 |  * @cap: HT capabilities map as described in 802.11n spec | 
 | 144 |  * @ampdu_factor: Maximum A-MPDU length factor | 
 | 145 |  * @ampdu_density: Minimum A-MPDU spacing | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 146 |  * @mcs: Supported MCS rates | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 147 |  */ | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 148 | struct ieee80211_sta_ht_cap { | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 149 | 	u16 cap; /* use IEEE80211_HT_CAP_ */ | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 150 | 	bool ht_supported; | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 151 | 	u8 ampdu_factor; | 
 | 152 | 	u8 ampdu_density; | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 153 | 	struct ieee80211_mcs_info mcs; | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 154 | }; | 
 | 155 |  | 
 | 156 | /** | 
 | 157 |  * struct ieee80211_supported_band - frequency band definition | 
 | 158 |  * | 
 | 159 |  * This structure describes a frequency band a wiphy | 
 | 160 |  * is able to operate in. | 
 | 161 |  * | 
 | 162 |  * @channels: Array of channels the hardware can operate in | 
 | 163 |  *	in this band. | 
 | 164 |  * @band: the band this structure represents | 
 | 165 |  * @n_channels: Number of channels in @channels | 
 | 166 |  * @bitrates: Array of bitrates the hardware can operate with | 
 | 167 |  *	in this band. Must be sorted to give a valid "supported | 
 | 168 |  *	rates" IE, i.e. CCK rates first, then OFDM. | 
 | 169 |  * @n_bitrates: Number of bitrates in @bitrates | 
 | 170 |  */ | 
 | 171 | struct ieee80211_supported_band { | 
 | 172 | 	struct ieee80211_channel *channels; | 
 | 173 | 	struct ieee80211_rate *bitrates; | 
 | 174 | 	enum ieee80211_band band; | 
 | 175 | 	int n_channels; | 
 | 176 | 	int n_bitrates; | 
| Johannes Berg | d9fe60d | 2008-10-09 12:13:49 +0200 | [diff] [blame] | 177 | 	struct ieee80211_sta_ht_cap ht_cap; | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 178 | }; | 
 | 179 |  | 
 | 180 | /** | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 181 |  * struct wiphy - wireless hardware description | 
 | 182 |  * @idx: the wiphy index assigned to this item | 
 | 183 |  * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> | 
| Luis R. Rodriguez | 2a44f91 | 2009-01-22 15:05:49 -0800 | [diff] [blame] | 184 |  * @custom_regulatory: tells us the driver for this device | 
 | 185 |  * 	has its own custom regulatory domain and cannot identify the | 
| Luis R. Rodriguez | 14b9815 | 2008-11-12 14:22:03 -0800 | [diff] [blame] | 186 |  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled | 
 | 187 |  * 	we will disregard the first regulatory hint (when the | 
 | 188 |  * 	initiator is %REGDOM_SET_BY_CORE). | 
| Luis R. Rodriguez | f976376 | 2009-01-22 15:05:52 -0800 | [diff] [blame] | 189 |  * @strict_regulatory: tells us the driver for this device will ignore | 
 | 190 |  * 	regulatory domain settings until it gets its own regulatory domain | 
 | 191 |  * 	via its regulatory_hint(). After its gets its own regulatory domain | 
 | 192 |  * 	it will only allow further regulatory domain settings to further | 
 | 193 |  * 	enhance compliance. For example if channel 13 and 14 are disabled | 
 | 194 |  * 	by this regulatory domain no user regulatory domain can enable these | 
 | 195 |  * 	channels at a later time. This can be used for devices which do not | 
 | 196 |  * 	have calibration information gauranteed for frequencies or settings | 
 | 197 |  * 	outside of its regulatory domain. | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 198 |  * @reg_notifier: the driver's regulatory notification callback | 
| Luis R. Rodriguez | 3e0c3ff | 2009-01-07 17:43:34 -0800 | [diff] [blame] | 199 |  * @regd: the driver's regulatory domain, if one was requested via | 
 | 200 |  * 	the regulatory_hint() API. This can be used by the driver | 
 | 201 |  *	on the reg_notifier() if it chooses to ignore future | 
 | 202 |  *	regulatory domain changes caused by other drivers. | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 203 |  */ | 
 | 204 | struct wiphy { | 
 | 205 | 	/* assign these fields before you register the wiphy */ | 
 | 206 |  | 
 | 207 | 	/* permanent MAC address */ | 
 | 208 | 	u8 perm_addr[ETH_ALEN]; | 
 | 209 |  | 
| Luis R. Rodriguez | f59ac04 | 2008-08-29 16:26:43 -0700 | [diff] [blame] | 210 | 	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | 
 | 211 | 	u16 interface_modes; | 
 | 212 |  | 
| Luis R. Rodriguez | 2a44f91 | 2009-01-22 15:05:49 -0800 | [diff] [blame] | 213 | 	bool custom_regulatory; | 
| Luis R. Rodriguez | f976376 | 2009-01-22 15:05:52 -0800 | [diff] [blame] | 214 | 	bool strict_regulatory; | 
| Luis R. Rodriguez | 14b9815 | 2008-11-12 14:22:03 -0800 | [diff] [blame] | 215 |  | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 216 | 	/* If multiple wiphys are registered and you're handed e.g. | 
 | 217 | 	 * a regular netdev with assigned ieee80211_ptr, you won't | 
 | 218 | 	 * know whether it points to a wiphy your driver has registered | 
 | 219 | 	 * or not. Assign this to something global to your driver to | 
 | 220 | 	 * help determine whether you own this wiphy or not. */ | 
 | 221 | 	void *privid; | 
 | 222 |  | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 223 | 	struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; | 
 | 224 |  | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 225 | 	/* Lets us get back the wiphy on the callback */ | 
| Luis R. Rodriguez | 716f939 | 2009-01-22 15:05:51 -0800 | [diff] [blame] | 226 | 	int (*reg_notifier)(struct wiphy *wiphy, | 
 | 227 | 			    struct regulatory_request *request); | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 228 |  | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 229 | 	/* fields below are read-only, assigned by cfg80211 */ | 
 | 230 |  | 
| Luis R. Rodriguez | 3e0c3ff | 2009-01-07 17:43:34 -0800 | [diff] [blame] | 231 | 	const struct ieee80211_regdomain *regd; | 
 | 232 |  | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 233 | 	/* the item in /sys/class/ieee80211/ points to this, | 
 | 234 | 	 * you need use set_wiphy_dev() (see below) */ | 
 | 235 | 	struct device dev; | 
 | 236 |  | 
 | 237 | 	/* dir in debugfs: ieee80211/<wiphyname> */ | 
 | 238 | 	struct dentry *debugfsdir; | 
 | 239 |  | 
 | 240 | 	char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); | 
 | 241 | }; | 
 | 242 |  | 
 | 243 | /** struct wireless_dev - wireless per-netdev state | 
 | 244 |  * | 
 | 245 |  * This structure must be allocated by the driver/stack | 
 | 246 |  * that uses the ieee80211_ptr field in struct net_device | 
 | 247 |  * (this is intentional so it can be allocated along with | 
 | 248 |  * the netdev.) | 
 | 249 |  * | 
 | 250 |  * @wiphy: pointer to hardware description | 
| Johannes Berg | 60719ff | 2008-09-16 14:55:09 +0200 | [diff] [blame] | 251 |  * @iftype: interface type | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 252 |  */ | 
 | 253 | struct wireless_dev { | 
 | 254 | 	struct wiphy *wiphy; | 
| Johannes Berg | 60719ff | 2008-09-16 14:55:09 +0200 | [diff] [blame] | 255 | 	enum nl80211_iftype iftype; | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 256 |  | 
 | 257 | 	/* private to the generic wireless code */ | 
 | 258 | 	struct list_head list; | 
 | 259 | 	struct net_device *netdev; | 
 | 260 | }; | 
 | 261 |  | 
 | 262 | /** | 
 | 263 |  * wiphy_priv - return priv from wiphy | 
 | 264 |  */ | 
 | 265 | static inline void *wiphy_priv(struct wiphy *wiphy) | 
 | 266 | { | 
 | 267 | 	BUG_ON(!wiphy); | 
 | 268 | 	return &wiphy->priv; | 
 | 269 | } | 
 | 270 |  | 
 | 271 | /** | 
 | 272 |  * set_wiphy_dev - set device pointer for wiphy | 
 | 273 |  */ | 
 | 274 | static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) | 
 | 275 | { | 
 | 276 | 	wiphy->dev.parent = dev; | 
 | 277 | } | 
 | 278 |  | 
 | 279 | /** | 
 | 280 |  * wiphy_dev - get wiphy dev pointer | 
 | 281 |  */ | 
 | 282 | static inline struct device *wiphy_dev(struct wiphy *wiphy) | 
 | 283 | { | 
 | 284 | 	return wiphy->dev.parent; | 
 | 285 | } | 
 | 286 |  | 
 | 287 | /** | 
 | 288 |  * wiphy_name - get wiphy name | 
 | 289 |  */ | 
| Kay Sievers | fb28ad3 | 2008-11-10 13:55:14 -0800 | [diff] [blame] | 290 | static inline const char *wiphy_name(struct wiphy *wiphy) | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 291 | { | 
| Kay Sievers | fb28ad3 | 2008-11-10 13:55:14 -0800 | [diff] [blame] | 292 | 	return dev_name(&wiphy->dev); | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 293 | } | 
 | 294 |  | 
 | 295 | /** | 
 | 296 |  * wdev_priv - return wiphy priv from wireless_dev | 
 | 297 |  */ | 
 | 298 | static inline void *wdev_priv(struct wireless_dev *wdev) | 
 | 299 | { | 
 | 300 | 	BUG_ON(!wdev); | 
 | 301 | 	return wiphy_priv(wdev->wiphy); | 
 | 302 | } | 
 | 303 |  | 
 | 304 | /** | 
 | 305 |  * wiphy_new - create a new wiphy for use with cfg80211 | 
 | 306 |  * | 
 | 307 |  * create a new wiphy and associate the given operations with it. | 
 | 308 |  * @sizeof_priv bytes are allocated for private use. | 
 | 309 |  * | 
 | 310 |  * the returned pointer must be assigned to each netdev's | 
 | 311 |  * ieee80211_ptr for proper operation. | 
 | 312 |  */ | 
 | 313 | struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv); | 
 | 314 |  | 
 | 315 | /** | 
 | 316 |  * wiphy_register - register a wiphy with cfg80211 | 
 | 317 |  * | 
 | 318 |  * register the given wiphy | 
 | 319 |  * | 
 | 320 |  * Returns a non-negative wiphy index or a negative error code. | 
 | 321 |  */ | 
 | 322 | extern int wiphy_register(struct wiphy *wiphy); | 
 | 323 |  | 
 | 324 | /** | 
 | 325 |  * wiphy_unregister - deregister a wiphy from cfg80211 | 
 | 326 |  * | 
 | 327 |  * unregister a device with the given priv pointer. | 
 | 328 |  * After this call, no more requests can be made with this priv | 
 | 329 |  * pointer, but the call may sleep to wait for an outstanding | 
 | 330 |  * request that is being handled. | 
 | 331 |  */ | 
 | 332 | extern void wiphy_unregister(struct wiphy *wiphy); | 
 | 333 |  | 
 | 334 | /** | 
 | 335 |  * wiphy_free - free wiphy | 
 | 336 |  */ | 
 | 337 | extern void wiphy_free(struct wiphy *wiphy); | 
 | 338 |  | 
| Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 339 | /** | 
 | 340 |  * ieee80211_channel_to_frequency - convert channel number to frequency | 
 | 341 |  */ | 
 | 342 | extern int ieee80211_channel_to_frequency(int chan); | 
 | 343 |  | 
 | 344 | /** | 
 | 345 |  * ieee80211_frequency_to_channel - convert frequency to channel number | 
 | 346 |  */ | 
 | 347 | extern int ieee80211_frequency_to_channel(int freq); | 
 | 348 |  | 
| Johannes Berg | 6c507cd | 2008-03-26 14:14:55 +0100 | [diff] [blame] | 349 | /* | 
 | 350 |  * Name indirection necessary because the ieee80211 code also has | 
 | 351 |  * a function named "ieee80211_get_channel", so if you include | 
 | 352 |  * cfg80211's header file you get cfg80211's version, if you try | 
 | 353 |  * to include both header files you'll (rightfully!) get a symbol | 
 | 354 |  * clash. | 
 | 355 |  */ | 
 | 356 | extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, | 
 | 357 | 							 int freq); | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 358 | /** | 
| Johannes Berg | e07aa37 | 2008-09-15 13:11:19 +0200 | [diff] [blame] | 359 |  * ieee80211_get_channel - get channel struct from wiphy for specified frequency | 
 | 360 |  */ | 
 | 361 | static inline struct ieee80211_channel * | 
 | 362 | ieee80211_get_channel(struct wiphy *wiphy, int freq) | 
 | 363 | { | 
 | 364 | 	return __ieee80211_get_channel(wiphy, freq); | 
 | 365 | } | 
 | 366 |  | 
 | 367 | /** | 
| Johannes Berg | bd81525 | 2008-10-29 20:00:45 +0100 | [diff] [blame] | 368 |  * ieee80211_get_response_rate - get basic rate for a given rate | 
 | 369 |  * | 
 | 370 |  * @sband: the band to look for rates in | 
 | 371 |  * @basic_rates: bitmap of basic rates | 
 | 372 |  * @bitrate: the bitrate for which to find the basic rate | 
 | 373 |  * | 
 | 374 |  * This function returns the basic rate corresponding to a given | 
 | 375 |  * bitrate, that is the next lower bitrate contained in the basic | 
 | 376 |  * rate map, which is, for this function, given as a bitmap of | 
 | 377 |  * indices of rates in the band's bitrate table. | 
 | 378 |  */ | 
 | 379 | struct ieee80211_rate * | 
 | 380 | ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | 
| Johannes Berg | 881d948 | 2009-01-21 15:13:48 +0100 | [diff] [blame] | 381 | 			    u32 basic_rates, int bitrate); | 
| Johannes Berg | bd81525 | 2008-10-29 20:00:45 +0100 | [diff] [blame] | 382 |  | 
 | 383 | /** | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 384 |  * regulatory_hint - driver hint to the wireless core a regulatory domain | 
| Johannes Berg | be3d481 | 2008-10-24 20:32:21 +0200 | [diff] [blame] | 385 |  * @wiphy: the wireless device giving the hint (used only for reporting | 
 | 386 |  *	conflicts) | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 387 |  * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain | 
 | 388 |  * 	should be in. If @rd is set this should be NULL. Note that if you | 
 | 389 |  * 	set this to NULL you should still set rd->alpha2 to some accepted | 
 | 390 |  * 	alpha2. | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 391 |  * | 
 | 392 |  * Wireless drivers can use this function to hint to the wireless core | 
 | 393 |  * what it believes should be the current regulatory domain by | 
 | 394 |  * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory | 
 | 395 |  * domain should be in or by providing a completely build regulatory domain. | 
 | 396 |  * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | 
| Johannes Berg | be3d481 | 2008-10-24 20:32:21 +0200 | [diff] [blame] | 397 |  * for a regulatory domain structure for the respective country. | 
| Luis R. Rodriguez | b2e1b30 | 2008-09-09 23:19:48 -0700 | [diff] [blame] | 398 |  */ | 
| Johannes Berg | be3d481 | 2008-10-24 20:32:21 +0200 | [diff] [blame] | 399 | extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2); | 
| Luis R. Rodriguez | 3f2355c | 2008-11-12 14:22:02 -0800 | [diff] [blame] | 400 |  | 
 | 401 | /** | 
 | 402 |  * regulatory_hint_11d - hints a country IE as a regulatory domain | 
 | 403 |  * @wiphy: the wireless device giving the hint (used only for reporting | 
 | 404 |  *	conflicts) | 
 | 405 |  * @country_ie: pointer to the country IE | 
 | 406 |  * @country_ie_len: length of the country IE | 
 | 407 |  * | 
 | 408 |  * We will intersect the rd with the what CRDA tells us should apply | 
 | 409 |  * for the alpha2 this country IE belongs to, this prevents APs from | 
 | 410 |  * sending us incorrect or outdated information against a country. | 
 | 411 |  */ | 
 | 412 | extern void regulatory_hint_11d(struct wiphy *wiphy, | 
 | 413 | 				u8 *country_ie, | 
 | 414 | 				u8 country_ie_len); | 
| Luis R. Rodriguez | 1fa25e4 | 2009-01-22 15:05:44 -0800 | [diff] [blame] | 415 |  | 
 | 416 | /** | 
 | 417 |  * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain | 
 | 418 |  * @wiphy: the wireless device we want to process the regulatory domain on | 
 | 419 |  * @regd: the custom regulatory domain to use for this wiphy | 
 | 420 |  * | 
 | 421 |  * Drivers can sometimes have custom regulatory domains which do not apply | 
 | 422 |  * to a specific country. Drivers can use this to apply such custom regulatory | 
 | 423 |  * domains. This routine must be called prior to wiphy registration. The | 
 | 424 |  * custom regulatory domain will be trusted completely and as such previous | 
 | 425 |  * default channel settings will be disregarded. If no rule is found for a | 
 | 426 |  * channel on the regulatory domain the channel will be disabled. | 
 | 427 |  */ | 
 | 428 | extern void wiphy_apply_custom_regulatory( | 
 | 429 | 	struct wiphy *wiphy, | 
 | 430 | 	const struct ieee80211_regdomain *regd); | 
 | 431 |  | 
| Luis R. Rodriguez | 34f5734 | 2009-01-22 15:05:45 -0800 | [diff] [blame] | 432 | /** | 
 | 433 |  * freq_reg_info - get regulatory information for the given frequency | 
 | 434 |  * @wiphy: the wiphy for which we want to process this rule for | 
 | 435 |  * @center_freq: Frequency in KHz for which we want regulatory information for | 
 | 436 |  * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one | 
 | 437 |  * 	you can set this to 0. If this frequency is allowed we then set | 
 | 438 |  * 	this value to the maximum allowed bandwidth. | 
 | 439 |  * @reg_rule: the regulatory rule which we have for this frequency | 
 | 440 |  * | 
 | 441 |  * Use this function to get the regulatory rule for a specific frequency on | 
 | 442 |  * a given wireless device. If the device has a specific regulatory domain | 
 | 443 |  * it wants to follow we respect that unless a country IE has been received | 
 | 444 |  * and processed already. | 
 | 445 |  * | 
 | 446 |  * Returns 0 if it was able to find a valid regulatory rule which does | 
 | 447 |  * apply to the given center_freq otherwise it returns non-zero. It will | 
 | 448 |  * also return -ERANGE if we determine the given center_freq does not even have | 
 | 449 |  * a regulatory rule for a frequency range in the center_freq's band. See | 
 | 450 |  * freq_in_rule_band() for our current definition of a band -- this is purely | 
 | 451 |  * subjective and right now its 802.11 specific. | 
 | 452 |  */ | 
 | 453 | extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth, | 
 | 454 | 			 const struct ieee80211_reg_rule **reg_rule); | 
 | 455 |  | 
| Johannes Berg | 704232c | 2007-04-23 12:20:05 -0700 | [diff] [blame] | 456 | #endif /* __NET_WIRELESS_H */ |