rtw_ioctl.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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_IOCTL_H_
  21. #define _RTW_IOCTL_H_
  22. #ifndef PLATFORM_WINDOWS
  23. // 00 - Success
  24. // 11 - Error
  25. #define STATUS_SUCCESS (0x00000000L)
  26. #define STATUS_PENDING (0x00000103L)
  27. #define STATUS_UNSUCCESSFUL (0xC0000001L)
  28. #define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
  29. #define STATUS_NOT_SUPPORTED (0xC00000BBL)
  30. #define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS)
  31. #define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING)
  32. #define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L)
  33. #define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L)
  34. #define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L)
  35. #define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L)
  36. #define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL)
  37. #define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
  38. #define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L)
  39. #define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)
  40. #define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L)
  41. #define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L)
  42. #define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L)
  43. #define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L)
  44. #define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L)
  45. #define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL)
  46. #define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL)
  47. #define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL)
  48. #define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL)
  49. #define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL)
  50. #define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED)
  51. #define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL)
  52. #define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L)
  53. #define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L)
  54. #define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L)
  55. #define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L)
  56. #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
  57. #define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L)
  58. #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
  59. #define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L)
  60. #define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L)
  61. #define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L)
  62. #define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL)
  63. #define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL)
  64. #define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL)
  65. #define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL)
  66. #define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL)
  67. #define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL)
  68. #define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L)
  69. #define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L)
  70. #define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L)
  71. #define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L)
  72. #define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L) // cause 27
  73. #define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L) // cause 35,45
  74. #define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L) // cause 37
  75. #define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L) // cause 49
  76. #define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L) // cause 93
  77. #define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L) // cause 3
  78. #endif /* #ifndef PLATFORM_WINDOWS */
  79. #ifndef OID_802_11_CAPABILITY
  80. #define OID_802_11_CAPABILITY 0x0d010122
  81. #endif
  82. #ifndef OID_802_11_PMKID
  83. #define OID_802_11_PMKID 0x0d010123
  84. #endif
  85. // For DDK-defined OIDs
  86. #define OID_NDIS_SEG1 0x00010100
  87. #define OID_NDIS_SEG2 0x00010200
  88. #define OID_NDIS_SEG3 0x00020100
  89. #define OID_NDIS_SEG4 0x01010100
  90. #define OID_NDIS_SEG5 0x01020100
  91. #define OID_NDIS_SEG6 0x01020200
  92. #define OID_NDIS_SEG7 0xFD010100
  93. #define OID_NDIS_SEG8 0x0D010100
  94. #define OID_NDIS_SEG9 0x0D010200
  95. #define OID_NDIS_SEG10 0x0D020200
  96. #define SZ_OID_NDIS_SEG1 23
  97. #define SZ_OID_NDIS_SEG2 3
  98. #define SZ_OID_NDIS_SEG3 6
  99. #define SZ_OID_NDIS_SEG4 6
  100. #define SZ_OID_NDIS_SEG5 4
  101. #define SZ_OID_NDIS_SEG6 8
  102. #define SZ_OID_NDIS_SEG7 7
  103. #define SZ_OID_NDIS_SEG8 36
  104. #define SZ_OID_NDIS_SEG9 24
  105. #define SZ_OID_NDIS_SEG10 19
  106. // For Realtek-defined OIDs
  107. #define OID_MP_SEG1 0xFF871100
  108. #define OID_MP_SEG2 0xFF818000
  109. #define OID_MP_SEG3 0xFF818700
  110. #define OID_MP_SEG4 0xFF011100
  111. #define DEBUG_OID(dbg, str) \
  112. if((!dbg)) \
  113. { \
  114. RT_TRACE(_module_rtl871x_ioctl_c_,_drv_info_,("%s(%d): %s", __FUNCTION__, __LINE__, str)); \
  115. }
  116. enum oid_type
  117. {
  118. QUERY_OID,
  119. SET_OID
  120. };
  121. struct oid_funs_node {
  122. unsigned int oid_start; //the starting number for OID
  123. unsigned int oid_end; //the ending number for OID
  124. struct oid_obj_priv *node_array;
  125. unsigned int array_sz; //the size of node_array
  126. int query_counter; //count the number of query hits for this segment
  127. int set_counter; //count the number of set hits for this segment
  128. };
  129. struct oid_par_priv
  130. {
  131. void *adapter_context;
  132. NDIS_OID oid;
  133. void *information_buf;
  134. u32 information_buf_len;
  135. u32 *bytes_rw;
  136. u32 *bytes_needed;
  137. enum oid_type type_of_oid;
  138. u32 dbg;
  139. };
  140. struct oid_obj_priv {
  141. unsigned char dbg; // 0: without OID debug message 1: with OID debug message
  142. NDIS_STATUS (*oidfuns)(struct oid_par_priv *poid_par_priv);
  143. };
  144. #if (defined(CONFIG_MP_INCLUDED) && defined(_RTW_MP_IOCTL_C_)) || \
  145. (defined(PLATFORM_WINDOWS) && defined(_RTW_IOCTL_RTL_C_))
  146. static NDIS_STATUS oid_null_function(struct oid_par_priv* poid_par_priv)
  147. {
  148. _func_enter_;
  149. _func_exit_;
  150. return NDIS_STATUS_SUCCESS;
  151. }
  152. #endif
  153. #ifdef PLATFORM_WINDOWS
  154. int TranslateNdisPsToRtPs(IN NDIS_802_11_POWER_MODE ndisPsMode);
  155. //OID Handler for Segment 1
  156. NDIS_STATUS oid_gen_supported_list_hdl(struct oid_par_priv* poid_par_priv);
  157. NDIS_STATUS oid_gen_hardware_status_hdl(struct oid_par_priv* poid_par_priv);
  158. NDIS_STATUS oid_gen_media_supported_hdl(struct oid_par_priv* poid_par_priv);
  159. NDIS_STATUS oid_gen_media_in_use_hdl(struct oid_par_priv* poid_par_priv);
  160. NDIS_STATUS oid_gen_maximum_lookahead_hdl(struct oid_par_priv* poid_par_priv);
  161. NDIS_STATUS oid_gen_maximum_frame_size_hdl(struct oid_par_priv* poid_par_priv);
  162. NDIS_STATUS oid_gen_link_speed_hdl(struct oid_par_priv* poid_par_priv);
  163. NDIS_STATUS oid_gen_transmit_buffer_space_hdl(struct oid_par_priv* poid_par_priv);
  164. NDIS_STATUS oid_gen_receive_buffer_space_hdl(struct oid_par_priv* poid_par_priv);
  165. NDIS_STATUS oid_gen_transmit_block_size_hdl(struct oid_par_priv* poid_par_priv);
  166. NDIS_STATUS oid_gen_receive_block_size_hdl(struct oid_par_priv* poid_par_priv);
  167. NDIS_STATUS oid_gen_vendor_id_hdl(struct oid_par_priv* poid_par_priv);
  168. NDIS_STATUS oid_gen_vendor_description_hdl(struct oid_par_priv* poid_par_priv);
  169. NDIS_STATUS oid_gen_current_packet_filter_hdl(struct oid_par_priv* poid_par_priv);
  170. NDIS_STATUS oid_gen_current_lookahead_hdl(struct oid_par_priv* poid_par_priv);
  171. NDIS_STATUS oid_gen_driver_version_hdl(struct oid_par_priv* poid_par_priv);
  172. NDIS_STATUS oid_gen_maximum_total_size_hdl(struct oid_par_priv* poid_par_priv);
  173. NDIS_STATUS oid_gen_protocol_options_hdl(struct oid_par_priv* poid_par_priv);
  174. NDIS_STATUS oid_gen_mac_options_hdl(struct oid_par_priv* poid_par_priv);
  175. NDIS_STATUS oid_gen_media_connect_status_hdl(struct oid_par_priv* poid_par_priv);
  176. NDIS_STATUS oid_gen_maximum_send_packets_hdl(struct oid_par_priv* poid_par_priv);
  177. NDIS_STATUS oid_gen_vendor_driver_version_hdl(struct oid_par_priv* poid_par_priv);
  178. //OID Handler for Segment 2
  179. NDIS_STATUS oid_gen_physical_medium_hdl(struct oid_par_priv* poid_par_priv);
  180. //OID Handler for Segment 3
  181. NDIS_STATUS oid_gen_xmit_ok_hdl(struct oid_par_priv* poid_par_priv);
  182. NDIS_STATUS oid_gen_rcv_ok_hdl(struct oid_par_priv* poid_par_priv);
  183. NDIS_STATUS oid_gen_xmit_error_hdl(struct oid_par_priv* poid_par_priv);
  184. NDIS_STATUS oid_gen_rcv_error_hdl(struct oid_par_priv* poid_par_priv);
  185. NDIS_STATUS oid_gen_rcv_no_buffer_hdl(struct oid_par_priv* poid_par_priv);
  186. //OID Handler for Segment 4
  187. NDIS_STATUS oid_802_3_permanent_address_hdl(struct oid_par_priv* poid_par_priv);
  188. NDIS_STATUS oid_802_3_current_address_hdl(struct oid_par_priv* poid_par_priv);
  189. NDIS_STATUS oid_802_3_multicast_list_hdl(struct oid_par_priv* poid_par_priv);
  190. NDIS_STATUS oid_802_3_maximum_list_size_hdl(struct oid_par_priv* poid_par_priv);
  191. NDIS_STATUS oid_802_3_mac_options_hdl(struct oid_par_priv* poid_par_priv);
  192. //OID Handler for Segment 5
  193. NDIS_STATUS oid_802_3_rcv_error_alignment_hdl(struct oid_par_priv* poid_par_priv);
  194. NDIS_STATUS oid_802_3_xmit_one_collision_hdl(struct oid_par_priv* poid_par_priv);
  195. NDIS_STATUS oid_802_3_xmit_more_collisions_hdl(struct oid_par_priv* poid_par_priv);
  196. //OID Handler for Segment 6
  197. NDIS_STATUS oid_802_3_xmit_deferred_hdl(struct oid_par_priv* poid_par_priv);
  198. NDIS_STATUS oid_802_3_xmit_max_collisions_hdl(struct oid_par_priv* poid_par_priv);
  199. NDIS_STATUS oid_802_3_rcv_overrun_hdl(struct oid_par_priv* poid_par_priv);
  200. NDIS_STATUS oid_802_3_xmit_underrun_hdl(struct oid_par_priv* poid_par_priv);
  201. NDIS_STATUS oid_802_3_xmit_heartbeat_failure_hdl(struct oid_par_priv* poid_par_priv);
  202. NDIS_STATUS oid_802_3_xmit_times_crs_lost_hdl(struct oid_par_priv* poid_par_priv);
  203. NDIS_STATUS oid_802_3_xmit_late_collisions_hdl(struct oid_par_priv* poid_par_priv);
  204. //OID Handler for Segment 7
  205. NDIS_STATUS oid_pnp_capabilities_hdl(struct oid_par_priv* poid_par_priv);
  206. NDIS_STATUS oid_pnp_set_power_hdl(struct oid_par_priv* poid_par_priv);
  207. NDIS_STATUS oid_pnp_query_power_hdl(struct oid_par_priv* poid_par_priv);
  208. NDIS_STATUS oid_pnp_add_wake_up_pattern_hdl(struct oid_par_priv* poid_par_priv);
  209. NDIS_STATUS oid_pnp_remove_wake_up_pattern_hdl(struct oid_par_priv* poid_par_priv);
  210. NDIS_STATUS oid_pnp_wake_up_pattern_list_hdl(struct oid_par_priv* poid_par_priv);
  211. NDIS_STATUS oid_pnp_enable_wake_up_hdl(struct oid_par_priv* poid_par_priv);
  212. //OID Handler for Segment 8
  213. NDIS_STATUS oid_802_11_bssid_hdl(struct oid_par_priv* poid_par_priv);
  214. NDIS_STATUS oid_802_11_ssid_hdl(struct oid_par_priv* poid_par_priv);
  215. NDIS_STATUS oid_802_11_infrastructure_mode_hdl(struct oid_par_priv* poid_par_priv);
  216. NDIS_STATUS oid_802_11_add_wep_hdl(struct oid_par_priv* poid_par_priv);
  217. NDIS_STATUS oid_802_11_remove_wep_hdl(struct oid_par_priv* poid_par_priv);
  218. NDIS_STATUS oid_802_11_disassociate_hdl(struct oid_par_priv* poid_par_priv);
  219. NDIS_STATUS oid_802_11_authentication_mode_hdl(struct oid_par_priv* poid_par_priv);
  220. NDIS_STATUS oid_802_11_privacy_filter_hdl(struct oid_par_priv* poid_par_priv);
  221. NDIS_STATUS oid_802_11_bssid_list_scan_hdl(struct oid_par_priv* poid_par_priv);
  222. NDIS_STATUS oid_802_11_encryption_status_hdl(struct oid_par_priv* poid_par_priv);
  223. NDIS_STATUS oid_802_11_reload_defaults_hdl(struct oid_par_priv* poid_par_priv);
  224. NDIS_STATUS oid_802_11_add_key_hdl(struct oid_par_priv* poid_par_priv);
  225. NDIS_STATUS oid_802_11_remove_key_hdl(struct oid_par_priv* poid_par_priv);
  226. NDIS_STATUS oid_802_11_association_information_hdl(struct oid_par_priv* poid_par_priv);
  227. NDIS_STATUS oid_802_11_test_hdl(struct oid_par_priv* poid_par_priv);
  228. NDIS_STATUS oid_802_11_media_stream_mode_hdl(struct oid_par_priv* poid_par_priv);
  229. NDIS_STATUS oid_802_11_capability_hdl(struct oid_par_priv* poid_par_priv);
  230. NDIS_STATUS oid_802_11_pmkid_hdl(struct oid_par_priv* poid_par_priv);
  231. //OID Handler for Segment 9
  232. NDIS_STATUS oid_802_11_network_types_supported_hdl(struct oid_par_priv* poid_par_priv);
  233. NDIS_STATUS oid_802_11_network_type_in_use_hdl(struct oid_par_priv* poid_par_priv);
  234. NDIS_STATUS oid_802_11_tx_power_level_hdl(struct oid_par_priv* poid_par_priv);
  235. NDIS_STATUS oid_802_11_rssi_hdl(struct oid_par_priv* poid_par_priv);
  236. NDIS_STATUS oid_802_11_rssi_trigger_hdl(struct oid_par_priv* poid_par_priv);
  237. NDIS_STATUS oid_802_11_fragmentation_threshold_hdl(struct oid_par_priv* poid_par_priv);
  238. NDIS_STATUS oid_802_11_rts_threshold_hdl(struct oid_par_priv* poid_par_priv);
  239. NDIS_STATUS oid_802_11_number_of_antennas_hdl(struct oid_par_priv* poid_par_priv);
  240. NDIS_STATUS oid_802_11_rx_antenna_selected_hdl(struct oid_par_priv* poid_par_priv);
  241. NDIS_STATUS oid_802_11_tx_antenna_selected_hdl(struct oid_par_priv* poid_par_priv);
  242. NDIS_STATUS oid_802_11_supported_rates_hdl(struct oid_par_priv* poid_par_priv);
  243. NDIS_STATUS oid_802_11_desired_rates_hdl(struct oid_par_priv* poid_par_priv);
  244. NDIS_STATUS oid_802_11_configuration_hdl(struct oid_par_priv* poid_par_priv);
  245. NDIS_STATUS oid_802_11_power_mode_hdl(struct oid_par_priv* poid_par_priv);
  246. NDIS_STATUS oid_802_11_bssid_list_hdl(struct oid_par_priv* poid_par_priv);
  247. //OID Handler for Segment 10
  248. NDIS_STATUS oid_802_11_statistics_hdl(struct oid_par_priv* poid_par_priv);
  249. //OID Handler for Segment ED
  250. NDIS_STATUS oid_rt_mh_vender_id_hdl(struct oid_par_priv* poid_par_priv);
  251. void Set_802_3_MULTICAST_LIST(ADAPTER *pAdapter, UCHAR *MCListbuf, ULONG MCListlen, BOOLEAN bAcceptAllMulticast);
  252. #endif// end of PLATFORM_WINDOWS
  253. #if defined(PLATFORM_LINUX) && defined(CONFIG_WIRELESS_EXT)
  254. extern struct iw_handler_def rtw_handlers_def;
  255. #endif
  256. extern void rtw_request_wps_pbc_event(_adapter *padapter);
  257. extern NDIS_STATUS drv_query_info(
  258. IN _nic_hdl MiniportAdapterContext,
  259. IN NDIS_OID Oid,
  260. IN void * InformationBuffer,
  261. IN u32 InformationBufferLength,
  262. OUT u32* BytesWritten,
  263. OUT u32* BytesNeeded
  264. );
  265. extern NDIS_STATUS drv_set_info(
  266. IN _nic_hdl MiniportAdapterContext,
  267. IN NDIS_OID Oid,
  268. IN void * InformationBuffer,
  269. IN u32 InformationBufferLength,
  270. OUT u32* BytesRead,
  271. OUT u32* BytesNeeded
  272. );
  273. #endif // #ifndef __INC_CEINFO_