PageRenderTime 104ms CodeModel.GetById 40ms RepoModel.GetById 2ms app.codeStats 1ms

/drivers/staging/wlags49_h2/wl_main.c

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C | 3870 lines | 2275 code | 523 blank | 1072 comment | 351 complexity | c3bd0e383eb30eee9671e4ec54fcf7cc MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*******************************************************************************
  2. * Agere Systems Inc.
  3. * Wireless device driver for Linux (wlags49).
  4. *
  5. * Copyright (c) 1998-2003 Agere Systems Inc.
  6. * All rights reserved.
  7. * http://www.agere.com
  8. *
  9. * Initially developed by TriplePoint, Inc.
  10. * http://www.triplepoint.com
  11. *
  12. *------------------------------------------------------------------------------
  13. *
  14. * This file contains the main driver entry points and other adapter
  15. * specific routines.
  16. *
  17. *------------------------------------------------------------------------------
  18. *
  19. * SOFTWARE LICENSE
  20. *
  21. * This software is provided subject to the following terms and conditions,
  22. * which you should read carefully before using the software. Using this
  23. * software indicates your acceptance of these terms and conditions. If you do
  24. * not agree with these terms and conditions, do not use the software.
  25. *
  26. * Copyright © 2003 Agere Systems Inc.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source or binary forms, with or without
  30. * modifications, are permitted provided that the following conditions are met:
  31. *
  32. * . Redistributions of source code must retain the above copyright notice, this
  33. * list of conditions and the following Disclaimer as comments in the code as
  34. * well as in the documentation and/or other materials provided with the
  35. * distribution.
  36. *
  37. * . Redistributions in binary form must reproduce the above copyright notice,
  38. * this list of conditions and the following Disclaimer in the documentation
  39. * and/or other materials provided with the distribution.
  40. *
  41. * . Neither the name of Agere Systems Inc. nor the names of the contributors
  42. * may be used to endorse or promote products derived from this software
  43. * without specific prior written permission.
  44. *
  45. * Disclaimer
  46. *
  47. * THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
  48. * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
  49. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
  50. * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
  51. * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
  52. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  53. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  54. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  55. * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
  56. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  57. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  58. * DAMAGE.
  59. *
  60. ******************************************************************************/
  61. /*******************************************************************************
  62. * constant definitions
  63. ******************************************************************************/
  64. /* Allow support for calling system fcns to access F/W iamge file */
  65. #define __KERNEL_SYSCALLS__
  66. /*******************************************************************************
  67. * include files
  68. ******************************************************************************/
  69. #include <wl_version.h>
  70. #include <linux/module.h>
  71. #include <linux/proc_fs.h>
  72. #include <linux/types.h>
  73. #include <linux/kernel.h>
  74. // #include <linux/sched.h>
  75. // #include <linux/ptrace.h>
  76. // #include <linux/slab.h>
  77. // #include <linux/ctype.h>
  78. // #include <linux/string.h>
  79. // #include <linux/timer.h>
  80. //#include <linux/interrupt.h>
  81. // #include <linux/tqueue.h>
  82. // #include <linux/in.h>
  83. // #include <linux/delay.h>
  84. // #include <asm/io.h>
  85. // #include <asm/system.h>
  86. // #include <asm/bitops.h>
  87. #include <linux/unistd.h>
  88. #include <asm/uaccess.h>
  89. #include <linux/netdevice.h>
  90. #include <linux/etherdevice.h>
  91. // #include <linux/skbuff.h>
  92. // #include <linux/if_arp.h>
  93. // #include <linux/ioport.h>
  94. #define BIN_DL 0
  95. #if BIN_DL
  96. #include <linux/vmalloc.h>
  97. #endif // BIN_DL
  98. #include <debug.h>
  99. #include <hcf.h>
  100. #include <dhf.h>
  101. //in order to get around:: wl_main.c:2229: `HREG_EV_RDMAD' undeclared (first use in this function)
  102. #include <hcfdef.h>
  103. #include <wl_if.h>
  104. #include <wl_internal.h>
  105. #include <wl_util.h>
  106. #include <wl_main.h>
  107. #include <wl_netdev.h>
  108. #include <wl_wext.h>
  109. #ifdef USE_PROFILE
  110. #include <wl_profile.h>
  111. #endif /* USE_PROFILE */
  112. #ifdef BUS_PCMCIA
  113. #include <wl_cs.h>
  114. #endif /* BUS_PCMCIA */
  115. #ifdef BUS_PCI
  116. #include <wl_pci.h>
  117. #endif /* BUS_PCI */
  118. /*******************************************************************************
  119. * macro defintions
  120. ******************************************************************************/
  121. #define VALID_PARAM(C) \
  122. { \
  123. if (!(C)) \
  124. { \
  125. printk(KERN_INFO "Wireless, parameter error: \"%s\"\n", #C); \
  126. goto failed; \
  127. } \
  128. }
  129. /*******************************************************************************
  130. * local functions
  131. ******************************************************************************/
  132. void wl_isr_handler( unsigned long p );
  133. #if 0 //SCULL_USE_PROC /* don't waste space if unused */
  134. //int scull_read_procmem(char *buf, char **start, off_t offset, int len, int unused);
  135. int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, void *data );
  136. static int write_int(struct file *file, const char *buffer, unsigned long count, void *data);
  137. static void proc_write(const char *name, write_proc_t *w, void *data);
  138. #endif /* SCULL_USE_PROC */
  139. /*******************************************************************************
  140. * module parameter definitions - set with 'insmod'
  141. ******************************************************************************/
  142. static p_u16 irq_mask = 0xdeb8; // IRQ3,4,5,7,9,10,11,12,14,15
  143. static p_s8 irq_list[4] = { -1 };
  144. #if 0
  145. MODULE_PARM(irq_mask, "h");
  146. MODULE_PARM_DESC(irq_mask, "IRQ mask [0xdeb8]");
  147. MODULE_PARM(irq_list, "1-4b");
  148. MODULE_PARM_DESC(irq_list, "IRQ list [<irq_mask>]");
  149. #endif
  150. static p_u8 PARM_AUTHENTICATION = PARM_DEFAULT_AUTHENTICATION;
  151. static p_u16 PARM_AUTH_KEY_MGMT_SUITE = PARM_DEFAULT_AUTH_KEY_MGMT_SUITE;
  152. static p_u16 PARM_BRSC_2GHZ = PARM_DEFAULT_BRSC_2GHZ;
  153. static p_u16 PARM_BRSC_5GHZ = PARM_DEFAULT_BRSC_5GHZ;
  154. static p_u16 PARM_COEXISTENCE = PARM_DEFAULT_COEXISTENCE;
  155. static p_u16 PARM_CONNECTION_CONTROL = PARM_DEFAULT_CONNECTION_CONTROL; //;?rename and move
  156. static p_char *PARM_CREATE_IBSS = PARM_DEFAULT_CREATE_IBSS_STR;
  157. static p_char *PARM_DESIRED_SSID = PARM_DEFAULT_SSID;
  158. static p_char *PARM_DOWNLOAD_FIRMWARE = "";
  159. static p_u16 PARM_ENABLE_ENCRYPTION = PARM_DEFAULT_ENABLE_ENCRYPTION;
  160. static p_char *PARM_EXCLUDE_UNENCRYPTED = PARM_DEFAULT_EXCLUDE_UNENCRYPTED_STR;
  161. static p_char *PARM_INTRA_BSS_RELAY = PARM_DEFAULT_INTRA_BSS_RELAY_STR;
  162. static p_char *PARM_KEY1 = "";
  163. static p_char *PARM_KEY2 = "";
  164. static p_char *PARM_KEY3 = "";
  165. static p_char *PARM_KEY4 = "";
  166. static p_char *PARM_LOAD_BALANCING = PARM_DEFAULT_LOAD_BALANCING_STR;
  167. static p_u16 PARM_MAX_SLEEP = PARM_DEFAULT_MAX_PM_SLEEP;
  168. static p_char *PARM_MEDIUM_DISTRIBUTION = PARM_DEFAULT_MEDIUM_DISTRIBUTION_STR;
  169. static p_char *PARM_MICROWAVE_ROBUSTNESS = PARM_DEFAULT_MICROWAVE_ROBUSTNESS_STR;
  170. static p_char *PARM_MULTICAST_PM_BUFFERING = PARM_DEFAULT_MULTICAST_PM_BUFFERING_STR;
  171. static p_u16 PARM_MULTICAST_RATE = PARM_DEFAULT_MULTICAST_RATE_2GHZ;
  172. static p_char *PARM_MULTICAST_RX = PARM_DEFAULT_MULTICAST_RX_STR;
  173. static p_u8 PARM_NETWORK_ADDR[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  174. static p_u16 PARM_OWN_ATIM_WINDOW = PARM_DEFAULT_OWN_ATIM_WINDOW;
  175. static p_u16 PARM_OWN_BEACON_INTERVAL = PARM_DEFAULT_OWN_BEACON_INTERVAL;
  176. static p_u8 PARM_OWN_CHANNEL = PARM_DEFAULT_OWN_CHANNEL;
  177. static p_u8 PARM_OWN_DTIM_PERIOD = PARM_DEFAULT_OWN_DTIM_PERIOD;
  178. static p_char *PARM_OWN_NAME = PARM_DEFAULT_OWN_NAME;
  179. static p_char *PARM_OWN_SSID = PARM_DEFAULT_SSID;
  180. static p_u16 PARM_PM_ENABLED = WVLAN_PM_STATE_DISABLED;
  181. static p_u16 PARM_PM_HOLDOVER_DURATION = PARM_DEFAULT_PM_HOLDOVER_DURATION;
  182. static p_u8 PARM_PORT_TYPE = PARM_DEFAULT_PORT_TYPE;
  183. static p_char *PARM_PROMISCUOUS_MODE = PARM_DEFAULT_PROMISCUOUS_MODE_STR;
  184. static p_char *PARM_REJECT_ANY = PARM_DEFAULT_REJECT_ANY_STR;
  185. #ifdef USE_WDS
  186. static p_u16 PARM_RTS_THRESHOLD1 = PARM_DEFAULT_RTS_THRESHOLD;
  187. static p_u16 PARM_RTS_THRESHOLD2 = PARM_DEFAULT_RTS_THRESHOLD;
  188. static p_u16 PARM_RTS_THRESHOLD3 = PARM_DEFAULT_RTS_THRESHOLD;
  189. static p_u16 PARM_RTS_THRESHOLD4 = PARM_DEFAULT_RTS_THRESHOLD;
  190. static p_u16 PARM_RTS_THRESHOLD5 = PARM_DEFAULT_RTS_THRESHOLD;
  191. static p_u16 PARM_RTS_THRESHOLD6 = PARM_DEFAULT_RTS_THRESHOLD;
  192. #endif // USE_WDS
  193. static p_u16 PARM_RTS_THRESHOLD = PARM_DEFAULT_RTS_THRESHOLD;
  194. static p_u16 PARM_SRSC_2GHZ = PARM_DEFAULT_SRSC_2GHZ;
  195. static p_u16 PARM_SRSC_5GHZ = PARM_DEFAULT_SRSC_5GHZ;
  196. static p_u8 PARM_SYSTEM_SCALE = PARM_DEFAULT_SYSTEM_SCALE;
  197. static p_u8 PARM_TX_KEY = PARM_DEFAULT_TX_KEY;
  198. static p_u16 PARM_TX_POW_LEVEL = PARM_DEFAULT_TX_POW_LEVEL;
  199. #ifdef USE_WDS
  200. static p_u16 PARM_TX_RATE1 = PARM_DEFAULT_TX_RATE_2GHZ;
  201. static p_u16 PARM_TX_RATE2 = PARM_DEFAULT_TX_RATE_2GHZ;
  202. static p_u16 PARM_TX_RATE3 = PARM_DEFAULT_TX_RATE_2GHZ;
  203. static p_u16 PARM_TX_RATE4 = PARM_DEFAULT_TX_RATE_2GHZ;
  204. static p_u16 PARM_TX_RATE5 = PARM_DEFAULT_TX_RATE_2GHZ;
  205. static p_u16 PARM_TX_RATE6 = PARM_DEFAULT_TX_RATE_2GHZ;
  206. #endif // USE_WDS
  207. static p_u16 PARM_TX_RATE = PARM_DEFAULT_TX_RATE_2GHZ;
  208. #ifdef USE_WDS
  209. static p_u8 PARM_WDS_ADDRESS1[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  210. static p_u8 PARM_WDS_ADDRESS2[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  211. static p_u8 PARM_WDS_ADDRESS3[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  212. static p_u8 PARM_WDS_ADDRESS4[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  213. static p_u8 PARM_WDS_ADDRESS5[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  214. static p_u8 PARM_WDS_ADDRESS6[ETH_ALEN] = PARM_DEFAULT_NETWORK_ADDR;
  215. #endif // USE_WDS
  216. #if 0
  217. MODULE_PARM(PARM_DESIRED_SSID, "s");
  218. MODULE_PARM_DESC(PARM_DESIRED_SSID, "Network Name (<string>) [ANY]");
  219. MODULE_PARM(PARM_OWN_SSID, "s");
  220. MODULE_PARM_DESC(PARM_OWN_SSID, "Network Name (<string>) [ANY]");
  221. MODULE_PARM(PARM_OWN_CHANNEL, "b");
  222. MODULE_PARM_DESC(PARM_OWN_CHANNEL, "Channel (0 - 14) [0]");
  223. MODULE_PARM(PARM_SYSTEM_SCALE, "b");
  224. MODULE_PARM_DESC(PARM_SYSTEM_SCALE, "Distance Between APs (1 - 3) [1]");
  225. MODULE_PARM(PARM_TX_RATE, "b");
  226. MODULE_PARM_DESC(PARM_TX_RATE, "Transmit Rate Control");
  227. MODULE_PARM(PARM_RTS_THRESHOLD, "h");
  228. MODULE_PARM_DESC(PARM_RTS_THRESHOLD, "Medium Reservation (RTS/CTS Fragment Length) (256 - 2347) [2347]");
  229. MODULE_PARM(PARM_MICROWAVE_ROBUSTNESS, "s");
  230. MODULE_PARM_DESC(PARM_MICROWAVE_ROBUSTNESS, "Microwave Oven Robustness Enabled (<string> N or Y) [N]");
  231. MODULE_PARM(PARM_OWN_NAME, "s");
  232. MODULE_PARM_DESC(PARM_OWN_NAME, "Station Name (<string>) [Linux]");
  233. MODULE_PARM(PARM_ENABLE_ENCRYPTION, "b");
  234. MODULE_PARM_DESC(PARM_ENABLE_ENCRYPTION, "Encryption Mode (0 - 7) [0]");
  235. MODULE_PARM(PARM_KEY1, "s");
  236. MODULE_PARM_DESC(PARM_KEY1, "Data Encryption Key 1 (<string>) []");
  237. MODULE_PARM(PARM_KEY2, "s");
  238. MODULE_PARM_DESC(PARM_KEY2, "Data Encryption Key 2 (<string>) []");
  239. MODULE_PARM(PARM_KEY3, "s");
  240. MODULE_PARM_DESC(PARM_KEY3, "Data Encryption Key 3 (<string>) []");
  241. MODULE_PARM(PARM_KEY4, "s");
  242. MODULE_PARM_DESC(PARM_KEY4, "Data Encryption Key 4 (<string>) []");
  243. MODULE_PARM(PARM_TX_KEY, "b");
  244. MODULE_PARM_DESC(PARM_TX_KEY, "Transmit Key ID (1 - 4) [1]");
  245. MODULE_PARM(PARM_MULTICAST_RATE, "b");
  246. MODULE_PARM_DESC(PARM_MULTICAST_RATE, "Multicast Rate");
  247. MODULE_PARM(PARM_DOWNLOAD_FIRMWARE, "s");
  248. MODULE_PARM_DESC(PARM_DOWNLOAD_FIRMWARE, "filename of firmware image");
  249. MODULE_PARM(PARM_AUTH_KEY_MGMT_SUITE, "b");
  250. MODULE_PARM_DESC(PARM_AUTH_KEY_MGMT_SUITE, "Authentication Key Management suite (0-4) [0]");
  251. MODULE_PARM(PARM_LOAD_BALANCING, "s");
  252. MODULE_PARM_DESC(PARM_LOAD_BALANCING, "Load Balancing Enabled (<string> N or Y) [Y]");
  253. MODULE_PARM(PARM_MEDIUM_DISTRIBUTION, "s");
  254. MODULE_PARM_DESC(PARM_MEDIUM_DISTRIBUTION, "Medium Distribution Enabled (<string> N or Y) [Y]");
  255. MODULE_PARM(PARM_TX_POW_LEVEL, "b");
  256. MODULE_PARM_DESC(PARM_TX_POW_LEVEL, "Transmit Power (0 - 6) [3]");
  257. MODULE_PARM(PARM_SRSC_2GHZ, "b");
  258. MODULE_PARM_DESC(PARM_SRSC_2GHZ, "Supported Rate Set Control 2.4 GHz");
  259. MODULE_PARM(PARM_SRSC_5GHZ, "b");
  260. MODULE_PARM_DESC(PARM_SRSC_5GHZ, "Supported Rate Set Control 5.0 GHz");
  261. MODULE_PARM(PARM_BRSC_2GHZ, "b");
  262. MODULE_PARM_DESC(PARM_BRSC_2GHZ, "Basic Rate Set Control 2.4 GHz");
  263. MODULE_PARM(PARM_BRSC_5GHZ, "b");
  264. MODULE_PARM_DESC(PARM_BRSC_5GHZ, "Basic Rate Set Control 5.0 GHz");
  265. #if 1 //;? (HCF_TYPE) & HCF_TYPE_STA
  266. //;?seems reasonable that even an AP-only driver could afford this small additional footprint
  267. MODULE_PARM(PARM_PM_ENABLED, "h");
  268. MODULE_PARM_DESC(PARM_PM_ENABLED, "Power Management State (0 - 2, 8001 - 8002) [0]");
  269. MODULE_PARM(PARM_PORT_TYPE, "b");
  270. MODULE_PARM_DESC(PARM_PORT_TYPE, "Port Type (1 - 3) [1]");
  271. //;?MODULE_PARM(PARM_CREATE_IBSS, "s");
  272. //;?MODULE_PARM_DESC(PARM_CREATE_IBSS, "Create IBSS (<string> N or Y) [N]");
  273. //;?MODULE_PARM(PARM_MULTICAST_RX, "s");
  274. //;?MODULE_PARM_DESC(PARM_MULTICAST_RX, "Multicast Receive Enable (<string> N or Y) [Y]");
  275. //;?MODULE_PARM(PARM_MAX_SLEEP, "h");
  276. //;?MODULE_PARM_DESC(PARM_MAX_SLEEP, "Maximum Power Management Sleep Duration (0 - 65535) [100]");
  277. //;?MODULE_PARM(PARM_NETWORK_ADDR, "6b");
  278. //;?MODULE_PARM_DESC(PARM_NETWORK_ADDR, "Hardware Ethernet Address ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [<factory value>]");
  279. //;?MODULE_PARM(PARM_AUTHENTICATION, "b");
  280. //
  281. //tracker 12448
  282. //;?MODULE_PARM_DESC(PARM_AUTHENTICATION, "Authentication Type (0-2) [0] 0=Open 1=SharedKey 2=LEAP");
  283. //;?MODULE_PARM_DESC(authentication, "Authentication Type (1-2) [1] 1=Open 2=SharedKey");
  284. //tracker 12448
  285. //
  286. //;?MODULE_PARM(PARM_OWN_ATIM_WINDOW, "b");
  287. //;?MODULE_PARM_DESC(PARM_OWN_ATIM_WINDOW, "ATIM Window time in TU for IBSS creation (0-100) [0]");
  288. //;?MODULE_PARM(PARM_PM_HOLDOVER_DURATION, "b");
  289. //;?MODULE_PARM_DESC(PARM_PM_HOLDOVER_DURATION, "Time station remains awake after MAC frame transfer when PM is on (0-65535) [100]");
  290. //;?MODULE_PARM(PARM_PROMISCUOUS_MODE, "s");
  291. //;?MODULE_PARM_DESC(PARM_PROMISCUOUS_MODE, "Promiscuous Mode Enable (<string> Y or N ) [N]" );
  292. //;?
  293. MODULE_PARM(PARM_CONNECTION_CONTROL, "b");
  294. MODULE_PARM_DESC(PARM_CONNECTION_CONTROL, "Connection Control (0 - 3) [2]");
  295. #endif /* HCF_STA */
  296. #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP
  297. //;?should we restore this to allow smaller memory footprint
  298. MODULE_PARM(PARM_OWN_DTIM_PERIOD, "b");
  299. MODULE_PARM_DESC(PARM_OWN_DTIM_PERIOD, "DTIM Period (0 - 255) [1]");
  300. MODULE_PARM(PARM_REJECT_ANY, "s");
  301. MODULE_PARM_DESC(PARM_REJECT_ANY, "Closed System (<string> N or Y) [N]");
  302. MODULE_PARM(PARM_EXCLUDE_UNENCRYPTED, "s");
  303. MODULE_PARM_DESC(PARM_EXCLUDE_UNENCRYPTED, "Deny non-encrypted (<string> N or Y) [Y]");
  304. MODULE_PARM(PARM_MULTICAST_PM_BUFFERING,"s");
  305. MODULE_PARM_DESC(PARM_MULTICAST_PM_BUFFERING, "Buffer MAC frames for Tx after DTIM (<string> Y or N) [Y]");
  306. MODULE_PARM(PARM_INTRA_BSS_RELAY, "s");
  307. MODULE_PARM_DESC(PARM_INTRA_BSS_RELAY, "IntraBSS Relay (<string> N or Y) [Y]");
  308. MODULE_PARM(PARM_RTS_THRESHOLD1, "h");
  309. MODULE_PARM_DESC(PARM_RTS_THRESHOLD1, "RTS Threshold, WDS Port 1 (256 - 2347) [2347]");
  310. MODULE_PARM(PARM_RTS_THRESHOLD2, "h");
  311. MODULE_PARM_DESC(PARM_RTS_THRESHOLD2, "RTS Threshold, WDS Port 2 (256 - 2347) [2347]");
  312. MODULE_PARM(PARM_RTS_THRESHOLD3, "h");
  313. MODULE_PARM_DESC(PARM_RTS_THRESHOLD3, "RTS Threshold, WDS Port 3 (256 - 2347) [2347]");
  314. MODULE_PARM(PARM_RTS_THRESHOLD4, "h");
  315. MODULE_PARM_DESC(PARM_RTS_THRESHOLD4, "RTS Threshold, WDS Port 4 (256 - 2347) [2347]");
  316. MODULE_PARM(PARM_RTS_THRESHOLD5, "h");
  317. MODULE_PARM_DESC(PARM_RTS_THRESHOLD5, "RTS Threshold, WDS Port 5 (256 - 2347) [2347]");
  318. MODULE_PARM(PARM_RTS_THRESHOLD6, "h");
  319. MODULE_PARM_DESC(PARM_RTS_THRESHOLD6, "RTS Threshold, WDS Port 6 (256 - 2347) [2347]");
  320. MODULE_PARM(PARM_TX_RATE1, "b");
  321. MODULE_PARM_DESC(PARM_TX_RATE1, "Transmit Rate Control, WDS Port 1 (1 - 7) [3]");
  322. MODULE_PARM(PARM_TX_RATE2, "b");
  323. MODULE_PARM_DESC(PARM_TX_RATE2, "Transmit Rate Control, WDS Port 2 (1 - 7) [3]");
  324. MODULE_PARM(PARM_TX_RATE3, "b");
  325. MODULE_PARM_DESC(PARM_TX_RATE3, "Transmit Rate Control, WDS Port 3 (1 - 7) [3]");
  326. MODULE_PARM(PARM_TX_RATE4, "b");
  327. MODULE_PARM_DESC(PARM_TX_RATE4, "Transmit Rate Control, WDS Port 4 (1 - 7) [3]");
  328. MODULE_PARM(PARM_TX_RATE5, "b");
  329. MODULE_PARM_DESC(PARM_TX_RATE5, "Transmit Rate Control, WDS Port 5 (1 - 7) [3]");
  330. MODULE_PARM(PARM_TX_RATE6, "b");
  331. MODULE_PARM_DESC(PARM_TX_RATE6, "Transmit Rate Control, WDS Port 6 (1 - 7) [3]");
  332. MODULE_PARM(PARM_WDS_ADDRESS1, "6b");
  333. MODULE_PARM_DESC(PARM_WDS_ADDRESS1, "MAC Address, WDS Port 1 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]");
  334. MODULE_PARM(PARM_WDS_ADDRESS2, "6b");
  335. MODULE_PARM_DESC(PARM_WDS_ADDRESS2, "MAC Address, WDS Port 2 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]");
  336. MODULE_PARM(PARM_WDS_ADDRESS3, "6b");
  337. MODULE_PARM_DESC(PARM_WDS_ADDRESS3, "MAC Address, WDS Port 3 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]");
  338. MODULE_PARM(PARM_WDS_ADDRESS4, "6b");
  339. MODULE_PARM_DESC(PARM_WDS_ADDRESS4, "MAC Address, WDS Port 4 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]");
  340. MODULE_PARM(PARM_WDS_ADDRESS5, "6b");
  341. MODULE_PARM_DESC(PARM_WDS_ADDRESS5, "MAC Address, WDS Port 5 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]");
  342. MODULE_PARM(PARM_WDS_ADDRESS6, "6b");
  343. MODULE_PARM_DESC(PARM_WDS_ADDRESS6, "MAC Address, WDS Port 6 ([0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff],[0x00-0xff]) [{0}]");
  344. MODULE_PARM(PARM_OWN_BEACON_INTERVAL, "b");
  345. MODULE_PARM_DESC(PARM_OWN_BEACON_INTERVAL, "Own Beacon Interval (20 - 200) [100]");
  346. MODULE_PARM(PARM_COEXISTENCE, "b");
  347. MODULE_PARM_DESC(PARM_COEXISTENCE, "Coexistence (0-7) [0]");
  348. #endif /* HCF_AP */
  349. #endif
  350. /* END NEW PARAMETERS */
  351. /*******************************************************************************
  352. * debugging specifics
  353. ******************************************************************************/
  354. #if DBG
  355. static p_u32 pc_debug = DBG_LVL;
  356. //MODULE_PARM(pc_debug, "i");
  357. /*static ;?conflicts with my understanding of CL parameters and breaks now I moved
  358. * the correspondig logic to wl_profile
  359. */ p_u32 DebugFlag = ~0; //recognizable "undefined value" rather then DBG_DEFAULTS;
  360. //MODULE_PARM(DebugFlag, "l");
  361. dbg_info_t wl_info = { DBG_MOD_NAME, 0, 0 };
  362. dbg_info_t *DbgInfo = &wl_info;
  363. #endif /* DBG */
  364. #ifdef USE_RTS
  365. static p_char *useRTS = "N";
  366. MODULE_PARM( useRTS, "s" );
  367. MODULE_PARM_DESC( useRTS, "Use RTS test interface (<string> N or Y) [N]" );
  368. #endif /* USE_RTS */
  369. /*******************************************************************************
  370. * firmware download specifics
  371. ******************************************************************************/
  372. extern struct CFG_RANGE2_STRCT BASED
  373. cfg_drv_act_ranges_pri; // describes primary-actor range of HCF
  374. #if 0 //;? (HCF_TYPE) & HCF_TYPE_AP
  375. extern memimage ap; // AP firmware image to be downloaded
  376. #endif /* HCF_AP */
  377. #if 1 //;? (HCF_TYPE) & HCF_TYPE_STA
  378. //extern memimage station; // STA firmware image to be downloaded
  379. extern memimage fw_image; // firmware image to be downloaded
  380. #endif /* HCF_STA */
  381. int wl_insert( struct net_device *dev )
  382. {
  383. int result = 0;
  384. int hcf_status = HCF_SUCCESS;
  385. int i;
  386. unsigned long flags = 0;
  387. struct wl_private *lp = wl_priv(dev);
  388. /*------------------------------------------------------------------------*/
  389. DBG_FUNC( "wl_insert" );
  390. DBG_ENTER( DbgInfo );
  391. /* Initialize the adapter hardware. */
  392. memset( &( lp->hcfCtx ), 0, sizeof( IFB_STRCT ));
  393. /* Initialize the adapter parameters. */
  394. spin_lock_init( &( lp->slock ));
  395. /* Initialize states */
  396. //lp->lockcount = 0; //PE1DNN
  397. lp->is_handling_int = WL_NOT_HANDLING_INT;
  398. lp->firmware_present = WL_FRIMWARE_NOT_PRESENT;
  399. lp->dev = dev;
  400. DBG_PARAM( DbgInfo, "irq_mask", "0x%04x", irq_mask & 0x0FFFF );
  401. DBG_PARAM( DbgInfo, "irq_list", "0x%02x 0x%02x 0x%02x 0x%02x",
  402. irq_list[0] & 0x0FF, irq_list[1] & 0x0FF,
  403. irq_list[2] & 0x0FF, irq_list[3] & 0x0FF );
  404. DBG_PARAM( DbgInfo, PARM_NAME_DESIRED_SSID, "\"%s\"", PARM_DESIRED_SSID );
  405. DBG_PARAM( DbgInfo, PARM_NAME_OWN_SSID, "\"%s\"", PARM_OWN_SSID );
  406. DBG_PARAM( DbgInfo, PARM_NAME_OWN_CHANNEL, "%d", PARM_OWN_CHANNEL);
  407. DBG_PARAM( DbgInfo, PARM_NAME_SYSTEM_SCALE, "%d", PARM_SYSTEM_SCALE );
  408. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE, "%d", PARM_TX_RATE );
  409. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD, "%d", PARM_RTS_THRESHOLD );
  410. DBG_PARAM( DbgInfo, PARM_NAME_MICROWAVE_ROBUSTNESS, "\"%s\"", PARM_MICROWAVE_ROBUSTNESS );
  411. DBG_PARAM( DbgInfo, PARM_NAME_OWN_NAME, "\"%s\"", PARM_OWN_NAME );
  412. //;? DBG_PARAM( DbgInfo, PARM_NAME_ENABLE_ENCRYPTION, "\"%s\"", PARM_ENABLE_ENCRYPTION );
  413. DBG_PARAM( DbgInfo, PARM_NAME_KEY1, "\"%s\"", PARM_KEY1 );
  414. DBG_PARAM( DbgInfo, PARM_NAME_KEY2, "\"%s\"", PARM_KEY2 );
  415. DBG_PARAM( DbgInfo, PARM_NAME_KEY3, "\"%s\"", PARM_KEY3 );
  416. DBG_PARAM( DbgInfo, PARM_NAME_KEY4, "\"%s\"", PARM_KEY4 );
  417. DBG_PARAM( DbgInfo, PARM_NAME_TX_KEY, "%d", PARM_TX_KEY );
  418. DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_RATE, "%d", PARM_MULTICAST_RATE );
  419. DBG_PARAM( DbgInfo, PARM_NAME_DOWNLOAD_FIRMWARE, "\"%s\"", PARM_DOWNLOAD_FIRMWARE );
  420. DBG_PARAM( DbgInfo, PARM_NAME_AUTH_KEY_MGMT_SUITE, "%d", PARM_AUTH_KEY_MGMT_SUITE );
  421. //;?#if (HCF_TYPE) & HCF_TYPE_STA
  422. //;?should we make this code conditional depending on in STA mode
  423. //;? DBG_PARAM( DbgInfo, PARM_NAME_PORT_TYPE, "%d", PARM_PORT_TYPE );
  424. DBG_PARAM( DbgInfo, PARM_NAME_PM_ENABLED, "%04x", PARM_PM_ENABLED );
  425. //;? DBG_PARAM( DbgInfo, PARM_NAME_CREATE_IBSS, "\"%s\"", PARM_CREATE_IBSS );
  426. //;? DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_RX, "\"%s\"", PARM_MULTICAST_RX );
  427. //;? DBG_PARAM( DbgInfo, PARM_NAME_MAX_SLEEP, "%d", PARM_MAX_SLEEP );
  428. /*
  429. DBG_PARAM(DbgInfo, PARM_NAME_NETWORK_ADDR, "\"%pM\"",
  430. PARM_NETWORK_ADDR);
  431. */
  432. //;? DBG_PARAM( DbgInfo, PARM_NAME_AUTHENTICATION, "%d", PARM_AUTHENTICATION );
  433. //;? DBG_PARAM( DbgInfo, PARM_NAME_OWN_ATIM_WINDOW, "%d", PARM_OWN_ATIM_WINDOW );
  434. //;? DBG_PARAM( DbgInfo, PARM_NAME_PM_HOLDOVER_DURATION, "%d", PARM_PM_HOLDOVER_DURATION );
  435. //;? DBG_PARAM( DbgInfo, PARM_NAME_PROMISCUOUS_MODE, "\"%s\"", PARM_PROMISCUOUS_MODE );
  436. //;?#endif /* HCF_STA */
  437. #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP
  438. //;?should we restore this to allow smaller memory footprint
  439. //;?I guess: no, since this is Debug mode only
  440. DBG_PARAM( DbgInfo, PARM_NAME_OWN_DTIM_PERIOD, "%d", PARM_OWN_DTIM_PERIOD );
  441. DBG_PARAM( DbgInfo, PARM_NAME_REJECT_ANY, "\"%s\"", PARM_REJECT_ANY );
  442. DBG_PARAM( DbgInfo, PARM_NAME_EXCLUDE_UNENCRYPTED, "\"%s\"", PARM_EXCLUDE_UNENCRYPTED );
  443. DBG_PARAM( DbgInfo, PARM_NAME_MULTICAST_PM_BUFFERING, "\"%s\"", PARM_MULTICAST_PM_BUFFERING );
  444. DBG_PARAM( DbgInfo, PARM_NAME_INTRA_BSS_RELAY, "\"%s\"", PARM_INTRA_BSS_RELAY );
  445. #ifdef USE_WDS
  446. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD1, "%d", PARM_RTS_THRESHOLD1 );
  447. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD2, "%d", PARM_RTS_THRESHOLD2 );
  448. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD3, "%d", PARM_RTS_THRESHOLD3 );
  449. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD4, "%d", PARM_RTS_THRESHOLD4 );
  450. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD5, "%d", PARM_RTS_THRESHOLD5 );
  451. DBG_PARAM( DbgInfo, PARM_NAME_RTS_THRESHOLD6, "%d", PARM_RTS_THRESHOLD6 );
  452. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE1, "%d", PARM_TX_RATE1 );
  453. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE2, "%d", PARM_TX_RATE2 );
  454. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE3, "%d", PARM_TX_RATE3 );
  455. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE4, "%d", PARM_TX_RATE4 );
  456. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE5, "%d", PARM_TX_RATE5 );
  457. DBG_PARAM( DbgInfo, PARM_NAME_TX_RATE6, "%d", PARM_TX_RATE6 );
  458. DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS1, "\"%pM\"",
  459. PARM_WDS_ADDRESS1);
  460. DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS2, "\"%pM\"",
  461. PARM_WDS_ADDRESS2);
  462. DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS3, "\"%pM\"",
  463. PARM_WDS_ADDRESS3);
  464. DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS4, "\"%pM\"",
  465. PARM_WDS_ADDRESS4);
  466. DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS5, "\"%pM\"",
  467. PARM_WDS_ADDRESS5);
  468. DBG_PARAM(DbgInfo, PARM_NAME_WDS_ADDRESS6, "\"%pM\"",
  469. PARM_WDS_ADDRESS6);
  470. #endif /* USE_WDS */
  471. #endif /* HCF_AP */
  472. VALID_PARAM( !PARM_DESIRED_SSID || ( strlen( PARM_DESIRED_SSID ) <= PARM_MAX_NAME_LEN ));
  473. VALID_PARAM( !PARM_OWN_SSID || ( strlen( PARM_OWN_SSID ) <= PARM_MAX_NAME_LEN ));
  474. VALID_PARAM(( PARM_OWN_CHANNEL <= PARM_MAX_OWN_CHANNEL ));
  475. VALID_PARAM(( PARM_SYSTEM_SCALE >= PARM_MIN_SYSTEM_SCALE ) && ( PARM_SYSTEM_SCALE <= PARM_MAX_SYSTEM_SCALE ));
  476. VALID_PARAM(( PARM_TX_RATE >= PARM_MIN_TX_RATE ) && ( PARM_TX_RATE <= PARM_MAX_TX_RATE ));
  477. VALID_PARAM(( PARM_RTS_THRESHOLD <= PARM_MAX_RTS_THRESHOLD ));
  478. VALID_PARAM( !PARM_MICROWAVE_ROBUSTNESS || strchr( "NnYy", PARM_MICROWAVE_ROBUSTNESS[0] ) != NULL );
  479. VALID_PARAM( !PARM_OWN_NAME || ( strlen( PARM_NAME_OWN_NAME ) <= PARM_MAX_NAME_LEN ));
  480. VALID_PARAM(( PARM_ENABLE_ENCRYPTION <= PARM_MAX_ENABLE_ENCRYPTION ));
  481. VALID_PARAM( is_valid_key_string( PARM_KEY1 ));
  482. VALID_PARAM( is_valid_key_string( PARM_KEY2 ));
  483. VALID_PARAM( is_valid_key_string( PARM_KEY3 ));
  484. VALID_PARAM( is_valid_key_string( PARM_KEY4 ));
  485. VALID_PARAM(( PARM_TX_KEY >= PARM_MIN_TX_KEY ) && ( PARM_TX_KEY <= PARM_MAX_TX_KEY ));
  486. VALID_PARAM(( PARM_MULTICAST_RATE >= PARM_MIN_MULTICAST_RATE ) &&
  487. ( PARM_MULTICAST_RATE <= PARM_MAX_MULTICAST_RATE ));
  488. VALID_PARAM( !PARM_DOWNLOAD_FIRMWARE || ( strlen( PARM_DOWNLOAD_FIRMWARE ) <= 255 /*;?*/ ));
  489. VALID_PARAM(( PARM_AUTH_KEY_MGMT_SUITE < PARM_MAX_AUTH_KEY_MGMT_SUITE ));
  490. VALID_PARAM( !PARM_LOAD_BALANCING || strchr( "NnYy", PARM_LOAD_BALANCING[0] ) != NULL );
  491. VALID_PARAM( !PARM_MEDIUM_DISTRIBUTION || strchr( "NnYy", PARM_MEDIUM_DISTRIBUTION[0] ) != NULL );
  492. VALID_PARAM(( PARM_TX_POW_LEVEL <= PARM_MAX_TX_POW_LEVEL ));
  493. VALID_PARAM(( PARM_PORT_TYPE >= PARM_MIN_PORT_TYPE ) && ( PARM_PORT_TYPE <= PARM_MAX_PORT_TYPE ));
  494. VALID_PARAM( PARM_PM_ENABLED <= WVLAN_PM_STATE_STANDARD ||
  495. ( PARM_PM_ENABLED & 0x7FFF ) <= WVLAN_PM_STATE_STANDARD );
  496. VALID_PARAM( !PARM_CREATE_IBSS || strchr( "NnYy", PARM_CREATE_IBSS[0] ) != NULL );
  497. VALID_PARAM( !PARM_MULTICAST_RX || strchr( "NnYy", PARM_MULTICAST_RX[0] ) != NULL );
  498. VALID_PARAM(( PARM_MAX_SLEEP <= PARM_MAX_MAX_PM_SLEEP ));
  499. VALID_PARAM(( PARM_AUTHENTICATION <= PARM_MAX_AUTHENTICATION ));
  500. VALID_PARAM(( PARM_OWN_ATIM_WINDOW <= PARM_MAX_OWN_ATIM_WINDOW ));
  501. VALID_PARAM(( PARM_PM_HOLDOVER_DURATION <= PARM_MAX_PM_HOLDOVER_DURATION ));
  502. VALID_PARAM( !PARM_PROMISCUOUS_MODE || strchr( "NnYy", PARM_PROMISCUOUS_MODE[0] ) != NULL );
  503. VALID_PARAM(( PARM_CONNECTION_CONTROL <= PARM_MAX_CONNECTION_CONTROL ));
  504. VALID_PARAM(( PARM_OWN_DTIM_PERIOD >= PARM_MIN_OWN_DTIM_PERIOD ));
  505. VALID_PARAM( !PARM_REJECT_ANY || strchr( "NnYy", PARM_REJECT_ANY[0] ) != NULL );
  506. VALID_PARAM( !PARM_EXCLUDE_UNENCRYPTED || strchr( "NnYy", PARM_EXCLUDE_UNENCRYPTED[0] ) != NULL );
  507. VALID_PARAM( !PARM_MULTICAST_PM_BUFFERING || strchr( "NnYy", PARM_MULTICAST_PM_BUFFERING[0] ) != NULL );
  508. VALID_PARAM( !PARM_INTRA_BSS_RELAY || strchr( "NnYy", PARM_INTRA_BSS_RELAY[0] ) != NULL );
  509. #ifdef USE_WDS
  510. VALID_PARAM(( PARM_RTS_THRESHOLD1 <= PARM_MAX_RTS_THRESHOLD ));
  511. VALID_PARAM(( PARM_RTS_THRESHOLD2 <= PARM_MAX_RTS_THRESHOLD ));
  512. VALID_PARAM(( PARM_RTS_THRESHOLD3 <= PARM_MAX_RTS_THRESHOLD ));
  513. VALID_PARAM(( PARM_RTS_THRESHOLD4 <= PARM_MAX_RTS_THRESHOLD ));
  514. VALID_PARAM(( PARM_RTS_THRESHOLD5 <= PARM_MAX_RTS_THRESHOLD ));
  515. VALID_PARAM(( PARM_RTS_THRESHOLD6 <= PARM_MAX_RTS_THRESHOLD ));
  516. VALID_PARAM(( PARM_TX_RATE1 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE1 <= PARM_MAX_TX_RATE ));
  517. VALID_PARAM(( PARM_TX_RATE2 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE2 <= PARM_MAX_TX_RATE ));
  518. VALID_PARAM(( PARM_TX_RATE3 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE3 <= PARM_MAX_TX_RATE ));
  519. VALID_PARAM(( PARM_TX_RATE4 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE4 <= PARM_MAX_TX_RATE ));
  520. VALID_PARAM(( PARM_TX_RATE5 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE5 <= PARM_MAX_TX_RATE ));
  521. VALID_PARAM(( PARM_TX_RATE6 >= PARM_MIN_TX_RATE ) && (PARM_TX_RATE6 <= PARM_MAX_TX_RATE ));
  522. #endif /* USE_WDS */
  523. VALID_PARAM(( PARM_OWN_BEACON_INTERVAL >= PARM_MIN_OWN_BEACON_INTERVAL ) && ( PARM_OWN_BEACON_INTERVAL <= PARM_MAX_OWN_BEACON_INTERVAL ));
  524. VALID_PARAM(( PARM_COEXISTENCE <= PARM_COEXISTENCE ));
  525. /* Set the driver parameters from the passed in parameters. */
  526. /* THESE MODULE PARAMETERS ARE TO BE DEPRECATED IN FAVOR OF A NAMING CONVENTION
  527. WHICH IS INLINE WITH THE FORTHCOMING WAVELAN API */
  528. /* START NEW PARAMETERS */
  529. lp->Channel = PARM_OWN_CHANNEL;
  530. lp->DistanceBetweenAPs = PARM_SYSTEM_SCALE;
  531. /* Need to determine how to handle the new bands for 5GHz */
  532. lp->TxRateControl[0] = PARM_DEFAULT_TX_RATE_2GHZ;
  533. lp->TxRateControl[1] = PARM_DEFAULT_TX_RATE_5GHZ;
  534. lp->RTSThreshold = PARM_RTS_THRESHOLD;
  535. /* Need to determine how to handle the new bands for 5GHz */
  536. lp->MulticastRate[0] = PARM_DEFAULT_MULTICAST_RATE_2GHZ;
  537. lp->MulticastRate[1] = PARM_DEFAULT_MULTICAST_RATE_5GHZ;
  538. if ( strchr( "Yy", PARM_MICROWAVE_ROBUSTNESS[0] ) != NULL ) {
  539. lp->MicrowaveRobustness = 1;
  540. } else {
  541. lp->MicrowaveRobustness = 0;
  542. }
  543. if ( PARM_DESIRED_SSID && ( strlen( PARM_DESIRED_SSID ) <= HCF_MAX_NAME_LEN )) {
  544. strcpy( lp->NetworkName, PARM_DESIRED_SSID );
  545. }
  546. if ( PARM_OWN_SSID && ( strlen( PARM_OWN_SSID ) <= HCF_MAX_NAME_LEN )) {
  547. strcpy( lp->NetworkName, PARM_OWN_SSID );
  548. }
  549. if ( PARM_OWN_NAME && ( strlen( PARM_OWN_NAME ) <= HCF_MAX_NAME_LEN )) {
  550. strcpy( lp->StationName, PARM_OWN_NAME );
  551. }
  552. lp->EnableEncryption = PARM_ENABLE_ENCRYPTION;
  553. if ( PARM_KEY1 && ( strlen( PARM_KEY1 ) <= MAX_KEY_LEN )) {
  554. strcpy( lp->Key1, PARM_KEY1 );
  555. }
  556. if ( PARM_KEY2 && ( strlen( PARM_KEY2 ) <= MAX_KEY_LEN )) {
  557. strcpy( lp->Key2, PARM_KEY2 );
  558. }
  559. if ( PARM_KEY3 && ( strlen( PARM_KEY3 ) <= MAX_KEY_LEN )) {
  560. strcpy( lp->Key3, PARM_KEY3 );
  561. }
  562. if ( PARM_KEY4 && ( strlen( PARM_KEY4 ) <= MAX_KEY_LEN )) {
  563. strcpy( lp->Key4, PARM_KEY4 );
  564. }
  565. lp->TransmitKeyID = PARM_TX_KEY;
  566. key_string2key( lp->Key1, &(lp->DefaultKeys.key[0] ));
  567. key_string2key( lp->Key2, &(lp->DefaultKeys.key[1] ));
  568. key_string2key( lp->Key3, &(lp->DefaultKeys.key[2] ));
  569. key_string2key( lp->Key4, &(lp->DefaultKeys.key[3] ));
  570. lp->DownloadFirmware = 1 ; //;?to be upgraded PARM_DOWNLOAD_FIRMWARE;
  571. lp->AuthKeyMgmtSuite = PARM_AUTH_KEY_MGMT_SUITE;
  572. if ( strchr( "Yy", PARM_LOAD_BALANCING[0] ) != NULL ) {
  573. lp->loadBalancing = 1;
  574. } else {
  575. lp->loadBalancing = 0;
  576. }
  577. if ( strchr( "Yy", PARM_MEDIUM_DISTRIBUTION[0] ) != NULL ) {
  578. lp->mediumDistribution = 1;
  579. } else {
  580. lp->mediumDistribution = 0;
  581. }
  582. lp->txPowLevel = PARM_TX_POW_LEVEL;
  583. lp->srsc[0] = PARM_SRSC_2GHZ;
  584. lp->srsc[1] = PARM_SRSC_5GHZ;
  585. lp->brsc[0] = PARM_BRSC_2GHZ;
  586. lp->brsc[1] = PARM_BRSC_5GHZ;
  587. #if 1 //;? (HCF_TYPE) & HCF_TYPE_STA
  588. //;?seems reasonable that even an AP-only driver could afford this small additional footprint
  589. lp->PortType = PARM_PORT_TYPE;
  590. lp->MaxSleepDuration = PARM_MAX_SLEEP;
  591. lp->authentication = PARM_AUTHENTICATION;
  592. lp->atimWindow = PARM_OWN_ATIM_WINDOW;
  593. lp->holdoverDuration = PARM_PM_HOLDOVER_DURATION;
  594. lp->PMEnabled = PARM_PM_ENABLED; //;?
  595. if ( strchr( "Yy", PARM_CREATE_IBSS[0] ) != NULL ) {
  596. lp->CreateIBSS = 1;
  597. } else {
  598. lp->CreateIBSS = 0;
  599. }
  600. if ( strchr( "Nn", PARM_MULTICAST_RX[0] ) != NULL ) {
  601. lp->MulticastReceive = 0;
  602. } else {
  603. lp->MulticastReceive = 1;
  604. }
  605. if ( strchr( "Yy", PARM_PROMISCUOUS_MODE[0] ) != NULL ) {
  606. lp->promiscuousMode = 1;
  607. } else {
  608. lp->promiscuousMode = 0;
  609. }
  610. for( i = 0; i < ETH_ALEN; i++ ) {
  611. lp->MACAddress[i] = PARM_NETWORK_ADDR[i];
  612. }
  613. lp->connectionControl = PARM_CONNECTION_CONTROL;
  614. #endif /* HCF_STA */
  615. #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP
  616. //;?should we restore this to allow smaller memory footprint
  617. lp->DTIMPeriod = PARM_OWN_DTIM_PERIOD;
  618. if ( strchr( "Yy", PARM_REJECT_ANY[0] ) != NULL ) {
  619. lp->RejectAny = 1;
  620. } else {
  621. lp->RejectAny = 0;
  622. }
  623. if ( strchr( "Nn", PARM_EXCLUDE_UNENCRYPTED[0] ) != NULL ) {
  624. lp->ExcludeUnencrypted = 0;
  625. } else {
  626. lp->ExcludeUnencrypted = 1;
  627. }
  628. if ( strchr( "Yy", PARM_MULTICAST_PM_BUFFERING[0] ) != NULL ) {
  629. lp->multicastPMBuffering = 1;
  630. } else {
  631. lp->multicastPMBuffering = 0;
  632. }
  633. if ( strchr( "Yy", PARM_INTRA_BSS_RELAY[0] ) != NULL ) {
  634. lp->intraBSSRelay = 1;
  635. } else {
  636. lp->intraBSSRelay = 0;
  637. }
  638. lp->ownBeaconInterval = PARM_OWN_BEACON_INTERVAL;
  639. lp->coexistence = PARM_COEXISTENCE;
  640. #ifdef USE_WDS
  641. lp->wds_port[0].rtsThreshold = PARM_RTS_THRESHOLD1;
  642. lp->wds_port[1].rtsThreshold = PARM_RTS_THRESHOLD2;
  643. lp->wds_port[2].rtsThreshold = PARM_RTS_THRESHOLD3;
  644. lp->wds_port[3].rtsThreshold = PARM_RTS_THRESHOLD4;
  645. lp->wds_port[4].rtsThreshold = PARM_RTS_THRESHOLD5;
  646. lp->wds_port[5].rtsThreshold = PARM_RTS_THRESHOLD6;
  647. lp->wds_port[0].txRateCntl = PARM_TX_RATE1;
  648. lp->wds_port[1].txRateCntl = PARM_TX_RATE2;
  649. lp->wds_port[2].txRateCntl = PARM_TX_RATE3;
  650. lp->wds_port[3].txRateCntl = PARM_TX_RATE4;
  651. lp->wds_port[4].txRateCntl = PARM_TX_RATE5;
  652. lp->wds_port[5].txRateCntl = PARM_TX_RATE6;
  653. for( i = 0; i < ETH_ALEN; i++ ) {
  654. lp->wds_port[0].wdsAddress[i] = PARM_WDS_ADDRESS1[i];
  655. }
  656. for( i = 0; i < ETH_ALEN; i++ ) {
  657. lp->wds_port[1].wdsAddress[i] = PARM_WDS_ADDRESS2[i];
  658. }
  659. for( i = 0; i < ETH_ALEN; i++ ) {
  660. lp->wds_port[2].wdsAddress[i] = PARM_WDS_ADDRESS3[i];
  661. }
  662. for( i = 0; i < ETH_ALEN; i++ ) {
  663. lp->wds_port[3].wdsAddress[i] = PARM_WDS_ADDRESS4[i];
  664. }
  665. for( i = 0; i < ETH_ALEN; i++ ) {
  666. lp->wds_port[4].wdsAddress[i] = PARM_WDS_ADDRESS5[i];
  667. }
  668. for( i = 0; i < ETH_ALEN; i++ ) {
  669. lp->wds_port[5].wdsAddress[i] = PARM_WDS_ADDRESS6[i];
  670. }
  671. #endif /* USE_WDS */
  672. #endif /* HCF_AP */
  673. #ifdef USE_RTS
  674. if ( strchr( "Yy", useRTS[0] ) != NULL ) {
  675. lp->useRTS = 1;
  676. } else {
  677. lp->useRTS = 0;
  678. }
  679. #endif /* USE_RTS */
  680. /* END NEW PARAMETERS */
  681. wl_lock( lp, &flags );
  682. /* Initialize the portState variable */
  683. lp->portState = WVLAN_PORT_STATE_DISABLED;
  684. /* Initialize the ScanResult struct */
  685. memset( &( lp->scan_results ), 0, sizeof( lp->scan_results ));
  686. lp->scan_results.scan_complete = FALSE;
  687. /* Initialize the ProbeResult struct */
  688. memset( &( lp->probe_results ), 0, sizeof( lp->probe_results ));
  689. lp->probe_results.scan_complete = FALSE;
  690. lp->probe_num_aps = 0;
  691. /* Initialize Tx queue stuff */
  692. memset( lp->txList, 0, sizeof( lp->txList ));
  693. INIT_LIST_HEAD( &( lp->txFree ));
  694. lp->txF.skb = NULL;
  695. lp->txF.port = 0;
  696. for( i = 0; i < DEFAULT_NUM_TX_FRAMES; i++ ) {
  697. list_add_tail( &( lp->txList[i].node ), &( lp->txFree ));
  698. }
  699. for( i = 0; i < WVLAN_MAX_TX_QUEUES; i++ ) {
  700. INIT_LIST_HEAD( &( lp->txQ[i] ));
  701. }
  702. lp->netif_queue_on = TRUE;
  703. lp->txQ_count = 0;
  704. /* Initialize the use_dma element in the adapter structure. Not sure if
  705. this should be a compile-time or run-time configurable. So for now,
  706. implement as run-time and just define here */
  707. #ifdef WARP
  708. #ifdef ENABLE_DMA
  709. DBG_TRACE( DbgInfo, "HERMES 2.5 BUSMASTER DMA MODE\n" );
  710. lp->use_dma = 1;
  711. #else
  712. DBG_TRACE( DbgInfo, "HERMES 2.5 PORT I/O MODE\n" );
  713. lp->use_dma = 0;
  714. #endif // ENABLE_DMA
  715. #endif // WARP
  716. /* Register the ISR handler information here, so that it's not done
  717. repeatedly in the ISR */
  718. tasklet_init(&lp->task, wl_isr_handler, (unsigned long)lp);
  719. /* Connect to the adapter */
  720. DBG_TRACE( DbgInfo, "Calling hcf_connect()...\n" );
  721. hcf_status = hcf_connect( &lp->hcfCtx, dev->base_addr );
  722. //HCF_ERR_INCOMP_FW is acceptable, because download must still take place
  723. //HCF_ERR_INCOMP_PRI is not acceptable
  724. if ( hcf_status != HCF_SUCCESS && hcf_status != HCF_ERR_INCOMP_FW ) {
  725. DBG_ERROR( DbgInfo, "hcf_connect() failed, status: 0x%x\n", hcf_status );
  726. wl_unlock( lp, &flags );
  727. goto hcf_failed;
  728. }
  729. //;?should set HCF_version and how about driver_stat
  730. lp->driverInfo.IO_address = dev->base_addr;
  731. lp->driverInfo.IO_range = HCF_NUM_IO_PORTS; //;?conditionally 0x40 or 0x80 seems better
  732. lp->driverInfo.IRQ_number = dev->irq;
  733. lp->driverInfo.card_stat = lp->hcfCtx.IFB_CardStat;
  734. //;? what happened to frame_type
  735. /* Fill in the driver identity structure */
  736. lp->driverIdentity.len = ( sizeof( lp->driverIdentity ) / sizeof( hcf_16 )) - 1;
  737. lp->driverIdentity.typ = CFG_DRV_IDENTITY;
  738. lp->driverIdentity.comp_id = DRV_IDENTITY;
  739. lp->driverIdentity.variant = DRV_VARIANT;
  740. lp->driverIdentity.version_major = DRV_MAJOR_VERSION;
  741. lp->driverIdentity.version_minor = DRV_MINOR_VERSION;
  742. /* Start the card here - This needs to be done in order to get the
  743. MAC address for the network layer */
  744. DBG_TRACE( DbgInfo, "Calling wvlan_go() to perform a card reset...\n" );
  745. hcf_status = wl_go( lp );
  746. if ( hcf_status != HCF_SUCCESS ) {
  747. DBG_ERROR( DbgInfo, "wl_go() failed\n" );
  748. wl_unlock( lp, &flags );
  749. goto hcf_failed;
  750. }
  751. /* Certain RIDs must be set before enabling the ports */
  752. wl_put_ltv_init( lp );
  753. #if 0 //;?why was this already commented out in wl_lkm_720
  754. /* Enable the ports */
  755. if ( wl_adapter_is_open( lp->dev )) {
  756. /* Enable the ports */
  757. DBG_TRACE( DbgInfo, "Enabling Port 0\n" );
  758. hcf_status = wl_enable( lp );
  759. if ( hcf_status != HCF_SUCCESS ) {
  760. DBG_TRACE( DbgInfo, "Enable port 0 failed: 0x%x\n", hcf_status );
  761. }
  762. #if (HCF_TYPE) & HCF_TYPE_AP
  763. DBG_TRACE( DbgInfo, "Enabling WDS Ports\n" );
  764. //wl_enable_wds_ports( lp );
  765. #endif /* (HCF_TYPE) & HCF_TYPE_AP */
  766. }
  767. #endif
  768. /* Fill out the MAC address information in the net_device struct */
  769. memcpy( lp->dev->dev_addr, lp->MACAddress, ETH_ALEN );
  770. dev->addr_len = ETH_ALEN;
  771. lp->is_registered = TRUE;
  772. #ifdef USE_PROFILE
  773. /* Parse the config file for the sake of creating WDS ports if WDS is
  774. configured there but not in the module options */
  775. parse_config( dev );
  776. #endif /* USE_PROFILE */
  777. /* If we're going into AP Mode, register the "virtual" ethernet devices
  778. needed for WDS */
  779. WL_WDS_NETDEV_REGISTER( lp );
  780. /* Reset the DownloadFirmware variable in the private struct. If the
  781. config file is not used, this will not matter; if it is used, it
  782. will be reparsed in wl_open(). This is done because logic in wl_open
  783. used to check if a firmware download is needed is broken by parsing
  784. the file here; however, this parsing is needed to register WDS ports
  785. in AP mode, if they are configured */
  786. lp->DownloadFirmware = WVLAN_DRV_MODE_STA; //;?download_firmware;
  787. #ifdef USE_RTS
  788. if ( lp->useRTS == 1 ) {
  789. DBG_TRACE( DbgInfo, "ENTERING RTS MODE...\n" );
  790. wl_act_int_off( lp );
  791. lp->is_handling_int = WL_NOT_HANDLING_INT; // Not handling interrupts anymore
  792. wl_disable( lp );
  793. hcf_connect( &lp->hcfCtx, HCF_DISCONNECT);
  794. }
  795. #endif /* USE_RTS */
  796. wl_unlock( lp, &flags );
  797. DBG_TRACE( DbgInfo, "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ",
  798. dev->name, dev->base_addr, dev->irq );
  799. for( i = 0; i < ETH_ALEN; i++ ) {
  800. printk( "%02X%c", dev->dev_addr[i], (( i < ( ETH_ALEN-1 )) ? ':' : '\n' ));
  801. }
  802. #if 0 //SCULL_USE_PROC /* don't waste space if unused */
  803. create_proc_read_entry( "wlags", 0, NULL, scull_read_procmem, dev );
  804. proc_mkdir("driver/wlags49", 0);
  805. proc_write("driver/wlags49/wlags49_type", write_int, &lp->wlags49_type);
  806. #endif /* SCULL_USE_PROC */
  807. DBG_LEAVE( DbgInfo );
  808. return result;
  809. hcf_failed:
  810. wl_hcf_error( dev, hcf_status );
  811. failed:
  812. DBG_ERROR( DbgInfo, "wl_insert() FAILED\n" );
  813. if ( lp->is_registered == TRUE ) {
  814. lp->is_registered = FALSE;
  815. }
  816. WL_WDS_NETDEV_DEREGISTER( lp );
  817. result = -EFAULT;
  818. DBG_LEAVE( DbgInfo );
  819. return result;
  820. } // wl_insert
  821. /*============================================================================*/
  822. /*******************************************************************************
  823. * wl_reset()
  824. *******************************************************************************
  825. *
  826. * DESCRIPTION:
  827. *
  828. * Reset the adapter.
  829. *
  830. * PARAMETERS:
  831. *
  832. * dev - a pointer to the net_device struct of the wireless device
  833. *
  834. * RETURNS:
  835. *
  836. * an HCF status code
  837. *
  838. ******************************************************************************/
  839. int wl_reset(struct net_device *dev)
  840. {
  841. struct wl_private *lp = wl_priv(dev);
  842. int hcf_status = HCF_SUCCESS;
  843. /*------------------------------------------------------------------------*/
  844. DBG_FUNC( "wl_reset" );
  845. DBG_ENTER( DbgInfo );
  846. DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
  847. DBG_PARAM( DbgInfo, "dev->base_addr", "(%#03lx)", dev->base_addr );
  848. /*
  849. * The caller should already have a lock and
  850. * disable the interrupts, we do not lock here,
  851. * nor do we enable/disable interrupts!
  852. */
  853. DBG_TRACE( DbgInfo, "Device Base Address: %#03lx\n", dev->base_addr );
  854. if ( dev->base_addr ) {
  855. /* Shutdown the adapter. */
  856. hcf_connect( &lp->hcfCtx, HCF_DISCONNECT );
  857. /* Reset the driver information. */
  858. lp->txBytes = 0;
  859. /* Connect to the adapter. */
  860. hcf_status = hcf_connect( &lp->hcfCtx, dev->base_addr );
  861. if ( hcf_status != HCF_SUCCESS && hcf_status != HCF_ERR_INCOMP_FW ) {
  862. DBG_ERROR( DbgInfo, "hcf_connect() failed, status: 0x%x\n", hcf_status );
  863. goto out;
  864. }
  865. /* Check if firmware is present, if not change state */
  866. if ( hcf_status == HCF_ERR_INCOMP_FW ) {
  867. lp->firmware_present = WL_FRIMWARE_NOT_PRESENT;
  868. }
  869. /* Initialize the portState variable */
  870. lp->portState = WVLAN_PORT_STATE_DISABLED;
  871. /* Restart the adapter. */
  872. hcf_status = wl_go( lp );
  873. if ( hcf_status != HCF_SUCCESS ) {
  874. DBG_ERROR( DbgInfo, "wl_go() failed, status: 0x%x\n", hcf_status );
  875. goto out;
  876. }
  877. /* Certain RIDs must be set before enabling the ports */
  878. wl_put_ltv_init( lp );
  879. } else {
  880. DBG_ERROR( DbgInfo, "Device Base Address INVALID!!!\n" );
  881. }
  882. out:
  883. DBG_LEAVE( DbgInfo );
  884. return hcf_status;
  885. } // wl_reset
  886. /*============================================================================*/
  887. /*******************************************************************************
  888. * wl_go()
  889. *******************************************************************************
  890. *
  891. * DESCRIPTION:
  892. *
  893. * Reset the adapter.
  894. *
  895. * PARAMETERS:
  896. *
  897. * dev - a pointer to the net_device struct of the wireless device
  898. *
  899. * RETURNS:
  900. *
  901. * an HCF status code
  902. *
  903. ******************************************************************************/
  904. int wl_go( struct wl_private *lp )
  905. {
  906. int hcf_status = HCF_SUCCESS;
  907. char *cp = NULL; //fw_image
  908. int retries = 0;
  909. /*------------------------------------------------------------------------*/
  910. DBG_FUNC( "wl_go" );
  911. DBG_ENTER( DbgInfo );
  912. hcf_status = wl_disable( lp );
  913. if ( hcf_status != HCF_SUCCESS ) {
  914. DBG_TRACE( DbgInfo, "Disable port 0 failed: 0x%x\n", hcf_status );
  915. while (( hcf_status != HCF_SUCCESS ) && (retries < 10)) {
  916. retries++;
  917. hcf_status = wl_disable( lp );
  918. }
  919. if ( hcf_status == HCF_SUCCESS ) {
  920. DBG_TRACE( DbgInfo, "Disable port 0 succes : %d retries\n", retries );
  921. } else {
  922. DBG_TRACE( DbgInfo, "Disable port 0 failed after: %d retries\n", retries );
  923. }
  924. }
  925. #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP
  926. //DBG_TRACE( DbgInfo, "Disabling WDS Ports\n" );
  927. //wl_disable_wds_ports( lp );
  928. #endif /* (HCF_TYPE) & HCF_TYPE_AP */
  929. //;?what was the purpose of this
  930. // /* load the appropriate firmware image, depending on driver mode */
  931. // lp->ltvRecord.len = ( sizeof( CFG_RANGE20_STRCT ) / sizeof( hcf_16 )) - 1;
  932. // lp->ltvRecord.typ = CFG_DRV_ACT_RANGES_PRI;
  933. // hcf_get_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  934. #if BIN_DL
  935. if ( strlen( lp->fw_image_filename ) ) {
  936. mm_segment_t fs;
  937. int file_desc;
  938. int rc;
  939. DBG_TRACE( DbgInfo, "F/W image:%s:\n", lp->fw_image_filename );
  940. /* Obtain a user-space process context, storing the original context */
  941. fs = get_fs( );
  942. set_fs( get_ds( ));
  943. file_desc = open( lp->fw_image_filename, O_RDONLY, 0 );
  944. if ( file_desc == -1 ) {
  945. DBG_ERROR( DbgInfo, "No image file found\n" );
  946. } else {
  947. DBG_TRACE( DbgInfo, "F/W image file found\n" );
  948. #define DHF_ALLOC_SIZE 96000 //just below 96K, let's hope it suffices for now and for the future
  949. cp = (char*)vmalloc( DHF_ALLOC_SIZE );
  950. if ( cp == NULL ) {
  951. DBG_ERROR( DbgInfo, "error in vmalloc\n" );
  952. } else {
  953. rc = read( file_desc, cp, DHF_ALLOC_SIZE );
  954. if ( rc == DHF_ALLOC_SIZE ) {
  955. DBG_ERROR( DbgInfo, "buffer too small, %d\n", DHF_ALLOC_SIZE );
  956. } else if ( rc > 0 ) {
  957. DBG_TRACE( DbgInfo, "read O.K.: %d bytes %.12s\n", rc, cp );
  958. rc = read( file_desc, &cp[rc], 1 );
  959. if ( rc == 0 ) { //;/change to an until-loop at rc<=0
  960. DBG_TRACE( DbgInfo, "no more to read\n" );
  961. }
  962. }
  963. if ( rc != 0 ) {
  964. DBG_ERROR( DbgInfo, "file not read in one swoop or other error"\
  965. ", give up, too complicated, rc = %0X\n", rc );
  966. DBG_ERROR( DbgInfo, "still have to change code to get a real download now !!!!!!!!\n" );
  967. } else {
  968. DBG_TRACE( DbgInfo, "before dhf_download_binary\n" );
  969. hcf_status = dhf_download_binary( (memimage *)cp );
  970. DBG_TRACE( DbgInfo, "after dhf_download_binary, before dhf_download_fw\n" );
  971. //;?improve error flow/handling
  972. hcf_status = dhf_download_fw( &lp->hcfCtx, (memimage *)cp );
  973. DBG_TRACE( DbgInfo, "after dhf_download_fw\n" );
  974. }
  975. vfree( cp );
  976. }
  977. close( file_desc );
  978. }
  979. set_fs( fs ); /* Return to the original context */
  980. }
  981. #endif // BIN_DL
  982. /* If firmware is present but the type is unknown then download anyway */
  983. if ( (lp->firmware_present == WL_FRIMWARE_PRESENT)
  984. &&
  985. ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) != COMP_ID_FW_STA )
  986. &&
  987. ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) != COMP_ID_FW_AP ) ) {
  988. /* Unknown type, download needed. */
  989. lp->firmware_present = WL_FRIMWARE_NOT_PRESENT;
  990. }
  991. if(lp->firmware_present == WL_FRIMWARE_NOT_PRESENT)
  992. {
  993. if ( cp == NULL ) {
  994. DBG_TRACE( DbgInfo, "Downloading STA firmware...\n" );
  995. // hcf_status = dhf_download_fw( &lp->hcfCtx, &station );
  996. hcf_status = dhf_download_fw( &lp->hcfCtx, &fw_image );
  997. }
  998. if ( hcf_status != HCF_SUCCESS ) {
  999. DBG_ERROR( DbgInfo, "Firmware Download failed\n" );
  1000. DBG_LEAVE( DbgInfo );
  1001. return hcf_status;
  1002. }
  1003. }
  1004. /* Report the FW versions */
  1005. //;?obsolete, use the available IFB info:: wl_get_pri_records( lp );
  1006. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) {
  1007. DBG_TRACE( DbgInfo, "downloaded station F/W\n" );
  1008. } else if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  1009. DBG_TRACE( DbgInfo, "downloaded AP F/W\n" );
  1010. } else {
  1011. DBG_ERROR( DbgInfo, "unknown F/W type\n" );
  1012. }
  1013. /*
  1014. * Downloaded, no need to repeat this next time, assume the
  1015. * contents stays in the card until it is powered off. Note we
  1016. * do not switch firmware on the fly, the firmware is fixed in
  1017. * the driver for now.
  1018. */
  1019. lp->firmware_present = WL_FRIMWARE_PRESENT;
  1020. DBG_TRACE( DbgInfo, "ComponentID:%04x variant:%04x major:%04x minor:%04x\n",
  1021. CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ),
  1022. CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.variant ),
  1023. CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.version_major ),
  1024. CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.version_minor ));
  1025. /* now we wil get the MAC address of the card */
  1026. lp->ltvRecord.len = 4;
  1027. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  1028. lp->ltvRecord.typ = CFG_NIC_MAC_ADDR;
  1029. } else
  1030. {
  1031. lp->ltvRecord.typ = CFG_CNF_OWN_MAC_ADDR;
  1032. }
  1033. hcf_status = hcf_get_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1034. if ( hcf_status != HCF_SUCCESS ) {
  1035. DBG_ERROR( DbgInfo, "Could not retrieve MAC address\n" );
  1036. DBG_LEAVE( DbgInfo );
  1037. return hcf_status;
  1038. }
  1039. memcpy( lp->MACAddress, &lp->ltvRecord.u.u8[0], ETH_ALEN );
  1040. DBG_TRACE(DbgInfo, "Card MAC Address: %pM\n", lp->MACAddress);
  1041. /* Write out configuration to the device, enable, and reconnect. However,
  1042. only reconnect if in AP mode. For STA mode, need to wait for passive scan
  1043. completion before a connect can be issued */
  1044. wl_put_ltv( lp );
  1045. /* Enable the ports */
  1046. hcf_status = wl_enable( lp );
  1047. if ( lp->DownloadFirmware == WVLAN_DRV_MODE_AP ) {
  1048. #ifdef USE_WDS
  1049. wl_enable_wds_ports( lp );
  1050. #endif // USE_WDS
  1051. hcf_status = wl_connect( lp );
  1052. }
  1053. DBG_LEAVE( DbgInfo );
  1054. return hcf_status;
  1055. } // wl_go
  1056. /*============================================================================*/
  1057. /*******************************************************************************
  1058. * wl_set_wep_keys()
  1059. *******************************************************************************
  1060. *
  1061. * DESCRIPTION:
  1062. *
  1063. * Write TxKeyID and WEP keys to the adapter. This is separated from
  1064. * wl_apply() to allow dynamic WEP key updates through the wireless
  1065. * extensions.
  1066. *
  1067. * PARAMETERS:
  1068. *
  1069. * lp - a pointer to the wireless adapter's private structure
  1070. *
  1071. * RETURNS:
  1072. *
  1073. * N/A
  1074. *
  1075. ******************************************************************************/
  1076. void wl_set_wep_keys( struct wl_private *lp )
  1077. {
  1078. int count = 0;
  1079. /*------------------------------------------------------------------------*/
  1080. DBG_FUNC( "wl_set_wep_keys" );
  1081. DBG_ENTER( DbgInfo );
  1082. DBG_PARAM( DbgInfo, "lp", "%s (0x%p)", lp->dev->name, lp );
  1083. if ( lp->EnableEncryption ) {
  1084. /* NOTE: CFG_CNF_ENCRYPTION is set in wl_put_ltv() as it's a static
  1085. RID */
  1086. /* set TxKeyID */
  1087. lp->ltvRecord.len = 2;
  1088. lp->ltvRecord.typ = CFG_TX_KEY_ID;
  1089. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE(lp->TransmitKeyID - 1);
  1090. hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1091. DBG_TRACE( DbgInfo, "Key 1 len: %d\n", lp->DefaultKeys.key[0].len );
  1092. DBG_TRACE( DbgInfo, "Key 2 len: %d\n", lp->DefaultKeys.key[1].len );
  1093. DBG_TRACE( DbgInfo, "Key 3 len: %d\n", lp->DefaultKeys.key[2].len );
  1094. DBG_TRACE( DbgInfo, "Key 4 len: %d\n", lp->DefaultKeys.key[3].len );
  1095. /* write keys */
  1096. lp->DefaultKeys.len = sizeof( lp->DefaultKeys ) / sizeof( hcf_16 ) - 1;
  1097. lp->DefaultKeys.typ = CFG_DEFAULT_KEYS;
  1098. /* endian translate the appropriate key information */
  1099. for( count = 0; count < MAX_KEYS; count++ ) {
  1100. lp->DefaultKeys.key[count].len = CNV_INT_TO_LITTLE( lp->DefaultKeys.key[count].len );
  1101. }
  1102. hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->DefaultKeys ));
  1103. /* Reverse the above endian translation, since these keys are accessed
  1104. elsewhere */
  1105. for( count = 0; count < MAX_KEYS; count++ ) {
  1106. lp->DefaultKeys.key[count].len = CNV_INT_TO_LITTLE( lp->DefaultKeys.key[count].len );
  1107. }
  1108. DBG_NOTICE( DbgInfo, "encrypt: %d, ID: %d\n", lp->EnableEncryption, lp->TransmitKeyID );
  1109. DBG_NOTICE( DbgInfo, "set key: %s(%d) [%d]\n", lp->DefaultKeys.key[lp->TransmitKeyID-1].key, lp->DefaultKeys.key[lp->TransmitKeyID-1].len, lp->TransmitKeyID-1 );
  1110. }
  1111. DBG_LEAVE( DbgInfo );
  1112. } // wl_set_wep_keys
  1113. /*============================================================================*/
  1114. /*******************************************************************************
  1115. * wl_apply()
  1116. *******************************************************************************
  1117. *
  1118. * DESCRIPTION:
  1119. *
  1120. * Write the parameters to the adapter. (re-)enables the card if device is
  1121. * open. Returns hcf_status of hcf_enable().
  1122. *
  1123. * PARAMETERS:
  1124. *
  1125. * lp - a pointer to the wireless adapter's private structure
  1126. *
  1127. * RETURNS:
  1128. *
  1129. * an HCF status code
  1130. *
  1131. ******************************************************************************/
  1132. int wl_apply(struct wl_private *lp)
  1133. {
  1134. int hcf_status = HCF_SUCCESS;
  1135. /*------------------------------------------------------------------------*/
  1136. DBG_FUNC( "wl_apply" );
  1137. DBG_ENTER( DbgInfo );
  1138. DBG_ASSERT( lp != NULL);
  1139. DBG_PARAM( DbgInfo, "lp", "%s (0x%p)", lp->dev->name, lp );
  1140. if ( !( lp->flags & WVLAN2_UIL_BUSY )) {
  1141. /* The adapter parameters have changed:
  1142. disable card
  1143. reload parameters
  1144. enable card
  1145. */
  1146. if ( wl_adapter_is_open( lp->dev )) {
  1147. /* Disconnect and disable if necessary */
  1148. hcf_status = wl_disconnect( lp );
  1149. if ( hcf_status != HCF_SUCCESS ) {
  1150. DBG_ERROR( DbgInfo, "Disconnect failed\n" );
  1151. DBG_LEAVE( DbgInfo );
  1152. return -1;
  1153. }
  1154. hcf_status = wl_disable( lp );
  1155. if ( hcf_status != HCF_SUCCESS ) {
  1156. DBG_ERROR( DbgInfo, "Disable failed\n" );
  1157. DBG_LEAVE( DbgInfo );
  1158. return -1;
  1159. } else {
  1160. /* Write out configuration to the device, enable, and reconnect.
  1161. However, only reconnect if in AP mode. For STA mode, need to
  1162. wait for passive scan completion before a connect can be
  1163. issued */
  1164. hcf_status = wl_put_ltv( lp );
  1165. if ( hcf_status == HCF_SUCCESS ) {
  1166. hcf_status = wl_enable( lp );
  1167. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  1168. hcf_status = wl_connect( lp );
  1169. }
  1170. } else {
  1171. DBG_WARNING( DbgInfo, "wl_put_ltv() failed\n" );
  1172. }
  1173. }
  1174. }
  1175. }
  1176. DBG_LEAVE( DbgInfo );
  1177. return hcf_status;
  1178. } // wl_apply
  1179. /*============================================================================*/
  1180. /*******************************************************************************
  1181. * wl_put_ltv_init()
  1182. *******************************************************************************
  1183. *
  1184. * DESCRIPTION:
  1185. *
  1186. * Used to set basic parameters for card initialization.
  1187. *
  1188. * PARAMETERS:
  1189. *
  1190. * lp - a pointer to the wireless adapter's private structure
  1191. *
  1192. * RETURNS:
  1193. *
  1194. * an HCF status code
  1195. *
  1196. ******************************************************************************/
  1197. int wl_put_ltv_init( struct wl_private *lp )
  1198. {
  1199. int i;
  1200. int hcf_status;
  1201. CFG_RID_LOG_STRCT *RidLog;
  1202. /*------------------------------------------------------------------------*/
  1203. DBG_FUNC( "wl_put_ltv_init" );
  1204. DBG_ENTER( DbgInfo );
  1205. if ( lp == NULL ) {
  1206. DBG_ERROR( DbgInfo, "lp pointer is NULL\n" );
  1207. DBG_LEAVE( DbgInfo );
  1208. return -1;
  1209. }
  1210. /* DMA/IO */
  1211. lp->ltvRecord.len = 2;
  1212. lp->ltvRecord.typ = CFG_CNTL_OPT;
  1213. /* The Card Services build must ALWAYS configure for 16-bit I/O. PCI or
  1214. CardBus can be set to either 16/32 bit I/O, or Bus Master DMA, but only
  1215. for Hermes-2.5 */
  1216. #ifdef BUS_PCMCIA
  1217. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( USE_16BIT );
  1218. #else
  1219. if ( lp->use_dma ) {
  1220. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( USE_DMA );
  1221. } else {
  1222. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 );
  1223. }
  1224. #endif
  1225. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1226. DBG_TRACE( DbgInfo, "CFG_CNTL_OPT : 0x%04x\n",
  1227. lp->ltvRecord.u.u16[0] );
  1228. DBG_TRACE( DbgInfo, "CFG_CNTL_OPT result : 0x%04x\n",
  1229. hcf_status );
  1230. /* Register the list of RIDs on which asynchronous notification is
  1231. required. Note that this mechanism replaces the mailbox, so the mailbox
  1232. can be queried by the host (if desired) without contention from us */
  1233. i=0;
  1234. lp->RidList[i].len = sizeof( lp->ProbeResp );
  1235. lp->RidList[i].typ = CFG_ACS_SCAN;
  1236. lp->RidList[i].bufp = (wci_recordp)&lp->ProbeResp;
  1237. //lp->ProbeResp.infoType = 0xFFFF;
  1238. i++;
  1239. lp->RidList[i].len = sizeof( lp->assoc_stat );
  1240. lp->RidList[i].typ = CFG_ASSOC_STAT;
  1241. lp->RidList[i].bufp = (wci_recordp)&lp->assoc_stat;
  1242. lp->assoc_stat.len = 0xFFFF;
  1243. i++;
  1244. lp->RidList[i].len = 4;
  1245. lp->RidList[i].typ = CFG_UPDATED_INFO_RECORD;
  1246. lp->RidList[i].bufp = (wci_recordp)&lp->updatedRecord;
  1247. lp->updatedRecord.len = 0xFFFF;
  1248. i++;
  1249. lp->RidList[i].len = sizeof( lp->sec_stat );
  1250. lp->RidList[i].typ = CFG_SECURITY_STAT;
  1251. lp->RidList[i].bufp = (wci_recordp)&lp->sec_stat;
  1252. lp->sec_stat.len = 0xFFFF;
  1253. i++;
  1254. lp->RidList[i].typ = 0; // Terminate List
  1255. RidLog = (CFG_RID_LOG_STRCT *)&lp->ltvRecord;
  1256. RidLog->len = 3;
  1257. RidLog->typ = CFG_REG_INFO_LOG;
  1258. RidLog->recordp = (RID_LOGP)&lp->RidList[0];
  1259. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1260. DBG_TRACE( DbgInfo, "CFG_REG_INFO_LOG\n" );
  1261. DBG_TRACE( DbgInfo, "CFG_REG_INFO_LOG result : 0x%04x\n",
  1262. hcf_status );
  1263. DBG_LEAVE( DbgInfo );
  1264. return hcf_status;
  1265. } // wl_put_ltv_init
  1266. /*============================================================================*/
  1267. /*******************************************************************************
  1268. * wl_put_ltv()
  1269. *******************************************************************************
  1270. *
  1271. * DESCRIPTION:
  1272. *
  1273. * Used by wvlan_apply() and wvlan_go to set the card's configuration.
  1274. *
  1275. * PARAMETERS:
  1276. *
  1277. * lp - a pointer to the wireless adapter's private structure
  1278. *
  1279. * RETURNS:
  1280. *
  1281. * an HCF status code
  1282. *
  1283. ******************************************************************************/
  1284. int wl_put_ltv( struct wl_private *lp )
  1285. {
  1286. int len;
  1287. int hcf_status;
  1288. /*------------------------------------------------------------------------*/
  1289. DBG_FUNC( "wl_put_ltv" );
  1290. DBG_ENTER( DbgInfo );
  1291. if ( lp == NULL ) {
  1292. DBG_ERROR( DbgInfo, "lp pointer is NULL\n" );
  1293. return -1;
  1294. }
  1295. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  1296. lp->maxPort = 6; //;?why set this here and not as part of download process
  1297. } else {
  1298. lp->maxPort = 0;
  1299. }
  1300. /* Send our configuration to the card. Perform any endian translation
  1301. necessary */
  1302. /* Register the Mailbox; VxWorks does this elsewhere; why;? */
  1303. lp->ltvRecord.len = 4;
  1304. lp->ltvRecord.typ = CFG_REG_MB;
  1305. lp->ltvRecord.u.u32[0] = (u_long)&( lp->mailbox );
  1306. lp->ltvRecord.u.u16[2] = ( MB_SIZE / sizeof( hcf_16 ));
  1307. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1308. /* Max Data Length */
  1309. lp->ltvRecord.len = 2;
  1310. lp->ltvRecord.typ = CFG_CNF_MAX_DATA_LEN;
  1311. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( HCF_MAX_PACKET_SIZE );
  1312. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1313. /* System Scale / Distance between APs */
  1314. lp->ltvRecord.len = 2;
  1315. lp->ltvRecord.typ = CFG_CNF_SYSTEM_SCALE;
  1316. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->DistanceBetweenAPs );
  1317. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1318. /* Channel */
  1319. if ( lp->CreateIBSS && ( lp->Channel == 0 )) {
  1320. DBG_TRACE( DbgInfo, "Create IBSS" );
  1321. lp->Channel = 10;
  1322. }
  1323. lp->ltvRecord.len = 2;
  1324. lp->ltvRecord.typ = CFG_CNF_OWN_CHANNEL;
  1325. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->Channel );
  1326. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1327. /* Microwave Robustness */
  1328. lp->ltvRecord.len = 2;
  1329. lp->ltvRecord.typ = CFG_CNF_MICRO_WAVE;
  1330. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MicrowaveRobustness );
  1331. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1332. /* Load Balancing */
  1333. lp->ltvRecord.len = 2;
  1334. lp->ltvRecord.typ = CFG_CNF_LOAD_BALANCING;
  1335. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->loadBalancing );
  1336. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1337. /* Medium Distribution */
  1338. lp->ltvRecord.len = 2;
  1339. lp->ltvRecord.typ = CFG_CNF_MEDIUM_DISTRIBUTION;
  1340. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->mediumDistribution );
  1341. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1342. /* Country Code */
  1343. #ifdef WARP
  1344. /* Tx Power Level (for supported cards) */
  1345. lp->ltvRecord.len = 2;
  1346. lp->ltvRecord.typ = CFG_CNF_TX_POW_LVL;
  1347. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->txPowLevel );
  1348. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1349. /* Short Retry Limit */
  1350. /*lp->ltvRecord.len = 2;
  1351. lp->ltvRecord.typ = 0xFC32;
  1352. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->shortRetryLimit );
  1353. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1354. */
  1355. /* Long Retry Limit */
  1356. /*lp->ltvRecord.len = 2;
  1357. lp->ltvRecord.typ = 0xFC33;
  1358. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->longRetryLimit );
  1359. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1360. */
  1361. /* Supported Rate Set Control */
  1362. lp->ltvRecord.len = 3;
  1363. lp->ltvRecord.typ = CFG_SUPPORTED_RATE_SET_CNTL; //0xFC88;
  1364. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->srsc[0] );
  1365. lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->srsc[1] );
  1366. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1367. /* Basic Rate Set Control */
  1368. lp->ltvRecord.len = 3;
  1369. lp->ltvRecord.typ = CFG_BASIC_RATE_SET_CNTL; //0xFC89;
  1370. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->brsc[0] );
  1371. lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->brsc[1] );
  1372. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1373. /* Frame Burst Limit */
  1374. /* Defined, but not currently available in Firmware */
  1375. #endif // WARP
  1376. #ifdef WARP
  1377. /* Multicast Rate */
  1378. lp->ltvRecord.len = 3;
  1379. lp->ltvRecord.typ = CFG_CNF_MCAST_RATE;
  1380. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MulticastRate[0] );
  1381. lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->MulticastRate[1] );
  1382. #else
  1383. lp->ltvRecord.len = 2;
  1384. lp->ltvRecord.typ = CFG_CNF_MCAST_RATE;
  1385. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MulticastRate[0] );
  1386. #endif // WARP
  1387. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1388. /* Own Name (Station Nickname) */
  1389. if (( len = ( strlen( lp->StationName ) + 1 ) & ~0x01 ) != 0 ) {
  1390. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME : %s\n",
  1391. // lp->StationName );
  1392. lp->ltvRecord.len = 2 + ( len / sizeof( hcf_16 ));
  1393. lp->ltvRecord.typ = CFG_CNF_OWN_NAME;
  1394. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( strlen( lp->StationName ));
  1395. memcpy( &( lp->ltvRecord.u.u8[2] ), lp->StationName, len );
  1396. } else {
  1397. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME : EMPTY\n" );
  1398. lp->ltvRecord.len = 2;
  1399. lp->ltvRecord.typ = CFG_CNF_OWN_NAME;
  1400. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 );
  1401. }
  1402. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1403. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_NAME result : 0x%04x\n",
  1404. // hcf_status );
  1405. /* The following are set in STA mode only */
  1406. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) {
  1407. /* RTS Threshold */
  1408. lp->ltvRecord.len = 2;
  1409. lp->ltvRecord.typ = CFG_RTS_THRH;
  1410. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->RTSThreshold );
  1411. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1412. /* Port Type */
  1413. lp->ltvRecord.len = 2;
  1414. lp->ltvRecord.typ = CFG_CNF_PORT_TYPE;
  1415. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->PortType );
  1416. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1417. /* Tx Rate Control */
  1418. #ifdef WARP
  1419. lp->ltvRecord.len = 3;
  1420. lp->ltvRecord.typ = CFG_TX_RATE_CNTL;
  1421. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] );
  1422. lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->TxRateControl[1] );
  1423. #else
  1424. lp->ltvRecord.len = 2;
  1425. lp->ltvRecord.typ = CFG_TX_RATE_CNTL;
  1426. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] );
  1427. #endif // WARP
  1428. //;?skip temporarily to see whether the RID or something else is the probelm hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1429. DBG_TRACE( DbgInfo, "CFG_TX_RATE_CNTL 2.4GHz : 0x%04x\n",
  1430. lp->TxRateControl[0] );
  1431. DBG_TRACE( DbgInfo, "CFG_TX_RATE_CNTL 5.0GHz : 0x%04x\n",
  1432. lp->TxRateControl[1] );
  1433. DBG_TRACE( DbgInfo, "CFG_TX_RATE_CNTL result : 0x%04x\n",
  1434. hcf_status );
  1435. /* Power Management */
  1436. lp->ltvRecord.len = 2;
  1437. lp->ltvRecord.typ = CFG_CNF_PM_ENABLED;
  1438. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->PMEnabled );
  1439. // lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0x8001 );
  1440. DBG_TRACE( DbgInfo, "CFG_CNF_PM_ENABLED : 0x%04x\n", lp->PMEnabled );
  1441. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1442. /* Multicast Receive */
  1443. lp->ltvRecord.len = 2;
  1444. lp->ltvRecord.typ = CFG_CNF_MCAST_RX;
  1445. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MulticastReceive );
  1446. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1447. /* Max Sleep Duration */
  1448. lp->ltvRecord.len = 2;
  1449. lp->ltvRecord.typ = CFG_CNF_MAX_SLEEP_DURATION;
  1450. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->MaxSleepDuration );
  1451. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1452. /* Create IBSS */
  1453. lp->ltvRecord.len = 2;
  1454. lp->ltvRecord.typ = CFG_CREATE_IBSS;
  1455. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->CreateIBSS );
  1456. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1457. /* Desired SSID */
  1458. if ((( len = ( strlen( lp->NetworkName ) + 1 ) & ~0x01 ) != 0 ) &&
  1459. ( strcmp( lp->NetworkName, "ANY" ) != 0 ) &&
  1460. ( strcmp( lp->NetworkName, "any" ) != 0 )) {
  1461. //DBG_TRACE( DbgInfo, "CFG_DESIRED_SSID : %s\n",
  1462. // lp->NetworkName );
  1463. lp->ltvRecord.len = 2 + (len / sizeof(hcf_16));
  1464. lp->ltvRecord.typ = CFG_DESIRED_SSID;
  1465. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( strlen( lp->NetworkName ));
  1466. memcpy( &( lp->ltvRecord.u.u8[2] ), lp->NetworkName, len );
  1467. } else {
  1468. //DBG_TRACE( DbgInfo, "CFG_DESIRED_SSID : ANY\n" );
  1469. lp->ltvRecord.len = 2;
  1470. lp->ltvRecord.typ = CFG_DESIRED_SSID;
  1471. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 );
  1472. }
  1473. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1474. //DBG_TRACE( DbgInfo, "CFG_DESIRED_SSID result : 0x%04x\n",
  1475. // hcf_status );
  1476. /* Own ATIM window */
  1477. lp->ltvRecord.len = 2;
  1478. lp->ltvRecord.typ = CFG_CNF_OWN_ATIM_WINDOW;
  1479. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->atimWindow );
  1480. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1481. /* Holdover Duration */
  1482. lp->ltvRecord.len = 2;
  1483. lp->ltvRecord.typ = CFG_CNF_HOLDOVER_DURATION;
  1484. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->holdoverDuration );
  1485. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1486. /* Promiscuous Mode */
  1487. lp->ltvRecord.len = 2;
  1488. lp->ltvRecord.typ = CFG_PROMISCUOUS_MODE;
  1489. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->promiscuousMode );
  1490. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1491. /* Authentication */
  1492. lp->ltvRecord.len = 2;
  1493. lp->ltvRecord.typ = CFG_CNF_AUTHENTICATION;
  1494. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->authentication );
  1495. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1496. #ifdef WARP
  1497. /* Connection Control */
  1498. lp->ltvRecord.len = 2;
  1499. lp->ltvRecord.typ = CFG_CNF_CONNECTION_CNTL;
  1500. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->connectionControl );
  1501. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1502. /* Probe data rate */
  1503. /*lp->ltvRecord.len = 3;
  1504. lp->ltvRecord.typ = CFG_PROBE_DATA_RATE;
  1505. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->probeDataRates[0] );
  1506. lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->probeDataRates[1] );
  1507. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1508. DBG_TRACE( DbgInfo, "CFG_PROBE_DATA_RATE 2.4GHz : 0x%04x\n",
  1509. lp->probeDataRates[0] );
  1510. DBG_TRACE( DbgInfo, "CFG_PROBE_DATA_RATE 5.0GHz : 0x%04x\n",
  1511. lp->probeDataRates[1] );
  1512. DBG_TRACE( DbgInfo, "CFG_PROBE_DATA_RATE result : 0x%04x\n",
  1513. hcf_status );*/
  1514. #endif // WARP
  1515. } else {
  1516. /* The following are set in AP mode only */
  1517. #if 0 //;? (HCF_TYPE) & HCF_TYPE_AP
  1518. //;?should we restore this to allow smaller memory footprint
  1519. /* DTIM Period */
  1520. lp->ltvRecord.len = 2;
  1521. lp->ltvRecord.typ = CFG_CNF_OWN_DTIM_PERIOD;
  1522. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->DTIMPeriod );
  1523. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1524. /* Multicast PM Buffering */
  1525. lp->ltvRecord.len = 2;
  1526. lp->ltvRecord.typ = CFG_CNF_MCAST_PM_BUF;
  1527. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->multicastPMBuffering );
  1528. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1529. /* Reject ANY - Closed System */
  1530. lp->ltvRecord.len = 2;
  1531. lp->ltvRecord.typ = CFG_CNF_REJECT_ANY;
  1532. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->RejectAny );
  1533. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1534. /* Exclude Unencrypted */
  1535. lp->ltvRecord.len = 2;
  1536. lp->ltvRecord.typ = CFG_CNF_EXCL_UNENCRYPTED;
  1537. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ExcludeUnencrypted );
  1538. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1539. /* IntraBSS Relay */
  1540. lp->ltvRecord.len = 2;
  1541. lp->ltvRecord.typ = CFG_CNF_INTRA_BSS_RELAY;
  1542. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->intraBSSRelay );
  1543. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1544. /* RTS Threshold 0 */
  1545. lp->ltvRecord.len = 2;
  1546. lp->ltvRecord.typ = CFG_RTS_THRH0;
  1547. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->RTSThreshold );
  1548. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1549. /* Tx Rate Control 0 */
  1550. #ifdef WARP
  1551. lp->ltvRecord.len = 3;
  1552. lp->ltvRecord.typ = CFG_TX_RATE_CNTL0;
  1553. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] );
  1554. lp->ltvRecord.u.u16[1] = CNV_INT_TO_LITTLE( lp->TxRateControl[1] );
  1555. #else
  1556. lp->ltvRecord.len = 2;
  1557. lp->ltvRecord.typ = CFG_TX_RATE_CNTL0;
  1558. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->TxRateControl[0] );
  1559. #endif // WARP
  1560. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1561. /* Own Beacon Interval */
  1562. lp->ltvRecord.len = 2;
  1563. lp->ltvRecord.typ = 0xFC31;
  1564. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->ownBeaconInterval );
  1565. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1566. /* Co-Existence Behavior */
  1567. lp->ltvRecord.len = 2;
  1568. lp->ltvRecord.typ = 0xFCC7;
  1569. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->coexistence );
  1570. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1571. #ifdef USE_WDS
  1572. /* RTS Threshold 1 */
  1573. lp->ltvRecord.len = 2;
  1574. lp->ltvRecord.typ = CFG_RTS_THRH1;
  1575. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[0].rtsThreshold );
  1576. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1577. /* RTS Threshold 2 */
  1578. lp->ltvRecord.len = 2;
  1579. lp->ltvRecord.typ = CFG_RTS_THRH2;
  1580. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[1].rtsThreshold );
  1581. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1582. /* RTS Threshold 3 */
  1583. lp->ltvRecord.len = 2;
  1584. lp->ltvRecord.typ = CFG_RTS_THRH3;
  1585. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[2].rtsThreshold );
  1586. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1587. /* RTS Threshold 4 */
  1588. lp->ltvRecord.len = 2;
  1589. lp->ltvRecord.typ = CFG_RTS_THRH4;
  1590. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[3].rtsThreshold );
  1591. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1592. /* RTS Threshold 5 */
  1593. lp->ltvRecord.len = 2;
  1594. lp->ltvRecord.typ = CFG_RTS_THRH5;
  1595. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[4].rtsThreshold );
  1596. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1597. /* RTS Threshold 6 */
  1598. lp->ltvRecord.len = 2;
  1599. lp->ltvRecord.typ = CFG_RTS_THRH6;
  1600. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[5].rtsThreshold );
  1601. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1602. #if 0
  1603. /* TX Rate Control 1 */
  1604. lp->ltvRecord.len = 2;
  1605. lp->ltvRecord.typ = CFG_TX_RATE_CNTL1;
  1606. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[0].txRateCntl );
  1607. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1608. /* TX Rate Control 2 */
  1609. lp->ltvRecord.len = 2;
  1610. lp->ltvRecord.typ = CFG_TX_RATE_CNTL2;
  1611. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[1].txRateCntl );
  1612. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1613. /* TX Rate Control 3 */
  1614. lp->ltvRecord.len = 2;
  1615. lp->ltvRecord.typ = CFG_TX_RATE_CNTL3;
  1616. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[2].txRateCntl );
  1617. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1618. /* TX Rate Control 4 */
  1619. lp->ltvRecord.len = 2;
  1620. lp->ltvRecord.typ = CFG_TX_RATE_CNTL4;
  1621. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[3].txRateCntl );
  1622. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1623. /* TX Rate Control 5 */
  1624. lp->ltvRecord.len = 2;
  1625. lp->ltvRecord.typ = CFG_TX_RATE_CNTL5;
  1626. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[4].txRateCntl );
  1627. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1628. /* TX Rate Control 6 */
  1629. lp->ltvRecord.len = 2;
  1630. lp->ltvRecord.typ = CFG_TX_RATE_CNTL6;
  1631. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->wds_port[5].txRateCntl );
  1632. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1633. #endif
  1634. /* WDS addresses. It's okay to blindly send these parameters, because
  1635. the port needs to be enabled, before anything is done with it. */
  1636. /* WDS Address 1 */
  1637. lp->ltvRecord.len = 4;
  1638. lp->ltvRecord.typ = CFG_CNF_WDS_ADDR1;
  1639. memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[0].wdsAddress, ETH_ALEN );
  1640. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1641. /* WDS Address 2 */
  1642. lp->ltvRecord.len = 4;
  1643. lp->ltvRecord.typ = CFG_CNF_WDS_ADDR2;
  1644. memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[1].wdsAddress, ETH_ALEN );
  1645. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1646. /* WDS Address 3 */
  1647. lp->ltvRecord.len = 4;
  1648. lp->ltvRecord.typ = CFG_CNF_WDS_ADDR3;
  1649. memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[2].wdsAddress, ETH_ALEN );
  1650. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1651. /* WDS Address 4 */
  1652. lp->ltvRecord.len = 4;
  1653. lp->ltvRecord.typ = CFG_CNF_WDS_ADDR4;
  1654. memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[3].wdsAddress, ETH_ALEN );
  1655. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1656. /* WDS Address 5 */
  1657. lp->ltvRecord.len = 4;
  1658. lp->ltvRecord.typ = CFG_CNF_WDS_ADDR5;
  1659. memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[4].wdsAddress, ETH_ALEN );
  1660. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1661. /* WDS Address 6 */
  1662. lp->ltvRecord.len = 4;
  1663. lp->ltvRecord.typ = CFG_CNF_WDS_ADDR6;
  1664. memcpy( &lp->ltvRecord.u.u8[0], lp->wds_port[5].wdsAddress, ETH_ALEN );
  1665. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1666. #endif /* USE_WDS */
  1667. #endif /* (HCF_TYPE) & HCF_TYPE_AP */
  1668. }
  1669. /* Own MAC Address */
  1670. /*
  1671. DBG_TRACE(DbgInfo, "MAC Address : %pM\n",
  1672. lp->MACAddress);
  1673. */
  1674. if ( WVLAN_VALID_MAC_ADDRESS( lp->MACAddress )) {
  1675. /* Make the MAC address valid by:
  1676. Clearing the multicast bit
  1677. Setting the local MAC address bit
  1678. */
  1679. //lp->MACAddress[0] &= ~0x03; //;?why is this commented out already in 720
  1680. //lp->MACAddress[0] |= 0x02;
  1681. lp->ltvRecord.len = 1 + ( ETH_ALEN / sizeof( hcf_16 ));
  1682. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  1683. //DBG_TRACE( DbgInfo, "CFG_NIC_MAC_ADDR\n" );
  1684. lp->ltvRecord.typ = CFG_NIC_MAC_ADDR;
  1685. } else {
  1686. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_MAC_ADDR\n" );
  1687. lp->ltvRecord.typ = CFG_CNF_OWN_MAC_ADDR;
  1688. }
  1689. /* MAC address is byte aligned, no endian conversion needed */
  1690. memcpy( &( lp->ltvRecord.u.u8[0] ), lp->MACAddress, ETH_ALEN );
  1691. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1692. //DBG_TRACE( DbgInfo, "CFG_XXX_MAC_ADDR result : 0x%04x\n",
  1693. // hcf_status );
  1694. /* Update the MAC address in the netdevice struct */
  1695. memcpy( lp->dev->dev_addr, lp->MACAddress, ETH_ALEN ); //;?what is the purpose of this seemingly complex logic
  1696. }
  1697. /* Own SSID */
  1698. if ((( len = ( strlen( lp->NetworkName ) + 1 ) & ~0x01 ) != 0 ) &&
  1699. ( strcmp( lp->NetworkName, "ANY" ) != 0 ) &&
  1700. ( strcmp( lp->NetworkName, "any" ) != 0 )) {
  1701. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_SSID : %s\n",
  1702. // lp->NetworkName );
  1703. lp->ltvRecord.len = 2 + (len / sizeof(hcf_16));
  1704. lp->ltvRecord.typ = CFG_CNF_OWN_SSID;
  1705. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( strlen( lp->NetworkName ));
  1706. memcpy( &( lp->ltvRecord.u.u8[2] ), lp->NetworkName, len );
  1707. } else {
  1708. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_SSID : ANY\n" );
  1709. lp->ltvRecord.len = 2;
  1710. lp->ltvRecord.typ = CFG_CNF_OWN_SSID;
  1711. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( 0 );
  1712. }
  1713. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1714. //DBG_TRACE( DbgInfo, "CFG_CNF_OWN_SSID result : 0x%04x\n",
  1715. // hcf_status );
  1716. /* enable/disable encryption */
  1717. lp->ltvRecord.len = 2;
  1718. lp->ltvRecord.typ = CFG_CNF_ENCRYPTION;
  1719. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->EnableEncryption );
  1720. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1721. /* Set the Authentication Key Management Suite */
  1722. lp->ltvRecord.len = 2;
  1723. lp->ltvRecord.typ = CFG_SET_WPA_AUTH_KEY_MGMT_SUITE;
  1724. lp->ltvRecord.u.u16[0] = CNV_INT_TO_LITTLE( lp->AuthKeyMgmtSuite );
  1725. hcf_status = hcf_put_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  1726. /* WEP Keys */
  1727. wl_set_wep_keys( lp );
  1728. /* Country Code */
  1729. /* countryInfo, ltvCountryInfo, CFG_CNF_COUNTRY_INFO */
  1730. DBG_LEAVE( DbgInfo );
  1731. return hcf_status;
  1732. } // wl_put_ltv
  1733. /*============================================================================*/
  1734. /*******************************************************************************
  1735. * init_module()
  1736. *******************************************************************************
  1737. *
  1738. * DESCRIPTION:
  1739. *
  1740. * Load the kernel module.
  1741. *
  1742. * PARAMETERS:
  1743. *
  1744. * N/A
  1745. *
  1746. * RETURNS:
  1747. *
  1748. * 0 on success
  1749. * an errno value otherwise
  1750. *
  1751. ******************************************************************************/
  1752. static int __init wl_module_init( void )
  1753. {
  1754. int result;
  1755. /*------------------------------------------------------------------------*/
  1756. DBG_FUNC( "wl_module_init" );
  1757. #if DBG
  1758. /* Convert "standard" PCMCIA parameter pc_debug to a reasonable DebugFlag value.
  1759. * NOTE: The values all fall through to the lower values. */
  1760. DbgInfo->DebugFlag = 0;
  1761. DbgInfo->DebugFlag = DBG_TRACE_ON; //;?get this mess resolved one day
  1762. if ( pc_debug ) switch( pc_debug ) {
  1763. case 8:
  1764. DbgInfo->DebugFlag |= DBG_DS_ON;
  1765. case 7:
  1766. DbgInfo->DebugFlag |= DBG_RX_ON | DBG_TX_ON;
  1767. case 6:
  1768. DbgInfo->DebugFlag |= DBG_PARAM_ON;
  1769. case 5:
  1770. DbgInfo->DebugFlag |= DBG_TRACE_ON;
  1771. case 4:
  1772. DbgInfo->DebugFlag |= DBG_VERBOSE_ON;
  1773. case 1:
  1774. DbgInfo->DebugFlag |= DBG_DEFAULTS;
  1775. default:
  1776. break;
  1777. }
  1778. #endif /* DBG */
  1779. DBG_ENTER( DbgInfo );
  1780. printk(KERN_INFO "%s\n", VERSION_INFO);
  1781. printk(KERN_INFO "*** Modified for kernel 2.6 by Henk de Groot <pe1dnn@amsat.org>\n");
  1782. printk(KERN_INFO "*** Based on 7.18 version by Andrey Borzenkov <arvidjaar@mail.ru> $Revision: 39 $\n");
  1783. // ;?#if (HCF_TYPE) & HCF_TYPE_AP
  1784. // DBG_PRINT( "Access Point Mode (AP) Support: YES\n" );
  1785. // #else
  1786. // DBG_PRINT( "Access Point Mode (AP) Support: NO\n" );
  1787. // #endif /* (HCF_TYPE) & HCF_TYPE_AP */
  1788. result = wl_adapter_init_module( );
  1789. DBG_LEAVE( DbgInfo );
  1790. return result;
  1791. } // init_module
  1792. /*============================================================================*/
  1793. /*******************************************************************************
  1794. * cleanup_module()
  1795. *******************************************************************************
  1796. *
  1797. * DESCRIPTION:
  1798. *
  1799. * Unload the kernel module.
  1800. *
  1801. * PARAMETERS:
  1802. *
  1803. * N/A
  1804. *
  1805. * RETURNS:
  1806. *
  1807. * N/A
  1808. *
  1809. ******************************************************************************/
  1810. static void __exit wl_module_exit( void )
  1811. {
  1812. DBG_FUNC( "wl_module_exit" );
  1813. DBG_ENTER(DbgInfo);
  1814. wl_adapter_cleanup_module( );
  1815. #if 0 //SCULL_USE_PROC /* don't waste space if unused */
  1816. remove_proc_entry( "wlags", NULL ); //;?why so a-symmetric compared to location of create_proc_read_entry
  1817. #endif
  1818. DBG_LEAVE( DbgInfo );
  1819. return;
  1820. } // cleanup_module
  1821. /*============================================================================*/
  1822. module_init(wl_module_init);
  1823. module_exit(wl_module_exit);
  1824. /*******************************************************************************
  1825. * wl_isr()
  1826. *******************************************************************************
  1827. *
  1828. * DESCRIPTION:
  1829. *
  1830. * The Interrupt Service Routine for the driver.
  1831. *
  1832. * PARAMETERS:
  1833. *
  1834. * irq - the irq the interrupt came in on
  1835. * dev_id - a buffer containing information about the request
  1836. * regs -
  1837. *
  1838. * RETURNS:
  1839. *
  1840. * N/A
  1841. *
  1842. ******************************************************************************/
  1843. irqreturn_t wl_isr( int irq, void *dev_id, struct pt_regs *regs )
  1844. {
  1845. int events;
  1846. struct net_device *dev = (struct net_device *) dev_id;
  1847. struct wl_private *lp = NULL;
  1848. /*------------------------------------------------------------------------*/
  1849. if (( dev == NULL ) || ( !netif_device_present( dev ))) {
  1850. return IRQ_NONE;
  1851. }
  1852. /* Set the wl_private pointer (lp), now that we know that dev is non-null */
  1853. lp = wl_priv(dev);
  1854. #ifdef USE_RTS
  1855. if ( lp->useRTS == 1 ) {
  1856. DBG_PRINT( "EXITING ISR, IN RTS MODE...\n" );
  1857. return;
  1858. }
  1859. #endif /* USE_RTS */
  1860. /* If we have interrupts pending, then put them on a system task
  1861. queue. Otherwise turn interrupts back on */
  1862. events = hcf_action( &lp->hcfCtx, HCF_ACT_INT_OFF );
  1863. if ( events == HCF_INT_PENDING ) {
  1864. /* Schedule the ISR handler as a bottom-half task in the
  1865. tq_immediate queue */
  1866. tasklet_schedule(&lp->task);
  1867. } else {
  1868. //DBG_PRINT( "NOT OUR INTERRUPT\n" );
  1869. hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON );
  1870. }
  1871. return IRQ_RETVAL(events == HCF_INT_PENDING);
  1872. } // wl_isr
  1873. /*============================================================================*/
  1874. /*******************************************************************************
  1875. * wl_isr_handler()
  1876. *******************************************************************************
  1877. *
  1878. * DESCRIPTION:
  1879. *
  1880. * The ISR handler, scheduled to run in a deferred context by the ISR. This
  1881. * is where the ISR's work actually gets done.
  1882. *
  1883. * PARAMETERS:
  1884. *
  1885. * lp - a pointer to the device's private adapter structure
  1886. *
  1887. * RETURNS:
  1888. *
  1889. * N/A
  1890. *
  1891. ******************************************************************************/
  1892. #define WVLAN_MAX_INT_SERVICES 50
  1893. void wl_isr_handler( unsigned long p )
  1894. {
  1895. struct net_device *dev;
  1896. unsigned long flags;
  1897. bool_t stop = TRUE;
  1898. int count;
  1899. int result;
  1900. struct wl_private *lp = (struct wl_private *)p;
  1901. /*------------------------------------------------------------------------*/
  1902. if ( lp == NULL ) {
  1903. DBG_PRINT( "wl_isr_handler lp adapter pointer is NULL!!!\n" );
  1904. } else {
  1905. wl_lock( lp, &flags );
  1906. dev = (struct net_device *)lp->dev;
  1907. if ( dev != NULL && netif_device_present( dev ) ) stop = FALSE;
  1908. for( count = 0; stop == FALSE && count < WVLAN_MAX_INT_SERVICES; count++ ) {
  1909. stop = TRUE;
  1910. result = hcf_service_nic( &lp->hcfCtx,
  1911. (wci_bufp)lp->lookAheadBuf,
  1912. sizeof( lp->lookAheadBuf ));
  1913. if ( result == HCF_ERR_MIC ) {
  1914. wl_wext_event_mic_failed( dev ); /* Send an event that MIC failed */
  1915. //;?this seems wrong if HCF_ERR_MIC coincides with another event, stop gets FALSE
  1916. //so why not do it always ;?
  1917. }
  1918. #ifndef USE_MBOX_SYNC
  1919. if ( lp->hcfCtx.IFB_MBInfoLen != 0 ) { /* anything in the mailbox */
  1920. wl_mbx( lp );
  1921. stop = FALSE;
  1922. }
  1923. #endif
  1924. /* Check for a Link status event */
  1925. if ( ( lp->hcfCtx.IFB_LinkStat & CFG_LINK_STAT_FW ) != 0 ) {
  1926. wl_process_link_status( lp );
  1927. stop = FALSE;
  1928. }
  1929. /* Check for probe response events */
  1930. if ( lp->ProbeResp.infoType != 0 &&
  1931. lp->ProbeResp.infoType != 0xFFFF ) {
  1932. wl_process_probe_response( lp );
  1933. memset( &lp->ProbeResp, 0, sizeof( lp->ProbeResp ));
  1934. lp->ProbeResp.infoType = 0xFFFF;
  1935. stop = FALSE;
  1936. }
  1937. /* Check for updated record events */
  1938. if ( lp->updatedRecord.len != 0xFFFF ) {
  1939. wl_process_updated_record( lp );
  1940. lp->updatedRecord.len = 0xFFFF;
  1941. stop = FALSE;
  1942. }
  1943. /* Check for association status events */
  1944. if ( lp->assoc_stat.len != 0xFFFF ) {
  1945. wl_process_assoc_status( lp );
  1946. lp->assoc_stat.len = 0xFFFF;
  1947. stop = FALSE;
  1948. }
  1949. /* Check for security status events */
  1950. if ( lp->sec_stat.len != 0xFFFF ) {
  1951. wl_process_security_status( lp );
  1952. lp->sec_stat.len = 0xFFFF;
  1953. stop = FALSE;
  1954. }
  1955. #ifdef ENABLE_DMA
  1956. if ( lp->use_dma ) {
  1957. /* Check for DMA Rx packets */
  1958. if ( lp->hcfCtx.IFB_DmaPackets & HREG_EV_RDMAD ) {
  1959. wl_rx_dma( dev );
  1960. stop = FALSE;
  1961. }
  1962. /* Return Tx DMA descriptors to host */
  1963. if ( lp->hcfCtx.IFB_DmaPackets & HREG_EV_TDMAD ) {
  1964. wl_pci_dma_hcf_reclaim_tx( lp );
  1965. stop = FALSE;
  1966. }
  1967. }
  1968. else
  1969. #endif // ENABLE_DMA
  1970. {
  1971. /* Check for Rx packets */
  1972. if ( lp->hcfCtx.IFB_RxLen != 0 ) {
  1973. wl_rx( dev );
  1974. stop = FALSE;
  1975. }
  1976. /* Make sure that queued frames get sent */
  1977. if ( wl_send( lp )) {
  1978. stop = FALSE;
  1979. }
  1980. }
  1981. }
  1982. /* We're done, so turn interrupts which were turned off in wl_isr, back on */
  1983. hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON );
  1984. wl_unlock( lp, &flags );
  1985. }
  1986. return;
  1987. } // wl_isr_handler
  1988. /*============================================================================*/
  1989. /*******************************************************************************
  1990. * wl_remove()
  1991. *******************************************************************************
  1992. *
  1993. * DESCRIPTION:
  1994. *
  1995. * Notify the adapter that it has been removed. Since the adapter is gone,
  1996. * we should no longer try to talk to it.
  1997. *
  1998. * PARAMETERS:
  1999. *
  2000. * dev - a pointer to the device's net_device structure
  2001. *
  2002. * RETURNS:
  2003. *
  2004. * N/A
  2005. *
  2006. ******************************************************************************/
  2007. void wl_remove( struct net_device *dev )
  2008. {
  2009. struct wl_private *lp = wl_priv(dev);
  2010. unsigned long flags;
  2011. /*------------------------------------------------------------------------*/
  2012. DBG_FUNC( "wl_remove" );
  2013. DBG_ENTER( DbgInfo );
  2014. DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
  2015. wl_lock( lp, &flags );
  2016. /* stop handling interrupts */
  2017. wl_act_int_off( lp );
  2018. lp->is_handling_int = WL_NOT_HANDLING_INT;
  2019. /*
  2020. * Disable the ports: just change state: since the
  2021. * card is gone it is useless to talk to it and at
  2022. * disconnect all state information is lost anyway.
  2023. */
  2024. /* Reset portState */
  2025. lp->portState = WVLAN_PORT_STATE_DISABLED;
  2026. #if 0 //;? (HCF_TYPE) & HCF_TYPE_AP
  2027. #ifdef USE_WDS
  2028. //wl_disable_wds_ports( lp );
  2029. #endif // USE_WDS
  2030. #endif /* (HCF_TYPE) & HCF_TYPE_AP */
  2031. /* Mark the device as unregistered */
  2032. lp->is_registered = FALSE;
  2033. /* Deregister the WDS ports as well */
  2034. WL_WDS_NETDEV_DEREGISTER( lp );
  2035. #ifdef USE_RTS
  2036. if ( lp->useRTS == 1 ) {
  2037. wl_unlock( lp, &flags );
  2038. DBG_LEAVE( DbgInfo );
  2039. return;
  2040. }
  2041. #endif /* USE_RTS */
  2042. /* Inform the HCF that the card has been removed */
  2043. hcf_connect( &lp->hcfCtx, HCF_DISCONNECT );
  2044. wl_unlock( lp, &flags );
  2045. DBG_LEAVE( DbgInfo );
  2046. return;
  2047. } // wl_remove
  2048. /*============================================================================*/
  2049. /*******************************************************************************
  2050. * wl_suspend()
  2051. *******************************************************************************
  2052. *
  2053. * DESCRIPTION:
  2054. *
  2055. * Power-down and halt the adapter.
  2056. *
  2057. * PARAMETERS:
  2058. *
  2059. * dev - a pointer to the device's net_device structure
  2060. *
  2061. * RETURNS:
  2062. *
  2063. * N/A
  2064. *
  2065. ******************************************************************************/
  2066. void wl_suspend( struct net_device *dev )
  2067. {
  2068. struct wl_private *lp = wl_priv(dev);
  2069. unsigned long flags;
  2070. /*------------------------------------------------------------------------*/
  2071. DBG_FUNC( "wl_suspend" );
  2072. DBG_ENTER( DbgInfo );
  2073. DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
  2074. /* The adapter is suspended:
  2075. Stop the adapter
  2076. Power down
  2077. */
  2078. wl_lock( lp, &flags );
  2079. /* Disable interrupt handling */
  2080. wl_act_int_off( lp );
  2081. /* Disconnect */
  2082. wl_disconnect( lp );
  2083. /* Disable */
  2084. wl_disable( lp );
  2085. /* Disconnect from the adapter */
  2086. hcf_connect( &lp->hcfCtx, HCF_DISCONNECT );
  2087. /* Reset portState to be sure (should have been done by wl_disable */
  2088. lp->portState = WVLAN_PORT_STATE_DISABLED;
  2089. wl_unlock( lp, &flags );
  2090. DBG_LEAVE( DbgInfo );
  2091. return;
  2092. } // wl_suspend
  2093. /*============================================================================*/
  2094. /*******************************************************************************
  2095. * wl_resume()
  2096. *******************************************************************************
  2097. *
  2098. * DESCRIPTION:
  2099. *
  2100. * Resume a previously suspended adapter.
  2101. *
  2102. * PARAMETERS:
  2103. *
  2104. * dev - a pointer to the device's net_device structure
  2105. *
  2106. * RETURNS:
  2107. *
  2108. * N/A
  2109. *
  2110. ******************************************************************************/
  2111. void wl_resume(struct net_device *dev)
  2112. {
  2113. struct wl_private *lp = wl_priv(dev);
  2114. unsigned long flags;
  2115. /*------------------------------------------------------------------------*/
  2116. DBG_FUNC( "wl_resume" );
  2117. DBG_ENTER( DbgInfo );
  2118. DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
  2119. wl_lock( lp, &flags );
  2120. /* Connect to the adapter */
  2121. hcf_connect( &lp->hcfCtx, dev->base_addr );
  2122. /* Reset portState */
  2123. lp->portState = WVLAN_PORT_STATE_DISABLED;
  2124. /* Power might have been off, assume the card lost the firmware*/
  2125. lp->firmware_present = WL_FRIMWARE_NOT_PRESENT;
  2126. /* Reload the firmware and restart */
  2127. wl_reset( dev );
  2128. /* Resume interrupt handling */
  2129. wl_act_int_on( lp );
  2130. wl_unlock( lp, &flags );
  2131. DBG_LEAVE( DbgInfo );
  2132. return;
  2133. } // wl_resume
  2134. /*============================================================================*/
  2135. /*******************************************************************************
  2136. * wl_release()
  2137. *******************************************************************************
  2138. *
  2139. * DESCRIPTION:
  2140. *
  2141. * This function perfroms a check on the device and calls wl_remove() if
  2142. * necessary. This function can be used for all bus types, but exists mostly
  2143. * for the benefit of the Card Services driver, as there are times when
  2144. * wl_remove() does not get called.
  2145. *
  2146. * PARAMETERS:
  2147. *
  2148. * dev - a pointer to the device's net_device structure
  2149. *
  2150. * RETURNS:
  2151. *
  2152. * N/A
  2153. *
  2154. ******************************************************************************/
  2155. void wl_release( struct net_device *dev )
  2156. {
  2157. struct wl_private *lp = wl_priv(dev);
  2158. /*------------------------------------------------------------------------*/
  2159. DBG_FUNC( "wl_release" );
  2160. DBG_ENTER( DbgInfo );
  2161. DBG_PARAM( DbgInfo, "dev", "%s (0x%p)", dev->name, dev );
  2162. /* If wl_remove() hasn't been called (i.e. when Card Services is shut
  2163. down with the card in the slot), then call it */
  2164. if ( lp->is_registered == TRUE ) {
  2165. DBG_TRACE( DbgInfo, "Calling unregister_netdev(), as it wasn't called yet\n" );
  2166. wl_remove( dev );
  2167. lp->is_registered = FALSE;
  2168. }
  2169. DBG_LEAVE( DbgInfo );
  2170. return;
  2171. } // wl_release
  2172. /*============================================================================*/
  2173. /*******************************************************************************
  2174. * wl_get_irq_mask()
  2175. *******************************************************************************
  2176. *
  2177. * DESCRIPTION:
  2178. *
  2179. * Accessor function to retrieve the irq_mask module parameter
  2180. *
  2181. * PARAMETERS:
  2182. *
  2183. * N/A
  2184. *
  2185. * RETURNS:
  2186. *
  2187. * The irq_mask module parameter
  2188. *
  2189. ******************************************************************************/
  2190. p_u16 wl_get_irq_mask( void )
  2191. {
  2192. return irq_mask;
  2193. } // wl_get_irq_mask
  2194. /*============================================================================*/
  2195. /*******************************************************************************
  2196. * wl_get_irq_list()
  2197. *******************************************************************************
  2198. *
  2199. * DESCRIPTION:
  2200. *
  2201. * Accessor function to retrieve the irq_list module parameter
  2202. *
  2203. * PARAMETERS:
  2204. *
  2205. * N/A
  2206. *
  2207. * RETURNS:
  2208. *
  2209. * The irq_list module parameter
  2210. *
  2211. ******************************************************************************/
  2212. p_s8 * wl_get_irq_list( void )
  2213. {
  2214. return irq_list;
  2215. } // wl_get_irq_list
  2216. /*============================================================================*/
  2217. /*******************************************************************************
  2218. * wl_enable()
  2219. *******************************************************************************
  2220. *
  2221. * DESCRIPTION:
  2222. *
  2223. * Used to enable MAC ports
  2224. *
  2225. * PARAMETERS:
  2226. *
  2227. * lp - pointer to the device's private adapter structure
  2228. *
  2229. * RETURNS:
  2230. *
  2231. * N/A
  2232. *
  2233. ******************************************************************************/
  2234. int wl_enable( struct wl_private *lp )
  2235. {
  2236. int hcf_status = HCF_SUCCESS;
  2237. /*------------------------------------------------------------------------*/
  2238. DBG_FUNC( "wl_enable" );
  2239. DBG_ENTER( DbgInfo );
  2240. if ( lp->portState == WVLAN_PORT_STATE_ENABLED ) {
  2241. DBG_TRACE( DbgInfo, "No action: Card already enabled\n" );
  2242. } else if ( lp->portState == WVLAN_PORT_STATE_CONNECTED ) {
  2243. //;?suspicuous logic, how can you be connected without being enabled so this is probably dead code
  2244. DBG_TRACE( DbgInfo, "No action: Card already connected\n" );
  2245. } else {
  2246. hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_ENABLE );
  2247. if ( hcf_status == HCF_SUCCESS ) {
  2248. /* Set the status of the NIC to enabled */
  2249. lp->portState = WVLAN_PORT_STATE_ENABLED; //;?bad mnemonic, NIC iso PORT
  2250. #ifdef ENABLE_DMA
  2251. if ( lp->use_dma ) {
  2252. wl_pci_dma_hcf_supply( lp ); //;?always succes?
  2253. }
  2254. #endif
  2255. }
  2256. }
  2257. if ( hcf_status != HCF_SUCCESS ) { //;?make this an assert
  2258. DBG_TRACE( DbgInfo, "failed: 0x%x\n", hcf_status );
  2259. }
  2260. DBG_LEAVE( DbgInfo );
  2261. return hcf_status;
  2262. } // wl_enable
  2263. /*============================================================================*/
  2264. #ifdef USE_WDS
  2265. /*******************************************************************************
  2266. * wl_enable_wds_ports()
  2267. *******************************************************************************
  2268. *
  2269. * DESCRIPTION:
  2270. *
  2271. * Used to enable the WDS MAC ports 1-6
  2272. *
  2273. * PARAMETERS:
  2274. *
  2275. * lp - pointer to the device's private adapter structure
  2276. *
  2277. * RETURNS:
  2278. *
  2279. * N/A
  2280. *
  2281. ******************************************************************************/
  2282. void wl_enable_wds_ports( struct wl_private * lp )
  2283. {
  2284. DBG_FUNC( "wl_enable_wds_ports" );
  2285. DBG_ENTER( DbgInfo );
  2286. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ){
  2287. DBG_ERROR( DbgInfo, "!!!!;? someone misunderstood something !!!!!\n" );
  2288. }
  2289. DBG_LEAVE( DbgInfo );
  2290. return;
  2291. } // wl_enable_wds_ports
  2292. #endif /* USE_WDS */
  2293. /*============================================================================*/
  2294. /*******************************************************************************
  2295. * wl_connect()
  2296. *******************************************************************************
  2297. *
  2298. * DESCRIPTION:
  2299. *
  2300. * Used to connect a MAC port
  2301. *
  2302. * PARAMETERS:
  2303. *
  2304. * lp - pointer to the device's private adapter structure
  2305. *
  2306. * RETURNS:
  2307. *
  2308. * N/A
  2309. *
  2310. ******************************************************************************/
  2311. int wl_connect( struct wl_private *lp )
  2312. {
  2313. int hcf_status;
  2314. /*------------------------------------------------------------------------*/
  2315. DBG_FUNC( "wl_connect" );
  2316. DBG_ENTER( DbgInfo );
  2317. if ( lp->portState != WVLAN_PORT_STATE_ENABLED ) {
  2318. DBG_TRACE( DbgInfo, "No action: Not in enabled state\n" );
  2319. DBG_LEAVE( DbgInfo );
  2320. return HCF_SUCCESS;
  2321. }
  2322. hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_CONNECT );
  2323. if ( hcf_status == HCF_SUCCESS ) {
  2324. lp->portState = WVLAN_PORT_STATE_CONNECTED;
  2325. }
  2326. DBG_LEAVE( DbgInfo );
  2327. return hcf_status;
  2328. } // wl_connect
  2329. /*============================================================================*/
  2330. /*******************************************************************************
  2331. * wl_disconnect()
  2332. *******************************************************************************
  2333. *
  2334. * DESCRIPTION:
  2335. *
  2336. * Used to disconnect a MAC port
  2337. *
  2338. * PARAMETERS:
  2339. *
  2340. * lp - pointer to the device's private adapter structure
  2341. *
  2342. * RETURNS:
  2343. *
  2344. * N/A
  2345. *
  2346. ******************************************************************************/
  2347. int wl_disconnect( struct wl_private *lp )
  2348. {
  2349. int hcf_status;
  2350. /*------------------------------------------------------------------------*/
  2351. DBG_FUNC( "wl_disconnect" );
  2352. DBG_ENTER( DbgInfo );
  2353. if ( lp->portState != WVLAN_PORT_STATE_CONNECTED ) {
  2354. DBG_TRACE( DbgInfo, "No action: Not in connected state\n" );
  2355. DBG_LEAVE( DbgInfo );
  2356. return HCF_SUCCESS;
  2357. }
  2358. hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_DISCONNECT );
  2359. if ( hcf_status == HCF_SUCCESS ) {
  2360. lp->portState = WVLAN_PORT_STATE_ENABLED;
  2361. }
  2362. DBG_LEAVE( DbgInfo );
  2363. return hcf_status;
  2364. } // wl_disconnect
  2365. /*============================================================================*/
  2366. /*******************************************************************************
  2367. * wl_disable()
  2368. *******************************************************************************
  2369. *
  2370. * DESCRIPTION:
  2371. *
  2372. * Used to disable MAC ports
  2373. *
  2374. * PARAMETERS:
  2375. *
  2376. * lp - pointer to the device's private adapter structure
  2377. * port - the MAC port to disable
  2378. *
  2379. * RETURNS:
  2380. *
  2381. * N/A
  2382. *
  2383. ******************************************************************************/
  2384. int wl_disable( struct wl_private *lp )
  2385. {
  2386. int hcf_status = HCF_SUCCESS;
  2387. /*------------------------------------------------------------------------*/
  2388. DBG_FUNC( "wl_disable" );
  2389. DBG_ENTER( DbgInfo );
  2390. if ( lp->portState == WVLAN_PORT_STATE_DISABLED ) {
  2391. DBG_TRACE( DbgInfo, "No action: Port state is disabled\n" );
  2392. } else {
  2393. hcf_status = hcf_cntl( &lp->hcfCtx, HCF_CNTL_DISABLE );
  2394. if ( hcf_status == HCF_SUCCESS ) {
  2395. /* Set the status of the port to disabled */ //;?bad mnemonic use NIC iso PORT
  2396. lp->portState = WVLAN_PORT_STATE_DISABLED;
  2397. #ifdef ENABLE_DMA
  2398. if ( lp->use_dma ) {
  2399. wl_pci_dma_hcf_reclaim( lp );
  2400. }
  2401. #endif
  2402. }
  2403. }
  2404. if ( hcf_status != HCF_SUCCESS ) {
  2405. DBG_TRACE( DbgInfo, "failed: 0x%x\n", hcf_status );
  2406. }
  2407. DBG_LEAVE( DbgInfo );
  2408. return hcf_status;
  2409. } // wl_disable
  2410. /*============================================================================*/
  2411. #ifdef USE_WDS
  2412. /*******************************************************************************
  2413. * wl_disable_wds_ports()
  2414. *******************************************************************************
  2415. *
  2416. * DESCRIPTION:
  2417. *
  2418. * Used to disable the WDS MAC ports 1-6
  2419. *
  2420. * PARAMETERS:
  2421. *
  2422. * lp - pointer to the device's private adapter structure
  2423. *
  2424. * RETURNS:
  2425. *
  2426. * N/A
  2427. *
  2428. ******************************************************************************/
  2429. void wl_disable_wds_ports( struct wl_private * lp )
  2430. {
  2431. DBG_FUNC( "wl_disable_wds_ports" );
  2432. DBG_ENTER( DbgInfo );
  2433. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ){
  2434. DBG_ERROR( DbgInfo, "!!!!;? someone misunderstood something !!!!!\n" );
  2435. }
  2436. // if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  2437. // wl_disable( lp, HCF_PORT_1 );
  2438. // wl_disable( lp, HCF_PORT_2 );
  2439. // wl_disable( lp, HCF_PORT_3 );
  2440. // wl_disable( lp, HCF_PORT_4 );
  2441. // wl_disable( lp, HCF_PORT_5 );
  2442. // wl_disable( lp, HCF_PORT_6 );
  2443. // }
  2444. DBG_LEAVE( DbgInfo );
  2445. return;
  2446. } // wl_disable_wds_ports
  2447. #endif // USE_WDS
  2448. /*============================================================================*/
  2449. #ifndef USE_MBOX_SYNC
  2450. /*******************************************************************************
  2451. * wl_mbx()
  2452. *******************************************************************************
  2453. *
  2454. * DESCRIPTION:
  2455. * This function is used to read and process a mailbox message.
  2456. *
  2457. *
  2458. * PARAMETERS:
  2459. *
  2460. * lp - pointer to the device's private adapter structure
  2461. *
  2462. * RETURNS:
  2463. *
  2464. * an HCF status code
  2465. *
  2466. ******************************************************************************/
  2467. int wl_mbx( struct wl_private *lp )
  2468. {
  2469. int hcf_status = HCF_SUCCESS;
  2470. /*------------------------------------------------------------------------*/
  2471. DBG_FUNC( "wl_mbx" );
  2472. DBG_ENTER( DbgInfo );
  2473. DBG_TRACE( DbgInfo, "Mailbox Info: IFB_MBInfoLen: %d\n",
  2474. lp->hcfCtx.IFB_MBInfoLen );
  2475. memset( &( lp->ltvRecord ), 0, sizeof( ltv_t ));
  2476. lp->ltvRecord.len = MB_SIZE;
  2477. lp->ltvRecord.typ = CFG_MB_INFO;
  2478. hcf_status = hcf_get_info( &lp->hcfCtx, (LTVP)&( lp->ltvRecord ));
  2479. if ( hcf_status != HCF_SUCCESS ) {
  2480. DBG_ERROR( DbgInfo, "hcf_get_info returned 0x%x\n", hcf_status );
  2481. DBG_LEAVE( DbgInfo );
  2482. return hcf_status;
  2483. }
  2484. if ( lp->ltvRecord.typ == CFG_MB_INFO ) {
  2485. DBG_LEAVE( DbgInfo );
  2486. return hcf_status;
  2487. }
  2488. /* Endian translate the mailbox data, then process the message */
  2489. wl_endian_translate_mailbox( &( lp->ltvRecord ));
  2490. wl_process_mailbox( lp );
  2491. DBG_LEAVE( DbgInfo );
  2492. return hcf_status;
  2493. } // wl_mbx
  2494. /*============================================================================*/
  2495. /*******************************************************************************
  2496. * wl_endian_translate_mailbox()
  2497. *******************************************************************************
  2498. *
  2499. * DESCRIPTION:
  2500. *
  2501. * This function will perform the tedious task of endian translating all
  2502. * fields withtin a mailbox message which need translating.
  2503. *
  2504. * PARAMETERS:
  2505. *
  2506. * ltv - pointer to the LTV to endian translate
  2507. *
  2508. * RETURNS:
  2509. *
  2510. * none
  2511. *
  2512. ******************************************************************************/
  2513. void wl_endian_translate_mailbox( ltv_t *ltv )
  2514. {
  2515. DBG_FUNC( "wl_endian_translate_mailbox" );
  2516. DBG_ENTER( DbgInfo );
  2517. switch( ltv->typ ) {
  2518. case CFG_TALLIES:
  2519. break;
  2520. case CFG_SCAN:
  2521. {
  2522. int num_aps;
  2523. SCAN_RS_STRCT *aps = (SCAN_RS_STRCT *)&ltv->u.u8[0];
  2524. num_aps = (hcf_16)(( (size_t)(ltv->len - 1 ) * 2 ) /
  2525. ( sizeof( SCAN_RS_STRCT )));
  2526. while( num_aps >= 1 ) {
  2527. num_aps--;
  2528. aps[num_aps].channel_id =
  2529. CNV_LITTLE_TO_INT( aps[num_aps].channel_id );
  2530. aps[num_aps].noise_level =
  2531. CNV_LITTLE_TO_INT( aps[num_aps].noise_level );
  2532. aps[num_aps].signal_level =
  2533. CNV_LITTLE_TO_INT( aps[num_aps].signal_level );
  2534. aps[num_aps].beacon_interval_time =
  2535. CNV_LITTLE_TO_INT( aps[num_aps].beacon_interval_time );
  2536. aps[num_aps].capability =
  2537. CNV_LITTLE_TO_INT( aps[num_aps].capability );
  2538. aps[num_aps].ssid_len =
  2539. CNV_LITTLE_TO_INT( aps[num_aps].ssid_len );
  2540. aps[num_aps].ssid_val[aps[num_aps].ssid_len] = 0;
  2541. }
  2542. }
  2543. break;
  2544. case CFG_ACS_SCAN:
  2545. {
  2546. PROBE_RESP *probe_resp = (PROBE_RESP *)ltv;
  2547. probe_resp->frameControl = CNV_LITTLE_TO_INT( probe_resp->frameControl );
  2548. probe_resp->durID = CNV_LITTLE_TO_INT( probe_resp->durID );
  2549. probe_resp->sequence = CNV_LITTLE_TO_INT( probe_resp->sequence );
  2550. probe_resp->dataLength = CNV_LITTLE_TO_INT( probe_resp->dataLength );
  2551. #ifndef WARP
  2552. probe_resp->lenType = CNV_LITTLE_TO_INT( probe_resp->lenType );
  2553. #endif // WARP
  2554. probe_resp->beaconInterval = CNV_LITTLE_TO_INT( probe_resp->beaconInterval );
  2555. probe_resp->capability = CNV_LITTLE_TO_INT( probe_resp->capability );
  2556. probe_resp->flags = CNV_LITTLE_TO_INT( probe_resp->flags );
  2557. }
  2558. break;
  2559. case CFG_LINK_STAT:
  2560. #define ls ((LINK_STATUS_STRCT *)ltv)
  2561. ls->linkStatus = CNV_LITTLE_TO_INT( ls->linkStatus );
  2562. break;
  2563. #undef ls
  2564. case CFG_ASSOC_STAT:
  2565. {
  2566. ASSOC_STATUS_STRCT *as = (ASSOC_STATUS_STRCT *)ltv;
  2567. as->assocStatus = CNV_LITTLE_TO_INT( as->assocStatus );
  2568. }
  2569. break;
  2570. case CFG_SECURITY_STAT:
  2571. {
  2572. SECURITY_STATUS_STRCT *ss = (SECURITY_STATUS_STRCT *)ltv;
  2573. ss->securityStatus = CNV_LITTLE_TO_INT( ss->securityStatus );
  2574. ss->reason = CNV_LITTLE_TO_INT( ss->reason );
  2575. }
  2576. break;
  2577. case CFG_WMP:
  2578. break;
  2579. case CFG_NULL:
  2580. break;
  2581. default:
  2582. break;
  2583. }
  2584. DBG_LEAVE( DbgInfo );
  2585. return;
  2586. } // wl_endian_translate_mailbox
  2587. /*============================================================================*/
  2588. /*******************************************************************************
  2589. * wl_process_mailbox()
  2590. *******************************************************************************
  2591. *
  2592. * DESCRIPTION:
  2593. *
  2594. * This function will process the mailbox data.
  2595. *
  2596. * PARAMETERS:
  2597. *
  2598. * ltv - pointer to the LTV to be processed.
  2599. *
  2600. * RETURNS:
  2601. *
  2602. * none
  2603. *
  2604. ******************************************************************************/
  2605. void wl_process_mailbox( struct wl_private *lp )
  2606. {
  2607. ltv_t *ltv;
  2608. hcf_16 ltv_val = 0xFFFF;
  2609. /*------------------------------------------------------------------------*/
  2610. DBG_FUNC( "wl_process_mailbox" );
  2611. DBG_ENTER( DbgInfo );
  2612. ltv = &( lp->ltvRecord );
  2613. switch( ltv->typ ) {
  2614. case CFG_TALLIES:
  2615. DBG_TRACE( DbgInfo, "CFG_TALLIES\n" );
  2616. break;
  2617. case CFG_SCAN:
  2618. DBG_TRACE( DbgInfo, "CFG_SCAN\n" );
  2619. {
  2620. int num_aps;
  2621. SCAN_RS_STRCT *aps = (SCAN_RS_STRCT *)&ltv->u.u8[0];
  2622. num_aps = (hcf_16)(( (size_t)(ltv->len - 1 ) * 2 ) /
  2623. ( sizeof( SCAN_RS_STRCT )));
  2624. lp->scan_results.num_aps = num_aps;
  2625. DBG_TRACE( DbgInfo, "Number of APs: %d\n", num_aps );
  2626. while( num_aps >= 1 ) {
  2627. num_aps--;
  2628. DBG_TRACE( DbgInfo, "AP : %d\n", num_aps );
  2629. DBG_TRACE( DbgInfo, "=========================\n" );
  2630. DBG_TRACE( DbgInfo, "Channel ID : 0x%04x\n",
  2631. aps[num_aps].channel_id );
  2632. DBG_TRACE( DbgInfo, "Noise Level : 0x%04x\n",
  2633. aps[num_aps].noise_level );
  2634. DBG_TRACE( DbgInfo, "Signal Level : 0x%04x\n",
  2635. aps[num_aps].signal_level );
  2636. DBG_TRACE( DbgInfo, "Beacon Interval : 0x%04x\n",
  2637. aps[num_aps].beacon_interval_time );
  2638. DBG_TRACE( DbgInfo, "Capability : 0x%04x\n",
  2639. aps[num_aps].capability );
  2640. DBG_TRACE( DbgInfo, "SSID Length : 0x%04x\n",
  2641. aps[num_aps].ssid_len );
  2642. DBG_TRACE(DbgInfo, "BSSID : %pM\n",
  2643. aps[num_aps].bssid);
  2644. if ( aps[num_aps].ssid_len != 0 ) {
  2645. DBG_TRACE( DbgInfo, "SSID : %s.\n",
  2646. aps[num_aps].ssid_val );
  2647. } else {
  2648. DBG_TRACE( DbgInfo, "SSID : %s.\n", "ANY" );
  2649. }
  2650. DBG_TRACE( DbgInfo, "\n" );
  2651. /* Copy the info to the ScanResult structure in the private
  2652. adapter struct */
  2653. memcpy( &( lp->scan_results.APTable[num_aps]), &( aps[num_aps] ),
  2654. sizeof( SCAN_RS_STRCT ));
  2655. }
  2656. /* Set scan result to true so that any scan requests will
  2657. complete */
  2658. lp->scan_results.scan_complete = TRUE;
  2659. }
  2660. break;
  2661. case CFG_ACS_SCAN:
  2662. DBG_TRACE( DbgInfo, "CFG_ACS_SCAN\n" );
  2663. {
  2664. PROBE_RESP *probe_rsp = (PROBE_RESP *)ltv;
  2665. hcf_8 *wpa_ie = NULL;
  2666. hcf_16 wpa_ie_len = 0;
  2667. DBG_TRACE( DbgInfo, "(%s) =========================\n",
  2668. lp->dev->name );
  2669. DBG_TRACE( DbgInfo, "(%s) length : 0x%04x.\n",
  2670. lp->dev->name, probe_rsp->length );
  2671. if ( probe_rsp->length > 1 ) {
  2672. DBG_TRACE( DbgInfo, "(%s) infoType : 0x%04x.\n",
  2673. lp->dev->name, probe_rsp->infoType );
  2674. DBG_TRACE( DbgInfo, "(%s) signal : 0x%02x.\n",
  2675. lp->dev->name, probe_rsp->signal );
  2676. DBG_TRACE( DbgInfo, "(%s) silence : 0x%02x.\n",
  2677. lp->dev->name, probe_rsp->silence );
  2678. DBG_TRACE( DbgInfo, "(%s) rxFlow : 0x%02x.\n",
  2679. lp->dev->name, probe_rsp->rxFlow );
  2680. DBG_TRACE( DbgInfo, "(%s) rate : 0x%02x.\n",
  2681. lp->dev->name, probe_rsp->rate );
  2682. DBG_TRACE( DbgInfo, "(%s) frame cntl : 0x%04x.\n",
  2683. lp->dev->name, probe_rsp->frameControl );
  2684. DBG_TRACE( DbgInfo, "(%s) durID : 0x%04x.\n",
  2685. lp->dev->name, probe_rsp->durID );
  2686. DBG_TRACE(DbgInfo, "(%s) address1 : %pM\n",
  2687. lp->dev->name, probe_rsp->address1);
  2688. DBG_TRACE(DbgInfo, "(%s) address2 : %pM\n",
  2689. lp->dev->name, probe_rsp->address2);
  2690. DBG_TRACE(DbgInfo, "(%s) BSSID : %pM\n",
  2691. lp->dev->name, probe_rsp->BSSID);
  2692. DBG_TRACE( DbgInfo, "(%s) sequence : 0x%04x.\n",
  2693. lp->dev->name, probe_rsp->sequence );
  2694. DBG_TRACE(DbgInfo, "(%s) address4 : %pM\n",
  2695. lp->dev->name, probe_rsp->address4);
  2696. DBG_TRACE( DbgInfo, "(%s) datalength : 0x%04x.\n",
  2697. lp->dev->name, probe_rsp->dataLength );
  2698. DBG_TRACE(DbgInfo, "(%s) DA : %pM\n",
  2699. lp->dev->name, probe_rsp->DA);
  2700. DBG_TRACE(DbgInfo, "(%s) SA : %pM\n",
  2701. lp->dev->name, probe_rsp->SA);
  2702. //DBG_TRACE( DbgInfo, "(%s) lenType : 0x%04x.\n",
  2703. // lp->dev->name, probe_rsp->lenType );
  2704. DBG_TRACE(DbgInfo, "(%s) timeStamp : "
  2705. "%d.%d.%d.%d.%d.%d.%d.%d\n",
  2706. lp->dev->name,
  2707. probe_rsp->timeStamp[0],
  2708. probe_rsp->timeStamp[1],
  2709. probe_rsp->timeStamp[2],
  2710. probe_rsp->timeStamp[3],
  2711. probe_rsp->timeStamp[4],
  2712. probe_rsp->timeStamp[5],
  2713. probe_rsp->timeStamp[6],
  2714. probe_rsp->timeStamp[7]);
  2715. DBG_TRACE( DbgInfo, "(%s) beaconInt : 0x%04x.\n",
  2716. lp->dev->name, probe_rsp->beaconInterval );
  2717. DBG_TRACE( DbgInfo, "(%s) capability : 0x%04x.\n",
  2718. lp->dev->name, probe_rsp->capability );
  2719. DBG_TRACE( DbgInfo, "(%s) SSID len : 0x%04x.\n",
  2720. lp->dev->name, probe_rsp->rawData[1] );
  2721. if ( probe_rsp->rawData[1] > 0 ) {
  2722. char ssid[HCF_MAX_NAME_LEN];
  2723. memset( ssid, 0, sizeof( ssid ));
  2724. strncpy( ssid, &probe_rsp->rawData[2],
  2725. probe_rsp->rawData[1] );
  2726. DBG_TRACE( DbgInfo, "(%s) SSID : %s\n",
  2727. lp->dev->name, ssid );
  2728. }
  2729. /* Parse out the WPA-IE, if one exists */
  2730. wpa_ie = wl_parse_wpa_ie( probe_rsp, &wpa_ie_len );
  2731. if ( wpa_ie != NULL ) {
  2732. DBG_TRACE( DbgInfo, "(%s) WPA-IE : %s\n",
  2733. lp->dev->name, wl_print_wpa_ie( wpa_ie, wpa_ie_len ));
  2734. }
  2735. DBG_TRACE( DbgInfo, "(%s) flags : 0x%04x.\n",
  2736. lp->dev->name, probe_rsp->flags );
  2737. }
  2738. DBG_TRACE( DbgInfo, "\n\n" );
  2739. /* If probe response length is 1, then the scan is complete */
  2740. if ( probe_rsp->length == 1 ) {
  2741. DBG_TRACE( DbgInfo, "SCAN COMPLETE\n" );
  2742. lp->probe_results.num_aps = lp->probe_num_aps;
  2743. lp->probe_results.scan_complete = TRUE;
  2744. /* Reset the counter for the next scan request */
  2745. lp->probe_num_aps = 0;
  2746. /* Send a wireless extensions event that the scan completed */
  2747. wl_wext_event_scan_complete( lp->dev );
  2748. } else {
  2749. /* Only copy to the table if the entry is unique; APs sometimes
  2750. respond more than once to a probe */
  2751. if ( lp->probe_num_aps == 0 ) {
  2752. /* Copy the info to the ScanResult structure in the private
  2753. adapter struct */
  2754. memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ),
  2755. probe_rsp, sizeof( PROBE_RESP ));
  2756. /* Increment the number of APs detected */
  2757. lp->probe_num_aps++;
  2758. } else {
  2759. int count;
  2760. int unique = 1;
  2761. for( count = 0; count < lp->probe_num_aps; count++ ) {
  2762. if ( memcmp( &( probe_rsp->BSSID ),
  2763. lp->probe_results.ProbeTable[count].BSSID,
  2764. ETH_ALEN ) == 0 ) {
  2765. unique = 0;
  2766. }
  2767. }
  2768. if ( unique ) {
  2769. /* Copy the info to the ScanResult structure in the
  2770. private adapter struct. Only copy if there's room in the
  2771. table */
  2772. if ( lp->probe_num_aps < MAX_NAPS )
  2773. {
  2774. memcpy( &( lp->probe_results.ProbeTable[lp->probe_num_aps] ),
  2775. probe_rsp, sizeof( PROBE_RESP ));
  2776. }
  2777. else
  2778. {
  2779. DBG_WARNING( DbgInfo, "Num of scan results exceeds storage, truncating\n" );
  2780. }
  2781. /* Increment the number of APs detected. Note I do this
  2782. here even when I don't copy the probe response to the
  2783. buffer in order to detect the overflow condition */
  2784. lp->probe_num_aps++;
  2785. }
  2786. }
  2787. }
  2788. }
  2789. break;
  2790. case CFG_LINK_STAT:
  2791. #define ls ((LINK_STATUS_STRCT *)ltv)
  2792. DBG_TRACE( DbgInfo, "CFG_LINK_STAT\n" );
  2793. switch( ls->linkStatus ) {
  2794. case 1:
  2795. DBG_TRACE( DbgInfo, "Link Status : Connected\n" );
  2796. wl_wext_event_ap( lp->dev );
  2797. break;
  2798. case 2:
  2799. DBG_TRACE( DbgInfo, "Link Status : Disconnected\n" );
  2800. break;
  2801. case 3:
  2802. DBG_TRACE( DbgInfo, "Link Status : Access Point Change\n" );
  2803. break;
  2804. case 4:
  2805. DBG_TRACE( DbgInfo, "Link Status : Access Point Out of Range\n" );
  2806. break;
  2807. case 5:
  2808. DBG_TRACE( DbgInfo, "Link Status : Access Point In Range\n" );
  2809. break;
  2810. default:
  2811. DBG_TRACE( DbgInfo, "Link Status : UNKNOWN (0x%04x)\n",
  2812. ls->linkStatus );
  2813. break;
  2814. }
  2815. break;
  2816. #undef ls
  2817. case CFG_ASSOC_STAT:
  2818. DBG_TRACE( DbgInfo, "CFG_ASSOC_STAT\n" );
  2819. {
  2820. ASSOC_STATUS_STRCT *as = (ASSOC_STATUS_STRCT *)ltv;
  2821. switch( as->assocStatus ) {
  2822. case 1:
  2823. DBG_TRACE( DbgInfo, "Association Status : STA Associated\n" );
  2824. break;
  2825. case 2:
  2826. DBG_TRACE( DbgInfo, "Association Status : STA Reassociated\n" );
  2827. break;
  2828. case 3:
  2829. DBG_TRACE( DbgInfo, "Association Status : STA Disassociated\n" );
  2830. break;
  2831. default:
  2832. DBG_TRACE( DbgInfo, "Association Status : UNKNOWN (0x%04x)\n",
  2833. as->assocStatus );
  2834. break;
  2835. }
  2836. DBG_TRACE(DbgInfo, "STA Address : %pM\n",
  2837. as->staAddr);
  2838. if (( as->assocStatus == 2 ) && ( as->len == 8 )) {
  2839. DBG_TRACE(DbgInfo, "Old AP Address : %pM\n",
  2840. as->oldApAddr);
  2841. }
  2842. }
  2843. break;
  2844. case CFG_SECURITY_STAT:
  2845. DBG_TRACE( DbgInfo, "CFG_SECURITY_STAT\n" );
  2846. {
  2847. SECURITY_STATUS_STRCT *ss = (SECURITY_STATUS_STRCT *)ltv;
  2848. switch( ss->securityStatus ) {
  2849. case 1:
  2850. DBG_TRACE( DbgInfo, "Security Status : Dissassociate [AP]\n" );
  2851. break;
  2852. case 2:
  2853. DBG_TRACE( DbgInfo, "Security Status : Deauthenticate [AP]\n" );
  2854. break;
  2855. case 3:
  2856. DBG_TRACE( DbgInfo, "Security Status : Authenticate Fail [STA] or [AP]\n" );
  2857. break;
  2858. case 4:
  2859. DBG_TRACE( DbgInfo, "Security Status : MIC Fail\n" );
  2860. break;
  2861. case 5:
  2862. DBG_TRACE( DbgInfo, "Security Status : Associate Fail\n" );
  2863. break;
  2864. default:
  2865. DBG_TRACE( DbgInfo, "Security Status : UNKNOWN %d\n",
  2866. ss->securityStatus );
  2867. break;
  2868. }
  2869. DBG_TRACE(DbgInfo, "STA Address : %pM\n",
  2870. ss->staAddr);
  2871. DBG_TRACE(DbgInfo, "Reason : 0x%04x\n",
  2872. ss->reason);
  2873. }
  2874. break;
  2875. case CFG_WMP:
  2876. DBG_TRACE( DbgInfo, "CFG_WMP, size is %d bytes\n", ltv->len );
  2877. {
  2878. WMP_RSP_STRCT *wmp_rsp = (WMP_RSP_STRCT *)ltv;
  2879. DBG_TRACE( DbgInfo, "CFG_WMP, pdu type is 0x%x\n",
  2880. wmp_rsp->wmpRsp.wmpHdr.type );
  2881. switch( wmp_rsp->wmpRsp.wmpHdr.type ) {
  2882. case WVLAN_WMP_PDU_TYPE_LT_RSP:
  2883. {
  2884. #if DBG
  2885. LINKTEST_RSP_STRCT *lt_rsp = (LINKTEST_RSP_STRCT *)ltv;
  2886. #endif // DBG
  2887. DBG_TRACE( DbgInfo, "LINK TEST RESULT\n" );
  2888. DBG_TRACE( DbgInfo, "================\n" );
  2889. DBG_TRACE( DbgInfo, "Length : %d.\n", lt_rsp->len );
  2890. DBG_TRACE( DbgInfo, "Name : %s.\n", lt_rsp->ltRsp.ltRsp.name );
  2891. DBG_TRACE( DbgInfo, "Signal Level : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.signal );
  2892. DBG_TRACE( DbgInfo, "Noise Level : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.noise );
  2893. DBG_TRACE( DbgInfo, "Receive Flow : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.rxFlow );
  2894. DBG_TRACE( DbgInfo, "Data Rate : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.dataRate );
  2895. DBG_TRACE( DbgInfo, "Protocol : 0x%04x.\n", lt_rsp->ltRsp.ltRsp.protocol );
  2896. DBG_TRACE( DbgInfo, "Station : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.station );
  2897. DBG_TRACE( DbgInfo, "Data Rate Cap : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.dataRateCap );
  2898. DBG_TRACE( DbgInfo, "Power Mgmt : 0x%02x 0x%02x 0x%02x 0x%02x.\n",
  2899. lt_rsp->ltRsp.ltRsp.powerMgmt[0],
  2900. lt_rsp->ltRsp.ltRsp.powerMgmt[1],
  2901. lt_rsp->ltRsp.ltRsp.powerMgmt[2],
  2902. lt_rsp->ltRsp.ltRsp.powerMgmt[3] );
  2903. DBG_TRACE( DbgInfo, "Robustness : 0x%02x 0x%02x 0x%02x 0x%02x.\n",
  2904. lt_rsp->ltRsp.ltRsp.robustness[0],
  2905. lt_rsp->ltRsp.ltRsp.robustness[1],
  2906. lt_rsp->ltRsp.ltRsp.robustness[2],
  2907. lt_rsp->ltRsp.ltRsp.robustness[3] );
  2908. DBG_TRACE( DbgInfo, "Scaling : 0x%02x.\n", lt_rsp->ltRsp.ltRsp.scaling );
  2909. }
  2910. break;
  2911. default:
  2912. break;
  2913. }
  2914. }
  2915. break;
  2916. case CFG_NULL:
  2917. DBG_TRACE( DbgInfo, "CFG_NULL\n" );
  2918. break;
  2919. case CFG_UPDATED_INFO_RECORD: // Updated Information Record
  2920. DBG_TRACE( DbgInfo, "UPDATED INFORMATION RECORD\n" );
  2921. ltv_val = CNV_INT_TO_LITTLE( ltv->u.u16[0] );
  2922. /* Check and see which RID was updated */
  2923. switch( ltv_val ) {
  2924. case CFG_CUR_COUNTRY_INFO: // Indicate Passive Scan Completion
  2925. DBG_TRACE( DbgInfo, "Updated country info\n" );
  2926. /* Do I need to hold off on updating RIDs until the process is
  2927. complete? */
  2928. wl_connect( lp );
  2929. break;
  2930. case CFG_PORT_STAT: // Wait for Connect Event
  2931. //wl_connect( lp );
  2932. break;
  2933. default:
  2934. DBG_WARNING( DbgInfo, "Unknown RID: 0x%04x\n", ltv_val );
  2935. }
  2936. break;
  2937. default:
  2938. DBG_TRACE( DbgInfo, "UNKNOWN MESSAGE: 0x%04x\n", ltv->typ );
  2939. break;
  2940. }
  2941. DBG_LEAVE( DbgInfo );
  2942. return;
  2943. } // wl_process_mailbox
  2944. /*============================================================================*/
  2945. #endif /* ifndef USE_MBOX_SYNC */
  2946. #ifdef USE_WDS
  2947. /*******************************************************************************
  2948. * wl_wds_netdev_register()
  2949. *******************************************************************************
  2950. *
  2951. * DESCRIPTION:
  2952. *
  2953. * This function registers net_device structures with the system's network
  2954. * layer for use with the WDS ports.
  2955. *
  2956. *
  2957. * PARAMETERS:
  2958. *
  2959. * lp - pointer to the device's private adapter structure
  2960. *
  2961. * RETURNS:
  2962. *
  2963. * N/A
  2964. *
  2965. ******************************************************************************/
  2966. void wl_wds_netdev_register( struct wl_private *lp )
  2967. {
  2968. int count;
  2969. /*------------------------------------------------------------------------*/
  2970. DBG_FUNC( "wl_wds_netdev_register" );
  2971. DBG_ENTER( DbgInfo );
  2972. //;?why is there no USE_WDS clause like in wl_enable_wds_ports
  2973. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  2974. for( count = 0; count < NUM_WDS_PORTS; count++ ) {
  2975. if ( WVLAN_VALID_MAC_ADDRESS( lp->wds_port[count].wdsAddress )) {
  2976. if ( register_netdev( lp->wds_port[count].dev ) != 0 ) {
  2977. DBG_WARNING( DbgInfo, "net device for WDS port %d could not be registered\n",
  2978. ( count + 1 ));
  2979. }
  2980. lp->wds_port[count].is_registered = TRUE;
  2981. /* Fill out the net_device structs with the MAC addr */
  2982. memcpy( lp->wds_port[count].dev->dev_addr, lp->MACAddress, ETH_ALEN );
  2983. lp->wds_port[count].dev->addr_len = ETH_ALEN;
  2984. }
  2985. }
  2986. }
  2987. DBG_LEAVE( DbgInfo );
  2988. return;
  2989. } // wl_wds_netdev_register
  2990. /*============================================================================*/
  2991. /*******************************************************************************
  2992. * wl_wds_netdev_deregister()
  2993. *******************************************************************************
  2994. *
  2995. * DESCRIPTION:
  2996. *
  2997. * This function deregisters the WDS net_device structures used by the
  2998. * system's network layer.
  2999. *
  3000. *
  3001. * PARAMETERS:
  3002. *
  3003. * lp - pointer to the device's private adapter structure
  3004. *
  3005. * RETURNS:
  3006. *
  3007. * N/A
  3008. *
  3009. ******************************************************************************/
  3010. void wl_wds_netdev_deregister( struct wl_private *lp )
  3011. {
  3012. int count;
  3013. /*------------------------------------------------------------------------*/
  3014. DBG_FUNC( "wl_wds_netdev_deregister" );
  3015. DBG_ENTER( DbgInfo );
  3016. if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) {
  3017. for( count = 0; count < NUM_WDS_PORTS; count++ ) {
  3018. if ( WVLAN_VALID_MAC_ADDRESS( lp->wds_port[count].wdsAddress )) {
  3019. unregister_netdev( lp->wds_port[count].dev );
  3020. }
  3021. lp->wds_port[count].is_registered = FALSE;
  3022. }
  3023. }
  3024. DBG_LEAVE( DbgInfo );
  3025. return;
  3026. } // wl_wds_netdev_deregister
  3027. /*============================================================================*/
  3028. #endif /* USE_WDS */
  3029. #if 0 //SCULL_USE_PROC /* don't waste space if unused */
  3030. /*
  3031. * The proc filesystem: function to read and entry
  3032. */
  3033. int printf_hcf_16( char *s, char *buf, hcf_16* p, int n );
  3034. int printf_hcf_16( char *s, char *buf, hcf_16* p, int n ) {
  3035. int i, len;
  3036. len = sprintf(buf, "%s", s );
  3037. while ( len < 20 ) len += sprintf(buf+len, " " );
  3038. len += sprintf(buf+len,": " );
  3039. for ( i = 0; i < n; i++ ) {
  3040. if ( len % 80 > 75 ) {
  3041. len += sprintf(buf+len,"\n" );
  3042. }
  3043. len += sprintf(buf+len,"%04X ", p[i] );
  3044. }
  3045. len += sprintf(buf+len,"\n" );
  3046. return len;
  3047. } // printf_hcf_16
  3048. int printf_hcf_8( char *s, char *buf, hcf_8* p, int n );
  3049. int printf_hcf_8( char *s, char *buf, hcf_8* p, int n ) {
  3050. int i, len;
  3051. len = sprintf(buf, "%s", s );
  3052. while ( len < 20 ) len += sprintf(buf+len, " " );
  3053. len += sprintf(buf+len,": " );
  3054. for ( i = 0; i <= n; i++ ) {
  3055. if ( len % 80 > 77 ) {
  3056. len += sprintf(buf+len,"\n" );
  3057. }
  3058. len += sprintf(buf+len,"%02X ", p[i] );
  3059. }
  3060. len += sprintf(buf+len,"\n" );
  3061. return len;
  3062. } // printf_hcf8
  3063. int printf_strct( char *s, char *buf, hcf_16* p );
  3064. int printf_strct( char *s, char *buf, hcf_16* p ) {
  3065. int i, len;
  3066. len = sprintf(buf, "%s", s );
  3067. while ( len < 20 ) len += sprintf(buf+len, " " );
  3068. len += sprintf(buf+len,": " );
  3069. for ( i = 0; i <= *p; i++ ) {
  3070. if ( len % 80 > 75 ) {
  3071. len += sprintf(buf+len,"\n" );
  3072. }
  3073. len += sprintf(buf+len,"%04X ", p[i] );
  3074. }
  3075. len += sprintf(buf+len,"\n" );
  3076. return len;
  3077. } // printf_strct
  3078. int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof, void *data )
  3079. {
  3080. struct wl_private *lp = NULL;
  3081. IFBP ifbp;
  3082. CFG_HERMES_TALLIES_STRCT *p;
  3083. #define LIMIT (PAGE_SIZE-80) /* don't print any more after this size */
  3084. len=0;
  3085. lp = ((struct net_device *)data)->priv;
  3086. if (lp == NULL) {
  3087. len += sprintf(buf+len,"No wl_private in scull_read_procmem\n" );
  3088. } else if ( lp->wlags49_type == 0 ){
  3089. ifbp = &lp->hcfCtx;
  3090. len += sprintf(buf+len,"Magic: 0x%04X\n", ifbp->IFB_Magic );
  3091. len += sprintf(buf+len,"IOBase: 0x%04X\n", ifbp->IFB_IOBase );
  3092. len += sprintf(buf+len,"LinkStat: 0x%04X\n", ifbp->IFB_LinkStat );
  3093. len += sprintf(buf+len,"DSLinkStat: 0x%04X\n", ifbp->IFB_DSLinkStat );
  3094. len += sprintf(buf+len,"TickIni: 0x%08lX\n", ifbp->IFB_TickIni );
  3095. len += sprintf(buf+len,"TickCnt: 0x%04X\n", ifbp->IFB_TickCnt );
  3096. len += sprintf(buf+len,"IntOffCnt: 0x%04X\n", ifbp->IFB_IntOffCnt );
  3097. len += printf_hcf_16( "IFB_FWIdentity", &buf[len],
  3098. &ifbp->IFB_FWIdentity.len, ifbp->IFB_FWIdentity.len + 1 );
  3099. } else if ( lp->wlags49_type == 1 ) {
  3100. len += sprintf(buf+len,"Channel: 0x%04X\n", lp->Channel );
  3101. /****** len += sprintf(buf+len,"slock: %d\n", lp->slock ); */
  3102. //x struct tq_struct "task: 0x%04X\n", lp->task );
  3103. //x struct net_device_stats "stats: 0x%04X\n", lp->stats );
  3104. #ifdef WIRELESS_EXT
  3105. //x struct iw_statistics "wstats: 0x%04X\n", lp->wstats );
  3106. //x len += sprintf(buf+len,"spy_number: 0x%04X\n", lp->spy_number );
  3107. //x u_char spy_address[IW_MAX_SPY][ETH_ALEN];
  3108. //x struct iw_quality spy_stat[IW_MAX_SPY];
  3109. #endif // WIRELESS_EXT
  3110. len += sprintf(buf+len,"IFB: 0x%p\n", &lp->hcfCtx );
  3111. len += sprintf(buf+len,"flags: %#.8lX\n", lp->flags ); //;?use this format from now on
  3112. len += sprintf(buf+len,"DebugFlag(wl_private) 0x%04X\n", lp->DebugFlag );
  3113. #if DBG
  3114. len += sprintf(buf+len,"DebugFlag (DbgInfo): 0x%08lX\n", DbgInfo->DebugFlag );
  3115. #endif // DBG
  3116. len += sprintf(buf+len,"is_registered: 0x%04X\n", lp->is_registered );
  3117. //x CFG_DRV_INFO_STRCT "driverInfo: 0x%04X\n", lp->driverInfo );
  3118. len += printf_strct( "driverInfo", &buf[len], (hcf_16*)&lp->driverInfo );
  3119. //x CFG_IDENTITY_STRCT "driverIdentity: 0x%04X\n", lp->driverIdentity );
  3120. len += printf_strct( "driverIdentity", &buf[len], (hcf_16*)&lp->driverIdentity );
  3121. //x CFG_FW_IDENTITY_STRCT "StationIdentity: 0x%04X\n", lp->StationIdentity );
  3122. len += printf_strct( "StationIdentity", &buf[len], (hcf_16*)&lp->StationIdentity );
  3123. //x CFG_PRI_IDENTITY_STRCT "PrimaryIdentity: 0x%04X\n", lp->PrimaryIdentity );
  3124. len += printf_strct( "PrimaryIdentity", &buf[len], (hcf_16*)&lp->hcfCtx.IFB_PRIIdentity );
  3125. len += printf_strct( "PrimarySupplier", &buf[len], (hcf_16*)&lp->hcfCtx.IFB_PRISup );
  3126. //x CFG_PRI_IDENTITY_STRCT "NICIdentity: 0x%04X\n", lp->NICIdentity );
  3127. len += printf_strct( "NICIdentity", &buf[len], (hcf_16*)&lp->NICIdentity );
  3128. //x ltv_t "ltvRecord: 0x%04X\n", lp->ltvRecord );
  3129. len += sprintf(buf+len,"txBytes: 0x%08lX\n", lp->txBytes );
  3130. len += sprintf(buf+len,"maxPort: 0x%04X\n", lp->maxPort ); /* 0 for STA, 6 for AP */
  3131. /* Elements used for async notification from hardware */
  3132. //x RID_LOG_STRCT RidList[10];
  3133. //x ltv_t "updatedRecord: 0x%04X\n", lp->updatedRecord );
  3134. //x PROBE_RESP "ProbeResp: 0x%04X\n", lp->ProbeResp );
  3135. //x ASSOC_STATUS_STRCT "assoc_stat: 0x%04X\n", lp->assoc_stat );
  3136. //x SECURITY_STATUS_STRCT "sec_stat: 0x%04X\n", lp->sec_stat );
  3137. //x u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD];
  3138. len += sprintf(buf+len,"PortType: 0x%04X\n", lp->PortType ); // 1 - 3 (1 [Normal] | 3 [AdHoc])
  3139. len += sprintf(buf+len,"Channel: 0x%04X\n", lp->Channel ); // 0 - 14 (0)
  3140. //x hcf_16 TxRateControl[2];
  3141. len += sprintf(buf+len,"TxRateControl[2]: 0x%04X 0x%04X\n",
  3142. lp->TxRateControl[0], lp->TxRateControl[1] );
  3143. len += sprintf(buf+len,"DistanceBetweenAPs: 0x%04X\n", lp->DistanceBetweenAPs ); // 1 - 3 (1)
  3144. len += sprintf(buf+len,"RTSThreshold: 0x%04X\n", lp->RTSThreshold ); // 0 - 2347 (2347)
  3145. len += sprintf(buf+len,"PMEnabled: 0x%04X\n", lp->PMEnabled ); // 0 - 2, 8001 - 8002 (0)
  3146. len += sprintf(buf+len,"MicrowaveRobustness: 0x%04X\n", lp->MicrowaveRobustness );// 0 - 1 (0)
  3147. len += sprintf(buf+len,"CreateIBSS: 0x%04X\n", lp->CreateIBSS ); // 0 - 1 (0)
  3148. len += sprintf(buf+len,"MulticastReceive: 0x%04X\n", lp->MulticastReceive ); // 0 - 1 (1)
  3149. len += sprintf(buf+len,"MaxSleepDuration: 0x%04X\n", lp->MaxSleepDuration ); // 0 - 65535 (100)
  3150. //x hcf_8 MACAddress[ETH_ALEN];
  3151. len += printf_hcf_8( "MACAddress", &buf[len], lp->MACAddress, ETH_ALEN );
  3152. //x char NetworkName[HCF_MAX_NAME_LEN+1];
  3153. len += sprintf(buf+len,"NetworkName: %.32s\n", lp->NetworkName );
  3154. //x char StationName[HCF_MAX_NAME_LEN+1];
  3155. len += sprintf(buf+len,"EnableEncryption: 0x%04X\n", lp->EnableEncryption ); // 0 - 1 (0)
  3156. //x char Key1[MAX_KEY_LEN+1];
  3157. len += printf_hcf_8( "Key1", &buf[len], lp->Key1, MAX_KEY_LEN );
  3158. //x char Key2[MAX_KEY_LEN+1];
  3159. //x char Key3[MAX_KEY_LEN+1];
  3160. //x char Key4[MAX_KEY_LEN+1];
  3161. len += sprintf(buf+len,"TransmitKeyID: 0x%04X\n", lp->TransmitKeyID ); // 1 - 4 (1)
  3162. //x CFG_DEFAULT_KEYS_STRCT "DefaultKeys: 0x%04X\n", lp->DefaultKeys );
  3163. //x u_char mailbox[MB_SIZE];
  3164. //x char szEncryption[MAX_ENC_LEN];
  3165. len += sprintf(buf+len,"driverEnable: 0x%04X\n", lp->driverEnable );
  3166. len += sprintf(buf+len,"wolasEnable: 0x%04X\n", lp->wolasEnable );
  3167. len += sprintf(buf+len,"atimWindow: 0x%04X\n", lp->atimWindow );
  3168. len += sprintf(buf+len,"holdoverDuration: 0x%04X\n", lp->holdoverDuration );
  3169. //x hcf_16 MulticastRate[2];
  3170. len += sprintf(buf+len,"authentication: 0x%04X\n", lp->authentication ); // is this AP specific?
  3171. len += sprintf(buf+len,"promiscuousMode: 0x%04X\n", lp->promiscuousMode );
  3172. len += sprintf(buf+len,"DownloadFirmware: 0x%04X\n", lp->DownloadFirmware ); // 0 - 2 (0 [None] | 1 [STA] | 2 [AP])
  3173. len += sprintf(buf+len,"AuthKeyMgmtSuite: 0x%04X\n", lp->AuthKeyMgmtSuite );
  3174. len += sprintf(buf+len,"loadBalancing: 0x%04X\n", lp->loadBalancing );
  3175. len += sprintf(buf+len,"mediumDistribution: 0x%04X\n", lp->mediumDistribution );
  3176. len += sprintf(buf+len,"txPowLevel: 0x%04X\n", lp->txPowLevel );
  3177. // len += sprintf(buf+len,"shortRetryLimit: 0x%04X\n", lp->shortRetryLimit );
  3178. // len += sprintf(buf+len,"longRetryLimit: 0x%04X\n", lp->longRetryLimit );
  3179. //x hcf_16 srsc[2];
  3180. //x hcf_16 brsc[2];
  3181. len += sprintf(buf+len,"connectionControl: 0x%04X\n", lp->connectionControl );
  3182. //x //hcf_16 probeDataRates[2];
  3183. len += sprintf(buf+len,"ownBeaconInterval: 0x%04X\n", lp->ownBeaconInterval );
  3184. len += sprintf(buf+len,"coexistence: 0x%04X\n", lp->coexistence );
  3185. //x WVLAN_FRAME "txF: 0x%04X\n", lp->txF );
  3186. //x WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES];
  3187. //x struct list_head "txFree: 0x%04X\n", lp->txFree );
  3188. //x struct list_head txQ[WVLAN_MAX_TX_QUEUES];
  3189. len += sprintf(buf+len,"netif_queue_on: 0x%04X\n", lp->netif_queue_on );
  3190. len += sprintf(buf+len,"txQ_count: 0x%04X\n", lp->txQ_count );
  3191. //x DESC_STRCT "desc_rx: 0x%04X\n", lp->desc_rx );
  3192. //x DESC_STRCT "desc_tx: 0x%04X\n", lp->desc_tx );
  3193. //x WVLAN_PORT_STATE "portState: 0x%04X\n", lp->portState );
  3194. //x ScanResult "scan_results: 0x%04X\n", lp->scan_results );
  3195. //x ProbeResult "probe_results: 0x%04X\n", lp->probe_results );
  3196. len += sprintf(buf+len,"probe_num_aps: 0x%04X\n", lp->probe_num_aps );
  3197. len += sprintf(buf+len,"use_dma: 0x%04X\n", lp->use_dma );
  3198. //x DMA_STRCT "dma: 0x%04X\n", lp->dma );
  3199. #ifdef USE_RTS
  3200. len += sprintf(buf+len,"useRTS: 0x%04X\n", lp->useRTS );
  3201. #endif // USE_RTS
  3202. #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP
  3203. //;?should we restore this to allow smaller memory footprint
  3204. //;?I guess not. This should be brought under Debug mode only
  3205. len += sprintf(buf+len,"DTIMPeriod: 0x%04X\n", lp->DTIMPeriod ); // 1 - 255 (1)
  3206. len += sprintf(buf+len,"multicastPMBuffering: 0x%04X\n", lp->multicastPMBuffering );
  3207. len += sprintf(buf+len,"RejectAny: 0x%04X\n", lp->RejectAny ); // 0 - 1 (0)
  3208. len += sprintf(buf+len,"ExcludeUnencrypted: 0x%04X\n", lp->ExcludeUnencrypted ); // 0 - 1 (1)
  3209. len += sprintf(buf+len,"intraBSSRelay: 0x%04X\n", lp->intraBSSRelay );
  3210. len += sprintf(buf+len,"wlags49_type: 0x%08lX\n", lp->wlags49_type );
  3211. #ifdef USE_WDS
  3212. //x WVLAN_WDS_IF wds_port[NUM_WDS_PORTS];
  3213. #endif // USE_WDS
  3214. #endif // HCF_AP
  3215. } else if ( lp->wlags49_type == 2 ){
  3216. len += sprintf(buf+len,"tallies to be added\n" );
  3217. //Hermes Tallies (IFB substructure) {
  3218. p = &lp->hcfCtx.IFB_NIC_Tallies;
  3219. len += sprintf(buf+len,"TxUnicastFrames: %08lX\n", p->TxUnicastFrames );
  3220. len += sprintf(buf+len,"TxMulticastFrames: %08lX\n", p->TxMulticastFrames );
  3221. len += sprintf(buf+len,"TxFragments: %08lX\n", p->TxFragments );
  3222. len += sprintf(buf+len,"TxUnicastOctets: %08lX\n", p->TxUnicastOctets );
  3223. len += sprintf(buf+len,"TxMulticastOctets: %08lX\n", p->TxMulticastOctets );
  3224. len += sprintf(buf+len,"TxDeferredTransmissions: %08lX\n", p->TxDeferredTransmissions );
  3225. len += sprintf(buf+len,"TxSingleRetryFrames: %08lX\n", p->TxSingleRetryFrames );
  3226. len += sprintf(buf+len,"TxMultipleRetryFrames: %08lX\n", p->TxMultipleRetryFrames );
  3227. len += sprintf(buf+len,"TxRetryLimitExceeded: %08lX\n", p->TxRetryLimitExceeded );
  3228. len += sprintf(buf+len,"TxDiscards: %08lX\n", p->TxDiscards );
  3229. len += sprintf(buf+len,"RxUnicastFrames: %08lX\n", p->RxUnicastFrames );
  3230. len += sprintf(buf+len,"RxMulticastFrames: %08lX\n", p->RxMulticastFrames );
  3231. len += sprintf(buf+len,"RxFragments: %08lX\n", p->RxFragments );
  3232. len += sprintf(buf+len,"RxUnicastOctets: %08lX\n", p->RxUnicastOctets );
  3233. len += sprintf(buf+len,"RxMulticastOctets: %08lX\n", p->RxMulticastOctets );
  3234. len += sprintf(buf+len,"RxFCSErrors: %08lX\n", p->RxFCSErrors );
  3235. len += sprintf(buf+len,"RxDiscardsNoBuffer: %08lX\n", p->RxDiscardsNoBuffer );
  3236. len += sprintf(buf+len,"TxDiscardsWrongSA: %08lX\n", p->TxDiscardsWrongSA );
  3237. len += sprintf(buf+len,"RxWEPUndecryptable: %08lX\n", p->RxWEPUndecryptable );
  3238. len += sprintf(buf+len,"RxMsgInMsgFragments: %08lX\n", p->RxMsgInMsgFragments );
  3239. len += sprintf(buf+len,"RxMsgInBadMsgFragments: %08lX\n", p->RxMsgInBadMsgFragments );
  3240. len += sprintf(buf+len,"RxDiscardsWEPICVError: %08lX\n", p->RxDiscardsWEPICVError );
  3241. len += sprintf(buf+len,"RxDiscardsWEPExcluded: %08lX\n", p->RxDiscardsWEPExcluded );
  3242. #if (HCF_EXT) & HCF_EXT_TALLIES_FW
  3243. //to be added ;?
  3244. #endif // HCF_EXT_TALLIES_FW
  3245. } else if ( lp->wlags49_type & 0x8000 ) { //;?kludgy but it is unclear to me were else to place this
  3246. #if DBG
  3247. DbgInfo->DebugFlag = lp->wlags49_type & 0x7FFF;
  3248. #endif // DBG
  3249. lp->wlags49_type = 0; //default to IFB again ;?
  3250. } else {
  3251. len += sprintf(buf+len,"unknown value for wlags49_type: 0x%08lX\n", lp->wlags49_type );
  3252. len += sprintf(buf+len,"0x0000 - IFB\n" );
  3253. len += sprintf(buf+len,"0x0001 - wl_private\n" );
  3254. len += sprintf(buf+len,"0x0002 - Tallies\n" );
  3255. len += sprintf(buf+len,"0x8xxx - Change debufflag\n" );
  3256. len += sprintf(buf+len,"ERROR 0001\nWARNING 0002\nNOTICE 0004\nTRACE 0008\n" );
  3257. len += sprintf(buf+len,"VERBOSE 0010\nPARAM 0020\nBREAK 0040\nRX 0100\n" );
  3258. len += sprintf(buf+len,"TX 0200\nDS 0400\n" );
  3259. }
  3260. return len;
  3261. } // scull_read_procmem
  3262. static void proc_write(const char *name, write_proc_t *w, void *data)
  3263. {
  3264. struct proc_dir_entry * entry = create_proc_entry(name, S_IFREG | S_IWUSR, NULL);
  3265. if (entry) {
  3266. entry->write_proc = w;
  3267. entry->data = data;
  3268. }
  3269. } // proc_write
  3270. static int write_int(struct file *file, const char *buffer, unsigned long count, void *data)
  3271. {
  3272. static char proc_number[11];
  3273. unsigned int nr = 0;
  3274. DBG_FUNC( "write_int" );
  3275. DBG_ENTER( DbgInfo );
  3276. if (count > 9) {
  3277. count = -EINVAL;
  3278. } else if ( copy_from_user(proc_number, buffer, count) ) {
  3279. count = -EFAULT;
  3280. }
  3281. if (count > 0 ) {
  3282. proc_number[count] = 0;
  3283. nr = simple_strtoul(proc_number , NULL, 0);
  3284. *(unsigned int *)data = nr;
  3285. if ( nr & 0x8000 ) { //;?kludgy but it is unclear to me were else to place this
  3286. #if DBG
  3287. DbgInfo->DebugFlag = nr & 0x7FFF;
  3288. #endif // DBG
  3289. }
  3290. }
  3291. DBG_PRINT( "value: %08X\n", nr );
  3292. DBG_LEAVE( DbgInfo );
  3293. return count;
  3294. } // write_int
  3295. #endif /* SCULL_USE_PROC */
  3296. #ifdef DN554
  3297. #define RUN_AT(x) (jiffies+(x)) //"borrowed" from include/pcmcia/k_compat.h
  3298. #define DS_OOR 0x8000 //Deepsleep OutOfRange Status
  3299. lp->timer_oor_cnt = DS_OOR;
  3300. init_timer( &lp->timer_oor );
  3301. lp->timer_oor.function = timer_oor;
  3302. lp->timer_oor.data = (unsigned long)lp;
  3303. lp->timer_oor.expires = RUN_AT( 3 * HZ );
  3304. add_timer( &lp->timer_oor );
  3305. printk( "<5>wl_enable: %ld\n", jiffies ); //;?remove me 1 day
  3306. #endif //DN554
  3307. #ifdef DN554
  3308. /*******************************************************************************
  3309. * timer_oor()
  3310. *******************************************************************************
  3311. *
  3312. * DESCRIPTION:
  3313. *
  3314. *
  3315. * PARAMETERS:
  3316. *
  3317. * arg - a u_long representing a pointer to a dev_link_t structure for the
  3318. * device to be released.
  3319. *
  3320. * RETURNS:
  3321. *
  3322. * N/A
  3323. *
  3324. ******************************************************************************/
  3325. void timer_oor( u_long arg )
  3326. {
  3327. struct wl_private *lp = (struct wl_private *)arg;
  3328. /*------------------------------------------------------------------------*/
  3329. DBG_FUNC( "timer_oor" );
  3330. DBG_ENTER( DbgInfo );
  3331. DBG_PARAM( DbgInfo, "arg", "0x%08lx", arg );
  3332. printk( "<5>timer_oor: %ld 0x%04X\n", jiffies, lp->timer_oor_cnt ); //;?remove me 1 day
  3333. lp->timer_oor_cnt += 10;
  3334. if ( (lp->timer_oor_cnt & ~DS_OOR) > 300 ) {
  3335. lp->timer_oor_cnt = 300;
  3336. }
  3337. lp->timer_oor_cnt |= DS_OOR;
  3338. init_timer( &lp->timer_oor );
  3339. lp->timer_oor.function = timer_oor;
  3340. lp->timer_oor.data = (unsigned long)lp;
  3341. lp->timer_oor.expires = RUN_AT( (lp->timer_oor_cnt & ~DS_OOR) * HZ );
  3342. add_timer( &lp->timer_oor );
  3343. DBG_LEAVE( DbgInfo );
  3344. } // timer_oor
  3345. #endif //DN554
  3346. MODULE_LICENSE("Dual BSD/GPL");