rtw_mlme_ext.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __RTW_MLME_EXT_H_
  21. #define __RTW_MLME_EXT_H_
  22. #include <osdep_service.h>
  23. #include <drv_types.h>
  24. #include <wlan_bssdef.h>
  25. /* Commented by Albert 20101105 */
  26. /* Increase the SURVEY_TO value from 100 to 150 ( 100ms to 150ms ) */
  27. /* The Realtek 8188CE SoftAP will spend around 100ms to send the probe response after receiving the probe request. */
  28. /* So, this driver tried to extend the dwell time for each scanning channel. */
  29. /* This will increase the chance to receive the probe response from SoftAP. */
  30. #define SURVEY_TO (100)
  31. #define REAUTH_TO (300) /* 50) */
  32. #define REASSOC_TO (300) /* 50) */
  33. /* define DISCONNECT_TO (3000) */
  34. #define ADDBA_TO (2000)
  35. #define LINKED_TO (1) /* unit:2 sec, 1x2=2 sec */
  36. #define REAUTH_LIMIT (4)
  37. #define REASSOC_LIMIT (4)
  38. #define READDBA_LIMIT (2)
  39. #define ROAMING_LIMIT 8
  40. #define DYNAMIC_FUNC_DISABLE (0x0)
  41. /* ====== ODM_ABILITY_E ======== */
  42. /* BB ODM section BIT 0-15 */
  43. #define DYNAMIC_BB_DIG BIT(0)
  44. #define DYNAMIC_BB_RA_MASK BIT(1)
  45. #define DYNAMIC_BB_DYNAMIC_TXPWR BIT(2)
  46. #define DYNAMIC_BB_BB_FA_CNT BIT(3)
  47. #define DYNAMIC_BB_RSSI_MONITOR BIT(4)
  48. #define DYNAMIC_BB_CCK_PD BIT(5)
  49. #define DYNAMIC_BB_ANT_DIV BIT(6)
  50. #define DYNAMIC_BB_PWR_SAVE BIT(7)
  51. #define DYNAMIC_BB_PWR_TRA BIT(8)
  52. #define DYNAMIC_BB_RATE_ADAPTIVE BIT(9)
  53. #define DYNAMIC_BB_PATH_DIV BIT(10)
  54. #define DYNAMIC_BB_PSD BIT(11)
  55. /* MAC DM section BIT 16-23 */
  56. #define DYNAMIC_MAC_EDCA_TURBO BIT(16)
  57. #define DYNAMIC_MAC_EARLY_MODE BIT(17)
  58. /* RF ODM section BIT 24-31 */
  59. #define DYNAMIC_RF_TX_PWR_TRACK BIT(24)
  60. #define DYNAMIC_RF_RX_GAIN_TRACK BIT(25)
  61. #define DYNAMIC_RF_CALIBRATION BIT(26)
  62. #define DYNAMIC_ALL_FUNC_ENABLE 0xFFFFFFF
  63. #define _HW_STATE_NOLINK_ 0x00
  64. #define _HW_STATE_ADHOC_ 0x01
  65. #define _HW_STATE_STATION_ 0x02
  66. #define _HW_STATE_AP_ 0x03
  67. #define _1M_RATE_ 0
  68. #define _2M_RATE_ 1
  69. #define _5M_RATE_ 2
  70. #define _11M_RATE_ 3
  71. #define _6M_RATE_ 4
  72. #define _9M_RATE_ 5
  73. #define _12M_RATE_ 6
  74. #define _18M_RATE_ 7
  75. #define _24M_RATE_ 8
  76. #define _36M_RATE_ 9
  77. #define _48M_RATE_ 10
  78. #define _54M_RATE_ 11
  79. extern unsigned char RTW_WPA_OUI[];
  80. extern unsigned char WMM_OUI[];
  81. extern unsigned char WPS_OUI[];
  82. extern unsigned char WFD_OUI[];
  83. extern unsigned char P2P_OUI[];
  84. extern unsigned char WMM_INFO_OUI[];
  85. extern unsigned char WMM_PARA_OUI[];
  86. /* Channel Plan Type. */
  87. /* Note: */
  88. /* We just add new channel plan when the new channel plan is different
  89. * from any of the following channel plan. */
  90. /* If you just want to customize the actions(scan period or join actions)
  91. * about one of the channel plan, */
  92. /* customize them in struct rt_channel_info in the RT_CHANNEL_LIST. */
  93. enum RT_CHANNEL_DOMAIN {
  94. /* old channel plan mapping ===== */
  95. RT_CHANNEL_DOMAIN_FCC = 0x00,
  96. RT_CHANNEL_DOMAIN_IC = 0x01,
  97. RT_CHANNEL_DOMAIN_ETSI = 0x02,
  98. RT_CHANNEL_DOMAIN_SPAIN = 0x03,
  99. RT_CHANNEL_DOMAIN_FRANCE = 0x04,
  100. RT_CHANNEL_DOMAIN_MKK = 0x05,
  101. RT_CHANNEL_DOMAIN_MKK1 = 0x06,
  102. RT_CHANNEL_DOMAIN_ISRAEL = 0x07,
  103. RT_CHANNEL_DOMAIN_TELEC = 0x08,
  104. RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN = 0x09,
  105. RT_CHANNEL_DOMAIN_WORLD_WIDE_13 = 0x0A,
  106. RT_CHANNEL_DOMAIN_TAIWAN = 0x0B,
  107. RT_CHANNEL_DOMAIN_CHINA = 0x0C,
  108. RT_CHANNEL_DOMAIN_SINGAPORE_INDIA_MEXICO = 0x0D,
  109. RT_CHANNEL_DOMAIN_KOREA = 0x0E,
  110. RT_CHANNEL_DOMAIN_TURKEY = 0x0F,
  111. RT_CHANNEL_DOMAIN_JAPAN = 0x10,
  112. RT_CHANNEL_DOMAIN_FCC_NO_DFS = 0x11,
  113. RT_CHANNEL_DOMAIN_JAPAN_NO_DFS = 0x12,
  114. RT_CHANNEL_DOMAIN_WORLD_WIDE_5G = 0x13,
  115. RT_CHANNEL_DOMAIN_TAIWAN_NO_DFS = 0x14,
  116. /* new channel plan mapping, (2GDOMAIN_5GDOMAIN) ===== */
  117. RT_CHANNEL_DOMAIN_WORLD_NULL = 0x20,
  118. RT_CHANNEL_DOMAIN_ETSI1_NULL = 0x21,
  119. RT_CHANNEL_DOMAIN_FCC1_NULL = 0x22,
  120. RT_CHANNEL_DOMAIN_MKK1_NULL = 0x23,
  121. RT_CHANNEL_DOMAIN_ETSI2_NULL = 0x24,
  122. RT_CHANNEL_DOMAIN_FCC1_FCC1 = 0x25,
  123. RT_CHANNEL_DOMAIN_WORLD_ETSI1 = 0x26,
  124. RT_CHANNEL_DOMAIN_MKK1_MKK1 = 0x27,
  125. RT_CHANNEL_DOMAIN_WORLD_KCC1 = 0x28,
  126. RT_CHANNEL_DOMAIN_WORLD_FCC2 = 0x29,
  127. RT_CHANNEL_DOMAIN_WORLD_FCC3 = 0x30,
  128. RT_CHANNEL_DOMAIN_WORLD_FCC4 = 0x31,
  129. RT_CHANNEL_DOMAIN_WORLD_FCC5 = 0x32,
  130. RT_CHANNEL_DOMAIN_WORLD_FCC6 = 0x33,
  131. RT_CHANNEL_DOMAIN_FCC1_FCC7 = 0x34,
  132. RT_CHANNEL_DOMAIN_WORLD_ETSI2 = 0x35,
  133. RT_CHANNEL_DOMAIN_WORLD_ETSI3 = 0x36,
  134. RT_CHANNEL_DOMAIN_MKK1_MKK2 = 0x37,
  135. RT_CHANNEL_DOMAIN_MKK1_MKK3 = 0x38,
  136. RT_CHANNEL_DOMAIN_FCC1_NCC1 = 0x39,
  137. RT_CHANNEL_DOMAIN_FCC1_NCC2 = 0x40,
  138. RT_CHANNEL_DOMAIN_GLOBAL_DOAMIN_2G = 0x41,
  139. /* Add new channel plan above this line=============== */
  140. RT_CHANNEL_DOMAIN_MAX,
  141. RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
  142. };
  143. enum RT_CHANNEL_DOMAIN_2G {
  144. RT_CHANNEL_DOMAIN_2G_WORLD = 0x00, /* Worldwide 13 */
  145. RT_CHANNEL_DOMAIN_2G_ETSI1 = 0x01, /* Europe */
  146. RT_CHANNEL_DOMAIN_2G_FCC1 = 0x02, /* US */
  147. RT_CHANNEL_DOMAIN_2G_MKK1 = 0x03, /* Japan */
  148. RT_CHANNEL_DOMAIN_2G_ETSI2 = 0x04, /* France */
  149. RT_CHANNEL_DOMAIN_2G_NULL = 0x05,
  150. /* Add new channel plan above this line=============== */
  151. RT_CHANNEL_DOMAIN_2G_MAX,
  152. };
  153. #define rtw_is_channel_plan_valid(chplan) \
  154. (chplan < RT_CHANNEL_DOMAIN_MAX || \
  155. chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE)
  156. struct rt_channel_plan {
  157. unsigned char Channel[MAX_CHANNEL_NUM];
  158. unsigned char Len;
  159. };
  160. struct rt_channel_plan_2g {
  161. unsigned char Channel[MAX_CHANNEL_NUM_2G];
  162. unsigned char Len;
  163. };
  164. struct rt_channel_plan_map {
  165. unsigned char Index2G;
  166. };
  167. static const struct {
  168. int channel_plan;
  169. char *name;
  170. } channel_table[] = { { RT_CHANNEL_DOMAIN_FCC, "US" },
  171. { RT_CHANNEL_DOMAIN_ETSI, "EU" },
  172. { RT_CHANNEL_DOMAIN_MKK, "JP" },
  173. { RT_CHANNEL_DOMAIN_CHINA, "CN"} };
  174. enum Associated_AP {
  175. atherosAP = 0,
  176. broadcomAP = 1,
  177. ciscoAP = 2,
  178. marvellAP = 3,
  179. ralinkAP = 4,
  180. realtekAP = 5,
  181. airgocapAP = 6,
  182. unknownAP = 7,
  183. maxAP,
  184. };
  185. enum HT_IOT_PEER {
  186. HT_IOT_PEER_UNKNOWN = 0,
  187. HT_IOT_PEER_REALTEK = 1,
  188. HT_IOT_PEER_REALTEK_92SE = 2,
  189. HT_IOT_PEER_BROADCOM = 3,
  190. HT_IOT_PEER_RALINK = 4,
  191. HT_IOT_PEER_ATHEROS = 5,
  192. HT_IOT_PEER_CISCO = 6,
  193. HT_IOT_PEER_MERU = 7,
  194. HT_IOT_PEER_MARVELL = 8,
  195. HT_IOT_PEER_REALTEK_SOFTAP = 9,/* peer is RealTek SOFT_AP */
  196. HT_IOT_PEER_SELF_SOFTAP = 10, /* Self is SoftAP */
  197. HT_IOT_PEER_AIRGO = 11,
  198. HT_IOT_PEER_INTEL = 12,
  199. HT_IOT_PEER_RTK_APCLIENT = 13,
  200. HT_IOT_PEER_REALTEK_81XX = 14,
  201. HT_IOT_PEER_REALTEK_WOW = 15,
  202. HT_IOT_PEER_TENDA = 16,
  203. HT_IOT_PEER_MAX = 17
  204. };
  205. enum SCAN_STATE {
  206. SCAN_DISABLE = 0,
  207. SCAN_START = 1,
  208. SCAN_TXNULL = 2,
  209. SCAN_PROCESS = 3,
  210. SCAN_COMPLETE = 4,
  211. SCAN_STATE_MAX,
  212. };
  213. struct mlme_handler {
  214. unsigned int num;
  215. char *str;
  216. unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame);
  217. };
  218. struct action_handler {
  219. unsigned int num;
  220. char *str;
  221. unsigned int (*func)(struct adapter *adapt, struct recv_frame *frame);
  222. };
  223. struct ss_res {
  224. int state;
  225. int bss_cnt;
  226. int channel_idx;
  227. int scan_mode;
  228. u8 ssid_num;
  229. u8 ch_num;
  230. struct ndis_802_11_ssid ssid[RTW_SSID_SCAN_AMOUNT];
  231. struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT];
  232. };
  233. /* define AP_MODE 0x0C */
  234. /* define STATION_MODE 0x08 */
  235. /* define AD_HOC_MODE 0x04 */
  236. /* define NO_LINK_MODE 0x00 */
  237. #define WIFI_FW_NULL_STATE _HW_STATE_NOLINK_
  238. #define WIFI_FW_STATION_STATE _HW_STATE_STATION_
  239. #define WIFI_FW_AP_STATE _HW_STATE_AP_
  240. #define WIFI_FW_ADHOC_STATE _HW_STATE_ADHOC_
  241. #define WIFI_FW_AUTH_NULL 0x00000100
  242. #define WIFI_FW_AUTH_STATE 0x00000200
  243. #define WIFI_FW_AUTH_SUCCESS 0x00000400
  244. #define WIFI_FW_ASSOC_STATE 0x00002000
  245. #define WIFI_FW_ASSOC_SUCCESS 0x00004000
  246. #define WIFI_FW_LINKING_STATE (WIFI_FW_AUTH_NULL | \
  247. WIFI_FW_AUTH_STATE | \
  248. WIFI_FW_AUTH_SUCCESS | \
  249. WIFI_FW_ASSOC_STATE)
  250. struct FW_Sta_Info {
  251. struct sta_info *psta;
  252. u32 status;
  253. u32 rx_pkt;
  254. u32 retry;
  255. unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
  256. };
  257. /*
  258. * Usage:
  259. * When one iface acted as AP mode and the other iface is STA mode and scanning,
  260. * it should switch back to AP's operating channel periodically.
  261. * Parameters info:
  262. * When the driver scanned RTW_SCAN_NUM_OF_CH channels, it would switch back to
  263. * AP's operating channel for
  264. * RTW_STAY_AP_CH_MILLISECOND * SURVEY_TO milliseconds.
  265. * Example:
  266. * For chip supports 2.4G + 5GHz and AP mode is operating in channel 1,
  267. * RTW_SCAN_NUM_OF_CH is 8, RTW_STAY_AP_CH_MS is 3 and SURVEY_TO is 100.
  268. * When it's STA mode gets set_scan command,
  269. * it would
  270. * 1. Doing the scan on channel 1.2.3.4.5.6.7.8
  271. * 2. Back to channel 1 for 300 milliseconds
  272. * 3. Go through doing site survey on channel 9.10.11.36.40.44.48.52
  273. * 4. Back to channel 1 for 300 milliseconds
  274. * 5. ... and so on, till survey done.
  275. */
  276. struct mlme_ext_info {
  277. u32 state;
  278. u32 reauth_count;
  279. u32 reassoc_count;
  280. u32 link_count;
  281. u32 auth_seq;
  282. u32 auth_algo; /* 802.11 auth, could be open, shared, auto */
  283. u32 authModeToggle;
  284. u32 enc_algo;/* encrypt algorithm; */
  285. u32 key_index; /* this is only valid for legacy wep,
  286. * 0~3 for key id. */
  287. u32 iv;
  288. u8 chg_txt[128];
  289. u16 aid;
  290. u16 bcn_interval;
  291. u16 capability;
  292. u8 assoc_AP_vendor;
  293. u8 slotTime;
  294. u8 preamble_mode;
  295. u8 WMM_enable;
  296. u8 ERP_enable;
  297. u8 ERP_IE;
  298. u8 HT_enable;
  299. u8 HT_caps_enable;
  300. u8 HT_info_enable;
  301. u8 HT_protection;
  302. u8 turboMode_cts2self;
  303. u8 turboMode_rtsen;
  304. u8 SM_PS;
  305. u8 agg_enable_bitmap;
  306. u8 ADDBA_retry_count;
  307. u8 candidate_tid_bitmap;
  308. u8 dialogToken;
  309. /* Accept ADDBA Request */
  310. bool bAcceptAddbaReq;
  311. u8 bwmode_updated;
  312. u8 hidden_ssid_mode;
  313. struct ADDBA_request ADDBA_req;
  314. struct WMM_para_element WMM_param;
  315. struct HT_caps_element HT_caps;
  316. struct HT_info_element HT_info;
  317. struct wlan_bssid_ex network;/* join network or bss_network,
  318. * if in ap mode, it is the same
  319. * as cur_network.network */
  320. struct FW_Sta_Info FW_sta_info[NUM_STA];
  321. };
  322. /* The channel information about this channel including joining,
  323. * scanning, and power constraints. */
  324. struct rt_channel_info {
  325. u8 ChannelNum; /* The channel number. */
  326. enum rt_scan_type ScanType; /* Scan type such as passive
  327. * or active scan. */
  328. u32 rx_count;
  329. };
  330. int rtw_ch_set_search_ch(struct rt_channel_info *ch_set, const u32 ch);
  331. /* P2P_MAX_REG_CLASSES - Maximum number of regulatory classes */
  332. #define P2P_MAX_REG_CLASSES 10
  333. /* P2P_MAX_REG_CLASS_CHANNELS - Maximum number of chan per regulatory class */
  334. #define P2P_MAX_REG_CLASS_CHANNELS 20
  335. /* struct p2p_channels - List of supported channels */
  336. struct p2p_channels {
  337. /* struct p2p_reg_class - Supported regulatory class */
  338. struct p2p_reg_class {
  339. /* reg_class - Regulatory class (IEEE 802.11-2007, Annex J) */
  340. u8 reg_class;
  341. /* channel - Supported channels */
  342. u8 channel[P2P_MAX_REG_CLASS_CHANNELS];
  343. /* channels - Number of channel entries in use */
  344. size_t channels;
  345. } reg_class[P2P_MAX_REG_CLASSES];
  346. /* reg_classes - Number of reg_class entries in use */
  347. size_t reg_classes;
  348. };
  349. struct p2p_oper_class_map {
  350. enum hw_mode {IEEE80211G} mode;
  351. u8 op_class;
  352. u8 min_chan;
  353. u8 max_chan;
  354. u8 inc;
  355. enum {BW20, BW40PLUS, BW40MINUS} bw;
  356. };
  357. struct mlme_ext_priv {
  358. struct adapter *padapter;
  359. u8 mlmeext_init;
  360. atomic_t event_seq;
  361. u16 mgnt_seq;
  362. unsigned char cur_channel;
  363. unsigned char cur_bwmode;
  364. unsigned char cur_ch_offset;/* PRIME_CHNL_OFFSET */
  365. unsigned char cur_wireless_mode; /* NETWORK_TYPE */
  366. unsigned char oper_channel; /* saved chan info when call
  367. * set_channel_bw */
  368. unsigned char oper_bwmode;
  369. unsigned char oper_ch_offset;/* PRIME_CHNL_OFFSET */
  370. unsigned char max_chan_nums;
  371. struct rt_channel_info channel_set[MAX_CHANNEL_NUM];
  372. struct p2p_channels channel_list;
  373. unsigned char basicrate[NumRates];
  374. unsigned char datarate[NumRates];
  375. struct ss_res sitesurvey_res;
  376. struct mlme_ext_info mlmext_info;/* for sta/adhoc mode, including
  377. * current scan/connecting/connected
  378. * related info. For ap mode,
  379. * network includes ap's cap_info*/
  380. struct timer_list survey_timer;
  381. struct timer_list link_timer;
  382. u16 chan_scan_time;
  383. u8 scan_abort;
  384. u8 tx_rate; /* TXRATE when USERATE is set. */
  385. u32 retry; /* retry for issue probereq */
  386. u64 TSFValue;
  387. #ifdef CONFIG_88EU_AP_MODE
  388. unsigned char bstart_bss;
  389. #endif
  390. u8 update_channel_plan_by_ap_done;
  391. /* recv_decache check for Action_public frame */
  392. u8 action_public_dialog_token;
  393. u16 action_public_rxseq;
  394. u8 active_keep_alive_check;
  395. };
  396. int init_mlme_ext_priv(struct adapter *adapter);
  397. int init_hw_mlme_ext(struct adapter *padapter);
  398. void free_mlme_ext_priv(struct mlme_ext_priv *pmlmeext);
  399. void init_mlme_ext_timer(struct adapter *padapter);
  400. void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta);
  401. struct xmit_frame *alloc_mgtxmitframe(struct xmit_priv *pxmitpriv);
  402. unsigned char networktype_to_raid(unsigned char network_type);
  403. u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int len);
  404. void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *len);
  405. void UpdateBrateTbl(struct adapter *padapter, u8 *mBratesOS);
  406. void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen);
  407. void Save_DM_Func_Flag(struct adapter *padapter);
  408. void Restore_DM_Func_Flag(struct adapter *padapter);
  409. void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);
  410. void Set_MSR(struct adapter *padapter, u8 type);
  411. u8 rtw_get_oper_ch(struct adapter *adapter);
  412. void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
  413. u8 rtw_get_oper_bw(struct adapter *adapter);
  414. void rtw_set_oper_bw(struct adapter *adapter, u8 bw);
  415. u8 rtw_get_oper_choffset(struct adapter *adapter);
  416. void rtw_set_oper_choffset(struct adapter *adapter, u8 offset);
  417. void set_channel_bwmode(struct adapter *padapter, unsigned char channel,
  418. unsigned char channel_offset, unsigned short bwmode);
  419. void SelectChannel(struct adapter *padapter, unsigned char channel);
  420. void SetBWMode(struct adapter *padapter, unsigned short bwmode,
  421. unsigned char channel_offset);
  422. unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval);
  423. void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key);
  424. void clear_cam_entry(struct adapter *padapter, u8 entry);
  425. void invalidate_cam_all(struct adapter *padapter);
  426. void CAM_empty_entry(struct adapter *Adapter, u8 ucIndex);
  427. int allocate_fw_sta_entry(struct adapter *padapter);
  428. void flush_all_cam_entry(struct adapter *padapter);
  429. void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
  430. struct adapter *adapter, bool update_ie);
  431. int get_bsstype(unsigned short capability);
  432. u16 get_beacon_interval(struct wlan_bssid_ex *bss);
  433. int is_client_associated_to_ap(struct adapter *padapter);
  434. int is_client_associated_to_ibss(struct adapter *padapter);
  435. int is_IBSS_empty(struct adapter *padapter);
  436. unsigned char check_assoc_AP(u8 *pframe, uint len);
  437. int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
  438. void WMMOnAssocRsp(struct adapter *padapter);
  439. void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
  440. void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
  441. void HTOnAssocRsp(struct adapter *padapter);
  442. void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE);
  443. void VCS_update(struct adapter *padapter, struct sta_info *psta);
  444. void update_beacon_info(struct adapter *padapter, u8 *pframe, uint len,
  445. struct sta_info *psta);
  446. int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len);
  447. void update_IOT_info(struct adapter *padapter);
  448. void update_capinfo(struct adapter *adapter, u16 updatecap);
  449. void update_wireless_mode(struct adapter *padapter);
  450. void update_tx_basic_rate(struct adapter *padapter, u8 modulation);
  451. void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id);
  452. int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie,
  453. uint var_ie_len, int cam_idx);
  454. /* for sta/adhoc mode */
  455. void update_sta_info(struct adapter *padapter, struct sta_info *psta);
  456. unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz);
  457. unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz);
  458. unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps);
  459. void Update_RA_Entry(struct adapter *padapter, u32 mac_id);
  460. void set_sta_rate(struct adapter *padapter, struct sta_info *psta);
  461. unsigned char get_highest_rate_idx(u32 mask);
  462. int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps);
  463. unsigned int is_ap_in_tkip(struct adapter *padapter);
  464. unsigned int is_ap_in_wep(struct adapter *padapter);
  465. unsigned int should_forbid_n_rate(struct adapter *padapter);
  466. void report_join_res(struct adapter *padapter, int res);
  467. void report_survey_event(struct adapter *padapter,
  468. struct recv_frame *precv_frame);
  469. void report_surveydone_event(struct adapter *padapter);
  470. void report_del_sta_event(struct adapter *padapter,
  471. unsigned char *addr, unsigned short reason);
  472. void report_add_sta_event(struct adapter *padapter, unsigned char *addr,
  473. int cam_idx);
  474. void beacon_timing_control(struct adapter *padapter);
  475. u8 set_tx_beacon_cmd(struct adapter *padapter);
  476. unsigned int setup_beacon_frame(struct adapter *padapter,
  477. unsigned char *beacon_frame);
  478. void update_mgnt_tx_rate(struct adapter *padapter, u8 rate);
  479. void update_mgntframe_attrib(struct adapter *padapter,
  480. struct pkt_attrib *pattrib);
  481. int issue_nulldata(struct adapter *padapter, unsigned char *da,
  482. unsigned int power_mode, int try_cnt, int wait_ms);
  483. int issue_qos_nulldata(struct adapter *padapter, unsigned char *da,
  484. u16 tid, int try_cnt, int wait_ms);
  485. int issue_deauth(struct adapter *padapter, unsigned char *da,
  486. unsigned short reason);
  487. void issue_action_spct_ch_switch(struct adapter *padapter, u8 *ra, u8 new_ch,
  488. u8 ch_offset);
  489. unsigned int send_delba(struct adapter *padapter, u8 initiator, u8 *addr);
  490. unsigned int send_beacon(struct adapter *padapter);
  491. void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res);
  492. void mlmeext_sta_del_event_callback(struct adapter *padapter);
  493. void mlmeext_sta_add_event_callback(struct adapter *padapter,
  494. struct sta_info *psta);
  495. void linked_status_chk(struct adapter *padapter);
  496. void survey_timer_hdl(unsigned long data);
  497. void link_timer_hdl(unsigned long data);
  498. void addba_timer_hdl(unsigned long data);
  499. #define set_survey_timer(mlmeext, ms) \
  500. mod_timer(&mlmeext->survey_timer, jiffies + \
  501. msecs_to_jiffies(ms))
  502. #define set_link_timer(mlmeext, ms) \
  503. mod_timer(&mlmeext->link_timer, jiffies + \
  504. msecs_to_jiffies(ms))
  505. int cckrates_included(unsigned char *rate, int ratelen);
  506. int cckratesonly_included(unsigned char *rate, int ratelen);
  507. void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr);
  508. void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len);
  509. void correct_TSF(struct adapter *padapter, struct mlme_ext_priv *pmlmeext);
  510. struct cmd_hdl {
  511. uint parmsize;
  512. u8 (*h2cfuns)(struct adapter *padapter, u8 *pbuf);
  513. };
  514. u8 read_macreg_hdl(struct adapter *padapter, u8 *pbuf);
  515. u8 write_macreg_hdl(struct adapter *padapter, u8 *pbuf);
  516. u8 read_bbreg_hdl(struct adapter *padapter, u8 *pbuf);
  517. u8 write_bbreg_hdl(struct adapter *padapter, u8 *pbuf);
  518. u8 read_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
  519. u8 write_rfreg_hdl(struct adapter *padapter, u8 *pbuf);
  520. u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf);
  521. u8 disconnect_hdl(struct adapter *padapter, u8 *pbuf);
  522. u8 createbss_hdl(struct adapter *padapter, u8 *pbuf);
  523. u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf);
  524. u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf);
  525. u8 setauth_hdl(struct adapter *padapter, u8 *pbuf);
  526. u8 setkey_hdl(struct adapter *padapter, u8 *pbuf);
  527. u8 set_stakey_hdl(struct adapter *padapter, u8 *pbuf);
  528. u8 set_assocsta_hdl(struct adapter *padapter, u8 *pbuf);
  529. u8 del_assocsta_hdl(struct adapter *padapter, u8 *pbuf);
  530. u8 add_ba_hdl(struct adapter *padapter, unsigned char *pbuf);
  531. u8 mlme_evt_hdl(struct adapter *padapter, unsigned char *pbuf);
  532. u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf);
  533. u8 tx_beacon_hdl(struct adapter *padapter, unsigned char *pbuf);
  534. u8 set_ch_hdl(struct adapter *padapter, u8 *pbuf);
  535. u8 set_chplan_hdl(struct adapter *padapter, unsigned char *pbuf);
  536. u8 led_blink_hdl(struct adapter *padapter, unsigned char *pbuf);
  537. /* Handling DFS channel switch announcement ie. */
  538. u8 set_csa_hdl(struct adapter *padapter, unsigned char *pbuf);
  539. u8 tdls_hdl(struct adapter *padapter, unsigned char *pbuf);
  540. #define GEN_DRV_CMD_HANDLER(size, cmd) {size, &cmd ## _hdl},
  541. #define GEN_MLME_EXT_HANDLER(size, cmd) {size, cmd},
  542. #ifdef _RTW_CMD_C_
  543. static struct cmd_hdl wlancmds[] = {
  544. GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), join_cmd_hdl)
  545. GEN_MLME_EXT_HANDLER(sizeof(struct disconnect_parm), disconnect_hdl)
  546. GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), createbss_hdl)
  547. GEN_MLME_EXT_HANDLER(sizeof(struct setopmode_parm), setopmode_hdl)
  548. GEN_MLME_EXT_HANDLER(sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl)
  549. GEN_MLME_EXT_HANDLER(sizeof(struct setauth_parm), setauth_hdl)
  550. GEN_MLME_EXT_HANDLER(sizeof(struct setkey_parm), setkey_hdl)
  551. GEN_MLME_EXT_HANDLER(sizeof(struct set_stakey_parm), set_stakey_hdl)
  552. GEN_MLME_EXT_HANDLER(sizeof(struct set_assocsta_parm), NULL)
  553. GEN_MLME_EXT_HANDLER(sizeof(struct addBaReq_parm), add_ba_hdl)
  554. GEN_MLME_EXT_HANDLER(sizeof(struct set_ch_parm), set_ch_hdl)
  555. GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), tx_beacon_hdl)
  556. GEN_MLME_EXT_HANDLER(0, mlme_evt_hdl)
  557. GEN_MLME_EXT_HANDLER(0, rtw_drvextra_cmd_hdl)
  558. GEN_MLME_EXT_HANDLER(sizeof(struct SetChannelPlan_param), set_chplan_hdl)
  559. };
  560. #endif
  561. struct C2HEvent_Header {
  562. #ifdef __LITTLE_ENDIAN
  563. unsigned int len:16;
  564. unsigned int ID:8;
  565. unsigned int seq:8;
  566. #elif defined(__BIG_ENDIAN)
  567. unsigned int seq:8;
  568. unsigned int ID:8;
  569. unsigned int len:16;
  570. #endif
  571. unsigned int rsvd;
  572. };
  573. void rtw_dummy_event_callback(struct adapter *adapter, u8 *pbuf);
  574. void rtw_fwdbg_event_callback(struct adapter *adapter, u8 *pbuf);
  575. enum rtw_c2h_event {
  576. GEN_EVT_CODE(_Read_MACREG) = 0, /*0*/
  577. GEN_EVT_CODE(_Read_BBREG),
  578. GEN_EVT_CODE(_Read_RFREG),
  579. GEN_EVT_CODE(_Read_EEPROM),
  580. GEN_EVT_CODE(_Read_EFUSE),
  581. GEN_EVT_CODE(_Read_CAM), /*5*/
  582. GEN_EVT_CODE(_Get_BasicRate),
  583. GEN_EVT_CODE(_Get_DataRate),
  584. GEN_EVT_CODE(_Survey), /*8*/
  585. GEN_EVT_CODE(_SurveyDone), /*9*/
  586. GEN_EVT_CODE(_JoinBss), /*10*/
  587. GEN_EVT_CODE(_AddSTA),
  588. GEN_EVT_CODE(_DelSTA),
  589. GEN_EVT_CODE(_AtimDone),
  590. GEN_EVT_CODE(_TX_Report),
  591. GEN_EVT_CODE(_CCX_Report), /*15*/
  592. GEN_EVT_CODE(_DTM_Report),
  593. GEN_EVT_CODE(_TX_Rate_Statistics),
  594. GEN_EVT_CODE(_C2HLBK),
  595. GEN_EVT_CODE(_FWDBG),
  596. GEN_EVT_CODE(_C2HFEEDBACK), /*20*/
  597. GEN_EVT_CODE(_ADDBA),
  598. GEN_EVT_CODE(_C2HBCN),
  599. GEN_EVT_CODE(_ReportPwrState), /* filen: only for PCIE, USB */
  600. GEN_EVT_CODE(_CloseRF), /* filen: only for PCIE,
  601. * work around ASPM */
  602. MAX_C2HEVT
  603. };
  604. #ifdef _RTW_MLME_EXT_C_
  605. static struct fwevent wlanevents[] = {
  606. {0, rtw_dummy_event_callback}, /*0*/
  607. {0, NULL},
  608. {0, NULL},
  609. {0, NULL},
  610. {0, NULL},
  611. {0, NULL},
  612. {0, NULL},
  613. {0, NULL},
  614. {0, &rtw_survey_event_callback}, /*8*/
  615. {sizeof(struct surveydone_event), &rtw_surveydone_event_callback},/*9*/
  616. {0, &rtw_joinbss_event_callback}, /*10*/
  617. {sizeof(struct stassoc_event), &rtw_stassoc_event_callback},
  618. {sizeof(struct stadel_event), &rtw_stadel_event_callback},
  619. {0, &rtw_atimdone_event_callback},
  620. {0, rtw_dummy_event_callback},
  621. {0, NULL}, /*15*/
  622. {0, NULL},
  623. {0, NULL},
  624. {0, NULL},
  625. {0, rtw_fwdbg_event_callback},
  626. {0, NULL}, /*20*/
  627. {0, NULL},
  628. {0, NULL},
  629. {0, &rtw_cpwm_event_callback},
  630. {0, NULL},
  631. };
  632. #endif/* _RTL_MLME_EXT_C_ */
  633. #endif /* __RTW_MLME_EXT_H_ */