ieee80211_i.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /*
  2. * Copyright 2002-2005, Instant802 Networks, Inc.
  3. * Copyright 2005, Devicescape Software, Inc.
  4. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef IEEE80211_I_H
  11. #define IEEE80211_I_H
  12. #include <linux/kernel.h>
  13. #include <linux/device.h>
  14. #include <linux/if_ether.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/list.h>
  17. #include <linux/netdevice.h>
  18. #include <linux/skbuff.h>
  19. #include <linux/workqueue.h>
  20. #include <linux/types.h>
  21. #include <linux/spinlock.h>
  22. #include <net/wireless.h>
  23. #include "ieee80211_key.h"
  24. #include "sta_info.h"
  25. /* ieee80211.o internal definitions, etc. These are not included into
  26. * low-level drivers. */
  27. #ifndef ETH_P_PAE
  28. #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
  29. #endif /* ETH_P_PAE */
  30. #define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
  31. struct ieee80211_local;
  32. #define BIT(x) (1 << (x))
  33. #define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
  34. /* Maximum number of broadcast/multicast frames to buffer when some of the
  35. * associated stations are using power saving. */
  36. #define AP_MAX_BC_BUFFER 128
  37. /* Maximum number of frames buffered to all STAs, including multicast frames.
  38. * Note: increasing this limit increases the potential memory requirement. Each
  39. * frame can be up to about 2 kB long. */
  40. #define TOTAL_MAX_TX_BUFFER 512
  41. /* Required encryption head and tailroom */
  42. #define IEEE80211_ENCRYPT_HEADROOM 8
  43. #define IEEE80211_ENCRYPT_TAILROOM 12
  44. /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
  45. * reception of at least three fragmented frames. This limit can be increased
  46. * by changing this define, at the cost of slower frame reassembly and
  47. * increased memory use (about 2 kB of RAM per entry). */
  48. #define IEEE80211_FRAGMENT_MAX 4
  49. struct ieee80211_fragment_entry {
  50. unsigned long first_frag_time;
  51. unsigned int seq;
  52. unsigned int rx_queue;
  53. unsigned int last_frag;
  54. unsigned int extra_len;
  55. struct sk_buff_head skb_list;
  56. int ccmp; /* Whether fragments were encrypted with CCMP */
  57. u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
  58. };
  59. struct ieee80211_sta_bss {
  60. struct list_head list;
  61. struct ieee80211_sta_bss *hnext;
  62. atomic_t users;
  63. u8 bssid[ETH_ALEN];
  64. u8 ssid[IEEE80211_MAX_SSID_LEN];
  65. size_t ssid_len;
  66. u16 capability; /* host byte order */
  67. int hw_mode;
  68. int channel;
  69. int freq;
  70. int rssi, signal, noise;
  71. u8 *wpa_ie;
  72. size_t wpa_ie_len;
  73. u8 *rsn_ie;
  74. size_t rsn_ie_len;
  75. u8 *wmm_ie;
  76. size_t wmm_ie_len;
  77. #define IEEE80211_MAX_SUPP_RATES 32
  78. u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
  79. size_t supp_rates_len;
  80. int beacon_int;
  81. u64 timestamp;
  82. int probe_resp;
  83. unsigned long last_update;
  84. };
  85. typedef enum {
  86. TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
  87. } ieee80211_txrx_result;
  88. struct ieee80211_txrx_data {
  89. struct sk_buff *skb;
  90. struct net_device *dev;
  91. struct ieee80211_local *local;
  92. struct ieee80211_sub_if_data *sdata;
  93. struct sta_info *sta;
  94. u16 fc, ethertype;
  95. struct ieee80211_key *key;
  96. unsigned int fragmented:1; /* whether the MSDU was fragmented */
  97. union {
  98. struct {
  99. struct ieee80211_tx_control *control;
  100. unsigned int unicast:1;
  101. unsigned int ps_buffered:1;
  102. unsigned int short_preamble:1;
  103. unsigned int probe_last_frag:1;
  104. struct ieee80211_hw_mode *mode;
  105. struct ieee80211_rate *rate;
  106. /* use this rate (if set) for last fragment; rate can
  107. * be set to lower rate for the first fragments, e.g.,
  108. * when using CTS protection with IEEE 802.11g. */
  109. struct ieee80211_rate *last_frag_rate;
  110. int last_frag_hwrate;
  111. int mgmt_interface;
  112. /* Extra fragments (in addition to the first fragment
  113. * in skb) */
  114. int num_extra_frag;
  115. struct sk_buff **extra_frag;
  116. } tx;
  117. struct {
  118. struct ieee80211_rx_status *status;
  119. int sent_ps_buffered;
  120. int queue;
  121. int load;
  122. unsigned int in_scan:1;
  123. /* frame is destined to interface currently processed
  124. * (including multicast frames) */
  125. unsigned int ra_match:1;
  126. } rx;
  127. } u;
  128. };
  129. /* Stored in sk_buff->cb */
  130. struct ieee80211_tx_packet_data {
  131. int ifindex;
  132. unsigned long jiffies;
  133. unsigned int req_tx_status:1;
  134. unsigned int do_not_encrypt:1;
  135. unsigned int requeue:1;
  136. unsigned int mgmt_iface:1;
  137. unsigned int queue:4;
  138. };
  139. struct ieee80211_tx_stored_packet {
  140. struct ieee80211_tx_control control;
  141. struct sk_buff *skb;
  142. int num_extra_frag;
  143. struct sk_buff **extra_frag;
  144. int last_frag_rateidx;
  145. int last_frag_hwrate;
  146. struct ieee80211_rate *last_frag_rate;
  147. unsigned int last_frag_rate_ctrl_probe:1;
  148. };
  149. typedef ieee80211_txrx_result (*ieee80211_tx_handler)
  150. (struct ieee80211_txrx_data *tx);
  151. typedef ieee80211_txrx_result (*ieee80211_rx_handler)
  152. (struct ieee80211_txrx_data *rx);
  153. struct ieee80211_if_ap {
  154. u8 *beacon_head, *beacon_tail;
  155. int beacon_head_len, beacon_tail_len;
  156. u8 ssid[IEEE80211_MAX_SSID_LEN];
  157. size_t ssid_len;
  158. u8 *generic_elem;
  159. size_t generic_elem_len;
  160. /* yes, this looks ugly, but guarantees that we can later use
  161. * bitmap_empty :)
  162. * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */
  163. u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
  164. atomic_t num_sta_ps; /* number of stations in PS mode */
  165. struct sk_buff_head ps_bc_buf;
  166. int dtim_period, dtim_count;
  167. int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
  168. int max_ratectrl_rateidx; /* max TX rateidx for rate control */
  169. int num_beacons; /* number of TXed beacon frames for this BSS */
  170. };
  171. struct ieee80211_if_wds {
  172. u8 remote_addr[ETH_ALEN];
  173. struct sta_info *sta;
  174. };
  175. struct ieee80211_if_vlan {
  176. u8 id;
  177. };
  178. struct ieee80211_if_sta {
  179. enum {
  180. IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
  181. IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
  182. IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
  183. } state;
  184. struct timer_list timer;
  185. struct work_struct work;
  186. u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
  187. u8 ssid[IEEE80211_MAX_SSID_LEN];
  188. size_t ssid_len;
  189. u16 aid;
  190. u16 ap_capab, capab;
  191. u8 *extra_ie; /* to be added to the end of AssocReq */
  192. size_t extra_ie_len;
  193. /* The last AssocReq/Resp IEs */
  194. u8 *assocreq_ies, *assocresp_ies;
  195. size_t assocreq_ies_len, assocresp_ies_len;
  196. int auth_tries, assoc_tries;
  197. unsigned int ssid_set:1;
  198. unsigned int bssid_set:1;
  199. unsigned int prev_bssid_set:1;
  200. unsigned int authenticated:1;
  201. unsigned int associated:1;
  202. unsigned int probereq_poll:1;
  203. unsigned int use_protection:1;
  204. unsigned int create_ibss:1;
  205. unsigned int mixed_cell:1;
  206. unsigned int wmm_enabled:1;
  207. unsigned int auto_ssid_sel:1;
  208. unsigned int auto_bssid_sel:1;
  209. unsigned int auto_channel_sel:1;
  210. #define IEEE80211_STA_REQ_SCAN 0
  211. #define IEEE80211_STA_REQ_AUTH 1
  212. #define IEEE80211_STA_REQ_RUN 2
  213. unsigned long request;
  214. struct sk_buff_head skb_queue;
  215. int key_mgmt;
  216. unsigned long last_probe;
  217. #define IEEE80211_AUTH_ALG_OPEN BIT(0)
  218. #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
  219. #define IEEE80211_AUTH_ALG_LEAP BIT(2)
  220. unsigned int auth_algs; /* bitfield of allowed auth algs */
  221. int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
  222. int auth_transaction;
  223. unsigned long ibss_join_req;
  224. struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
  225. u32 supp_rates_bits;
  226. int wmm_last_param_set;
  227. };
  228. struct ieee80211_sub_if_data {
  229. struct list_head list;
  230. unsigned int type;
  231. struct wireless_dev wdev;
  232. struct net_device *dev;
  233. struct ieee80211_local *local;
  234. int mc_count;
  235. unsigned int allmulti:1;
  236. unsigned int promisc:1;
  237. struct net_device_stats stats;
  238. int drop_unencrypted;
  239. int eapol; /* 0 = process EAPOL frames as normal data frames,
  240. * 1 = send EAPOL frames through wlan#ap to hostapd
  241. * (default) */
  242. int ieee802_1x; /* IEEE 802.1X PAE - drop packet to/from unauthorized
  243. * port */
  244. u16 sequence;
  245. /* Fragment table for host-based reassembly */
  246. struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
  247. unsigned int fragment_next;
  248. #define NUM_DEFAULT_KEYS 4
  249. struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
  250. struct ieee80211_key *default_key;
  251. struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
  252. union {
  253. struct ieee80211_if_ap ap;
  254. struct ieee80211_if_wds wds;
  255. struct ieee80211_if_vlan vlan;
  256. struct ieee80211_if_sta sta;
  257. } u;
  258. int channel_use;
  259. int channel_use_raw;
  260. };
  261. #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
  262. enum {
  263. IEEE80211_RX_MSG = 1,
  264. IEEE80211_TX_STATUS_MSG = 2,
  265. };
  266. struct ieee80211_local {
  267. /* embed the driver visible part.
  268. * don't cast (use the static inlines below), but we keep
  269. * it first anyway so they become a no-op */
  270. struct ieee80211_hw hw;
  271. const struct ieee80211_ops *ops;
  272. /* List of registered struct ieee80211_hw_mode */
  273. struct list_head modes_list;
  274. struct net_device *mdev; /* wmaster# - "master" 802.11 device */
  275. struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
  276. int open_count;
  277. int monitors;
  278. struct iw_statistics wstats;
  279. u8 wstats_flags;
  280. enum {
  281. IEEE80211_DEV_UNINITIALIZED = 0,
  282. IEEE80211_DEV_REGISTERED,
  283. IEEE80211_DEV_UNREGISTERED,
  284. } reg_state;
  285. /* Tasklet and skb queue to process calls from IRQ mode. All frames
  286. * added to skb_queue will be processed, but frames in
  287. * skb_queue_unreliable may be dropped if the total length of these
  288. * queues increases over the limit. */
  289. #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
  290. struct tasklet_struct tasklet;
  291. struct sk_buff_head skb_queue;
  292. struct sk_buff_head skb_queue_unreliable;
  293. /* Station data structures */
  294. spinlock_t sta_lock; /* mutex for STA data structures */
  295. int num_sta; /* number of stations in sta_list */
  296. struct list_head sta_list;
  297. struct list_head deleted_sta_list;
  298. struct sta_info *sta_hash[STA_HASH_SIZE];
  299. struct timer_list sta_cleanup;
  300. unsigned long state[NUM_TX_DATA_QUEUES];
  301. struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES];
  302. struct tasklet_struct tx_pending_tasklet;
  303. int mc_count; /* total count of multicast entries in all interfaces */
  304. int iff_allmultis, iff_promiscs;
  305. /* number of interfaces with corresponding IFF_ flags */
  306. struct rate_control_ref *rate_ctrl;
  307. int next_mode; /* MODE_IEEE80211*
  308. * The mode preference for next channel change. This is
  309. * used to select .11g vs. .11b channels (or 4.9 GHz vs.
  310. * .11a) when the channel number is not unique. */
  311. /* Supported and basic rate filters for different modes. These are
  312. * pointers to -1 terminated lists and rates in 100 kbps units. */
  313. int *supp_rates[NUM_IEEE80211_MODES];
  314. int *basic_rates[NUM_IEEE80211_MODES];
  315. int rts_threshold;
  316. int cts_protect_erp_frames;
  317. int fragmentation_threshold;
  318. int short_retry_limit; /* dot11ShortRetryLimit */
  319. int long_retry_limit; /* dot11LongRetryLimit */
  320. int short_preamble; /* use short preamble with IEEE 802.11b */
  321. struct crypto_blkcipher *wep_tx_tfm;
  322. struct crypto_blkcipher *wep_rx_tfm;
  323. u32 wep_iv;
  324. int key_tx_rx_threshold; /* number of times any key can be used in TX
  325. * or RX before generating a rekey
  326. * notification; 0 = notification disabled. */
  327. int bridge_packets; /* bridge packets between associated stations and
  328. * deliver multicast frames both back to wireless
  329. * media and to the local net stack */
  330. ieee80211_rx_handler *rx_pre_handlers;
  331. ieee80211_rx_handler *rx_handlers;
  332. ieee80211_tx_handler *tx_handlers;
  333. rwlock_t sub_if_lock; /* Protects sub_if_list. Cannot be taken under
  334. * sta_bss_lock or sta_lock. */
  335. struct list_head sub_if_list;
  336. int sta_scanning;
  337. int scan_channel_idx;
  338. enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
  339. unsigned long last_scan_completed;
  340. struct delayed_work scan_work;
  341. struct net_device *scan_dev;
  342. struct ieee80211_channel *oper_channel, *scan_channel;
  343. struct ieee80211_hw_mode *oper_hw_mode, *scan_hw_mode;
  344. u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
  345. size_t scan_ssid_len;
  346. struct list_head sta_bss_list;
  347. struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
  348. spinlock_t sta_bss_lock;
  349. #define IEEE80211_SCAN_MATCH_SSID BIT(0)
  350. #define IEEE80211_SCAN_WPA_ONLY BIT(1)
  351. #define IEEE80211_SCAN_EXTRA_INFO BIT(2)
  352. int scan_flags;
  353. /* SNMP counters */
  354. /* dot11CountersTable */
  355. u32 dot11TransmittedFragmentCount;
  356. u32 dot11MulticastTransmittedFrameCount;
  357. u32 dot11FailedCount;
  358. u32 dot11RetryCount;
  359. u32 dot11MultipleRetryCount;
  360. u32 dot11FrameDuplicateCount;
  361. u32 dot11ReceivedFragmentCount;
  362. u32 dot11MulticastReceivedFrameCount;
  363. u32 dot11TransmittedFrameCount;
  364. u32 dot11WEPUndecryptableCount;
  365. #ifdef CONFIG_MAC80211_LEDS
  366. int tx_led_counter, rx_led_counter;
  367. struct led_trigger *tx_led, *rx_led;
  368. char tx_led_name[32], rx_led_name[32];
  369. #endif
  370. u32 channel_use;
  371. u32 channel_use_raw;
  372. u32 stat_time;
  373. struct timer_list stat_timer;
  374. enum {
  375. STA_ANTENNA_SEL_AUTO = 0,
  376. STA_ANTENNA_SEL_SW_CTRL = 1,
  377. STA_ANTENNA_SEL_SW_CTRL_DEBUG = 2
  378. } sta_antenna_sel;
  379. int rate_ctrl_num_up, rate_ctrl_num_down;
  380. #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
  381. /* TX/RX handler statistics */
  382. unsigned int tx_handlers_drop;
  383. unsigned int tx_handlers_queued;
  384. unsigned int tx_handlers_drop_unencrypted;
  385. unsigned int tx_handlers_drop_fragment;
  386. unsigned int tx_handlers_drop_wep;
  387. unsigned int tx_handlers_drop_not_assoc;
  388. unsigned int tx_handlers_drop_unauth_port;
  389. unsigned int rx_handlers_drop;
  390. unsigned int rx_handlers_queued;
  391. unsigned int rx_handlers_drop_nullfunc;
  392. unsigned int rx_handlers_drop_defrag;
  393. unsigned int rx_handlers_drop_short;
  394. unsigned int rx_handlers_drop_passive_scan;
  395. unsigned int tx_expand_skb_head;
  396. unsigned int tx_expand_skb_head_cloned;
  397. unsigned int rx_expand_skb_head;
  398. unsigned int rx_expand_skb_head2;
  399. unsigned int rx_handlers_fragments;
  400. unsigned int tx_status_drop;
  401. unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
  402. unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
  403. #define I802_DEBUG_INC(c) (c)++
  404. #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
  405. #define I802_DEBUG_INC(c) do { } while (0)
  406. #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
  407. int default_wep_only; /* only default WEP keys are used with this
  408. * interface; this is used to decide when hwaccel
  409. * can be used with default keys */
  410. int total_ps_buffered; /* total number of all buffered unicast and
  411. * multicast packets for power saving stations
  412. */
  413. int allow_broadcast_always; /* whether to allow TX of broadcast frames
  414. * even when there are no associated STAs
  415. */
  416. int wifi_wme_noack_test;
  417. unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
  418. unsigned int enabled_modes; /* bitfield of allowed modes;
  419. * (1 << MODE_*) */
  420. unsigned int hw_modes; /* bitfield of supported hardware modes;
  421. * (1 << MODE_*) */
  422. int user_space_mlme;
  423. };
  424. static inline struct ieee80211_local *hw_to_local(
  425. struct ieee80211_hw *hw)
  426. {
  427. return container_of(hw, struct ieee80211_local, hw);
  428. }
  429. static inline struct ieee80211_hw *local_to_hw(
  430. struct ieee80211_local *local)
  431. {
  432. return &local->hw;
  433. }
  434. enum ieee80211_link_state_t {
  435. IEEE80211_LINK_STATE_XOFF = 0,
  436. IEEE80211_LINK_STATE_PENDING,
  437. };
  438. struct sta_attribute {
  439. struct attribute attr;
  440. ssize_t (*show)(const struct sta_info *, char *buf);
  441. ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
  442. };
  443. static inline void __bss_tim_set(struct ieee80211_if_ap *bss, int aid)
  444. {
  445. /*
  446. * This format has ben mandated by the IEEE specifications,
  447. * so this line may not be changed to use the __set_bit() format.
  448. */
  449. bss->tim[(aid)/8] |= 1<<((aid) % 8);
  450. }
  451. static inline void bss_tim_set(struct ieee80211_local *local,
  452. struct ieee80211_if_ap *bss, int aid)
  453. {
  454. spin_lock_bh(&local->sta_lock);
  455. __bss_tim_set(bss, aid);
  456. spin_unlock_bh(&local->sta_lock);
  457. }
  458. static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, int aid)
  459. {
  460. /*
  461. * This format has ben mandated by the IEEE specifications,
  462. * so this line may not be changed to use the __clear_bit() format.
  463. */
  464. bss->tim[(aid)/8] &= !(1<<((aid) % 8));
  465. }
  466. static inline void bss_tim_clear(struct ieee80211_local *local,
  467. struct ieee80211_if_ap *bss, int aid)
  468. {
  469. spin_lock_bh(&local->sta_lock);
  470. __bss_tim_clear(bss, aid);
  471. spin_unlock_bh(&local->sta_lock);
  472. }
  473. /**
  474. * ieee80211_is_erp_rate - Check if a rate is an ERP rate
  475. * @phymode: The PHY-mode for this rate (MODE_IEEE80211...)
  476. * @rate: Transmission rate to check, in 100 kbps
  477. *
  478. * Check if a given rate is an Extended Rate PHY (ERP) rate.
  479. */
  480. static inline int ieee80211_is_erp_rate(int phymode, int rate)
  481. {
  482. if (phymode == MODE_IEEE80211G) {
  483. if (rate != 10 && rate != 20 &&
  484. rate != 55 && rate != 110)
  485. return 1;
  486. }
  487. return 0;
  488. }
  489. /* ieee80211.c */
  490. int ieee80211_hw_config(struct ieee80211_local *local);
  491. int ieee80211_if_config(struct net_device *dev);
  492. int ieee80211_if_config_beacon(struct net_device *dev);
  493. struct ieee80211_key_conf *
  494. ieee80211_key_data2conf(struct ieee80211_local *local,
  495. const struct ieee80211_key *data);
  496. struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
  497. int idx, size_t key_len, gfp_t flags);
  498. void ieee80211_key_free(struct ieee80211_key *key);
  499. void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
  500. struct ieee80211_rx_status *status, u32 msg_type);
  501. void ieee80211_prepare_rates(struct ieee80211_local *local,
  502. struct ieee80211_hw_mode *mode);
  503. void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
  504. int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
  505. void ieee80211_if_setup(struct net_device *dev);
  506. void ieee80211_if_mgmt_setup(struct net_device *dev);
  507. int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
  508. const char *name);
  509. struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
  510. /* ieee80211_ioctl.c */
  511. extern const struct iw_handler_def ieee80211_iw_handler_def;
  512. void ieee80211_update_default_wep_only(struct ieee80211_local *local);
  513. /* Least common multiple of the used rates (in 100 kbps). This is used to
  514. * calculate rate_inv values for each rate so that only integers are needed. */
  515. #define CHAN_UTIL_RATE_LCM 95040
  516. /* 1 usec is 1/8 * (95040/10) = 1188 */
  517. #define CHAN_UTIL_PER_USEC 1188
  518. /* Amount of bits to shift the result right to scale the total utilization
  519. * to values that will not wrap around 32-bit integers. */
  520. #define CHAN_UTIL_SHIFT 9
  521. /* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
  522. * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
  523. * raw value with about 23 should give utilization in 10th of a percentage
  524. * (1/1000). However, utilization is only estimated and not all intervals
  525. * between frames etc. are calculated. 18 seems to give numbers that are closer
  526. * to the real maximum. */
  527. #define CHAN_UTIL_PER_10MS 18
  528. #define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
  529. #define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
  530. /* ieee80211_ioctl.c */
  531. int ieee80211_set_compression(struct ieee80211_local *local,
  532. struct net_device *dev, struct sta_info *sta);
  533. int ieee80211_init_client(struct net_device *dev);
  534. int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq);
  535. /* ieee80211_sta.c */
  536. void ieee80211_sta_timer(unsigned long data);
  537. void ieee80211_sta_work(struct work_struct *work);
  538. void ieee80211_sta_scan_work(struct work_struct *work);
  539. void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
  540. struct ieee80211_rx_status *rx_status);
  541. int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len);
  542. int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len);
  543. int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
  544. int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
  545. void ieee80211_sta_req_auth(struct net_device *dev,
  546. struct ieee80211_if_sta *ifsta);
  547. int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
  548. void ieee80211_sta_rx_scan(struct net_device *dev, struct sk_buff *skb,
  549. struct ieee80211_rx_status *rx_status);
  550. void ieee80211_rx_bss_list_init(struct net_device *dev);
  551. void ieee80211_rx_bss_list_deinit(struct net_device *dev);
  552. int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
  553. struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
  554. struct sk_buff *skb, u8 *bssid,
  555. u8 *addr);
  556. int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
  557. int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
  558. /* ieee80211_iface.c */
  559. int ieee80211_if_add(struct net_device *dev, const char *name,
  560. struct net_device **new_dev, int type);
  561. void ieee80211_if_set_type(struct net_device *dev, int type);
  562. void ieee80211_if_reinit(struct net_device *dev);
  563. void __ieee80211_if_del(struct ieee80211_local *local,
  564. struct ieee80211_sub_if_data *sdata);
  565. int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
  566. void ieee80211_if_free(struct net_device *dev);
  567. void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
  568. int ieee80211_if_add_mgmt(struct ieee80211_local *local);
  569. void ieee80211_if_del_mgmt(struct ieee80211_local *local);
  570. /* for wiphy privid */
  571. extern void *mac80211_wiphy_privid;
  572. #endif /* IEEE80211_I_H */