dhd.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. /*
  2. * Copyright (c) 2010 Broadcom Corporation
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  11. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  13. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /****************
  17. * Common types *
  18. */
  19. #ifndef _BRCMF_H_
  20. #define _BRCMF_H_
  21. #define BRCMF_VERSION_STR "4.218.248.5"
  22. /*******************************************************************************
  23. * IO codes that are interpreted by dongle firmware
  24. ******************************************************************************/
  25. #define BRCMF_C_UP 2
  26. #define BRCMF_C_DOWN 3
  27. #define BRCMF_C_SET_PROMISC 10
  28. #define BRCMF_C_GET_RATE 12
  29. #define BRCMF_C_GET_INFRA 19
  30. #define BRCMF_C_SET_INFRA 20
  31. #define BRCMF_C_GET_AUTH 21
  32. #define BRCMF_C_SET_AUTH 22
  33. #define BRCMF_C_GET_BSSID 23
  34. #define BRCMF_C_GET_SSID 25
  35. #define BRCMF_C_SET_SSID 26
  36. #define BRCMF_C_GET_CHANNEL 29
  37. #define BRCMF_C_GET_SRL 31
  38. #define BRCMF_C_GET_LRL 33
  39. #define BRCMF_C_GET_RADIO 37
  40. #define BRCMF_C_SET_RADIO 38
  41. #define BRCMF_C_GET_PHYTYPE 39
  42. #define BRCMF_C_SET_KEY 45
  43. #define BRCMF_C_SET_PASSIVE_SCAN 49
  44. #define BRCMF_C_SCAN 50
  45. #define BRCMF_C_SCAN_RESULTS 51
  46. #define BRCMF_C_DISASSOC 52
  47. #define BRCMF_C_REASSOC 53
  48. #define BRCMF_C_SET_ROAM_TRIGGER 55
  49. #define BRCMF_C_SET_ROAM_DELTA 57
  50. #define BRCMF_C_GET_BCNPRD 75
  51. #define BRCMF_C_SET_BCNPRD 76
  52. #define BRCMF_C_GET_DTIMPRD 77
  53. #define BRCMF_C_SET_DTIMPRD 78
  54. #define BRCMF_C_SET_COUNTRY 84
  55. #define BRCMF_C_GET_PM 85
  56. #define BRCMF_C_SET_PM 86
  57. #define BRCMF_C_GET_AP 117
  58. #define BRCMF_C_SET_AP 118
  59. #define BRCMF_C_GET_RSSI 127
  60. #define BRCMF_C_GET_WSEC 133
  61. #define BRCMF_C_SET_WSEC 134
  62. #define BRCMF_C_GET_PHY_NOISE 135
  63. #define BRCMF_C_GET_BSS_INFO 136
  64. #define BRCMF_C_SET_SCAN_CHANNEL_TIME 185
  65. #define BRCMF_C_SET_SCAN_UNASSOC_TIME 187
  66. #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201
  67. #define BRCMF_C_GET_VALID_CHANNELS 217
  68. #define BRCMF_C_GET_KEY_PRIMARY 235
  69. #define BRCMF_C_SET_KEY_PRIMARY 236
  70. #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
  71. #define BRCMF_C_GET_VAR 262
  72. #define BRCMF_C_SET_VAR 263
  73. /* phy types (returned by WLC_GET_PHYTPE) */
  74. #define WLC_PHY_TYPE_A 0
  75. #define WLC_PHY_TYPE_B 1
  76. #define WLC_PHY_TYPE_G 2
  77. #define WLC_PHY_TYPE_N 4
  78. #define WLC_PHY_TYPE_LP 5
  79. #define WLC_PHY_TYPE_SSN 6
  80. #define WLC_PHY_TYPE_HT 7
  81. #define WLC_PHY_TYPE_LCN 8
  82. #define WLC_PHY_TYPE_NULL 0xf
  83. #define BRCMF_EVENTING_MASK_LEN 16
  84. #define TOE_TX_CSUM_OL 0x00000001
  85. #define TOE_RX_CSUM_OL 0x00000002
  86. #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
  87. /* size of brcmf_scan_params not including variable length array */
  88. #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
  89. /* masks for channel and ssid count */
  90. #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff
  91. #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16
  92. #define BRCMF_SCAN_ACTION_START 1
  93. #define BRCMF_SCAN_ACTION_CONTINUE 2
  94. #define WL_SCAN_ACTION_ABORT 3
  95. #define BRCMF_ISCAN_REQ_VERSION 1
  96. /* brcmf_iscan_results status values */
  97. #define BRCMF_SCAN_RESULTS_SUCCESS 0
  98. #define BRCMF_SCAN_RESULTS_PARTIAL 1
  99. #define BRCMF_SCAN_RESULTS_PENDING 2
  100. #define BRCMF_SCAN_RESULTS_ABORTED 3
  101. #define BRCMF_SCAN_RESULTS_NO_MEM 4
  102. /* Indicates this key is using soft encrypt */
  103. #define WL_SOFT_KEY (1 << 0)
  104. /* primary (ie tx) key */
  105. #define BRCMF_PRIMARY_KEY (1 << 1)
  106. /* Reserved for backward compat */
  107. #define WL_KF_RES_4 (1 << 4)
  108. /* Reserved for backward compat */
  109. #define WL_KF_RES_5 (1 << 5)
  110. /* Indicates a group key for a IBSS PEER */
  111. #define WL_IBSS_PEER_GROUP_KEY (1 << 6)
  112. /* For supporting multiple interfaces */
  113. #define BRCMF_MAX_IFS 16
  114. #define DOT11_BSSTYPE_ANY 2
  115. #define DOT11_MAX_DEFAULT_KEYS 4
  116. #define BRCMF_EVENT_MSG_LINK 0x01
  117. #define BRCMF_EVENT_MSG_FLUSHTXQ 0x02
  118. #define BRCMF_EVENT_MSG_GROUP 0x04
  119. #define BRCMF_ESCAN_REQ_VERSION 1
  120. #define WLC_BSS_RSSI_ON_CHANNEL 0x0002
  121. #define BRCMF_MAXRATES_IN_SET 16 /* max # of rates in rateset */
  122. #define BRCMF_STA_ASSOC 0x10 /* Associated */
  123. struct brcmf_event_msg {
  124. __be16 version;
  125. __be16 flags;
  126. __be32 event_type;
  127. __be32 status;
  128. __be32 reason;
  129. __be32 auth_type;
  130. __be32 datalen;
  131. u8 addr[ETH_ALEN];
  132. char ifname[IFNAMSIZ];
  133. u8 ifidx;
  134. u8 bsscfgidx;
  135. } __packed;
  136. struct brcm_ethhdr {
  137. u16 subtype;
  138. u16 length;
  139. u8 version;
  140. u8 oui[3];
  141. u16 usr_subtype;
  142. } __packed;
  143. struct brcmf_event {
  144. struct ethhdr eth;
  145. struct brcm_ethhdr hdr;
  146. struct brcmf_event_msg msg;
  147. } __packed;
  148. /* event codes sent by the dongle to this driver */
  149. #define BRCMF_E_SET_SSID 0
  150. #define BRCMF_E_JOIN 1
  151. #define BRCMF_E_START 2
  152. #define BRCMF_E_AUTH 3
  153. #define BRCMF_E_AUTH_IND 4
  154. #define BRCMF_E_DEAUTH 5
  155. #define BRCMF_E_DEAUTH_IND 6
  156. #define BRCMF_E_ASSOC 7
  157. #define BRCMF_E_ASSOC_IND 8
  158. #define BRCMF_E_REASSOC 9
  159. #define BRCMF_E_REASSOC_IND 10
  160. #define BRCMF_E_DISASSOC 11
  161. #define BRCMF_E_DISASSOC_IND 12
  162. #define BRCMF_E_QUIET_START 13
  163. #define BRCMF_E_QUIET_END 14
  164. #define BRCMF_E_BEACON_RX 15
  165. #define BRCMF_E_LINK 16
  166. #define BRCMF_E_MIC_ERROR 17
  167. #define BRCMF_E_NDIS_LINK 18
  168. #define BRCMF_E_ROAM 19
  169. #define BRCMF_E_TXFAIL 20
  170. #define BRCMF_E_PMKID_CACHE 21
  171. #define BRCMF_E_RETROGRADE_TSF 22
  172. #define BRCMF_E_PRUNE 23
  173. #define BRCMF_E_AUTOAUTH 24
  174. #define BRCMF_E_EAPOL_MSG 25
  175. #define BRCMF_E_SCAN_COMPLETE 26
  176. #define BRCMF_E_ADDTS_IND 27
  177. #define BRCMF_E_DELTS_IND 28
  178. #define BRCMF_E_BCNSENT_IND 29
  179. #define BRCMF_E_BCNRX_MSG 30
  180. #define BRCMF_E_BCNLOST_MSG 31
  181. #define BRCMF_E_ROAM_PREP 32
  182. #define BRCMF_E_PFN_NET_FOUND 33
  183. #define BRCMF_E_PFN_NET_LOST 34
  184. #define BRCMF_E_RESET_COMPLETE 35
  185. #define BRCMF_E_JOIN_START 36
  186. #define BRCMF_E_ROAM_START 37
  187. #define BRCMF_E_ASSOC_START 38
  188. #define BRCMF_E_IBSS_ASSOC 39
  189. #define BRCMF_E_RADIO 40
  190. #define BRCMF_E_PSM_WATCHDOG 41
  191. #define BRCMF_E_PROBREQ_MSG 44
  192. #define BRCMF_E_SCAN_CONFIRM_IND 45
  193. #define BRCMF_E_PSK_SUP 46
  194. #define BRCMF_E_COUNTRY_CODE_CHANGED 47
  195. #define BRCMF_E_EXCEEDED_MEDIUM_TIME 48
  196. #define BRCMF_E_ICV_ERROR 49
  197. #define BRCMF_E_UNICAST_DECODE_ERROR 50
  198. #define BRCMF_E_MULTICAST_DECODE_ERROR 51
  199. #define BRCMF_E_TRACE 52
  200. #define BRCMF_E_IF 54
  201. #define BRCMF_E_RSSI 56
  202. #define BRCMF_E_PFN_SCAN_COMPLETE 57
  203. #define BRCMF_E_EXTLOG_MSG 58
  204. #define BRCMF_E_ACTION_FRAME 59
  205. #define BRCMF_E_ACTION_FRAME_COMPLETE 60
  206. #define BRCMF_E_PRE_ASSOC_IND 61
  207. #define BRCMF_E_PRE_REASSOC_IND 62
  208. #define BRCMF_E_CHANNEL_ADOPTED 63
  209. #define BRCMF_E_AP_STARTED 64
  210. #define BRCMF_E_DFS_AP_STOP 65
  211. #define BRCMF_E_DFS_AP_RESUME 66
  212. #define BRCMF_E_RESERVED1 67
  213. #define BRCMF_E_RESERVED2 68
  214. #define BRCMF_E_ESCAN_RESULT 69
  215. #define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70
  216. #define BRCMF_E_DCS_REQUEST 73
  217. #define BRCMF_E_FIFO_CREDIT_MAP 74
  218. #define BRCMF_E_LAST 75
  219. #define BRCMF_E_STATUS_SUCCESS 0
  220. #define BRCMF_E_STATUS_FAIL 1
  221. #define BRCMF_E_STATUS_TIMEOUT 2
  222. #define BRCMF_E_STATUS_NO_NETWORKS 3
  223. #define BRCMF_E_STATUS_ABORT 4
  224. #define BRCMF_E_STATUS_NO_ACK 5
  225. #define BRCMF_E_STATUS_UNSOLICITED 6
  226. #define BRCMF_E_STATUS_ATTEMPT 7
  227. #define BRCMF_E_STATUS_PARTIAL 8
  228. #define BRCMF_E_STATUS_NEWSCAN 9
  229. #define BRCMF_E_STATUS_NEWASSOC 10
  230. #define BRCMF_E_STATUS_11HQUIET 11
  231. #define BRCMF_E_STATUS_SUPPRESS 12
  232. #define BRCMF_E_STATUS_NOCHANS 13
  233. #define BRCMF_E_STATUS_CS_ABORT 15
  234. #define BRCMF_E_STATUS_ERROR 16
  235. #define BRCMF_E_REASON_INITIAL_ASSOC 0
  236. #define BRCMF_E_REASON_LOW_RSSI 1
  237. #define BRCMF_E_REASON_DEAUTH 2
  238. #define BRCMF_E_REASON_DISASSOC 3
  239. #define BRCMF_E_REASON_BCNS_LOST 4
  240. #define BRCMF_E_REASON_MINTXRATE 9
  241. #define BRCMF_E_REASON_TXFAIL 10
  242. #define BRCMF_E_REASON_FAST_ROAM_FAILED 5
  243. #define BRCMF_E_REASON_DIRECTED_ROAM 6
  244. #define BRCMF_E_REASON_TSPEC_REJECTED 7
  245. #define BRCMF_E_REASON_BETTER_AP 8
  246. #define BRCMF_E_PRUNE_ENCR_MISMATCH 1
  247. #define BRCMF_E_PRUNE_BCAST_BSSID 2
  248. #define BRCMF_E_PRUNE_MAC_DENY 3
  249. #define BRCMF_E_PRUNE_MAC_NA 4
  250. #define BRCMF_E_PRUNE_REG_PASSV 5
  251. #define BRCMF_E_PRUNE_SPCT_MGMT 6
  252. #define BRCMF_E_PRUNE_RADAR 7
  253. #define BRCMF_E_RSN_MISMATCH 8
  254. #define BRCMF_E_PRUNE_NO_COMMON_RATES 9
  255. #define BRCMF_E_PRUNE_BASIC_RATES 10
  256. #define BRCMF_E_PRUNE_CIPHER_NA 12
  257. #define BRCMF_E_PRUNE_KNOWN_STA 13
  258. #define BRCMF_E_PRUNE_WDS_PEER 15
  259. #define BRCMF_E_PRUNE_QBSS_LOAD 16
  260. #define BRCMF_E_PRUNE_HOME_AP 17
  261. #define BRCMF_E_SUP_OTHER 0
  262. #define BRCMF_E_SUP_DECRYPT_KEY_DATA 1
  263. #define BRCMF_E_SUP_BAD_UCAST_WEP128 2
  264. #define BRCMF_E_SUP_BAD_UCAST_WEP40 3
  265. #define BRCMF_E_SUP_UNSUP_KEY_LEN 4
  266. #define BRCMF_E_SUP_PW_KEY_CIPHER 5
  267. #define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6
  268. #define BRCMF_E_SUP_MSG3_IE_MISMATCH 7
  269. #define BRCMF_E_SUP_NO_INSTALL_FLAG 8
  270. #define BRCMF_E_SUP_MSG3_NO_GTK 9
  271. #define BRCMF_E_SUP_GRP_KEY_CIPHER 10
  272. #define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11
  273. #define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12
  274. #define BRCMF_E_SUP_SEND_FAIL 13
  275. #define BRCMF_E_SUP_DEAUTH 14
  276. #define BRCMF_E_IF_ADD 1
  277. #define BRCMF_E_IF_DEL 2
  278. #define BRCMF_E_IF_CHANGE 3
  279. #define BRCMF_E_IF_ROLE_STA 0
  280. #define BRCMF_E_IF_ROLE_AP 1
  281. #define BRCMF_E_IF_ROLE_WDS 2
  282. #define BRCMF_E_LINK_BCN_LOSS 1
  283. #define BRCMF_E_LINK_DISASSOC 2
  284. #define BRCMF_E_LINK_ASSOC_REC 3
  285. #define BRCMF_E_LINK_BSSCFG_DIS 4
  286. /* Small, medium and maximum buffer size for dcmd
  287. */
  288. #define BRCMF_DCMD_SMLEN 256
  289. #define BRCMF_DCMD_MEDLEN 1536
  290. #define BRCMF_DCMD_MAXLEN 8192
  291. /* Pattern matching filter. Specifies an offset within received packets to
  292. * start matching, the pattern to match, the size of the pattern, and a bitmask
  293. * that indicates which bits within the pattern should be matched.
  294. */
  295. struct brcmf_pkt_filter_pattern_le {
  296. /*
  297. * Offset within received packet to start pattern matching.
  298. * Offset '0' is the first byte of the ethernet header.
  299. */
  300. __le32 offset;
  301. /* Size of the pattern. Bitmask must be the same size.*/
  302. __le32 size_bytes;
  303. /*
  304. * Variable length mask and pattern data. mask starts at offset 0.
  305. * Pattern immediately follows mask.
  306. */
  307. u8 mask_and_pattern[1];
  308. };
  309. /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
  310. struct brcmf_pkt_filter_le {
  311. __le32 id; /* Unique filter id, specified by app. */
  312. __le32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
  313. __le32 negate_match; /* Negate the result of filter matches */
  314. union { /* Filter definitions */
  315. struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */
  316. } u;
  317. };
  318. /* IOVAR "pkt_filter_enable" parameter. */
  319. struct brcmf_pkt_filter_enable_le {
  320. __le32 id; /* Unique filter id */
  321. __le32 enable; /* Enable/disable bool */
  322. };
  323. /* BSS info structure
  324. * Applications MUST CHECK ie_offset field and length field to access IEs and
  325. * next bss_info structure in a vector (in struct brcmf_scan_results)
  326. */
  327. struct brcmf_bss_info_le {
  328. __le32 version; /* version field */
  329. __le32 length; /* byte length of data in this record,
  330. * starting at version and including IEs
  331. */
  332. u8 BSSID[ETH_ALEN];
  333. __le16 beacon_period; /* units are Kusec */
  334. __le16 capability; /* Capability information */
  335. u8 SSID_len;
  336. u8 SSID[32];
  337. struct {
  338. __le32 count; /* # rates in this set */
  339. u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
  340. } rateset; /* supported rates */
  341. __le16 chanspec; /* chanspec for bss */
  342. __le16 atim_window; /* units are Kusec */
  343. u8 dtim_period; /* DTIM period */
  344. __le16 RSSI; /* receive signal strength (in dBm) */
  345. s8 phy_noise; /* noise (in dBm) */
  346. u8 n_cap; /* BSS is 802.11N Capable */
  347. /* 802.11N BSS Capabilities (based on HT_CAP_*): */
  348. __le32 nbss_cap;
  349. u8 ctl_ch; /* 802.11N BSS control channel number */
  350. __le32 reserved32[1]; /* Reserved for expansion of BSS properties */
  351. u8 flags; /* flags */
  352. u8 reserved[3]; /* Reserved for expansion of BSS properties */
  353. u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
  354. __le16 ie_offset; /* offset at which IEs start, from beginning */
  355. __le32 ie_length; /* byte length of Information Elements */
  356. __le16 SNR; /* average SNR of during frame reception */
  357. /* Add new fields here */
  358. /* variable length Information Elements */
  359. };
  360. struct brcm_rateset_le {
  361. /* # rates in this set */
  362. __le32 count;
  363. /* rates in 500kbps units w/hi bit set if basic */
  364. u8 rates[WL_NUMRATES];
  365. };
  366. struct brcmf_ssid {
  367. u32 SSID_len;
  368. unsigned char SSID[32];
  369. };
  370. struct brcmf_ssid_le {
  371. __le32 SSID_len;
  372. unsigned char SSID[32];
  373. };
  374. struct brcmf_scan_params_le {
  375. struct brcmf_ssid_le ssid_le; /* default: {0, ""} */
  376. u8 bssid[ETH_ALEN]; /* default: bcast */
  377. s8 bss_type; /* default: any,
  378. * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
  379. */
  380. u8 scan_type; /* flags, 0 use default */
  381. __le32 nprobes; /* -1 use default, number of probes per channel */
  382. __le32 active_time; /* -1 use default, dwell time per channel for
  383. * active scanning
  384. */
  385. __le32 passive_time; /* -1 use default, dwell time per channel
  386. * for passive scanning
  387. */
  388. __le32 home_time; /* -1 use default, dwell time for the
  389. * home channel between channel scans
  390. */
  391. __le32 channel_num; /* count of channels and ssids that follow
  392. *
  393. * low half is count of channels in
  394. * channel_list, 0 means default (use all
  395. * available channels)
  396. *
  397. * high half is entries in struct brcmf_ssid
  398. * array that follows channel_list, aligned for
  399. * s32 (4 bytes) meaning an odd channel count
  400. * implies a 2-byte pad between end of
  401. * channel_list and first ssid
  402. *
  403. * if ssid count is zero, single ssid in the
  404. * fixed parameter portion is assumed, otherwise
  405. * ssid in the fixed portion is ignored
  406. */
  407. __le16 channel_list[1]; /* list of chanspecs */
  408. };
  409. /* incremental scan struct */
  410. struct brcmf_iscan_params_le {
  411. __le32 version;
  412. __le16 action;
  413. __le16 scan_duration;
  414. struct brcmf_scan_params_le params_le;
  415. };
  416. struct brcmf_scan_results {
  417. u32 buflen;
  418. u32 version;
  419. u32 count;
  420. struct brcmf_bss_info_le bss_info_le[];
  421. };
  422. struct brcmf_scan_results_le {
  423. __le32 buflen;
  424. __le32 version;
  425. __le32 count;
  426. };
  427. struct brcmf_escan_params_le {
  428. __le32 version;
  429. __le16 action;
  430. __le16 sync_id;
  431. struct brcmf_scan_params_le params_le;
  432. };
  433. struct brcmf_escan_result_le {
  434. __le32 buflen;
  435. __le32 version;
  436. __le16 sync_id;
  437. __le16 bss_count;
  438. struct brcmf_bss_info_le bss_info_le;
  439. };
  440. #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \
  441. sizeof(struct brcmf_bss_info_le))
  442. /* used for association with a specific BSSID and chanspec list */
  443. struct brcmf_assoc_params_le {
  444. /* 00:00:00:00:00:00: broadcast scan */
  445. u8 bssid[ETH_ALEN];
  446. /* 0: all available channels, otherwise count of chanspecs in
  447. * chanspec_list */
  448. __le32 chanspec_num;
  449. /* list of chanspecs */
  450. __le16 chanspec_list[1];
  451. };
  452. /* used for join with or without a specific bssid and channel list */
  453. struct brcmf_join_params {
  454. struct brcmf_ssid_le ssid_le;
  455. struct brcmf_assoc_params_le params_le;
  456. };
  457. /* incremental scan results struct */
  458. struct brcmf_iscan_results {
  459. union {
  460. u32 status;
  461. __le32 status_le;
  462. };
  463. union {
  464. struct brcmf_scan_results results;
  465. struct brcmf_scan_results_le results_le;
  466. };
  467. };
  468. /* size of brcmf_iscan_results not including variable length array */
  469. #define BRCMF_ISCAN_RESULTS_FIXED_SIZE \
  470. (sizeof(struct brcmf_scan_results) + \
  471. offsetof(struct brcmf_iscan_results, results))
  472. struct brcmf_wsec_key {
  473. u32 index; /* key index */
  474. u32 len; /* key length */
  475. u8 data[WLAN_MAX_KEY_LEN]; /* key data */
  476. u32 pad_1[18];
  477. u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
  478. u32 flags; /* misc flags */
  479. u32 pad_2[3];
  480. u32 iv_initialized; /* has IV been initialized already? */
  481. u32 pad_3;
  482. /* Rx IV */
  483. struct {
  484. u32 hi; /* upper 32 bits of IV */
  485. u16 lo; /* lower 16 bits of IV */
  486. } rxiv;
  487. u32 pad_4[2];
  488. u8 ea[ETH_ALEN]; /* per station */
  489. };
  490. /*
  491. * dongle requires same struct as above but with fields in little endian order
  492. */
  493. struct brcmf_wsec_key_le {
  494. __le32 index; /* key index */
  495. __le32 len; /* key length */
  496. u8 data[WLAN_MAX_KEY_LEN]; /* key data */
  497. __le32 pad_1[18];
  498. __le32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
  499. __le32 flags; /* misc flags */
  500. __le32 pad_2[3];
  501. __le32 iv_initialized; /* has IV been initialized already? */
  502. __le32 pad_3;
  503. /* Rx IV */
  504. struct {
  505. __le32 hi; /* upper 32 bits of IV */
  506. __le16 lo; /* lower 16 bits of IV */
  507. } rxiv;
  508. __le32 pad_4[2];
  509. u8 ea[ETH_ALEN]; /* per station */
  510. };
  511. /* Used to get specific STA parameters */
  512. struct brcmf_scb_val_le {
  513. __le32 val;
  514. u8 ea[ETH_ALEN];
  515. };
  516. /* channel encoding */
  517. struct brcmf_channel_info_le {
  518. __le32 hw_channel;
  519. __le32 target_channel;
  520. __le32 scan_channel;
  521. };
  522. struct brcmf_sta_info_le {
  523. __le16 ver; /* version of this struct */
  524. __le16 len; /* length in bytes of this structure */
  525. __le16 cap; /* sta's advertised capabilities */
  526. __le32 flags; /* flags defined below */
  527. __le32 idle; /* time since data pkt rx'd from sta */
  528. u8 ea[ETH_ALEN]; /* Station address */
  529. __le32 count; /* # rates in this set */
  530. u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
  531. /* w/hi bit set if basic */
  532. __le32 in; /* seconds elapsed since associated */
  533. __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
  534. __le32 tx_pkts; /* # of packets transmitted */
  535. __le32 tx_failures; /* # of packets failed */
  536. __le32 rx_ucast_pkts; /* # of unicast packets received */
  537. __le32 rx_mcast_pkts; /* # of multicast packets received */
  538. __le32 tx_rate; /* Rate of last successful tx frame */
  539. __le32 rx_rate; /* Rate of last successful rx frame */
  540. __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
  541. __le32 rx_decrypt_failures; /* # of packet decrypted failed */
  542. };
  543. /* Bus independent dongle command */
  544. struct brcmf_dcmd {
  545. uint cmd; /* common dongle cmd definition */
  546. void *buf; /* pointer to user buffer */
  547. uint len; /* length of user buffer */
  548. u8 set; /* get or set request (optional) */
  549. uint used; /* bytes read or written (optional) */
  550. uint needed; /* bytes needed (optional) */
  551. };
  552. /* Forward decls for struct brcmf_pub (see below) */
  553. struct brcmf_proto; /* device communication protocol info */
  554. struct brcmf_cfg80211_dev; /* cfg80211 device info */
  555. /* Common structure for module and instance linkage */
  556. struct brcmf_pub {
  557. /* Linkage ponters */
  558. struct brcmf_bus *bus_if;
  559. struct brcmf_proto *prot;
  560. struct brcmf_cfg80211_info *config;
  561. struct device *dev; /* fullmac dongle device pointer */
  562. /* Internal brcmf items */
  563. uint hdrlen; /* Total BRCMF header length (proto + bus) */
  564. uint rxsz; /* Rx buffer size bus module should use */
  565. u8 wme_dp; /* wme discard priority */
  566. /* Dongle media info */
  567. bool iswl; /* Dongle-resident driver is wl */
  568. unsigned long drv_version; /* Version of dongle-resident driver */
  569. u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */
  570. /* Additional stats for the bus level */
  571. /* Multicast data packets sent to dongle */
  572. unsigned long tx_multicast;
  573. /* Packets flushed due to unscheduled sendup thread */
  574. unsigned long rx_flushed;
  575. /* Number of times dpc scheduled by watchdog timer */
  576. unsigned long wd_dpc_sched;
  577. /* Number of flow control pkts recvd */
  578. unsigned long fc_packets;
  579. /* Last error return */
  580. int bcmerror;
  581. /* Last error from dongle */
  582. int dongle_error;
  583. /* Suspend disable flag flag */
  584. int suspend_disable_flag; /* "1" to disable all extra powersaving
  585. during suspend */
  586. int in_suspend; /* flag set to 1 when early suspend called */
  587. int dtim_skip; /* dtim skip , default 0 means wake each dtim */
  588. /* Pkt filter defination */
  589. char *pktfilter[100];
  590. int pktfilter_count;
  591. u8 country_code[BRCM_CNTRY_BUF_SZ];
  592. char eventmask[BRCMF_EVENTING_MASK_LEN];
  593. struct brcmf_if *iflist[BRCMF_MAX_IFS];
  594. struct mutex proto_block;
  595. unsigned char proto_buf[BRCMF_DCMD_MAXLEN];
  596. struct work_struct setmacaddr_work;
  597. struct work_struct multicast_work;
  598. u8 macvalue[ETH_ALEN];
  599. atomic_t pend_8021x_cnt;
  600. #ifdef DEBUG
  601. struct dentry *dbgfs_dir;
  602. #endif
  603. };
  604. /* struct brcmf_if - Interface control information
  605. *
  606. * @drvr: back pointer to brcmf_pub
  607. * @ndev: interface net device pointer
  608. * @stats: net device statistics
  609. * @idx: iface idx in dongle
  610. * @mac_addr: assigned MAC address
  611. */
  612. struct brcmf_if {
  613. struct brcmf_pub *drvr;
  614. struct net_device *ndev;
  615. struct net_device_stats stats;
  616. int idx;
  617. u8 mac_addr[ETH_ALEN];
  618. };
  619. struct brcmf_if_event {
  620. u8 ifidx;
  621. u8 action;
  622. u8 flags;
  623. u8 bssidx;
  624. };
  625. struct bcmevent_name {
  626. uint event;
  627. const char *name;
  628. };
  629. extern const struct bcmevent_name bcmevent_names[];
  630. extern uint brcmf_c_mkiovar(char *name, char *data, uint datalen,
  631. char *buf, uint len);
  632. extern uint brcmf_c_mkiovar_bsscfg(char *name, char *data, uint datalen,
  633. char *buf, uint buflen, s32 bssidx);
  634. extern int brcmf_netdev_wait_pend8021x(struct net_device *ndev);
  635. extern s32 brcmf_exec_dcmd(struct net_device *dev, u32 cmd, void *arg, u32 len);
  636. extern int brcmf_netlink_dcmd(struct net_device *ndev, struct brcmf_dcmd *dcmd);
  637. /* Return pointer to interface name */
  638. extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx);
  639. /* Query dongle */
  640. extern int brcmf_proto_cdc_query_dcmd(struct brcmf_pub *drvr, int ifidx,
  641. uint cmd, void *buf, uint len);
  642. extern int brcmf_proto_cdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
  643. void *buf, uint len);
  644. extern int brcmf_ifname2idx(struct brcmf_pub *drvr, char *name);
  645. extern int brcmf_c_host_event(struct brcmf_pub *drvr, int *idx,
  646. void *pktdata, struct brcmf_event_msg *,
  647. void **data_ptr);
  648. extern void brcmf_del_if(struct brcmf_pub *drvr, int ifidx);
  649. extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg);
  650. extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg,
  651. int enable, int master_mode);
  652. #endif /* _BRCMF_H_ */