aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/cfg80211.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-20 08:31:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:57:17 -0400
commitd323655372590c533c275b1d798f9d1221efb5c6 (patch)
tree7eb0e7ecb88b09cead5a36b5aa93328b199e5c25 /include/net/cfg80211.h
parentaf8cdcd828ad751fae8e6cbfe94eef9f2f23b14b (diff)
cfg80211: clean up includes
Trying to separate header files into net/wireless.h and net/cfg80211.h has been a source of confusion. Remove net/wireless.h (because there also is the linux/wireless.h) and subsume everything into net/cfg80211.h -- except the definitions for regulatory structures which get moved to a new header net/regulatory.h. The "new" net/cfg80211.h is now divided into sections. There are no real changes in this patch but code shuffling and some very minor documentation fixes. I have also, to make things reflect reality, put in a copyright line for Luis to net/regulatory.h since that is probably exclusively written by him but was formerly in a file that only had my copyright line. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r--include/net/cfg80211.h709
1 files changed, 582 insertions, 127 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5287a3e56e7c..601eac64b02d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1,70 +1,217 @@
1#ifndef __NET_CFG80211_H 1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H 2#define __NET_CFG80211_H
3/*
4 * 802.11 device and configuration interface
5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
3 12
13#include <linux/netdevice.h>
14#include <linux/debugfs.h>
15#include <linux/list.h>
4#include <linux/netlink.h> 16#include <linux/netlink.h>
5#include <linux/skbuff.h> 17#include <linux/skbuff.h>
6#include <linux/nl80211.h> 18#include <linux/nl80211.h>
7#include <linux/if_ether.h> 19#include <linux/if_ether.h>
8#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
9#include <linux/wireless.h> 21#include <net/regulatory.h>
10#include <net/iw_handler.h> 22
11#include <net/genetlink.h>
12/* remove once we remove the wext stuff */ 23/* remove once we remove the wext stuff */
24#include <net/iw_handler.h>
25#include <linux/wireless.h>
26
13 27
14/* 28/*
15 * 802.11 configuration in-kernel interface 29 * wireless hardware capability structures
30 */
31
32/**
33 * enum ieee80211_band - supported frequency bands
34 *
35 * The bands are assigned this way because the supported
36 * bitrates differ in these bands.
16 * 37 *
17 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
18 */ 40 */
41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ,
44
45 /* keep last */
46 IEEE80211_NUM_BANDS
47};
19 48
20/** 49/**
21 * struct vif_params - describes virtual interface parameters 50 * enum ieee80211_channel_flags - channel flags
22 * @mesh_id: mesh ID to use 51 *
23 * @mesh_id_len: length of the mesh ID 52 * Channel flags set by the regulatory control code.
53 *
54 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
55 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
56 * on this channel.
57 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
58 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
59 * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
60 * is not permitted.
61 * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
62 * is not permitted.
24 */ 63 */
25struct vif_params { 64enum ieee80211_channel_flags {
26 u8 *mesh_id; 65 IEEE80211_CHAN_DISABLED = 1<<0,
27 int mesh_id_len; 66 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
67 IEEE80211_CHAN_NO_IBSS = 1<<2,
68 IEEE80211_CHAN_RADAR = 1<<3,
69 IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4,
70 IEEE80211_CHAN_NO_FAT_BELOW = 1<<5,
28}; 71};
29 72
30/* Radiotap header iteration 73/**
31 * implemented in net/wireless/radiotap.c 74 * struct ieee80211_channel - channel definition
32 * docs in Documentation/networking/radiotap-headers.txt 75 *
76 * This structure describes a single channel for use
77 * with cfg80211.
78 *
79 * @center_freq: center frequency in MHz
80 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
81 * @hw_value: hardware-specific value for the channel
82 * @flags: channel flags from &enum ieee80211_channel_flags.
83 * @orig_flags: channel flags at registration time, used by regulatory
84 * code to support devices with additional restrictions
85 * @band: band this channel belongs to.
86 * @max_antenna_gain: maximum antenna gain in dBi
87 * @max_power: maximum transmission power (in dBm)
88 * @beacon_found: helper to regulatory code to indicate when a beacon
89 * has been found on this channel. Use regulatory_hint_found_beacon()
90 * to enable this, this is is useful only on 5 GHz band.
91 * @orig_mag: internal use
92 * @orig_mpwr: internal use
33 */ 93 */
94struct ieee80211_channel {
95 enum ieee80211_band band;
96 u16 center_freq;
97 u8 max_bandwidth;
98 u16 hw_value;
99 u32 flags;
100 int max_antenna_gain;
101 int max_power;
102 bool beacon_found;
103 u32 orig_flags;
104 int orig_mag, orig_mpwr;
105};
106
34/** 107/**
35 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 108 * enum ieee80211_rate_flags - rate flags
36 * @rtheader: pointer to the radiotap header we are walking through 109 *
37 * @max_length: length of radiotap header in cpu byte ordering 110 * Hardware/specification flags for rates. These are structured
38 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 111 * in a way that allows using the same bitrate structure for
39 * @this_arg: pointer to current radiotap arg 112 * different bands/PHY modes.
40 * @arg_index: internal next argument index 113 *
41 * @arg: internal next argument pointer 114 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
42 * @next_bitmap: internal pointer to next present u32 115 * preamble on this bitrate; only relevant in 2.4GHz band and
43 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 116 * with CCK rates.
117 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
118 * when used with 802.11a (on the 5 GHz band); filled by the
119 * core code when registering the wiphy.
120 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
121 * when used with 802.11b (on the 2.4 GHz band); filled by the
122 * core code when registering the wiphy.
123 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
124 * when used with 802.11g (on the 2.4 GHz band); filled by the
125 * core code when registering the wiphy.
126 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
44 */ 127 */
128enum ieee80211_rate_flags {
129 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
130 IEEE80211_RATE_MANDATORY_A = 1<<1,
131 IEEE80211_RATE_MANDATORY_B = 1<<2,
132 IEEE80211_RATE_MANDATORY_G = 1<<3,
133 IEEE80211_RATE_ERP_G = 1<<4,
134};
45 135
46struct ieee80211_radiotap_iterator { 136/**
47 struct ieee80211_radiotap_header *rtheader; 137 * struct ieee80211_rate - bitrate definition
48 int max_length; 138 *
49 int this_arg_index; 139 * This structure describes a bitrate that an 802.11 PHY can
50 u8 *this_arg; 140 * operate with. The two values @hw_value and @hw_value_short
141 * are only for driver use when pointers to this structure are
142 * passed around.
143 *
144 * @flags: rate-specific flags
145 * @bitrate: bitrate in units of 100 Kbps
146 * @hw_value: driver/hardware value for this rate
147 * @hw_value_short: driver/hardware value for this rate when
148 * short preamble is used
149 */
150struct ieee80211_rate {
151 u32 flags;
152 u16 bitrate;
153 u16 hw_value, hw_value_short;
154};
51 155
52 int arg_index; 156/**
53 u8 *arg; 157 * struct ieee80211_sta_ht_cap - STA's HT capabilities
54 __le32 *next_bitmap; 158 *
55 u32 bitmap_shifter; 159 * This structure describes most essential parameters needed
160 * to describe 802.11n HT capabilities for an STA.
161 *
162 * @ht_supported: is HT supported by the STA
163 * @cap: HT capabilities map as described in 802.11n spec
164 * @ampdu_factor: Maximum A-MPDU length factor
165 * @ampdu_density: Minimum A-MPDU spacing
166 * @mcs: Supported MCS rates
167 */
168struct ieee80211_sta_ht_cap {
169 u16 cap; /* use IEEE80211_HT_CAP_ */
170 bool ht_supported;
171 u8 ampdu_factor;
172 u8 ampdu_density;
173 struct ieee80211_mcs_info mcs;
56}; 174};
57 175
58extern int ieee80211_radiotap_iterator_init( 176/**
59 struct ieee80211_radiotap_iterator *iterator, 177 * struct ieee80211_supported_band - frequency band definition
60 struct ieee80211_radiotap_header *radiotap_header, 178 *
61 int max_length); 179 * This structure describes a frequency band a wiphy
180 * is able to operate in.
181 *
182 * @channels: Array of channels the hardware can operate in
183 * in this band.
184 * @band: the band this structure represents
185 * @n_channels: Number of channels in @channels
186 * @bitrates: Array of bitrates the hardware can operate with
187 * in this band. Must be sorted to give a valid "supported
188 * rates" IE, i.e. CCK rates first, then OFDM.
189 * @n_bitrates: Number of bitrates in @bitrates
190 */
191struct ieee80211_supported_band {
192 struct ieee80211_channel *channels;
193 struct ieee80211_rate *bitrates;
194 enum ieee80211_band band;
195 int n_channels;
196 int n_bitrates;
197 struct ieee80211_sta_ht_cap ht_cap;
198};
62 199
63extern int ieee80211_radiotap_iterator_next( 200/*
64 struct ieee80211_radiotap_iterator *iterator); 201 * Wireless hardware/device configuration structures and methods
202 */
65 203
204/**
205 * struct vif_params - describes virtual interface parameters
206 * @mesh_id: mesh ID to use
207 * @mesh_id_len: length of the mesh ID
208 */
209struct vif_params {
210 u8 *mesh_id;
211 int mesh_id_len;
212};
66 213
67 /** 214/**
68 * struct key_params - key information 215 * struct key_params - key information
69 * 216 *
70 * Information about a key 217 * Information about a key
@@ -347,92 +494,6 @@ struct bss_parameters {
347 u8 basic_rates_len; 494 u8 basic_rates_len;
348}; 495};
349 496
350/**
351 * enum environment_cap - Environment parsed from country IE
352 * @ENVIRON_ANY: indicates country IE applies to both indoor and
353 * outdoor operation.
354 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
355 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
356 */
357enum environment_cap {
358 ENVIRON_ANY,
359 ENVIRON_INDOOR,
360 ENVIRON_OUTDOOR,
361};
362
363/**
364 * struct regulatory_request - used to keep track of regulatory requests
365 *
366 * @wiphy_idx: this is set if this request's initiator is
367 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
368 * can be used by the wireless core to deal with conflicts
369 * and potentially inform users of which devices specifically
370 * cased the conflicts.
371 * @initiator: indicates who sent this request, could be any of
372 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
373 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
374 * regulatory domain. We have a few special codes:
375 * 00 - World regulatory domain
376 * 99 - built by driver but a specific alpha2 cannot be determined
377 * 98 - result of an intersection between two regulatory domains
378 * @intersect: indicates whether the wireless core should intersect
379 * the requested regulatory domain with the presently set regulatory
380 * domain.
381 * @country_ie_checksum: checksum of the last processed and accepted
382 * country IE
383 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
384 * indoor, or if it doesn't matter
385 * @list: used to insert into the reg_requests_list linked list
386 */
387struct regulatory_request {
388 int wiphy_idx;
389 enum nl80211_reg_initiator initiator;
390 char alpha2[2];
391 bool intersect;
392 u32 country_ie_checksum;
393 enum environment_cap country_ie_env;
394 struct list_head list;
395};
396
397struct ieee80211_freq_range {
398 u32 start_freq_khz;
399 u32 end_freq_khz;
400 u32 max_bandwidth_khz;
401};
402
403struct ieee80211_power_rule {
404 u32 max_antenna_gain;
405 u32 max_eirp;
406};
407
408struct ieee80211_reg_rule {
409 struct ieee80211_freq_range freq_range;
410 struct ieee80211_power_rule power_rule;
411 u32 flags;
412};
413
414struct ieee80211_regdomain {
415 u32 n_reg_rules;
416 char alpha2[2];
417 struct ieee80211_reg_rule reg_rules[];
418};
419
420#define MHZ_TO_KHZ(freq) ((freq) * 1000)
421#define KHZ_TO_MHZ(freq) ((freq) / 1000)
422#define DBI_TO_MBI(gain) ((gain) * 100)
423#define MBI_TO_DBI(gain) ((gain) / 100)
424#define DBM_TO_MBM(gain) ((gain) * 100)
425#define MBM_TO_DBM(gain) ((gain) / 100)
426
427#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
428 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
429 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
430 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
431 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
432 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
433 .flags = reg_flags, \
434 }
435
436struct mesh_config { 497struct mesh_config {
437 /* Timeouts in ms */ 498 /* Timeouts in ms */
438 /* Mesh plink management parameters */ 499 /* Mesh plink management parameters */
@@ -853,7 +914,396 @@ struct cfg80211_ops {
853 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 914 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
854}; 915};
855 916
856/* temporary wext handlers */ 917/*
918 * wireless hardware and networking interfaces structures
919 * and registration/helper functions
920 */
921
922/**
923 * struct wiphy - wireless hardware description
924 * @idx: the wiphy index assigned to this item
925 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
926 * @custom_regulatory: tells us the driver for this device
927 * has its own custom regulatory domain and cannot identify the
928 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
929 * we will disregard the first regulatory hint (when the
930 * initiator is %REGDOM_SET_BY_CORE).
931 * @strict_regulatory: tells us the driver for this device will ignore
932 * regulatory domain settings until it gets its own regulatory domain
933 * via its regulatory_hint(). After its gets its own regulatory domain
934 * it will only allow further regulatory domain settings to further
935 * enhance compliance. For example if channel 13 and 14 are disabled
936 * by this regulatory domain no user regulatory domain can enable these
937 * channels at a later time. This can be used for devices which do not
938 * have calibration information gauranteed for frequencies or settings
939 * outside of its regulatory domain.
940 * @reg_notifier: the driver's regulatory notification callback
941 * @regd: the driver's regulatory domain, if one was requested via
942 * the regulatory_hint() API. This can be used by the driver
943 * on the reg_notifier() if it chooses to ignore future
944 * regulatory domain changes caused by other drivers.
945 * @signal_type: signal type reported in &struct cfg80211_bss.
946 * @cipher_suites: supported cipher suites
947 * @n_cipher_suites: number of supported cipher suites
948 */
949struct wiphy {
950 /* assign these fields before you register the wiphy */
951
952 /* permanent MAC address */
953 u8 perm_addr[ETH_ALEN];
954
955 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
956 u16 interface_modes;
957
958 bool custom_regulatory;
959 bool strict_regulatory;
960
961 enum cfg80211_signal_type signal_type;
962
963 int bss_priv_size;
964 u8 max_scan_ssids;
965 u16 max_scan_ie_len;
966
967 int n_cipher_suites;
968 const u32 *cipher_suites;
969
970 /* If multiple wiphys are registered and you're handed e.g.
971 * a regular netdev with assigned ieee80211_ptr, you won't
972 * know whether it points to a wiphy your driver has registered
973 * or not. Assign this to something global to your driver to
974 * help determine whether you own this wiphy or not. */
975 void *privid;
976
977 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
978
979 /* Lets us get back the wiphy on the callback */
980 int (*reg_notifier)(struct wiphy *wiphy,
981 struct regulatory_request *request);
982
983 /* fields below are read-only, assigned by cfg80211 */
984
985 const struct ieee80211_regdomain *regd;
986
987 /* the item in /sys/class/ieee80211/ points to this,
988 * you need use set_wiphy_dev() (see below) */
989 struct device dev;
990
991 /* dir in debugfs: ieee80211/<wiphyname> */
992 struct dentry *debugfsdir;
993
994 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
995};
996
997/**
998 * wiphy_priv - return priv from wiphy
999 *
1000 * @wiphy: the wiphy whose priv pointer to return
1001 */
1002static inline void *wiphy_priv(struct wiphy *wiphy)
1003{
1004 BUG_ON(!wiphy);
1005 return &wiphy->priv;
1006}
1007
1008/**
1009 * set_wiphy_dev - set device pointer for wiphy
1010 *
1011 * @wiphy: The wiphy whose device to bind
1012 * @dev: The device to parent it to
1013 */
1014static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1015{
1016 wiphy->dev.parent = dev;
1017}
1018
1019/**
1020 * wiphy_dev - get wiphy dev pointer
1021 *
1022 * @wiphy: The wiphy whose device struct to look up
1023 */
1024static inline struct device *wiphy_dev(struct wiphy *wiphy)
1025{
1026 return wiphy->dev.parent;
1027}
1028
1029/**
1030 * wiphy_name - get wiphy name
1031 *
1032 * @wiphy: The wiphy whose name to return
1033 */
1034static inline const char *wiphy_name(struct wiphy *wiphy)
1035{
1036 return dev_name(&wiphy->dev);
1037}
1038
1039/**
1040 * wiphy_new - create a new wiphy for use with cfg80211
1041 *
1042 * @ops: The configuration operations for this device
1043 * @sizeof_priv: The size of the private area to allocate
1044 *
1045 * Create a new wiphy and associate the given operations with it.
1046 * @sizeof_priv bytes are allocated for private use.
1047 *
1048 * The returned pointer must be assigned to each netdev's
1049 * ieee80211_ptr for proper operation.
1050 */
1051struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
1052
1053/**
1054 * wiphy_register - register a wiphy with cfg80211
1055 *
1056 * @wiphy: The wiphy to register.
1057 *
1058 * Returns a non-negative wiphy index or a negative error code.
1059 */
1060extern int wiphy_register(struct wiphy *wiphy);
1061
1062/**
1063 * wiphy_unregister - deregister a wiphy from cfg80211
1064 *
1065 * @wiphy: The wiphy to unregister.
1066 *
1067 * After this call, no more requests can be made with this priv
1068 * pointer, but the call may sleep to wait for an outstanding
1069 * request that is being handled.
1070 */
1071extern void wiphy_unregister(struct wiphy *wiphy);
1072
1073/**
1074 * wiphy_free - free wiphy
1075 *
1076 * @wiphy: The wiphy to free
1077 */
1078extern void wiphy_free(struct wiphy *wiphy);
1079
1080/**
1081 * struct wireless_dev - wireless per-netdev state
1082 *
1083 * This structure must be allocated by the driver/stack
1084 * that uses the ieee80211_ptr field in struct net_device
1085 * (this is intentional so it can be allocated along with
1086 * the netdev.)
1087 *
1088 * @wiphy: pointer to hardware description
1089 * @iftype: interface type
1090 * @list: (private) Used to collect the interfaces
1091 * @netdev: (private) Used to reference back to the netdev
1092 * @current_bss: (private) Used by the internal configuration code
1093 * @bssid: (private) Used by the internal configuration code
1094 * @ssid: (private) Used by the internal configuration code
1095 * @ssid_len: (private) Used by the internal configuration code
1096 * @wext: (private) Used by the internal wireless extensions compat code
1097 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1098 */
1099struct wireless_dev {
1100 struct wiphy *wiphy;
1101 enum nl80211_iftype iftype;
1102
1103 /* private to the generic wireless code */
1104 struct list_head list;
1105 struct net_device *netdev;
1106
1107 /* currently used for IBSS - might be rearranged in the future */
1108 struct cfg80211_bss *current_bss;
1109 u8 bssid[ETH_ALEN];
1110 u8 ssid[IEEE80211_MAX_SSID_LEN];
1111 u8 ssid_len;
1112
1113#ifdef CONFIG_WIRELESS_EXT
1114 /* wext data */
1115 struct cfg80211_ibss_params wext;
1116 u8 wext_bssid[ETH_ALEN];
1117#endif
1118};
1119
1120/**
1121 * wdev_priv - return wiphy priv from wireless_dev
1122 *
1123 * @wdev: The wireless device whose wiphy's priv pointer to return
1124 */
1125static inline void *wdev_priv(struct wireless_dev *wdev)
1126{
1127 BUG_ON(!wdev);
1128 return wiphy_priv(wdev->wiphy);
1129}
1130
1131/*
1132 * Utility functions
1133 */
1134
1135/**
1136 * ieee80211_channel_to_frequency - convert channel number to frequency
1137 */
1138extern int ieee80211_channel_to_frequency(int chan);
1139
1140/**
1141 * ieee80211_frequency_to_channel - convert frequency to channel number
1142 */
1143extern int ieee80211_frequency_to_channel(int freq);
1144
1145/*
1146 * Name indirection necessary because the ieee80211 code also has
1147 * a function named "ieee80211_get_channel", so if you include
1148 * cfg80211's header file you get cfg80211's version, if you try
1149 * to include both header files you'll (rightfully!) get a symbol
1150 * clash.
1151 */
1152extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1153 int freq);
1154/**
1155 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1156 */
1157static inline struct ieee80211_channel *
1158ieee80211_get_channel(struct wiphy *wiphy, int freq)
1159{
1160 return __ieee80211_get_channel(wiphy, freq);
1161}
1162
1163/**
1164 * ieee80211_get_response_rate - get basic rate for a given rate
1165 *
1166 * @sband: the band to look for rates in
1167 * @basic_rates: bitmap of basic rates
1168 * @bitrate: the bitrate for which to find the basic rate
1169 *
1170 * This function returns the basic rate corresponding to a given
1171 * bitrate, that is the next lower bitrate contained in the basic
1172 * rate map, which is, for this function, given as a bitmap of
1173 * indices of rates in the band's bitrate table.
1174 */
1175struct ieee80211_rate *
1176ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1177 u32 basic_rates, int bitrate);
1178
1179/*
1180 * Radiotap parsing functions -- for controlled injection support
1181 *
1182 * Implemented in net/wireless/radiotap.c
1183 * Documentation in Documentation/networking/radiotap-headers.txt
1184 */
1185
1186/**
1187 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1188 * @rtheader: pointer to the radiotap header we are walking through
1189 * @max_length: length of radiotap header in cpu byte ordering
1190 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
1191 * @this_arg: pointer to current radiotap arg
1192 * @arg_index: internal next argument index
1193 * @arg: internal next argument pointer
1194 * @next_bitmap: internal pointer to next present u32
1195 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1196 */
1197
1198struct ieee80211_radiotap_iterator {
1199 struct ieee80211_radiotap_header *rtheader;
1200 int max_length;
1201 int this_arg_index;
1202 u8 *this_arg;
1203
1204 int arg_index;
1205 u8 *arg;
1206 __le32 *next_bitmap;
1207 u32 bitmap_shifter;
1208};
1209
1210extern int ieee80211_radiotap_iterator_init(
1211 struct ieee80211_radiotap_iterator *iterator,
1212 struct ieee80211_radiotap_header *radiotap_header,
1213 int max_length);
1214
1215extern int ieee80211_radiotap_iterator_next(
1216 struct ieee80211_radiotap_iterator *iterator);
1217
1218/*
1219 * Regulatory helper functions for wiphys
1220 */
1221
1222/**
1223 * regulatory_hint - driver hint to the wireless core a regulatory domain
1224 * @wiphy: the wireless device giving the hint (used only for reporting
1225 * conflicts)
1226 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
1227 * should be in. If @rd is set this should be NULL. Note that if you
1228 * set this to NULL you should still set rd->alpha2 to some accepted
1229 * alpha2.
1230 *
1231 * Wireless drivers can use this function to hint to the wireless core
1232 * what it believes should be the current regulatory domain by
1233 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
1234 * domain should be in or by providing a completely build regulatory domain.
1235 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
1236 * for a regulatory domain structure for the respective country.
1237 *
1238 * The wiphy must have been registered to cfg80211 prior to this call.
1239 * For cfg80211 drivers this means you must first use wiphy_register(),
1240 * for mac80211 drivers you must first use ieee80211_register_hw().
1241 *
1242 * Drivers should check the return value, its possible you can get
1243 * an -ENOMEM.
1244 */
1245extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1246
1247/**
1248 * regulatory_hint_11d - hints a country IE as a regulatory domain
1249 * @wiphy: the wireless device giving the hint (used only for reporting
1250 * conflicts)
1251 * @country_ie: pointer to the country IE
1252 * @country_ie_len: length of the country IE
1253 *
1254 * We will intersect the rd with the what CRDA tells us should apply
1255 * for the alpha2 this country IE belongs to, this prevents APs from
1256 * sending us incorrect or outdated information against a country.
1257 */
1258extern void regulatory_hint_11d(struct wiphy *wiphy,
1259 u8 *country_ie,
1260 u8 country_ie_len);
1261/**
1262 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1263 * @wiphy: the wireless device we want to process the regulatory domain on
1264 * @regd: the custom regulatory domain to use for this wiphy
1265 *
1266 * Drivers can sometimes have custom regulatory domains which do not apply
1267 * to a specific country. Drivers can use this to apply such custom regulatory
1268 * domains. This routine must be called prior to wiphy registration. The
1269 * custom regulatory domain will be trusted completely and as such previous
1270 * default channel settings will be disregarded. If no rule is found for a
1271 * channel on the regulatory domain the channel will be disabled.
1272 */
1273extern void wiphy_apply_custom_regulatory(
1274 struct wiphy *wiphy,
1275 const struct ieee80211_regdomain *regd);
1276
1277/**
1278 * freq_reg_info - get regulatory information for the given frequency
1279 * @wiphy: the wiphy for which we want to process this rule for
1280 * @center_freq: Frequency in KHz for which we want regulatory information for
1281 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
1282 * you can set this to 0. If this frequency is allowed we then set
1283 * this value to the maximum allowed bandwidth.
1284 * @reg_rule: the regulatory rule which we have for this frequency
1285 *
1286 * Use this function to get the regulatory rule for a specific frequency on
1287 * a given wireless device. If the device has a specific regulatory domain
1288 * it wants to follow we respect that unless a country IE has been received
1289 * and processed already.
1290 *
1291 * Returns 0 if it was able to find a valid regulatory rule which does
1292 * apply to the given center_freq otherwise it returns non-zero. It will
1293 * also return -ERANGE if we determine the given center_freq does not even have
1294 * a regulatory rule for a frequency range in the center_freq's band. See
1295 * freq_in_rule_band() for our current definition of a band -- this is purely
1296 * subjective and right now its 802.11 specific.
1297 */
1298extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
1299 const struct ieee80211_reg_rule **reg_rule);
1300
1301/*
1302 * Temporary wext handlers & helper functions
1303 *
1304 * In the future cfg80211 will simply assign the entire wext handler
1305 * structure to netdevs it manages, but we're not there yet.
1306 */
857int cfg80211_wext_giwname(struct net_device *dev, 1307int cfg80211_wext_giwname(struct net_device *dev,
858 struct iw_request_info *info, 1308 struct iw_request_info *info,
859 char *name, char *extra); 1309 char *name, char *extra);
@@ -892,10 +1342,14 @@ int cfg80211_ibss_wext_giwap(struct net_device *dev,
892 struct iw_request_info *info, 1342 struct iw_request_info *info,
893 struct sockaddr *ap_addr, char *extra); 1343 struct sockaddr *ap_addr, char *extra);
894 1344
895/* wext helper for now (to be removed) */
896struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 1345struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
897 struct iw_freq *freq); 1346 struct iw_freq *freq);
898 1347
1348/*
1349 * callbacks for asynchronous cfg80211 methods, notification
1350 * functions and BSS handling helpers
1351 */
1352
899/** 1353/**
900 * cfg80211_scan_done - notify that scan finished 1354 * cfg80211_scan_done - notify that scan finished
901 * 1355 *
@@ -949,6 +1403,7 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
949 const u8 *meshid, size_t meshidlen, 1403 const u8 *meshid, size_t meshidlen,
950 const u8 *meshcfg); 1404 const u8 *meshcfg);
951void cfg80211_put_bss(struct cfg80211_bss *bss); 1405void cfg80211_put_bss(struct cfg80211_bss *bss);
1406
952/** 1407/**
953 * cfg80211_unlink_bss - unlink BSS from internal data structures 1408 * cfg80211_unlink_bss - unlink BSS from internal data structures
954 * @wiphy: the wiphy 1409 * @wiphy: the wiphy