cfg80211.h 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975
  1. #ifndef __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. */
  12. #include <linux/netdevice.h>
  13. #include <linux/debugfs.h>
  14. #include <linux/list.h>
  15. #include <linux/netlink.h>
  16. #include <linux/skbuff.h>
  17. #include <linux/nl80211.h>
  18. #include <linux/if_ether.h>
  19. #include <linux/ieee80211.h>
  20. #include <net/regulatory.h>
  21. /* remove once we remove the wext stuff */
  22. #include <net/iw_handler.h>
  23. #include <linux/wireless.h>
  24. /*
  25. * wireless hardware capability structures
  26. */
  27. /**
  28. * enum ieee80211_band - supported frequency bands
  29. *
  30. * The bands are assigned this way because the supported
  31. * bitrates differ in these bands.
  32. *
  33. * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
  34. * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
  35. */
  36. enum ieee80211_band {
  37. IEEE80211_BAND_2GHZ,
  38. IEEE80211_BAND_5GHZ,
  39. /* keep last */
  40. IEEE80211_NUM_BANDS
  41. };
  42. /**
  43. * enum ieee80211_channel_flags - channel flags
  44. *
  45. * Channel flags set by the regulatory control code.
  46. *
  47. * @IEEE80211_CHAN_DISABLED: This channel is disabled.
  48. * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
  49. * on this channel.
  50. * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
  51. * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
  52. * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
  53. * is not permitted.
  54. * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
  55. * is not permitted.
  56. */
  57. enum ieee80211_channel_flags {
  58. IEEE80211_CHAN_DISABLED = 1<<0,
  59. IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
  60. IEEE80211_CHAN_NO_IBSS = 1<<2,
  61. IEEE80211_CHAN_RADAR = 1<<3,
  62. IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
  63. IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
  64. };
  65. #define IEEE80211_CHAN_NO_HT40 \
  66. (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
  67. /**
  68. * struct ieee80211_channel - channel definition
  69. *
  70. * This structure describes a single channel for use
  71. * with cfg80211.
  72. *
  73. * @center_freq: center frequency in MHz
  74. * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
  75. * @hw_value: hardware-specific value for the channel
  76. * @flags: channel flags from &enum ieee80211_channel_flags.
  77. * @orig_flags: channel flags at registration time, used by regulatory
  78. * code to support devices with additional restrictions
  79. * @band: band this channel belongs to.
  80. * @max_antenna_gain: maximum antenna gain in dBi
  81. * @max_power: maximum transmission power (in dBm)
  82. * @beacon_found: helper to regulatory code to indicate when a beacon
  83. * has been found on this channel. Use regulatory_hint_found_beacon()
  84. * to enable this, this is is useful only on 5 GHz band.
  85. * @orig_mag: internal use
  86. * @orig_mpwr: internal use
  87. */
  88. struct ieee80211_channel {
  89. enum ieee80211_band band;
  90. u16 center_freq;
  91. u8 max_bandwidth;
  92. u16 hw_value;
  93. u32 flags;
  94. int max_antenna_gain;
  95. int max_power;
  96. bool beacon_found;
  97. u32 orig_flags;
  98. int orig_mag, orig_mpwr;
  99. };
  100. /**
  101. * enum ieee80211_rate_flags - rate flags
  102. *
  103. * Hardware/specification flags for rates. These are structured
  104. * in a way that allows using the same bitrate structure for
  105. * different bands/PHY modes.
  106. *
  107. * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
  108. * preamble on this bitrate; only relevant in 2.4GHz band and
  109. * with CCK rates.
  110. * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
  111. * when used with 802.11a (on the 5 GHz band); filled by the
  112. * core code when registering the wiphy.
  113. * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
  114. * when used with 802.11b (on the 2.4 GHz band); filled by the
  115. * core code when registering the wiphy.
  116. * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
  117. * when used with 802.11g (on the 2.4 GHz band); filled by the
  118. * core code when registering the wiphy.
  119. * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
  120. */
  121. enum ieee80211_rate_flags {
  122. IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
  123. IEEE80211_RATE_MANDATORY_A = 1<<1,
  124. IEEE80211_RATE_MANDATORY_B = 1<<2,
  125. IEEE80211_RATE_MANDATORY_G = 1<<3,
  126. IEEE80211_RATE_ERP_G = 1<<4,
  127. };
  128. /**
  129. * struct ieee80211_rate - bitrate definition
  130. *
  131. * This structure describes a bitrate that an 802.11 PHY can
  132. * operate with. The two values @hw_value and @hw_value_short
  133. * are only for driver use when pointers to this structure are
  134. * passed around.
  135. *
  136. * @flags: rate-specific flags
  137. * @bitrate: bitrate in units of 100 Kbps
  138. * @hw_value: driver/hardware value for this rate
  139. * @hw_value_short: driver/hardware value for this rate when
  140. * short preamble is used
  141. */
  142. struct ieee80211_rate {
  143. u32 flags;
  144. u16 bitrate;
  145. u16 hw_value, hw_value_short;
  146. };
  147. /**
  148. * struct ieee80211_sta_ht_cap - STA's HT capabilities
  149. *
  150. * This structure describes most essential parameters needed
  151. * to describe 802.11n HT capabilities for an STA.
  152. *
  153. * @ht_supported: is HT supported by the STA
  154. * @cap: HT capabilities map as described in 802.11n spec
  155. * @ampdu_factor: Maximum A-MPDU length factor
  156. * @ampdu_density: Minimum A-MPDU spacing
  157. * @mcs: Supported MCS rates
  158. */
  159. struct ieee80211_sta_ht_cap {
  160. u16 cap; /* use IEEE80211_HT_CAP_ */
  161. bool ht_supported;
  162. u8 ampdu_factor;
  163. u8 ampdu_density;
  164. struct ieee80211_mcs_info mcs;
  165. };
  166. /**
  167. * struct ieee80211_supported_band - frequency band definition
  168. *
  169. * This structure describes a frequency band a wiphy
  170. * is able to operate in.
  171. *
  172. * @channels: Array of channels the hardware can operate in
  173. * in this band.
  174. * @band: the band this structure represents
  175. * @n_channels: Number of channels in @channels
  176. * @bitrates: Array of bitrates the hardware can operate with
  177. * in this band. Must be sorted to give a valid "supported
  178. * rates" IE, i.e. CCK rates first, then OFDM.
  179. * @n_bitrates: Number of bitrates in @bitrates
  180. */
  181. struct ieee80211_supported_band {
  182. struct ieee80211_channel *channels;
  183. struct ieee80211_rate *bitrates;
  184. enum ieee80211_band band;
  185. int n_channels;
  186. int n_bitrates;
  187. struct ieee80211_sta_ht_cap ht_cap;
  188. };
  189. /*
  190. * Wireless hardware/device configuration structures and methods
  191. */
  192. /**
  193. * struct vif_params - describes virtual interface parameters
  194. * @mesh_id: mesh ID to use
  195. * @mesh_id_len: length of the mesh ID
  196. */
  197. struct vif_params {
  198. u8 *mesh_id;
  199. int mesh_id_len;
  200. };
  201. /**
  202. * struct key_params - key information
  203. *
  204. * Information about a key
  205. *
  206. * @key: key material
  207. * @key_len: length of key material
  208. * @cipher: cipher suite selector
  209. * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
  210. * with the get_key() callback, must be in little endian,
  211. * length given by @seq_len.
  212. */
  213. struct key_params {
  214. u8 *key;
  215. u8 *seq;
  216. int key_len;
  217. int seq_len;
  218. u32 cipher;
  219. };
  220. /**
  221. * struct beacon_parameters - beacon parameters
  222. *
  223. * Used to configure the beacon for an interface.
  224. *
  225. * @head: head portion of beacon (before TIM IE)
  226. * or %NULL if not changed
  227. * @tail: tail portion of beacon (after TIM IE)
  228. * or %NULL if not changed
  229. * @interval: beacon interval or zero if not changed
  230. * @dtim_period: DTIM period or zero if not changed
  231. * @head_len: length of @head
  232. * @tail_len: length of @tail
  233. */
  234. struct beacon_parameters {
  235. u8 *head, *tail;
  236. int interval, dtim_period;
  237. int head_len, tail_len;
  238. };
  239. /**
  240. * enum plink_action - actions to perform in mesh peers
  241. *
  242. * @PLINK_ACTION_INVALID: action 0 is reserved
  243. * @PLINK_ACTION_OPEN: start mesh peer link establishment
  244. * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
  245. */
  246. enum plink_actions {
  247. PLINK_ACTION_INVALID,
  248. PLINK_ACTION_OPEN,
  249. PLINK_ACTION_BLOCK,
  250. };
  251. /**
  252. * struct station_parameters - station parameters
  253. *
  254. * Used to change and create a new station.
  255. *
  256. * @vlan: vlan interface station should belong to
  257. * @supported_rates: supported rates in IEEE 802.11 format
  258. * (or NULL for no change)
  259. * @supported_rates_len: number of supported rates
  260. * @sta_flags_mask: station flags that changed
  261. * (bitmask of BIT(NL80211_STA_FLAG_...))
  262. * @sta_flags_set: station flags values
  263. * (bitmask of BIT(NL80211_STA_FLAG_...))
  264. * @listen_interval: listen interval or -1 for no change
  265. * @aid: AID or zero for no change
  266. */
  267. struct station_parameters {
  268. u8 *supported_rates;
  269. struct net_device *vlan;
  270. u32 sta_flags_mask, sta_flags_set;
  271. int listen_interval;
  272. u16 aid;
  273. u8 supported_rates_len;
  274. u8 plink_action;
  275. struct ieee80211_ht_cap *ht_capa;
  276. };
  277. /**
  278. * enum station_info_flags - station information flags
  279. *
  280. * Used by the driver to indicate which info in &struct station_info
  281. * it has filled in during get_station() or dump_station().
  282. *
  283. * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
  284. * @STATION_INFO_RX_BYTES: @rx_bytes filled
  285. * @STATION_INFO_TX_BYTES: @tx_bytes filled
  286. * @STATION_INFO_LLID: @llid filled
  287. * @STATION_INFO_PLID: @plid filled
  288. * @STATION_INFO_PLINK_STATE: @plink_state filled
  289. * @STATION_INFO_SIGNAL: @signal filled
  290. * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
  291. * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
  292. * @STATION_INFO_RX_PACKETS: @rx_packets filled
  293. * @STATION_INFO_TX_PACKETS: @tx_packets filled
  294. */
  295. enum station_info_flags {
  296. STATION_INFO_INACTIVE_TIME = 1<<0,
  297. STATION_INFO_RX_BYTES = 1<<1,
  298. STATION_INFO_TX_BYTES = 1<<2,
  299. STATION_INFO_LLID = 1<<3,
  300. STATION_INFO_PLID = 1<<4,
  301. STATION_INFO_PLINK_STATE = 1<<5,
  302. STATION_INFO_SIGNAL = 1<<6,
  303. STATION_INFO_TX_BITRATE = 1<<7,
  304. STATION_INFO_RX_PACKETS = 1<<8,
  305. STATION_INFO_TX_PACKETS = 1<<9,
  306. };
  307. /**
  308. * enum station_info_rate_flags - bitrate info flags
  309. *
  310. * Used by the driver to indicate the specific rate transmission
  311. * type for 802.11n transmissions.
  312. *
  313. * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
  314. * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
  315. * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
  316. */
  317. enum rate_info_flags {
  318. RATE_INFO_FLAGS_MCS = 1<<0,
  319. RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
  320. RATE_INFO_FLAGS_SHORT_GI = 1<<2,
  321. };
  322. /**
  323. * struct rate_info - bitrate information
  324. *
  325. * Information about a receiving or transmitting bitrate
  326. *
  327. * @flags: bitflag of flags from &enum rate_info_flags
  328. * @mcs: mcs index if struct describes a 802.11n bitrate
  329. * @legacy: bitrate in 100kbit/s for 802.11abg
  330. */
  331. struct rate_info {
  332. u8 flags;
  333. u8 mcs;
  334. u16 legacy;
  335. };
  336. /**
  337. * struct station_info - station information
  338. *
  339. * Station information filled by driver for get_station() and dump_station.
  340. *
  341. * @filled: bitflag of flags from &enum station_info_flags
  342. * @inactive_time: time since last station activity (tx/rx) in milliseconds
  343. * @rx_bytes: bytes received from this station
  344. * @tx_bytes: bytes transmitted to this station
  345. * @llid: mesh local link id
  346. * @plid: mesh peer link id
  347. * @plink_state: mesh peer link state
  348. * @signal: signal strength of last received packet in dBm
  349. * @txrate: current unicast bitrate to this station
  350. * @rx_packets: packets received from this station
  351. * @tx_packets: packets transmitted to this station
  352. */
  353. struct station_info {
  354. u32 filled;
  355. u32 inactive_time;
  356. u32 rx_bytes;
  357. u32 tx_bytes;
  358. u16 llid;
  359. u16 plid;
  360. u8 plink_state;
  361. s8 signal;
  362. struct rate_info txrate;
  363. u32 rx_packets;
  364. u32 tx_packets;
  365. };
  366. /**
  367. * enum monitor_flags - monitor flags
  368. *
  369. * Monitor interface configuration flags. Note that these must be the bits
  370. * according to the nl80211 flags.
  371. *
  372. * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
  373. * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  374. * @MONITOR_FLAG_CONTROL: pass control frames
  375. * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
  376. * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
  377. */
  378. enum monitor_flags {
  379. MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
  380. MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
  381. MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
  382. MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
  383. MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
  384. };
  385. /**
  386. * enum mpath_info_flags - mesh path information flags
  387. *
  388. * Used by the driver to indicate which info in &struct mpath_info it has filled
  389. * in during get_station() or dump_station().
  390. *
  391. * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
  392. * MPATH_INFO_DSN: @dsn filled
  393. * MPATH_INFO_METRIC: @metric filled
  394. * MPATH_INFO_EXPTIME: @exptime filled
  395. * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
  396. * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
  397. * MPATH_INFO_FLAGS: @flags filled
  398. */
  399. enum mpath_info_flags {
  400. MPATH_INFO_FRAME_QLEN = BIT(0),
  401. MPATH_INFO_DSN = BIT(1),
  402. MPATH_INFO_METRIC = BIT(2),
  403. MPATH_INFO_EXPTIME = BIT(3),
  404. MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
  405. MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
  406. MPATH_INFO_FLAGS = BIT(6),
  407. };
  408. /**
  409. * struct mpath_info - mesh path information
  410. *
  411. * Mesh path information filled by driver for get_mpath() and dump_mpath().
  412. *
  413. * @filled: bitfield of flags from &enum mpath_info_flags
  414. * @frame_qlen: number of queued frames for this destination
  415. * @dsn: destination sequence number
  416. * @metric: metric (cost) of this mesh path
  417. * @exptime: expiration time for the mesh path from now, in msecs
  418. * @flags: mesh path flags
  419. * @discovery_timeout: total mesh path discovery timeout, in msecs
  420. * @discovery_retries: mesh path discovery retries
  421. */
  422. struct mpath_info {
  423. u32 filled;
  424. u32 frame_qlen;
  425. u32 dsn;
  426. u32 metric;
  427. u32 exptime;
  428. u32 discovery_timeout;
  429. u8 discovery_retries;
  430. u8 flags;
  431. };
  432. /**
  433. * struct bss_parameters - BSS parameters
  434. *
  435. * Used to change BSS parameters (mainly for AP mode).
  436. *
  437. * @use_cts_prot: Whether to use CTS protection
  438. * (0 = no, 1 = yes, -1 = do not change)
  439. * @use_short_preamble: Whether the use of short preambles is allowed
  440. * (0 = no, 1 = yes, -1 = do not change)
  441. * @use_short_slot_time: Whether the use of short slot time is allowed
  442. * (0 = no, 1 = yes, -1 = do not change)
  443. * @basic_rates: basic rates in IEEE 802.11 format
  444. * (or NULL for no change)
  445. * @basic_rates_len: number of basic rates
  446. */
  447. struct bss_parameters {
  448. int use_cts_prot;
  449. int use_short_preamble;
  450. int use_short_slot_time;
  451. u8 *basic_rates;
  452. u8 basic_rates_len;
  453. };
  454. struct mesh_config {
  455. /* Timeouts in ms */
  456. /* Mesh plink management parameters */
  457. u16 dot11MeshRetryTimeout;
  458. u16 dot11MeshConfirmTimeout;
  459. u16 dot11MeshHoldingTimeout;
  460. u16 dot11MeshMaxPeerLinks;
  461. u8 dot11MeshMaxRetries;
  462. u8 dot11MeshTTL;
  463. bool auto_open_plinks;
  464. /* HWMP parameters */
  465. u8 dot11MeshHWMPmaxPREQretries;
  466. u32 path_refresh_time;
  467. u16 min_discovery_timeout;
  468. u32 dot11MeshHWMPactivePathTimeout;
  469. u16 dot11MeshHWMPpreqMinInterval;
  470. u16 dot11MeshHWMPnetDiameterTraversalTime;
  471. };
  472. /**
  473. * struct ieee80211_txq_params - TX queue parameters
  474. * @queue: TX queue identifier (NL80211_TXQ_Q_*)
  475. * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
  476. * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
  477. * 1..32767]
  478. * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
  479. * 1..32767]
  480. * @aifs: Arbitration interframe space [0..255]
  481. */
  482. struct ieee80211_txq_params {
  483. enum nl80211_txq_q queue;
  484. u16 txop;
  485. u16 cwmin;
  486. u16 cwmax;
  487. u8 aifs;
  488. };
  489. /* from net/wireless.h */
  490. struct wiphy;
  491. /* from net/ieee80211.h */
  492. struct ieee80211_channel;
  493. /**
  494. * struct cfg80211_ssid - SSID description
  495. * @ssid: the SSID
  496. * @ssid_len: length of the ssid
  497. */
  498. struct cfg80211_ssid {
  499. u8 ssid[IEEE80211_MAX_SSID_LEN];
  500. u8 ssid_len;
  501. };
  502. /**
  503. * struct cfg80211_scan_request - scan request description
  504. *
  505. * @ssids: SSIDs to scan for (active scan only)
  506. * @n_ssids: number of SSIDs
  507. * @channels: channels to scan on.
  508. * @n_channels: number of channels for each band
  509. * @ie: optional information element(s) to add into Probe Request or %NULL
  510. * @ie_len: length of ie in octets
  511. * @wiphy: the wiphy this was for
  512. * @ifidx: the interface index
  513. */
  514. struct cfg80211_scan_request {
  515. struct cfg80211_ssid *ssids;
  516. int n_ssids;
  517. struct ieee80211_channel **channels;
  518. u32 n_channels;
  519. const u8 *ie;
  520. size_t ie_len;
  521. /* internal */
  522. struct wiphy *wiphy;
  523. int ifidx;
  524. };
  525. /**
  526. * enum cfg80211_signal_type - signal type
  527. *
  528. * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
  529. * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
  530. * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
  531. */
  532. enum cfg80211_signal_type {
  533. CFG80211_SIGNAL_TYPE_NONE,
  534. CFG80211_SIGNAL_TYPE_MBM,
  535. CFG80211_SIGNAL_TYPE_UNSPEC,
  536. };
  537. /**
  538. * struct cfg80211_bss - BSS description
  539. *
  540. * This structure describes a BSS (which may also be a mesh network)
  541. * for use in scan results and similar.
  542. *
  543. * @bssid: BSSID of the BSS
  544. * @tsf: timestamp of last received update
  545. * @beacon_interval: the beacon interval as from the frame
  546. * @capability: the capability field in host byte order
  547. * @information_elements: the information elements (Note that there
  548. * is no guarantee that these are well-formed!)
  549. * @len_information_elements: total length of the information elements
  550. * @signal: signal strength value (type depends on the wiphy's signal_type)
  551. * @free_priv: function pointer to free private data
  552. * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
  553. */
  554. struct cfg80211_bss {
  555. struct ieee80211_channel *channel;
  556. u8 bssid[ETH_ALEN];
  557. u64 tsf;
  558. u16 beacon_interval;
  559. u16 capability;
  560. u8 *information_elements;
  561. size_t len_information_elements;
  562. s32 signal;
  563. void (*free_priv)(struct cfg80211_bss *bss);
  564. u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
  565. };
  566. /**
  567. * ieee80211_bss_get_ie - find IE with given ID
  568. * @bss: the bss to search
  569. * @ie: the IE ID
  570. * Returns %NULL if not found.
  571. */
  572. const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
  573. /**
  574. * struct cfg80211_crypto_settings - Crypto settings
  575. * @wpa_versions: indicates which, if any, WPA versions are enabled
  576. * (from enum nl80211_wpa_versions)
  577. * @cipher_group: group key cipher suite (or 0 if unset)
  578. * @n_ciphers_pairwise: number of AP supported unicast ciphers
  579. * @ciphers_pairwise: unicast key cipher suites
  580. * @n_akm_suites: number of AKM suites
  581. * @akm_suites: AKM suites
  582. * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
  583. * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
  584. * required to assume that the port is unauthorized until authorized by
  585. * user space. Otherwise, port is marked authorized by default.
  586. */
  587. struct cfg80211_crypto_settings {
  588. u32 wpa_versions;
  589. u32 cipher_group;
  590. int n_ciphers_pairwise;
  591. u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
  592. int n_akm_suites;
  593. u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
  594. bool control_port;
  595. };
  596. /**
  597. * struct cfg80211_auth_request - Authentication request data
  598. *
  599. * This structure provides information needed to complete IEEE 802.11
  600. * authentication.
  601. *
  602. * @bss: The BSS to authenticate with.
  603. * @auth_type: Authentication type (algorithm)
  604. * @ie: Extra IEs to add to Authentication frame or %NULL
  605. * @ie_len: Length of ie buffer in octets
  606. */
  607. struct cfg80211_auth_request {
  608. struct cfg80211_bss *bss;
  609. const u8 *ie;
  610. size_t ie_len;
  611. enum nl80211_auth_type auth_type;
  612. };
  613. /**
  614. * struct cfg80211_assoc_request - (Re)Association request data
  615. *
  616. * This structure provides information needed to complete IEEE 802.11
  617. * (re)association.
  618. * @bss: The BSS to associate with.
  619. * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
  620. * @ie_len: Length of ie buffer in octets
  621. * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
  622. * @crypto: crypto settings
  623. */
  624. struct cfg80211_assoc_request {
  625. struct cfg80211_bss *bss;
  626. const u8 *ie;
  627. size_t ie_len;
  628. struct cfg80211_crypto_settings crypto;
  629. bool use_mfp;
  630. };
  631. /**
  632. * struct cfg80211_deauth_request - Deauthentication request data
  633. *
  634. * This structure provides information needed to complete IEEE 802.11
  635. * deauthentication.
  636. *
  637. * @bss: the BSS to deauthenticate from
  638. * @ie: Extra IEs to add to Deauthentication frame or %NULL
  639. * @ie_len: Length of ie buffer in octets
  640. * @reason_code: The reason code for the deauthentication
  641. */
  642. struct cfg80211_deauth_request {
  643. struct cfg80211_bss *bss;
  644. const u8 *ie;
  645. size_t ie_len;
  646. u16 reason_code;
  647. };
  648. /**
  649. * struct cfg80211_disassoc_request - Disassociation request data
  650. *
  651. * This structure provides information needed to complete IEEE 802.11
  652. * disassocation.
  653. *
  654. * @bss: the BSS to disassociate from
  655. * @ie: Extra IEs to add to Disassociation frame or %NULL
  656. * @ie_len: Length of ie buffer in octets
  657. * @reason_code: The reason code for the disassociation
  658. */
  659. struct cfg80211_disassoc_request {
  660. struct cfg80211_bss *bss;
  661. const u8 *ie;
  662. size_t ie_len;
  663. u16 reason_code;
  664. };
  665. /**
  666. * struct cfg80211_ibss_params - IBSS parameters
  667. *
  668. * This structure defines the IBSS parameters for the join_ibss()
  669. * method.
  670. *
  671. * @ssid: The SSID, will always be non-null.
  672. * @ssid_len: The length of the SSID, will always be non-zero.
  673. * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
  674. * search for IBSSs with a different BSSID.
  675. * @channel: The channel to use if no IBSS can be found to join.
  676. * @channel_fixed: The channel should be fixed -- do not search for
  677. * IBSSs to join on other channels.
  678. * @ie: information element(s) to include in the beacon
  679. * @ie_len: length of that
  680. * @beacon_interval: beacon interval to use
  681. */
  682. struct cfg80211_ibss_params {
  683. u8 *ssid;
  684. u8 *bssid;
  685. struct ieee80211_channel *channel;
  686. u8 *ie;
  687. u8 ssid_len, ie_len;
  688. u16 beacon_interval;
  689. bool channel_fixed;
  690. };
  691. /**
  692. * struct cfg80211_connect_params - Connection parameters
  693. *
  694. * This structure provides information needed to complete IEEE 802.11
  695. * authentication and association.
  696. *
  697. * @channel: The channel to use or %NULL if not specified (auto-select based
  698. * on scan results)
  699. * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
  700. * results)
  701. * @ssid: SSID
  702. * @ssid_len: Length of ssid in octets
  703. * @auth_type: Authentication type (algorithm)
  704. * @assoc_ie: IEs for association request
  705. * @assoc_ie_len: Length of assoc_ie in octets
  706. * @privacy: indicates whether privacy-enabled APs should be used
  707. * @crypto: crypto settings
  708. */
  709. struct cfg80211_connect_params {
  710. struct ieee80211_channel *channel;
  711. u8 *bssid;
  712. u8 *ssid;
  713. size_t ssid_len;
  714. enum nl80211_auth_type auth_type;
  715. u8 *ie;
  716. size_t ie_len;
  717. bool privacy;
  718. struct cfg80211_crypto_settings crypto;
  719. };
  720. /**
  721. * enum wiphy_params_flags - set_wiphy_params bitfield values
  722. * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
  723. * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
  724. * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
  725. * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
  726. */
  727. enum wiphy_params_flags {
  728. WIPHY_PARAM_RETRY_SHORT = 1 << 0,
  729. WIPHY_PARAM_RETRY_LONG = 1 << 1,
  730. WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
  731. WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
  732. };
  733. /**
  734. * enum tx_power_setting - TX power adjustment
  735. *
  736. * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
  737. * @TX_POWER_LIMITED: limit TX power by the dbm parameter
  738. * @TX_POWER_FIXED: fix TX power to the dbm parameter
  739. */
  740. enum tx_power_setting {
  741. TX_POWER_AUTOMATIC,
  742. TX_POWER_LIMITED,
  743. TX_POWER_FIXED,
  744. };
  745. /*
  746. * cfg80211_bitrate_mask - masks for bitrate control
  747. */
  748. struct cfg80211_bitrate_mask {
  749. /*
  750. * As discussed in Berlin, this struct really
  751. * should look like this:
  752. struct {
  753. u32 legacy;
  754. u8 mcs[IEEE80211_HT_MCS_MASK_LEN];
  755. } control[IEEE80211_NUM_BANDS];
  756. * Since we can always fix in-kernel users, let's keep
  757. * it simpler for now:
  758. */
  759. u32 fixed; /* fixed bitrate, 0 == not fixed */
  760. u32 maxrate; /* in kbps, 0 == no limit */
  761. };
  762. /**
  763. * struct cfg80211_ops - backend description for wireless configuration
  764. *
  765. * This struct is registered by fullmac card drivers and/or wireless stacks
  766. * in order to handle configuration requests on their interfaces.
  767. *
  768. * All callbacks except where otherwise noted should return 0
  769. * on success or a negative error code.
  770. *
  771. * All operations are currently invoked under rtnl for consistency with the
  772. * wireless extensions but this is subject to reevaluation as soon as this
  773. * code is used more widely and we have a first user without wext.
  774. *
  775. * @suspend: wiphy device needs to be suspended
  776. * @resume: wiphy device needs to be resumed
  777. *
  778. * @add_virtual_intf: create a new virtual interface with the given name,
  779. * must set the struct wireless_dev's iftype.
  780. *
  781. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  782. *
  783. * @change_virtual_intf: change type/configuration of virtual interface,
  784. * keep the struct wireless_dev's iftype updated.
  785. *
  786. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  787. * when adding a group key.
  788. *
  789. * @get_key: get information about the key with the given parameters.
  790. * @mac_addr will be %NULL when requesting information for a group
  791. * key. All pointers given to the @callback function need not be valid
  792. * after it returns. This function should return an error if it is
  793. * not possible to retrieve the key, -ENOENT if it doesn't exist.
  794. *
  795. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  796. * and @key_index, return -ENOENT if the key doesn't exist.
  797. *
  798. * @set_default_key: set the default key on an interface
  799. *
  800. * @set_default_mgmt_key: set the default management frame key on an interface
  801. *
  802. * @add_beacon: Add a beacon with given parameters, @head, @interval
  803. * and @dtim_period will be valid, @tail is optional.
  804. * @set_beacon: Change the beacon parameters for an access point mode
  805. * interface. This should reject the call when no beacon has been
  806. * configured.
  807. * @del_beacon: Remove beacon configuration and stop sending the beacon.
  808. *
  809. * @add_station: Add a new station.
  810. *
  811. * @del_station: Remove a station; @mac may be NULL to remove all stations.
  812. *
  813. * @change_station: Modify a given station.
  814. *
  815. * @get_mesh_params: Put the current mesh parameters into *params
  816. *
  817. * @set_mesh_params: Set mesh parameters.
  818. * The mask is a bitfield which tells us which parameters to
  819. * set, and which to leave alone.
  820. *
  821. * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
  822. *
  823. * @change_bss: Modify parameters for a given BSS.
  824. *
  825. * @set_txq_params: Set TX queue parameters
  826. *
  827. * @set_channel: Set channel
  828. *
  829. * @scan: Request to do a scan. If returning zero, the scan request is given
  830. * the driver, and will be valid until passed to cfg80211_scan_done().
  831. * For scan results, call cfg80211_inform_bss(); you can call this outside
  832. * the scan/scan_done bracket too.
  833. *
  834. * @auth: Request to authenticate with the specified peer
  835. * @assoc: Request to (re)associate with the specified peer
  836. * @deauth: Request to deauthenticate from the specified peer
  837. * @disassoc: Request to disassociate from the specified peer
  838. *
  839. * @connect: Connect to the ESS with the specified parameters. When connected,
  840. * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS.
  841. * If the connection fails for some reason, call cfg80211_connect_result()
  842. * with the status from the AP.
  843. * @disconnect: Disconnect from the BSS/ESS.
  844. *
  845. * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
  846. * cfg80211_ibss_joined(), also call that function when changing BSSID due
  847. * to a merge.
  848. * @leave_ibss: Leave the IBSS.
  849. *
  850. * @set_wiphy_params: Notify that wiphy parameters have changed;
  851. * @changed bitfield (see &enum wiphy_params_flags) describes which values
  852. * have changed. The actual parameter values are available in
  853. * struct wiphy. If returning an error, no value should be changed.
  854. *
  855. * @set_tx_power: set the transmit power according to the parameters
  856. * @get_tx_power: store the current TX power into the dbm variable;
  857. * return 0 if successful
  858. *
  859. * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
  860. * functions to adjust rfkill hw state
  861. *
  862. * @testmode_cmd: run a test mode command
  863. */
  864. struct cfg80211_ops {
  865. int (*suspend)(struct wiphy *wiphy);
  866. int (*resume)(struct wiphy *wiphy);
  867. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  868. enum nl80211_iftype type, u32 *flags,
  869. struct vif_params *params);
  870. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  871. int (*change_virtual_intf)(struct wiphy *wiphy,
  872. struct net_device *dev,
  873. enum nl80211_iftype type, u32 *flags,
  874. struct vif_params *params);
  875. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  876. u8 key_index, const u8 *mac_addr,
  877. struct key_params *params);
  878. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  879. u8 key_index, const u8 *mac_addr, void *cookie,
  880. void (*callback)(void *cookie, struct key_params*));
  881. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  882. u8 key_index, const u8 *mac_addr);
  883. int (*set_default_key)(struct wiphy *wiphy,
  884. struct net_device *netdev,
  885. u8 key_index);
  886. int (*set_default_mgmt_key)(struct wiphy *wiphy,
  887. struct net_device *netdev,
  888. u8 key_index);
  889. int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
  890. struct beacon_parameters *info);
  891. int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
  892. struct beacon_parameters *info);
  893. int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
  894. int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
  895. u8 *mac, struct station_parameters *params);
  896. int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
  897. u8 *mac);
  898. int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
  899. u8 *mac, struct station_parameters *params);
  900. int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
  901. u8 *mac, struct station_info *sinfo);
  902. int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
  903. int idx, u8 *mac, struct station_info *sinfo);
  904. int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
  905. u8 *dst, u8 *next_hop);
  906. int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
  907. u8 *dst);
  908. int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
  909. u8 *dst, u8 *next_hop);
  910. int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
  911. u8 *dst, u8 *next_hop,
  912. struct mpath_info *pinfo);
  913. int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
  914. int idx, u8 *dst, u8 *next_hop,
  915. struct mpath_info *pinfo);
  916. int (*get_mesh_params)(struct wiphy *wiphy,
  917. struct net_device *dev,
  918. struct mesh_config *conf);
  919. int (*set_mesh_params)(struct wiphy *wiphy,
  920. struct net_device *dev,
  921. const struct mesh_config *nconf, u32 mask);
  922. int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
  923. struct bss_parameters *params);
  924. int (*set_txq_params)(struct wiphy *wiphy,
  925. struct ieee80211_txq_params *params);
  926. int (*set_channel)(struct wiphy *wiphy,
  927. struct ieee80211_channel *chan,
  928. enum nl80211_channel_type channel_type);
  929. int (*scan)(struct wiphy *wiphy, struct net_device *dev,
  930. struct cfg80211_scan_request *request);
  931. int (*auth)(struct wiphy *wiphy, struct net_device *dev,
  932. struct cfg80211_auth_request *req);
  933. int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
  934. struct cfg80211_assoc_request *req);
  935. int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
  936. struct cfg80211_deauth_request *req);
  937. int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
  938. struct cfg80211_disassoc_request *req);
  939. int (*connect)(struct wiphy *wiphy, struct net_device *dev,
  940. struct cfg80211_connect_params *sme);
  941. int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
  942. u16 reason_code);
  943. int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
  944. struct cfg80211_ibss_params *params);
  945. int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
  946. int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
  947. int (*set_tx_power)(struct wiphy *wiphy,
  948. enum tx_power_setting type, int dbm);
  949. int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
  950. int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
  951. u8 *addr);
  952. void (*rfkill_poll)(struct wiphy *wiphy);
  953. #ifdef CONFIG_NL80211_TESTMODE
  954. int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
  955. #endif
  956. int (*set_bitrate_mask)(struct wiphy *wiphy,
  957. struct net_device *dev,
  958. const u8 *peer,
  959. const struct cfg80211_bitrate_mask *mask);
  960. /* some temporary stuff to finish wext */
  961. int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
  962. bool enabled, int timeout);
  963. };
  964. /*
  965. * wireless hardware and networking interfaces structures
  966. * and registration/helper functions
  967. */
  968. /**
  969. * struct wiphy - wireless hardware description
  970. * @idx: the wiphy index assigned to this item
  971. * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
  972. * @custom_regulatory: tells us the driver for this device
  973. * has its own custom regulatory domain and cannot identify the
  974. * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
  975. * we will disregard the first regulatory hint (when the
  976. * initiator is %REGDOM_SET_BY_CORE).
  977. * @strict_regulatory: tells us the driver for this device will ignore
  978. * regulatory domain settings until it gets its own regulatory domain
  979. * via its regulatory_hint(). After its gets its own regulatory domain
  980. * it will only allow further regulatory domain settings to further
  981. * enhance compliance. For example if channel 13 and 14 are disabled
  982. * by this regulatory domain no user regulatory domain can enable these
  983. * channels at a later time. This can be used for devices which do not
  984. * have calibration information gauranteed for frequencies or settings
  985. * outside of its regulatory domain.
  986. * @reg_notifier: the driver's regulatory notification callback
  987. * @regd: the driver's regulatory domain, if one was requested via
  988. * the regulatory_hint() API. This can be used by the driver
  989. * on the reg_notifier() if it chooses to ignore future
  990. * regulatory domain changes caused by other drivers.
  991. * @signal_type: signal type reported in &struct cfg80211_bss.
  992. * @cipher_suites: supported cipher suites
  993. * @n_cipher_suites: number of supported cipher suites
  994. * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
  995. * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
  996. * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
  997. * -1 = fragmentation disabled, only odd values >= 256 used
  998. * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
  999. */
  1000. struct wiphy {
  1001. /* assign these fields before you register the wiphy */
  1002. /* permanent MAC address */
  1003. u8 perm_addr[ETH_ALEN];
  1004. /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
  1005. u16 interface_modes;
  1006. bool custom_regulatory;
  1007. bool strict_regulatory;
  1008. enum cfg80211_signal_type signal_type;
  1009. int bss_priv_size;
  1010. u8 max_scan_ssids;
  1011. u16 max_scan_ie_len;
  1012. int n_cipher_suites;
  1013. const u32 *cipher_suites;
  1014. u8 retry_short;
  1015. u8 retry_long;
  1016. u32 frag_threshold;
  1017. u32 rts_threshold;
  1018. /* If multiple wiphys are registered and you're handed e.g.
  1019. * a regular netdev with assigned ieee80211_ptr, you won't
  1020. * know whether it points to a wiphy your driver has registered
  1021. * or not. Assign this to something global to your driver to
  1022. * help determine whether you own this wiphy or not. */
  1023. const void *privid;
  1024. struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
  1025. /* Lets us get back the wiphy on the callback */
  1026. int (*reg_notifier)(struct wiphy *wiphy,
  1027. struct regulatory_request *request);
  1028. /* fields below are read-only, assigned by cfg80211 */
  1029. const struct ieee80211_regdomain *regd;
  1030. /* the item in /sys/class/ieee80211/ points to this,
  1031. * you need use set_wiphy_dev() (see below) */
  1032. struct device dev;
  1033. /* dir in debugfs: ieee80211/<wiphyname> */
  1034. struct dentry *debugfsdir;
  1035. char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
  1036. };
  1037. /**
  1038. * wiphy_priv - return priv from wiphy
  1039. *
  1040. * @wiphy: the wiphy whose priv pointer to return
  1041. */
  1042. static inline void *wiphy_priv(struct wiphy *wiphy)
  1043. {
  1044. BUG_ON(!wiphy);
  1045. return &wiphy->priv;
  1046. }
  1047. /**
  1048. * priv_to_wiphy - return the wiphy containing the priv
  1049. *
  1050. * @priv: a pointer previously returned by wiphy_priv
  1051. */
  1052. static inline struct wiphy *priv_to_wiphy(void *priv)
  1053. {
  1054. BUG_ON(!priv);
  1055. return container_of(priv, struct wiphy, priv);
  1056. }
  1057. /**
  1058. * set_wiphy_dev - set device pointer for wiphy
  1059. *
  1060. * @wiphy: The wiphy whose device to bind
  1061. * @dev: The device to parent it to
  1062. */
  1063. static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
  1064. {
  1065. wiphy->dev.parent = dev;
  1066. }
  1067. /**
  1068. * wiphy_dev - get wiphy dev pointer
  1069. *
  1070. * @wiphy: The wiphy whose device struct to look up
  1071. */
  1072. static inline struct device *wiphy_dev(struct wiphy *wiphy)
  1073. {
  1074. return wiphy->dev.parent;
  1075. }
  1076. /**
  1077. * wiphy_name - get wiphy name
  1078. *
  1079. * @wiphy: The wiphy whose name to return
  1080. */
  1081. static inline const char *wiphy_name(struct wiphy *wiphy)
  1082. {
  1083. return dev_name(&wiphy->dev);
  1084. }
  1085. /**
  1086. * wiphy_new - create a new wiphy for use with cfg80211
  1087. *
  1088. * @ops: The configuration operations for this device
  1089. * @sizeof_priv: The size of the private area to allocate
  1090. *
  1091. * Create a new wiphy and associate the given operations with it.
  1092. * @sizeof_priv bytes are allocated for private use.
  1093. *
  1094. * The returned pointer must be assigned to each netdev's
  1095. * ieee80211_ptr for proper operation.
  1096. */
  1097. struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
  1098. /**
  1099. * wiphy_register - register a wiphy with cfg80211
  1100. *
  1101. * @wiphy: The wiphy to register.
  1102. *
  1103. * Returns a non-negative wiphy index or a negative error code.
  1104. */
  1105. extern int wiphy_register(struct wiphy *wiphy);
  1106. /**
  1107. * wiphy_unregister - deregister a wiphy from cfg80211
  1108. *
  1109. * @wiphy: The wiphy to unregister.
  1110. *
  1111. * After this call, no more requests can be made with this priv
  1112. * pointer, but the call may sleep to wait for an outstanding
  1113. * request that is being handled.
  1114. */
  1115. extern void wiphy_unregister(struct wiphy *wiphy);
  1116. /**
  1117. * wiphy_free - free wiphy
  1118. *
  1119. * @wiphy: The wiphy to free
  1120. */
  1121. extern void wiphy_free(struct wiphy *wiphy);
  1122. /* internal struct */
  1123. struct cfg80211_conn;
  1124. struct cfg80211_internal_bss;
  1125. #define MAX_AUTH_BSSES 4
  1126. /**
  1127. * struct wireless_dev - wireless per-netdev state
  1128. *
  1129. * This structure must be allocated by the driver/stack
  1130. * that uses the ieee80211_ptr field in struct net_device
  1131. * (this is intentional so it can be allocated along with
  1132. * the netdev.)
  1133. *
  1134. * @wiphy: pointer to hardware description
  1135. * @iftype: interface type
  1136. * @list: (private) Used to collect the interfaces
  1137. * @netdev: (private) Used to reference back to the netdev
  1138. * @current_bss: (private) Used by the internal configuration code
  1139. * @bssid: (private) Used by the internal configuration code
  1140. * @ssid: (private) Used by the internal configuration code
  1141. * @ssid_len: (private) Used by the internal configuration code
  1142. * @wext: (private) Used by the internal wireless extensions compat code
  1143. * @wext_bssid: (private) Used by the internal wireless extensions compat code
  1144. */
  1145. struct wireless_dev {
  1146. struct wiphy *wiphy;
  1147. enum nl80211_iftype iftype;
  1148. /* private to the generic wireless code */
  1149. struct list_head list;
  1150. struct net_device *netdev;
  1151. /* currently used for IBSS and SME - might be rearranged later */
  1152. u8 ssid[IEEE80211_MAX_SSID_LEN];
  1153. u8 ssid_len;
  1154. enum {
  1155. CFG80211_SME_IDLE,
  1156. CFG80211_SME_CONNECTING,
  1157. CFG80211_SME_CONNECTED,
  1158. } sme_state;
  1159. struct cfg80211_conn *conn;
  1160. struct cfg80211_internal_bss *authtry_bsses[MAX_AUTH_BSSES];
  1161. struct cfg80211_internal_bss *auth_bsses[MAX_AUTH_BSSES];
  1162. struct cfg80211_internal_bss *current_bss; /* associated / joined */
  1163. #ifdef CONFIG_WIRELESS_EXT
  1164. /* wext data */
  1165. struct {
  1166. union {
  1167. struct cfg80211_ibss_params ibss;
  1168. struct cfg80211_connect_params connect;
  1169. };
  1170. u8 *ie;
  1171. size_t ie_len;
  1172. u8 bssid[ETH_ALEN];
  1173. u8 ssid[IEEE80211_MAX_SSID_LEN];
  1174. s8 default_key, default_mgmt_key;
  1175. bool ps;
  1176. int ps_timeout;
  1177. } wext;
  1178. #endif
  1179. };
  1180. /**
  1181. * wdev_priv - return wiphy priv from wireless_dev
  1182. *
  1183. * @wdev: The wireless device whose wiphy's priv pointer to return
  1184. */
  1185. static inline void *wdev_priv(struct wireless_dev *wdev)
  1186. {
  1187. BUG_ON(!wdev);
  1188. return wiphy_priv(wdev->wiphy);
  1189. }
  1190. /*
  1191. * Utility functions
  1192. */
  1193. /**
  1194. * ieee80211_channel_to_frequency - convert channel number to frequency
  1195. */
  1196. extern int ieee80211_channel_to_frequency(int chan);
  1197. /**
  1198. * ieee80211_frequency_to_channel - convert frequency to channel number
  1199. */
  1200. extern int ieee80211_frequency_to_channel(int freq);
  1201. /*
  1202. * Name indirection necessary because the ieee80211 code also has
  1203. * a function named "ieee80211_get_channel", so if you include
  1204. * cfg80211's header file you get cfg80211's version, if you try
  1205. * to include both header files you'll (rightfully!) get a symbol
  1206. * clash.
  1207. */
  1208. extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
  1209. int freq);
  1210. /**
  1211. * ieee80211_get_channel - get channel struct from wiphy for specified frequency
  1212. */
  1213. static inline struct ieee80211_channel *
  1214. ieee80211_get_channel(struct wiphy *wiphy, int freq)
  1215. {
  1216. return __ieee80211_get_channel(wiphy, freq);
  1217. }
  1218. /**
  1219. * ieee80211_get_response_rate - get basic rate for a given rate
  1220. *
  1221. * @sband: the band to look for rates in
  1222. * @basic_rates: bitmap of basic rates
  1223. * @bitrate: the bitrate for which to find the basic rate
  1224. *
  1225. * This function returns the basic rate corresponding to a given
  1226. * bitrate, that is the next lower bitrate contained in the basic
  1227. * rate map, which is, for this function, given as a bitmap of
  1228. * indices of rates in the band's bitrate table.
  1229. */
  1230. struct ieee80211_rate *
  1231. ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
  1232. u32 basic_rates, int bitrate);
  1233. /*
  1234. * Radiotap parsing functions -- for controlled injection support
  1235. *
  1236. * Implemented in net/wireless/radiotap.c
  1237. * Documentation in Documentation/networking/radiotap-headers.txt
  1238. */
  1239. /**
  1240. * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
  1241. * @rtheader: pointer to the radiotap header we are walking through
  1242. * @max_length: length of radiotap header in cpu byte ordering
  1243. * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
  1244. * @this_arg: pointer to current radiotap arg
  1245. * @arg_index: internal next argument index
  1246. * @arg: internal next argument pointer
  1247. * @next_bitmap: internal pointer to next present u32
  1248. * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
  1249. */
  1250. struct ieee80211_radiotap_iterator {
  1251. struct ieee80211_radiotap_header *rtheader;
  1252. int max_length;
  1253. int this_arg_index;
  1254. u8 *this_arg;
  1255. int arg_index;
  1256. u8 *arg;
  1257. __le32 *next_bitmap;
  1258. u32 bitmap_shifter;
  1259. };
  1260. extern int ieee80211_radiotap_iterator_init(
  1261. struct ieee80211_radiotap_iterator *iterator,
  1262. struct ieee80211_radiotap_header *radiotap_header,
  1263. int max_length);
  1264. extern int ieee80211_radiotap_iterator_next(
  1265. struct ieee80211_radiotap_iterator *iterator);
  1266. extern const unsigned char rfc1042_header[6];
  1267. extern const unsigned char bridge_tunnel_header[6];
  1268. /**
  1269. * ieee80211_get_hdrlen_from_skb - get header length from data
  1270. *
  1271. * Given an skb with a raw 802.11 header at the data pointer this function
  1272. * returns the 802.11 header length in bytes (not including encryption
  1273. * headers). If the data in the sk_buff is too short to contain a valid 802.11
  1274. * header the function returns 0.
  1275. *
  1276. * @skb: the frame
  1277. */
  1278. unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
  1279. /**
  1280. * ieee80211_hdrlen - get header length in bytes from frame control
  1281. * @fc: frame control field in little-endian format
  1282. */
  1283. unsigned int ieee80211_hdrlen(__le16 fc);
  1284. /**
  1285. * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
  1286. * @skb: the 802.11 data frame
  1287. * @addr: the device MAC address
  1288. * @iftype: the virtual interface type
  1289. */
  1290. int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
  1291. enum nl80211_iftype iftype);
  1292. /**
  1293. * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
  1294. * @skb: the 802.3 frame
  1295. * @addr: the device MAC address
  1296. * @iftype: the virtual interface type
  1297. * @bssid: the network bssid (used only for iftype STATION and ADHOC)
  1298. * @qos: build 802.11 QoS data frame
  1299. */
  1300. int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr,
  1301. enum nl80211_iftype iftype, u8 *bssid, bool qos);
  1302. /**
  1303. * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
  1304. * @skb: the data frame
  1305. */
  1306. unsigned int cfg80211_classify8021d(struct sk_buff *skb);
  1307. /*
  1308. * Regulatory helper functions for wiphys
  1309. */
  1310. /**
  1311. * regulatory_hint - driver hint to the wireless core a regulatory domain
  1312. * @wiphy: the wireless device giving the hint (used only for reporting
  1313. * conflicts)
  1314. * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
  1315. * should be in. If @rd is set this should be NULL. Note that if you
  1316. * set this to NULL you should still set rd->alpha2 to some accepted
  1317. * alpha2.
  1318. *
  1319. * Wireless drivers can use this function to hint to the wireless core
  1320. * what it believes should be the current regulatory domain by
  1321. * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
  1322. * domain should be in or by providing a completely build regulatory domain.
  1323. * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
  1324. * for a regulatory domain structure for the respective country.
  1325. *
  1326. * The wiphy must have been registered to cfg80211 prior to this call.
  1327. * For cfg80211 drivers this means you must first use wiphy_register(),
  1328. * for mac80211 drivers you must first use ieee80211_register_hw().
  1329. *
  1330. * Drivers should check the return value, its possible you can get
  1331. * an -ENOMEM.
  1332. */
  1333. extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
  1334. /**
  1335. * regulatory_hint_11d - hints a country IE as a regulatory domain
  1336. * @wiphy: the wireless device giving the hint (used only for reporting
  1337. * conflicts)
  1338. * @country_ie: pointer to the country IE
  1339. * @country_ie_len: length of the country IE
  1340. *
  1341. * We will intersect the rd with the what CRDA tells us should apply
  1342. * for the alpha2 this country IE belongs to, this prevents APs from
  1343. * sending us incorrect or outdated information against a country.
  1344. */
  1345. extern void regulatory_hint_11d(struct wiphy *wiphy,
  1346. u8 *country_ie,
  1347. u8 country_ie_len);
  1348. /**
  1349. * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
  1350. * @wiphy: the wireless device we want to process the regulatory domain on
  1351. * @regd: the custom regulatory domain to use for this wiphy
  1352. *
  1353. * Drivers can sometimes have custom regulatory domains which do not apply
  1354. * to a specific country. Drivers can use this to apply such custom regulatory
  1355. * domains. This routine must be called prior to wiphy registration. The
  1356. * custom regulatory domain will be trusted completely and as such previous
  1357. * default channel settings will be disregarded. If no rule is found for a
  1358. * channel on the regulatory domain the channel will be disabled.
  1359. */
  1360. extern void wiphy_apply_custom_regulatory(
  1361. struct wiphy *wiphy,
  1362. const struct ieee80211_regdomain *regd);
  1363. /**
  1364. * freq_reg_info - get regulatory information for the given frequency
  1365. * @wiphy: the wiphy for which we want to process this rule for
  1366. * @center_freq: Frequency in KHz for which we want regulatory information for
  1367. * @desired_bw_khz: the desired max bandwidth you want to use per
  1368. * channel. Note that this is still 20 MHz if you want to use HT40
  1369. * as HT40 makes use of two channels for its 40 MHz width bandwidth.
  1370. * If set to 0 we'll assume you want the standard 20 MHz.
  1371. * @reg_rule: the regulatory rule which we have for this frequency
  1372. *
  1373. * Use this function to get the regulatory rule for a specific frequency on
  1374. * a given wireless device. If the device has a specific regulatory domain
  1375. * it wants to follow we respect that unless a country IE has been received
  1376. * and processed already.
  1377. *
  1378. * Returns 0 if it was able to find a valid regulatory rule which does
  1379. * apply to the given center_freq otherwise it returns non-zero. It will
  1380. * also return -ERANGE if we determine the given center_freq does not even have
  1381. * a regulatory rule for a frequency range in the center_freq's band. See
  1382. * freq_in_rule_band() for our current definition of a band -- this is purely
  1383. * subjective and right now its 802.11 specific.
  1384. */
  1385. extern int freq_reg_info(struct wiphy *wiphy,
  1386. u32 center_freq,
  1387. u32 desired_bw_khz,
  1388. const struct ieee80211_reg_rule **reg_rule);
  1389. /*
  1390. * Temporary wext handlers & helper functions
  1391. *
  1392. * In the future cfg80211 will simply assign the entire wext handler
  1393. * structure to netdevs it manages, but we're not there yet.
  1394. */
  1395. int cfg80211_wext_giwname(struct net_device *dev,
  1396. struct iw_request_info *info,
  1397. char *name, char *extra);
  1398. int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
  1399. u32 *mode, char *extra);
  1400. int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
  1401. u32 *mode, char *extra);
  1402. int cfg80211_wext_siwscan(struct net_device *dev,
  1403. struct iw_request_info *info,
  1404. union iwreq_data *wrqu, char *extra);
  1405. int cfg80211_wext_giwscan(struct net_device *dev,
  1406. struct iw_request_info *info,
  1407. struct iw_point *data, char *extra);
  1408. int cfg80211_wext_siwmlme(struct net_device *dev,
  1409. struct iw_request_info *info,
  1410. struct iw_point *data, char *extra);
  1411. int cfg80211_wext_giwrange(struct net_device *dev,
  1412. struct iw_request_info *info,
  1413. struct iw_point *data, char *extra);
  1414. int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
  1415. struct iw_request_info *info,
  1416. struct iw_freq *freq, char *extra);
  1417. int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
  1418. struct iw_request_info *info,
  1419. struct iw_freq *freq, char *extra);
  1420. int cfg80211_ibss_wext_siwessid(struct net_device *dev,
  1421. struct iw_request_info *info,
  1422. struct iw_point *data, char *ssid);
  1423. int cfg80211_ibss_wext_giwessid(struct net_device *dev,
  1424. struct iw_request_info *info,
  1425. struct iw_point *data, char *ssid);
  1426. int cfg80211_ibss_wext_siwap(struct net_device *dev,
  1427. struct iw_request_info *info,
  1428. struct sockaddr *ap_addr, char *extra);
  1429. int cfg80211_ibss_wext_giwap(struct net_device *dev,
  1430. struct iw_request_info *info,
  1431. struct sockaddr *ap_addr, char *extra);
  1432. int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
  1433. struct iw_request_info *info,
  1434. struct iw_freq *freq, char *extra);
  1435. int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
  1436. struct iw_request_info *info,
  1437. struct iw_freq *freq, char *extra);
  1438. int cfg80211_mgd_wext_siwessid(struct net_device *dev,
  1439. struct iw_request_info *info,
  1440. struct iw_point *data, char *ssid);
  1441. int cfg80211_mgd_wext_giwessid(struct net_device *dev,
  1442. struct iw_request_info *info,
  1443. struct iw_point *data, char *ssid);
  1444. int cfg80211_mgd_wext_siwap(struct net_device *dev,
  1445. struct iw_request_info *info,
  1446. struct sockaddr *ap_addr, char *extra);
  1447. int cfg80211_mgd_wext_giwap(struct net_device *dev,
  1448. struct iw_request_info *info,
  1449. struct sockaddr *ap_addr, char *extra);
  1450. int cfg80211_wext_siwgenie(struct net_device *dev,
  1451. struct iw_request_info *info,
  1452. struct iw_point *data, char *extra);
  1453. int cfg80211_wext_siwauth(struct net_device *dev,
  1454. struct iw_request_info *info,
  1455. struct iw_param *data, char *extra);
  1456. int cfg80211_wext_giwauth(struct net_device *dev,
  1457. struct iw_request_info *info,
  1458. struct iw_param *data, char *extra);
  1459. struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
  1460. struct iw_freq *freq);
  1461. int cfg80211_wext_siwrate(struct net_device *dev,
  1462. struct iw_request_info *info,
  1463. struct iw_param *rate, char *extra);
  1464. int cfg80211_wext_giwrate(struct net_device *dev,
  1465. struct iw_request_info *info,
  1466. struct iw_param *rate, char *extra);
  1467. int cfg80211_wext_siwrts(struct net_device *dev,
  1468. struct iw_request_info *info,
  1469. struct iw_param *rts, char *extra);
  1470. int cfg80211_wext_giwrts(struct net_device *dev,
  1471. struct iw_request_info *info,
  1472. struct iw_param *rts, char *extra);
  1473. int cfg80211_wext_siwfrag(struct net_device *dev,
  1474. struct iw_request_info *info,
  1475. struct iw_param *frag, char *extra);
  1476. int cfg80211_wext_giwfrag(struct net_device *dev,
  1477. struct iw_request_info *info,
  1478. struct iw_param *frag, char *extra);
  1479. int cfg80211_wext_siwretry(struct net_device *dev,
  1480. struct iw_request_info *info,
  1481. struct iw_param *retry, char *extra);
  1482. int cfg80211_wext_giwretry(struct net_device *dev,
  1483. struct iw_request_info *info,
  1484. struct iw_param *retry, char *extra);
  1485. int cfg80211_wext_siwencodeext(struct net_device *dev,
  1486. struct iw_request_info *info,
  1487. struct iw_point *erq, char *extra);
  1488. int cfg80211_wext_siwencode(struct net_device *dev,
  1489. struct iw_request_info *info,
  1490. struct iw_point *erq, char *keybuf);
  1491. int cfg80211_wext_giwencode(struct net_device *dev,
  1492. struct iw_request_info *info,
  1493. struct iw_point *erq, char *keybuf);
  1494. int cfg80211_wext_siwtxpower(struct net_device *dev,
  1495. struct iw_request_info *info,
  1496. union iwreq_data *data, char *keybuf);
  1497. int cfg80211_wext_giwtxpower(struct net_device *dev,
  1498. struct iw_request_info *info,
  1499. union iwreq_data *data, char *keybuf);
  1500. struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev);
  1501. int cfg80211_wext_siwpower(struct net_device *dev,
  1502. struct iw_request_info *info,
  1503. struct iw_param *wrq, char *extra);
  1504. int cfg80211_wext_giwpower(struct net_device *dev,
  1505. struct iw_request_info *info,
  1506. struct iw_param *wrq, char *extra);
  1507. int cfg80211_wds_wext_siwap(struct net_device *dev,
  1508. struct iw_request_info *info,
  1509. struct sockaddr *addr, char *extra);
  1510. int cfg80211_wds_wext_giwap(struct net_device *dev,
  1511. struct iw_request_info *info,
  1512. struct sockaddr *addr, char *extra);
  1513. /*
  1514. * callbacks for asynchronous cfg80211 methods, notification
  1515. * functions and BSS handling helpers
  1516. */
  1517. /**
  1518. * cfg80211_scan_done - notify that scan finished
  1519. *
  1520. * @request: the corresponding scan request
  1521. * @aborted: set to true if the scan was aborted for any reason,
  1522. * userspace will be notified of that
  1523. */
  1524. void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
  1525. /**
  1526. * cfg80211_inform_bss - inform cfg80211 of a new BSS
  1527. *
  1528. * @wiphy: the wiphy reporting the BSS
  1529. * @bss: the found BSS
  1530. * @signal: the signal strength, type depends on the wiphy's signal_type
  1531. * @gfp: context flags
  1532. *
  1533. * This informs cfg80211 that BSS information was found and
  1534. * the BSS should be updated/added.
  1535. */
  1536. struct cfg80211_bss*
  1537. cfg80211_inform_bss_frame(struct wiphy *wiphy,
  1538. struct ieee80211_channel *channel,
  1539. struct ieee80211_mgmt *mgmt, size_t len,
  1540. s32 signal, gfp_t gfp);
  1541. struct cfg80211_bss*
  1542. cfg80211_inform_bss(struct wiphy *wiphy,
  1543. struct ieee80211_channel *channel,
  1544. const u8 *bssid,
  1545. u64 timestamp, u16 capability, u16 beacon_interval,
  1546. const u8 *ie, size_t ielen,
  1547. s32 signal, gfp_t gfp);
  1548. struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
  1549. struct ieee80211_channel *channel,
  1550. const u8 *bssid,
  1551. const u8 *ssid, size_t ssid_len,
  1552. u16 capa_mask, u16 capa_val);
  1553. static inline struct cfg80211_bss *
  1554. cfg80211_get_ibss(struct wiphy *wiphy,
  1555. struct ieee80211_channel *channel,
  1556. const u8 *ssid, size_t ssid_len)
  1557. {
  1558. return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
  1559. WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
  1560. }
  1561. struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
  1562. struct ieee80211_channel *channel,
  1563. const u8 *meshid, size_t meshidlen,
  1564. const u8 *meshcfg);
  1565. void cfg80211_put_bss(struct cfg80211_bss *bss);
  1566. /**
  1567. * cfg80211_unlink_bss - unlink BSS from internal data structures
  1568. * @wiphy: the wiphy
  1569. * @bss: the bss to remove
  1570. *
  1571. * This function removes the given BSS from the internal data structures
  1572. * thereby making it no longer show up in scan results etc. Use this
  1573. * function when you detect a BSS is gone. Normally BSSes will also time
  1574. * out, so it is not necessary to use this function at all.
  1575. */
  1576. void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  1577. /**
  1578. * cfg80211_send_rx_auth - notification of processed authentication
  1579. * @dev: network device
  1580. * @buf: authentication frame (header + body)
  1581. * @len: length of the frame data
  1582. * @gfp: allocation flags
  1583. *
  1584. * This function is called whenever an authentication has been processed in
  1585. * station mode. The driver is required to call either this function or
  1586. * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
  1587. * call.
  1588. */
  1589. void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1590. /**
  1591. * cfg80211_send_auth_timeout - notification of timed out authentication
  1592. * @dev: network device
  1593. * @addr: The MAC address of the device with which the authentication timed out
  1594. * @gfp: allocation flags
  1595. */
  1596. void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp);
  1597. /**
  1598. * cfg80211_send_rx_assoc - notification of processed association
  1599. * @dev: network device
  1600. * @buf: (re)association response frame (header + body)
  1601. * @len: length of the frame data
  1602. * @gfp: allocation flags
  1603. *
  1604. * This function is called whenever a (re)association response has been
  1605. * processed in station mode. The driver is required to call either this
  1606. * function or cfg80211_send_assoc_timeout() to indicate the result of
  1607. * cfg80211_ops::assoc() call.
  1608. */
  1609. void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1610. /**
  1611. * cfg80211_send_assoc_timeout - notification of timed out association
  1612. * @dev: network device
  1613. * @addr: The MAC address of the device with which the association timed out
  1614. * @gfp: allocation flags
  1615. */
  1616. void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp);
  1617. /**
  1618. * cfg80211_send_deauth - notification of processed deauthentication
  1619. * @dev: network device
  1620. * @buf: deauthentication frame (header + body)
  1621. * @len: length of the frame data
  1622. * @gfp: allocation flags
  1623. *
  1624. * This function is called whenever deauthentication has been processed in
  1625. * station mode. This includes both received deauthentication frames and
  1626. * locally generated ones.
  1627. */
  1628. void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1629. /**
  1630. * cfg80211_send_disassoc - notification of processed disassociation
  1631. * @dev: network device
  1632. * @buf: disassociation response frame (header + body)
  1633. * @len: length of the frame data
  1634. * @gfp: allocation flags
  1635. *
  1636. * This function is called whenever disassociation has been processed in
  1637. * station mode. This includes both received disassociation frames and locally
  1638. * generated ones.
  1639. */
  1640. void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp);
  1641. /**
  1642. * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
  1643. * @dev: network device
  1644. * @addr: The source MAC address of the frame
  1645. * @key_type: The key type that the received frame used
  1646. * @key_id: Key identifier (0..3)
  1647. * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
  1648. * @gfp: allocation flags
  1649. *
  1650. * This function is called whenever the local MAC detects a MIC failure in a
  1651. * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
  1652. * primitive.
  1653. */
  1654. void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
  1655. enum nl80211_key_type key_type, int key_id,
  1656. const u8 *tsc, gfp_t gfp);
  1657. /**
  1658. * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
  1659. *
  1660. * @dev: network device
  1661. * @bssid: the BSSID of the IBSS joined
  1662. * @gfp: allocation flags
  1663. *
  1664. * This function notifies cfg80211 that the device joined an IBSS or
  1665. * switched to a different BSSID. Before this function can be called,
  1666. * either a beacon has to have been received from the IBSS, or one of
  1667. * the cfg80211_inform_bss{,_frame} functions must have been called
  1668. * with the locally generated beacon -- this guarantees that there is
  1669. * always a scan result for this IBSS. cfg80211 will handle the rest.
  1670. */
  1671. void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
  1672. /**
  1673. * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
  1674. * @wiphy: the wiphy
  1675. * @blocked: block status
  1676. */
  1677. void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
  1678. /**
  1679. * wiphy_rfkill_start_polling - start polling rfkill
  1680. * @wiphy: the wiphy
  1681. */
  1682. void wiphy_rfkill_start_polling(struct wiphy *wiphy);
  1683. /**
  1684. * wiphy_rfkill_stop_polling - stop polling rfkill
  1685. * @wiphy: the wiphy
  1686. */
  1687. void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
  1688. #ifdef CONFIG_NL80211_TESTMODE
  1689. /**
  1690. * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
  1691. * @wiphy: the wiphy
  1692. * @approxlen: an upper bound of the length of the data that will
  1693. * be put into the skb
  1694. *
  1695. * This function allocates and pre-fills an skb for a reply to
  1696. * the testmode command. Since it is intended for a reply, calling
  1697. * it outside of the @testmode_cmd operation is invalid.
  1698. *
  1699. * The returned skb (or %NULL if any errors happen) is pre-filled
  1700. * with the wiphy index and set up in a way that any data that is
  1701. * put into the skb (with skb_put(), nla_put() or similar) will end
  1702. * up being within the %NL80211_ATTR_TESTDATA attribute, so all that
  1703. * needs to be done with the skb is adding data for the corresponding
  1704. * userspace tool which can then read that data out of the testdata
  1705. * attribute. You must not modify the skb in any other way.
  1706. *
  1707. * When done, call cfg80211_testmode_reply() with the skb and return
  1708. * its error code as the result of the @testmode_cmd operation.
  1709. */
  1710. struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy,
  1711. int approxlen);
  1712. /**
  1713. * cfg80211_testmode_reply - send the reply skb
  1714. * @skb: The skb, must have been allocated with
  1715. * cfg80211_testmode_alloc_reply_skb()
  1716. *
  1717. * Returns an error code or 0 on success, since calling this
  1718. * function will usually be the last thing before returning
  1719. * from the @testmode_cmd you should return the error code.
  1720. * Note that this function consumes the skb regardless of the
  1721. * return value.
  1722. */
  1723. int cfg80211_testmode_reply(struct sk_buff *skb);
  1724. /**
  1725. * cfg80211_testmode_alloc_event_skb - allocate testmode event
  1726. * @wiphy: the wiphy
  1727. * @approxlen: an upper bound of the length of the data that will
  1728. * be put into the skb
  1729. * @gfp: allocation flags
  1730. *
  1731. * This function allocates and pre-fills an skb for an event on the
  1732. * testmode multicast group.
  1733. *
  1734. * The returned skb (or %NULL if any errors happen) is set up in the
  1735. * same way as with cfg80211_testmode_alloc_reply_skb() but prepared
  1736. * for an event. As there, you should simply add data to it that will
  1737. * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must
  1738. * not modify the skb in any other way.
  1739. *
  1740. * When done filling the skb, call cfg80211_testmode_event() with the
  1741. * skb to send the event.
  1742. */
  1743. struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy,
  1744. int approxlen, gfp_t gfp);
  1745. /**
  1746. * cfg80211_testmode_event - send the event
  1747. * @skb: The skb, must have been allocated with
  1748. * cfg80211_testmode_alloc_event_skb()
  1749. * @gfp: allocation flags
  1750. *
  1751. * This function sends the given @skb, which must have been allocated
  1752. * by cfg80211_testmode_alloc_event_skb(), as an event. It always
  1753. * consumes it.
  1754. */
  1755. void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp);
  1756. #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
  1757. #else
  1758. #define CFG80211_TESTMODE_CMD(cmd)
  1759. #endif
  1760. /**
  1761. * cfg80211_connect_result - notify cfg80211 of connection result
  1762. *
  1763. * @dev: network device
  1764. * @bssid: the BSSID of the AP
  1765. * @req_ie: association request IEs (maybe be %NULL)
  1766. * @req_ie_len: association request IEs length
  1767. * @resp_ie: association response IEs (may be %NULL)
  1768. * @resp_ie_len: assoc response IEs length
  1769. * @status: status code, 0 for successful connection, use
  1770. * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
  1771. * the real status code for failures.
  1772. * @gfp: allocation flags
  1773. *
  1774. * It should be called by the underlying driver whenever connect() has
  1775. * succeeded.
  1776. */
  1777. void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
  1778. const u8 *req_ie, size_t req_ie_len,
  1779. const u8 *resp_ie, size_t resp_ie_len,
  1780. u16 status, gfp_t gfp);
  1781. /**
  1782. * cfg80211_roamed - notify cfg80211 of roaming
  1783. *
  1784. * @dev: network device
  1785. * @bssid: the BSSID of the new AP
  1786. * @req_ie: association request IEs (maybe be %NULL)
  1787. * @req_ie_len: association request IEs length
  1788. * @resp_ie: association response IEs (may be %NULL)
  1789. * @resp_ie_len: assoc response IEs length
  1790. * @gfp: allocation flags
  1791. *
  1792. * It should be called by the underlying driver whenever it roamed
  1793. * from one AP to another while connected.
  1794. */
  1795. void cfg80211_roamed(struct net_device *dev, const u8 *bssid,
  1796. const u8 *req_ie, size_t req_ie_len,
  1797. const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
  1798. /**
  1799. * cfg80211_disconnected - notify cfg80211 that connection was dropped
  1800. *
  1801. * @dev: network device
  1802. * @ie: information elements of the deauth/disassoc frame (may be %NULL)
  1803. * @ie_len: length of IEs
  1804. * @reason: reason code for the disconnection, set it to 0 if unknown
  1805. * @gfp: allocation flags
  1806. *
  1807. * After it calls this function, the driver should enter an idle state
  1808. * and not try to connect to any AP any more.
  1809. */
  1810. void cfg80211_disconnected(struct net_device *dev, u16 reason,
  1811. u8 *ie, size_t ie_len, gfp_t gfp);
  1812. #endif /* __NET_CFG80211_H */