rtw_ioctl_rtl.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  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. #define _RTW_IOCTL_RTL_C_
  21. #include <drv_types.h>
  22. #ifdef CONFIG_MP_INCLUDED
  23. #include <rtw_mp_ioctl.h>
  24. #endif
  25. struct oid_obj_priv oid_rtl_seg_01_01[] =
  26. {
  27. {1, &oid_null_function}, //0x80
  28. {1, &oid_null_function}, //0x81
  29. {1, &oid_null_function}, //0x82
  30. {1, &oid_null_function}, //0x83//OID_RT_SET_SNIFFER_MODE
  31. {1, &oid_rt_get_signal_quality_hdl}, //0x84
  32. {1, &oid_rt_get_small_packet_crc_hdl}, //0x85
  33. {1, &oid_rt_get_middle_packet_crc_hdl}, //0x86
  34. {1, &oid_rt_get_large_packet_crc_hdl}, //0x87
  35. {1, &oid_rt_get_tx_retry_hdl}, //0x88
  36. {1, &oid_rt_get_rx_retry_hdl}, //0x89
  37. {1, &oid_rt_pro_set_fw_dig_state_hdl}, //0x8A
  38. {1, &oid_rt_pro_set_fw_ra_state_hdl} , //0x8B
  39. {1, &oid_null_function}, //0x8C
  40. {1, &oid_null_function}, //0x8D
  41. {1, &oid_null_function}, //0x8E
  42. {1, &oid_null_function}, //0x8F
  43. {1, &oid_rt_get_rx_total_packet_hdl}, //0x90
  44. {1, &oid_rt_get_tx_beacon_ok_hdl}, //0x91
  45. {1, &oid_rt_get_tx_beacon_err_hdl}, //0x92
  46. {1, &oid_rt_get_rx_icv_err_hdl}, //0x93
  47. {1, &oid_rt_set_encryption_algorithm_hdl}, //0x94
  48. {1, &oid_null_function}, //0x95
  49. {1, &oid_rt_get_preamble_mode_hdl}, //0x96
  50. {1, &oid_null_function}, //0x97
  51. {1, &oid_rt_get_ap_ip_hdl}, //0x98
  52. {1, &oid_rt_get_channelplan_hdl}, //0x99
  53. {1, &oid_rt_set_preamble_mode_hdl}, //0x9A
  54. {1, &oid_rt_set_bcn_intvl_hdl}, //0x9B
  55. {1, &oid_null_function}, //0x9C
  56. {1, &oid_rt_dedicate_probe_hdl}, //0x9D
  57. {1, &oid_null_function}, //0x9E
  58. {1, &oid_null_function}, //0x9F
  59. {1, &oid_null_function}, //0xA0
  60. {1, &oid_null_function}, //0xA1
  61. {1, &oid_null_function}, //0xA2
  62. {1, &oid_null_function}, //0xA3
  63. {1, &oid_null_function}, //0xA4
  64. {1, &oid_null_function}, //0xA5
  65. {1, &oid_null_function}, //0xA6
  66. {1, &oid_rt_get_total_tx_bytes_hdl}, //0xA7
  67. {1, &oid_rt_get_total_rx_bytes_hdl}, //0xA8
  68. {1, &oid_rt_current_tx_power_level_hdl}, //0xA9
  69. {1, &oid_rt_get_enc_key_mismatch_count_hdl}, //0xAA
  70. {1, &oid_rt_get_enc_key_match_count_hdl}, //0xAB
  71. {1, &oid_rt_get_channel_hdl}, //0xAC
  72. {1, &oid_rt_set_channelplan_hdl}, //0xAD
  73. {1, &oid_rt_get_hardware_radio_off_hdl}, //0xAE
  74. {1, &oid_null_function}, //0xAF
  75. {1, &oid_null_function}, //0xB0
  76. {1, &oid_null_function}, //0xB1
  77. {1, &oid_null_function}, //0xB2
  78. {1, &oid_null_function}, //0xB3
  79. {1, &oid_rt_get_key_mismatch_hdl}, //0xB4
  80. {1, &oid_null_function}, //0xB5
  81. {1, &oid_null_function}, //0xB6
  82. {1, &oid_null_function}, //0xB7
  83. {1, &oid_null_function}, //0xB8
  84. {1, &oid_null_function}, //0xB9
  85. {1, &oid_null_function}, //0xBA
  86. {1, &oid_rt_supported_wireless_mode_hdl}, //0xBB
  87. {1, &oid_rt_get_channel_list_hdl}, //0xBC
  88. {1, &oid_rt_get_scan_in_progress_hdl}, //0xBD
  89. {1, &oid_null_function}, //0xBE
  90. {1, &oid_null_function}, //0xBF
  91. {1, &oid_null_function}, //0xC0
  92. {1, &oid_rt_forced_data_rate_hdl}, //0xC1
  93. {1, &oid_rt_wireless_mode_for_scan_list_hdl}, //0xC2
  94. {1, &oid_rt_get_bss_wireless_mode_hdl}, //0xC3
  95. {1, &oid_rt_scan_with_magic_packet_hdl}, //0xC4
  96. {1, &oid_null_function}, //0xC5
  97. {1, &oid_null_function}, //0xC6
  98. {1, &oid_null_function}, //0xC7
  99. {1, &oid_null_function}, //0xC8
  100. {1, &oid_null_function}, //0xC9
  101. {1, &oid_null_function}, //0xCA
  102. {1, &oid_null_function}, //0xCB
  103. {1, &oid_null_function}, //0xCC
  104. {1, &oid_null_function}, //0xCD
  105. {1, &oid_null_function}, //0xCE
  106. {1, &oid_null_function}, //0xCF
  107. };
  108. struct oid_obj_priv oid_rtl_seg_01_03[] =
  109. {
  110. {1, &oid_rt_ap_get_associated_station_list_hdl}, //0x00
  111. {1, &oid_null_function}, //0x01
  112. {1, &oid_rt_ap_switch_into_ap_mode_hdl}, //0x02
  113. {1, &oid_null_function}, //0x03
  114. {1, &oid_rt_ap_supported_hdl}, //0x04
  115. {1, &oid_rt_ap_set_passphrase_hdl}, //0x05
  116. };
  117. struct oid_obj_priv oid_rtl_seg_01_11[] =
  118. {
  119. {1, &oid_null_function}, //0xC0 OID_RT_PRO_RX_FILTER
  120. {1, &oid_null_function}, //0xC1 OID_CE_USB_WRITE_REGISTRY
  121. {1, &oid_null_function}, //0xC2 OID_CE_USB_READ_REGISTRY
  122. {1, &oid_null_function}, //0xC3 OID_RT_PRO_SET_INITIAL_GAIN
  123. {1, &oid_null_function}, //0xC4 OID_RT_PRO_SET_BB_RF_STANDBY_MODE
  124. {1, &oid_null_function}, //0xC5 OID_RT_PRO_SET_BB_RF_SHUTDOWN_MODE
  125. {1, &oid_null_function}, //0xC6 OID_RT_PRO_SET_TX_CHARGE_PUMP
  126. {1, &oid_null_function}, //0xC7 OID_RT_PRO_SET_RX_CHARGE_PUMP
  127. {1, &oid_rt_pro_rf_write_registry_hdl}, //0xC8
  128. {1, &oid_rt_pro_rf_read_registry_hdl}, //0xC9
  129. {1, &oid_null_function} //0xCA OID_RT_PRO_QUERY_RF_TYPE
  130. };
  131. struct oid_obj_priv oid_rtl_seg_03_00[] =
  132. {
  133. {1, &oid_null_function}, //0x00
  134. {1, &oid_rt_get_connect_state_hdl}, //0x01
  135. {1, &oid_null_function}, //0x02
  136. {1, &oid_null_function}, //0x03
  137. {1, &oid_rt_set_default_key_id_hdl}, //0x04
  138. };
  139. //************** oid_rtl_seg_01_01 section start **************
  140. NDIS_STATUS oid_rt_pro_set_fw_dig_state_hdl(struct oid_par_priv* poid_par_priv)
  141. {
  142. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  143. #if 0
  144. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  145. _irqL oldirql;
  146. _func_enter_;
  147. if(poid_par_priv->type_of_oid != SET_OID)
  148. {
  149. status = NDIS_STATUS_NOT_ACCEPTED;
  150. return status;
  151. }
  152. _irqlevel_changed_(&oldirql,LOWER);
  153. if(poid_par_priv->information_buf_len >= sizeof(struct setdig_parm))
  154. {
  155. //DEBUG_ERR(("===> oid_rt_pro_set_fw_dig_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf )));
  156. if(!rtw_setfwdig_cmd(Adapter,*((unsigned char*)poid_par_priv->information_buf )))
  157. {
  158. status = NDIS_STATUS_NOT_ACCEPTED;
  159. }
  160. }
  161. else{
  162. status = NDIS_STATUS_NOT_ACCEPTED;
  163. }
  164. _irqlevel_changed_(&oldirql,RAISE);
  165. _func_exit_;
  166. #endif
  167. return status;
  168. }
  169. //-----------------------------------------------------------------------------
  170. NDIS_STATUS oid_rt_pro_set_fw_ra_state_hdl(struct oid_par_priv* poid_par_priv)
  171. {
  172. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  173. #if 0
  174. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  175. _irqL oldirql;
  176. _func_enter_;
  177. if(poid_par_priv->type_of_oid != SET_OID)
  178. {
  179. status = NDIS_STATUS_NOT_ACCEPTED;
  180. return status;
  181. }
  182. _irqlevel_changed_(&oldirql,LOWER);
  183. if(poid_par_priv->information_buf_len >= sizeof(struct setra_parm))
  184. {
  185. //DEBUG_ERR(("===> oid_rt_pro_set_fw_ra_state_hdl. type:0x%02x.\n",*((unsigned char*)poid_par_priv->information_buf )));
  186. if(!rtw_setfwra_cmd(Adapter,*((unsigned char*)poid_par_priv->information_buf )))
  187. {
  188. status = NDIS_STATUS_NOT_ACCEPTED;
  189. }
  190. }
  191. else{
  192. status = NDIS_STATUS_NOT_ACCEPTED;
  193. }
  194. _irqlevel_changed_(&oldirql,RAISE);
  195. _func_exit_;
  196. #endif
  197. return status;
  198. }
  199. //-----------------------------------------------------------------------------
  200. NDIS_STATUS oid_rt_get_signal_quality_hdl(struct oid_par_priv* poid_par_priv)
  201. {
  202. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  203. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  204. //DEBUG_ERR(("<**********************oid_rt_get_signal_quality_hdl \n"));
  205. if(poid_par_priv->type_of_oid != QUERY_OID)
  206. {
  207. status = NDIS_STATUS_NOT_ACCEPTED;
  208. return status;
  209. }
  210. #if 0
  211. if(pMgntInfo->mAssoc || pMgntInfo->mIbss)
  212. {
  213. ulInfo = pAdapter->RxStats.SignalQuality;
  214. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  215. }
  216. else
  217. {
  218. ulInfo = 0xffffffff; // It stands for -1 in 4-byte integer.
  219. }
  220. break;
  221. #endif
  222. return status;
  223. }
  224. //------------------------------------------------------------------------------
  225. NDIS_STATUS oid_rt_get_small_packet_crc_hdl(struct oid_par_priv* poid_par_priv)
  226. {
  227. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  228. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  229. if(poid_par_priv->type_of_oid != QUERY_OID)
  230. {
  231. status = NDIS_STATUS_NOT_ACCEPTED;
  232. return status;
  233. }
  234. if(poid_par_priv->information_buf_len >= sizeof(ULONG) )
  235. {
  236. *(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_smallpacket_crcerr;
  237. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  238. }
  239. else
  240. {
  241. status = NDIS_STATUS_INVALID_LENGTH;
  242. }
  243. return status;
  244. }
  245. //------------------------------------------------------------------------------
  246. NDIS_STATUS oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv* poid_par_priv)
  247. {
  248. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  249. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  250. if(poid_par_priv->type_of_oid != QUERY_OID)
  251. {
  252. status = NDIS_STATUS_NOT_ACCEPTED;
  253. return status;
  254. }
  255. if(poid_par_priv->information_buf_len >= sizeof(ULONG) )
  256. {
  257. *(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_middlepacket_crcerr;
  258. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  259. }
  260. else
  261. {
  262. status = NDIS_STATUS_INVALID_LENGTH;
  263. }
  264. return status;
  265. }
  266. //------------------------------------------------------------------------------
  267. NDIS_STATUS oid_rt_get_large_packet_crc_hdl(struct oid_par_priv* poid_par_priv)
  268. {
  269. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  270. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  271. if(poid_par_priv->type_of_oid != QUERY_OID)
  272. {
  273. status = NDIS_STATUS_NOT_ACCEPTED;
  274. return status;
  275. }
  276. if(poid_par_priv->information_buf_len >= sizeof(ULONG) )
  277. {
  278. *(ULONG *)poid_par_priv->information_buf = padapter->recvpriv.rx_largepacket_crcerr;
  279. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  280. }
  281. else
  282. {
  283. status = NDIS_STATUS_INVALID_LENGTH;
  284. }
  285. return status;
  286. }
  287. //------------------------------------------------------------------------------
  288. NDIS_STATUS oid_rt_get_tx_retry_hdl(struct oid_par_priv* poid_par_priv)
  289. {
  290. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  291. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  292. if(poid_par_priv->type_of_oid != QUERY_OID)
  293. {
  294. status = NDIS_STATUS_NOT_ACCEPTED;
  295. return status;
  296. }
  297. return status;
  298. }
  299. NDIS_STATUS oid_rt_get_rx_retry_hdl(struct oid_par_priv* poid_par_priv)
  300. {
  301. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  302. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  303. if(poid_par_priv->type_of_oid != QUERY_OID)
  304. {
  305. status = NDIS_STATUS_NOT_ACCEPTED;
  306. return status;
  307. }
  308. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  309. return status;
  310. }
  311. //------------------------------------------------------------------------------
  312. NDIS_STATUS oid_rt_get_rx_total_packet_hdl(struct oid_par_priv* poid_par_priv)
  313. {
  314. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  315. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  316. if(poid_par_priv->type_of_oid != QUERY_OID)
  317. {
  318. status = NDIS_STATUS_NOT_ACCEPTED;
  319. return status;
  320. }
  321. if(poid_par_priv->information_buf_len >= sizeof(ULONG) )
  322. {
  323. *(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_pkts + padapter->recvpriv.rx_drop;
  324. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  325. }
  326. else
  327. {
  328. status = NDIS_STATUS_INVALID_LENGTH;
  329. }
  330. return status;
  331. }
  332. //------------------------------------------------------------------------------
  333. NDIS_STATUS oid_rt_get_tx_beacon_ok_hdl(struct oid_par_priv* poid_par_priv)
  334. {
  335. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  336. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  337. if(poid_par_priv->type_of_oid != QUERY_OID)
  338. {
  339. status = NDIS_STATUS_NOT_ACCEPTED;
  340. return status;
  341. }
  342. return status;
  343. }
  344. NDIS_STATUS oid_rt_get_tx_beacon_err_hdl(struct oid_par_priv* poid_par_priv)
  345. {
  346. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  347. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  348. if(poid_par_priv->type_of_oid != QUERY_OID)
  349. {
  350. status = NDIS_STATUS_NOT_ACCEPTED;
  351. return status;
  352. }
  353. return status;
  354. }
  355. //------------------------------------------------------------------------------
  356. NDIS_STATUS oid_rt_get_rx_icv_err_hdl(struct oid_par_priv* poid_par_priv)
  357. {
  358. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  359. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  360. if(poid_par_priv->type_of_oid != QUERY_OID)
  361. {
  362. status = NDIS_STATUS_NOT_ACCEPTED;
  363. return status;
  364. }
  365. if(poid_par_priv->information_buf_len>= sizeof(u32))
  366. {
  367. //_rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32));
  368. *(uint *)poid_par_priv->information_buf = padapter->recvpriv.rx_icv_err;
  369. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  370. }
  371. else
  372. {
  373. status = NDIS_STATUS_INVALID_LENGTH ;
  374. }
  375. return status;
  376. }
  377. //------------------------------------------------------------------------------
  378. NDIS_STATUS oid_rt_set_encryption_algorithm_hdl(struct oid_par_priv* poid_par_priv)
  379. {
  380. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  381. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  382. if(poid_par_priv->type_of_oid != SET_OID)
  383. {
  384. status = NDIS_STATUS_NOT_ACCEPTED;
  385. return status;
  386. }
  387. return status;
  388. }
  389. //------------------------------------------------------------------------------
  390. NDIS_STATUS oid_rt_get_preamble_mode_hdl(struct oid_par_priv* poid_par_priv)
  391. {
  392. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  393. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  394. ULONG preamblemode = 0 ;
  395. if(poid_par_priv->type_of_oid != QUERY_OID)
  396. {
  397. status = NDIS_STATUS_NOT_ACCEPTED;
  398. return status;
  399. }
  400. if(poid_par_priv->information_buf_len>= sizeof(ULONG))
  401. {
  402. if(padapter->registrypriv.preamble == PREAMBLE_LONG)
  403. preamblemode = 0;
  404. else if (padapter->registrypriv.preamble == PREAMBLE_AUTO)
  405. preamblemode = 1;
  406. else if (padapter->registrypriv.preamble == PREAMBLE_SHORT)
  407. preamblemode = 2;
  408. *(ULONG *)poid_par_priv->information_buf = preamblemode ;
  409. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  410. }
  411. else
  412. {
  413. status = NDIS_STATUS_INVALID_LENGTH ;
  414. }
  415. return status;
  416. }
  417. //------------------------------------------------------------------------------
  418. NDIS_STATUS oid_rt_get_ap_ip_hdl(struct oid_par_priv* poid_par_priv)
  419. {
  420. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  421. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  422. if(poid_par_priv->type_of_oid != QUERY_OID)
  423. {
  424. status = NDIS_STATUS_NOT_ACCEPTED;
  425. return status;
  426. }
  427. return status;
  428. }
  429. NDIS_STATUS oid_rt_get_channelplan_hdl(struct oid_par_priv* poid_par_priv)
  430. {
  431. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  432. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  433. struct eeprom_priv* peeprompriv = &padapter->eeprompriv;
  434. if(poid_par_priv->type_of_oid != QUERY_OID)
  435. {
  436. status = NDIS_STATUS_NOT_ACCEPTED;
  437. return status;
  438. }
  439. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  440. *(u16 *)poid_par_priv->information_buf = peeprompriv->channel_plan ;
  441. return status;
  442. }
  443. NDIS_STATUS oid_rt_set_channelplan_hdl(struct oid_par_priv* poid_par_priv)
  444. {
  445. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  446. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  447. struct eeprom_priv* peeprompriv = &padapter->eeprompriv;
  448. if(poid_par_priv->type_of_oid != SET_OID)
  449. {
  450. status = NDIS_STATUS_NOT_ACCEPTED;
  451. return status;
  452. }
  453. peeprompriv->channel_plan = *(u16 *)poid_par_priv->information_buf ;
  454. return status;
  455. }
  456. //------------------------------------------------------------------------------
  457. NDIS_STATUS oid_rt_set_preamble_mode_hdl(struct oid_par_priv* poid_par_priv)
  458. {
  459. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  460. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  461. ULONG preamblemode = 0;
  462. if(poid_par_priv->type_of_oid != SET_OID)
  463. {
  464. status = NDIS_STATUS_NOT_ACCEPTED;
  465. return status;
  466. }
  467. if(poid_par_priv->information_buf_len>= sizeof(ULONG))
  468. {
  469. preamblemode = *(ULONG *)poid_par_priv->information_buf ;
  470. if( preamblemode == 0)
  471. padapter->registrypriv.preamble = PREAMBLE_LONG;
  472. else if (preamblemode==1 )
  473. padapter->registrypriv.preamble = PREAMBLE_AUTO;
  474. else if ( preamblemode==2 )
  475. padapter->registrypriv.preamble = PREAMBLE_SHORT;
  476. *(ULONG *)poid_par_priv->information_buf = preamblemode ;
  477. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  478. }
  479. else
  480. {
  481. status = NDIS_STATUS_INVALID_LENGTH ;
  482. }
  483. return status;
  484. }
  485. //------------------------------------------------------------------------------
  486. NDIS_STATUS oid_rt_set_bcn_intvl_hdl(struct oid_par_priv* poid_par_priv)
  487. {
  488. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  489. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  490. if(poid_par_priv->type_of_oid != SET_OID)
  491. {
  492. status = NDIS_STATUS_NOT_ACCEPTED;
  493. return status;
  494. }
  495. return status;
  496. }
  497. NDIS_STATUS oid_rt_dedicate_probe_hdl(struct oid_par_priv* poid_par_priv)
  498. {
  499. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  500. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  501. return status;
  502. }
  503. //------------------------------------------------------------------------------
  504. NDIS_STATUS oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv* poid_par_priv)
  505. {
  506. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  507. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  508. if(poid_par_priv->type_of_oid != QUERY_OID)
  509. {
  510. status = NDIS_STATUS_NOT_ACCEPTED;
  511. return status;
  512. }
  513. if(poid_par_priv->information_buf_len>= sizeof(ULONG))
  514. {
  515. *(u64 *)poid_par_priv->information_buf = padapter->xmitpriv.tx_bytes;
  516. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  517. }
  518. else
  519. {
  520. status = NDIS_STATUS_INVALID_LENGTH ;
  521. }
  522. return status;
  523. }
  524. //------------------------------------------------------------------------------
  525. NDIS_STATUS oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv* poid_par_priv)
  526. {
  527. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  528. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  529. if(poid_par_priv->type_of_oid != QUERY_OID)
  530. {
  531. status = NDIS_STATUS_NOT_ACCEPTED;
  532. return status;
  533. }
  534. if(poid_par_priv->information_buf_len>= sizeof(ULONG))
  535. {
  536. //_rtw_memcpy(*(uint *)poid_par_priv->information_buf,padapter->recvpriv.rx_icv_err,sizeof(u32));
  537. *(u64 *)poid_par_priv->information_buf = padapter->recvpriv.rx_bytes;
  538. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  539. }
  540. else
  541. {
  542. status = NDIS_STATUS_INVALID_LENGTH ;
  543. }
  544. return status;
  545. }
  546. //------------------------------------------------------------------------------
  547. NDIS_STATUS oid_rt_current_tx_power_level_hdl(struct oid_par_priv* poid_par_priv)
  548. {
  549. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  550. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  551. return status;
  552. }
  553. NDIS_STATUS oid_rt_get_enc_key_mismatch_count_hdl(struct oid_par_priv* poid_par_priv)
  554. {
  555. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  556. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  557. if(poid_par_priv->type_of_oid != QUERY_OID)
  558. {
  559. status = NDIS_STATUS_NOT_ACCEPTED;
  560. return status;
  561. }
  562. return status;
  563. }
  564. NDIS_STATUS oid_rt_get_enc_key_match_count_hdl(struct oid_par_priv* poid_par_priv)
  565. {
  566. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  567. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  568. if(poid_par_priv->type_of_oid != QUERY_OID)
  569. {
  570. status = NDIS_STATUS_NOT_ACCEPTED;
  571. return status;
  572. }
  573. return status;
  574. }
  575. NDIS_STATUS oid_rt_get_channel_hdl(struct oid_par_priv* poid_par_priv)
  576. {
  577. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  578. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  579. struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
  580. NDIS_802_11_CONFIGURATION *pnic_Config;
  581. ULONG channelnum;
  582. _func_enter_;
  583. if(poid_par_priv->type_of_oid != QUERY_OID)
  584. {
  585. status = NDIS_STATUS_NOT_ACCEPTED;
  586. return status;
  587. }
  588. if ( (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) ||
  589. (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == _TRUE))
  590. pnic_Config = &pmlmepriv->cur_network.network.Configuration;
  591. else
  592. pnic_Config = &padapter->registrypriv.dev_network.Configuration;
  593. channelnum = pnic_Config->DSConfig;
  594. *(ULONG *)poid_par_priv->information_buf = channelnum;
  595. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  596. _func_exit_;
  597. return status;
  598. }
  599. NDIS_STATUS oid_rt_get_hardware_radio_off_hdl(struct oid_par_priv* poid_par_priv)
  600. {
  601. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  602. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  603. if(poid_par_priv->type_of_oid != QUERY_OID)
  604. {
  605. status = NDIS_STATUS_NOT_ACCEPTED;
  606. return status;
  607. }
  608. return status;
  609. }
  610. NDIS_STATUS oid_rt_get_key_mismatch_hdl(struct oid_par_priv* poid_par_priv)
  611. {
  612. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  613. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  614. if(poid_par_priv->type_of_oid != QUERY_OID)
  615. {
  616. status = NDIS_STATUS_NOT_ACCEPTED;
  617. return status;
  618. }
  619. return status;
  620. }
  621. NDIS_STATUS oid_rt_supported_wireless_mode_hdl(struct oid_par_priv* poid_par_priv)
  622. {
  623. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  624. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  625. ULONG ulInfo = 0 ;
  626. //DEBUG_ERR(("<**********************oid_rt_supported_wireless_mode_hdl \n"));
  627. if(poid_par_priv->type_of_oid != QUERY_OID)
  628. {
  629. status = NDIS_STATUS_NOT_ACCEPTED;
  630. return status;
  631. }
  632. if(poid_par_priv->information_buf_len >= sizeof(ULONG)){
  633. ulInfo |= 0x0100; //WIRELESS_MODE_B
  634. ulInfo |= 0x0200; //WIRELESS_MODE_G
  635. ulInfo |= 0x0400; //WIRELESS_MODE_A
  636. *(ULONG *) poid_par_priv->information_buf = ulInfo;
  637. //DEBUG_ERR(("<===oid_rt_supported_wireless_mode %x\n",ulInfo));
  638. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  639. }
  640. else{
  641. status = NDIS_STATUS_INVALID_LENGTH;
  642. }
  643. return status;
  644. }
  645. NDIS_STATUS oid_rt_get_channel_list_hdl(struct oid_par_priv* poid_par_priv)
  646. {
  647. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  648. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  649. if(poid_par_priv->type_of_oid != QUERY_OID)
  650. {
  651. status = NDIS_STATUS_NOT_ACCEPTED;
  652. return status;
  653. }
  654. return status;
  655. }
  656. NDIS_STATUS oid_rt_get_scan_in_progress_hdl(struct oid_par_priv* poid_par_priv)
  657. {
  658. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  659. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  660. if(poid_par_priv->type_of_oid != QUERY_OID)
  661. {
  662. status = NDIS_STATUS_NOT_ACCEPTED;
  663. return status;
  664. }
  665. return status;
  666. }
  667. NDIS_STATUS oid_rt_forced_data_rate_hdl(struct oid_par_priv* poid_par_priv)
  668. {
  669. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  670. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  671. return status;
  672. }
  673. NDIS_STATUS oid_rt_wireless_mode_for_scan_list_hdl(struct oid_par_priv* poid_par_priv)
  674. {
  675. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  676. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  677. return status;
  678. }
  679. NDIS_STATUS oid_rt_get_bss_wireless_mode_hdl(struct oid_par_priv* poid_par_priv)
  680. {
  681. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  682. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  683. if(poid_par_priv->type_of_oid != QUERY_OID)
  684. {
  685. status = NDIS_STATUS_NOT_ACCEPTED;
  686. return status;
  687. }
  688. return status;
  689. }
  690. NDIS_STATUS oid_rt_scan_with_magic_packet_hdl(struct oid_par_priv* poid_par_priv)
  691. {
  692. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  693. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  694. return status;
  695. }
  696. //************** oid_rtl_seg_01_01 section end **************
  697. //************** oid_rtl_seg_01_03 section start **************
  698. NDIS_STATUS oid_rt_ap_get_associated_station_list_hdl(struct oid_par_priv* poid_par_priv)
  699. {
  700. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  701. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  702. if(poid_par_priv->type_of_oid != QUERY_OID)
  703. {
  704. status = NDIS_STATUS_NOT_ACCEPTED;
  705. return status;
  706. }
  707. return status;
  708. }
  709. NDIS_STATUS oid_rt_ap_switch_into_ap_mode_hdl(struct oid_par_priv* poid_par_priv)
  710. {
  711. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  712. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  713. return status;
  714. }
  715. NDIS_STATUS oid_rt_ap_supported_hdl(struct oid_par_priv* poid_par_priv)
  716. {
  717. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  718. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  719. return status;
  720. }
  721. NDIS_STATUS oid_rt_ap_set_passphrase_hdl(struct oid_par_priv* poid_par_priv)
  722. {
  723. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  724. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  725. if(poid_par_priv->type_of_oid != SET_OID)
  726. {
  727. status = NDIS_STATUS_NOT_ACCEPTED;
  728. return status;
  729. }
  730. return status;
  731. }
  732. //************** oid_rtl_seg_01_03 section end **************
  733. //**************** oid_rtl_seg_01_11 section start ****************
  734. NDIS_STATUS oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv* poid_par_priv)
  735. {
  736. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  737. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  738. _irqL oldirql;
  739. _func_enter_;
  740. //DEBUG_ERR(("<**********************oid_rt_pro_rf_write_registry_hdl \n"));
  741. if(poid_par_priv->type_of_oid != SET_OID) //QUERY_OID
  742. {
  743. status = NDIS_STATUS_NOT_ACCEPTED;
  744. return status;
  745. }
  746. _irqlevel_changed_(&oldirql,LOWER);
  747. if(poid_par_priv->information_buf_len== (sizeof(unsigned long)*3))
  748. {
  749. //RegOffsetValue - The offset of RF register to write.
  750. //RegDataWidth - The data width of RF register to write.
  751. //RegDataValue - The value to write.
  752. //RegOffsetValue = *((unsigned long*)InformationBuffer);
  753. //RegDataWidth = *((unsigned long*)InformationBuffer+1);
  754. //RegDataValue = *((unsigned long*)InformationBuffer+2);
  755. if(!rtw_setrfreg_cmd(Adapter,
  756. *(unsigned char*)poid_par_priv->information_buf,
  757. (unsigned long)(*((unsigned long*)poid_par_priv->information_buf+2))))
  758. {
  759. status = NDIS_STATUS_NOT_ACCEPTED;
  760. }
  761. }
  762. else{
  763. status = NDIS_STATUS_INVALID_LENGTH;
  764. }
  765. _irqlevel_changed_(&oldirql,RAISE);
  766. _func_exit_;
  767. return status;
  768. }
  769. //------------------------------------------------------------------------------
  770. NDIS_STATUS oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv* poid_par_priv)
  771. {
  772. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  773. #if 0
  774. PADAPTER Adapter = (PADAPTER)(poid_par_priv->adapter_context);
  775. _irqL oldirql;
  776. _func_enter_;
  777. //DEBUG_ERR(("<**********************oid_rt_pro_rf_read_registry_hdl \n"));
  778. if(poid_par_priv->type_of_oid != SET_OID) //QUERY_OID
  779. {
  780. status = NDIS_STATUS_NOT_ACCEPTED;
  781. return status;
  782. }
  783. _irqlevel_changed_(&oldirql,LOWER);
  784. if(poid_par_priv->information_buf_len== (sizeof(unsigned long)*3))
  785. {
  786. if(Adapter->mppriv.act_in_progress == _TRUE)
  787. {
  788. status = NDIS_STATUS_NOT_ACCEPTED;
  789. }
  790. else
  791. {
  792. //init workparam
  793. Adapter->mppriv.act_in_progress = _TRUE;
  794. Adapter->mppriv.workparam.bcompleted= _FALSE;
  795. Adapter->mppriv.workparam.act_type = MPT_READ_RF;
  796. Adapter->mppriv.workparam.io_offset = *(unsigned long*)poid_par_priv->information_buf;
  797. Adapter->mppriv.workparam.io_value = 0xcccccccc;
  798. //RegOffsetValue - The offset of RF register to read.
  799. //RegDataWidth - The data width of RF register to read.
  800. //RegDataValue - The value to read.
  801. //RegOffsetValue = *((unsigned long*)InformationBuffer);
  802. //RegDataWidth = *((unsigned long*)InformationBuffer+1);
  803. //RegDataValue = *((unsigned long*)InformationBuffer+2);
  804. if(!rtw_getrfreg_cmd(Adapter,
  805. *(unsigned char*)poid_par_priv->information_buf,
  806. (unsigned char*)&Adapter->mppriv.workparam.io_value))
  807. {
  808. status = NDIS_STATUS_NOT_ACCEPTED;
  809. }
  810. }
  811. }
  812. else {
  813. status = NDIS_STATUS_INVALID_LENGTH;
  814. }
  815. _irqlevel_changed_(&oldirql,RAISE);
  816. _func_exit_;
  817. #endif
  818. return status;
  819. }
  820. //**************** oid_rtl_seg_01_11 section end****************
  821. //************** oid_rtl_seg_03_00 section start **************
  822. enum _CONNECT_STATE_{
  823. CHECKINGSTATUS,
  824. ASSOCIATED,
  825. ADHOCMODE,
  826. NOTASSOCIATED
  827. };
  828. NDIS_STATUS oid_rt_get_connect_state_hdl(struct oid_par_priv* poid_par_priv)
  829. {
  830. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  831. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  832. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  833. ULONG ulInfo;
  834. if(poid_par_priv->type_of_oid != QUERY_OID)
  835. {
  836. status = NDIS_STATUS_NOT_ACCEPTED;
  837. return status;
  838. }
  839. // nStatus==0 CheckingStatus
  840. // nStatus==1 Associated
  841. // nStatus==2 AdHocMode
  842. // nStatus==3 NotAssociated
  843. if(check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == _TRUE)
  844. ulInfo = CHECKINGSTATUS;
  845. else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
  846. ulInfo = ASSOCIATED;
  847. else if(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)== _TRUE)
  848. ulInfo = ADHOCMODE;
  849. else
  850. ulInfo = NOTASSOCIATED ;
  851. *(ULONG *)poid_par_priv->information_buf = ulInfo;
  852. *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
  853. #if 0
  854. // Rearrange the order to let the UI still shows connection when scan is in progress
  855. RT_TRACE(COMP_OID_QUERY, DBG_LOUD, ("===> Query OID_RT_GET_CONNECT_STATE.\n"));
  856. if(pMgntInfo->mAssoc)
  857. ulInfo = 1;
  858. else if(pMgntInfo->mIbss)
  859. ulInfo = 2;
  860. else if(pMgntInfo->bScanInProgress)
  861. ulInfo = 0;
  862. else
  863. ulInfo = 3;
  864. ulInfoLen = sizeof(ULONG);
  865. RT_TRACE(COMP_OID_QUERY, DBG_LOUD, ("<=== Query OID_RT_GET_CONNECT_STATE: %d\n", ulInfo));
  866. #endif
  867. return status;
  868. }
  869. NDIS_STATUS oid_rt_set_default_key_id_hdl(struct oid_par_priv* poid_par_priv)
  870. {
  871. NDIS_STATUS status = NDIS_STATUS_SUCCESS;
  872. PADAPTER padapter = (PADAPTER)(poid_par_priv->adapter_context);
  873. if(poid_par_priv->type_of_oid != SET_OID)
  874. {
  875. status = NDIS_STATUS_NOT_ACCEPTED;
  876. return status;
  877. }
  878. return status;
  879. }
  880. //************** oid_rtl_seg_03_00 section end **************