|
||||
Warning, cross-references for /kernel/include/drivers/net/cfg80211.h need to be fixed.
0001 /* The Quest Operating System 0002 * Copyright (C) 2005-2010 Richard West, Boston University 0003 * 0004 * This program is free software: you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation, either version 3 of the License, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 /* Based on Linux */ 0019 0020 #ifndef __NET_CFG80211_H 0021 #define __NET_CFG80211_H 0022 /* 0023 * 802.11 device and configuration interface 0024 * 0025 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 0026 * 0027 * This program is free software; you can redistribute it and/or modify 0028 * it under the terms of the GNU General Public License version 2 as 0029 * published by the Free Software Foundation. 0030 */ 0031 0032 #if 0 0033 #include <linux/netdevice.h> 0034 #include <linux/debugfs.h> 0035 #include <linux/list.h> 0036 #include <linux/netlink.h> 0037 #include <linux/skbuff.h> 0038 #include <linux/nl80211.h> 0039 #include <linux/if_ether.h> 0040 #include <linux/ieee80211.h> 0041 #include <net/regulatory.h> 0042 0043 /* remove once we remove the wext stuff */ 0044 #include <net/iw_handler.h> 0045 #include <linux/wireless.h> 0046 #endif 0047 0048 #include <kernel.h> 0049 #include <drivers/net/ieee80211.h> 0050 #include <drivers/net/ethernet.h> 0051 0052 #if 0 0053 0054 /* 0055 * wireless hardware capability structures 0056 */ 0057 0058 /** 0059 * enum ieee80211_band - supported frequency bands 0060 * 0061 * The bands are assigned this way because the supported 0062 * bitrates differ in these bands. 0063 * 0064 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band 0065 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) 0066 */ 0067 enum ieee80211_band { 0068 IEEE80211_BAND_2GHZ, 0069 IEEE80211_BAND_5GHZ, 0070 0071 /* keep last */ 0072 IEEE80211_NUM_BANDS 0073 }; 0074 0075 /** 0076 * enum ieee80211_channel_flags - channel flags 0077 * 0078 * Channel flags set by the regulatory control code. 0079 * 0080 * @IEEE80211_CHAN_DISABLED: This channel is disabled. 0081 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted 0082 * on this channel. 0083 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. 0084 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. 0085 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel 0086 * is not permitted. 0087 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel 0088 * is not permitted. 0089 */ 0090 enum ieee80211_channel_flags { 0091 IEEE80211_CHAN_DISABLED = 1<<0, 0092 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, 0093 IEEE80211_CHAN_NO_IBSS = 1<<2, 0094 IEEE80211_CHAN_RADAR = 1<<3, 0095 IEEE80211_CHAN_NO_HT40PLUS = 1<<4, 0096 IEEE80211_CHAN_NO_HT40MINUS = 1<<5, 0097 }; 0098 0099 #define IEEE80211_CHAN_NO_HT40 \ 0100 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) 0101 0102 /** 0103 * struct ieee80211_channel - channel definition 0104 * 0105 * This structure describes a single channel for use 0106 * with cfg80211. 0107 * 0108 * @center_freq: center frequency in MHz 0109 * @hw_value: hardware-specific value for the channel 0110 * @flags: channel flags from &enum ieee80211_channel_flags. 0111 * @orig_flags: channel flags at registration time, used by regulatory 0112 * code to support devices with additional restrictions 0113 * @band: band this channel belongs to. 0114 * @max_antenna_gain: maximum antenna gain in dBi 0115 * @max_power: maximum transmission power (in dBm) 0116 * @beacon_found: helper to regulatory code to indicate when a beacon 0117 * has been found on this channel. Use regulatory_hint_found_beacon() 0118 * to enable this, this is is useful only on 5 GHz band. 0119 * @orig_mag: internal use 0120 * @orig_mpwr: internal use 0121 */ 0122 struct ieee80211_channel { 0123 enum ieee80211_band band; 0124 u16 center_freq; 0125 u16 hw_value; 0126 u32 flags; 0127 int max_antenna_gain; 0128 int max_power; 0129 bool beacon_found; 0130 u32 orig_flags; 0131 int orig_mag, orig_mpwr; 0132 }; 0133 0134 /** 0135 * enum ieee80211_rate_flags - rate flags 0136 * 0137 * Hardware/specification flags for rates. These are structured 0138 * in a way that allows using the same bitrate structure for 0139 * different bands/PHY modes. 0140 * 0141 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short 0142 * preamble on this bitrate; only relevant in 2.4GHz band and 0143 * with CCK rates. 0144 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate 0145 * when used with 802.11a (on the 5 GHz band); filled by the 0146 * core code when registering the wiphy. 0147 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate 0148 * when used with 802.11b (on the 2.4 GHz band); filled by the 0149 * core code when registering the wiphy. 0150 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate 0151 * when used with 802.11g (on the 2.4 GHz band); filled by the 0152 * core code when registering the wiphy. 0153 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. 0154 */ 0155 enum ieee80211_rate_flags { 0156 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, 0157 IEEE80211_RATE_MANDATORY_A = 1<<1, 0158 IEEE80211_RATE_MANDATORY_B = 1<<2, 0159 IEEE80211_RATE_MANDATORY_G = 1<<3, 0160 IEEE80211_RATE_ERP_G = 1<<4, 0161 }; 0162 0163 /** 0164 * struct ieee80211_rate - bitrate definition 0165 * 0166 * This structure describes a bitrate that an 802.11 PHY can 0167 * operate with. The two values @hw_value and @hw_value_short 0168 * are only for driver use when pointers to this structure are 0169 * passed around. 0170 * 0171 * @flags: rate-specific flags 0172 * @bitrate: bitrate in units of 100 Kbps 0173 * @hw_value: driver/hardware value for this rate 0174 * @hw_value_short: driver/hardware value for this rate when 0175 * short preamble is used 0176 */ 0177 struct ieee80211_rate { 0178 u32 flags; 0179 u16 bitrate; 0180 u16 hw_value, hw_value_short; 0181 }; 0182 0183 /** 0184 * struct ieee80211_sta_ht_cap - STA's HT capabilities 0185 * 0186 * This structure describes most essential parameters needed 0187 * to describe 802.11n HT capabilities for an STA. 0188 * 0189 * @ht_supported: is HT supported by the STA 0190 * @cap: HT capabilities map as described in 802.11n spec 0191 * @ampdu_factor: Maximum A-MPDU length factor 0192 * @ampdu_density: Minimum A-MPDU spacing 0193 * @mcs: Supported MCS rates 0194 */ 0195 struct ieee80211_sta_ht_cap { 0196 u16 cap; /* use IEEE80211_HT_CAP_ */ 0197 bool ht_supported; 0198 u8 ampdu_factor; 0199 u8 ampdu_density; 0200 //struct ieee80211_mcs_info mcs; 0201 }; 0202 0203 /** 0204 * struct ieee80211_supported_band - frequency band definition 0205 * 0206 * This structure describes a frequency band a wiphy 0207 * is able to operate in. 0208 * 0209 * @channels: Array of channels the hardware can operate in 0210 * in this band. 0211 * @band: the band this structure represents 0212 * @n_channels: Number of channels in @channels 0213 * @bitrates: Array of bitrates the hardware can operate with 0214 * in this band. Must be sorted to give a valid "supported 0215 * rates" IE, i.e. CCK rates first, then OFDM. 0216 * @n_bitrates: Number of bitrates in @bitrates 0217 */ 0218 struct ieee80211_supported_band { 0219 struct ieee80211_channel *channels; 0220 struct ieee80211_rate *bitrates; 0221 enum ieee80211_band band; 0222 int n_channels; 0223 int n_bitrates; 0224 struct ieee80211_sta_ht_cap ht_cap; 0225 }; 0226 0227 /* 0228 * Wireless hardware/device configuration structures and methods 0229 */ 0230 0231 /** 0232 * struct vif_params - describes virtual interface parameters 0233 * @mesh_id: mesh ID to use 0234 * @mesh_id_len: length of the mesh ID 0235 */ 0236 struct vif_params { 0237 u8 *mesh_id; 0238 int mesh_id_len; 0239 }; 0240 0241 /** 0242 * struct key_params - key information 0243 * 0244 * Information about a key 0245 * 0246 * @key: key material 0247 * @key_len: length of key material 0248 * @cipher: cipher suite selector 0249 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used 0250 * with the get_key() callback, must be in little endian, 0251 * length given by @seq_len. 0252 */ 0253 struct key_params { 0254 u8 *key; 0255 u8 *seq; 0256 int key_len; 0257 int seq_len; 0258 u32 cipher; 0259 }; 0260 0261 /** 0262 * struct beacon_parameters - beacon parameters 0263 * 0264 * Used to configure the beacon for an interface. 0265 * 0266 * @head: head portion of beacon (before TIM IE) 0267 * or %NULL if not changed 0268 * @tail: tail portion of beacon (after TIM IE) 0269 * or %NULL if not changed 0270 * @interval: beacon interval or zero if not changed 0271 * @dtim_period: DTIM period or zero if not changed 0272 * @head_len: length of @head 0273 * @tail_len: length of @tail 0274 */ 0275 struct beacon_parameters { 0276 u8 *head, *tail; 0277 int interval, dtim_period; 0278 int head_len, tail_len; 0279 }; 0280 0281 /** 0282 * enum plink_action - actions to perform in mesh peers 0283 * 0284 * @PLINK_ACTION_INVALID: action 0 is reserved 0285 * @PLINK_ACTION_OPEN: start mesh peer link establishment 0286 * @PLINK_ACTION_BLOCL: block traffic from this mesh peer 0287 */ 0288 enum plink_actions { 0289 PLINK_ACTION_INVALID, 0290 PLINK_ACTION_OPEN, 0291 PLINK_ACTION_BLOCK, 0292 }; 0293 0294 /** 0295 * struct station_parameters - station parameters 0296 * 0297 * Used to change and create a new station. 0298 * 0299 * @vlan: vlan interface station should belong to 0300 * @supported_rates: supported rates in IEEE 802.11 format 0301 * (or NULL for no change) 0302 * @supported_rates_len: number of supported rates 0303 * @sta_flags_mask: station flags that changed 0304 * (bitmask of BIT(NL80211_STA_FLAG_...)) 0305 * @sta_flags_set: station flags values 0306 * (bitmask of BIT(NL80211_STA_FLAG_...)) 0307 * @listen_interval: listen interval or -1 for no change 0308 * @aid: AID or zero for no change 0309 */ 0310 struct station_parameters { 0311 u8 *supported_rates; 0312 struct net_device *vlan; 0313 u32 sta_flags_mask, sta_flags_set; 0314 int listen_interval; 0315 u16 aid; 0316 u8 supported_rates_len; 0317 u8 plink_action; 0318 struct ieee80211_ht_cap *ht_capa; 0319 }; 0320 0321 /** 0322 * enum station_info_flags - station information flags 0323 * 0324 * Used by the driver to indicate which info in &struct station_info 0325 * it has filled in during get_station() or dump_station(). 0326 * 0327 * @STATION_INFO_INACTIVE_TIME: @inactive_time filled 0328 * @STATION_INFO_RX_BYTES: @rx_bytes filled 0329 * @STATION_INFO_TX_BYTES: @tx_bytes filled 0330 * @STATION_INFO_LLID: @llid filled 0331 * @STATION_INFO_PLID: @plid filled 0332 * @STATION_INFO_PLINK_STATE: @plink_state filled 0333 * @STATION_INFO_SIGNAL: @signal filled 0334 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 0335 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 0336 * @STATION_INFO_RX_PACKETS: @rx_packets filled 0337 * @STATION_INFO_TX_PACKETS: @tx_packets filled 0338 */ 0339 enum station_info_flags { 0340 STATION_INFO_INACTIVE_TIME = 1<<0, 0341 STATION_INFO_RX_BYTES = 1<<1, 0342 STATION_INFO_TX_BYTES = 1<<2, 0343 STATION_INFO_LLID = 1<<3, 0344 STATION_INFO_PLID = 1<<4, 0345 STATION_INFO_PLINK_STATE = 1<<5, 0346 STATION_INFO_SIGNAL = 1<<6, 0347 STATION_INFO_TX_BITRATE = 1<<7, 0348 STATION_INFO_RX_PACKETS = 1<<8, 0349 STATION_INFO_TX_PACKETS = 1<<9, 0350 }; 0351 0352 /** 0353 * enum station_info_rate_flags - bitrate info flags 0354 * 0355 * Used by the driver to indicate the specific rate transmission 0356 * type for 802.11n transmissions. 0357 * 0358 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled 0359 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission 0360 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval 0361 */ 0362 enum rate_info_flags { 0363 RATE_INFO_FLAGS_MCS = 1<<0, 0364 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, 0365 RATE_INFO_FLAGS_SHORT_GI = 1<<2, 0366 }; 0367 0368 /** 0369 * struct rate_info - bitrate information 0370 * 0371 * Information about a receiving or transmitting bitrate 0372 * 0373 * @flags: bitflag of flags from &enum rate_info_flags 0374 * @mcs: mcs index if struct describes a 802.11n bitrate 0375 * @legacy: bitrate in 100kbit/s for 802.11abg 0376 */ 0377 struct rate_info { 0378 u8 flags; 0379 u8 mcs; 0380 u16 legacy; 0381 }; 0382 0383 /** 0384 * struct station_info - station information 0385 * 0386 * Station information filled by driver for get_station() and dump_station. 0387 * 0388 * @filled: bitflag of flags from &enum station_info_flags 0389 * @inactive_time: time since last station activity (tx/rx) in milliseconds 0390 * @rx_bytes: bytes received from this station 0391 * @tx_bytes: bytes transmitted to this station 0392 * @llid: mesh local link id 0393 * @plid: mesh peer link id 0394 * @plink_state: mesh peer link state 0395 * @signal: signal strength of last received packet in dBm 0396 * @txrate: current unicast bitrate to this station 0397 * @rx_packets: packets received from this station 0398 * @tx_packets: packets transmitted to this station 0399 * @generation: generation number for nl80211 dumps. 0400 * This number should increase every time the list of stations 0401 * changes, i.e. when a station is added or removed, so that 0402 * userspace can tell whether it got a consistent snapshot. 0403 */ 0404 struct station_info { 0405 u32 filled; 0406 u32 inactive_time; 0407 u32 rx_bytes; 0408 u32 tx_bytes; 0409 u16 llid; 0410 u16 plid; 0411 u8 plink_state; 0412 s8 signal; 0413 struct rate_info txrate; 0414 u32 rx_packets; 0415 u32 tx_packets; 0416 0417 int generation; 0418 }; 0419 0420 /** 0421 * enum monitor_flags - monitor flags 0422 * 0423 * Monitor interface configuration flags. Note that these must be the bits 0424 * according to the nl80211 flags. 0425 * 0426 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS 0427 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP 0428 * @MONITOR_FLAG_CONTROL: pass control frames 0429 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering 0430 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing 0431 */ 0432 enum monitor_flags { 0433 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, 0434 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, 0435 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, 0436 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, 0437 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, 0438 }; 0439 0440 /** 0441 * enum mpath_info_flags - mesh path information flags 0442 * 0443 * Used by the driver to indicate which info in &struct mpath_info it has filled 0444 * in during get_station() or dump_station(). 0445 * 0446 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled 0447 * MPATH_INFO_DSN: @dsn filled 0448 * MPATH_INFO_METRIC: @metric filled 0449 * MPATH_INFO_EXPTIME: @exptime filled 0450 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled 0451 * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled 0452 * MPATH_INFO_FLAGS: @flags filled 0453 */ 0454 enum mpath_info_flags { 0455 MPATH_INFO_FRAME_QLEN = BIT(0), 0456 MPATH_INFO_DSN = BIT(1), 0457 MPATH_INFO_METRIC = BIT(2), 0458 MPATH_INFO_EXPTIME = BIT(3), 0459 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), 0460 MPATH_INFO_DISCOVERY_RETRIES = BIT(5), 0461 MPATH_INFO_FLAGS = BIT(6), 0462 }; 0463 0464 /** 0465 * struct mpath_info - mesh path information 0466 * 0467 * Mesh path information filled by driver for get_mpath() and dump_mpath(). 0468 * 0469 * @filled: bitfield of flags from &enum mpath_info_flags 0470 * @frame_qlen: number of queued frames for this destination 0471 * @dsn: destination sequence number 0472 * @metric: metric (cost) of this mesh path 0473 * @exptime: expiration time for the mesh path from now, in msecs 0474 * @flags: mesh path flags 0475 * @discovery_timeout: total mesh path discovery timeout, in msecs 0476 * @discovery_retries: mesh path discovery retries 0477 * @generation: generation number for nl80211 dumps. 0478 * This number should increase every time the list of mesh paths 0479 * changes, i.e. when a station is added or removed, so that 0480 * userspace can tell whether it got a consistent snapshot. 0481 */ 0482 struct mpath_info { 0483 u32 filled; 0484 u32 frame_qlen; 0485 u32 dsn; 0486 u32 metric; 0487 u32 exptime; 0488 u32 discovery_timeout; 0489 u8 discovery_retries; 0490 u8 flags; 0491 0492 int generation; 0493 }; 0494 0495 /** 0496 * struct bss_parameters - BSS parameters 0497 * 0498 * Used to change BSS parameters (mainly for AP mode). 0499 * 0500 * @use_cts_prot: Whether to use CTS protection 0501 * (0 = no, 1 = yes, -1 = do not change) 0502 * @use_short_preamble: Whether the use of short preambles is allowed 0503 * (0 = no, 1 = yes, -1 = do not change) 0504 * @use_short_slot_time: Whether the use of short slot time is allowed 0505 * (0 = no, 1 = yes, -1 = do not change) 0506 * @basic_rates: basic rates in IEEE 802.11 format 0507 * (or NULL for no change) 0508 * @basic_rates_len: number of basic rates 0509 */ 0510 struct bss_parameters { 0511 int use_cts_prot; 0512 int use_short_preamble; 0513 int use_short_slot_time; 0514 u8 *basic_rates; 0515 u8 basic_rates_len; 0516 }; 0517 0518 struct mesh_config { 0519 /* Timeouts in ms */ 0520 /* Mesh plink management parameters */ 0521 u16 dot11MeshRetryTimeout; 0522 u16 dot11MeshConfirmTimeout; 0523 u16 dot11MeshHoldingTimeout; 0524 u16 dot11MeshMaxPeerLinks; 0525 u8 dot11MeshMaxRetries; 0526 u8 dot11MeshTTL; 0527 bool auto_open_plinks; 0528 /* HWMP parameters */ 0529 u8 dot11MeshHWMPmaxPREQretries; 0530 u32 path_refresh_time; 0531 u16 min_discovery_timeout; 0532 u32 dot11MeshHWMPactivePathTimeout; 0533 u16 dot11MeshHWMPpreqMinInterval; 0534 u16 dot11MeshHWMPnetDiameterTraversalTime; 0535 }; 0536 0537 /** 0538 * struct ieee80211_txq_params - TX queue parameters 0539 * @queue: TX queue identifier (NL80211_TXQ_Q_*) 0540 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 0541 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 0542 * 1..32767] 0543 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range 0544 * 1..32767] 0545 * @aifs: Arbitration interframe space [0..255] 0546 */ 0547 struct ieee80211_txq_params { 0548 enum nl80211_txq_q queue; 0549 u16 txop; 0550 u16 cwmin; 0551 u16 cwmax; 0552 u8 aifs; 0553 }; 0554 0555 /* from net/wireless.h */ 0556 struct wiphy; 0557 0558 /* from net/ieee80211.h */ 0559 struct ieee80211_channel; 0560 0561 /** 0562 * struct cfg80211_ssid - SSID description 0563 * @ssid: the SSID 0564 * @ssid_len: length of the ssid 0565 */ 0566 struct cfg80211_ssid { 0567 u8 ssid[IEEE80211_MAX_SSID_LEN]; 0568 u8 ssid_len; 0569 }; 0570 0571 /** 0572 * struct cfg80211_scan_request - scan request description 0573 * 0574 * @ssids: SSIDs to scan for (active scan only) 0575 * @n_ssids: number of SSIDs 0576 * @channels: channels to scan on. 0577 * @n_channels: total number of channels to scan 0578 * @ie: optional information element(s) to add into Probe Request or %NULL 0579 * @ie_len: length of ie in octets 0580 * @wiphy: the wiphy this was for 0581 * @dev: the interface 0582 */ 0583 struct cfg80211_scan_request { 0584 struct cfg80211_ssid *ssids; 0585 int n_ssids; 0586 u32 n_channels; 0587 const u8 *ie; 0588 size_t ie_len; 0589 0590 /* internal */ 0591 struct wiphy *wiphy; 0592 struct net_device *dev; 0593 bool aborted; 0594 0595 /* keep last */ 0596 struct ieee80211_channel *channels[0]; 0597 }; 0598 0599 #endif 0600 0601 /** 0602 * enum cfg80211_signal_type - signal type 0603 * 0604 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available 0605 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) 0606 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 0607 */ 0608 enum cfg80211_signal_type { 0609 CFG80211_SIGNAL_TYPE_NONE, 0610 CFG80211_SIGNAL_TYPE_MBM, 0611 CFG80211_SIGNAL_TYPE_UNSPEC, 0612 }; 0613 0614 #if 0 0615 0616 /** 0617 * struct cfg80211_bss - BSS description 0618 * 0619 * This structure describes a BSS (which may also be a mesh network) 0620 * for use in scan results and similar. 0621 * 0622 * @bssid: BSSID of the BSS 0623 * @tsf: timestamp of last received update 0624 * @beacon_interval: the beacon interval as from the frame 0625 * @capability: the capability field in host byte order 0626 * @information_elements: the information elements (Note that there 0627 * is no guarantee that these are well-formed!) 0628 * @len_information_elements: total length of the information elements 0629 * @signal: signal strength value (type depends on the wiphy's signal_type) 0630 * @free_priv: function pointer to free private data 0631 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes 0632 */ 0633 struct cfg80211_bss { 0634 struct ieee80211_channel *channel; 0635 0636 u8 bssid[ETH_ALEN]; 0637 u64 tsf; 0638 u16 beacon_interval; 0639 u16 capability; 0640 u8 *information_elements; 0641 size_t len_information_elements; 0642 0643 s32 signal; 0644 0645 void (*free_priv)(struct cfg80211_bss *bss); 0646 u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); 0647 }; 0648 0649 /** 0650 * ieee80211_bss_get_ie - find IE with given ID 0651 * @bss: the bss to search 0652 * @ie: the IE ID 0653 * Returns %NULL if not found. 0654 */ 0655 const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); 0656 0657 0658 /** 0659 * struct cfg80211_crypto_settings - Crypto settings 0660 * @wpa_versions: indicates which, if any, WPA versions are enabled 0661 * (from enum nl80211_wpa_versions) 0662 * @cipher_group: group key cipher suite (or 0 if unset) 0663 * @n_ciphers_pairwise: number of AP supported unicast ciphers 0664 * @ciphers_pairwise: unicast key cipher suites 0665 * @n_akm_suites: number of AKM suites 0666 * @akm_suites: AKM suites 0667 * @control_port: Whether user space controls IEEE 802.1X port, i.e., 0668 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 0669 * required to assume that the port is unauthorized until authorized by 0670 * user space. Otherwise, port is marked authorized by default. 0671 */ 0672 struct cfg80211_crypto_settings { 0673 u32 wpa_versions; 0674 u32 cipher_group; 0675 int n_ciphers_pairwise; 0676 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; 0677 int n_akm_suites; 0678 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; 0679 bool control_port; 0680 }; 0681 0682 /** 0683 * struct cfg80211_auth_request - Authentication request data 0684 * 0685 * This structure provides information needed to complete IEEE 802.11 0686 * authentication. 0687 * 0688 * @bss: The BSS to authenticate with. 0689 * @auth_type: Authentication type (algorithm) 0690 * @ie: Extra IEs to add to Authentication frame or %NULL 0691 * @ie_len: Length of ie buffer in octets 0692 * @key_len: length of WEP key for shared key authentication 0693 * @key_idx: index of WEP key for shared key authentication 0694 * @key: WEP key for shared key authentication 0695 */ 0696 struct cfg80211_auth_request { 0697 struct cfg80211_bss *bss; 0698 const u8 *ie; 0699 size_t ie_len; 0700 enum nl80211_auth_type auth_type; 0701 const u8 *key; 0702 u8 key_len, key_idx; 0703 }; 0704 0705 /** 0706 * struct cfg80211_assoc_request - (Re)Association request data 0707 * 0708 * This structure provides information needed to complete IEEE 802.11 0709 * (re)association. 0710 * @bss: The BSS to associate with. 0711 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 0712 * @ie_len: Length of ie buffer in octets 0713 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 0714 * @crypto: crypto settings 0715 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame 0716 */ 0717 struct cfg80211_assoc_request { 0718 struct cfg80211_bss *bss; 0719 const u8 *ie, *prev_bssid; 0720 size_t ie_len; 0721 struct cfg80211_crypto_settings crypto; 0722 bool use_mfp; 0723 }; 0724 0725 /** 0726 * struct cfg80211_deauth_request - Deauthentication request data 0727 * 0728 * This structure provides information needed to complete IEEE 802.11 0729 * deauthentication. 0730 * 0731 * @bss: the BSS to deauthenticate from 0732 * @ie: Extra IEs to add to Deauthentication frame or %NULL 0733 * @ie_len: Length of ie buffer in octets 0734 * @reason_code: The reason code for the deauthentication 0735 */ 0736 struct cfg80211_deauth_request { 0737 struct cfg80211_bss *bss; 0738 const u8 *ie; 0739 size_t ie_len; 0740 u16 reason_code; 0741 }; 0742 0743 /** 0744 * struct cfg80211_disassoc_request - Disassociation request data 0745 * 0746 * This structure provides information needed to complete IEEE 802.11 0747 * disassocation. 0748 * 0749 * @bss: the BSS to disassociate from 0750 * @ie: Extra IEs to add to Disassociation frame or %NULL 0751 * @ie_len: Length of ie buffer in octets 0752 * @reason_code: The reason code for the disassociation 0753 */ 0754 struct cfg80211_disassoc_request { 0755 struct cfg80211_bss *bss; 0756 const u8 *ie; 0757 size_t ie_len; 0758 u16 reason_code; 0759 }; 0760 0761 /** 0762 * struct cfg80211_ibss_params - IBSS parameters 0763 * 0764 * This structure defines the IBSS parameters for the join_ibss() 0765 * method. 0766 * 0767 * @ssid: The SSID, will always be non-null. 0768 * @ssid_len: The length of the SSID, will always be non-zero. 0769 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 0770 * search for IBSSs with a different BSSID. 0771 * @channel: The channel to use if no IBSS can be found to join. 0772 * @channel_fixed: The channel should be fixed -- do not search for 0773 * IBSSs to join on other channels. 0774 * @ie: information element(s) to include in the beacon 0775 * @ie_len: length of that 0776 * @beacon_interval: beacon interval to use 0777 * @privacy: this is a protected network, keys will be configured 0778 * after joining 0779 */ 0780 struct cfg80211_ibss_params { 0781 u8 *ssid; 0782 u8 *bssid; 0783 struct ieee80211_channel *channel; 0784 u8 *ie; 0785 u8 ssid_len, ie_len; 0786 u16 beacon_interval; 0787 bool channel_fixed; 0788 bool privacy; 0789 }; 0790 0791 /** 0792 * struct cfg80211_connect_params - Connection parameters 0793 * 0794 * This structure provides information needed to complete IEEE 802.11 0795 * authentication and association. 0796 * 0797 * @channel: The channel to use or %NULL if not specified (auto-select based 0798 * on scan results) 0799 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 0800 * results) 0801 * @ssid: SSID 0802 * @ssid_len: Length of ssid in octets 0803 * @auth_type: Authentication type (algorithm) 0804 * @assoc_ie: IEs for association request 0805 * @assoc_ie_len: Length of assoc_ie in octets 0806 * @privacy: indicates whether privacy-enabled APs should be used 0807 * @crypto: crypto settings 0808 * @key_len: length of WEP key for shared key authentication 0809 * @key_idx: index of WEP key for shared key authentication 0810 * @key: WEP key for shared key authentication 0811 */ 0812 struct cfg80211_connect_params { 0813 struct ieee80211_channel *channel; 0814 u8 *bssid; 0815 u8 *ssid; 0816 size_t ssid_len; 0817 enum nl80211_auth_type auth_type; 0818 u8 *ie; 0819 size_t ie_len; 0820 bool privacy; 0821 struct cfg80211_crypto_settings crypto; 0822 const u8 *key; 0823 u8 key_len, key_idx; 0824 }; 0825 0826 /** 0827 * enum wiphy_params_flags - set_wiphy_params bitfield values 0828 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed 0829 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed 0830 * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed 0831 * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed 0832 */ 0833 enum wiphy_params_flags { 0834 WIPHY_PARAM_RETRY_SHORT = 1 << 0, 0835 WIPHY_PARAM_RETRY_LONG = 1 << 1, 0836 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, 0837 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, 0838 }; 0839 0840 /** 0841 * enum tx_power_setting - TX power adjustment 0842 * 0843 * @TX_POWER_AUTOMATIC: the dbm parameter is ignored 0844 * @TX_POWER_LIMITED: limit TX power by the dbm parameter 0845 * @TX_POWER_FIXED: fix TX power to the dbm parameter 0846 */ 0847 enum tx_power_setting { 0848 TX_POWER_AUTOMATIC, 0849 TX_POWER_LIMITED, 0850 TX_POWER_FIXED, 0851 }; 0852 0853 /* 0854 * cfg80211_bitrate_mask - masks for bitrate control 0855 */ 0856 struct cfg80211_bitrate_mask { 0857 /* 0858 * As discussed in Berlin, this struct really 0859 * should look like this: 0860 0861 struct { 0862 u32 legacy; 0863 u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; 0864 } control[IEEE80211_NUM_BANDS]; 0865 0866 * Since we can always fix in-kernel users, let's keep 0867 * it simpler for now: 0868 */ 0869 u32 fixed; /* fixed bitrate, 0 == not fixed */ 0870 u32 maxrate; /* in kbps, 0 == no limit */ 0871 }; 0872 0873 /** 0874 * struct cfg80211_ops - backend description for wireless configuration 0875 * 0876 * This struct is registered by fullmac card drivers and/or wireless stacks 0877 * in order to handle configuration requests on their interfaces. 0878 * 0879 * All callbacks except where otherwise noted should return 0 0880 * on success or a negative error code. 0881 * 0882 * All operations are currently invoked under rtnl for consistency with the 0883 * wireless extensions but this is subject to reevaluation as soon as this 0884 * code is used more widely and we have a first user without wext. 0885 * 0886 * @suspend: wiphy device needs to be suspended 0887 * @resume: wiphy device needs to be resumed 0888 * 0889 * @add_virtual_intf: create a new virtual interface with the given name, 0890 * must set the struct wireless_dev's iftype. Beware: You must create 0891 * the new netdev in the wiphy's network namespace! 0892 * 0893 * @del_virtual_intf: remove the virtual interface determined by ifindex. 0894 * 0895 * @change_virtual_intf: change type/configuration of virtual interface, 0896 * keep the struct wireless_dev's iftype updated. 0897 * 0898 * @add_key: add a key with the given parameters. @mac_addr will be %NULL 0899 * when adding a group key. 0900 * 0901 * @get_key: get information about the key with the given parameters. 0902 * @mac_addr will be %NULL when requesting information for a group 0903 * key. All pointers given to the @callback function need not be valid 0904 * after it returns. This function should return an error if it is 0905 * not possible to retrieve the key, -ENOENT if it doesn't exist. 0906 * 0907 * @del_key: remove a key given the @mac_addr (%NULL for a group key) 0908 * and @key_index, return -ENOENT if the key doesn't exist. 0909 * 0910 * @set_default_key: set the default key on an interface 0911 * 0912 * @set_default_mgmt_key: set the default management frame key on an interface 0913 * 0914 * @add_beacon: Add a beacon with given parameters, @head, @interval 0915 * and @dtim_period will be valid, @tail is optional. 0916 * @set_beacon: Change the beacon parameters for an access point mode 0917 * interface. This should reject the call when no beacon has been 0918 * configured. 0919 * @del_beacon: Remove beacon configuration and stop sending the beacon. 0920 * 0921 * @add_station: Add a new station. 0922 * 0923 * @del_station: Remove a station; @mac may be NULL to remove all stations. 0924 * 0925 * @change_station: Modify a given station. 0926 * 0927 * @get_mesh_params: Put the current mesh parameters into *params 0928 * 0929 * @set_mesh_params: Set mesh parameters. 0930 * The mask is a bitfield which tells us which parameters to 0931 * set, and which to leave alone. 0932 * 0933 * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 0934 * 0935 * @change_bss: Modify parameters for a given BSS. 0936 * 0937 * @set_txq_params: Set TX queue parameters 0938 * 0939 * @set_channel: Set channel 0940 * 0941 * @scan: Request to do a scan. If returning zero, the scan request is given 0942 * the driver, and will be valid until passed to cfg80211_scan_done(). 0943 * For scan results, call cfg80211_inform_bss(); you can call this outside 0944 * the scan/scan_done bracket too. 0945 * 0946 * @auth: Request to authenticate with the specified peer 0947 * @assoc: Request to (re)associate with the specified peer 0948 * @deauth: Request to deauthenticate from the specified peer 0949 * @disassoc: Request to disassociate from the specified peer 0950 * 0951 * @connect: Connect to the ESS with the specified parameters. When connected, 0952 * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. 0953 * If the connection fails for some reason, call cfg80211_connect_result() 0954 * with the status from the AP. 0955 * @disconnect: Disconnect from the BSS/ESS. 0956 * 0957 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call 0958 * cfg80211_ibss_joined(), also call that function when changing BSSID due 0959 * to a merge. 0960 * @leave_ibss: Leave the IBSS. 0961 * 0962 * @set_wiphy_params: Notify that wiphy parameters have changed; 0963 * @changed bitfield (see &enum wiphy_params_flags) describes which values 0964 * have changed. The actual parameter values are available in 0965 * struct wiphy. If returning an error, no value should be changed. 0966 * 0967 * @set_tx_power: set the transmit power according to the parameters 0968 * @get_tx_power: store the current TX power into the dbm variable; 0969 * return 0 if successful 0970 * 0971 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting 0972 * functions to adjust rfkill hw state 0973 * 0974 * @testmode_cmd: run a test mode command 0975 */ 0976 struct cfg80211_ops { 0977 int (*suspend)(struct wiphy *wiphy); 0978 int (*resume)(struct wiphy *wiphy); 0979 0980 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 0981 enum nl80211_iftype type, u32 *flags, 0982 struct vif_params *params); 0983 int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); 0984 int (*change_virtual_intf)(struct wiphy *wiphy, 0985 struct net_device *dev, 0986 enum nl80211_iftype type, u32 *flags, 0987 struct vif_params *params); 0988 0989 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 0990 u8 key_index, const u8 *mac_addr, 0991 struct key_params *params); 0992 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 0993 u8 key_index, const u8 *mac_addr, void *cookie, 0994 void (*callback)(void *cookie, struct key_params*)); 0995 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 0996 u8 key_index, const u8 *mac_addr); 0997 int (*set_default_key)(struct wiphy *wiphy, 0998 struct net_device *netdev, 0999 u8 key_index); 1000 int (*set_default_mgmt_key)(struct wiphy *wiphy, 1001 struct net_device *netdev, 1002 u8 key_index); 1003 1004 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, 1005 struct beacon_parameters *info); 1006 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, 1007 struct beacon_parameters *info); 1008 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); 1009 1010 1011 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 1012 u8 *mac, struct station_parameters *params); 1013 int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 1014 u8 *mac); 1015 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 1016 u8 *mac, struct station_parameters *params); 1017 int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 1018 u8 *mac, struct station_info *sinfo); 1019 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 1020 int idx, u8 *mac, struct station_info *sinfo); 1021 1022 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 1023 u8 *dst, u8 *next_hop); 1024 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 1025 u8 *dst); 1026 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 1027 u8 *dst, u8 *next_hop); 1028 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 1029 u8 *dst, u8 *next_hop, 1030 struct mpath_info *pinfo); 1031 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 1032 int idx, u8 *dst, u8 *next_hop, 1033 struct mpath_info *pinfo); 1034 int (*get_mesh_params)(struct wiphy *wiphy, 1035 struct net_device *dev, 1036 struct mesh_config *conf); 1037 int (*set_mesh_params)(struct wiphy *wiphy, 1038 struct net_device *dev, 1039 const struct mesh_config *nconf, u32 mask); 1040 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, 1041 struct bss_parameters *params); 1042 1043 int (*set_txq_params)(struct wiphy *wiphy, 1044 struct ieee80211_txq_params *params); 1045 1046 int (*set_channel)(struct wiphy *wiphy, 1047 struct ieee80211_channel *chan, 1048 enum nl80211_channel_type channel_type); 1049 1050 int (*scan)(struct wiphy *wiphy, struct net_device *dev, 1051 struct cfg80211_scan_request *request); 1052 1053 int (*auth)(struct wiphy *wiphy, struct net_device *dev, 1054 struct cfg80211_auth_request *req); 1055 int (*assoc)(struct wiphy *wiphy, struct net_device *dev, 1056 struct cfg80211_assoc_request *req); 1057 int (*deauth)(struct wiphy *wiphy, struct net_device *dev, 1058 struct cfg80211_deauth_request *req, 1059 void *cookie); 1060 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 1061 struct cfg80211_disassoc_request *req, 1062 void *cookie); 1063 1064 int (*connect)(struct wiphy *wiphy, struct net_device *dev, 1065 struct cfg80211_connect_params *sme); 1066 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, 1067 u16 reason_code); 1068 1069 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, 1070 struct cfg80211_ibss_params *params); 1071 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); 1072 1073 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); 1074 1075 int (*set_tx_power)(struct wiphy *wiphy, 1076 enum tx_power_setting type, int dbm); 1077 int (*get_tx_power)(struct wiphy *wiphy, int *dbm); 1078 1079 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, 1080 u8 *addr); 1081 1082 void (*rfkill_poll)(struct wiphy *wiphy); 1083 1084 #ifdef CONFIG_NL80211_TESTMODE 1085 int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); 1086 #endif 1087 1088 int (*set_bitrate_mask)(struct wiphy *wiphy, 1089 struct net_device *dev, 1090 const u8 *peer, 1091 const struct cfg80211_bitrate_mask *mask); 1092 1093 /* some temporary stuff to finish wext */ 1094 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1095 bool enabled, int timeout); 1096 }; 1097 1098 #endif 1099 1100 /* 1101 * wireless hardware and networking interfaces structures 1102 * and registration/helper functions 1103 */ 1104 1105 /** 1106 * struct wiphy - wireless hardware description 1107 * @idx: the wiphy index assigned to this item 1108 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 1109 * @custom_regulatory: tells us the driver for this device 1110 * has its own custom regulatory domain and cannot identify the 1111 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled 1112 * we will disregard the first regulatory hint (when the 1113 * initiator is %REGDOM_SET_BY_CORE). 1114 * @strict_regulatory: tells us the driver for this device will ignore 1115 * regulatory domain settings until it gets its own regulatory domain 1116 * via its regulatory_hint(). After its gets its own regulatory domain 1117 * it will only allow further regulatory domain settings to further 1118 * enhance compliance. For example if channel 13 and 14 are disabled 1119 * by this regulatory domain no user regulatory domain can enable these 1120 * channels at a later time. This can be used for devices which do not 1121 * have calibration information gauranteed for frequencies or settings 1122 * outside of its regulatory domain. 1123 * @disable_beacon_hints: enable this if your driver needs to ensure that 1124 * passive scan flags and beaconing flags may not be lifted by cfg80211 1125 * due to regulatory beacon hints. For more information on beacon 1126 * hints read the documenation for regulatory_hint_found_beacon() 1127 * @reg_notifier: the driver's regulatory notification callback 1128 * @regd: the driver's regulatory domain, if one was requested via 1129 * the regulatory_hint() API. This can be used by the driver 1130 * on the reg_notifier() if it chooses to ignore future 1131 * regulatory domain changes caused by other drivers. 1132 * @signal_type: signal type reported in &struct cfg80211_bss. 1133 * @cipher_suites: supported cipher suites 1134 * @n_cipher_suites: number of supported cipher suites 1135 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) 1136 * @retry_long: Retry limit for long frames (dot11LongRetryLimit) 1137 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); 1138 * -1 = fragmentation disabled, only odd values >= 256 used 1139 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled 1140 * @net: the network namespace this wiphy currently lives in 1141 * @netnsok: if set to false, do not allow changing the netns of this 1142 * wiphy at all 1143 * @ps_default: default for powersave, will be set depending on the 1144 * kernel's default on wiphy_new(), but can be changed by the 1145 * driver if it has a good reason to override the default 1146 */ 1147 struct wiphy { 1148 /* assign these fields before you register the wiphy */ 1149 1150 /* permanent MAC address */ 1151 u8 perm_addr[ETH_ADDR_LEN]; 1152 1153 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ 1154 u16 interface_modes; 1155 1156 bool custom_regulatory; 1157 bool strict_regulatory; 1158 bool disable_beacon_hints; 1159 1160 bool netnsok; 1161 bool ps_default; 1162 1163 enum cfg80211_signal_type signal_type; 1164 1165 int bss_priv_size; 1166 u8 max_scan_ssids; 1167 u16 max_scan_ie_len; 1168 1169 int n_cipher_suites; 1170 const u32 *cipher_suites; 1171 1172 u8 retry_short; 1173 u8 retry_long; 1174 u32 frag_threshold; 1175 u32 rts_threshold; 1176 1177 /* If multiple wiphys are registered and you're handed e.g. 1178 * a regular netdev with assigned ieee80211_ptr, you won't 1179 * know whether it points to a wiphy your driver has registered 1180 * or not. Assign this to something global to your driver to 1181 * help determine whether you own this wiphy or not. */ 1182 const void *privid; 1183 1184 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 1185 1186 /* Lets us get back the wiphy on the callback */ 1187 #if 0 1188 int (*reg_notifier)(struct wiphy *wiphy, 1189 struct regulatory_request *request); 1190 #endif 1191 1192 /* fields below are read-only, assigned by cfg80211 */ 1193 1194 const struct ieee80211_regdomain *regd; 1195 1196 /* the item in /sys/class/ieee80211/ points to this, 1197 * you need use set_wiphy_dev() (see below) */ 1198 //struct device dev; 1199 1200 /* dir in debugfs: ieee80211/<wiphyname> */ 1201 struct dentry *debugfsdir; 1202 1203 #ifdef CONFIG_NET_NS 1204 /* the network namespace this phy lives in currently */ 1205 struct net *_net; 1206 #endif 1207 1208 char priv[0] ALIGNED(32); 1209 }; 1210 1211 #if 0 1212 1213 #ifdef CONFIG_NET_NS 1214 static inline struct net *wiphy_net(struct wiphy *wiphy) 1215 { 1216 return wiphy->_net; 1217 } 1218 1219 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1220 { 1221 wiphy->_net = net; 1222 } 1223 #else 1224 static inline struct net *wiphy_net(struct wiphy *wiphy) 1225 { 1226 return &init_net; 1227 } 1228 1229 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) 1230 { 1231 } 1232 #endif 1233 1234 /** 1235 * wiphy_priv - return priv from wiphy 1236 * 1237 * @wiphy: the wiphy whose priv pointer to return 1238 */ 1239 static inline void *wiphy_priv(struct wiphy *wiphy) 1240 { 1241 BUG_ON(!wiphy); 1242 return &wiphy->priv; 1243 } 1244 1245 /** 1246 * priv_to_wiphy - return the wiphy containing the priv 1247 * 1248 * @priv: a pointer previously returned by wiphy_priv 1249 */ 1250 static inline struct wiphy *priv_to_wiphy(void *priv) 1251 { 1252 BUG_ON(!priv); 1253 return container_of(priv, struct wiphy, priv); 1254 } 1255 1256 /** 1257 * set_wiphy_dev - set device pointer for wiphy 1258 * 1259 * @wiphy: The wiphy whose device to bind 1260 * @dev: The device to parent it to 1261 */ 1262 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1263 { 1264 wiphy->dev.parent = dev; 1265 } 1266 1267 /** 1268 * wiphy_dev - get wiphy dev pointer 1269 * 1270 * @wiphy: The wiphy whose device struct to look up 1271 */ 1272 static inline struct device *wiphy_dev(struct wiphy *wiphy) 1273 { 1274 return wiphy->dev.parent; 1275 } 1276 1277 /** 1278 * wiphy_name - get wiphy name 1279 * 1280 * @wiphy: The wiphy whose name to return 1281 */ 1282 static inline const char *wiphy_name(struct wiphy *wiphy) 1283 { 1284 return dev_name(&wiphy->dev); 1285 } 1286 1287 /** 1288 * wiphy_new - create a new wiphy for use with cfg80211 1289 * 1290 * @ops: The configuration operations for this device 1291 * @sizeof_priv: The size of the private area to allocate 1292 * 1293 * Create a new wiphy and associate the given operations with it. 1294 * @sizeof_priv bytes are allocated for private use. 1295 * 1296 * The returned pointer must be assigned to each netdev's 1297 * ieee80211_ptr for proper operation. 1298 */ 1299 struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); 1300 1301 /** 1302 * wiphy_register - register a wiphy with cfg80211 1303 * 1304 * @wiphy: The wiphy to register. 1305 * 1306 * Returns a non-negative wiphy index or a negative error code. 1307 */ 1308 extern int wiphy_register(struct wiphy *wiphy); 1309 1310 /** 1311 * wiphy_unregister - deregister a wiphy from cfg80211 1312 * 1313 * @wiphy: The wiphy to unregister. 1314 * 1315 * After this call, no more requests can be made with this priv 1316 * pointer, but the call may sleep to wait for an outstanding 1317 * request that is being handled. 1318 */ 1319 extern void wiphy_unregister(struct wiphy *wiphy); 1320 1321 /** 1322 * wiphy_free - free wiphy 1323 * 1324 * @wiphy: The wiphy to free 1325 */ 1326 extern void wiphy_free(struct wiphy *wiphy); 1327 1328 /* internal structs */ 1329 struct cfg80211_conn; 1330 struct cfg80211_internal_bss; 1331 struct cfg80211_cached_keys; 1332 1333 #define MAX_AUTH_BSSES 4 1334 1335 /** 1336 * struct wireless_dev - wireless per-netdev state 1337 * 1338 * This structure must be allocated by the driver/stack 1339 * that uses the ieee80211_ptr field in struct net_device 1340 * (this is intentional so it can be allocated along with 1341 * the netdev.) 1342 * 1343 * @wiphy: pointer to hardware description 1344 * @iftype: interface type 1345 * @list: (private) Used to collect the interfaces 1346 * @netdev: (private) Used to reference back to the netdev 1347 * @current_bss: (private) Used by the internal configuration code 1348 * @bssid: (private) Used by the internal configuration code 1349 * @ssid: (private) Used by the internal configuration code 1350 * @ssid_len: (private) Used by the internal configuration code 1351 * @wext: (private) Used by the internal wireless extensions compat code 1352 * @wext_bssid: (private) Used by the internal wireless extensions compat code 1353 */ 1354 struct wireless_dev { 1355 struct wiphy *wiphy; 1356 enum nl80211_iftype iftype; 1357 1358 /* the remainder of this struct should be private to cfg80211 */ 1359 struct list_head list; 1360 struct net_device *netdev; 1361 1362 struct mutex mtx; 1363 1364 struct work_struct cleanup_work; 1365 1366 /* currently used for IBSS and SME - might be rearranged later */ 1367 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1368 u8 ssid_len; 1369 enum { 1370 CFG80211_SME_IDLE, 1371 CFG80211_SME_CONNECTING, 1372 CFG80211_SME_CONNECTED, 1373 } sme_state; 1374 struct cfg80211_conn *conn; 1375 struct cfg80211_cached_keys *connect_keys; 1376 1377 struct list_head event_list; 1378 spinlock_t event_lock; 1379 1380 struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES]; 1381 struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES]; 1382 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 1383 1384 #ifdef CONFIG_WIRELESS_EXT 1385 /* wext data */ 1386 struct { 1387 struct cfg80211_ibss_params ibss; 1388 struct cfg80211_connect_params connect; 1389 struct cfg80211_cached_keys *keys; 1390 u8 *ie; 1391 size_t ie_len; 1392 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 1393 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1394 s8 default_key, default_mgmt_key; 1395 bool ps, prev_bssid_valid; 1396 int ps_timeout; 1397 } wext; 1398 #endif 1399 }; 1400 1401 /** 1402 * wdev_priv - return wiphy priv from wireless_dev 1403 * 1404 * @wdev: The wireless device whose wiphy's priv pointer to return 1405 */ 1406 static inline void *wdev_priv(struct wireless_dev *wdev) 1407 { 1408 BUG_ON(!wdev); 1409 return wiphy_priv(wdev->wiphy); 1410 } 1411 1412 /* 1413 * Utility functions 1414 */ 1415 1416 /** 1417 * ieee80211_channel_to_frequency - convert channel number to frequency 1418 */ 1419 extern int ieee80211_channel_to_frequency(int chan); 1420 1421 /** 1422 * ieee80211_frequency_to_channel - convert frequency to channel number 1423 */ 1424 extern int ieee80211_frequency_to_channel(int freq); 1425 1426 /* 1427 * Name indirection necessary because the ieee80211 code also has 1428 * a function named "ieee80211_get_channel", so if you include 1429 * cfg80211's header file you get cfg80211's version, if you try 1430 * to include both header files you'll (rightfully!) get a symbol 1431 * clash. 1432 */ 1433 extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 1434 int freq); 1435 /** 1436 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 1437 */ 1438 static inline struct ieee80211_channel * 1439 ieee80211_get_channel(struct wiphy *wiphy, int freq) 1440 { 1441 return __ieee80211_get_channel(wiphy, freq); 1442 } 1443 1444 /** 1445 * ieee80211_get_response_rate - get basic rate for a given rate 1446 * 1447 * @sband: the band to look for rates in 1448 * @basic_rates: bitmap of basic rates 1449 * @bitrate: the bitrate for which to find the basic rate 1450 * 1451 * This function returns the basic rate corresponding to a given 1452 * bitrate, that is the next lower bitrate contained in the basic 1453 * rate map, which is, for this function, given as a bitmap of 1454 * indices of rates in the band's bitrate table. 1455 */ 1456 struct ieee80211_rate * 1457 ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 1458 u32 basic_rates, int bitrate); 1459 1460 /* 1461 * Radiotap parsing functions -- for controlled injection support 1462 * 1463 * Implemented in net/wireless/radiotap.c 1464 * Documentation in Documentation/networking/radiotap-headers.txt 1465 */ 1466 1467 /** 1468 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 1469 * @rtheader: pointer to the radiotap header we are walking through 1470 * @max_length: length of radiotap header in cpu byte ordering 1471 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 1472 * @this_arg: pointer to current radiotap arg 1473 * @arg_index: internal next argument index 1474 * @arg: internal next argument pointer 1475 * @next_bitmap: internal pointer to next present u32 1476 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 1477 */ 1478 1479 struct ieee80211_radiotap_iterator { 1480 struct ieee80211_radiotap_header *rtheader; 1481 int max_length; 1482 int this_arg_index; 1483 u8 *this_arg; 1484 1485 int arg_index; 1486 u8 *arg; 1487 __le32 *next_bitmap; 1488 u32 bitmap_shifter; 1489 }; 1490 1491 extern int ieee80211_radiotap_iterator_init( 1492 struct ieee80211_radiotap_iterator *iterator, 1493 struct ieee80211_radiotap_header *radiotap_header, 1494 int max_length); 1495 1496 extern int ieee80211_radiotap_iterator_next( 1497 struct ieee80211_radiotap_iterator *iterator); 1498 1499 extern const unsigned char rfc1042_header[6]; 1500 extern const unsigned char bridge_tunnel_header[6]; 1501 1502 /** 1503 * ieee80211_get_hdrlen_from_skb - get header length from data 1504 * 1505 * Given an skb with a raw 802.11 header at the data pointer this function 1506 * returns the 802.11 header length in bytes (not including encryption 1507 * headers). If the data in the sk_buff is too short to contain a valid 802.11 1508 * header the function returns 0. 1509 * 1510 * @skb: the frame 1511 */ 1512 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1513 1514 /** 1515 * ieee80211_hdrlen - get header length in bytes from frame control 1516 * @fc: frame control field in little-endian format 1517 */ 1518 unsigned int ieee80211_hdrlen(__le16 fc); 1519 1520 /** 1521 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 1522 * @skb: the 802.11 data frame 1523 * @addr: the device MAC address 1524 * @iftype: the virtual interface type 1525 */ 1526 int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr, 1527 enum nl80211_iftype iftype); 1528 1529 /** 1530 * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 1531 * @skb: the 802.3 frame 1532 * @addr: the device MAC address 1533 * @iftype: the virtual interface type 1534 * @bssid: the network bssid (used only for iftype STATION and ADHOC) 1535 * @qos: build 802.11 QoS data frame 1536 */ 1537 int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr, 1538 enum nl80211_iftype iftype, u8 *bssid, bool qos); 1539 1540 /** 1541 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame 1542 * @skb: the data frame 1543 */ 1544 unsigned int cfg80211_classify8021d(struct sk_buff *skb); 1545 1546 /* 1547 * Regulatory helper functions for wiphys 1548 */ 1549 1550 /** 1551 * regulatory_hint - driver hint to the wireless core a regulatory domain 1552 * @wiphy: the wireless device giving the hint (used only for reporting 1553 * conflicts) 1554 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain 1555 * should be in. If @rd is set this should be NULL. Note that if you 1556 * set this to NULL you should still set rd->alpha2 to some accepted 1557 * alpha2. 1558 * 1559 * Wireless drivers can use this function to hint to the wireless core 1560 * what it believes should be the current regulatory domain by 1561 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory 1562 * domain should be in or by providing a completely build regulatory domain. 1563 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried 1564 * for a regulatory domain structure for the respective country. 1565 * 1566 * The wiphy must have been registered to cfg80211 prior to this call. 1567 * For cfg80211 drivers this means you must first use wiphy_register(), 1568 * for mac80211 drivers you must first use ieee80211_register_hw(). 1569 * 1570 * Drivers should check the return value, its possible you can get 1571 * an -ENOMEM. 1572 */ 1573 extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1574 1575 /** 1576 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1577 * @wiphy: the wireless device we want to process the regulatory domain on 1578 * @regd: the custom regulatory domain to use for this wiphy 1579 * 1580 * Drivers can sometimes have custom regulatory domains which do not apply 1581 * to a specific country. Drivers can use this to apply such custom regulatory 1582 * domains. This routine must be called prior to wiphy registration. The 1583 * custom regulatory domain will be trusted completely and as such previous 1584 * default channel settings will be disregarded. If no rule is found for a 1585 * channel on the regulatory domain the channel will be disabled. 1586 */ 1587 extern void wiphy_apply_custom_regulatory( 1588 struct wiphy *wiphy, 1589 const struct ieee80211_regdomain *regd); 1590 1591 /** 1592 * freq_reg_info - get regulatory information for the given frequency 1593 * @wiphy: the wiphy for which we want to process this rule for 1594 * @center_freq: Frequency in KHz for which we want regulatory information for 1595 * @desired_bw_khz: the desired max bandwidth you want to use per 1596 * channel. Note that this is still 20 MHz if you want to use HT40 1597 * as HT40 makes use of two channels for its 40 MHz width bandwidth. 1598 * If set to 0 we'll assume you want the standard 20 MHz. 1599 * @reg_rule: the regulatory rule which we have for this frequency 1600 * 1601 * Use this function to get the regulatory rule for a specific frequency on 1602 * a given wireless device. If the device has a specific regulatory domain 1603 * it wants to follow we respect that unless a country IE has been received 1604 * and processed already. 1605 * 1606 * Returns 0 if it was able to find a valid regulatory rule which does 1607 * apply to the given center_freq otherwise it returns non-zero. It will 1608 * also return -ERANGE if we determine the given center_freq does not even have 1609 * a regulatory rule for a frequency range in the center_freq's band. See 1610 * freq_in_rule_band() for our current definition of a band -- this is purely 1611 * subjective and right now its 802.11 specific. 1612 */ 1613 extern int freq_reg_info(struct wiphy *wiphy, 1614 u32 center_freq, 1615 u32 desired_bw_khz, 1616 const struct ieee80211_reg_rule **reg_rule); 1617 1618 /* 1619 * Temporary wext handlers & helper functions 1620 * 1621 * In the future cfg80211 will simply assign the entire wext handler 1622 * structure to netdevs it manages, but we're not there yet. 1623 */ 1624 int cfg80211_wext_giwname(struct net_device *dev, 1625 struct iw_request_info *info, 1626 char *name, char *extra); 1627 int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 1628 u32 *mode, char *extra); 1629 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 1630 u32 *mode, char *extra); 1631 int cfg80211_wext_siwscan(struct net_device *dev, 1632 struct iw_request_info *info, 1633 union iwreq_data *wrqu, char *extra); 1634 int cfg80211_wext_giwscan(struct net_device *dev, 1635 struct iw_request_info *info, 1636 struct iw_point *data, char *extra); 1637 int cfg80211_wext_siwmlme(struct net_device *dev, 1638 struct iw_request_info *info, 1639 struct iw_point *data, char *extra); 1640 int cfg80211_wext_giwrange(struct net_device *dev, 1641 struct iw_request_info *info, 1642 struct iw_point *data, char *extra); 1643 int cfg80211_wext_siwgenie(struct net_device *dev, 1644 struct iw_request_info *info, 1645 struct iw_point *data, char *extra); 1646 int cfg80211_wext_siwauth(struct net_device *dev, 1647 struct iw_request_info *info, 1648 struct iw_param *data, char *extra); 1649 int cfg80211_wext_giwauth(struct net_device *dev, 1650 struct iw_request_info *info, 1651 struct iw_param *data, char *extra); 1652 1653 int cfg80211_wext_siwfreq(struct net_device *dev, 1654 struct iw_request_info *info, 1655 struct iw_freq *freq, char *extra); 1656 int cfg80211_wext_giwfreq(struct net_device *dev, 1657 struct iw_request_info *info, 1658 struct iw_freq *freq, char *extra); 1659 int cfg80211_wext_siwessid(struct net_device *dev, 1660 struct iw_request_info *info, 1661 struct iw_point *data, char *ssid); 1662 int cfg80211_wext_giwessid(struct net_device *dev, 1663 struct iw_request_info *info, 1664 struct iw_point *data, char *ssid); 1665 int cfg80211_wext_siwrate(struct net_device *dev, 1666 struct iw_request_info *info, 1667 struct iw_param *rate, char *extra); 1668 int cfg80211_wext_giwrate(struct net_device *dev, 1669 struct iw_request_info *info, 1670 struct iw_param *rate, char *extra); 1671 1672 int cfg80211_wext_siwrts(struct net_device *dev, 1673 struct iw_request_info *info, 1674 struct iw_param *rts, char *extra); 1675 int cfg80211_wext_giwrts(struct net_device *dev, 1676 struct iw_request_info *info, 1677 struct iw_param *rts, char *extra); 1678 int cfg80211_wext_siwfrag(struct net_device *dev, 1679 struct iw_request_info *info, 1680 struct iw_param *frag, char *extra); 1681 int cfg80211_wext_giwfrag(struct net_device *dev, 1682 struct iw_request_info *info, 1683 struct iw_param *frag, char *extra); 1684 int cfg80211_wext_siwretry(struct net_device *dev, 1685 struct iw_request_info *info, 1686 struct iw_param *retry, char *extra); 1687 int cfg80211_wext_giwretry(struct net_device *dev, 1688 struct iw_request_info *info, 1689 struct iw_param *retry, char *extra); 1690 int cfg80211_wext_siwencodeext(struct net_device *dev, 1691 struct iw_request_info *info, 1692 struct iw_point *erq, char *extra); 1693 int cfg80211_wext_siwencode(struct net_device *dev, 1694 struct iw_request_info *info, 1695 struct iw_point *erq, char *keybuf); 1696 int cfg80211_wext_giwencode(struct net_device *dev, 1697 struct iw_request_info *info, 1698 struct iw_point *erq, char *keybuf); 1699 int cfg80211_wext_siwtxpower(struct net_device *dev, 1700 struct iw_request_info *info, 1701 union iwreq_data *data, char *keybuf); 1702 int cfg80211_wext_giwtxpower(struct net_device *dev, 1703 struct iw_request_info *info, 1704 union iwreq_data *data, char *keybuf); 1705 struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev); 1706 1707 int cfg80211_wext_siwpower(struct net_device *dev, 1708 struct iw_request_info *info, 1709 struct iw_param *wrq, char *extra); 1710 int cfg80211_wext_giwpower(struct net_device *dev, 1711 struct iw_request_info *info, 1712 struct iw_param *wrq, char *extra); 1713 1714 int cfg80211_wext_siwap(struct net_device *dev, 1715 struct iw_request_info *info, 1716 struct sockaddr *ap_addr, char *extra); 1717 int cfg80211_wext_giwap(struct net_device *dev, 1718 struct iw_request_info *info, 1719 struct sockaddr *ap_addr, char *extra); 1720 1721 /* 1722 * callbacks for asynchronous cfg80211 methods, notification 1723 * functions and BSS handling helpers 1724 */ 1725 1726 /** 1727 * cfg80211_scan_done - notify that scan finished 1728 * 1729 * @request: the corresponding scan request 1730 * @aborted: set to true if the scan was aborted for any reason, 1731 * userspace will be notified of that 1732 */ 1733 void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); 1734 1735 /** 1736 * cfg80211_inform_bss - inform cfg80211 of a new BSS 1737 * 1738 * @wiphy: the wiphy reporting the BSS 1739 * @bss: the found BSS 1740 * @signal: the signal strength, type depends on the wiphy's signal_type 1741 * @gfp: context flags 1742 * 1743 * This informs cfg80211 that BSS information was found and 1744 * the BSS should be updated/added. 1745 */ 1746 struct cfg80211_bss* 1747 cfg80211_inform_bss_frame(struct wiphy *wiphy, 1748 struct ieee80211_channel *channel, 1749 struct ieee80211_mgmt *mgmt, size_t len, 1750 s32 signal, gfp_t gfp); 1751 1752 struct cfg80211_bss* 1753 cfg80211_inform_bss(struct wiphy *wiphy, 1754 struct ieee80211_channel *channel, 1755 const u8 *bssid, 1756 u64 timestamp, u16 capability, u16 beacon_interval, 1757 const u8 *ie, size_t ielen, 1758 s32 signal, gfp_t gfp); 1759 1760 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 1761 struct ieee80211_channel *channel, 1762 const u8 *bssid, 1763 const u8 *ssid, size_t ssid_len, 1764 u16 capa_mask, u16 capa_val); 1765 static inline struct cfg80211_bss * 1766 cfg80211_get_ibss(struct wiphy *wiphy, 1767 struct ieee80211_channel *channel, 1768 const u8 *ssid, size_t ssid_len) 1769 { 1770 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, 1771 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); 1772 } 1773 1774 struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, 1775 struct ieee80211_channel *channel, 1776 const u8 *meshid, size_t meshidlen, 1777 const u8 *meshcfg); 1778 void cfg80211_put_bss(struct cfg80211_bss *bss); 1779 1780 /** 1781 * cfg80211_unlink_bss - unlink BSS from internal data structures 1782 * @wiphy: the wiphy 1783 * @bss: the bss to remove 1784 * 1785 * This function removes the given BSS from the internal data structures 1786 * thereby making it no longer show up in scan results etc. Use this 1787 * function when you detect a BSS is gone. Normally BSSes will also time 1788 * out, so it is not necessary to use this function at all. 1789 */ 1790 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); 1791 1792 /** 1793 * cfg80211_send_rx_auth - notification of processed authentication 1794 * @dev: network device 1795 * @buf: authentication frame (header + body) 1796 * @len: length of the frame data 1797 * 1798 * This function is called whenever an authentication has been processed in 1799 * station mode. The driver is required to call either this function or 1800 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() 1801 * call. This function may sleep. 1802 */ 1803 void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1804 1805 /** 1806 * cfg80211_send_auth_timeout - notification of timed out authentication 1807 * @dev: network device 1808 * @addr: The MAC address of the device with which the authentication timed out 1809 * 1810 * This function may sleep. 1811 */ 1812 void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); 1813 1814 /** 1815 * cfg80211_send_rx_assoc - notification of processed association 1816 * @dev: network device 1817 * @buf: (re)association response frame (header + body) 1818 * @len: length of the frame data 1819 * 1820 * This function is called whenever a (re)association response has been 1821 * processed in station mode. The driver is required to call either this 1822 * function or cfg80211_send_assoc_timeout() to indicate the result of 1823 * cfg80211_ops::assoc() call. This function may sleep. 1824 */ 1825 void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1826 1827 /** 1828 * cfg80211_send_assoc_timeout - notification of timed out association 1829 * @dev: network device 1830 * @addr: The MAC address of the device with which the association timed out 1831 * 1832 * This function may sleep. 1833 */ 1834 void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); 1835 1836 /** 1837 * cfg80211_send_deauth - notification of processed deauthentication 1838 * @dev: network device 1839 * @buf: deauthentication frame (header + body) 1840 * @len: length of the frame data 1841 * @cookie: cookie from ->deauth if called within that callback, 1842 * %NULL otherwise 1843 * 1844 * This function is called whenever deauthentication has been processed in 1845 * station mode. This includes both received deauthentication frames and 1846 * locally generated ones. This function may sleep. 1847 */ 1848 void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, 1849 void *cookie); 1850 1851 /** 1852 * cfg80211_send_disassoc - notification of processed disassociation 1853 * @dev: network device 1854 * @buf: disassociation response frame (header + body) 1855 * @len: length of the frame data 1856 * @cookie: cookie from ->disassoc if called within that callback, 1857 * %NULL otherwise 1858 * 1859 * This function is called whenever disassociation has been processed in 1860 * station mode. This includes both received disassociation frames and locally 1861 * generated ones. This function may sleep. 1862 */ 1863 void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, 1864 void *cookie); 1865 1866 /** 1867 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) 1868 * @dev: network device 1869 * @addr: The source MAC address of the frame 1870 * @key_type: The key type that the received frame used 1871 * @key_id: Key identifier (0..3) 1872 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) 1873 * @gfp: allocation flags 1874 * 1875 * This function is called whenever the local MAC detects a MIC failure in a 1876 * received frame. This matches with MLME-MICHAELMICFAILURE.indication() 1877 * primitive. 1878 */ 1879 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, 1880 enum nl80211_key_type key_type, int key_id, 1881 const u8 *tsc, gfp_t gfp); 1882 1883 /** 1884 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS 1885 * 1886 * @dev: network device 1887 * @bssid: the BSSID of the IBSS joined 1888 * @gfp: allocation flags 1889 * 1890 * This function notifies cfg80211 that the device joined an IBSS or 1891 * switched to a different BSSID. Before this function can be called, 1892 * either a beacon has to have been received from the IBSS, or one of 1893 * the cfg80211_inform_bss{,_frame} functions must have been called 1894 * with the locally generated beacon -- this guarantees that there is 1895 * always a scan result for this IBSS. cfg80211 will handle the rest. 1896 */ 1897 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 1898 1899 /** 1900 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state 1901 * @wiphy: the wiphy 1902 * @blocked: block status 1903 */ 1904 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); 1905 1906 /** 1907 * wiphy_rfkill_start_polling - start polling rfkill 1908 * @wiphy: the wiphy 1909 */ 1910 void wiphy_rfkill_start_polling(struct wiphy *wiphy); 1911 1912 /** 1913 * wiphy_rfkill_stop_polling - stop polling rfkill 1914 * @wiphy: the wiphy 1915 */ 1916 void wiphy_rfkill_stop_polling(struct wiphy *wiphy); 1917 1918 #ifdef CONFIG_NL80211_TESTMODE 1919 /** 1920 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply 1921 * @wiphy: the wiphy 1922 * @approxlen: an upper bound of the length of the data that will 1923 * be put into the skb 1924 * 1925 * This function allocates and pre-fills an skb for a reply to 1926 * the testmode command. Since it is intended for a reply, calling 1927 * it outside of the @testmode_cmd operation is invalid. 1928 * 1929 * The returned skb (or %NULL if any errors happen) is pre-filled 1930 * with the wiphy index and set up in a way that any data that is 1931 * put into the skb (with skb_put(), nla_put() or similar) will end 1932 * up being within the %NL80211_ATTR_TESTDATA attribute, so all that 1933 * needs to be done with the skb is adding data for the corresponding 1934 * userspace tool which can then read that data out of the testdata 1935 * attribute. You must not modify the skb in any other way. 1936 * 1937 * When done, call cfg80211_testmode_reply() with the skb and return 1938 * its error code as the result of the @testmode_cmd operation. 1939 */ 1940 struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, 1941 int approxlen); 1942 1943 /** 1944 * cfg80211_testmode_reply - send the reply skb 1945 * @skb: The skb, must have been allocated with 1946 * cfg80211_testmode_alloc_reply_skb() 1947 * 1948 * Returns an error code or 0 on success, since calling this 1949 * function will usually be the last thing before returning 1950 * from the @testmode_cmd you should return the error code. 1951 * Note that this function consumes the skb regardless of the 1952 * return value. 1953 */ 1954 int cfg80211_testmode_reply(struct sk_buff *skb); 1955 1956 /** 1957 * cfg80211_testmode_alloc_event_skb - allocate testmode event 1958 * @wiphy: the wiphy 1959 * @approxlen: an upper bound of the length of the data that will 1960 * be put into the skb 1961 * @gfp: allocation flags 1962 * 1963 * This function allocates and pre-fills an skb for an event on the 1964 * testmode multicast group. 1965 * 1966 * The returned skb (or %NULL if any errors happen) is set up in the 1967 * same way as with cfg80211_testmode_alloc_reply_skb() but prepared 1968 * for an event. As there, you should simply add data to it that will 1969 * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must 1970 * not modify the skb in any other way. 1971 * 1972 * When done filling the skb, call cfg80211_testmode_event() with the 1973 * skb to send the event. 1974 */ 1975 struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, 1976 int approxlen, gfp_t gfp); 1977 1978 /** 1979 * cfg80211_testmode_event - send the event 1980 * @skb: The skb, must have been allocated with 1981 * cfg80211_testmode_alloc_event_skb() 1982 * @gfp: allocation flags 1983 * 1984 * This function sends the given @skb, which must have been allocated 1985 * by cfg80211_testmode_alloc_event_skb(), as an event. It always 1986 * consumes it. 1987 */ 1988 void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); 1989 1990 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), 1991 #else 1992 #define CFG80211_TESTMODE_CMD(cmd) 1993 #endif 1994 1995 /** 1996 * cfg80211_connect_result - notify cfg80211 of connection result 1997 * 1998 * @dev: network device 1999 * @bssid: the BSSID of the AP 2000 * @req_ie: association request IEs (maybe be %NULL) 2001 * @req_ie_len: association request IEs length 2002 * @resp_ie: association response IEs (may be %NULL) 2003 * @resp_ie_len: assoc response IEs length 2004 * @status: status code, 0 for successful connection, use 2005 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you 2006 * the real status code for failures. 2007 * @gfp: allocation flags 2008 * 2009 * It should be called by the underlying driver whenever connect() has 2010 * succeeded. 2011 */ 2012 void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 2013 const u8 *req_ie, size_t req_ie_len, 2014 const u8 *resp_ie, size_t resp_ie_len, 2015 u16 status, gfp_t gfp); 2016 2017 /** 2018 * cfg80211_roamed - notify cfg80211 of roaming 2019 * 2020 * @dev: network device 2021 * @bssid: the BSSID of the new AP 2022 * @req_ie: association request IEs (maybe be %NULL) 2023 * @req_ie_len: association request IEs length 2024 * @resp_ie: association response IEs (may be %NULL) 2025 * @resp_ie_len: assoc response IEs length 2026 * @gfp: allocation flags 2027 * 2028 * It should be called by the underlying driver whenever it roamed 2029 * from one AP to another while connected. 2030 */ 2031 void cfg80211_roamed(struct net_device *dev, const u8 *bssid, 2032 const u8 *req_ie, size_t req_ie_len, 2033 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); 2034 2035 /** 2036 * cfg80211_disconnected - notify cfg80211 that connection was dropped 2037 * 2038 * @dev: network device 2039 * @ie: information elements of the deauth/disassoc frame (may be %NULL) 2040 * @ie_len: length of IEs 2041 * @reason: reason code for the disconnection, set it to 0 if unknown 2042 * @gfp: allocation flags 2043 * 2044 * After it calls this function, the driver should enter an idle state 2045 * and not try to connect to any AP any more. 2046 */ 2047 void cfg80211_disconnected(struct net_device *dev, u16 reason, 2048 u8 *ie, size_t ie_len, gfp_t gfp); 2049 2050 #endif 2051 #endif /* __NET_CFG80211_H */ 2052 2053 /* 2054 * Local Variables: 2055 * indent-tabs-mode: nil 2056 * mode: C 2057 * c-file-style: "gnu" 2058 * c-basic-offset: 2 2059 * End: 2060 */ 2061 2062 /* vi: set et sw=2 sts=2: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |